/* Focus console. Tokens first; every rule below uses them. */
@font-face { font-family: "Inter"; src: url("/fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  /* colour: a restrained base, one accent (Qorsa cyan) for actions and the single key highlight */
  --bg: #0b1220; --bg-deep: #080e1a;
  --surface: #111b2e; --surface-2: #152238; --surface-3: #1a2943;
  --line: rgba(255, 255, 255, .07); --line-2: rgba(255, 255, 255, .12);
  --text: #e8eef6; --text-2: #b4c0d0; --muted: #8a99ad;
  --accent: #5ccfe0; --accent-strong: #7fdcea; --accent-ink: #052129; --accent-soft: rgba(92, 207, 224, .12);
  --steel: #4b99b8; --deep: #2f6f8f; --mist: #3a4a63;
  --risk: #f07178; --warn: #e9a84c; --caution: #cbb35a; --ok: #5bc78f; --info: #8fa3bd;
  /* type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --t-hero: clamp(36px, 5.4vw, 64px); --t-title: clamp(26px, 3vw, 36px); --t-section: clamp(18px, 1.6vw, 21px);
  --t-lead: clamp(16px, 1.3vw, 18px); --t-body: 14.5px; --t-small: 13px; --t-label: 11.5px;
  /* space: 4 8 12 16 24 32 48 64 96 128 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;
  /* shape and depth */
  --r-control: 10px; --r-card: 14px;
  --edge: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow: 0 24px 48px -24px rgba(0, 0, 0, .6);
  --glow: 0 10px 28px -12px rgba(92, 207, 224, .45);
  /* motion: one family of ease-out curves */
  --ease: cubic-bezier(.215, .61, .355, 1); --t-fast: 140ms; --t-enter: 560ms;
  --container: 1200px; --rail: 248px; --top: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: radial-gradient(1200px 600px at 70% -10%, rgba(75, 153, 184, .10), transparent 60%), linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%) fixed; }
body { margin: 0; font-family: var(--font); font-size: var(--t-body); line-height: 1.55; color: var(--text); -webkit-font-smoothing: antialiased; min-height: 100vh;
  font-feature-settings: "cv11", "ss01"; }
h1, h2, h3 { margin: 0; font-weight: 650; text-wrap: balance; }
h1 { font-size: var(--t-title); letter-spacing: -.03em; line-height: 1.08; }
h2 { font-size: var(--t-section); letter-spacing: -.015em; line-height: 1.25; margin: var(--s7) 0 var(--s4); }
h3 { font-size: 15.5px; letter-spacing: -.01em; margin: var(--s5) 0 var(--s3); }
p { margin: 0 0 var(--s3); max-width: 68ch; text-wrap: pretty; }
a { color: var(--accent); text-decoration-color: rgba(92, 207, 224, .4); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code { font-family: var(--mono); font-size: .88em; color: var(--text-2); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(92, 207, 224, .3); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: var(--t-small); }
.label { font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell */
.skip { position: absolute; left: -9999px; top: 0; z-index: 50; background: var(--surface-2); color: var(--text); padding: var(--s2) var(--s4); border-radius: var(--r-control); }
.skip:focus { left: var(--s4); top: var(--s4); }
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: var(--s5) var(--s4) var(--s4);
  background: linear-gradient(180deg, rgba(17, 27, 46, .92), rgba(11, 18, 32, .92)); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s5); text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: auto; }
.brand b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; line-height: 1.15; }
.brand small { display: block; font-size: 12px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; margin: 0 calc(-1 * var(--s2)); padding: 0 var(--s2); }
.nav .label { display: block; padding: var(--s4) var(--s3) var(--s2); }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: flex-start; gap: var(--s2); padding: 7px var(--s3); border-radius: var(--r-control);
  color: var(--text-2); text-decoration: none; font-weight: 500; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.nav a:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .06); color: var(--text); box-shadow: var(--edge); }
