/* ---------- Fonts (self-hosted, OFL; no third-party CDN) ---------- */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Tokens: light (default) ---------- */
:root {
  color-scheme: light dark;

  /* Type */
  --font-head: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --text-xs: 0.6875rem;   /* 11px: mono labels */
  --text-sm: 0.875rem;    /* 14px */
  --text-md: 1rem;        /* 16px: body, never smaller on inputs (iOS zoom) */
  --text-lg: 1.1875rem;   /* 19px: lede */
  --text-xl: clamp(1.375rem, 1.1rem + 1.2vw, 1.75rem);  /* h2 */
  --text-2xl: clamp(1.75rem, 1.3rem + 2.2vw, 2.5rem);   /* h1 */
  --leading: 1.6;
  --tracking-label: 0.14em;

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --measure: 40rem;       /* reading column */
  --wrap: 60rem;          /* page frame */

  /* Radii (squared, engineered) */
  --radius-sm: 3px;
  --radius: 4px;
  --radius-lg: 6px;

  /* Colour: light */
  --bg: #f5f7fa;
  --bg-2: #eaeff5;
  --surface: #ffffff;
  --line: #d5dee8;
  --line-2: #b4c3d4;
  --text: #0a1929;
  --muted: #45586f;
  --dim: #5a6e86;
  --accent: #00788a;        /* links, focus, current state: 5.0:1 on white */
  --accent-fill: #08b8ca;   /* button fill (brand cyan); text on it is --on-accent */
  --accent-soft: #08b8ca1f;
  --on-accent: #04121d;
  --done: #1f8a5b;          /* 4.6:1 on white */
  --warn-bg: #fff4d6;
  --warn-line: #e3b341;
  --warn-text: #5c4300;
  --danger: #b3261e;
  --grid-line: #0a192910;
  --shadow: 0 1px 2px #0a192914, 0 8px 24px -12px #0a192933;
}

