/* LabelLie — "back of the pack" design system.
   Borrowed from what LabelLie reads: claims set like front-of-pack type (Archivo, condensed, heavy),
   verdicts printed like the dot-matrix batch-code stamp (Doto), data framed like a nutrition panel
   (thick ink rules). Colours from an Indian kitchen: turmeric accent, chilli / slate / leaf verdicts.
   Turmeric is a FILL only (2.45:1 on white); text uses turmeric-ink. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Doto";
  src: url("fonts/doto-latin-var.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --sans: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: var(--sans);                       /* headings use Archivo condensed (see h2, .page-title) */
  --stamp: "Doto", "Courier New", monospace;  /* dot-matrix: verdict stamps only */
  --mono: "Cascadia Mono", Consolas, monospace; /* raw OCR text only */
  --condensed: 72%;

  --paper: #f6f7f4;
  --surface: #ffffff;
  --surface-alt: #f1f2ee;
  --ink: #14171a;
  --muted: #5a6168;
  --line: #dde0da;
  --line-strong: #14171a;                     /* nutrition-panel rules are ink, not grey */
  --control-line: #7c838a;
  --control-line-hover: #4c5258;
  --accent: #8f6300;                          /* turmeric ink: links, small accents (5.3:1) */
  --accent-hover: #6f4c00;
  --accent-fill: #d99a00;                     /* turmeric: buttons, bars, underlines */
  --accent-fill-hover: #c48a00;
  --accent-ink: #14171a;                      /* text on turmeric (7.3:1) */
  --chart-1: #a87400;                         /* single-series bars (4.1:1 on white) */
  --focus: #14171a;

  --supported: #2f7d4a;
  --supported-bg: #e8f3ec;
  --supported-border: #a9d2b6;
  --misleading: #c8371d;
  --misleading-bg: #fcebe7;
  --misleading-border: #efb3a6;
  --misleading-wash: #fdf4f1;
  --insufficient: #3f5a78;
  --insufficient-bg: #eaeff5;
  --insufficient-border: #b9c7d8;
  --neutral: #5a6168;
  --neutral-bg: #eff0ee;
  --neutral-border: #cfd3cd;

  --error: #b3311a;
  --error-bg: #fcebe7;
  --error-border: #efb3a6;

  --radius: 3px;
  --shell: 1240px;
  --measure: 72ch;

  /* Dashboard chart series (validated with the dataviz palette checker, light surface #fff) */
  --viz-misleading: #f47230;
  --viz-insufficient: #257de0;
  --viz-supported: #008a17;
}

/* Dark palette: follows Windows unless the viewer picked a theme with the header toggle (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #121417;
    --surface: #1a1d21;
    --surface-alt: #20242a;
    --ink: #eef0ec;
    --muted: #a3aab0;
    --line: #2c3138;
    --line-strong: #eef0ec;
    --control-line: #6b737c;
    --control-line-hover: #959da5;
    --accent: #f0b429;
    --accent-hover: #f7c95a;
    --accent-fill: #f0b429;
    --accent-fill-hover: #f7c95a;
    --accent-ink: #14171a;
    --chart-1: #f0b429;
    --focus: #f0b429;

    --supported: #6cc48a;
    --supported-bg: #17271d;
    --supported-border: #2d5a3c;
    --misleading: #ff7a5c;
    --misleading-bg: #2e1a15;
    --misleading-border: #6e3326;
    --misleading-wash: #24171a;
    --insufficient: #9db4cf;
    --insufficient-bg: #1b2430;
    --insufficient-border: #34475e;
    --neutral: #a3aab0;
    --neutral-bg: #22262b;
    --neutral-border: #3a4048;

    --error: #ff7a5c;
    --error-bg: #2e1a15;
    --error-border: #6e3326;

    /* dark steps of the same three hues, validated against the dark surface */
    --viz-misleading: #e76624;
    --viz-insufficient: #338ced;
    --viz-supported: #0aac23;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121417;
  --surface: #1a1d21;
  --surface-alt: #20242a;
  --ink: #eef0ec;
  --muted: #a3aab0;
  --line: #2c3138;
  --line-strong: #eef0ec;
  --control-line: #6b737c;
  --control-line-hover: #959da5;
  --accent: #f0b429;
  --accent-hover: #f7c95a;
  --accent-fill: #f0b429;
  --accent-fill-hover: #f7c95a;
  --accent-ink: #14171a;
  --chart-1: #f0b429;
  --focus: #f0b429;

  --supported: #6cc48a;
  --supported-bg: #17271d;
  --supported-border: #2d5a3c;
  --misleading: #ff7a5c;
  --misleading-bg: #2e1a15;
  --misleading-border: #6e3326;
  --misleading-wash: #24171a;
  --insufficient: #9db4cf;
  --insufficient-bg: #1b2430;
  --insufficient-border: #34475e;
  --neutral: #a3aab0;
  --neutral-bg: #22262b;
  --neutral-border: #3a4048;

  --error: #ff7a5c;
  --error-bg: #2e1a15;
  --error-border: #6e3326;

  /* dark steps of the same three hues, validated against the dark surface */
  --viz-misleading: #e76624;
  --viz-insufficient: #338ced;
  --viz-supported: #0aac23;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, dl, dd, figure, blockquote { margin: 0; }