.nav a { position: relative; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; margin-top: -8px; border-radius: 2px; background: var(--accent); }
.nav a .count { margin-left: auto; }
.count { font-size: 11.5px; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--text-2); }
.who { border-top: 1px solid var(--line); padding: var(--s4) var(--s2) 0; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: var(--t-small); }
.who strong { display: block; font-weight: 600; } .who span { color: var(--muted); }
.topbar { display: none; }
main.content { min-width: 0; padding: 0 var(--s6) var(--s9); }
main.content:focus { outline: none; }
.container { max-width: var(--container); margin: 0 auto; }

/* the sticky page header: title on the left, the page's one primary action on the right */
.pagehead { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: var(--s5);
  padding: var(--s5) 0 var(--s4); margin-bottom: var(--s5); background: linear-gradient(180deg, rgba(11, 18, 32, .96) 70%, rgba(11, 18, 32, 0));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.pagehead .sub { color: var(--text-2); margin: var(--s2) 0 0; font-size: var(--t-small); max-width: 72ch; }
.tools { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 38px; padding: 0 var(--s4); border-radius: var(--r-control);
  font: 600 13.5px/1 var(--font); letter-spacing: -.005em; color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2);
  box-shadow: var(--edge); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.btn:hover { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .18); }
.btn:active { transform: translateY(1px); }
.btn-primary { color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-strong), var(--accent)); border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), var(--glow); }
.btn-primary:hover { background: linear-gradient(180deg, #93e4f0, var(--accent-strong)); }
.btn-danger { color: #2a0b0d; background: linear-gradient(180deg, #f48f94, var(--risk)); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.small { min-height: 30px; padding: 0 var(--s3); font-size: 12.5px; }
.btn.wide { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: rgba(92, 207, 224, .4); color: var(--accent); }
.iconbtn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-control); background: transparent; border: 1px solid transparent;
  color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; transition: background var(--t-fast) var(--ease); }
.iconbtn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--text); }
.input { width: 100%; min-height: 38px; padding: 0 var(--s3); font: inherit; color: var(--text); background: rgba(8, 14, 26, .7); border: 1px solid var(--line-2);
  border-radius: var(--r-control); transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
textarea.input { padding: var(--s3); min-height: 84px; resize: vertical; }
.input:hover { border-color: rgba(255, 255, 255, .2); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92, 207, 224, .18); }
.input[aria-invalid="true"] { border-color: var(--risk); }
select.input option { background: var(--surface); }
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); margin: 0 0 var(--s5); }
.filter { display: grid; gap: 6px; min-width: 180px; flex: 0 1 220px; }
.filter label { font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; margin-top: var(--s5); }

