/* ===========================================================================
   SovereignHealth Library — presentation UI
   ---------------------------------------------------------------------------
   Design notes, so a later reader knows what is deliberate:

   · Two typefaces, both from the system stack. UI chrome is sans; the speaker
     notes and the demo's `claim` events are set in the system serif, because
     those two carry the argument and should read as prose rather than as
     interface. No webfonts — this must run with no network.

   · The ORIGIN / CUSTODY distinction is carried by *shape* first and colour
     second: ORIGIN is a solid rule, a filled mark and a flat field; CUSTODY is
     a dashed rule, a hollow mark and a hatched field. It survives a projector
     with bad colour, a greyscale printout, and a colour-blind viewer.

   · Every actor gets one hue, declared once as --actor and inherited. Providers
     that can sign are greens; the patient's own identities are violets; the
     verifier is navy; the lab — the actor that cannot sign — is the only
     achromatic one, so its weakness reads as designed rather than as an
     oversight.
   =========================================================================== */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --scale: 1;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  --r-sm: 3px;
  --r-md: 5px;
  --rule: 1px;

  color-scheme: light dark;
}

/* Light — warm paper, so long reading at projector brightness is not glaring. */
:root,
body[data-theme="light"] {
  --bg:            #f6f6f3;
  --surface:       #ffffff;
  --surface-2:     #eeeeea;
  --surface-3:     #e4e4df;
  --text:          #15171b;
  --text-muted:    #565d69;
  --text-faint:    #6e7684;
  --border:        #d6d8dc;
  --border-strong: #b4b8c0;
  --shadow:        0 1px 2px rgba(16, 18, 22, .06), 0 8px 24px rgba(16, 18, 22, .05);

  --origin:        #0d6b3d;
  --origin-fill:   #e7f3ec;
  --custody:       #8a5a00;
  --custody-fill:  #faf1de;
  --reject:        #ad2313;
  --reject-fill:   #fbebe8;
  --caution:       #b07a00;

  --ok:            #0d6b3d;
  --warn:          #8a5a00;
  --deny:          #9c3324;
  --accent:        #1d3a73;

  --a-hospital:    #0d6e6b;
  --a-neurology:   #4a6e12;
  --a-lab:         #6a7280;
  --a-sovereign:   #6428c4;
  --a-warden:      #8f2a63;
  --a-ssa:         #1d3a73;

  --hazard-a:      #d9a520;
  --hazard-b:      #2b2b2b;
  --tint:          8%;
}

/* The script resolves `auto` against prefers-color-scheme and stamps the
   result on <body data-theme>, so every rule below matches one literal value.
   Dark is near-black rather than pure black: projectors bloom on pure black. */
body[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #0d1016;
  --surface:       #151921;
  --surface-2:     #1c212b;
  --surface-3:     #242a36;
  --text:          #e9ebef;
  --text-muted:    #a0a8b6;
  --text-faint:    #838c9b;
  --border:        #2a3038;
  --border-strong: #3d4552;
  --shadow:        0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);

  --origin:        #5fd39a;
  --origin-fill:   #10241b;
  --custody:       #f0b843;
  --custody-fill:  #2a2113;
  --reject:        #ff8f7e;
  --reject-fill:   #2c1614;
  --caution:       #f0c04a;

  --ok:            #5fd39a;
  --warn:          #f0b843;
  --deny:          #f0907e;
  --accent:        #93b4ff;

  --a-hospital:    #46c8c2;
  --a-neurology:   #a4d24a;
  --a-lab:         #8e97a6;
  --a-sovereign:   #b899ff;
  --a-warden:      #ef95c7;
  --a-ssa:         #93b4ff;

  --hazard-a:      #c99a2a;
  --hazard-b:      #14161c;
  --tint:          14%;
}

/* ── Reset / frame ──────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--scale));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }

::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ── Caution band ───────────────────────────────────────────────────────── */

.hazard {
  height: 5px;
  background: repeating-linear-gradient(
    -45deg,
    var(--hazard-a) 0 12px,
    var(--hazard-b) 12px 24px
  );
  opacity: .85;
}