/* ---------- Tokens: dark ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1929;
    --bg-2: #0d2036;
    --surface: #10263f;
    --line: #1f3a5a;
    --line-2: #2a4a70;
    --text: #e8eef5;
    --muted: #93a7bf;
    --dim: #7e96b2;
    --accent: #08b8ca;
    --accent-fill: #08b8ca;
    --accent-soft: #08b8ca1f;
    --on-accent: #04121d;
    --done: #3fcf8e;
    --warn-bg: #e3b3411a;
    --warn-line: #e3b341;
    --warn-text: #f1d48a;
    --danger: #ff8a80;
    --grid-line: #1f3a5a80;
    --shadow: 0 1px 0 #ffffff08 inset, 0 12px 32px -16px #000000a0;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: var(--text-md)/var(--leading) var(--font-body);
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 var(--space-4); }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: 1.0625rem; letter-spacing: -0.01em; }
p { margin: 0 0 var(--space-4); }
a { color: var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }
.lede { font-size: var(--text-lg); color: var(--muted); max-width: var(--measure); }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.label {
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font: 500 var(--text-xs)/1.2 var(--font-mono);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--accent);
}
.label .idx { color: var(--dim); }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 10; background: var(--accent-fill); color: var(--on-accent); padding: var(--space-2) var(--space-4); font-weight: 600; text-decoration: none; }
.skip-link:focus { left: var(--space-4); top: var(--space-4); border-radius: var(--radius); }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 92%, transparent); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 3.5rem; }
.brand { display: flex; align-items: baseline; gap: var(--space-2); text-decoration: none; color: var(--text); }
.brand b { font: 600 1.0625rem/1 var(--font-head); letter-spacing: 0.06em; }
.brand span { font: 400 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); border-left: 1px solid var(--line-2); padding-left: var(--space-2); }
.site-nav { display: flex; align-items: center; gap: var(--space-4); font-size: var(--text-sm); font-weight: 500; }
.site-nav a, .site-nav .link { color: var(--muted); text-decoration: none; padding: var(--space-2) 0; min-height: 44px; display: inline-flex; align-items: center; }
.site-nav a:hover, .site-nav .link:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav form { margin: 0; }
@media (max-width: 26rem) { .brand span { display: none; } }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 40rem) { .wrap { padding: 0 var(--space-6); } }
main { flex: 1; padding: var(--space-5) 0 var(--space-8); }
.narrow { max-width: var(--measure); }

.page-head {
  position: relative;
  padding: var(--space-6) 0 var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
}
.page-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.page-head > * { position: relative; }
.page-head h1 { margin-bottom: var(--space-2); }
.back { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); font-weight: 500; color: var(--muted); text-decoration: none; min-height: 44px; }
.back:hover { color: var(--text); }
.back::before { content: "\2190"; font-family: var(--font-mono); }

.intake-nav { margin: 0 calc(var(--space-4) * -1) var(--space-6); padding: 0 var(--space-4); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.intake-nav ul { display: flex; gap: var(--space-5); margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.intake-nav a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--muted); text-decoration: none; font-size: var(--text-sm); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.intake-nav a:hover { color: var(--text); }
.intake-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.intake-nav .count { font: 500 var(--text-xs)/1 var(--font-mono); background: var(--accent-fill); color: var(--on-accent); border-radius: 999px; padding: 3px 7px; }
.intake-nav .soon { font: 400 var(--text-xs)/1 var(--font-mono); color: var(--dim); }
@media (min-width: 40rem) { .intake-nav { margin-left: 0; margin-right: 0; padding: 0; } }

/* ---------- Buttons ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-5);
  font: 600 var(--text-md)/1 var(--font-body);
  border-radius: var(--radius); border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent-fill) 88%, var(--text)); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-block { width: 100%; }
@media (min-width: 40rem) { .btn-block { width: auto; } }
.btn .arrow { font-family: var(--font-mono); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
button.link:hover { color: var(--text); }

/* ---------- Forms ---------- */
.field { margin-bottom: var(--space-5); }
.field > label, .field > .field-label, legend { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.field .opt { font-weight: 400; color: var(--dim); }
.hint { display: block; color: var(--muted); font-size: var(--text-sm); margin-bottom: var(--space-2); }
input[type="text"], input[type="email"], select, textarea {
  width: 100%; min-height: 48px;
  padding: var(--space-3) var(--space-3);
  font: var(--text-md)/1.4 var(--font-body);
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius);
}
textarea { resize: vertical; min-height: 7rem; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.5rem; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--space-5); }
.choices { display: grid; gap: var(--space-2); }
.choices.row { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.choice { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); min-height: 48px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input { margin: 0.2rem 0 0; accent-color: var(--accent); width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.choice small { display: block; color: var(--muted); font-size: var(--text-sm); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow); }
@media (min-width: 40rem) { .card { padding: var(--space-6); } }

.notice { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--warn-line); border-left-width: 4px; background: var(--warn-bg); color: var(--warn-text); border-radius: var(--radius); margin-bottom: var(--space-5); font-size: var(--text-sm); }
.notice strong { color: inherit; }
.notice.info { border-color: var(--line-2); border-left-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.errors { border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-5); }
.errors p { font-weight: 600; margin-bottom: var(--space-2); }
.errors ul { margin: 0; padding-left: var(--space-5); }
[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }

.ai-disclosure { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-sm); color: var(--muted); padding: var(--space-3) 0; margin: 0 0 var(--space-4); border-top: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); }
.ai-badge { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 4px 6px; }
.ai-badge::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; transform: rotate(45deg); }

.tag { display: inline-flex; align-items: center; gap: 7px; font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tag.current { color: var(--accent); }
.tag.done { color: var(--done); }
.tag.wait { color: var(--warn-text); }
.tag.wait::before { background: var(--warn-line); }

dl.facts { display: grid; grid-template-columns: 1fr; gap: var(--space-1) var(--space-5); margin: 0; }
dl.facts dt { font: 400 var(--text-xs)/1.8 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-top: var(--space-3); }
dl.facts dd { margin: 0; }
@media (min-width: 40rem) {
  dl.facts { grid-template-columns: 12rem 1fr; }
  dl.facts dt { margin-top: 0; padding-top: var(--space-3); border-top: 1px solid var(--line); }
  dl.facts dd { padding-top: var(--space-3); border-top: 1px solid var(--line); }
}

.thread { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-3); }
.msg { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); background: var(--bg); max-width: 34rem; }
.msg.you { justify-self: end; background: var(--accent-soft); border-color: transparent; }
.msg .who { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-1); }
.msg .who time { font: 400 var(--text-xs)/1 var(--font-mono); color: var(--dim); }
.msg p:last-child { margin-bottom: 0; }
.msg .meta { font-size: var(--text-sm); color: var(--muted); }