/* ---------------------------------------------------------------- surfaces */
.card, .tablewrap, .brief, .qitem, .empty, .firstrun, .ledger, .facts-panel, table.factors, .story, .bigrisk, .errorbox {
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--edge), var(--shadow); }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 11px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; transition: background var(--t-fast) var(--ease); }
tr.clickable:hover td { background: rgba(255, 255, 255, .025); }
/* a row's name: the button that opens it, for the keyboard and screen readers (a click anywhere on the row does too) */
.rowbtn { display: block; width: 100%; background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.rowbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* a state with its hover: reads as text, dotted to show there is more */
.statebtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: help;
  text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.statebtn:focus-visible, .rglyph:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rglyph { cursor: help; }
ul.why { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; color: var(--text-2); }
td.wrap { overflow-wrap: anywhere; }                       /* long titles and names break, so the table fits */
td.whycell { min-width: 16em; max-width: 26em; }
.scrollhint { margin: 0 0 var(--s2); font-size: 12.5px; color: var(--muted); text-align: right; }
.stepnote { display: block; margin-top: 4px; font-size: var(--t-small); color: var(--accent); }
.stepnote.done { color: var(--muted); }
.scrollhint[hidden] { display: none; }
/* help: a topic opened by its link is not hidden under the sticky page header */
.helpsection, .helptopic, .glossary > div { scroll-margin-top: 140px; }
.seenline { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin: 0 0 var(--s4); }
.thbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.thbtn:hover { color: var(--text); }
th[aria-sort="ascending"] .thbtn::after { content: " \2191"; } th[aria-sort="descending"] .thbtn::after { content: " \2193"; }
td.nowrap { white-space: nowrap; }
.emptycell { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.where { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.count-line { color: var(--muted); font-size: var(--t-small); margin: 0 0 var(--s2); font-variant-numeric: tabular-nums; }

/* severity and status: colour only where it carries meaning */
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); text-transform: capitalize; }
.sev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--info); }
.sev-critical { color: #ffb3b7; } .sev-critical::before { background: var(--risk); box-shadow: 0 0 0 3px rgba(240, 113, 120, .18); }
.sev-high { color: #f7cd8f; } .sev-high::before { background: var(--warn); }
.sev-medium::before { background: var(--caution); } .sev-low::before { background: var(--steel); } .sev-info::before { background: var(--mist); }
.sevdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sevdot.sev-critical { background: var(--risk); } .sevdot.sev-high { background: var(--warn); } .sevdot.sev-medium { background: var(--caution); }
.sevdot.sev-low { background: var(--steel); } .sevdot.sev-info { background: var(--mist); }
.pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-2); color: var(--text-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill-ok::before { background: var(--ok); } .pill-warn::before { background: var(--warn); } .pill-bad::before { background: var(--risk); }
.tone-bad { color: #ffb3b7 !important; } .tone-warn { color: #f7cd8f !important; }

/* the vantage strip and risk glyph keep their shape; colours come from the logo */
.vantage { display: inline-grid; grid-template-columns: repeat(4, 20px); gap: 2px; vertical-align: middle; }
.vantage .v { height: 16px; padding: 0; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .06); color: transparent; font: 700 9.5px/16px var(--font);
  text-align: center; cursor: help; }
.vantage .v:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* the legend's letters, one at a time */
.vbox { display: inline-block; width: 20px; height: 16px; border-radius: 3px; font: 700 9.5px/16px var(--font); text-align: center; color: var(--bg); }
.vbox.v-code { background: #9b8cf0; } .vbox.v-host { background: var(--accent); } .vbox.v-wire { background: var(--steel); } .vbox.v-records { background: #d6b36a; }
/* the one hover */
.tip { position: fixed; z-index: 60; max-width: 300px; display: grid; gap: 3px; padding: 9px 11px; font-size: 12.5px; line-height: 1.4; color: var(--text-2);
  background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: var(--shadow); pointer-events: none; }
.tip strong { color: var(--text); } .tip[hidden] { display: none; }
.vantage .v.on { color: var(--bg); }
.vantage .v-code.on { background: #9b8cf0; } .vantage .v-host.on { background: var(--accent); } .vantage .v-wire.on { background: var(--steel); } .vantage .v-records.on { background: #d6b36a; }
.vantage.big { grid-template-columns: repeat(4, 7px); gap: 3px; } .vantage.big .v { height: 22px; }
/* on a touch screen, boxes big enough to tap */
@media (pointer: coarse) { .vantage { grid-template-columns: repeat(4, 24px); gap: 3px; } .vantage .v { height: 24px; line-height: 24px; } }
.rglyph { position: relative; display: inline-block; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line-2);
  background: linear-gradient(135deg, transparent 49%, rgba(255, 255, 255, .08) 50%, transparent 51%); flex-shrink: 0; }
.rdot { position: absolute; width: 7px; height: 7px; border-radius: 50%; transform: translate(-50%, 50%); }
.rdot.band-high { background: var(--risk); } .rdot.band-medium { background: var(--warn); } .rdot.band-low { background: var(--steel); }
.riskcell { display: inline-flex; align-items: center; gap: var(--s2); }
.riskcell b { font-weight: 650; min-width: 2.2ch; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- overview */
.lede { font-size: var(--t-lead); color: var(--text-2); line-height: 1.55; max-width: 60ch; }
.story { padding: var(--s6); margin-top: var(--s5); }
.story header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); margin-bottom: var(--s5); }
.story h2 { margin: 0 0 var(--s2); } .story .headrow-h2 { margin: 0 0 var(--s4); }
.stage dd { margin: 0; }
.story p { color: var(--text-2); margin: 0; }
.flow { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .05); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
.flow i { display: block; height: 100%; }
.flow i + i { box-shadow: -1px 0 0 rgba(11, 18, 32, .9); }
.flow .f-server { background: linear-gradient(180deg, #8fe3ef, var(--accent)); }
.flow .f-app { background: linear-gradient(180deg, #6fb3cf, var(--steel)); }
.flow .f-person { background: linear-gradient(180deg, #4f6a8a, #3a5170); }
.flow .f-none { background: rgba(255, 255, 255, .08); }
.stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s5); }
.stage .k { display: flex; align-items: center; gap: var(--s2); }
.stage .k i { width: 10px; height: 10px; border-radius: 3px; }
.stage b { display: block; font-size: clamp(22px, 2.4vw, 30px); font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: var(--s1) 0 2px; }
.stage span { color: var(--muted); font-size: var(--t-small); }
.groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s5); }
.group { padding: var(--s5); }
.group .label { margin-bottom: var(--s3); display: block; }
.group dl { margin: 0; display: grid; gap: var(--s3); }
.group dl div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.group dt { color: var(--text-2); }
.group dd { margin: 0; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.group dd a { color: inherit; text-decoration: none; } .group dd a:hover { color: var(--accent); }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--s6); align-items: start; }
.split.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin: 0 0 var(--s4); }
.facts dt { font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.facts dd { margin: var(--s1) 0 0; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { display: flex; gap: var(--s2); align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plainlist li:last-child { border-bottom: 0; }
p.after { margin-top: var(--s3); }

/* ledger (used on other pages) */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); overflow: hidden; margin: 0 0 var(--s5); }
.ledger > div { padding: var(--s5); border-right: 1px solid var(--line); }
.ledger > div:last-child { border-right: 0; }
.ledger dt { font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.ledger dd { margin: var(--s2) 0 0; font-size: clamp(22px, 2.2vw, 28px); font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ledger dd.note { font-size: 12.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-top: var(--s1); }
.ledger dd a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- detail pages */
.crumbs { margin: var(--s5) 0 0; font-size: var(--t-small); }
.apphead { display: flex; gap: var(--s5); align-items: center; flex-wrap: wrap; margin: var(--s4) 0 var(--s5); }
.apphead h1 { font-size: var(--t-title); }
.bigrisk { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); }
.bigrisk .rglyph { width: 44px; height: 44px; } .bigrisk .rdot { width: 11px; height: 11px; }
.riskno { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.brief { padding: var(--s5); }
.prose h3 { margin-top: 0; } .prose p, .prose li { color: var(--text-2); } .prose ul { padding-left: 1.2em; margin: 0 0 var(--s3); } .prose li { margin-bottom: var(--s1); }
table.factors th { position: static; background: none; text-transform: none; letter-spacing: 0; font-size: var(--t-small); font-weight: 500; color: var(--text); }
.wave { margin-bottom: var(--s6); } .wave header { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s3); } .wave header h2, .wave header .headrow { margin: 0; }
.source { margin-bottom: var(--s6); } .source h2 { margin-top: var(--s5); }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: var(--s4) 0; }
.fields dt { color: var(--muted); } .fields dd { margin: 0; overflow-wrap: anywhere; }
.field { display: contents; }
.detail { font-size: 15px; color: var(--text-2); }

/* review queue: progress, and one primary choice per item */
.progress { display: flex; align-items: center; gap: var(--s3); font-size: var(--t-small); color: var(--text-2); font-variant-numeric: tabular-nums; }
.progress .bar { width: 160px; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.qitem { padding: var(--s5); transition: opacity 260ms var(--ease), transform 260ms var(--ease); }
.qitem.leaving { opacity: 0; transform: translateY(-6px); }
.qitem header { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); }
.qitem h2 { margin: 0; font-size: 16.5px; }
.reason { color: var(--text-2); margin: 0 0 var(--s4); }
.options { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s2); }
.options li { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--r-control); background: rgba(255, 255, 255, .025); border: 1px solid var(--line); }
.options li:first-child { border-color: rgba(92, 207, 224, .22); }
.opt { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; column-gap: var(--s2); align-items: baseline; }
.opt .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .06); margin-top: var(--s2); overflow: hidden; max-width: 320px; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--steel); }
.qitem footer { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }

/* ---------------------------------------------------------------- overlays */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(4, 8, 16, .6); animation: fade var(--t-fast) var(--ease); }
/* a drawer is a modal <dialog> at the right */
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0 0 env(safe-area-inset-bottom); border: 0; max-width: 100vw; max-height: none;
  height: 100%; width: min(860px, 100vw); color: var(--text);
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-left: 1px solid var(--line-2); box-shadow: -24px 0 64px -24px rgba(0, 0, 0, .7);
  animation: slidein 320ms var(--ease); }
.drawer[open] { display: flex; flex-direction: column; }
.drawer::backdrop { background: rgba(4, 8, 16, .6); }
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.drawer header .iconbtn { flex-shrink: 0; }
.drawerbody { padding: var(--s5); overflow-y: auto; }
.drawerbody .tablewrap { margin-bottom: var(--s4); box-shadow: var(--edge); }
.drawerbody td { overflow-wrap: anywhere; }                 /* long values (paths, dates, ids) wrap inside a narrow drawer */
.dialog { width: min(480px, calc(100vw - 32px)); padding: var(--s6); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-card);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); box-shadow: var(--edge), 0 32px 80px -24px rgba(0, 0, 0, .8); }
.dialog::backdrop { background: rgba(4, 8, 16, .65); }
.dialog h2 { margin: 0 0 var(--s3); font-size: 19px; }
.dialog p { color: var(--text-2); }
.dialog textarea { margin-top: var(--s3); }

