/* PlanOfAction: one stylesheet, the design system of docs/DESIGN.md.
   Method and tokens adapted from unslop by Damir Sokolovsky (@heydamir), CC BY 4.0.
   Order: tokens (2), fonts (3.1), base (4.0), shells (5), components (4.1-4.25), landing preview (7), motion (2.7). */

/* ---------------------------------------------------------------- 2. Tokens */

:root {
  color-scheme: light dark;

  /* Neutral ramp: warm kraft, the seller's packing desk (cartons, label paper, thermal ink) */
  --surface-page: #f6f3ee;
  --surface-card: #fdfcf9;
  --surface-paper: #fffefb;
  --surface-raised: #fdfcf9;
  --surface-hover: #efe9df;
  --surface-sunken: #ede7dc;
  /* Carton kraft: the surface under the landing preview's sheet, nowhere else */
  --kraft: #e9dfcd;
  --hairline: rgb(29 26 22 / 0.09);
  --hairline-strong: #8a8174;

  /* Three text roles */
  --text-primary: #1d1a16;
  --text-secondary: #514a41;
  --text-muted: #6b6358;

  /* One accent: account-health green, for what is in good standing (scores, passes, selection) */
  --accent: #17734f;
  --accent-hover: #125e40;
  --accent-text: #146a48;
  --accent-subtle: #e5f0e8;
  --on-accent: #ffffff;
  --focus: #17734f;

  /* Solid: thermal-ink fill for every primary button, the header button and the current build step */
  --solid: #1d1a16;
  --solid-hover: #36302a;
  --on-solid: #fffefb;

  /* Semantic, toned to the ramp: dot (also status icons), text, subtle surface */
  --pass-dot: #2e8f5e;
  --pass-text: #146a48;
  --pass-subtle: #e5f0e8;
  --warn-dot: #b07a12;
  --warn-text: #8a5a06;
  --warn-subtle: #f8efdc;
  --stop-dot: #d0453b;
  --stop-text: #b23128;
  --stop-subtle: #f9e9e4;
  --info-dot: #7a8594;
  --info-text: #4a5b6e;
  --info-subtle: #edeef0;

  /* Depth: small and neutral on light */
  --shadow-sm: 0 1px 2px rgb(40 30 18 / 0.06);
  --shadow-md: 0 1px 2px rgb(40 30 18 / 0.05), 0 8px 24px rgb(40 30 18 / 0.07);
  --shadow-sheet: 0 1px 2px rgb(40 30 18 / 0.06), 0 12px 32px rgb(40 30 18 / 0.10);
  --highlight-top: inset 0 1px 0 rgb(255 255 255 / 0.12);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6358' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  /* The route card (the read notice's decision): a card set apart by --shadow-md on light, by a surface step on dark */
  --route-surface: var(--surface-card);
  --route-edge: var(--hairline);

  /* Radius by size */
  --radius-tag: 4px;
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-panel: 16px;

  /* Spacing: 4 px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-display: 56px;    --lh-display: 58px;    --ls-display: -0.03em;
  --fs-title: 32px;      --lh-title: 40px;      --ls-title: -0.01em;
  --fs-decision: 24px;   --lh-decision: 32px;
  --fs-heading: 20px;    --lh-heading: 28px;
  --fs-lead: 18px;       --lh-lead: 28px;
  --fs-subheading: 16px; --lh-subheading: 24px;
  --fs-body: 16px;       --lh-body: 26px;
  --fs-ui: 15px;         --lh-ui: 20px;
  --fs-small: 14px;      --lh-small: 20px;
  --fs-caption: 13px;    --lh-caption: 20px;
  --fs-mono: 12px;       --lh-mono: 16px;
  --fs-figure-lg: 40px;  --lh-figure-lg: 44px;
  --fs-figure: 32px;     --lh-figure: 36px;
  --fs-figure-sm: 28px;  --lh-figure-sm: 32px;

  /* Layout */
  --container: 1200px;
  --gutter: 32px;
  --rail: 304px;
  --case-gap: 64px;
  /* Geist's ch (its tabular 0) is about 0.67em, so 52ch sets 70 to 74 characters a line, not 68ch's 93 to 100 */
  --measure: 52ch;
  --short: 560px;
  --header-h: 64px;
  --casebar-h: 48px;

  /* Motion: one curve */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 140ms;
  --dur-menu: 180ms;
  --dur-enter: 360ms;
  --dur-live: 2000ms;
  --rise: 8px;
  --press: 0.98;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-page: #161513;
    --surface-card: #1c1a18;
    --surface-paper: #211f1c;
    --surface-raised: #262421;
    --surface-hover: #2c2a26;
    --surface-sunken: #100f0d;
    --kraft: #2a241b;
    --hairline: rgb(239 233 222 / 0.09);
    --hairline-strong: #7d766b;

    --text-primary: #efe9de;
    --text-secondary: #aaa398;
    --text-muted: #8f887d;

    --accent: #2f8f63;
    --accent-hover: #38a172;
    --accent-text: #6cc79a;
    --accent-subtle: #16261d;
    --on-accent: #ffffff;
    --focus: #6cc79a;

    --solid: #efe9de;
    --solid-hover: #d9d2c5;
    --on-solid: #161513;

    --pass-dot: #4cb07f;
    --pass-text: #74cf9f;
    --pass-subtle: #15251c;
    --warn-dot: #d9a23c;
    --warn-text: #e8b964;
    --warn-subtle: #2a2113;
    --stop-dot: #e3625a;
    --stop-text: #f08c84;
    --stop-subtle: #2d1716;
    --info-dot: #8695a8;
    --info-text: #a9b6c6;
    --info-subtle: #1b1f25;

    /* An empty shadow, not none: these tokens are also used inside box-shadow lists */
    --shadow-sm: 0 0 transparent;
    --shadow-md: 0 0 transparent;
    --shadow-sheet: 0 0 transparent;
    --highlight-top: inset 0 1px 0 rgb(255 255 255 / 0.06);
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f887d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    /* The paper step and a firmer edge: the one card on a case page one step above the cards beside it */
    --route-surface: #211f1c;
    --route-edge: rgb(239 233 222 / 0.14);
  }
}

@media (max-width: 1023px) {
  :root { --gutter: 24px; }
}

@media (max-width: 639px) {
  :root {
    --gutter: 16px;
    --header-h: 56px;
    --fs-display: 36px;    --lh-display: 38px;    --ls-display: -0.01em;
    --fs-title: 28px;      --lh-title: 36px;      --ls-title: -0.01em;
    --fs-decision: 22px;   --lh-decision: 30px;
    --fs-heading: 18px;    --lh-heading: 26px;
    --fs-lead: 17px;       --lh-lead: 26px;
    --fs-figure-lg: 36px;  --lh-figure-lg: 40px;
    --fs-figure: 28px;     --lh-figure: 32px;
    --fs-figure-sm: 24px;  --lh-figure-sm: 28px;
  }
}

/* ---------------------------------------------------------------- 3.1 Fonts (vendored, SIL OFL 1.1)
   Each url carries the font's content version (asset_version, a test keeps them equal), so it is the very URL
   base.html preloads through static_url() and a changed font gets a new URL. */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2?v=28258d062121") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2?v=5bc6413e82be") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- 4.0 Base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--space-6); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--surface-page);
  color: var(--text-primary); font: 400 var(--fs-body)/var(--lh-body) var(--font-sans);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
#main { flex: 1 0 auto; }
/* Zero specificity, so the flow rhythm below can space these and any component rule can override it */
:where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
h1 { font-size: var(--fs-title); line-height: var(--lh-title); font-weight: 500; letter-spacing: var(--ls-title); }
h2 { font-size: var(--fs-heading); line-height: var(--lh-heading); font-weight: 500; }
h3 { font-size: var(--fs-subheading); line-height: var(--lh-subheading); font-weight: 500; }
h4 { font-size: var(--fs-subheading); line-height: var(--lh-subheading); font-weight: 500; }
ul, ol { padding-left: var(--space-5); }
li + li { margin-top: var(--space-2); }
strong, b { font-weight: 500; }
em, i { font-style: normal; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font: 400 var(--fs-caption)/var(--lh-caption) var(--font-mono); background: var(--surface-sunken);
  padding: 1px 4px; border-radius: var(--radius-tag); }
hr { border: 0; border-top: 1px solid var(--hairline); margin: var(--space-8) 0; }
[hidden] { display: none !important; }

.container { max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.meta { font: 400 var(--fs-mono)/var(--lh-mono) var(--font-mono); letter-spacing: 0.01em; color: var(--text-muted); }
.note { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-secondary); }
.caption { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.lead { font-size: var(--fs-lead); line-height: var(--lh-lead); color: var(--text-secondary); max-width: var(--measure);
  text-wrap: pretty; }
.measure { max-width: var(--measure); }
.link { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--hairline-strong);
  text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--dur-fast) var(--ease); }
.link:hover { color: var(--accent-text); text-decoration-color: currentColor; }
:is(.prose, .note, .field__hint, .callout, .lead, .flow) a:not(.btn) { color: var(--text-primary); text-decoration: underline;
  text-decoration-color: var(--hairline-strong); text-decoration-thickness: 1px; text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease); }
:is(.prose, .note, .field__hint, .callout, .lead, .flow) a:not(.btn):hover { color: var(--accent-text);
  text-decoration-color: currentColor; }

