/* ===========================================================================
   Herdmark — console design system.

   Mobile-first. One stylesheet, no build step, no framework, no CDN font.
   Everything is a custom property so light and dark are the same rules with
   different values, and both are defined explicitly — nothing inherits a
   colour from the host.

   Register: serious financial infrastructure. Restrained, precise, confident.
   No gradients, no shadows-as-decoration, no emoji, no rounded-pill styling
   for its own sake. The audience is an underwriter, a credit officer and a vet.
   =========================================================================== */

/* ---------------------------------------------------------------- tokens -- */
:root {
  color-scheme: light dark;

  /* type */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "DejaVu Sans Mono", monospace;

  --t-xs:   11.5px;
  --t-sm:   12.75px;
  --t-base: 14.5px;
  --t-md:   15.5px;
  --t-lg:   17px;
  --t-xl:   20px;
  --t-2xl:  25px;
  --t-3xl:  30px;

  /* space — a 4px scale */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 44px;

  --radius:    6px;
  --radius-sm: 4px;
  --radius-lg: 10px;

  --measure: 74ch;
  --page:    1220px;

  /* ---- light palette (the default; every colour defined here) ---- */
  --bg:            #f2f4f6;
  --surface:       #ffffff;
  --surface-2:     #f8fafb;
  --surface-3:     #eef1f4;
  --ink:           #101820;
  --text:          #333d49;
  --muted:         #5d6875;
  --faint:         #8a949f;
  --border:        #e0e4e9;
  --border-strong: #c4ccd5;

  --accent:        #14527f;
  --accent-hover:  #0e3d60;
  --accent-ink:    #ffffff;
  --accent-soft:   #e9f0f7;
  --accent-line:   #b9cee1;

  --ok:      #12633d;  --ok-bg:   #e9f4ee;  --ok-line:   #b3d4c2;
  --warn:    #7a5300;  --warn-bg: #fbf3e0;  --warn-line: #e2cd97;
  --stop:    #8e2521;  --stop-bg: #fbeeed;  --stop-line: #e2b9b5;
  --info:    #14527f;  --info-bg: #e9f0f7;  --info-line: #b9cee1;
  --stop-ink: #ffffff;

  --topbar:      #101820;
  --topbar-ink:  #ffffff;
  --topbar-dim:  #a8b3bf;
  --topbar-line: #26313d;

  --focus: #2f7fc0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0a0e13;
    --surface:       #141a22;
    --surface-2:     #1a212b;
    --surface-3:     #202935;
    --ink:           #eef2f6;
    --text:          #c2ccd7;
    --muted:         #8d99a7;
    --faint:         #6b7683;
    --border:        #26303c;
    --border-strong: #3a4653;

    --accent:        #7fb4e2;
    --accent-hover:  #a3cbf0;
    --accent-ink:    #0a0e13;
    --accent-soft:   #16283a;
    --accent-line:   #2c455f;

    --ok:      #6fcf9d;  --ok-bg:   #10251c;  --ok-line:   #1f4534;
    --warn:    #e0b263;  --warn-bg: #292014;  --warn-line: #4b3b1d;
    --stop:    #f0918a;  --stop-bg: #2a1614;  --stop-line: #4c2724;
    --info:    #7fb4e2;  --info-bg: #16283a;  --info-line: #2c455f;
    --stop-ink: #2a1614;

    --topbar:      #0d1319;
    --topbar-ink:  #f3f6f9;
    --topbar-dim:  #8d99a7;
    --topbar-line: #222c37;

    --focus: #7fb4e2;
  }
}

