/* Crucible shell — ported from the approved wireframe (crucible-console-v2.html).
   Sections: tokens · app shell (sidebar/topbar) · components (metrics/card/table/pills/buttons)
   · drawer/modal · legacy (pre-U3 station pages; removed when the reskin lands). */

:root {
  --ground: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #17202e;
  --muted: #5c6779;
  --faint: #8a94a6;
  --line: #dde3ec;
  --line-strong: #cbd4e0;
  --accent: #3457d5;
  --accent-ink: #ffffff;
  --accent-soft: #eaeefb;
  --done: #1f8a5b;   --done-soft: #e3f3ec;
  --current: #b9770f; --current-soft: #fbf0dd;
  --error: #c23b3b;  --error-soft: #fae3e3;
  --pending: #8a94a6; --pending-soft: #eef1f5;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgba(23, 32, 46, .06), 0 4px 16px rgba(23, 32, 46, .06);
  --shadow-lg: 0 8px 40px rgba(23, 32, 46, .20);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--ui); color: var(--ink);
  background: var(--ground); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* ---- Sidebar ---- */
.side { background: #10182a; color: #c3ccdb; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .wordmark { display: flex; align-items: center; gap: 10px; padding: 18px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.glyph { width: 26px; height: 26px; border-radius: 7px; flex: none; background: linear-gradient(150deg, #4a6bff, #2f3ea8); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.wordmark b { color: #fff; font-weight: 650; letter-spacing: .01em; font-size: 15px; }
.wordmark small { display: block; color: #7c88a0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin-top: 1px; }
.nav { padding: 12px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav .lbl { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #66728c; padding: 12px 10px 6px; }
.navbtn { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: 0; color: #c3ccdb; font: inherit; cursor: pointer; padding: 9px 10px; border-radius: 8px; position: relative; text-decoration: none; }
.navbtn:hover { background: rgba(255,255,255,.05); color: #fff; }
.navbtn.active { background: rgba(74,107,255,.18); color: #fff; }
.navbtn.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; background: #6f8bff; border-radius: 0 3px 3px 0; }
.navbtn svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.navbtn .txt { flex: 1; }
.count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255,255,255,.1); color: #dbe2ee; font-size: 12px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.navbtn.active .count { background: #6f8bff; color: #fff; }
.navbtn.attn .count { background: var(--current); color: #2a1c05; }
.side .foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; background: #2f3c57; color: #cfd8e8; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.foot .who { flex: 1; line-height: 1.2; min-width: 0; }
.foot .who b { color: #eef2f8; font-weight: 600; font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot .who span { display: block; color: #74809a; font-size: 11px; }
.signout { background: none; border: 0; color: #8b97b0; cursor: pointer; padding: 6px; border-radius: 6px; }
.signout:hover { color: #fff; background: rgba(255,255,255,.06); }
.signout svg { width: 16px; height: 16px; display: block; }

/* ---- Main / topbar ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 28px; display: flex; align-items: flex-end; gap: 18px; position: sticky; top: 0; z-index: 5; }
.topbar .head { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; width: 240px; color: var(--faint); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input { border: 0; background: none; font: inherit; color: var(--ink); width: 100%; outline: none; }
.content { padding: 22px 28px 60px; }

/* ---- Metric strip ---- */
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 22px; }
.metrics.four { grid-template-columns: repeat(4, 1fr); }
.metrics.three { grid-template-columns: repeat(3, 1fr); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; box-shadow: var(--shadow); }
.metric .k { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.metric .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.metric .v { font-size: 26px; font-weight: 650; margin-top: 8px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.metric .sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
/* A metric that acts as a filter shortcut (the Attention tile) — same tile, button affordance. */
.metric[role="button"] { cursor: pointer; }
.metric[role="button"]:hover { border-color: #eeb4b4; box-shadow: var(--shadow-lg); }

/* ---- Card / queue ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 18px; }
.qhead { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 54px; background: var(--surface); }
.qhead .title { font-weight: 600; font-size: 14px; }
.qhead .title span { color: var(--faint); font-weight: 500; margin-left: 6px; }
.qhead .spacer { flex: 1; }
.qhead .note { font-size: 12px; color: var(--faint); }
/* Numbered step heading inside a multi-step form card (Shipping pack&ship). Matches .qhead .title
   weight/size so in-card sections read at the same level as card titles. */
.step-h { font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.step-h:first-of-type { margin-top: 6px; }
.scanbtn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; border-radius: 8px; padding: 7px 13px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; }
.scanbtn:hover { background: #2c4bc0; }
.scanbtn svg { width: 15px; height: 15px; }

/* filter bar */
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filterbar[hidden] { display: none; }
.filterbar .flabel { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-right: 2px; }
.fbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); border-radius: 20px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: none; }
.fbtn:hover { border-color: var(--accent); color: var(--accent); }
.fbtn.on { background: var(--accent-soft); border-color: #b9c6f4; color: var(--accent); font-weight: 600; }
.fbtn.on.err { background: var(--error-soft); border-color: #eeb4b4; color: var(--error); }
.fbtn .fc { font-variant-numeric: tabular-nums; opacity: .75; }
.fsel { position: relative; display: inline-flex; align-items: center; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 20px; }
.fsel.on { background: var(--accent-soft); border-color: #b9c6f4; }
.fsel select { appearance: none; -webkit-appearance: none; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--muted); padding: 5px 26px 5px 12px; cursor: pointer; border-radius: 20px; outline: none; }
.fsel.on select { color: var(--accent); font-weight: 600; }
.fsel::after { content: ""; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-70%) rotate(45deg); color: var(--faint); pointer-events: none; }
.fclear { margin-left: auto; background: none; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; padding: 5px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.fclear:hover { color: var(--error); background: var(--surface); }
.fclear svg { width: 13px; height: 13px; }

/* ---- Table ---- */
table.q { width: 100%; border-collapse: collapse; }
table.q thead th { text-align: left; padding: 9px 14px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.q td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.q tbody tr:last-child td { border-bottom: none; }
table.q tbody tr.rowlink { cursor: pointer; }
table.q tbody tr.rowlink:hover { background: var(--surface-2); }
table.q th.num, table.q td.num { text-align: right; font-variant-numeric: tabular-nums; }
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--ink); }
thead th.sortable .sarrow { display: inline-block; margin-left: 5px; opacity: 0; transition: opacity .1s; }
thead th.sortable:hover .sarrow { opacity: .5; }
thead th.sortable.sorted { color: var(--accent); }
thead th.sortable.sorted .sarrow { opacity: 1; }
.cellsub { display: block; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.empty { padding: 34px 16px; text-align: center; color: var(--faint); font-size: 13.5px; }

/* ---- Queue extras (bulk bar / banner / pager / mini progress) ---- */
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--accent-soft); font-size: 13px; }
.bulkbar[hidden] { display: none; }
.selbanner { padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--current-soft); font-size: 12.5px; color: #6b4a0e; display: flex; gap: 8px; align-items: center; }
.selbanner[hidden] { display: none; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline; padding: 0; }
.pager { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; }
.pager .spacer { flex: 1; }
.pbtn { min-width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 12.5px; cursor: pointer; text-decoration: none; padding: 0 6px; font-variant-numeric: tabular-nums; }
.pbtn:hover { border-color: var(--accent); color: var(--accent); }
.pbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pbtn.disabled { opacity: .45; cursor: default; }
.pbtn.disabled:hover { border-color: var(--line-strong); color: var(--muted); }
.prog { display: inline-flex; gap: 3px; }
.prog i { width: 18px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.prog i.done { background: var(--done); }
.prog i.current { background: var(--current); }
.prog i.error { background: var(--error); }

/* ---- Pills / tags ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill .pd { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill.done { background: var(--done-soft); color: var(--done); }
.pill.current { background: var(--current-soft); color: var(--current); }
.pill.error { background: var(--error-soft); color: var(--error); }
.pill.pending { background: var(--pending-soft); color: var(--pending); }
/* Amber missing-data indicator (Control queue) — same palette as .pill-warn. */
.pill.warn { background: var(--current-soft); border: 1px solid #f5c98a; color: #8a5a12; padding: 1px 7px; cursor: help; }
/* Instant hover/focus tooltip on the indicator, listing the order's issues. */
.has-tip { position: relative; }
.has-tip .tip { display: none; position: absolute; bottom: calc(100% + 6px); left: -8px; z-index: 30; min-width: 180px; max-width: 280px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 12px; font-size: 12px; font-weight: 500; white-space: normal; text-align: left; }
.has-tip .tip strong { display: block; margin-bottom: 3px; color: #8a5a12; }
.has-tip .tip ul { margin: 0; padding-left: 16px; }
.has-tip .tip li + li { margin-top: 2px; }
.has-tip:hover .tip, .has-tip:focus-visible .tip { display: block; }
/* Below-opening variant — for tips anchored near a card's top edge (e.g. table headers),
   where the default upward tip would clip against the card's overflow:hidden. */
.has-tip .tip.below { bottom: auto; top: calc(100% + 6px); }
/* The little (?) glossary mark on table headers. */
.qmark { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; margin-left: 4px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; vertical-align: 1px; }
.qmark .tip { font-weight: 500; text-transform: none; letter-spacing: normal; }
.qmark:hover, .qmark:focus-visible { border-color: var(--accent); color: var(--accent); }
/* Red needs-attention variant (Control stage pill) — same tooltip mechanics, error palette. */
.pill.error.has-tip { cursor: help; }
.pill.error .tip { border-color: #eeb4b4; }
.pill.error .tip > strong { color: var(--error); }
.pill.error .tip li strong { display: inline; margin: 0; color: var(--error); }
.kit { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.kit.welcome { background: var(--accent-soft); color: var(--accent); }
.kit.repeat { background: var(--pending-soft); color: var(--muted); }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-size: 13px; border-radius: 8px; padding: 7px 13px; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: #fff; text-decoration: none; }
.btn:hover { background: #2c4bc0; }
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.danger { border-color: var(--error); background: var(--surface); color: var(--error); }
.btn.danger:hover { background: var(--error-soft); }
.btn.mini { font-size: 12px; padding: 4px 10px; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Forms ---- */
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field input, .field select { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); width: 100%; }
.frow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.frow .field { min-width: 120px; }
/* Bare inputs/selects in a form row (search + scan rows). Match the .btn box so input and button
   align on the same baseline — the old `body > main .frow input` selector was dead (shell is .main,
   not <main>), leaving these unstyled + misaligned. */
.frow > input, .frow > select { padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 14px; line-height: 1.3; background: var(--surface); color: var(--ink); }
.frow > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }

/* ---- Notices ---- */
.notice { background: var(--done-soft); border: 1px solid #b5dcc9; color: var(--done); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.error { background: var(--error-soft); border: 1px solid #f0b9b9; color: var(--error); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.note { color: var(--muted); font-size: 12px; }
.note.sm { font-size: 11.5px; }

/* ---- Drawer (order detail) ---- */
.scrim { position: fixed; inset: 0; background: rgba(23,32,46,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw; background: var(--surface); box-shadow: var(--shadow-lg); z-index: 41; display: flex; flex-direction: column; animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.dhead { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.dhead .drow { display: flex; align-items: center; gap: 10px; }
.dhead .oname { font-family: var(--mono); font-size: 19px; font-weight: 650; flex: 1; }
.dhead .dmeta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dhead .dsub { color: var(--faint); font-size: 12.5px; margin-top: 8px; }
.dclose { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.dclose:hover { background: var(--surface-2); color: var(--ink); }
.dclose svg { width: 18px; height: 18px; display: block; }
.dbody { flex: 1; overflow-y: auto; padding: 8px 22px 30px; }
.dsec { padding: 16px 0 4px; }
.dsec h3 { margin: 0 0 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.dsec + .dsec { border-top: 1px solid var(--line); margin-top: 12px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; }
/* fulfillment progress track */
.track { display: flex; align-items: flex-start; gap: 0; margin: 4px 0 8px; }
.tstep { flex: 1; text-align: center; position: relative; }
.tnode { width: 26px; height: 26px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; background: var(--pending-soft); color: var(--pending); border: 2px solid var(--line-strong); }
.tnode svg { width: 13px; height: 13px; }
.tstep.done .tnode { background: var(--done); border-color: var(--done); color: #fff; }
.tstep.active .tnode { background: var(--current-soft); border-color: var(--current); color: var(--current); }
.tstep.error .tnode { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.tstep .tl { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tstep .ts { font-size: 10.5px; color: var(--faint); }
.tstep::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: -1; }
.tstep:first-child::before { display: none; }
.tstep.done::before { background: var(--done); }
/* event history */
.ev { display: flex; gap: 10px; padding: 7px 0; font-size: 12.5px; align-items: baseline; }
.ev .edot { width: 8px; height: 8px; border-radius: 50%; flex: none; position: relative; top: 1px; }
.ev .edot.done { background: var(--done); }
.ev .edot.error { background: var(--error); }
.ev .ebody { flex: 1; }
.ev .ewho { color: var(--faint); }
.ev .ewhen { font-family: var(--mono); color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.ev .enote { display: block; color: var(--muted); font-style: italic; margin-top: 1px; }

/* ---- Modal ---- */
.modalwrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal { width: 520px; max-width: 94vw; max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 51; }
.modal .mhead { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .mhead b { font-size: 15px; flex: 1; }
.modal .mbody { padding: 18px 20px; }
.modal .mfoot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---- Scan modal checklist ---- */
.scanwin { width: 560px; }
.schecklist { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.srow { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.srow:last-child { border-bottom: none; }
.srow.locked { opacity: .45; }
.srow.next { background: var(--accent-soft); }
.srow.done { background: var(--done-soft); }
.scheck { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; background: var(--surface); color: var(--done); }
.srow.done .scheck { border-color: var(--done); background: #fff; }
.scheck svg { width: 12px; height: 12px; }
.sbody { flex: 1; min-width: 0; }
.sbody .note { font-size: 12px; }
/* Inline action area of the CURRENT step — rendered directly under its .srow.next.act
   header so the checklist itself carries the scan input / confirm button. */
.srow.next.act { border-bottom: none; }
.sact { padding: 2px 12px 12px 42px; background: var(--accent-soft);
  border-bottom: 1px solid var(--line); }
.sact:last-child { border-bottom: none; }
.stag { font-size: 10px; font-weight: 700; letter-spacing: .06em; border-radius: 5px; padding: 2px 7px; flex: none; }
.stag.next { background: var(--accent); color: #fff; }
.stag.manual { background: var(--current-soft); color: var(--current); }
/* FEFO lot that is NOT the active one — consuming out of expiry order, changeover candidate. */
.stag.fefo-warn { background: var(--current); color: #fff; }

/* ---- Operator Guide (/guide) — docs-style: prose column + sticky "On this page" rail ---- */
.guide { display: grid; grid-template-columns: minmax(0, 760px) 190px; gap: 40px;
  align-items: start; }
.guide .gbody { min-width: 0; }
.guide .gsec { padding: 6px 0 26px; scroll-margin-top: 18px; border-bottom: 1px solid var(--line); }
.guide .gsec:last-child { border-bottom: 0; }
.guide .geyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin: 22px 0 2px; }
.guide h2 { font-size: 19px; letter-spacing: -.01em; margin: 4px 0 12px; display: flex;
  align-items: baseline; gap: 10px; }
.guide h3 { font-size: 14.5px; margin: 20px 0 6px; }
.guide .grole { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; letter-spacing: .02em; }
.guide p, .guide li { font-size: 14px; line-height: 1.65; color: var(--ink); }
.guide .gwhy { color: var(--muted); margin-top: 0; }
.guide ol { padding-left: 0; margin: 10px 0; list-style: none; counter-reset: gstep; }
.guide ol li { counter-increment: gstep; position: relative; padding-left: 34px; margin-bottom: 10px; }
.guide ol li::before { content: counter(gstep); position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.guide ul { padding-left: 20px; margin: 8px 0; }
.guide ul li { margin-bottom: 7px; }
.guide .callout { border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 8px; padding: 10px 14px; margin: 14px 0 4px;
  font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.guide table.gref { margin-top: 6px; }
.guide table.q td { font-size: 13px; }

/* On-this-page rail */
.guide .grail { position: sticky; top: 18px; }
.guide .grail-title { font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.guide .gtoc { display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.guide .gtoc a { font-size: 12.5px; color: var(--muted); text-decoration: none;
  padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; }
.guide .gtoc a.sub { padding-left: 22px; }
.guide .gtoc a:hover { color: var(--ink); }
.guide .gtoc a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 1180px) { .guide { grid-template-columns: minmax(0, 1fr); } .guide .grail { display: none; } }

/* HTML/CSS flow diagrams — server-rendered, no diagram library */
.guide .flow { display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.guide .fnode { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px;
  padding: 10px 14px; font-size: 12.5px; line-height: 1.4; display: flex; flex-direction: column;
  justify-content: center; text-align: center; box-shadow: 0 1px 2px rgba(23, 32, 46, .05); }
.guide .fnode b { font-size: 13px; }
.guide .fnode span { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.guide .fnode.fedge { border-style: dashed; color: var(--muted); background: var(--surface-2); }
.guide .fnode.fstation { border-color: var(--accent); box-shadow: 0 1px 3px rgba(52, 87, 213, .12); }
.guide .fnode.fdone { border-color: var(--done); background: var(--done-soft); color: var(--done); font-weight: 650; }
.guide .fnode.fdecision { border-color: var(--current); background: var(--current-soft); font-weight: 600; }
.guide .farrow { align-self: center; flex: none; width: 22px; height: 2px; background: var(--line-strong);
  position: relative; }
.guide .farrow::after { content: ""; position: absolute; right: -1px; top: -4px;
  border-left: 7px solid var(--line-strong); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.guide .ffeed { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* Labeled decision branches */
.guide .fbranches { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.guide .fbranch { border: 1px solid var(--line); border-radius: 8px; padding: 9px 13px;
  font-size: 13px; line-height: 1.5; }
.guide .fbranch .ftag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; border-radius: 5px; padding: 2px 7px; margin-right: 8px; }
.guide .fbranch.ok { border-left: 3px solid var(--done); }
.guide .fbranch.ok .ftag { background: var(--done-soft); color: var(--done); }
.guide .fbranch.warn { border-left: 3px solid var(--current); }
.guide .fbranch.warn .ftag { background: var(--current-soft); color: var(--current); }
.guide .fbranch.bad { border-left: 3px solid var(--error); }
.guide .fbranch.bad .ftag { background: var(--error-soft); color: var(--error); }

/* ---- Toast ---- */
.toastwrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { display: inline-flex; align-items: center; gap: 9px; background: #17202e; color: #eef2f8; border-radius: 10px; padding: 10px 16px; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: toast-in .15s ease-out; }
.toast svg { width: 15px; height: 15px; flex: none; }
.toast.ok svg { color: #4ade80; }
.toast.err svg { color: #f87171; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ================================================================================
   LEGACY (pre-U3 station pages + login/forgot/reset). Removed when the reskin lands.
   ================================================================================ */
header.legacy, body > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
body > header .brand { font-weight: 700; letter-spacing: .02em; }
body > header .who { color: var(--muted); font-size: 13px; }
nav.stations { display: flex; gap: 2px; flex-wrap: wrap; }
nav.stations a { padding: 6px 12px; font-size: 13px; color: var(--muted); text-decoration: none; border-radius: 6px; }
nav.stations a:hover { background: var(--ground); color: var(--ink); }
nav.stations a.on { background: var(--accent); color: #fff; }
body > main, main.legacy { max-width: 960px; margin: 32px auto; padding: 0 24px; }
body > main h1 { font-size: 22px; margin: 0 0 16px; }
body > main .card { padding: 20px; margin-bottom: 20px; overflow: visible; }
body > main .card h2 { font-size: 16px; margin: 0 0 14px; }
body > main .frow label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
body > main .frow input, body > main .frow select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; width: auto; }
.scan input { font-size: 18px; padding: 11px 14px; }
.pill-warn { background: var(--current-soft); border: 1px solid #f5c98a; color: #8a5a12; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
body > main table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
body > main th, body > main td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
body > main th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fbfcfe; }
body > main tr:last-child td { border-bottom: none; }
form.login { max-width: 340px; margin: 64px auto; background: var(--surface); padding: 28px; border: 1px solid var(--line); border-radius: 10px; }
form.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
form.login input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 15px; }
form.login .btn { width: 100%; margin-top: 20px; text-align: center; }
form.login .linkrow { margin-top: 12px; font-size: 13px; text-align: center; }

/* Password fields (reset page): reveal eye + strength meter + live match note */
form.login .pwwrap { position: relative; }
form.login .pwwrap input { padding-right: 40px; }
.pweye { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 5px; cursor: pointer; color: var(--faint); line-height: 0; border-radius: 6px; }
.pweye:hover { color: var(--ink); background: var(--surface-2); }
.pweye svg { width: 18px; height: 18px; display: block; }
.pweye .eye-off { display: none; }
.pweye.revealed .eye-on { display: none; }
.pweye.revealed .eye-off { display: block; }
.pwmeter { display: flex; gap: 8px; margin-top: 12px; }
.pwmeter i { flex: 1; height: 6px; border-radius: 999px; background: var(--line); transition: background .2s; }
.pwmeter[data-strength="weak"] i:nth-child(-n+1) { background: var(--error); }
.pwmeter[data-strength="medium"] i:nth-child(-n+2) { background: var(--current); }
.pwmeter[data-strength="strong"] i:nth-child(-n+3) { background: var(--done); }
.pwhint { margin-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.pwhint.weak { color: var(--error); font-weight: 600; }
.pwhint.medium { color: var(--current); font-weight: 600; }
.pwhint.strong { color: var(--done); font-weight: 600; }
.note.pwok { color: var(--done); text-align: center; font-weight: 600; font-size: 13px; }
.note.pwbad { color: var(--error); text-align: center; font-weight: 600; font-size: 13px; }