/* Flow: vertical rhythm inside content containers. Zero specificity, so every component margin wins. */
:where(.flow, .card, .route, .rail__block, .callout__body, .short, .case-main, .case-more, .page-body) > * + * {
  margin-top: var(--space-4);
}
:where(.flow, .case-main, .case-more, .page-body) > * + :where(h2, section, .card, .route, .callout, .error-summary) {
  margin-top: var(--space-8);
}
:where(.card, .route, .rail__block, .callout__body, .flow) > :where(h2, h3) + * { margin-top: var(--space-2); }

.skip-link { position: absolute; left: var(--space-2); top: var(--space-2); z-index: 20; display: inline-flex;
  align-items: center; height: 44px; padding: 0 var(--space-5); border: 1px solid var(--hairline);
  border-radius: var(--radius-control); background: var(--surface-raised); color: var(--text-primary);
  font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); text-decoration: none; box-shadow: var(--shadow-sm);
  transform: translateY(-200%); }
.skip-link:focus, .skip-link:focus-visible { transform: none; }

/* ---------------------------------------------------------------- 3.2 Icons */

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.icon--18 { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- 4.25 Shared states */

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
/* A container focused by the page itself (the error summary's autofocus) is not a control: no ring */
[tabindex="-1"]:focus { outline: none; }

/* ---------------------------------------------------------------- 4.1 Site header */

.site-header { position: relative; z-index: 10; background: var(--surface-page); border-bottom: 1px solid var(--hairline); }
.site-header__inner { display: flex; align-items: center; gap: var(--space-8); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--text-primary);
  font-size: var(--fs-lead); line-height: var(--lh-subheading); font-weight: 500; letter-spacing: -0.01em;
  text-decoration: none; border-radius: var(--radius-control); }
.brand__mark { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); }
.site-nav__link { display: inline-flex; align-items: center; height: 36px; padding: 0 var(--space-3);
  border-radius: var(--radius-control); color: var(--text-secondary); font-size: var(--fs-small);
  line-height: var(--lh-small); text-decoration: none;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.site-nav__link:hover { background: var(--surface-hover); color: var(--text-primary); }
.site-nav__link[aria-current="page"] { color: var(--text-primary); font-weight: 500; }
.site-nav .btn { margin-left: var(--space-2); }
/* The header's graphite button steps down to the secondary look where a fill would outshine the page's own primary:
   on /check (it is the page you are on) and in dark, where the primary-text fill turns near-white */
.site-nav .btn--solid[aria-current="page"] { background: var(--surface-raised); color: var(--text-primary);
  border-color: var(--hairline); }
.site-nav .btn--solid[aria-current="page"]:hover { background: var(--surface-hover); }
@media (prefers-color-scheme: dark) {
  .site-nav .btn--solid { background: var(--surface-raised); color: var(--text-primary); border-color: var(--hairline);
    box-shadow: var(--highlight-top); }
  .site-nav .btn--solid:hover { background: var(--surface-hover); }
}
.site-header .meta { margin-left: auto; }

.nav-menu { display: none; margin-left: auto; }
.nav-menu__toggle { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 44px; min-height: 44px;
  padding: 0 var(--space-3); border-radius: var(--radius-control); color: var(--text-primary);
  font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); list-style: none; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.nav-menu__toggle::-webkit-details-marker { display: none; }
.nav-menu__toggle::marker { content: ""; }
.nav-menu__toggle:hover { background: var(--surface-hover); }
.nav-menu__toggle:active { transform: scale(var(--press)); }
.nav-menu__toggle .icon + .icon { display: none; }
.nav-menu[open] .nav-menu__toggle .icon:first-child { display: none; }
.nav-menu[open] .nav-menu__toggle .icon + .icon { display: block; }
.nav-menu__panel { position: absolute; left: 0; right: 0; top: var(--header-h); display: flex; flex-direction: column;
  gap: var(--space-1); padding: var(--space-2) var(--gutter) var(--space-4); background: var(--surface-card);
  border-bottom: 1px solid var(--hairline); box-shadow: var(--shadow-md);
  animation: menu-in var(--dur-menu) var(--ease) both; }
.nav-menu__panel a { display: flex; align-items: center; min-height: 48px; padding: 0 var(--space-3);
  border-radius: var(--radius-control); color: var(--text-primary); font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans);
  text-decoration: none; transition: background-color var(--dur-fast) var(--ease); }
.nav-menu__panel a:hover { background: var(--surface-hover); }
.nav-menu__panel a[aria-current="page"] { background: var(--surface-hover); }

@media (max-width: 767px) {
  .site-nav { display: none; }
  .nav-menu { display: block; }
}

/* ---------------------------------------------------------------- 4.2 Footer */

.site-footer { margin-top: var(--space-20); border-top: 1px solid var(--hairline); padding: var(--space-8) 0 var(--space-12); }
.site-footer__inner { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-8); }
.disclaimer { max-width: 60ch; font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.footer-links a { color: var(--text-secondary); font-size: var(--fs-small); line-height: var(--lh-small);
  text-decoration: none; text-underline-offset: 3px; transition: color var(--dur-fast) var(--ease); }
.footer-links a:hover { color: var(--text-primary); text-decoration: underline; }

@media (max-width: 639px) {
  .site-footer__inner { flex-direction: column; align-items: stretch; gap: var(--space-4); }
  .footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
  .footer-links a { display: flex; align-items: center; min-height: 44px; }
}

/* ---------------------------------------------------------------- 4.3 Case bar */

.casebar { background: var(--surface-page); border-bottom: 1px solid var(--hairline); }
.casebar__inner { display: flex; justify-content: space-between; align-items: center; gap: var(--space-6);
  min-height: var(--casebar-h); }
.casebar__ref { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.casebar__label { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-secondary); }
.casebar__ref > .mono { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: 500;
  color: var(--text-primary); }
.casebar__step { display: none; }

.steps { display: flex; gap: var(--space-6); margin: 0; padding: 0; list-style: none; }
.steps__item { display: flex; align-items: center; gap: var(--space-2); margin: 0; color: var(--text-muted);
  font-size: var(--fs-small); line-height: var(--lh-small); white-space: nowrap; }
.steps__item + .steps__item { margin-top: 0; }
.steps__mark { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex: none;
  border: 1px solid var(--hairline-strong); border-radius: 50%;
  font: 400 var(--fs-mono)/var(--lh-mono) var(--font-mono); }
.steps__item--done { color: var(--text-secondary); }
.steps__item--done .steps__mark { border-color: transparent; color: var(--pass-dot); }
.steps__item[aria-current="step"] { color: var(--text-primary); font-weight: 500; }
.steps__item[aria-current="step"] .steps__mark { background: var(--solid); border-color: var(--solid);
  color: var(--on-solid); }

@media (max-width: 767px) {
  /* When the reference wraps to two lines, the step label sits on its first line, not between the two */
  .casebar__inner { align-items: baseline; padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .casebar .steps { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .casebar__step { display: block; flex: none; margin-left: auto; white-space: nowrap; font: 400 var(--fs-mono)/var(--lh-mono) var(--font-mono);
    letter-spacing: 0.01em; color: var(--text-muted); text-align: right; }
}

/* ---------------------------------------------------------------- 5. Shells */

/* Site shell */
.page { padding-top: var(--space-12); }
.page-body { margin-top: 0; }
.short { max-width: calc(var(--short) + 2 * var(--gutter)); margin: 0 auto; padding: var(--space-12) var(--gutter); }
/* A short unit (5.2) or a waiting unit (4.15) is centered in the space between the header and the footer, a little
   above the middle (48 more below it than above); a unit taller than that space starts 48 under the header. The htmx
   poll swaps #main-body only, so #main keeps this while the wait lasts and drops it when the result arrives */
#main:has(> .short), #main:has(> #main-body > .waiting) { display: flex; flex-direction: column;
  justify-content: center; padding-bottom: var(--space-12); }
.short > .page-header { padding-top: 0; }
/* A short unit's context is one statement of one or two lines: balanced, so no line ends on a lone "to one." */
.short .page-header__context { text-wrap: balance; }

/* Forms with an aside (check, score): the form in a card, the aside as rail blocks */
.aside-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); column-gap: var(--space-16);
  align-items: start; }
.aside-grid > * { min-width: 0; }
.aside-grid__aside { display: flex; flex-direction: column; gap: var(--space-6); }

/* Text pages with a sub-nav (legal, appeal guide) */
.doc-layout { display: grid; grid-template-columns: 200px minmax(0, var(--measure)); column-gap: var(--space-16);
  align-items: start; }
.doc-layout > * { min-width: 0; }
/* Legal pages: the column takes the rest of the row so a table can be wider than the text; .prose holds every other
   child to the measure */
.doc-layout--prose { grid-template-columns: 200px minmax(0, 1fr); }
.doc-nav { position: sticky; top: var(--space-6); display: flex; flex-direction: column; gap: 2px; }
.doc-nav__title { margin-bottom: var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 500; color: var(--text-secondary); }
/* The links' text sits on the title's left edge (the page's content edge); their hover surface reaches 12 into the
   gutter. Rows are 36 tall with 8 above and below, so a wrapped link keeps its padding */
.doc-nav a { display: flex; align-items: center; min-height: 36px; margin-left: calc(-1 * var(--space-3));
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-control); color: var(--text-secondary);
  font-size: var(--fs-small); line-height: var(--lh-small); text-decoration: none;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.doc-nav a:hover { background: var(--surface-hover); color: var(--text-primary); }
.doc-nav a[aria-current="page"] { color: var(--text-primary); font-weight: 500; background: var(--surface-hover); }

/* Case shell */
.case-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); column-gap: var(--case-gap);
  grid-template-areas: "main rail" "more rail"; grid-template-rows: auto 1fr; align-items: start;
  padding-top: var(--space-12); }