/* ── Top bar ────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .7rem 1.4rem;
  background: var(--surface);
  border-bottom: var(--rule) solid var(--border);
}

.topbar__identity { min-width: 0; }

.brand {
  font-size: 1.05rem;
  font-weight: 640;
  letter-spacing: -.008em;
  white-space: nowrap;
}

.brand__sub {
  font-size: .72rem;
  color: var(--text-faint);
  letter-spacing: .02em;
  white-space: nowrap;
}

/* The synthetic-data flag. Loud enough to be unmissable in a screenshot,
   restrained enough not to look like a warning about a malfunction. */
.synthflag {
  display: flex;
  align-items: stretch;
  gap: .7rem;
  padding: .34rem .8rem .34rem .34rem;
  border: 1.5px solid var(--caution);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--caution) var(--tint), var(--surface));
  flex: none;
}

.synthflag__hatch {
  width: 9px;
  border-radius: 2px;
  background: repeating-linear-gradient(
    -45deg,
    var(--caution) 0 5px,
    transparent 5px 10px
  );
}

.synthflag__text { display: flex; flex-direction: column; justify-content: center; }

.synthflag__text strong {
  font-size: .8rem;
  font-weight: 720;
  letter-spacing: .11em;
  color: var(--text);
}

.synthflag__text span {
  font-size: .68rem;
  color: var(--text-muted);
  letter-spacing: .01em;
}

.runmeta {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
  min-width: 0;
}

.runmeta__pair { min-width: 0; }

.runmeta dt {
  font-size: .61rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--text-faint);
}

.runmeta dd {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22ch;
}

.topbar__tools { display: flex; gap: .5rem; flex: none; }

.segmented {
  display: flex;
  border: var(--rule) solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
}

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: .72rem;
  padding: .3rem .55rem;
  cursor: pointer;
  border-right: var(--rule) solid var(--border);
}

.segmented button:last-child { border-right: 0; }
.segmented button:hover { background: var(--surface-3); color: var(--text); }

.segmented button[aria-pressed="true"] {
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
}

.segmented .sm { font-size: .62em; }
.segmented .lg { font-size: 1em; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr) 27rem;
  min-height: 0;
}

.rail,
.side { background: var(--surface); min-width: 0; }
.rail { border-right: var(--rule) solid var(--border); overflow-y: auto; }
/* Fractional rows rather than auto: the two panels keep the same proportions
   from slide to slide, so nothing jumps under an audience mid-sentence. */
.side {
  border-left: var(--rule) solid var(--border);
  display: grid;
  grid-template-rows: minmax(0, .85fr) minmax(0, 1fr);
  min-height: 0;
}

.panelhead {
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--text-faint);
  padding: 1rem 1.15rem .5rem;
}

.panelhead--spaced { padding-top: 1.6rem; }
.panelhead--row { display: flex; align-items: center; justify-content: space-between; }

.counter {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: 0;
  color: var(--text-muted);
  background: var(--surface-2);
  border: var(--rule) solid var(--border);
  border-radius: 999px;
  padding: 0 .5rem;
}

/* ── Outline rail ───────────────────────────────────────────────────────── */

.outline { padding: 0 .55rem; }

.outline__item {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: .55rem;
  align-items: start;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--r-md);
  padding: .5rem .6rem;
  cursor: pointer;
  position: relative;
}

.outline__item:disabled { cursor: default; opacity: .55; }
.outline__item:not(:disabled):hover { background: var(--surface-2); }