details.disclose > summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 44px; display: flex; align-items: center; gap: var(--space-2); list-style: none; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary::before { content: "+"; font-family: var(--font-mono); width: 1rem; }
details.disclose[open] > summary::before { content: "\2212"; }
details.disclose[open] > summary { margin-bottom: var(--space-3); }

/* ---------- Screen: sign-in family ---------- */
.auth { flex: 1; display: grid; align-content: center; padding: var(--space-6) 0 var(--space-8);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px; }
.auth-grid { display: grid; gap: var(--space-6); align-items: center; }
@media (min-width: 52rem) { .auth-grid { grid-template-columns: 1fr 26rem; gap: var(--space-8); } }
.auth-intro h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem); max-width: 16ch; }
.auth-intro .lede { margin-bottom: var(--space-5); }
.auth-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); font-size: var(--text-sm); color: var(--muted); }
.auth-steps li { display: flex; gap: var(--space-3); }
.auth-steps b { font: 500 var(--text-xs)/1.9 var(--font-mono); color: var(--accent); }
@media (max-width: 51.99rem) { .auth-steps { display: none; } }
.auth-card h2 { font-size: 1.375rem; }
.auth-card .fine { font-size: var(--text-sm); color: var(--muted); margin: var(--space-4) 0 0; }