.case-main { grid-area: main; min-width: 0; }
.case-rail { grid-area: rail; min-width: 0; }
.case-more { grid-area: more; min-width: 0; margin-top: var(--space-12); }
.case-grid .page-header { padding-top: 0; }
.case-grid--single { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "more"; }
/* The draft (5.4): the review beside the sheet, the case details 24 under the review, "Before you submit" and the
   export under the sheet. Row 2 is the flexible one, so neither the sheet nor the rail pushes the other's column
   down. Below 1024 the DOM order holds: sheet, review, before you submit, export, revision, case details */
.case-grid--draft { grid-template-areas: "main review" "main rail" "more rail"; grid-template-rows: auto 1fr auto; }
.case-review { grid-area: review; min-width: 0; }
.case-grid--draft > .case-rail { margin-top: var(--space-6); }

/* Admin shell */
.admin { padding-top: var(--space-12); }

@media (max-width: 1023px) {
  .aside-grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-8); }
  .case-grid { display: flex; flex-direction: column; gap: var(--space-8); }
  .case-more, .case-grid--draft > .case-rail { margin-top: 0; }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
  .doc-nav { display: none; }
}

@media (max-width: 639px) {
  .page, .case-grid, .admin { padding-top: var(--space-8); }
}

/* ---------------------------------------------------------------- 4.5 Page header */

.page-header { padding-top: var(--space-12); margin-bottom: var(--space-8); }
.page-header__eyebrow { margin-bottom: var(--space-2); }
.page-header > h1 + * { margin-top: var(--space-2); }
.page-header__context { max-width: var(--measure); font-size: var(--fs-lead); line-height: var(--lh-lead);
  color: var(--text-secondary); text-wrap: pretty; }
.page-header__context + .page-header__context { margin-top: var(--space-2); }
/* The independence note (spec-business-14) under the first screen's title and lead, above the form */
:is(.page-header, .hero__text, .appeal-top__text) > .independence { margin-top: var(--space-2); }
.page-header--actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--space-8);
  align-items: end; }
.page-header--actions > :not(.page-header__actions) { grid-column: 1; }
.page-header--actions > .page-header__actions { grid-column: 2; grid-row: 1 / span 3; align-self: end; margin-top: 0; }
.page > .page-header:first-child, .short > .page-header:first-child, .admin > .page-header:first-child { padding-top: 0; }
/* A polled page starts with the empty #poll div: its header still sits at the page's own top padding */
.page > #poll:first-child + .page-header { padding-top: 0; }

@media (max-width: 639px) {
  .page-header { padding-top: var(--space-8); margin-bottom: var(--space-6); }
  .page-header--actions { display: block; }
  .page-header--actions > .page-header__actions { margin-top: var(--space-4); }
}

/* ---------------------------------------------------------------- 4.6 Buttons */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 44px;
  padding: 0 var(--space-5); border: 1px solid transparent; border-radius: var(--radius-control);
  font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.btn:active:not([disabled]) { transform: scale(var(--press)); }
.btn--primary { background: var(--solid); color: var(--on-solid); box-shadow: var(--shadow-sm), var(--highlight-top); }
.btn--primary:hover { background: var(--solid-hover); }
.btn--solid { background: var(--solid); color: var(--on-solid); box-shadow: var(--shadow-sm); }
.btn--solid:hover { background: var(--solid-hover); }
.btn--secondary { background: var(--surface-raised); color: var(--text-primary); border-color: var(--hairline);
  box-shadow: var(--shadow-sm); }
.btn--secondary:hover { background: var(--surface-hover); }
.btn--quiet { background: transparent; color: var(--text-secondary); padding: 0 var(--space-3); }
.btn--quiet:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn--destructive { background: var(--surface-raised); color: var(--stop-text); border-color: var(--hairline); }
.btn--destructive:hover { background: var(--stop-subtle); border-color: var(--stop-dot); }
.btn--sm { height: 36px; padding: 0 var(--space-3); font-size: var(--fs-small); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--surface-sunken); color: var(--text-muted);
  border-color: var(--hairline); box-shadow: none; cursor: not-allowed; }
@media (pointer: coarse) { .btn--sm { height: 44px; } }

/* A row of buttons: gap 12, wraps, left-aligned; on a phone a row holding a primary becomes a column */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.actions > form { display: contents; }
@media (max-width: 639px) {
  .actions:has(.btn--primary) { flex-direction: column; align-items: stretch; }
  .actions:has(.btn--primary) .btn { width: 100%; }
}

/* ---------------------------------------------------------------- 4.7 Form fields */

.form > * + * { margin-top: var(--space-6); }
/* Hidden inputs (CSRF, ids) come first in a form: the first visible child gets no top margin */
form > input[type="hidden"] + :not(input[type="hidden"]) { margin-top: 0; }
.form > .actions { margin-top: var(--space-8); }
.form > .note, .form > .meta { margin-top: var(--space-3); }
.field { min-width: 0; }
fieldset.field { margin-left: 0; margin-right: 0; border: 0; padding: 0; }
.field__label, fieldset.field > legend { display: block; padding: 0; font-size: var(--fs-subheading);
  line-height: var(--lh-subheading); font-weight: 500; color: var(--text-primary); }
.field__optional { margin-left: var(--space-1); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 400; color: var(--text-muted); }
.field__hint { max-width: var(--measure); margin-top: var(--space-1); font-size: var(--fs-small);
  line-height: var(--lh-small); color: var(--text-secondary); }
.field__error { display: flex; gap: var(--space-2); align-items: flex-start; margin-top: var(--space-2);
  font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; color: var(--stop-text); }
.field__error .icon { margin-top: 2px; color: var(--stop-dot); }
.field > :is(.input, .choices, .segmented__options, input[type="file"]) { margin-top: var(--space-2); }
.field__status { margin-top: var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  color: var(--text-secondary); }
.field__status:empty { display: none; }

.input { display: block; width: 100%; height: 44px; padding: 0 var(--space-3); border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-control); background: var(--surface-raised); color: var(--text-primary);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-sans);
  transition: border-color var(--dur-fast) var(--ease); }
.input::placeholder { color: var(--text-muted); opacity: 1; }
/* :focus, not :focus-visible: a date input's calendar button is a fourth Tab stop that Chrome reports as :focus only,
   which the rule above would leave without any ring. Same specificity as that rule and later, so it wins */
.input:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 2px; }
textarea.input { height: auto; min-height: 120px; padding: var(--space-3); resize: vertical;
  font-size: var(--fs-subheading); line-height: var(--lh-subheading); }
textarea.input--long { min-height: 160px; }
textarea.input--notice { min-height: 200px; }
textarea.input--draft { min-height: 280px; }
textarea.input--hero { min-height: 144px; }
/* The Plan of Action template's fill-in outline: read-only, copied with the copy button */
textarea.input--outline { min-height: 420px; font: 400 var(--fs-small)/var(--lh-small) var(--font-mono); }
/* A column list of links (the appeal guides by notice type) */
.link-list { columns: 2 16rem; column-gap: var(--space-6); padding-left: 0; list-style: none; }
.link-list > li { break-inside: avoid; margin-bottom: var(--space-2); }
/* The template guide's comparison: ours is the first column, tinted, so it stays in view while the other three
   scroll sideways in the narrow column (.table-scroll) */
.table--compare { min-width: 720px; }
.table--compare tbody th { width: 16%; vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 0;
  border-top: 1px solid var(--hairline); color: var(--text-primary); font-size: var(--fs-small); }
.table--compare tbody tr:first-child > th { border-top: 0; }
.table--compare td { vertical-align: top; width: 21%; }
.table--compare .compare__ours { background: var(--accent-subtle); padding-left: 16px; }
.table--compare th.compare__ours { color: var(--accent-text); }
/* Weak and specific examples differ by more than their label */
.quote.quote--weak { background: var(--stop-subtle); }
.quote--weak .quote__label { color: var(--stop-text); }
.quote.quote--specific { background: var(--pass-subtle); }
.quote--specific .quote__label { color: var(--pass-text); }
select.input { appearance: none; -webkit-appearance: none; padding-right: var(--space-10);
  background: var(--surface-raised) var(--select-chevron) no-repeat right 12px center; }
/* A select that opens on its "Choose one" prompt (interview) shows it as a placeholder; the options keep their color */
select.input:has(> option[data-prompt]:checked) { color: var(--text-muted); }
select.input option { color: var(--text-primary); }
input.input[type="date"], input.input[type="number"] { max-width: 240px; }
.input:disabled, .input[readonly] { background: var(--surface-sunken); }
.field--invalid .input { border-color: var(--stop-dot); box-shadow: inset 0 0 0 1px var(--stop-dot); }
.field__count { margin-top: var(--space-2); text-align: right; font: 400 var(--fs-mono)/var(--lh-mono) var(--font-mono);
  letter-spacing: 0.01em; color: var(--text-muted); }
.field__count--near { color: var(--warn-text); }
.field:target { background: var(--surface-sunken); box-shadow: 0 0 0 8px var(--surface-sunken);
  border-radius: var(--radius-control); }

/* Checkboxes and radios: native, in a choice row */
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.choices { display: flex; flex-direction: column; }
.choice { display: flex; gap: var(--space-3); align-items: center; min-height: 44px; padding: var(--space-2) 0;
  font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 400; color: var(--text-primary); cursor: pointer; }
.choice > input { align-self: flex-start; margin-top: 4px; }