/* ---------------------------------------------------------------- help */
/* a heading and its help button: the row carries the heading's spacing, so the button sits level with the text */
.headrow { display: flex; align-items: center; gap: var(--s2); }
.headrow > h1, .headrow > h2, .headrow > h3 { margin: 0; }
.headrow-h2 { margin: var(--s7) 0 var(--s4); }
.headrow-h3 { margin: var(--s5) 0 var(--s3); }
.helpbtn { display: inline-grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; padding: 0; border-radius: 50%;
  font: 700 12px/1 var(--font); color: var(--text-2); background: transparent; border: 1px solid var(--line-2); cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.helpbtn:hover, .helpbtn:focus-visible { color: var(--accent); border-color: var(--accent); }
.helpdlg { width: min(640px, calc(100vw - 32px)); max-height: min(80vh, 760px); overflow-y: auto; }
.helpbody p, .helpbody li, .helptopic p, .helptopic li, .helpsection > p, .helpsection li { color: var(--text-2); line-height: 1.55; max-width: 72ch; }
.helpbody ul, .helpbody ol, .helpsection ul, .helpsection ol { padding-left: 1.3em; }
.helpbody li, .helpsection li { margin-bottom: var(--s1); }
.terms { margin: var(--s3) 0; display: grid; gap: var(--s3); }
.terms dt { font-weight: 600; color: var(--text); }
.terms dd { margin: 2px 0 0; color: var(--text-2); line-height: 1.5; max-width: 72ch; }
.glossary { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s4) var(--s6); }
.helptopic { margin-bottom: var(--s5); }
.helptopic h3 { margin-top: var(--s5); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0 0 var(--s4); font-size: var(--t-small); color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: var(--s2); }
.helptable th[scope="row"] { font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; font-size: var(--t-body); white-space: normal; }
.helptable td { color: var(--text-2); }
.toc { columns: 2 220px; margin: 0; padding-left: 1.2em; } .toc li { margin-bottom: 2px; }
.helpindex { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s3); }
.helpsection .helpindex li { margin: 0; max-width: 72ch; }
.helpindex a { font-weight: 600; }
.helpindex .about { display: block; color: var(--text-2); }
.helpnav { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin: var(--s7) 0 var(--s4);
  padding-top: var(--s4); border-top: 1px solid var(--line-2); }
