.product-data-naehrwerte {
    padding-top: 20px;
    color: var(--nutritional-table-text-color, var(--color-primary, currentColor));
    line-height: 1.6;
    font-size: 1rem;
}

.nutri-marker {
    display: inline-flex;
    width: var(--nutritional-table-marker-size, 16px);
    height: var(--nutritional-table-marker-size, 16px);
    color: var(--nutritional-table-marker-color, var(--color-primary, currentColor));
}

.nutri-marker svg {
    width: 100%;
    height: 100%;
}

.product-data-naehrwerte-title {
    color: var(--color-primary, currentColor);
    font-size: 2.5rem;
    text-transform: uppercase;
    font-weight: normal;
    margin-bottom: 30px;
    letter-spacing: 2px;
}

.nutritional-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.nutritional-table td {
    padding: 15px 10px;
    border: none;
    /* Row rule lives on the CELLS, not the <tr>: under border-collapse a <tr> border
       paints faint, while cell borders paint crisp — the same gold as the column
       rules and the text. */
    border-bottom: var(--nutritional-table-row-border, 1px solid var(--color-primary, currentColor));
    /* Live renders NÄHRWERTE cells at 18px; override the global `table td { font-size: .85rem }`. */
    font-size: var(--nutritional-table-cell-size, 1.125rem);
    line-height: 1.4;
}

/* Live draws no rule under the last row. */
.nutritional-table tr:last-child td {
    border-bottom: var(--nutritional-table-bottom-border, none);
}

/* NÄHRWERTE is a full grid on live: 1px gold rules on the rows PLUS vertical
   separators between the value columns, all the same gold as the text. Every cell
   after the first in its row gets a left rule -> continuous vertical lines with
   border-collapse. Allergene (icon list) stays rows-only, so it is excluded. */
.nutritional-table:not(.nutritional-table--allergens) td + td {
    border-left: var(--nutritional-table-col-border, 1px solid var(--color-primary, currentColor));
}

/* Allergene cells are larger on live (20px vs the 18px nutrition grid). */
.nutritional-table--allergens td {
    font-size: var(--nutritional-table-allergen-cell-size, 1.25rem);
}

.nutritional-table td.header-cell {
    color: var(--color-primary, currentColor);
    font-weight: normal;
}

/* Nährwerte's header row is centred on live; Allergene doesn't currently render
   a header-cell at all (headerFirstRow: false there), but excluding it here
   keeps this rule honest about what it's for and safe if that ever changes —
   same reasoning as the column-border and width rules above. */
.nutritional-table:not(.nutritional-table--allergens) td.header-cell {
    text-align: center;
}

/* Nährwerte columns default to content-based auto width, which lets the long
   "% Referenzmenge..." header stretch its column far past the others (measured
   560px vs ~250px). Fixed layout + explicit shares keeps every column the same
   proportion regardless of header text length, matching live's tighter columns;
   the long header just wraps onto a second line instead. Allergene keeps its
   own (already-correct) auto layout — excluded here as elsewhere in this file. */
.nutritional-table:not(.nutritional-table--allergens) {
    table-layout: fixed;
}

.nutritional-table:not(.nutritional-table--allergens) td:first-child {
    width: 22%;
}

.nutritional-table:not(.nutritional-table--allergens) td:not(:first-child) {
    width: 26%;
}

.nutritional-table td.label-cell {
    text-align: left;
    font-weight: bold;
}

.nutritional-table td.value-cell {
    text-align: center;
}

/* Legend: small note under the table (live: 12px, gold). */
.nutritional-table-legend {
    font-size: var(--nutritional-table-legend-size, 0.75rem);
    color: var(--nutritional-table-note-color, var(--color-primary, currentColor));
    margin-top: 20px;
    margin-bottom: 10px;
}

/* Disclaimer paragraph under the table (live: 16px, gold). */
.nutritional-table-disclaimer {
    font-size: var(--nutritional-table-disclaimer-size, 1rem);
    color: var(--nutritional-table-note-color, var(--color-primary, currentColor));
    line-height: 1.5;
    margin-bottom: 20px;
}

/* --- MOBILE: the tables must fit the narrow viewport instead of overflowing --- */
@media (max-width: 767px) {
    /* Allergene uses a fixed layout so its columns respect the container and wrap. */
    .nutritional-table--allergens {
        table-layout: fixed;
        width: 100%;
    }
    .nutritional-table td {
        font-size: var(--nutritional-table-cell-size-mobile, 14px);
        padding: 12px 6px;
        overflow-wrap: anywhere;
        line-height: 1.35;
        vertical-align: top;
    }
    /* Allergene reads as a list: a tight marker column, the name, then the wrapping
       description — all left-aligned so it doesn't spread across the row. */
    .nutritional-table--allergens td,
    .nutritional-table--allergens td.value-cell,
    .nutritional-table--allergens td.label-cell {
        font-size: var(--nutritional-table-allergen-cell-size-mobile, 14px);
        text-align: left;
    }
    /* Col 1 holds either the ✕/✓ marker OR a section title ("Ernährungsweisen").
       Keep it on ONE line (no per-character wrap) and let a title overflow into the
       empty cells 2-3 of its own row instead of breaking apart in the 28px column. */
    .nutritional-table--allergens td:first-child {
        width: 28px;
        white-space: nowrap;
        overflow: visible;
    }
    .nutritional-table--allergens td:nth-child(2) {
        width: 92px;
        font-weight: 700;
    }
    /* Nährwerte is dense numeric data: let it scroll sideways rather than crush the
       columns into unreadable wraps. */
    .product-data-naehrwerte:not(:has(.nutritional-table--allergens)) {
        overflow-x: auto;
    }
}