/* Explicit override wins in both directions. */
:root[data-theme="dark"] {
  --bg:            #0a0e13;
  --surface:       #141a22;
  --surface-2:     #1a212b;
  --surface-3:     #202935;
  --ink:           #eef2f6;
  --text:          #c2ccd7;
  --muted:         #8d99a7;
  --faint:         #6b7683;
  --border:        #26303c;
  --border-strong: #3a4653;

  --accent:        #7fb4e2;
  --accent-hover:  #a3cbf0;
  --accent-ink:    #0a0e13;
  --accent-soft:   #16283a;
  --accent-line:   #2c455f;

  --ok:      #6fcf9d;  --ok-bg:   #10251c;  --ok-line:   #1f4534;
  --warn:    #e0b263;  --warn-bg: #292014;  --warn-line: #4b3b1d;
  --stop:    #f0918a;  --stop-bg: #2a1614;  --stop-line: #4c2724;
  --info:    #7fb4e2;  --info-bg: #16283a;  --info-line: #2c455f;
  --stop-ink: #2a1614;

  --topbar:      #0d1319;
  --topbar-ink:  #f3f6f9;
  --topbar-dim:  #8d99a7;
  --topbar-line: #222c37;

  --focus: #7fb4e2;
}

/* ----------------------------------------------------------------- base -- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  /* Nothing may ever push the page sideways. Wide content scrolls in its own box. */
  overflow-x: hidden;
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