.helpnav a { color: var(--accent); }
.toc a, .helpsection a { color: var(--accent); }
.demo { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin: var(--s3) 0 0; padding: 7px var(--s4); font-size: var(--t-small);
  color: #f5d9a8; background: rgba(233, 168, 76, .10); border: 1px solid rgba(233, 168, 76, .35); border-radius: var(--r-control); }
.demo a { color: inherit; }
.choices { display: grid; gap: var(--s2); }
.choices label { display: flex; align-items: center; gap: var(--s2); }
.known { color: var(--text); margin: var(--s2) 0; }
.how { margin: var(--s3) 0 0; color: var(--muted); font-size: var(--t-small); }
.callout { padding: var(--s4) var(--s5); margin: 0 0 var(--s5); border-radius: var(--r-card); border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); }
.callout.warn { border-color: rgba(233, 168, 76, .35); }
.callout a:not(.btn) { color: var(--accent); }        /* a button keeps its own colours: Help's "How Focus works" */
.callout h2 { margin: 0 0 var(--s3); }
.stage dt { min-height: 2.8em; align-items: flex-start; }
.group .label + .plainlist, .group p.label { margin-top: var(--s4); }
.tasks { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.tasks > li { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); }
.tasks ul { margin: var(--s1) 0 0; padding-left: 1.2em; }
.group dd { white-space: nowrap; }
#toasts { position: fixed; z-index: 40; right: var(--s5); bottom: calc(var(--s5) + env(safe-area-inset-bottom)); display: grid; gap: var(--s2); }
.toast { display: flex; align-items: center; gap: var(--s3); max-width: 380px; padding: var(--s3) var(--s4); border-radius: var(--r-control);
  background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--edge), var(--shadow); animation: rise 360ms var(--ease); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.toast-bad::before { background: var(--risk); }
.toast .iconbtn { width: 26px; height: 26px; font-size: 18px; margin-left: auto; }