.outline__num {
  font-family: var(--mono);
  font-size: .72rem;
  line-height: 1.5;
  color: var(--text-faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.outline__title {
  font-size: .87rem;
  line-height: 1.32;
  letter-spacing: -.003em;
}

.outline__ms {
  display: block;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--text-faint);
  margin-top: .12rem;
  font-variant-numeric: tabular-nums;
}

.outline__item[data-state="done"] { color: var(--text); }
.outline__item[data-state="done"] .outline__num::before { content: "✓ "; color: var(--ok); }

.outline__item[data-state="current"] {
  background: color-mix(in srgb, var(--accent) var(--tint), var(--surface));
  color: var(--text);
}

.outline__item[data-state="current"] .outline__title { font-weight: 640; }

.outline__item[data-state="current"]::before {
  content: "";
  position: absolute;
  left: -.55rem;
  top: .35rem;
  bottom: .35rem;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.outline__item[data-state="running"] .outline__num::before {
  content: "▶ ";
  color: var(--accent);
}

.outline__item[data-state="missing"] .outline__title { font-style: italic; }

.outline__item--summary {
  margin-top: .5rem;
  border-top: var(--rule) solid var(--border);
  border-radius: 0 0 var(--r-md) var(--r-md);
  padding-top: .7rem;
}

/* ── Cast legend ────────────────────────────────────────────────────────── */

.cast { padding: 0 1.15rem 1.4rem; display: grid; gap: .34rem; }

.cast__item {
  display: grid;
  grid-template-columns: .5rem minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
}

.cast__swatch {
  width: .5rem;
  height: 1.5rem;
  border-radius: 1px;
  background: var(--actor, var(--text-faint));
}

.cast__item[data-actor="lab"] .cast__swatch {
  background: repeating-linear-gradient(
    -45deg,
    var(--a-lab) 0 3px,
    transparent 3px 6px
  );
  border: var(--rule) dashed var(--a-lab);
}

.cast__name {
  font-size: .78rem;
  line-height: 1.2;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast__role {
  display: block;
  font-size: .6rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--actor, var(--text-faint));
  font-weight: 700;
}

.cast__role--none { color: var(--text-faint); font-weight: 500; font-style: italic; letter-spacing: .04em; text-transform: none; }

/* ── Stage ──────────────────────────────────────────────────────────────── */

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.stage__scroll {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.stage__inner {
  max-width: 62rem;
  padding: 2.1rem 2.6rem 4rem;
}

@media (prefers-reduced-motion: reduce) {
  .stage__scroll { scroll-behavior: auto; }
}

/* Step heading */

.stephead { margin-bottom: 1.6rem; }

.stephead__eyebrow {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: .55rem;
}

.stephead__eyebrow::after {
  content: "";
  flex: 1;
  height: var(--rule);
  background: var(--border);
}

.stephead__title {
  font-size: 2.05rem;
  line-height: 1.12;
  font-weight: 660;
  letter-spacing: -.019em;
  text-wrap: balance;
}

.stephead__sub {
  margin-top: .5rem;
  font-size: 1.06rem;
  line-height: 1.4;
  color: var(--text-muted);
  max-width: 48ch;
  text-wrap: pretty;
}

/* Event groups — consecutive events by one actor render as a single block,
   so step 2 reads as six identities rather than twenty-four lines. */

.group {
  position: relative;
  margin: 0 0 .85rem;
  padding: .75rem 1rem .75rem 1.05rem;
  background: var(--surface);
  border: var(--rule) solid var(--border);
  border-left: 4px solid var(--actor, var(--border-strong));
  border-radius: var(--r-md);
}

.group[data-actor="lab"] { border-left-style: dashed; }
.group--plain { border-left-color: var(--border-strong); }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--actor, var(--text-muted));
  margin-bottom: .3rem;
}

.chip__role {
  font-size: .63rem;
  letter-spacing: .12em;
  padding: .06rem .38rem;
  border-radius: 2px;
  border: var(--rule) solid currentColor;
  opacity: .85;
}

.chip__role--none {
  border-style: dashed;
  text-transform: none;
  letter-spacing: .03em;
  font-weight: 500;
  font-style: italic;
}

.act {
  font-size: 1.06rem;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: .15rem;
  text-wrap: pretty;
}

.note {
  font-size: .93rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: .22rem 0;
  max-width: 62ch;
  text-wrap: pretty;
}

/* evidence rows inside the stage */
.ev {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr);
  gap: .2rem .9rem;
  padding: .2rem 0;
  align-items: baseline;
}

.ev__label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev__value {
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* status lines */
.status {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1fr);
  gap: .5rem;
  align-items: baseline;
  font-size: 1rem;
  line-height: 1.42;
  margin: .3rem 0;
  max-width: 62ch;
}