/* Segmented 3-way choice (evidence) */
fieldset.segmented { border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
.segmented > legend { padding: 0; font-size: var(--fs-subheading); line-height: var(--lh-subheading); font-weight: 500; }
.segmented__options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
  border: 1px solid var(--hairline-strong); border-radius: var(--radius-control); overflow: hidden; }
.segment { display: block; margin: 0; cursor: pointer; }
.segment + .segment > span { border-left: 1px solid var(--hairline); }
.segment > span { display: flex; align-items: center; justify-content: center; gap: var(--space-2); height: 100%;
  min-height: 44px; padding: var(--space-2) var(--space-3); background: var(--surface-raised); color: var(--text-secondary);
  font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; text-align: center;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.segment > span .icon { display: none; }
.segment:hover > span { background: var(--surface-hover); }
.segment > input:checked + span { background: var(--accent-subtle); color: var(--text-primary); }
.segment > input:checked + span .icon { display: block; }
.segment > input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
/* Invalid: the 2 px stop edge an invalid input has (outside, since the segments cover an inset ring) */
.field--invalid .segmented__options { border-color: var(--stop-dot); box-shadow: 0 0 0 1px var(--stop-dot); }

/* File input */
input[type="file"] { display: block; max-width: 100%; font-size: var(--fs-small); line-height: var(--lh-small);
  color: var(--text-secondary); }
input[type="file"]::file-selector-button { height: 44px; margin-right: var(--space-3); padding: 0 var(--space-5);
  border: 1px solid var(--hairline); border-radius: var(--radius-control); background: var(--surface-raised);
  color: var(--text-primary); font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background-color var(--dur-fast) var(--ease); }
input[type="file"]::file-selector-button:hover { background: var(--surface-hover); }

/* 4.7.1 The specificity nudge sits after the control */
.nudge { margin-top: var(--space-3); }

/* Honeypot (the specialist form): a field people never see or reach, which bots fill in */
.hp { position: absolute; left: -10000px; }

/* ---------------------------------------------------------------- 4.8 Error summary */

.error-summary { margin-bottom: var(--space-8); padding: var(--space-5); background: var(--surface-card);
  border: 1px solid var(--hairline); border-radius: var(--radius-card); }
.error-summary__title { display: flex; align-items: center; gap: var(--space-2); font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans);
  color: var(--text-primary); }
.error-summary__title .icon { color: var(--stop-dot); }
.error-summary ul { margin-top: var(--space-3); padding: 0; list-style: none; font-size: var(--fs-small);
  line-height: var(--lh-small); }
.error-summary li + li { margin-top: var(--space-2); }
/* Each row: the answer tag as its marker, the message beside it (a wrapped line stays under the message), only the
   words underlined */
.error-summary__link { display: inline-grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-2);
  align-items: baseline; color: var(--text-primary); text-decoration: none; border-radius: var(--radius-tag); }
.error-summary__text { text-decoration: underline; text-decoration-color: var(--hairline-strong);
  text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--dur-fast) var(--ease); }
.error-summary__link:hover .error-summary__text { color: var(--accent-text); text-decoration-color: currentColor; }
/* A row without a tag (the shared error_summary macro when a problem names none): the words take the whole row */
.error-summary__link > .error-summary__text:first-child { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- 4.9 Status line */

.status { display: flex; gap: var(--space-2); align-items: baseline; font-size: var(--fs-small);
  line-height: var(--lh-small); color: var(--text-secondary); }
.status--strong { font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); color: var(--text-primary); }
/* The mandated "not yet verified" (copy.case.not_verified, tested verbatim in lowercase) reads in sentence case where
   it stands as a status line or a callout title; every other one already starts with a capital */
.status > span:last-child::first-letter, .callout__title::first-letter { text-transform: uppercase; }
.dot { display: inline-block; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--text-muted);
  transform: translateY(-1px); }
.dot--pass, .status--pass .dot { background: var(--pass-dot); }
.dot--warn, .status--warn .dot { background: var(--warn-dot); }
.dot--stop, .status--stop .dot { background: var(--stop-dot); }
.dot--info, .status--info .dot { background: var(--info-dot); }
.dot--live, .status--live .dot { background: var(--accent); animation: live var(--dur-live) var(--ease) infinite; }
/* A status that is the page's context (a closed build): the lead's size, the dot 12 before the words */
.page-header__context.status { column-gap: var(--space-3); font-size: var(--fs-lead); line-height: var(--lh-lead);
  color: var(--text-secondary); }

/* ---------------------------------------------------------------- 4.10 Callout */

.callout { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: var(--space-3);
  padding: var(--space-4) var(--space-5); background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); }
.callout > .icon { margin-top: 5px; color: var(--info-dot); }
.callout--stop > .icon { color: var(--stop-dot); }
/* A callout that opens with its title (UI role, 20 px line) centers the icon on that line, not on a 26 px body line */
.callout:has(> .callout__body > .callout__title:first-child) > .icon { margin-top: 2px; }
.callout__title { font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); }
/* A callout as wide as the main column keeps its text to the measure */
:where(.callout__body > p) { max-width: var(--measure); text-wrap: pretty; }
.callout__title + * { margin-top: var(--space-2); }
.callout__actions { margin-top: var(--space-4); }
.callout__body > .callout__actions { margin-top: var(--space-4); }

/* ---------------------------------------------------------------- 4.11 Check list (review) */

.checks__group { display: flex; align-items: baseline; gap: var(--space-2); margin: var(--space-4) 0 var(--space-2);
  font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: 500; color: var(--text-secondary); }
.checks { display: grid; gap: var(--space-2); padding: 0; list-style: none; }
.checks > li + li { margin-top: 0; }
.check { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: var(--space-2);
  font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-primary); }
.check > .icon { margin-top: 2px; }
.check--work > .icon { color: var(--warn-dot); }
.check--pass > .icon { color: var(--pass-dot); }
.check__label { grid-column: 2; }
.check__detail { grid-column: 2; margin-top: 2px; font: 400 var(--fs-caption)/var(--lh-caption) var(--font-sans);
  color: var(--text-secondary); }

/* ---------------------------------------------------------------- 4.12 Score figure */

.review-block > :is(h2, h3):first-child { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 2px;
  font: 400 var(--fs-small)/var(--lh-small) var(--font-mono); color: var(--text-muted); }
.score-figure__label { flex-basis: 100%; margin-bottom: var(--space-1); font: 400 var(--fs-caption)/var(--lh-caption)
  var(--font-sans); color: var(--text-secondary); }
.review-block > :is(h2, h3):first-child .score { font: 500 var(--fs-figure-lg)/var(--lh-figure-lg) var(--font-mono);
  letter-spacing: -0.02em; color: var(--text-primary); }