:where(a) { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:where(a):hover { color: var(--accent-hover); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--ink); padding: var(--s3) var(--s4);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.skip:focus { left: var(--s3); top: var(--s3); }

/* ------------------------------------------------------------- app chrome -- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--topbar); color: var(--topbar-ink);
  border-bottom: 1px solid var(--topbar-line);
}
.appbar-in {
  max-width: var(--page); margin: 0 auto;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s4);
  min-height: 54px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand:hover { color: inherit; }
.brand .mark { flex: 0 0 auto; width: 26px; height: 26px; color: var(--topbar-ink); display: block; }
.brand .mark svg { display: block; width: 100%; height: 100%; }
.brand .word {
  font-size: var(--t-lg); font-weight: 640; letter-spacing: -.015em;
  color: var(--topbar-ink); line-height: 1.1; white-space: nowrap;
}
.brand .word b { font-weight: 640; }
.brand .word i { font-style: normal; font-weight: 350; }
.brand .sub {
  display: none;
  font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase;
  color: var(--topbar-dim); line-height: 1.1; margin-top: 3px;
}
@media (min-width: 720px) { .brand .sub { display: block; } }

.appbar-status { margin-left: auto; display: flex; align-items: center; gap: var(--s2); flex-wrap: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-xs); letter-spacing: .02em;
  color: var(--topbar-dim); border: 1px solid var(--topbar-line);
  background: rgba(255,255,255,.04);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.chip b { color: var(--topbar-ink); font-weight: 600; font-family: var(--mono); font-size: var(--t-xs); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.chip .dot.up   { background: #4bb583; }
.chip .dot.down { background: #e0685f; }
.chip .dot.warn { background: #d9a83f; }
.chip.hide-sm { display: none; }
@media (min-width: 860px) { .chip.hide-sm { display: inline-flex; } }

/* step navigation — horizontally scrollable on a phone, a real bar on a laptop */
.stepnav {
  position: sticky; top: 54px; z-index: 29;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.stepnav-in {
  max-width: var(--page); margin: 0 auto;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin;
  padding: 0 var(--s2);
  -webkit-overflow-scrolling: touch;
}
.stepnav a {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 7px;
  padding: 11px var(--s3) 9px;
  font-size: var(--t-base); color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.stepnav a:hover { color: var(--ink); background: var(--surface-2); }
.stepnav a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.stepnav a .n {
  font-family: var(--mono); font-size: var(--t-xs); color: var(--faint);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
}
.stepnav a.on .n { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.stepnav a.aux { color: var(--faint); }
.stepnav a.aux.on { color: var(--ink); }

.wrap {
  max-width: var(--page); margin: 0 auto;
  padding: var(--s5) var(--s4) var(--s8);
  min-width: 0;
}
@media (min-width: 760px) { .wrap { padding: var(--s6) var(--s6) 72px; } }

.sitefoot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--t-sm);
}
.sitefoot-in {
  max-width: var(--page); margin: 0 auto; padding: var(--s5) var(--s4);
  display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); align-items: baseline;
}
.sitefoot p { margin: 0; max-width: 78ch; }
.sitefoot .meta { font-family: var(--mono); font-size: var(--t-xs); color: var(--faint); }

/* ---------------------------------------------------------- page heading -- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: var(--t-sm); color: var(--muted); margin-bottom: var(--s3);
  min-width: 0;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs .sep { color: var(--faint); }
.crumbs .here { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }

.pagehead { margin-bottom: var(--s5); }
.pagehead .step {
  font-family: var(--mono); font-size: var(--t-xs); letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 6px;
}
.pagehead .titlerow {
  display: flex; flex-wrap: wrap; gap: var(--s3); align-items: baseline; justify-content: space-between;
}

h1 {
  font-size: var(--t-2xl); line-height: 1.18; margin: 0 0 var(--s2);
  color: var(--ink); font-weight: 650; letter-spacing: -.018em;
  overflow-wrap: anywhere;
}
@media (min-width: 760px) { h1 { font-size: var(--t-3xl); } }
h2 { font-size: var(--t-lg); margin: 0 0 var(--s3); color: var(--ink); font-weight: 620; letter-spacing: -.008em; }
h3 {
  font-size: var(--t-sm); margin: 0 0 var(--s2); color: var(--ink); font-weight: 650;
  letter-spacing: .07em; text-transform: uppercase;
}

/* the one plain-English line: why this screen matters commercially */
.why {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px var(--s4);
  margin: 0 0 var(--s6);
  color: var(--ink);
  font-size: var(--t-md);
  line-height: 1.55;
  max-width: var(--measure);
}
@media (min-width: 760px) { .why { font-size: var(--t-lg); } }

/* ---------------------------------------------------------------- cards -- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s4);
  margin-bottom: var(--s5);
  min-width: 0;
}
@media (min-width: 760px) { .card { padding: var(--s5) var(--s6); } }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.tight { padding: var(--s4); }
.card-note { color: var(--muted); font-size: var(--t-sm); margin: -2px 0 var(--s4); max-width: 82ch; }
.card-note:last-child { margin-bottom: 0; }

.grid { display: grid; gap: var(--s5); }
.grid.two, .grid.three, .grid.side { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 780px) {
  .grid.two   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1040px) {
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.side  { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
}
.stack > * + * { margin-top: var(--s4); }

/* ---------------------------------------------------------------- stats -- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: var(--s5);
}
.stat { background: var(--surface); padding: var(--s3) var(--s4); min-width: 0; }
.stat .label {
  font-size: var(--t-xs); letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}
.stat .value {
  font-size: var(--t-2xl); font-weight: 620; color: var(--ink); line-height: 1.2; margin-top: 3px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.stat .value.sm { font-size: var(--t-base); font-weight: 560; line-height: 1.35; padding-top: 5px; }
.stat .sub { font-size: var(--t-sm); color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------- tables -- */
/* Every table lives inside .table-scroll. That box scrolls, the page never does. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  scrollbar-width: thin;
}
table { width: 100%; border-collapse: collapse; font-size: var(--t-base); }
thead th {
  text-align: left; font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 650; padding: 9px var(--s3);
  border-bottom: 1px solid var(--border-strong); background: var(--surface-2); white-space: nowrap;
}
tbody td { padding: 10px var(--s3); border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.hit { background: var(--warn-bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }

.card > .table-scroll { margin: 0 calc(-1 * var(--s4)) calc(-1 * var(--s4)); max-width: none; }
.card > .table-scroll thead th:first-child,
.card > .table-scroll tbody td:first-child { padding-left: var(--s4); }
.card > .table-scroll thead th:last-child,
.card > .table-scroll tbody td:last-child { padding-right: var(--s4); }
@media (min-width: 760px) {
  .card > .table-scroll { margin: 0 calc(-1 * var(--s6)) calc(-1 * var(--s5)); max-width: none; }
  .card > .table-scroll thead th:first-child,
  .card > .table-scroll tbody td:first-child { padding-left: var(--s6); }
  .card > .table-scroll thead th:last-child,
  .card > .table-scroll tbody td:last-child { padding-right: var(--s6); }
}
table.wide { min-width: 940px; }
td.w-name, th.w-name { min-width: 160px; }
.empty { padding: var(--s6) var(--s4); color: var(--muted); text-align: left; }

/* ------------------------------------------------------------ typography -- */
.mono { font-family: var(--mono); font-size: var(--t-sm); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--t-sm); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

code {
  font-family: var(--mono); font-size: var(--t-sm);
  background: var(--surface-3); color: var(--ink);
  padding: 1px 5px; border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}
pre {
  font-family: var(--mono); font-size: var(--t-sm); line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: var(--s3);
  overflow-x: auto; margin: 0; color: var(--text); max-height: 340px;
}
details > summary {
  cursor: pointer; font-size: var(--t-sm); color: var(--muted); padding: 5px 0;
  list-style-position: outside;
}
details > summary:hover { color: var(--accent); }
hr { border: none; border-top: 1px solid var(--border); margin: var(--s5) 0; }

/* ---------------------------------------------------------------- pills -- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: var(--t-xs); font-weight: 650; letter-spacing: .02em;
  border: 1px solid var(--border-strong); color: var(--muted); background: var(--surface-3);
  white-space: nowrap; vertical-align: baseline;
}
.pill.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok-line); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill.stop { color: var(--stop); background: var(--stop-bg); border-color: var(--stop-line); }
.pill.info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }

/* score chip — a number with its verdict attached, used wherever a score shows */
.score {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 1px 7px; background: var(--surface-3); color: var(--ink);
  font-size: var(--t-sm); white-space: nowrap;
}
.score .v { font-weight: 650; }
.score .t { font-size: var(--t-xs); color: var(--muted); font-family: var(--sans); }
.score.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok-line); }
.score.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.score.stop { color: var(--stop); background: var(--stop-bg); border-color: var(--stop-line); }
.score.ok .t, .score.warn .t, .score.stop .t { color: inherit; opacity: .8; }