.status__mark { font-weight: 700; text-align: center; font-size: 1.05em; }
.status--ok   { color: var(--text); }
.status--ok   .status__mark { color: var(--ok); }
.status--warn .status__mark { color: var(--warn); }
.status--deny .status__mark { color: var(--deny); }
/* `bad` is a genuine defect — something the demo asserts must never happen.
   Distinct from `deny`, which is a correct refusal. */
.status--bad .status__mark { color: var(--reject); }
.status--bad { color: var(--text); font-weight: 600; }
.status--warn, .status--deny { color: var(--text); }

.timing {
  display: inline-block;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text-faint);
  background: var(--surface-2);
  border-radius: 999px;
  padding: .05rem .5rem;
  margin: .3rem .3rem 0 0;
  font-variant-numeric: tabular-nums;
}

/* The demo's own argument — set in serif, given room. */
.claim {
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.5;
  color: var(--text);
  margin: 1.3rem 0;
  padding: .3rem 0 .3rem 1.15rem;
  border-left: 3px solid var(--accent);
  max-width: 52ch;
  text-wrap: pretty;
}

/* tables */
.tablewrap {
  margin: .4rem 0 1.1rem;
  border: var(--rule) solid var(--border);
  border-radius: var(--r-md);
  overflow-x: auto;
  background: var(--surface);
}

table { border-collapse: collapse; width: 100%; font-size: .97rem; }

thead th {
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: .6rem .95rem;
  border-bottom: var(--rule) solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

tbody td {
  padding: .62rem .95rem;
  border-bottom: var(--rule) solid var(--border);
  vertical-align: top;
  line-height: 1.4;
}

tbody tr:last-child td { border-bottom: 0; }
tbody td:first-child { font-family: var(--mono); font-size: .88rem; color: var(--text); white-space: nowrap; }

/* ── Trust classes — the thesis ─────────────────────────────────────────── */

.record {
  --klass: var(--border-strong);
  --klass-fill: var(--surface-2);
  margin: .55rem 0;
  border-radius: var(--r-md);
  background: var(--klass-fill);
  padding: .75rem .95rem;
}

.record--origin {
  --klass: var(--origin);
  --klass-fill: var(--origin-fill);
  border: 1.5px solid var(--klass);
}

/* Hollow, dashed, hatched. Different in kind, not merely in colour. */
.record--custody {
  --klass: var(--custody);
  --klass-fill: var(--custody-fill);
  border: 1.5px dashed var(--klass);
  background-image: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--custody) 11%, transparent) 0 6px,
    transparent 6px 14px
  );
}

.record__head {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin-bottom: .4rem;
}

.klassmark { color: var(--klass); display: block; flex: none; }
.klassmark svg { display: block; width: 1.15rem; height: 1.15rem; }

.klassname {
  font-size: .82rem;
  font-weight: 780;
  letter-spacing: .17em;
  color: var(--klass);
}

.klassgloss {
  font-size: .78rem;
  color: var(--text-muted);
  letter-spacing: .01em;
}

.klassgloss::before { content: "· "; color: var(--klass); }

.record__id {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-muted);
}

.record__summary {
  font-size: 1.08rem;
  line-height: 1.38;
  color: var(--text);
  max-width: 60ch;
  text-wrap: pretty;
}

.record__foot { margin-top: .45rem; }
.record__foot .chip { margin-bottom: 0; }

/* Verdicts */

.verdict {
  --klass: var(--border-strong);
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  gap: .3rem .75rem;
  align-items: center;
  margin: .55rem 0;
  padding: .75rem .95rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--klass);
  background: var(--klass-fill, var(--surface-2));
}

.verdict--accept  { --klass: var(--origin);  --klass-fill: var(--origin-fill); }
.verdict--caveat  { --klass: var(--custody); --klass-fill: var(--custody-fill); border-style: dashed; }
.verdict--reject  { --klass: var(--reject);  --klass-fill: var(--reject-fill); }

.verdict__mark { color: var(--klass); grid-row: span 2; align-self: start; }
.verdict__mark svg { display: block; width: 1.6rem; height: 1.6rem; }

.verdict__head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }

.verdict__disp {
  font-size: 1.02rem;
  font-weight: 780;
  letter-spacing: .1em;
  color: var(--klass);
}