.review--rail .review-block > :is(h2, h3):first-child .score,
.review-block--minor > h2 .score { font-size: var(--fs-figure); line-height: var(--lh-figure); letter-spacing: -0.01em; }
.review-block > :is(h2, h3):first-child + * { margin-top: var(--space-2); }
.review { background: var(--surface-card); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  padding: var(--space-5); }
.review > * + * { margin-top: var(--space-4); }
.review__title { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: 500; color: var(--text-secondary); }
.review__figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.review__figures > * + * { margin-top: 0; }
.score-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-8); align-items: start; }
@media (max-width: 1023px) { .score-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- 4.13 Answer reference tag (the signature) */

.ref { display: inline-block; padding: 0 4px; border-radius: var(--radius-tag); background: var(--surface-paper);
  border: 1px solid var(--hairline-strong); color: var(--text-primary); box-shadow: 0 1px 0 var(--hairline);
  font: 500 var(--fs-mono)/var(--lh-mono) var(--font-mono); white-space: nowrap; vertical-align: 1px; }
.refs { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: flex-start; gap: 4px; }

/* ---------------------------------------------------------------- 4.14 The Plan of Action sheet */

.sheet { background: var(--surface-paper); border: 1px solid var(--hairline); border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sheet); padding: var(--space-12); }
.sheet__head { padding-bottom: var(--space-6); border-bottom: 1px solid var(--hairline); }
.sheet__title { font-size: var(--fs-decision); line-height: var(--lh-decision); font-weight: 500; }
.sheet__head > * + * { margin-top: var(--space-2); }
.sheet__legend { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.sheet__section { margin-top: var(--space-8); }
/* One text edge: section titles and every sentence start 28 in, and the section and sentence numbers hang in that
   margin, so the numbers make one column and the words another (root cause sentences, unnumbered, line up too) */
.sheet__heading { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: baseline;
  font-size: var(--fs-lead); line-height: var(--lh-lead); font-weight: 500; }
.sheet__num { min-width: 16px; font: 400 var(--fs-caption)/var(--lh-caption) var(--font-mono); color: var(--text-muted); }
.sentences { display: grid; gap: var(--space-3); margin: var(--space-3) 0 0; padding: 0; list-style: none;
  counter-reset: sentence; }
.sentences > li + li { margin-top: 0; }
/* The sentence row as the landing preview uses it: the words, then the tags in a right-aligned column */
.sentence { display: grid; grid-template-columns: minmax(0, 1fr) 96px; column-gap: var(--space-6); }
.sentence > .refs { padding-top: 4px; }
.sentences--numbered .sentence { grid-template-columns: 28px minmax(0, 1fr) 96px; }
.sentences--numbered .sentence::before { content: counter(sentence); counter-increment: sentence;
  font: 400 var(--fs-caption)/var(--lh-body) var(--font-mono); color: var(--text-muted); }
/* On the sheet: the number margin (28), the words, 24, the tags (96); 586 px of words at 1200 (66ch) */
.sheet .sentence { grid-template-columns: 28px minmax(0, 1fr) 96px; column-gap: 0; }
.sheet .sentence::before { grid-area: 1 / 1; }
.sheet .sentence > .sentence__text { grid-area: 1 / 2; padding-right: var(--space-6); }
.sheet .sentence > .refs { grid-area: 1 / 3; }
/* A draft rendered before the per-sentence markup lands (section text as plain paragraphs) */
.sheet__text { margin-top: var(--space-3); }

@media (max-width: 639px) {
  .sheet { padding: var(--space-5); }
  .sheet__head { padding-bottom: var(--space-5); }
  .sheet__section { margin-top: var(--space-6); }
  .sentences { gap: var(--space-4); }
  /* The margin narrows to 24 and the tags move under their sentence, on the words' edge */
  .sheet__heading { grid-template-columns: 24px minmax(0, 1fr); }
  .sheet .sentence { grid-template-columns: 24px minmax(0, 1fr); }
  .sheet .sentence > .sentence__text { padding-right: 0; }
  .sheet .sentence > .refs { grid-area: 2 / 2; justify-content: flex-start; margin-top: 4px; padding-top: 0; }
}

/* ---------------------------------------------------------------- 4.15 Waiting state */

.waiting { max-width: calc(var(--short) + 2 * var(--gutter)); margin: 0 auto; padding: var(--space-12) var(--gutter); }
.waiting > * + * { margin-top: var(--space-4); }
.waiting > h1 { text-wrap: balance; }
.waiting__note { margin-top: var(--space-2); max-width: var(--measure); font-size: var(--fs-lead);
  line-height: var(--lh-lead); color: var(--text-secondary); text-wrap: pretty; }
.waiting > h1 + .waiting__note { margin-top: var(--space-2); }
.waiting > .progress { margin-top: var(--space-8); }
.waiting > .callout { margin-top: var(--space-6); }
.waiting__slow { margin-top: var(--space-6); }
.waiting__slow > * + * { margin-top: var(--space-2); }
.waiting__after { margin-top: var(--space-8); }
.progress { padding: var(--space-2) var(--space-5); list-style: none; background: var(--surface-card);
  border: 1px solid var(--hairline); border-radius: var(--radius-card); }
.progress__item { display: flex; align-items: center; gap: var(--space-3); min-height: 48px; margin: 0;
  color: var(--text-muted); font-size: var(--fs-small); line-height: var(--lh-small); }
.progress__item + .progress__item { margin-top: 0; border-top: 1px solid var(--hairline); }
.progress__item > .icon, .progress__item > .dot, .progress__ring { flex: none; }
.progress__item--done { color: var(--text-secondary); }
.progress__item--done > .icon { color: var(--pass-dot); }
.progress__item--now { color: var(--text-primary); font-weight: 500; }
.progress__item--now > .dot { margin: 0 4px; transform: none; }
.progress__ring { width: 8px; height: 8px; margin: 0 4px; border: 1.5px solid var(--hairline-strong); border-radius: 50%; }


/* ---------------------------------------------------------------- 4.16 Tables */

table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); line-height: var(--lh-small); }
th { text-align: left; font-weight: 500; font-size: var(--fs-caption); color: var(--text-secondary);
  background: var(--surface-sunken); padding: 8px 16px; }
td { padding: 12px 16px; border-top: 1px solid var(--hairline); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
.table--site th, .prose th { background: transparent; border-bottom: 1px solid var(--hairline-strong); }
.table--site tbody tr:first-child > td, .prose tbody tr:first-child > td { border-top: 0; }
/* Pricing: the name, the larger price figure and the line beside them share one first baseline */
.table--site td { vertical-align: baseline; }
td.num, th.num { text-align: right; white-space: nowrap; }
/* Figures are mono; a header is a word, so it stays sans even over a column of figures */
td.num { font-family: var(--font-mono); }
/* Stacked at every width (the score result's rubric, in the narrower AI card): the same rows .table--stack makes on
   phone, criterion and points on row 1, the reason under them */
.table--stacked, .table--stacked tbody { display: block; }
.table--stacked tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  padding: var(--space-3) 0; border-top: 1px solid var(--hairline); }
.table--stacked tr:first-child { border-top: 0; padding-top: 0; }
.table--stacked td { padding: var(--space-1) 0 0; border: 0; grid-column: 1 / -1; color: var(--text-secondary); }
.table--stacked td:first-child { grid-row: 1; grid-column: 1; padding: 0; font-weight: 500; color: var(--text-primary); }
.table--stacked td.num { grid-row: 1; grid-column: 2; padding: 0 0 0 var(--space-3); color: var(--text-primary); }
.table-scroll { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--radius-card);
  background: var(--surface-card); }
.table-scroll th:first-child, .table-scroll td:first-child { padding-left: 16px; }
.table-scroll tbody tr:first-child > td { border-top: 0; }

@media (max-width: 639px) {
  .table--stack thead, .prose table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .table--stack, .table--stack tbody, .prose table, .prose table tbody { display: block; }
  .table--stack tr, .prose table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
    padding: var(--space-3) 0; border-top: 1px solid var(--hairline); }
  .table--stack tr:first-child, .prose table tr:first-child { border-top: 0; }
  .table--stack td, .prose table td { padding: var(--space-1) 0 0; border: 0; grid-column: 1 / -1;
    color: var(--text-secondary); }
  .table--stack td:first-child, .prose table td:first-child { grid-row: 1; grid-column: 1; padding: 0;
    font-weight: 500; color: var(--text-primary); }
  .table--stack td.num { grid-row: 1; grid-column: 2; padding: 0 0 0 var(--space-3); color: var(--text-primary); }
}

/* ---------------------------------------------------------------- 4.17 Picker options and disclosures */

.options { display: grid; gap: var(--space-2); padding: 0; list-style: none; }
.options > li + li { margin-top: 0; }
.options--grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .options--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
form.pick { margin: 0; }
.option { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); width: 100%;
  min-height: 48px; padding: var(--space-3) var(--space-4); border: 1px solid var(--hairline);
  border-radius: var(--radius-control); background: var(--surface-raised); color: var(--text-primary);
  font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease); }
.option > .icon { color: var(--text-muted); transition: color var(--dur-fast) var(--ease); }
.option:hover { background: var(--surface-hover); border-color: var(--hairline-strong); }
.option:hover > .icon { color: var(--text-primary); }
.option:active { transform: scale(var(--press)); }
.option--quiet { color: var(--text-secondary); font-weight: 400; }
.option--selected { background: var(--accent-subtle); border-color: var(--accent); }
.option--selected > .icon { color: var(--text-primary); }
.options__family { margin: var(--space-6) 0 var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 500; color: var(--text-secondary); }

.disclosure > summary { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px;
  padding: 0 var(--space-3) 0 var(--space-2); border-radius: var(--radius-control);
  font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); color: var(--text-primary); list-style: none; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::marker { content: ""; }
.disclosure > summary:hover { background: var(--surface-hover); }
.disclosure > summary:active { transform: scale(var(--press)); }
.disclosure > summary > .icon { color: var(--text-muted); transition: transform var(--dur-fast) var(--ease); }
.disclosure[open] > summary > .icon { transform: rotate(180deg); }
.disclosure > summary + * { margin-top: var(--space-2); }
.disclosure > * + * { margin-top: var(--space-3); }
/* Quiet (the delete control): the chevron's ink sits on the content edge, so its hover surface reaches 12 into the
   margin; the opened note and button line up with the summary's words */
.disclosure--quiet > summary { margin-left: calc(-1 * var(--space-3)); font: 400 var(--fs-small)/var(--lh-small) var(--font-sans);
  color: var(--text-secondary); }
.disclosure--quiet[open] > :not(summary) { padding-left: var(--space-5); }
/* The summary's 44 px target already leaves 12 under its words: the note follows 8 below it */
.disclosure--quiet[open] > summary + * { padding-top: 0; }
/* Flush (the draft's plain text, the admin refund review): the same chevron on the content edge, at the UI role;
   what opens keeps the content edge */
.disclosure--flush > summary { margin-left: calc(-1 * var(--space-3)); }

/* ---------------------------------------------------------------- 4.18 Offer block */

.offer > * + * { margin-top: var(--space-3); }
.offer__price { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-2);
  color: var(--text-secondary); }
.offer__figure { font: 500 var(--fs-figure)/var(--lh-figure) var(--font-mono); letter-spacing: -0.01em;
  color: var(--text-primary); }
.offer__for { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-secondary); }
.offer__refund { max-width: var(--measure); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-secondary); }
.included { display: grid; gap: var(--space-2); margin: var(--space-4) 0 var(--space-6); padding: 0; list-style: none; }
.included > li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: var(--space-2); margin: 0;
  font-size: var(--fs-small); line-height: var(--lh-small); }
.included > li > .icon { margin-top: 2px; color: var(--text-muted); }
.offer > .included { margin-top: var(--space-4); }
.offer > .included + * { margin-top: var(--space-6); }

/* ---------------------------------------------------------------- 4.19 Route card */

.route { background: var(--route-surface); border: 1px solid var(--route-edge); border-radius: var(--radius-panel);
  box-shadow: var(--shadow-md), var(--highlight-top); padding: var(--space-8); margin-top: var(--space-8); }
.route__decision { display: flex; align-items: baseline; gap: var(--space-3); font-size: var(--fs-decision);
  line-height: var(--lh-decision); font-weight: 500; letter-spacing: 0; text-wrap: balance; }