/* ---------- Screen: Your intakes ---------- */
.head-row { display: flex; flex-direction: column; gap: var(--space-4); }
@media (min-width: 40rem) { .head-row { flex-direction: row; align-items: flex-end; justify-content: space-between; } }
.head-row p { margin: 0; }
.intakes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.intake { position: relative; display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.intake:hover { border-color: var(--line-2); }
.intake:has(a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.intake h2 { font-size: 1.125rem; margin: 0; }
.intake h2 a { color: var(--text); text-decoration: none; }
.intake h2 a::after { content: ""; position: absolute; inset: 0; }
.intake h2 a:focus-visible { outline: none; }
.intake .meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; font-size: var(--text-sm); color: var(--muted); }
.intake .needs { font-weight: 600; color: var(--text); }
.intake .needs::before { content: "\25CF"; color: var(--accent); margin-right: 6px; font-size: 0.7em; vertical-align: 2px; }
.progress { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; max-width: 18rem; }
.progress i { height: 4px; border-radius: 2px; background: var(--line); }
.progress i.done { background: var(--done); }
.progress i.current { background: var(--accent-fill); }
@media (min-width: 40rem) { .intake { grid-template-columns: 1fr auto; align-items: center; } .intake .progress { grid-column: 2; grid-row: 1 / span 2; width: 12rem; } }
.empty { text-align: center; max-width: 30rem; margin: var(--space-6) auto 0; padding: var(--space-7) var(--space-5); border: 1px dashed var(--line-2); border-radius: var(--radius-lg); background: var(--surface); }
.empty .btn { margin-top: var(--space-2); }
.empty-mark { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; width: 9rem; margin: 0 auto var(--space-5); }
.empty-mark span { height: 6px; border-radius: 3px; background: var(--line); }
.empty-mark span:first-child { background: var(--accent-fill); }

/* ---------- Screen: intake hub ---------- */
.danger-link { color: var(--muted); font-size: var(--text-sm); }

/* ---------- Screen: Start an intake (/submit) ---------- */
.submit-layout { display: grid; gap: var(--space-6); }
@media (min-width: 60rem) { .submit-layout { grid-template-columns: minmax(0, 1fr) 17rem; gap: var(--space-7); align-items: start; } }
.group { border-top: 1px solid var(--line); padding-top: var(--space-5); margin-bottom: var(--space-6); }
.group > legend, .group > h2 { float: left; width: 100%; font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: var(--space-1); }
.group > legend + *, .group .group-intro { clear: both; }
.group-intro { color: var(--muted); margin-bottom: var(--space-5); }
.group .label { margin-bottom: var(--space-2); }
.field > label.drop { display: grid; font-weight: 400; margin: 0; }
.drop { display: grid; gap: var(--space-1); justify-items: center; text-align: center; padding: var(--space-5) var(--space-4); border: 1px dashed var(--line-2); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; }
.drop:hover, .drop:has(input:focus-visible) { border-color: var(--accent); background: var(--accent-soft); }
.drop:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop b { font-weight: 600; }
.drop .muted { font-size: var(--text-sm); }
.drop input { font: var(--text-sm) var(--font-body); color: var(--muted); max-width: 100%; margin-top: var(--space-2); }
.drop input::file-selector-button { font: 600 var(--text-sm) var(--font-body); padding: var(--space-2) var(--space-4); margin-right: var(--space-3); border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg); color: var(--text); cursor: pointer; }
.or { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0; font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--dim); }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.consent { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); }
.consent p { font-size: var(--text-sm); color: var(--muted); }
.submit-row { display: grid; gap: var(--space-3); }
.submit-row p { margin: 0; font-size: var(--text-sm); color: var(--muted); }
@media (min-width: 40rem) { .submit-row { grid-template-columns: auto 1fr; align-items: center; gap: var(--space-5); } }
.aside { position: sticky; top: 5rem; display: grid; gap: var(--space-4); }
.aside h2 { font-size: 1rem; margin-bottom: var(--space-3); }
.next-steps { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); color: var(--muted); }
.next-steps li { display: flex; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.next-steps b { font: 500 var(--text-xs)/1.9 var(--font-mono); color: var(--accent); }
@media (max-width: 59.99rem) { .aside { position: static; } }

/* ---------- Screen: an intake's timeline ---------- */
.tl-layout { display: grid; gap: var(--space-7); }
@media (min-width: 60rem) { .tl-layout { grid-template-columns: minmax(0, 1fr) 22rem; gap: var(--space-7); align-items: start; } }

.timeline { list-style: none; margin: 0; padding: 0; counter-reset: stage; }
.stage { position: relative; display: grid; grid-template-columns: 2.5rem 1fr; column-gap: var(--space-4); padding-bottom: var(--space-5); }
.stage::before { content: ""; position: absolute; left: calc(1.25rem - 1px); top: 2.5rem; bottom: 0; width: 2px; background: var(--line); }
.stage:last-child::before { display: none; }
.stage.done::before { background: var(--done); }
.stage.current::before { background: linear-gradient(var(--accent-fill), var(--line) 70%); }
.stage.upcoming::before { background: repeating-linear-gradient(var(--line-2) 0 4px, transparent 4px 9px); }

.node { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; font: 500 0.8125rem/1 var(--font-mono); border: 2px solid var(--line-2); color: var(--dim); background: var(--bg); position: relative; z-index: 1; }
.done .node { background: var(--done); border-color: var(--done); color: var(--bg); }
.done .node span { display: none; }
.done .node::after { content: ""; width: 12px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(-45deg); }
.current .node { border-color: var(--accent-fill); background: var(--accent-fill); color: var(--on-accent); box-shadow: 0 0 0 6px var(--accent-soft); }
@media (prefers-reduced-motion: no-preference) {
  .current .node { animation: halo 2.8s ease-in-out infinite; }
  @keyframes halo { 0%, 100% { box-shadow: 0 0 0 4px var(--accent-soft); } 50% { box-shadow: 0 0 0 10px var(--accent-soft); } }
}

.stage-body { padding-top: 0.45rem; min-width: 0; }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); margin-bottom: var(--space-1); }
.stage h3 { margin: 0; font-size: 1.0625rem; }
.stage p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.upcoming h3 { color: var(--muted); font-weight: 500; }
.done .stage-body time { font: 400 var(--text-xs)/1 var(--font-mono); color: var(--dim); }