/* ---------------------------------------------------------------- states */
.skeleton { display: grid; gap: var(--s4); padding-top: var(--s6); }
.skeleton i { display: block; height: 18px; border-radius: 8px; background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .08), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i.h { height: 44px; width: 55%; } .skeleton i.b { height: 160px; border-radius: var(--r-card); }
.errorbox { padding: var(--s5); margin: var(--s5) 0; border-color: rgba(240, 113, 120, .3); }
.errorbox strong { display: block; margin-bottom: var(--s2); color: #ffb3b7; }
.empty { padding: var(--s7) var(--s6); text-align: left; }
.empty h2 { margin: 0 0 var(--s2); }
.firstrun { padding: var(--s7); max-width: 820px; margin-top: var(--s6); }
.firstrun h1 { font-size: var(--t-title); margin-bottom: var(--s3); }
.steps { padding-left: 1.3em; margin: var(--s4) 0; } .steps li { margin-bottom: var(--s3); color: var(--text-2); max-width: 70ch; } .steps strong { color: var(--text); }
.loading { display: flex; align-items: center; gap: var(--s3); color: var(--text-2); padding: var(--s6) 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }


/* ---------------------------------------------------------------- a record's route */
.route { list-style: none; margin: 0; padding: 0 0 0 var(--s4); border-left: 2px solid var(--line-2); }
.route li { position: relative; padding: var(--s2) 0; }
.route li::before { content: ""; position: absolute; left: calc(-1 * var(--s4) - 5px); top: calc(var(--s2) + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.route li:last-child::before { background: var(--ok); }
.route p { margin: 0 0 2px; }

/* ---------------------------------------------------------------- sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: var(--s6) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom)); }
.signinbox { width: min(420px, 100%); padding: var(--s7) var(--s6) var(--s6); }
.signinbox .logo { width: 132px; height: auto; display: block; margin: 0 auto var(--s5); }
.signinbox h1 { text-align: center; font-size: 24px; letter-spacing: -.02em; }
.signinbox .lede { text-align: center; font-size: 15px; margin: var(--s2) auto var(--s6); }
.signinbox form { display: grid; gap: var(--s2); }
.signinbox label { font-size: var(--t-label); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.signinbox .privacy { font-size: 12.5px; color: var(--muted); text-align: center; margin: var(--s4) 0 0; }
.formmsg { min-height: 1.4em; margin: var(--s2) 0 0; font-size: var(--t-small); color: #ffb3b7; }
.or { display: flex; align-items: center; gap: var(--s3); color: var(--muted); font-size: 12px; margin: var(--s4) 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.signinbox { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--edge), var(--shadow), 0 0 0 1px rgba(92, 207, 224, .04); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slidein { from { transform: translateX(28px); opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 1100px) { .split, .split.wide-left { grid-template-columns: minmax(0, 1fr); } .groups { grid-template-columns: 1fr 1fr; } main.content { padding: 0 var(--s5) var(--s8); } }
@media (max-width: 760px) {
  :root { --t-body: 15px; }
  .shell { display: block; }
  /* closed: off-screen AND out of the tab order (visibility), so keyboard users never land on hidden links */
  .rail { position: fixed; inset: 0 auto 0 0; z-index: 35; width: min(300px, 86vw); height: 100%; transform: translateX(-102%);
    visibility: hidden; transition: transform 300ms var(--ease), visibility 0s linear 300ms;
    padding-top: calc(var(--s5) + env(safe-area-inset-top)); padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom)); box-shadow: 24px 0 64px -24px rgba(0, 0, 0, .7); }
  .shell.nav-open .rail { transform: none; visibility: visible; transition: transform 300ms var(--ease), visibility 0s; }
  .navscrim { position: fixed; inset: 0; z-index: 34; background: rgba(4, 8, 16, .6); }
  .topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); height: calc(var(--top) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--s4) 0; background: rgba(11, 18, 32, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar img { width: 26px; } .topbar b { font-size: 14.5px; font-weight: 650; flex: 1; }
  main.content { padding: 0 var(--s4) calc(var(--s8) + env(safe-area-inset-bottom)); }
  .pagehead { position: static; flex-direction: column; align-items: stretch; gap: var(--s3); padding-top: var(--s4); margin-bottom: var(--s4); }
  .pagehead .tools { justify-content: flex-start; }
  .pagehead .tools .btn { flex: 1 1 auto; }
  .story { padding: var(--s5); }
  .story header { flex-direction: column; }
  .stages { grid-template-columns: 1fr 1fr; gap: var(--s4) var(--s3); }
  .groups { grid-template-columns: 1fr; }
  th, td { padding: 10px var(--s3); }
  .tablewrap td:first-child, .tablewrap th:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface-2); }
  .tablewrap tbody td:first-child { background: var(--surface); box-shadow: 1px 0 0 var(--line); max-width: 40vw; white-space: normal; overflow-wrap: anywhere; }
  .filter { flex: 1 1 100%; }
  .options li { flex-direction: column; align-items: stretch; } .options .btn { width: 100%; }
  .progress .bar { width: 100px; }
  .drawer { width: 100vw; }
  /* a table of things to answer becomes one card per row, its column names beside each value */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: auto; }
  table.cards tr { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
  table.cards td { border: 0; padding: 4px var(--s3); position: static !important; max-width: none !important; box-shadow: none !important; }
  table.cards td::before { content: attr(data-label); display: block; font-size: var(--t-label); font-weight: 600;
    text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
  .tasks li { flex-direction: column; align-items: flex-start; }
  .fields { grid-template-columns: 1fr; gap: 2px; } .fields dd { margin-bottom: var(--s2); }
  #toasts { left: var(--s4); right: var(--s4); }
}
@media (hover: none) { tr.clickable:hover td { background: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .rail, .shell.nav-open .rail { transition: none !important; }       /* the menu opens at once, so focus can go into it */
  .skeleton i { animation: none; }
}
@media print { .rail, .topbar, .tools, .filters, #toasts { display: none; } .shell { display: block; } html, body { background: #fff; color: #000; } }