/* ------------------------------------------------------------ decisions -- */
.decision {
  display: flex; flex-direction: column; gap: var(--s2);
  border: 1px solid var(--border-strong); border-left-width: 4px;
  border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s5);
  background: var(--surface);
}
@media (min-width: 620px) { .decision { flex-direction: row; gap: var(--s5); align-items: flex-start; } }
.decision .word {
  font-size: var(--t-xl); font-weight: 660; letter-spacing: -.015em; line-height: 1.2;
  flex: 0 0 auto;
}
@media (min-width: 620px) { .decision .word { min-width: 168px; } }
.decision .meaning { color: var(--text); font-size: var(--t-base); max-width: var(--measure); min-width: 0; }
.decision.match,        .decision.created       { border-left-color: var(--ok);   background: var(--ok-bg); }
.decision.match .word,  .decision.created .word { color: var(--ok); }
.decision.inconclusive       { border-left-color: var(--warn); background: var(--warn-bg); }
.decision.inconclusive .word { color: var(--warn); }
.decision.no_match, .decision.blocked             { border-left-color: var(--stop); background: var(--stop-bg); }
.decision.no_match .word, .decision.blocked .word { color: var(--stop); }

/* -------------------------------------------------------------- banners -- */
.banner {
  border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn);
  border-radius: var(--radius); padding: var(--s3) var(--s4); margin-bottom: var(--s5);
  font-size: var(--t-sm); line-height: 1.55;
}
.banner .head {
  display: flex; align-items: center; gap: 7px;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; font-size: var(--t-xs); margin-bottom: var(--s2);
}
.banner .head::before {
  content: ""; width: 8px; height: 8px; border-radius: 2px;
  background: currentColor; flex: 0 0 auto; transform: rotate(45deg);
}
.banner p { margin: 0 0 5px; max-width: 92ch; }
.banner p:last-child { margin-bottom: 0; }
.banner strong { font-weight: 700; }
.banner.stub  { border-color: var(--warn-line); background: var(--warn-bg); }
/* `.err` means one thing only: the API failed. Nothing else may wear it, so
   that "is there an error panel on this page?" stays a question with a useful
   answer — for a reader and for the crawl that checks every screen. */
.banner.err   { border-color: var(--stop-line); background: var(--stop-bg); color: var(--stop); }
/* A consequence worth stopping for, which is not a failure: this click will
   change the register in a way the next screen depends on. */
.banner.caution { border-color: var(--stop-line); background: var(--stop-bg); color: var(--stop); }
.banner.flash { border-color: var(--info-line); background: var(--info-bg); color: var(--info); }
.banner.note  { border-color: var(--border-strong); background: var(--surface-2); color: var(--muted); }