.now { margin-top: var(--space-4); padding: var(--space-4) var(--space-5); border: 1px solid var(--line); border-left: 3px solid var(--accent-fill); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.now h4 { margin: 0 0 var(--space-2); font: 600 var(--text-md)/1.3 var(--font-body); color: var(--text); }
.now ul { margin: 0 0 var(--space-4); padding: 0; list-style: none; font-size: var(--text-sm); }
.now li span:last-child { white-space: nowrap; }
.now li { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.now li:last-child { border-bottom: 0; }
.now .actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.stage-links { margin-top: var(--space-2); font-size: var(--text-sm); }

.fig { margin: var(--space-2) 0 0; font: 400 var(--text-xs)/1.5 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }

.submitted h2 { font-size: 1.25rem; }
.submitted .brief { font-size: var(--text-sm); color: var(--muted); border-left: 2px solid var(--line-2); padding-left: var(--space-3); margin-bottom: var(--space-4); }
.file { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.file b { font: 500 var(--text-xs)/1 var(--font-mono); padding: 4px 6px; border-radius: var(--radius-sm); background: var(--bg-2); color: var(--muted); }
@media (min-width: 40rem) { .submitted dl.facts { grid-template-columns: 1fr; } .submitted dl.facts dt { border-top: 1px solid var(--line); } .submitted dl.facts dd { border-top: 0; padding-top: 0; } }

/* ---------- Screen: the summary to confirm ---------- */
.sum-layout { display: grid; gap: var(--space-6); }
@media (min-width: 60rem) { .sum-layout { grid-template-columns: 14rem minmax(0, 1fr); gap: var(--space-7); align-items: start; } }
.toc { position: sticky; top: 5rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; }
.toc a { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; color: var(--text); text-decoration: none; font-size: var(--text-sm); background: var(--surface); }
.toc a:hover { border-color: var(--line-2); }
.toc .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex-shrink: 0; }
.toc .ok .dot { background: var(--done); }
.toc .fix .dot { background: var(--warn-line); }
@media (max-width: 59.99rem) { .toc { position: static; margin: 0 calc(var(--space-4) * -1); padding: 0 var(--space-4); } }
@media (min-width: 60rem) { .toc ol { flex-direction: column; } .toc a { border-radius: var(--radius); border-color: transparent; background: none; } .toc a:hover { background: var(--surface); border-color: var(--line); } }
.toc .count { font: 500 var(--text-xs)/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 0 0 var(--space-3); }

.meter { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin: var(--space-2) 0 var(--space-4); }
.meter i { height: 4px; border-radius: 2px; background: var(--line); }
.meter i.ok { background: var(--done); }
.meter i.fix { background: var(--warn-line); }

.section { scroll-margin-top: 5rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-5); margin-bottom: var(--space-4); }
@media (min-width: 40rem) { .section { padding: var(--space-5) var(--space-6); } }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.section .status-line { font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--space-3); }
.section .body { font-size: 1.0625rem; max-width: 36rem; }
.section .body ul { padding-left: var(--space-5); margin: 0 0 var(--space-4); }
.section .confirm-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.section .confirm-row form { margin: 0; }
.section.confirmed { background: transparent; }
.section.confirmed .body { color: var(--muted); font-size: var(--text-md); }
.confirmed-note { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--done); font-weight: 600; font-size: var(--text-sm); margin: 0; }
.confirmed-note::before { content: ""; width: 10px; height: 6px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(-45deg); }
.section.needs-fix { border-left: 3px solid var(--warn-line); }
.thread-block { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px dashed var(--line-2); }
.thread-block h3 { font-size: var(--text-md); margin-bottom: var(--space-3); }
.follow-up { border-left: 2px solid var(--accent); padding-left: var(--space-3); margin-top: var(--space-2) !important; }
.correct form { display: grid; gap: 0; max-width: 34rem; }
.correct .btn { justify-self: start; }
.all-done { margin-top: var(--space-6); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-6); font-size: var(--text-sm); }
.footer-links .danger { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--space-5) 0 var(--space-6); color: var(--dim); font-size: var(--text-sm); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); }
.site-footer a { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 420ms cubic-bezier(.2,.7,.2,1) both; }
  .rise-2 { animation-delay: 80ms; }
  .rise-3 { animation-delay: 160ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