.verdict__rec { font-family: var(--mono); font-size: .82rem; color: var(--text-muted); }

.klasstag {
  font-size: .64rem;
  font-weight: 750;
  letter-spacing: .15em;
  padding: .1rem .4rem;
  border-radius: 2px;
  border: var(--rule) solid var(--klass);
  color: var(--klass);
}

.klasstag--custody { border-style: dashed; }

.verdict__reason {
  font-size: .95rem;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 62ch;
  text-wrap: pretty;
}

/* ── Cover / composition callout ────────────────────────────────────────── */

.cover__lede {
  font-family: var(--serif);
  font-size: 1.24rem;
  line-height: 1.55;
  color: var(--text);
  max-width: 54ch;
  margin: 1.2rem 0 1.6rem;
  text-wrap: pretty;
}

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .8rem;
  margin: 1.2rem 0;
}

.deck__cell {
  border: var(--rule) solid var(--border);
  border-left: 4px solid var(--actor, var(--border-strong));
  border-radius: var(--r-md);
  padding: .7rem .85rem;
  background: var(--surface);
}

.deck__cell[data-actor="lab"] { border-left-style: dashed; }
.deck__name { font-size: .95rem; font-weight: 600; line-height: 1.25; margin-bottom: .2rem; }
.deck__role { font-size: .88rem; color: var(--text-muted); line-height: 1.35; }

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: .8rem;
  margin: 1.4rem 0;
}

/* ── Working state ──────────────────────────────────────────────────────── */

.working {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin: 1.4rem 0;
  padding: .9rem 1.1rem;
  border: var(--rule) dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}

.working__pulse {
  width: .7rem;
  height: .7rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
  flex: none;
}

@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .working__pulse { animation: none; opacity: .9; } }

.working__text { font-size: 1rem; color: var(--text); }
.working__sub { font-size: .84rem; color: var(--text-muted); margin-top: .1rem; }

.working__ms {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Banners ────────────────────────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  padding: .8rem 1rem;
  border-radius: var(--r-md);
  margin-bottom: 1.3rem;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  font-size: .95rem;
  line-height: 1.45;
}

.banner--error { border-color: var(--reject); background: var(--reject-fill); }
.banner--info  { border-color: var(--accent); background: color-mix(in srgb, var(--accent) var(--tint), var(--surface)); }
.banner__title { font-weight: 700; margin-bottom: .15rem; }
.banner__body { color: var(--text-muted); overflow-wrap: anywhere; }
.banner__body code { font-family: var(--mono); font-size: .92em; color: var(--text); }

.banner__close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: .1rem .3rem;
}

/* ── Speaker notes ──────────────────────────────────────────────────────── */