/* The honesty layer. Designed, not bolted on — but never quieter than the
   content it qualifies, and the headline claim can never be collapsed away. */
.honesty {
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--warn);
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: var(--s5);
  overflow: hidden;
}
.honesty .hd {
  padding: var(--s2) var(--s4);
  background: var(--warn-bg); color: var(--warn);
  font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  border-bottom: 1px solid var(--warn-line);
}
.honesty .lede {
  padding: var(--s3) var(--s4);
  color: var(--ink); font-size: var(--t-base); font-weight: 540; line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.honesty .lede > span { display: block; max-width: 92ch; }
.honesty .lede.alt { color: var(--warn); background: var(--surface-2); font-weight: 560; }
.honesty > details > summary {
  padding: var(--s2) var(--s4); font-size: var(--t-sm); color: var(--muted);
}
.honesty > details[open] > summary { border-bottom: 1px solid var(--border); }
.honesty .body { padding: var(--s3) var(--s4) var(--s4); font-size: var(--t-sm); color: var(--text); }
.honesty .body p { margin: 0 0 var(--s2); max-width: 92ch; }
.honesty .body p:last-child { margin-bottom: 0; }
.honesty .body strong { color: var(--ink); }
/* Attribution. CC BY 4.0 obliges us to carry the citation wherever the images
   are shown, so it sits outside the collapsible disclosure and cannot fold. */
.honesty .attrib {
  display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap;
  padding: var(--s2) var(--s4);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: var(--t-xs); line-height: 1.55; color: var(--muted);
}
.honesty .attrib .lbl {
  flex: none; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--text);
}
.honesty .attrib .cite { max-width: 96ch; min-width: 0; overflow-wrap: anywhere; }
.honesty .attrib .cite strong { color: var(--ink); }
.honesty .attrib a { color: inherit; text-decoration: underline; }