/* Running text in a route card keeps the measure; zero specificity, so the offer's own widths win */
:where(.route p) { max-width: var(--measure); text-wrap: pretty; }
.route__decision .dot { transform: translateY(-4px); }
.route > * + * { margin-top: var(--space-4); }
.route__alt { max-width: none; margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--hairline);
  font-size: var(--fs-small); line-height: var(--lh-small); }
.route > .route__alt { margin-top: var(--space-6); }
.route__more { padding-top: var(--space-4); border-top: 1px solid var(--hairline); }
.route > .route__more { margin-top: var(--space-6); }
/* The retraction form: the checkbox and its button are one group */
.route__more.form > .actions { margin-top: var(--space-3); }
/* "Show all types" in the picker: its chevron's ink lines up with the option labels above */
.route > .disclosure > summary { padding: 0 var(--space-4); }
@media (max-width: 639px) {
  .route { padding: var(--space-5); }
  /* The scorer link is a 44 tall target; its text keeps 20 to the hairline above and to the card's edge below */
  .route__alt > a { display: inline-flex; align-items: center; min-height: 44px; }
  .route > .route__alt { padding-top: var(--space-2); margin-bottom: calc(-1 * var(--space-3)); }
}

/* ---------------------------------------------------------------- 4.20 The read notice */

.read__eyebrow { margin-bottom: var(--space-2); }
.read > h1 { text-wrap: balance; }
.read__summary { margin-top: var(--space-4); }
.read__summary .lead { color: var(--text-primary); }
/* One caption line under the explanation: not running text, so not held to the 13 px measure (453 px), which split
   it before "the notice itself." */
.read__ai { margin-top: var(--space-2); font-size: var(--fs-caption);
  line-height: var(--lh-caption); color: var(--text-muted); }
.read__ai-label { font-weight: 500; color: var(--text-secondary); }
.read__label { margin: var(--space-6) 0 var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 500; color: var(--text-secondary); }
.read > .read__label + * { margin-top: 0; }
.quote { padding: var(--space-3) var(--space-4); background: var(--surface-sunken); border-radius: var(--radius-control);
  color: var(--text-primary); overflow-wrap: anywhere; }
.quote blockquote { margin: 0; }
.quote__source { margin-top: var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  color: var(--text-muted); text-wrap: pretty; }
.facts { margin-top: var(--space-8); }
.reference { margin-top: var(--space-8); }
.reference__grid { padding: var(--space-6); background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); }
.reference__grid > section > * + * { margin-top: var(--space-2); }
.reference__grid p { max-width: var(--measure); text-wrap: pretty; }
@media (max-width: 639px) { .reference__grid { padding: var(--space-5); } }
.reference__grid > section + section { margin-top: var(--space-6); padding-top: var(--space-6);
  border-top: 1px solid var(--hairline); }
.reference__grid ul { display: grid; gap: var(--space-2); }
.reference__grid li + li { margin-top: 0; }

/* ---------------------------------------------------------------- 4.4 Case rail and property list */

.rail { display: flex; flex-direction: column; gap: var(--space-6); }
.rail--sticky { position: sticky; top: var(--space-6); align-self: start; }
/* A rail taller than a short window (the interview's, 774 tall, at 1280 x 720 or 125 % zoom) would hide its end for
   the whole form: below 820 tall it scrolls with the page */
@media (min-width: 1024px) and (max-height: 819px) { .rail--sticky { position: static; } }
.rail__block { padding: var(--space-5); background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); }
.rail__title { margin-bottom: var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 500; color: var(--text-secondary); }
.rail__block > .rail__title + * { margin-top: 0; }
/* Text outside a rail block (the pledge, the delete control, the check aside's privacy line) sits on the blocks' text
   edge: their 20 padding plus the 1 px border */
.rail > .pledge { margin: 0; padding: 0 calc(var(--space-5) + 1px); border-top: 0; }
.rail__nav { display: flex; flex-direction: column; gap: 2px; }
.rail__nav a { display: flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); margin: 0 calc(-1 * var(--space-3));
  border-radius: var(--radius-control); color: var(--text-secondary); font-size: var(--fs-small);
  line-height: var(--lh-small); text-decoration: none; transition: background-color var(--dur-fast) var(--ease); }
.rail__nav a:hover { background: var(--surface-hover); color: var(--text-primary); }
/* Phones: the rail's group index (interview) and the error summary's rows are touch targets of 44 */
@media (max-width: 639px) {
  .rail__nav a { min-height: 44px; }
  .error-summary ul { margin-top: var(--space-1); }
  .error-summary li + li { margin-top: 0; }
  .error-summary__link { min-height: 44px; align-content: center; }
}
.props > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--space-3); min-height: 36px;
  padding: var(--space-2) 0; border-top: 1px solid var(--hairline); }
.props > div:first-child { border-top: 0; }
.props dt { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted); }
.props dd { display: flex; align-items: baseline; gap: var(--space-2); font-size: var(--fs-small);
  line-height: var(--lh-small); color: var(--text-primary); overflow-wrap: anywhere; min-width: 0; text-wrap: pretty; }
.props dd.mono { display: block; }
.props--wide > div { grid-template-columns: 168px minmax(0, 1fr); }
@media (max-width: 639px) { .props--wide > div { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); } }

/* ---------------------------------------------------------------- 4.21 Delete control, 4.22 Pledge */


/* The rule spans the content width (it ends on a column edge, like every other hairline); the words keep the measure */
.pledge { max-width: none; padding-right: max(0px, calc(100% - var(--measure))); font-size: var(--fs-small);
  line-height: var(--lh-small); color: var(--text-secondary); margin-top: var(--space-8); padding-top: var(--space-4);
  border-top: 1px solid var(--hairline); }

/* ---------------------------------------------------------------- Cards */

.card { padding: var(--space-6); background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); }
.card__title { font-size: var(--fs-subheading); line-height: var(--lh-subheading); font-weight: 500; }
@media (max-width: 639px) { .card { padding: var(--space-5); } }

/* Numbered list with mono numbers (what happens next, before you submit) */
.numbered { display: grid; padding: 0; list-style: none; counter-reset: item; }
.numbered > li { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: baseline; margin: 0;
  padding: var(--space-3) 0; border-top: 1px solid var(--hairline); counter-increment: item; }
.numbered > li:first-child { border-top: 0; padding-top: 0; }
.numbered > li:last-child { padding-bottom: 0; }
.numbered > li::before { content: counter(item, decimal-leading-zero); font: 400 var(--fs-mono)/var(--lh-body) var(--font-mono);
  color: var(--text-muted); }
.numbered--plain > li::before { content: counter(item); }

/* ---------------------------------------------------------------- 4.23 Legal prose */

.prose > :not(table) { max-width: var(--measure); }
/* A three-column table at the text measure squeezed "How long" to four lines a row: tables take the pricing width */
.prose > table { max-width: 832px; }
.prose > h1 { margin-bottom: var(--space-6); }
.prose h2 { margin: var(--space-10) 0 var(--space-3); font-size: var(--fs-heading); line-height: var(--lh-heading); }
.prose h3 { margin: var(--space-6) 0 var(--space-2); }
.prose p { margin: 0 0 var(--space-4); }
.prose ul, .prose ol { margin: 0 0 var(--space-4); padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose li::marker, .appeal-guide li::marker { color: var(--text-muted); }
.prose table { margin: 0 0 var(--space-4); }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- 4.24 Admin stat cards and tags */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.stat { padding: var(--space-5); background: var(--surface-card); border: 1px solid var(--hairline);
  border-radius: var(--radius-card); }
.stat > * + * { margin-top: var(--space-2); }
.stat__label { font-size: var(--fs-caption); line-height: var(--lh-caption); font-weight: 400; color: var(--text-secondary); }
.stat__figure { font: 500 var(--fs-figure)/var(--lh-figure) var(--font-mono); letter-spacing: -0.01em; }
.tag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-tag); background: var(--surface-sunken);
  color: var(--text-secondary); font: 500 var(--fs-caption)/var(--lh-caption) var(--font-sans); white-space: nowrap; }
.tag--pass { background: var(--pass-subtle); color: var(--pass-text); }
.tag--warn { background: var(--warn-subtle); color: var(--warn-text); }
.tag--stop { background: var(--stop-subtle); color: var(--stop-text); }
.tag--info { background: var(--info-subtle); color: var(--info-text); }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
@media (max-width: 1023px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .stats { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- 5.3 Landing hero and sections */

.hero { padding: 56px 0 var(--space-16); }
.hero__grid { display: grid; grid-template-columns: 544px minmax(0, 1fr); column-gap: 56px; align-items: center; }
.hero__grid > * { min-width: 0; }
.display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 500;
  text-wrap: balance; }
/* Headline B wraps greedily: its question then ends at a line end ("your Plan of Action?"), where balancing would
   split "Plan of / Action?" at every width */
.display[data-variant="B"] { text-wrap: wrap; }
.hero__text > .lead { margin-top: var(--space-5); }
.hero__text > form { margin-top: var(--space-8); }
/* The privacy line (landing form, check aside): the lock sits on the first line when the text wraps */
.hero__privacy { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--fs-caption);
  line-height: var(--lh-caption); color: var(--text-muted); text-wrap: pretty; }
.hero__privacy > .icon { margin-top: 2px; }
/* The pledge closes the paste form, as it did before the overhaul: a quiet line on the content edge, no rule */
.hero__text > .pledge { margin-top: var(--space-3); padding: 0; border-top: 0; font-size: var(--fs-caption);
  line-height: var(--lh-caption); text-wrap: pretty; }
