/* homeview-barcode-scan-p1 parity: styles for app/nutrition.js (owned by that module).
   Mirrors FoodItemNutritionView: heading + (i), the grade centred, the basis line,
   the kcal line, then the dial grid OR the ranked panel. Colours reuse barcode.css
   tokens; the three nutrient tones are local. */
.nut {
  --nut-good: #2e7d32;
  --nut-warn: #b45309;
  --nut-neutral: #6b7280;
  --nut-track: var(--line);
  display: flex; flex-direction: column; gap: 0.5em;
}
/* Dark follows the PAGE's mode (<html data-mode>, set by the theme boot from
   the reader's choice, else prefers-color-scheme), not the media query alone:
   a reader who long-presses the mark to light keeps light tones. */
:root[data-mode="dark"] .nut { --nut-good: #81c784; --nut-warn: #f6ad55; --nut-neutral: #a3a3a3; }
.nut .nut-head { display: flex; align-items: center; justify-content: space-between; }
.nut .nut-head h2 { margin: 0; }
.nut-info {
  min-width: 44px; min-height: 44px; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 999px;
}
.nut-info:focus-visible, .expander:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Rows and dial tiles span their list: the ring sits INSIDE them (owner, 2026-12-02: it ran past
   the right edge and was clipped). */
.nut .tap:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.nut .tap { background: transparent; color: inherit; font: inherit; text-align: start; border: 0; padding: 0; cursor: pointer; }

.nut-grade { display: flex; flex-direction: column; align-items: center; gap: 0.2em; }
.nut-grade .grade.big, .why-badge .grade.big { width: 2.6em; height: 2.6em; font-size: 1.5em; border-radius: 0.5em; }
.nut-grade .grade-tap { min-height: 44px; border-radius: 0.6em; }
/* The drawn grade mark sits CENTRED, as the app's (its tap target is the
   framework's full-width .tap, which starts its content). */
.nut-grade .tap { justify-content: center; }
.grade-origin { font-size: 0.8em; color: var(--muted); }
/* NutriGradeWhyLink (nutrition_grade_why_overlay.dart:375): caption size,
   secondary colour, underlined (the underline is what says "tappable"), an
   8 px pad all round as the app's spacing.sm, centred under the badge. */
.nut .nut-why-link { background: transparent; border: 0; font: inherit; cursor: pointer; font-size: 0.8em; color: var(--muted); text-decoration: underline; text-decoration-color: var(--muted); padding: 8px; border-radius: 999px; text-align: center; }
.grade-na { color: var(--muted); font-size: 0.9em; min-height: 44px; }

.nut-basis { color: var(--muted); font-size: 0.95em; margin: 0; }
/* The page's own caption: standard daily values, not the reader's targets. */
.nut-dv-basis { color: var(--muted); font-size: 0.8em; margin: 0; }
.kcal { display: inline-flex; align-items: center; gap: 0.4em; min-height: 44px; }
.kcal-num { font-size: 1.5em; font-weight: 800; }
.kcal-tail { color: var(--muted); font-weight: 600; font-size: 0.9em; }
.advisory { color: var(--nut-warn); font-size: 0.85em; margin: 0; }

/* The flat dial grid: the app's TILES (nutrient_circles_grid.dart
   _buildNutrientCircle). Tone tokens come from the app's palette files,
   per <html data-pal> (nutrition.js dialPalette sets --nut-<pal>-<token>);
   1em = 16px reproduces the app's logical px. Layout (_dialWrap,
   dialCardWidth): tiles at half the width less the 8px gap, capped at the
   designed 200px (12.5em), as many to a row as fit, every row centred. */
.nut {
  --nut-d-good: var(--nut-pink-good, #1B5E20);
  --nut-d-warn: var(--nut-pink-warn, #8A3F00);
  --nut-d-quiet: var(--nut-pink-quiet, #6D5560);
  --nut-d-secondary: var(--nut-pink-secondary, #5A4450);
  --nut-d-divider: var(--nut-pink-divider, #F4A8C8);
  --nut-d-surface: var(--nut-pink-surface, #FFEAF3);
  --nut-d-outline: var(--nut-pink-outlineAlpha, 0.64);
}
:root[data-pal="kiwi"] .nut {
  --nut-d-good: var(--nut-kiwi-good, #2E7D32);
  --nut-d-warn: var(--nut-kiwi-warn, #B45309);
  --nut-d-quiet: var(--nut-kiwi-quiet, #666666);
  --nut-d-secondary: var(--nut-kiwi-secondary, #4A5043);
  --nut-d-divider: var(--nut-kiwi-divider, #D0E2B8);
  --nut-d-surface: var(--nut-kiwi-surface, #F6FAEE);
  --nut-d-outline: var(--nut-kiwi-outlineAlpha, 0.74);
}
:root[data-pal="golden"] .nut {
  --nut-d-good: var(--nut-golden-good, #2F5417);
  --nut-d-warn: var(--nut-golden-warn, #C2410C);
  --nut-d-quiet: var(--nut-golden-quiet, #6D5549);
  --nut-d-secondary: var(--nut-golden-secondary, #5D4037);
  --nut-d-divider: var(--nut-golden-divider, #D7CCC8);
  --nut-d-surface: var(--nut-golden-surface, #FFFEF5);
  --nut-d-outline: var(--nut-golden-outlineAlpha, 0.7);
}
/* Dark mode: the same tokens from the app's dark palette files
   (colors_dark_pink.json, colors_dark.json; build-barcode-shared.mjs). */
:root[data-mode="dark"] .nut {
  --nut-d-good: var(--nut-pinkDark-good, #66BB6A);
  --nut-d-warn: var(--nut-pinkDark-warn, #FFA726);
  --nut-d-quiet: var(--nut-pinkDark-quiet, #BC9AA4);
  --nut-d-secondary: var(--nut-pinkDark-secondary, #DCB8C2);
  --nut-d-divider: var(--nut-pinkDark-divider, #43222A);
  --nut-d-surface: var(--nut-pinkDark-surface, #2D1217);
  --nut-d-outline: var(--nut-pinkDark-outlineAlpha, 0.56);
}
:root[data-pal="kiwi"][data-mode="dark"] .nut {
  --nut-d-good: var(--nut-kiwiDark-good, #66BB6A);
  --nut-d-warn: var(--nut-kiwiDark-warn, #FFA726);
  --nut-d-quiet: var(--nut-kiwiDark-quiet, #A0A0A0);
  --nut-d-secondary: var(--nut-kiwiDark-secondary, #C0C0C0);
  --nut-d-divider: var(--nut-kiwiDark-divider, #1F3528);
  --nut-d-surface: var(--nut-kiwiDark-surface, #13241A);
  --nut-d-outline: var(--nut-kiwiDark-outlineAlpha, 0.56);
}
:root[data-pal="golden"][data-mode="dark"] .nut {
  --nut-d-good: var(--nut-goldenDark-good, #8FBF5E);
  --nut-d-warn: var(--nut-goldenDark-warn, #FF7043);
  --nut-d-quiet: var(--nut-goldenDark-quiet, #B0A18C);
  --nut-d-secondary: var(--nut-goldenDark-secondary, #C4B5A0);
  --nut-d-divider: var(--nut-goldenDark-divider, #4A3A2E);
  --nut-d-surface: var(--nut-goldenDark-surface, #33271F);
  --nut-d-outline: var(--nut-goldenDark-outlineAlpha, 0.66);
}
.nut-tiles {
  list-style: none; margin: 0.3em 0 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5em;
}
.nut-tiles-cell { flex: 0 0 min(12.5em, calc((100% - 0.5em) / 2)); display: flex; min-width: 0; }
.nut .tap.nut-tile {
  position: relative; width: 100%; min-height: 44px; box-sizing: border-box;
  padding: 0.5em; border: 1px solid var(--nut-d-divider); border-radius: 0.75em;
  display: flex; flex-direction: column; align-items: center;
}
.nut-tile-body { display: flex; flex-direction: column; align-items: center; width: 100%; }
/* The ring: 60px, a 5px band, the value + unit and the caption inside. */
.nut-tile-dial { --nut-tone: var(--nut-d-quiet); position: relative; width: 3.75em; height: 3.75em; display: grid; place-items: center; }
.nut-tile-dial.nut-tone-good { --nut-tone: var(--nut-d-good); }
.nut-tile-dial.nut-tone-warn { --nut-tone: var(--nut-d-warn); }
.nut-tile-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.nut-tile-track { stroke: color-mix(in srgb, var(--nut-tone) 15%, transparent); }
.nut-tile-arc { stroke: var(--nut-tone); }
/* nutrientDialArcColor: a moderate arc is the tone half-way to the surface. */
.nut-tile-dial.nut-p-moderate .nut-tile-arc { stroke: color-mix(in srgb, var(--nut-tone) 50%, var(--nut-d-surface)); }
.nut-tile-center {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  max-width: 3em; /* kDialInnerClear: the band's clear inner diameter */
  line-height: 1;
}
.nut-tile-value { display: inline-flex; align-items: baseline; white-space: nowrap; }
.nut-tile-num { font-weight: 700; font-size: 0.9375em; }
.nut-tile-unit { font-size: 0.625em; color: var(--muted); }
.nut-tile-pct { margin-top: 2px; font-size: 0.625em; font-weight: 600; color: var(--nut-tone); white-space: nowrap; }
.nut-tile-name { margin-top: 0.25em; font-size: 0.75em; text-align: center; line-height: 1.25; overflow-wrap: anywhere; }
/* The identity pill (NutrientGlyph): 22px tall, at most 40px, w700 11px. */
.nut-tile-pill {
  --nut-hue: var(--nut-d-secondary);
  position: absolute; top: 4px; inset-inline-start: 6px;
  box-sizing: border-box; font-size: 0.6875em; font-weight: 700; line-height: 1; white-space: nowrap;
  height: 2em; max-width: 3.64em; padding: 0 0.545em; border-radius: 0.545em; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid color-mix(in srgb, var(--nut-d-quiet) 12%, transparent);
  color: color-mix(in srgb, var(--nut-d-quiet) 50%, transparent);
}
.nut-tile-pill.nut-h-good, .nut-tile-badge.nut-h-good { --nut-hue: var(--nut-d-good); }
.nut-tile-pill.nut-h-warn, .nut-tile-badge.nut-h-warn { --nut-hue: var(--nut-d-warn); }
.nut-tile-pill.nut-p-moderate {
  color: var(--nut-hue);
  border-color: color-mix(in srgb, var(--nut-hue) calc(var(--nut-d-outline) * 100%), transparent);
}
.nut-tile-pill.nut-p-significant {
  color: var(--nut-hue); border-color: transparent;
  background: color-mix(in srgb, var(--nut-hue) 15%, transparent);
}
/* Corner chrome (the sugar (i), textSecondary) over the benefit badges
   (NutrientProminenceBadge: 26px, 16px glyph, a 2px outline or a fill). */
.nut-tile-marks {
  position: absolute; top: 0; inset-inline-end: 0;
  display: flex; flex-direction: column; align-items: flex-end;
}
.nut-tile-chrome { display: inline-grid; place-items: center; padding: 4px; color: var(--nut-d-secondary); }
.nut-tile-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 4px; padding-inline-end: 6px; }
.nut-tile-badge {
  --nut-hue: var(--nut-d-good);
  box-sizing: border-box; width: 1.625em; height: 1.625em; border-radius: 0.4875em;
  display: inline-grid; place-items: center;
  border: 2px solid color-mix(in srgb, var(--nut-d-quiet) 12%, transparent);
  color: color-mix(in srgb, var(--nut-d-quiet) 50%, transparent);
}
.nut-tile-badge .nut-glyph-icon { width: 1em; height: 1em; }
.nut-tile-badge.nut-p-moderate { color: var(--nut-hue); border-color: color-mix(in srgb, var(--nut-hue) 15%, transparent); }
.nut-tile-badge.nut-p-significant { color: var(--nut-hue); border-color: transparent; background: color-mix(in srgb, var(--nut-hue) 15%, transparent); }

/* The ranked panel: Worth getting / watching / knowing. */
.panel { display: flex; flex-direction: column; gap: 0.8em; margin-top: 0.3em; }
/* Owner 2026-12-01 ("styled like the app, one color"): the app's NutrientSectionHeader keeps the
   LABEL in textPrimary at w700 in every section ("which is what keeps it legible in all 15
   palettes"); the section's tone lives on the rows (chips, bars), not the heading. */
.psec h3 { font-size: 1em; margin: 0 0 0.3em; color: var(--ink); font-weight: 700; }
.prows { list-style: none; margin: 0; padding: 0; }
.prows[hidden] { display: none; }
.prow {
  display: grid; grid-template-columns: auto 1fr auto auto auto; grid-template-areas: 'chip name glyphs amt pct' 'bar bar bar bar bar';
  /* One centre line for chip, name, glyph pills, amount and %DV (owner 2026-12-01: on baselines the
     chip and pills sat lower than the words). The bar keeps its own row underneath. */
  align-items: center; gap: 0.1em 0.6em; width: 100%; min-height: 44px; padding: 0.35em 0;
  border-bottom: 1px solid var(--line);
}
.prow-name { grid-area: name; }
.prow.significant .prow-name { font-weight: 700; }
.prow-amt { grid-area: amt; font-variant-numeric: tabular-nums; }
.prow-pct { grid-area: pct; color: var(--muted); font-size: 0.85em; font-variant-numeric: tabular-nums; }
.nut-bar { grid-area: bar; height: 4px; border-radius: 2px; background: var(--nut-track); overflow: hidden; }
.nut-bar-fill { display: block; height: 100%; background: var(--nut-neutral); }
.prow.getting .nut-bar-fill { background: var(--nut-good); }
.prow.watching .nut-bar-fill { background: var(--nut-warn); }
/* The identity pill (NutrientGlyph) and the benefit glyph tiles
   (NutrientProminenceBadge): coloured at a standout, muted below one, in the
   section's register; decorative (aria-hidden). */
.nut-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.6em; padding: 0.05em 0.35em; border: 1.5px solid var(--line); border-radius: 0.45em;
  font-size: 0.75em; font-weight: 600; line-height: 1.5; color: var(--muted); white-space: nowrap;
  align-self: center;
}
.prow .nut-chip { grid-area: chip; }
.prow .nut-bar { align-self: auto; }
.nut-glyphs { grid-area: glyphs; display: inline-flex; gap: 3px; align-self: center; color: var(--muted); }
.nut-glyph {
  /* Sized to ONE text line of the row (1lh; 1.3em = the row's line-height where lh is unsupported),
     so a pill never makes its row taller than a word does. */
  display: inline-grid; place-items: center; box-sizing: border-box;
  width: 1.3em; height: 1.3em; width: 1lh; height: 1lh;
  border: 1.5px solid var(--line); border-radius: 0.45em;
}
.nut-glyph-icon { width: 1.05em; height: 1.05em; }
.nut-chip.nut-is-getting.nut-is-significant, .nut-glyphs.nut-is-getting.nut-is-significant { color: var(--nut-good); }
.nut-chip.nut-is-getting.nut-is-significant, .nut-glyphs.nut-is-getting.nut-is-significant .nut-glyph { border-color: var(--nut-good); }
.nut-chip.nut-is-watching.nut-is-significant, .nut-glyphs.nut-is-watching.nut-is-significant { color: var(--nut-warn); }
.nut-chip.nut-is-watching.nut-is-significant, .nut-glyphs.nut-is-watching.nut-is-significant .nut-glyph { border-color: var(--nut-warn); }
.nut-chip.nut-is-getting.nut-is-moderate, .nut-glyphs.nut-is-getting.nut-is-moderate { color: var(--nut-good); }
.nut-chip.nut-is-watching.nut-is-moderate, .nut-glyphs.nut-is-watching.nut-is-moderate { color: var(--nut-warn); }
.nut-chip.nut-is-knowing.nut-is-significant { color: var(--ink); border-color: var(--nut-neutral); }
.nut-chip-cal { font-size: 0.8em; }
.expander { background: transparent; color: var(--accent-ink); font: inherit; font-size: 0.9em; padding: 0.4em 0; min-height: 44px; text-align: start; border: 0; cursor: pointer; }
.see-all, .why-full {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  min-height: 44px; color: var(--accent-ink); font-weight: 600;
}

.nut-foot p, .nut .fine, .sheet .fine { color: var(--muted); font-size: 0.75em; margin: 0.2em 0 0; }

/* Sheets this module opens. */
.ni { display: flex; flex-direction: column; gap: 0.5em; }
.ni-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2em 0.8em; }
.ni-amount { font-size: 1.4em; font-weight: 800; }
.ni-pct { font-weight: 600; }
.ni-basis { color: var(--muted); font-size: 0.85em; width: 100%; }
.ni-headline { font-weight: 700; margin: 0; }
/* The benefit lines, each beside its glyph (web-benefit-glyphs-explained): the first is the headline. */
.ni-benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.375em; }
.ni-benefits li { display: flex; align-items: center; gap: 0.5em; }
.ni-benefits .ni-headline { font-weight: 700; }
.ni-benefit-glyph { flex: none; display: inline-flex; inline-size: 1.25em; block-size: 1.25em; color: var(--nut-good); }
.ni-benefit-glyph svg { inline-size: 100%; block-size: 100%; }
.ni-applies { margin: 0; }
.ni-applies.good strong { color: var(--nut-good); }
.ni-applies.warn strong { color: var(--nut-warn); }
.ni-body { color: var(--muted); margin: 0; }
.ni-sources-h { font-size: 0.8em; margin: 0.4em 0 0; color: var(--muted); }
.all-nutrients { list-style: none; margin: 0; padding: 0; }
.all-row {
  display: grid; grid-template-columns: 1fr auto 5.5em; gap: 0.6em; width: 100%;
  min-height: 44px; align-items: center; border-bottom: 1px solid var(--line);
}
.all-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.all-pct { color: var(--muted); font-size: 0.85em; text-align: end; }
.why { display: flex; flex-direction: column; gap: 0.5em; }
.why-badge { display: flex; justify-content: center; }
.why-intro { color: var(--muted); margin: 0; }
.why-verdict, .why-helped { margin: 0.3em 0 0; }
.why-helped { font-weight: 600; }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3em; }
.why-factor { display: flex; gap: 0.5em; align-items: flex-start; }
.why-factor.up .why-arrow { color: var(--nut-good); }
.why-factor.down .why-arrow { color: #d32f2f; }
:root[data-mode="dark"] .why-factor.down .why-arrow { color: #ef5350; } /* the dark palette's error */
.why-sub { display: block; color: var(--muted); font-size: 0.8em; }

/* grade-sheet-one-explanation: the basis, said once above the rows. */
.why-basis { margin: 0.3em 0 0; font-size: 0.85em; color: var(--muted); }