/* --------------------------------------------------------------- frames -- */
.frames { display: flex; gap: var(--s2); flex-wrap: wrap; }
.frame {
  width: 132px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-3); overflow: hidden; min-width: 0;
}
@media (min-width: 620px) { .frame { width: 156px; } .frame.lg { width: 200px; } }
.frame img, .frame svg { display: block; width: 100%; height: auto; }
.frame .cap {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  padding: 4px 6px; background: var(--surface); border-top: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sbs { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; margin-bottom: var(--s5); }
@media (min-width: 860px) { .sbs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sbs .col {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s4); background: var(--surface); min-width: 0;
}
.sbs .col.left  { border-left: 4px solid var(--accent); }
.sbs .col.right { border-left: 4px solid var(--stop); }

/* ------------------------------------------------------------------- kv -- */
.kv { border-top: 1px solid var(--border); }
.kv .row {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 2px; padding: var(--s2) 0; border-bottom: 1px solid var(--border); font-size: var(--t-base);
}
@media (min-width: 620px) {
  .kv .row { grid-template-columns: 210px minmax(0, 1fr); gap: var(--s4); align-items: baseline; }
  .kv.narrow .row { grid-template-columns: 145px minmax(0, 1fr); }
}
.kv .row .k { color: var(--muted); font-size: var(--t-sm); }
@media (min-width: 620px) { .kv .row .k { font-size: var(--t-base); } }
.kv .row .v { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.kv .row .v .pill, .kv .row .v .score { margin-right: 4px; }

/* ---------------------------------------------------------------- forms -- */
form .field { margin-bottom: var(--s4); min-width: 0; }
label {
  display: block; font-size: var(--t-xs); letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); font-weight: 650; margin-bottom: 5px;
}
input[type=text], input[type=file], select, textarea {
  width: 100%; max-width: 100%; padding: 9px 10px; font-size: var(--t-base); font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
select { height: 38px; }
input[type=file] { padding: 7px 8px; font-size: var(--t-sm); }
input::placeholder { color: var(--faint); }
input:disabled { background: var(--surface-3); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px var(--s5); font-size: var(--t-base); font-weight: 620; font-family: inherit;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; line-height: 1.3;
  min-height: 40px;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.secondary { background: var(--surface); color: var(--accent); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); color: var(--accent-hover); }
.btn.danger { background: var(--stop); border-color: var(--stop); color: var(--stop-ink); }
.btn.danger:hover { filter: brightness(.92); color: var(--stop-ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.btnrow > .small { flex: 1 1 220px; min-width: 0; }

.filterbar { display: flex; gap: 6px; align-items: center; margin-bottom: var(--s4); flex-wrap: wrap; }
.filterbar a {
  padding: 6px var(--s3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); text-decoration: none; font-size: var(--t-sm);
  white-space: nowrap;
}
.filterbar a:hover { border-color: var(--accent); color: var(--accent); }
.filterbar a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 620; }

/* radio group used for probe quality */
.choices { display: grid; gap: var(--s2); }
@media (min-width: 620px) { .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choices label.choice {
  display: flex; gap: var(--s2); align-items: flex-start; margin: 0;
  padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: var(--t-base); color: var(--text);
}
.choices label.choice:hover { border-color: var(--border-strong); background: var(--surface-2); }
.choices input[type=radio] { width: auto; margin: 3px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.choices .choice .t { color: var(--ink); font-weight: 560; display: block; }

/* ----------------------------------------------------------- burst list -- */
.bursts {
  border: 1px solid var(--border); border-radius: var(--radius);
  max-height: 340px; overflow-y: auto; background: var(--surface); scrollbar-width: thin;
}
@media (min-width: 760px) { .bursts { max-height: 420px; } }
.bursts .group {
  padding: 7px var(--s3); background: var(--surface-3); border-bottom: 1px solid var(--border);
  font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  font-weight: 650; position: sticky; top: 0; z-index: 1;
}
.bursts label {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: var(--s2);
  align-items: baseline; padding: 10px var(--s3); border-bottom: 1px solid var(--border);
  cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400;
  font-size: var(--t-base); color: var(--text); margin: 0;
}
.bursts label:last-child { border-bottom: none; }
.bursts label:hover { background: var(--surface-2); }
.bursts label:has(input:checked) { background: var(--accent-soft); }
.bursts label .sub { grid-column: 2 / -1; font-size: var(--t-sm); color: var(--muted); }
.bursts input[type=radio] { width: auto; margin: 0; accent-color: var(--accent); }

/* ---------------------------------------------------------------- steps -- */
.steps { list-style: none; margin: 0; padding: 0; }
.steps > li {
  border-left: 2px solid var(--border-strong); padding: 0 0 var(--s5) var(--s5);
  margin-left: 7px; position: relative; min-width: 0;
}
.steps > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.steps > li::before {
  content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong);
}
.steps > li.done::before    { background: var(--ok);   border-color: var(--ok); }
.steps > li.blocked::before { background: var(--stop); border-color: var(--stop); }
.steps > li.skipped::before { background: var(--faint); border-color: var(--faint); }
.steps .title { font-weight: 620; color: var(--ink); margin-bottom: 3px; }
.steps .note { color: var(--muted); font-size: var(--t-sm); max-width: 84ch; }

/* ----------------------------------------------------------------- misc -- */
.chain { font-family: var(--mono); font-size: var(--t-xs); color: var(--muted); }
.chain .head { color: var(--ink); }

.qr {
  border: 1px solid var(--border-strong); background: #ffffff; padding: var(--s3);
  border-radius: var(--radius); width: 100%; max-width: 208px;
}
.qr svg { display: block; width: 100%; height: auto; }

.emptystate {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: var(--s6) var(--s4); text-align: center; color: var(--muted);
  background: var(--surface-2);
}
.emptystate .t { color: var(--ink); font-weight: 620; margin-bottom: 4px; font-size: var(--t-md); }
.emptystate p { margin: 0 auto; max-width: 62ch; font-size: var(--t-sm); }

.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li { border-bottom: 1px solid var(--border); }
.linklist li:last-child { border-bottom: none; }
.linklist a { display: block; padding: 8px 0; text-decoration: none; font-size: var(--t-base); }
.linklist a:hover { text-decoration: underline; }

.legend { display: grid; gap: 6px; font-size: var(--t-sm); }
.legend .item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s2); align-items: baseline; }