ul, ol { margin: 0; }
img { max-width: 100%; }

::selection { background: var(--supported-bg); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 32px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- typography ---------- */
.eyebrow {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--muted);
}
.field-label {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
}
.field-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
h2 {
  font-family: var(--sans);
  font-stretch: var(--condensed);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.005em;
}
h3 { font-size: 15px; font-weight: 700; line-height: 1.35; }

/* ---------- header ---------- */
.app-header {
  border-bottom: 3px solid var(--line-strong);   /* the panel's top rule */
  background: var(--paper);
}
.header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-block: 20px 18px;
}
.wordmark {
  font-family: var(--sans);
  font-stretch: 62%;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;                    /* set like a brand name on a pack */
}
.wordmark a, .wordmark { text-decoration: underline 5px var(--accent-fill); text-underline-offset: 5px; }
.identity-note {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.wordmark a { color: inherit; text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.site-nav a {
  padding: 6px 0 4px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a { font-size: 14.5px; font-weight: 600; }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom: 4px solid var(--accent-fill); }

.notice {
  border-bottom: 1px solid var(--line);
  padding-block: 11px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}
.notice strong { color: var(--ink); font-weight: 600; }

/* ---------- workspace ---------- */
#workspace { flex: 1 0 auto; }

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  align-items: start;
  gap: 48px;
  padding-block: 36px 56px;
}
.rail, .pane { min-width: 0; }

.rail {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.rail h2 { margin-top: 6px; }
.rail-intro {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.pane > .pane-state > h2,
#results > .results-head h2 { margin-top: 6px; }
.pane-state > .eyebrow { margin-bottom: 0; }

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 28px;
  margin: 20px 0 18px;
  border-bottom: 1px solid var(--line-strong);
}
.tab {
  margin-bottom: -1px;
  padding: 9px 2px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 500 13px/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab:focus-visible { outline-offset: -2px; }

/* ---------- panels ---------- */
.panel { border: 0; padding: 0; margin: 0; }

.drop {
  padding: 24px 16px;
  cursor: pointer;
  border: 1px dashed var(--control-line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  text-align: center;
  transition: border-color .12s ease, background-color .12s ease;
}
.drop.over {
  border-color: var(--accent);
  background: var(--paper);
}
.drop-title { font-size: 14px; font-weight: 600; }
.drop-hint {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.drop .btn { margin-top: 12px; }
.drop .field-note { margin-top: 10px; }
.panel > .field-note { margin-top: 10px; }

.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}
.thumb {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.thumb-frame { position: relative; background: var(--paper); border-bottom: 1px solid var(--line); }
.thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.thumb-index {
  position: absolute;
  top: 7px;
  left: 7px;
  padding: 1px 5px;
  background: var(--ink);
  color: var(--surface);
  font: 10.5px/1.5 var(--sans);
}
.thumb-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px 2px 8px;
}
.thumb-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 10.5px/1.4 var(--sans);
  color: var(--muted);
}
.thumb-remove {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 11px/1 var(--sans);
  text-decoration: underline;
  cursor: pointer;
}
.thumb-remove:hover { color: var(--error); }

textarea {
  display: block;
  width: 100%;
  min-height: 196px;
  margin-top: 6px;
  padding: 10px 11px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--ink);
  font: 12.5px/1.6 var(--mono);
  resize: vertical;
}
textarea::placeholder { color: var(--muted); opacity: .8; }
textarea:focus-visible { outline-offset: 1px; border-color: var(--accent); }

.btn-link {
  margin-top: 8px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: 500 12.5px/1.4 var(--sans);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.btn-link:hover { color: var(--accent-hover); }

/* ---------- form controls ---------- */
.field-group {
  margin: 20px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.field-group legend { padding: 0; margin-bottom: 8px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 460px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.segment { position: relative; cursor: pointer; }
.segment + .segment { border-left: 1px solid var(--control-line); }
.segment input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.segment span {
  display: block;
  padding: 9px 12px 10px;
  transition: background-color .12s ease;
}
.segment strong { display: block; font-size: 13px; font-weight: 600; }
.segment small { display: block; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.segment input:checked + span {
  background: var(--surface-alt);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.segment span:hover { background: var(--surface-alt); }
.segment input:focus-visible { outline: none; }
.segment input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 20px;
}
.check-row input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 3px 0 0;
  accent-color: var(--accent);
}
.check-label { font-size: 13px; font-weight: 500; line-height: 1.4; }
.check-row .field-note { margin-top: 2px; }
.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--control-line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  vertical-align: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: 500 13.5px/1.2 var(--sans);
  text-align: center;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn-primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-ink);
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn-primary:focus-visible { outline-color: var(--ink); outline-offset: 3px; }
.btn-outline {
  background: transparent;
  border-color: var(--control-line);
  color: var(--ink);
}
.btn-outline:hover:not(:disabled) { border-color: var(--control-line-hover); }
.btn-quiet {
  background: var(--surface);
  border-color: var(--control-line);
  color: var(--ink);
}
.btn-quiet:hover:not(:disabled) { border-color: var(--control-line-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
#analyse { width: 100%; max-width: 360px; min-height: 44px; margin-top: 4px; }

.rail[aria-busy="true"] .drop,
.rail[aria-busy="true"] textarea,
.rail[aria-busy="true"] .segmented,
.rail[aria-busy="true"] .check-row { opacity: .55; }

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}
.status:empty { min-height: 0; margin-top: 0; }
.rail-timer {
  margin-top: 2px;
  font: 11.5px/1.4 var(--sans);
  color: var(--muted);
}

.status.is-error {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border-left: 2px solid var(--error);
  background: var(--error-bg);
  color: var(--error);
}
.status-hint { display: block; margin-top: 2px; color: var(--muted); }
.spinner {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- method pane ---------- */
.method-list {
  margin-top: 18px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}
.method-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.method-num {
  padding-top: 2px;
  font: 11px/1.4 var(--sans);
  color: var(--muted);
}
.method-list h3 { margin-bottom: 2px; }
.method-list p { font-size: 13px; line-height: 1.55; color: var(--muted); }

.legend { margin-top: 34px; }
.legend h3, .limits h3 { margin-bottom: 10px; }
.legend-list { border-top: 1px solid var(--line); }
.legend-item {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.legend-item dt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}
.legend-item dd { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.legend-item--misleading { --v: var(--misleading); }
.legend-item--insufficient { --v: var(--insufficient); }
.legend-item--supported { --v: var(--supported); }
.legend-item--neutral { --v: var(--neutral); }
.verdict-mark {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: var(--v, var(--neutral));
}

.limits { margin-top: 34px; }
.limits ul { padding-left: 16px; }
.limits li {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* ---------- processing ---------- */
.processing { max-width: 560px; }
.processing-time {
  margin-top: 4px;
  font: 12.5px/1.5 var(--sans);
  color: var(--muted);
}
.progress {
  height: 2px;
  margin: 14px 0 12px;
  background: var(--line);
  overflow: hidden;
}
.progress span {
  display: block;
  width: 34%;
  height: 100%;
  background: var(--accent);
  animation: progress 1.5s ease-in-out infinite;
}
@keyframes progress {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(320%); }
}

/* ---------- results ---------- */
.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
}
.results-meta { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.results-head .btn { flex: 0 0 auto; margin-top: 4px; }

.tally {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 20px;
  border-block: 1px solid var(--line-strong);
  background: var(--line);
}
.tally-item {
  min-width: 0;
  padding: 12px 14px 11px;
  background: var(--surface);
  border-top: 2px solid var(--v, var(--neutral));
}
.tally-item--misleading { --v: var(--misleading); }
.tally-item--insufficient { --v: var(--insufficient); }
.tally-item--supported { --v: var(--supported); }
.tally-item--neutral { --v: var(--neutral); }
.tally-count {
  display: block;
  font-stretch: var(--condensed);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: var(--v);
}
.tally-label {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.tally-meaning {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}
.tally-item.is-zero .tally-count { color: var(--muted); }
.tally-item.is-zero .tally-label { color: var(--muted); }
.summary-note { margin-top: 10px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

.claims-section { margin-top: 32px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}
.section-note { font-size: 12px; line-height: 1.4; color: var(--muted); text-align: right; overflow-wrap: anywhere; }

.claim {
  overflow-wrap: anywhere;
  padding: 18px 0 20px 18px;
  border-left: 3px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.claim--misleading {
  border-left-color: var(--misleading);
  background: var(--misleading-wash);
  padding-right: 16px;
}
.claim--insufficient { border-left-color: var(--insufficient); }
.claim--supported { border-left-color: var(--supported); }
.claim--neutral { border-left-color: var(--neutral); }
.claim-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.claim-ident { min-width: 0; }
.claim-meta { font-size: 12px; line-height: 1.45; color: var(--muted); }
.claim-text {                                  /* the claim, set like front-of-pack type */
  margin-top: 4px;
  font-stretch: var(--condensed);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .005em;
  overflow-wrap: anywhere;
}
.claim-explanation { margin-top: 10px; font-size: 14px; line-height: 1.6; }
.claim-caveat {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* The one bold element: verdicts printed like the dot-matrix batch-code stamp on a pack
   ("BEST BEFORE 03/27"). Upper case and the slight tilt are part of that vernacular, used only here. */
.verdict {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 4px;
  border: 2px solid currentColor;
  border-radius: var(--radius);
  background: transparent;
  color: var(--v, var(--neutral));
  font-family: var(--stamp);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: rotate(-2deg);
}
.verdict .verdict-mark { display: none; }
.verdict--misleading { --v: var(--misleading); --v-bg: var(--misleading-bg); --v-border: var(--misleading-border); }
.verdict--insufficient { --v: var(--insufficient); --v-bg: var(--insufficient-bg); --v-border: var(--insufficient-border); }
.verdict--supported { --v: var(--supported); --v-bg: var(--supported-bg); --v-border: var(--supported-border); }
.verdict--neutral { --v: var(--neutral); --v-bg: var(--neutral-bg); --v-border: var(--neutral-border); }

.evidence {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 20px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.evidence-item { min-width: 0; }
.evidence-item dt {
  margin-bottom: 2px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--muted);
}
.evidence-item dd {
  font: 13px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.evidence-item .tag { margin-left: 6px; margin-top: 3px; display: inline-block; }

.ai-block {
  margin-top: 14px;
  padding: 9px 12px;
  border-left: 2px solid var(--line-strong);
  background: var(--surface-alt);
}
.ai-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.ai-text { margin-top: 3px; font-size: 13px; line-height: 1.55; }

.passage { margin-top: 10px; }
.passage summary {
  padding: 6px 0;
  font: 500 12.5px/1.45 var(--sans);
  color: var(--accent);
  cursor: pointer;
}
.passage summary:hover { color: var(--accent-hover); }
.passage-ref { font: 11.5px/1.4 var(--sans); color: var(--muted); overflow-wrap: anywhere; }
.passage blockquote {
  margin: 4px 0 6px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--line-strong);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.passage-source { font: 11px/1.5 var(--sans); color: var(--muted); overflow-wrap: anywhere; }

.claims-empty {
  padding: 18px 0;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

/* ---------- claim vs reality (feature 1) ----------
   The one bold element: big serif percentages beside the claims as printed. Bars are ink, not
   traffic-light colours - there is no sourced "too much" threshold, so the page does not judge. */
.recheck-banner {
  margin-top: 12px;
  padding: 8px 12px;
  border-left: 2px solid var(--accent);
  background: var(--supported-bg);
  font-size: 13px;
  line-height: 1.5;
}
.reality { margin-top: 32px; }
.reality-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.reality-side { min-width: 0; padding: 18px 20px 20px; }
.reality-side + .reality-side { border-left: 1px solid var(--line-strong); }
.reality-kicker {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}
.reality-claims, .reality-bars { margin-top: 12px; padding: 0; list-style: none; }
.reality-claim {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  column-gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.reality-claim:last-child { border-bottom: 0; }
.reality-claim .verdict-mark { align-self: center; }
.reality-claim--misleading { --v: var(--misleading); }
.reality-claim--insufficient { --v: var(--insufficient); }
.reality-claim--supported { --v: var(--supported); }
.reality-claim-text { font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.reality-claim-verdict {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.4;
  color: var(--v, var(--muted));
}
.reality-empty { padding: 8px 0; font-size: 12.5px; color: var(--muted); }

.reality-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);   /* fits "100.0%" at 30px; ch would follow the small body font */
  column-gap: 14px;
  align-items: baseline;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}
.reality-row:last-child { border-bottom: 0; }
.reality-pct {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.reality-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.reality-label { font-size: 14px; font-weight: 500; }
.reality-amount { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reality-track {
  grid-column: 2;
  display: block;
  height: 6px;
  margin-top: 8px;
  background: var(--line);
}
.reality-fill { display: block; height: 100%; background: var(--ink); }
.reality-side .field-note { margin-top: 12px; }

/* ---------- check what we read (feature 3) ---------- */
.check-intro { max-width: var(--measure); margin-top: 8px; }
.nutrition-form { margin-top: 12px; }
.basis-row { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.inline-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.inline-field select, .inline-field input, .nutrient-input {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 13.5px/1.3 var(--sans);
}
.inline-field input { width: 120px; }
.nutrient-input {
  width: 100%;
  max-width: 104px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nutrient-input:focus-visible, .inline-field select:focus-visible, .inline-field input:focus-visible {
  outline-offset: 1px;
  border-color: var(--accent);
}
.nutrient-input.is-edited { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nutrient-table tr.is-edited td:first-child label::after {
  content: " · edited";
  color: var(--accent);
  font-size: 12px;
}
.nutrient-table td .tag { margin-left: 8px; }
.recheck-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 14px; }
.recheck-row .btn-link { margin-top: 0; }

/* ---------- pages: My scans + Dashboard (Module 10) ---------- */
.page { flex: 1 0 auto; padding-block: 32px 56px; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}
.page-title { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.2; }
.page-intro { max-width: 68ch; margin-top: 6px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.page > .status { margin-top: 14px; }
a.btn { text-decoration: none; }

.scan-list { margin: 8px 0 0; padding: 0; list-style: none; }
.scan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "head actions" "counts actions" "claims actions";
  gap: 6px 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.scan-head { grid-area: head; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.scan-title { font-size: 16px; font-weight: 600; }
.scan-title a { color: var(--ink); text-underline-offset: 3px; }
.scan-meta { font-size: 12.5px; color: var(--muted); }
.scan-counts { grid-area: counts; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.scan-count { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.scan-count--misleading { --v: var(--misleading); color: var(--ink); }
.scan-count--insufficient { --v: var(--insufficient); }
.scan-count--supported { --v: var(--supported); }
.scan-claims { grid-area: claims; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0; list-style: none; }
.scan-claim { font-size: 13px; overflow-wrap: anywhere; }
.scan-claim-status { margin-left: 6px; font-size: 12px; color: var(--muted); }
.scan-claim--misleading .scan-claim-status { color: var(--misleading); }
.scan-actions { grid-area: actions; display: flex; align-items: center; gap: 14px; }
.scan-actions .btn-link { margin-top: 0; }
.scan-delete:hover { color: var(--error); }
.scan-delete[data-armed="yes"] { color: var(--error); font-weight: 600; }
.scan-empty { padding: 28px 0; font-size: 14px; color: var(--muted); }

/* hero numbers: the system sans with proportional figures (dataviz: no serif or tabular figures on a stat value) */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 22px;
  border-block: 1px solid var(--line-strong);
  background: var(--line);
}
.stat-tile { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px 13px; background: var(--surface); }
.stat-value { font-size: 30px; font-weight: 500; line-height: 1.05; letter-spacing: -.01em; }
.stat-label { margin-top: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.stat-note { margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 24px; }
.chart-card {
  min-width: 0;
  padding: 18px 20px 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.chart-card--wide { grid-column: 1 / -1; }
.chart-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.chart-sub { margin-top: 2px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.chart-box { position: relative; height: 280px; margin-top: 14px; }
.chart-box--short { height: 220px; }
.chart-empty { margin-top: 14px; padding: 18px 0; font-size: 13.5px; color: var(--muted); }
.chart-table { margin-top: 10px; }
.chart-table summary { padding: 4px 0; font-size: 12.5px; font-weight: 500; color: var(--accent); cursor: pointer; }
.data-table { width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 0 8px 6px 0;
  border-bottom: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.data-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- data sections ---------- */
.data-section {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line-strong);
}
.data-section .section-head { padding-bottom: 0; border-bottom: 0; }

.nutrient-table {
  width: 100%;
  max-width: 560px;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: 13.5px;
}
.nutrient-table th {
  padding: 0 0 7px;
  border-bottom: 1px solid var(--line-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.nutrient-table td {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.nutrient-table .num {
  width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nutrient-table .unit {
  width: 64px;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.nutrient-table td.empty { color: var(--muted); font-size: 13px; }

.warnings {
  margin-top: 16px;
  padding-left: 10px;
  border-left: 2px solid var(--line-strong);
}
.warnings-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.warnings ul { margin-top: 5px; padding-left: 15px; }
.warnings li { font-size: 12.5px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }

.ingredients-text {
  max-width: var(--measure);
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.ingredients-text.is-empty { color: var(--muted); font-size: 13px; }

/* ---------- sugars in the ingredients (feature #6) ---------- */
.sugars { max-width: var(--measure); margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--misleading);
          background: var(--misleading-wash); }
.sugars-head { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.3; }
.sugar-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding: 0; list-style: none; }
.sugar { display: flex; flex-direction: column; padding: 6px 10px; border: 1px solid var(--misleading-border);
         background: var(--surface); }
.sugar-name { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.sugar-meta { font-size: 11.5px; color: var(--muted); }
.sugars .field-note { margin-top: 10px; }

/* ---------- allergens (feature #6) ---------- */
.allergen-list { max-width: var(--measure); margin-top: 10px; padding: 0; list-style: none; }
.allergen { padding: 10px 0 11px 14px; border-left: 3px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.allergen--misleading { border-left-color: var(--misleading); background: var(--misleading-wash); padding-right: 12px; }
.allergen--insufficient { border-left-color: var(--insufficient); }
.allergen--supported { border-left-color: var(--supported); }
.allergen-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.allergen-name { font-size: 14.5px; font-weight: 600; }
.allergen-found { margin-top: 4px; font-size: 13px; }
.allergen-note { margin-top: 3px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.allergen-empty { padding: 8px 0; font-size: 13px; color: var(--muted); }

/* ---------- raw OCR ---------- */
.raw {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
}
.raw summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}
.raw-count {
  font: 11.5px/1.4 var(--sans);
  font-weight: 400;
  color: var(--muted);
}
.raw pre {
  max-height: 360px;
  margin: 10px 0 0;
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--ink);
  font: 11.5px/1.6 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- footer ---------- */
.site-footer {
  margin-top: 16px;
  border-top: 1px solid var(--line-strong);
  padding-block: 18px 28px;
  background: var(--paper);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}
.footer-inner p:last-child { max-width: 62ch; text-align: right; }

/* ---------- responsive ---------- */
@media (max-width: 1119px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    max-width: 800px;
    gap: 32px;
    padding-block: 28px 48px;
  }
}

@media (max-width: 767px) {
  .shell { padding-inline: 16px; }
  .header-inner { padding-block: 16px 14px; }
  .wordmark { font-size: 24px; }
  .header-refs { display: none; }
  .notice { font-size: 12px; padding-block: 10px; }
  .workspace { padding-block: 22px 40px; gap: 26px; }
  .rail { padding: 20px 16px; }
  .rail h2 { font-size: 21px; }
  h2 { font-size: 21px; }

  .results-head { flex-direction: column; gap: 12px; }
  .results-head .btn { align-self: flex-start; }

  .tally { grid-template-columns: 1fr 1fr; }
  .tally-item { padding: 11px 12px 10px; }
  .tally-count { font-size: 25px; }

  .claim-head { flex-direction: column; gap: 8px; }
  .claim { padding: 16px 0 18px 14px; }
  .claim--misleading { padding-right: 12px; }
  .claim-text { font-size: 15.5px; }

  .evidence { grid-template-columns: minmax(0, 1fr); gap: 9px; }

  .stat-row { grid-template-columns: 1fr 1fr; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-card { padding: 16px 14px 12px; }
  .scan-item { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "counts" "claims" "actions"; }
  .page-title { font-size: 24px; }

  .reality-grid { grid-template-columns: minmax(0, 1fr); }
  .reality-side + .reality-side { border-left: 0; border-top: 1px solid var(--line-strong); }
  .reality-side { padding: 16px 14px 18px; }
  .reality-pct { font-size: 25px; }
  .reality-row { grid-template-columns: 84px minmax(0, 1fr); column-gap: 10px; }

  .section-head { flex-direction: column; gap: 2px; }
  .section-note { text-align: left; }
  .nutrient-table .num { width: 90px; }
  .nutrient-table .unit { width: 54px; padding-left: 12px; }

  .raw summary { flex-wrap: wrap; gap: 2px 12px; }
  .footer-inner { flex-direction: column; gap: 6px; }
  .footer-inner p:last-child { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .spinner { border-top-color: var(--accent); }
  .progress span { width: 100%; opacity: .35; }
}

/* ---------- display type: condensed Archivo (overrides the per-component weights above) ---------- */
.page-title, .reality-kicker, .reality-pct, .sugars-head, .chart-title, .stat-value {
  font-family: var(--sans);
  font-stretch: var(--condensed);
  font-weight: 800;
}
.page-title { font-size: 40px; line-height: 1; }
.chart-title { font-size: 20px; }
.reality-kicker { font-size: 20px; }
.sugars-head { font-size: 22px; }
.stat-value { font-size: 40px; }

/* ---------- nutrition-panel framing: thick ink rules where the content IS a panel of facts ---------- */
.nutrient-table { border-top: 8px solid var(--ink); }
.nutrient-table th { border-bottom: 3px solid var(--ink); padding-top: 6px; font-size: 12.5px; color: var(--ink); }
.reality-grid { border: 2px solid var(--ink); }
.reality-side + .reality-side { border-left: 2px solid var(--ink); }
.reality-fill { background: var(--accent-fill); }
.tally { border-block: 0; border-top: 6px solid var(--ink); border-bottom: 2px solid var(--ink); }
.stat-row { border-block: 0; border-top: 6px solid var(--ink); border-bottom: 2px solid var(--ink); }
.chart-card { border: 2px solid var(--ink); }
.rail { border: 2px solid var(--ink); }
/* hairlines everywhere else stay quiet */
.section-head, .results-head, .page-head, .method-list, .tabs { border-color: var(--line); }
.section-head { border-bottom-width: 2px; border-bottom-color: var(--ink); }
.tab[aria-selected="true"] { border-bottom: 3px solid var(--accent-fill); }
.segment input:checked + span { box-shadow: inset 0 -3px 0 var(--accent-fill); }
.claim--misleading { background: var(--misleading-wash); }
.claim-explanation { font-size: 15px; }
@media (max-width: 767px) {
  .reality-side + .reality-side { border-left: 0; border-top: 2px solid var(--ink); }
  .claim-text { font-size: 22px; }
  .page-title { font-size: 32px; }
  .verdict { font-size: 13.5px; }
}

/* review fixes: stamp legibility (Doto renders light at 15px) + banner colour */
.verdict { font-size: 17px; font-weight: 900; letter-spacing: .07em; padding: 5px 11px 4px; border-width: 2.5px; }
.recheck-banner { border-left-color: var(--supported); }
@media (max-width: 767px) { .verdict { font-size: 15px; } }

/* ---------- dark / light toggle (header) ---------- */
.site-nav { align-items: center; }
.theme-toggle {
  min-height: 32px;
  padding: 0 12px;
  border: 1.5px solid var(--control-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--ink); }

/* ---------- per-photo progress ("Reading photo 2 of 3...") ---------- */
.progress-step {
  margin-top: 10px;
  font-stretch: var(--condensed);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}
.progress { height: 6px; background: var(--line); }
.progress span { background: var(--accent-fill); }
.progress.progress--steps span {           /* counted steps: fill to the photo being read, no sweep */
  animation: none;
  transform: none;
  transition: width .4s ease;
}

/* ---------- compare two products ---------- */
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.scan-pick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; cursor: pointer; }
.scan-pick input { width: 16px; height: 16px; accent-color: var(--accent-fill); }
.compare-scroll { overflow-x: auto; margin-top: 18px; }
.compare-table { width: 100%; min-width: 520px; border-collapse: collapse; border-top: 8px solid var(--ink); }
.compare-table th, .compare-table td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare-table thead th { border-bottom: 3px solid var(--ink); font-size: 13px; color: var(--muted); font-weight: 600; }
.compare-product a { display: block; color: var(--ink); font-stretch: var(--condensed); font-size: 22px; font-weight: 800;
                     line-height: 1.1; text-decoration: none; }
.compare-product a:hover { text-decoration: underline; }
.compare-when { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 500; }
.compare-table tbody th { width: 22%; font-size: 14px; font-weight: 700; }
.compare-cell { width: 39%; }
.compare-amount { display: block; font-stretch: var(--condensed); font-size: 24px; font-weight: 800; line-height: 1.05; }
.compare-pct { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.compare-track { display: block; height: 6px; margin-top: 7px; max-width: 240px; background: var(--line); }
.compare-fill { display: block; height: 100%; background: var(--accent-fill); }
.compare-less { display: inline-block; margin-top: 6px; padding: 0 8px; border: 1.5px solid var(--supported);
                border-radius: 999px; color: var(--supported); font-size: 12px; font-weight: 700; }
.compare-missing { font-size: 13px; color: var(--muted); }
.compare-claims-title { margin-top: 36px; font-size: 26px; }
.compare-claims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 12px; }
.compare-claim-head { padding-bottom: 6px; border-bottom: 3px solid var(--ink); font-stretch: var(--condensed);
                      font-size: 20px; font-weight: 800; }
.compare-claim-list { margin: 0; padding: 0; list-style: none; }
.compare-claim { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
                 padding: 12px 0; border-bottom: 1px solid var(--line); }
.compare-claim-text { font-stretch: var(--condensed); font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.compare-claim .verdict { font-size: 13px; }
@media (max-width: 767px) { .compare-claims { grid-template-columns: minmax(0, 1fr); } }

/* ---------- stacked layout: analysis form on top (full content width), information / results below ---------- */
.workspace { grid-template-columns: minmax(0, 1fr); max-width: var(--shell); gap: 40px; }
.rail {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr);   /* input gets the room; options stay compact */
  column-gap: 48px;
  padding: 28px 32px 30px;
}
.rail > .eyebrow, .rail > h2, .rail > .rail-intro { grid-column: 1 / -1; }
.rail-input, .rail-options { min-width: 0; }
.rail-options { padding-top: 20px; }                           /* lines up with the tabs */
.rail-options > .field-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.rail-options .segmented { max-width: none; }
.rail-options #analyse { max-width: none; }
.rail .drop { padding: 32px 20px; }
.rail .previews { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.claim-explanation, .claim-caveat, .summary-note, .recheck-banner { max-width: 80ch; }

/* information below: the five steps side by side, then legend and limits in two columns */
.method-extra { display: grid; gap: 0 48px; }
@media (min-width: 960px) {
  .method-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 24px; }
  .method-list li { display: block; padding: 16px 0 18px; border-bottom: 0; }
  .method-num { display: block; margin-bottom: 6px; }
  .method-extra { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .method-extra .legend-item { grid-template-columns: 170px minmax(0, 1fr); }
}
@media (max-width: 1119px) { .workspace { max-width: var(--shell); } }
@media (max-width: 899px) {
  .rail { grid-template-columns: minmax(0, 1fr); padding: 22px 18px 24px; }
  .rail-options { padding-top: 0; }
  .rail-options > .field-group:first-child { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
}

/* ---------- theme toggle: icon-only. The icon shows the theme you can SWITCH TO (moon in light, sun in dark).
   Which icon is visible is decided by CSS from data-theme / the OS setting, so the right one paints first. ---------- */
.theme-toggle {
  position: relative;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  color: var(--ink);
}
.theme-toggle:hover { background: var(--surface-alt); }   /* no border: a soft wash shows it is clickable */
.theme-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.theme-icon {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity .3s ease, transform .3s cubic-bezier(.4, 0, .2, 1);
}
.theme-icon--moon { fill: currentColor; stroke: none; }
/* light (default): moon visible, sun waiting rotated out */
.theme-icon--moon { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-icon--sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
/* dark: sun visible, moon rotated away */
:root[data-theme="dark"] .theme-icon--sun { opacity: 1; transform: rotate(0deg) scale(1); }
:root[data-theme="dark"] .theme-icon--moon { opacity: 0; transform: rotate(90deg) scale(.5); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon--sun { opacity: 1; transform: rotate(0deg) scale(1); }
  :root:not([data-theme="light"]) .theme-icon--moon { opacity: 0; transform: rotate(90deg) scale(.5); }
}

/* ---------- phone header (< 768 px only; desktop unchanged): logo row, then one tab row with the toggle ---------- */
@media (max-width: 767px) {
  .header-inner { flex-direction: column; align-items: stretch; gap: 6px; padding-block: 14px 0; }
  .identity-note { display: none; }                 /* the page itself says what LabelLie does */
  .wordmark { font-size: 30px; }
  .site-nav { flex-wrap: nowrap; gap: 0 18px; width: 100%; overflow-x: auto; }
  .site-nav a { padding: 10px 0 8px; font-size: 15px; white-space: nowrap; }
  .site-nav a[aria-current="page"] { border-bottom-width: 4px; }
  .theme-toggle { flex: 0 0 auto; margin-left: auto; align-self: center; }
}