.section { padding-top: var(--space-24); }
/* Landing sections sit 96 apart (64 on phone), and the hero's own bottom padding counts toward it */
.hero + .section { padding-top: var(--space-8); }
.section > h2 + * { margin-top: var(--space-6); }
.how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-8); margin: 0; padding: 0;
  list-style: none; counter-reset: how; }
.how > li { margin: 0; padding-top: var(--space-4); border-top: 1px solid var(--hairline); counter-increment: how;
  font-size: var(--fs-ui); line-height: var(--lh-subheading); color: var(--text-secondary); }
.how > li::before { content: counter(how, decimal-leading-zero); display: block; margin-bottom: var(--space-2);
  font: 400 var(--fs-mono)/var(--lh-mono) var(--font-mono); letter-spacing: 0.01em; color: var(--text-muted); }

/* 1024 to 1199: a 544 text column would leave the preview less than half the hero (360 at 1024), so the split is two
   halves; the preview stacks its review above the sheet up to 1279 (section 7.3) */
@media (min-width: 1024px) and (max-width: 1199px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--space-12); }
}
@media (max-width: 1023px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-12); }
  .how { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 639px) {
  .hero { padding: var(--space-10) 0; }
  .section { padding-top: var(--space-16); }
  .hero + .section { padding-top: var(--space-6); }
  .how { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
}

/* ---------------------------------------------------------------- 7. The landing hero preview */

.preview { margin: 0; }
.preview__frame { display: grid; grid-template-columns: minmax(0, 1fr) 184px; grid-template-rows: 100%;
  grid-template-areas: "sheet review"; gap: var(--space-3); height: 660px; padding: var(--space-3); overflow: hidden;
  align-items: start; background: var(--kraft); border: 1px solid var(--hairline);
  border-radius: var(--radius-panel); animation: preview-in var(--dur-enter) var(--ease) 120ms both; }
/* Desktop: the paper runs 4 px past the frame's inner edge, so the frame crops it the way a window crops a long
   document and the paper keeps its shadow (a mask on the paper itself would clip it); only the text fades, over
   the last 40 px that show, so at 1440 the F1 tag stays crisp (7.3) */
.preview__sheet { grid-area: sheet; height: calc(100% + var(--space-4)); overflow: hidden;
  padding: var(--space-5) var(--space-4) 0 var(--space-5); background: var(--surface-paper);
  border: 1px solid var(--hairline); border-radius: var(--radius-tag); box-shadow: var(--shadow-sheet); }
.preview__page { height: 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent calc(100% - 8px));
  mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent calc(100% - 8px)); }
.preview__title { font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); }
.preview__page > .meta { margin-top: 2px; }
.preview__section { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--hairline); }
.preview__heading { display: flex; gap: var(--space-2); align-items: baseline; font: 500 var(--fs-caption)/var(--lh-caption) var(--font-sans); }
.preview .sentences { margin-top: var(--space-2); gap: var(--space-2); }
.preview .sentence { grid-template-columns: minmax(0, 1fr) 60px; column-gap: var(--space-2);
  font-size: var(--fs-caption); line-height: var(--lh-caption); }
.preview .sentence > .refs { padding-top: 1px; }
.preview .sentences--numbered .sentence { grid-template-columns: 16px minmax(0, 1fr) 60px; }
.preview .sentences--numbered .sentence::before { font: 400 var(--fs-caption)/var(--lh-caption) var(--font-mono); }
.preview__review { grid-area: review; display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-2) var(--space-1); }
/* Label on its own row, the figure and its /100 on the next: a grid, so the block is only as wide as its widest row */
.preview__figure { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline;
  font: 400 var(--fs-caption)/var(--lh-caption) var(--font-mono); color: var(--text-secondary); }
.preview__figure-label { grid-column: 1 / -1; font: 400 var(--fs-caption)/var(--lh-caption) var(--font-sans);
  color: var(--text-secondary); }
.preview__score { font: 500 var(--fs-figure-sm)/var(--lh-figure-sm) var(--font-mono); color: var(--accent-text); }
.preview__checks { padding-top: var(--space-3); border-top: 1px solid var(--hairline); }
.preview__checks .check { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.preview__more { padding-left: var(--space-6); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-secondary); }
.preview__trace { padding-top: var(--space-3); border-top: 1px solid var(--hairline); font-size: var(--fs-caption);
  line-height: var(--lh-caption); color: var(--text-secondary); }
.preview__caption { margin-top: var(--space-3); font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-muted);
  text-wrap: pretty; }

/* 1024 to 1279 (a frame 456 to 599 wide): beside a 184 review column the sentences would shrink to 33 characters a
   line, so the review becomes one row above the sheet, the two figures and the check that needs work beside them;
   the passing rows and the trace line wait for the full frame (600 from 1280) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .preview__frame { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "review" "sheet"; }
  .preview__review { flex-direction: row; align-items: flex-start; gap: var(--space-6); padding: var(--space-1) var(--space-2); }
  .preview__review > .preview__figure { flex: none; }
  .preview__checks { flex: 1 1 0; min-width: 0; padding: 0 0 0 var(--space-6); border-top: 0;
    border-left: 1px solid var(--hairline); }
  .preview__checks > .check--pass, .preview__more, .preview__trace { display: none; }
}
@media (max-width: 1023px) {
  .preview__frame { height: auto; grid-template-rows: none; overflow: visible; }
  .preview__sheet { height: auto; padding-bottom: var(--space-5); }
  .preview__page { height: auto; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 639px) {
  .preview__frame { grid-template-columns: minmax(0, 1fr); grid-template-areas: "sheet" "review"; padding: var(--space-2); }
  .preview__sheet { padding: var(--space-4) var(--space-3) var(--space-4) var(--space-4); }
  .preview__section--desktop { display: none; }
  .preview .sentence { grid-template-columns: minmax(0, 1fr); font-size: var(--fs-small); line-height: var(--lh-small); }
  .preview .sentence > .refs { grid-row: 2; justify-content: flex-start; margin-top: 4px; padding-top: 0; }
  .preview .sentences--numbered .sentence { grid-template-columns: 16px minmax(0, 1fr); }
  .preview .sentences--numbered .sentence > .refs { grid-column: 2; }
  .preview__review { flex-direction: row; align-items: flex-start; gap: var(--space-6);
    padding: var(--space-1) var(--space-2) var(--space-2); }
  .preview__review > :not(.preview__figure) { display: none; }
}

/* ---------------------------------------------------------------- Page-level pieces the templates share */

/* Landing form rhythm (5.3): actions and the privacy line 16 below the field */
.hero .form > .actions, .hero .form > .hero__privacy { margin-top: var(--space-4); }
.aside-grid__aside > .hero__privacy { padding: 0 calc(var(--space-5) + 1px); }

/* Pricing (6.1) */
.measure-wide { max-width: 832px; }
.pricing__name { font-weight: 500; color: var(--text-primary); }
.pricing__price { font-size: var(--fs-heading); line-height: var(--lh-heading); font-weight: 500; color: var(--text-primary); }
/* "Free" is a word, not a figure: sans, a step quieter, still right-aligned in the column */
td.num.pricing__price--word { font-family: var(--font-sans); color: var(--text-secondary); }
.pricing-top + .page-body { margin-top: 0; }
.pricing-top .actions { margin-top: var(--space-6); }
.rail__block > .included { margin: 0; }
.pricing__for { color: var(--text-secondary); }
.page-body > .actions { margin-top: var(--space-6); }
.page-body > section { margin-top: var(--space-12); }
.faq__item { max-width: var(--measure); }
.faq > .faq__item + .faq__item { margin-top: var(--space-6); }
.faq__item > p { margin-top: var(--space-2); color: var(--text-secondary); }
.faq > h2 + .faq__item { margin-top: var(--space-6); }

/* Appeal guide (6.1): split top, then the guide with its sub-nav */
/* A split: the text block centers against the paste card, so neither side leaves an empty corner */
.appeal-top { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--space-16);
  align-items: center; }
.appeal-top__text > .lead { margin-top: var(--space-4); }
/* The paste card is the landing's paste form: actions and the privacy line 16 below the field */
.appeal-top .form > .actions, .appeal-top .form > .hero__privacy { margin-top: var(--space-4); }
.appeal-guide { margin-top: var(--space-16); }
.appeal-guide section > ul { display: grid; gap: var(--space-2); }
.appeal-guide section > ul > li + li { margin-top: 0; }
@media (max-width: 1023px) {
  .appeal-top { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-8); }
  .appeal-guide { margin-top: var(--space-12); }
}

/* Score form (6.1): the aside names the two scores the result will show, in hairline rows */
.score-kinds > div { padding: var(--space-3) 0; border-top: 1px solid var(--hairline); }
.score-kinds > div:first-child { padding-top: 0; border-top: 0; }
.score-kinds dt { font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; }
.score-kinds dd { margin-top: var(--space-1); font-size: var(--fs-small); line-height: var(--lh-small);
  color: var(--text-secondary); }
.rail__block > .score-kinds + .score-kinds__note { margin-top: 0; padding-top: var(--space-3);
  border-top: 1px solid var(--hairline); }

/* Score result (6.4) */
/* The context is two short sentences: balanced, so the break falls between them, not before "its decision." */
.score-head > .page-header__context { text-wrap: balance; }
.score-grid + * { margin-top: var(--space-8); }
.score-delete { margin-top: var(--space-6); }
.review-block .table--stacked { margin-top: var(--space-4); }
.review-block > .checks__group + .table--stacked { margin-top: 0; }
/* The AI block while it runs: the live line stands where the figure will be, then the rubric it is scored on */
.review-block--waiting > h2 + .status { margin-top: var(--space-2); }
.review-block--waiting > .status + .note { margin-top: var(--space-1); }
.rubric-wait { display: grid; gap: var(--space-2); padding: 0; list-style: none; }
.rubric-wait > li { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: var(--space-2); margin: 0;
  font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-secondary); }