.notes {
  border-bottom: var(--rule) solid var(--border);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.notes__body { padding: 0 1.4rem 1.3rem; overflow-y: auto; min-height: 0; }

.notes__body p {
  font-family: var(--serif);
  font-size: 1.11rem;
  line-height: 1.62;
  color: var(--text);
  max-width: 44ch;
  text-wrap: pretty;
  hyphens: auto;
}

.notes__body p + p { margin-top: .75rem; }

.notes__body p::first-line { letter-spacing: .004em; }

.notes__empty { font-family: var(--sans) !important; color: var(--text-faint) !important; font-size: .93rem !important; font-style: italic; }

/* ── Evidence log ───────────────────────────────────────────────────────── */

.evidence { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; }

.evidence__hint {
  padding: 0 1.4rem .6rem;
  font-size: .76rem;
  line-height: 1.4;
  color: var(--text-faint);
  max-width: 42ch;
}

.evidence__scroll { overflow-y: auto; padding: 0 1.4rem 1.5rem; }

.evidence__step {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: .85rem 0 .35rem;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: var(--rule) solid var(--border);
  margin-bottom: .3rem;
  z-index: 1;
}

.evrow {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  background: transparent;
  border: 0;
  border-left: 3px solid var(--actor, var(--border));
  padding: .3rem 0 .35rem .6rem;
  margin: .2rem 0;
  cursor: pointer;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.evrow[data-actor="lab"] { border-left-style: dashed; }
.evrow:hover { background: var(--surface-2); }

.evrow.is-match {
  background: color-mix(in srgb, var(--accent) var(--tint), var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.evrow__label {
  display: block;
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--actor, var(--text-faint));
  font-weight: 700;
  margin-bottom: .1rem;
}

.evrow__value {
  display: block;
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.42;
  color: var(--text);
  overflow-wrap: anywhere;
}

.evrow__copied {
  display: none;
  font-size: .64rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ok);
  font-weight: 700;
}

.evrow.is-copied .evrow__copied { display: inline; }

.evidence__empty {
  padding: .5rem 0;
  font-size: .88rem;
  font-style: italic;
  color: var(--text-faint);
}

/* ── Control bar ────────────────────────────────────────────────────────── */

.controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: .7rem 1.4rem;
  background: var(--surface);
  border-top: var(--rule) solid var(--border);
}

.progress__label { font-size: .86rem; color: var(--text); font-weight: 560; }

.pips { display: flex; gap: .22rem; margin-top: .35rem; }

.pips li {
  width: 1.5rem;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

.pips li[data-state="done"] { background: var(--ok); }
.pips li[data-state="current"] { background: var(--accent); }

.controls__timing { display: flex; gap: 1.2rem; margin-left: auto; }

.timing__item {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.controls__actions { display: flex; align-items: center; gap: .7rem; }

.keyhint { font-size: .72rem; color: var(--text-faint); white-space: nowrap; }

kbd {
  font-family: var(--mono);
  font-size: .92em;
  border: var(--rule) solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 .28rem;
  background: var(--surface-2);
  color: var(--text-muted);
}

.btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  border-radius: var(--r-md);
  padding: .55rem 1.2rem;
  cursor: pointer;
  border: var(--rule) solid transparent;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}

.btn--primary { background: var(--accent); color: var(--surface); font-size: 1.02rem; padding: .58rem 1.5rem; }
body[data-theme="dark"] .btn--primary { color: #0d1016; }
.btn--primary:hover:not(:disabled) { filter: brightness(1.1); }

.btn--ghost { background: var(--surface); color: var(--text-muted); border-color: var(--border-strong); font-size: .88rem; }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn--ghost[data-armed="true"] { border-color: var(--reject); color: var(--reject); background: var(--reject-fill); font-weight: 700; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn__spinner {
  display: none;
  width: .85rem;
  height: .85rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn.is-busy .btn__spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn__spinner { animation-duration: 2s; } }

/* ── Narrower screens ───────────────────────────────────────────────────── */

@media (max-width: 1400px) {
  .layout { grid-template-columns: 15rem minmax(0, 1fr) 23rem; }
  .stage__inner { padding: 1.7rem 1.9rem 3.5rem; }
}

@media (max-width: 1150px) {
  body { overflow: auto; height: auto; }
  .layout { grid-template-columns: 14rem minmax(0, 1fr); }
  .side { grid-column: 1 / -1; border-left: 0; border-top: var(--rule) solid var(--border); }
  .runmeta { display: none; }
}

@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: var(--rule) solid var(--border); }
  .topbar { flex-wrap: wrap; gap: .8rem; }
  .keyhint { display: none; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */

@media print {
  body { height: auto; overflow: visible; display: block; }
  .rail, .controls, .topbar__tools { display: none; }
  .layout { display: block; }
  .side { border: 0; }
  .stage__scroll, .evidence__scroll, .notes__body { overflow: visible; }
}


/* ── Withheld record ───────────────────────────────────────────────────────
   Minimum-necessary working correctly. Deliberately reads as "declined", not
   as a failure: muted, struck-through summary, no error colour. */
.withheld {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.55em 0.8em;
  margin: 0.5em 0;
  background: var(--surface-2);
}
.withheld__head {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin-bottom: 0.25em;
}
.withheld__mark { color: var(--deny); font-size: 1.05em; }
.withheld__id {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--text-muted);
}
.withheld__tag {
  font-size: 0.7em;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 2px;
  padding: 0.1em 0.45em;
}
.withheld__summary {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border-strong);
}
.withheld__reason {
  font-size: 0.9em;
  color: var(--text-faint);
  margin-top: 0.3em;
}