.rubric-wait > li > .progress__ring { margin: 6px 4px 0; }
/* The AI block when it cannot come is the callout itself, padded like the card beside it */
.score-grid__callout { padding: var(--space-6); }
@media (max-width: 639px) { .score-grid__callout { padding: var(--space-5); } }
/* The next step after the scores: a full-width option row (a secondary link with its chevron) */
.score-next { min-height: 56px; padding: var(--space-4) var(--space-5); }

/* Case pages */
.case-main > .route:first-child { margin-top: 0; }
.case-main > .callout:first-child { margin-bottom: var(--space-8); }
.case-main > .read:first-child, .case-main > .callout + .read { margin-top: 0; }
.facts__deadline { font-weight: 500; }
.rail__delete { padding: 0 calc(var(--space-5) + 1px); }
.waiting__retry { margin-top: var(--space-4); }
/* Paid (6.5): what happens next, a row per build step: its name, then what it asks of the seller */
.paid-steps__name { font: 500 var(--fs-ui)/var(--lh-ui) var(--font-sans); color: var(--text-primary); }
.paid-steps__name + .note { margin-top: var(--space-1); }
.card > .card__title + * { margin-top: var(--space-4); }
.card > .numbered + .actions { margin-top: var(--space-6); }

/* Build forms (6.5): interview, follow-ups, evidence; no box, groups with a hairline above */
.build-form > * + * { margin-top: var(--space-8); }
.build-form > .error-summary { margin-bottom: 0; }
.build-form__group { padding-top: var(--space-6); border-top: 1px solid var(--hairline); }
.build-form > .build-form__group { margin-top: var(--space-12); }
/* The first group opens the form under the page header (or the error summary) without a rule of its own */
.build-form > .build-form__group:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.build-form > .error-summary + .build-form__group:first-of-type { margin-top: var(--space-8); }
.build-form > .build-form__group + .field { margin-top: var(--space-4); }
.build-form > fieldset + fieldset { margin-top: var(--space-6); }
.build-form__submit { padding-top: var(--space-6); border-top: 1px solid var(--hairline); }
.build-form__submit > .note { margin: 0; }
/* After a callout (evidence not yet verified) the button needs no rule above it */
.build-form > .callout + .build-form__submit { padding-top: 0; border-top: 0; }
/* Forms whose tags reach two digits (Q10 on): every tag is as wide as the widest, so the questions start on one line */
.build-form--wide-refs .ref { min-width: calc(3ch + 2 * var(--space-1)); text-align: center; }
.case-main > .callout + .build-form { margin-top: var(--space-8); }
.case-main > .page-header + .callout { margin-top: 0; }
.quote--example { margin: var(--space-3) 0 0; }
.quote--example + * { margin-top: var(--space-3); }
.quote__label { margin-bottom: var(--space-1); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 500; color: var(--text-secondary); }

/* Draft page (6.5) */
.draft-failed { margin-bottom: var(--space-8); }
.case-more > .card + .card { margin-top: var(--space-6); }
.case-more #plain { display: block; width: 100%; min-height: 240px; margin-top: var(--space-2); padding: var(--space-3);
  border: 1px solid var(--hairline-strong); border-radius: var(--radius-control); background: var(--surface-sunken);
  color: var(--text-primary); font: 400 var(--fs-small)/var(--lh-small) var(--font-mono); resize: vertical;
  field-sizing: content; max-height: 70vh; }  /* as tall as the draft, up to most of a phone screen (mobile-a11y-seo-15) */
/* The export buttons are controls with their own edge: 16 under the card's title, not the 8 a list or text takes */
.card > h2 + .export__actions { margin-top: var(--space-4); }
/* On a phone the four export buttons are one full-width column, whichever of them is the primary */
@media (max-width: 639px) {
  .export__actions { flex-direction: column; align-items: stretch; }
  .export__actions .btn { width: 100%; }
}
/* The revision and the refund: one row under a hairline, the revision and its note first, the refund at the far end
   (a quiet button whose words end on the content edge) */
.revision { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-4) var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--hairline); }
.revision > * + * { margin-top: 0; }
.revision__main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); min-width: 0; }
.revision__main > form { display: contents; }
.revision__main > .note { flex: 1 1 240px; max-width: 46ch; }
.revision__refund { margin-left: auto; }
.revision__refund > .btn--quiet { margin-right: calc(-1 * var(--space-3)); }
/* Alone (a revision whose build failed: the callout above holds its actions), the refund starts the row */
.revision > .revision__refund:first-child { margin-left: 0; }
.revision > .revision__refund:first-child > .btn--quiet { margin: 0 0 0 calc(-1 * var(--space-3)); }
.revision--empty { display: none; }
@media (max-width: 639px) {
  .revision { flex-direction: column; align-items: stretch; }
  .revision__main { flex-direction: column; align-items: stretch; }
  .revision__main > .note { flex: none; }
  .revision__refund { margin-left: 0; }
  .revision__refund > .btn--quiet { margin: 0 0 0 calc(-1 * var(--space-3)); }
}
/* The review: the label, the figures, the trace line, what to act on (needs work, top fixes), what passes, then
   what the scores mean under a hairline. Group labels 16 below the list above them, 8 above their own rows */
.review .checks__group:first-of-type { margin-top: var(--space-4); }
.review > .checks__group + .checks, .review > .checks__group + .numbered { margin-top: 0; }
/* The trace line's dot sits centered in the check icons' 16 px column, so its words start on the check labels' edge */
.review > .status > .dot { margin: 0 4px; }
/* The fixes line up with the check rows: the number centered in the icons' 16 px column, the words 8 after it */
.review__fixes { gap: var(--space-2); }
.review__fixes > li { grid-template-columns: 16px minmax(0, 1fr); column-gap: var(--space-2); padding: 0; border-top: 0; }
.review__fixes > li::before { font-size: var(--fs-mono); line-height: var(--lh-small); text-align: center; }
.review__fixes .note { color: var(--text-primary); }
.review > .review__notes { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--hairline); }
.review__notes > * + * { margin-top: var(--space-2); }
/* AI scoring unavailable, inside the review: the info mark and the words as one row, like a check, no box in a box */
.callout--inline { padding: 0; background: none; border: 0; border-radius: 0; column-gap: var(--space-2); }
.callout--inline > .icon { margin-top: 2px; }
.callout--inline .callout__body > p { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-secondary); }

/* Admin (5.5, 4.24) */
.admin .stats + .admin__table { margin-top: var(--space-8); }
/* The main table: each window's three columns under one spanner with a hairline, the two windows 32 apart */
.admin__table th { vertical-align: bottom; }
.admin__table th[colspan] { padding-bottom: var(--space-1); text-align: center; }
.admin__table th[colspan] > span { display: block; padding-bottom: var(--space-1); border-bottom: 1px solid var(--hairline-strong); }
.admin__table .admin__window-start { padding-left: var(--space-8); }
/* On a phone the table scrolls inside its frame instead of wrapping each metric's name over three lines */
.admin__table td:first-child { white-space: nowrap; }
/* Rows step on hover, so a figure can be read across seven columns */
.admin__table tbody tr:hover > td { background: var(--surface-hover); }
.admin__section { margin-top: var(--space-12); }
.admin__section > .note { margin-top: var(--space-1); }
.admin__outcomes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6);
  align-items: start; margin-top: var(--space-6); }
.admin__outcomes-grid > * { min-width: 0; }
.admin__window { margin-bottom: var(--space-2); font-size: var(--fs-caption); line-height: var(--lh-caption);
  font-weight: 500; color: var(--text-secondary); }
.admin__outcomes { font-size: var(--fs-caption); line-height: var(--lh-caption); }
.admin__outcomes td { vertical-align: middle; }
.tag > .mono { margin-left: var(--space-1); font-weight: 400; }
.admin__refund { max-width: var(--short); }
.admin__refund > .card + * { margin-top: var(--space-6); }
.admin__amount { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--text-secondary); }
.admin h1 .mono { font-size: var(--fs-heading); line-height: var(--lh-heading); color: var(--text-secondary); }
@media (max-width: 1023px) { .admin__outcomes-grid { grid-template-columns: minmax(0, 1fr); } }

/* Phones: long button labels wrap instead of pushing past the edge */
@media (max-width: 639px) {
  .btn { height: auto; min-height: 44px; padding-top: var(--space-2); padding-bottom: var(--space-2);
    white-space: normal; text-align: center; }
  .btn--sm { min-height: 36px; padding-top: var(--space-1); padding-bottom: var(--space-1); }
}
@media (max-width: 639px) and (pointer: coarse) { .btn--sm { min-height: 44px; } }

/* Touch screens at any width (a tablet, an iPad in landscape): every standalone link is a 44 px target (4.25) */
@media (pointer: coarse) {
  .site-nav__link { height: 44px; }
  .footer-links { row-gap: 0; }
  .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .rail__nav a, .doc-nav a { min-height: 44px; }
  .route__alt > a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---------------------------------------------------------------- 5.1 Overflow guard */

.case-main, .case-rail, .case-more, .card, .route, .callout__body, .rail__block, .props dd, .quote, .sheet,
.footer-links {
  overflow-wrap: anywhere; }
.casebar__ref .mono { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- 2.7 Motion */

@keyframes preview-in { from { opacity: 0; transform: translateY(var(--rise)); } to { opacity: 1; transform: none; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes live { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
