/* ==========================================================================
   Beacon — mission console design system for Verifier
   Calm, precise, dark. Linear/Vercel register crossed with a flight-ops
   display. Restraint over decoration: the drama comes from the data.

   Contract note: js/app.js writes inline styles against the legacy variable
   names (--good, --bad, --dim, --warn, --accent, ...) and toggles the classes
   active / on / show / sel / hint. Those names are load-bearing — see
   DESIGN-SYSTEM.md § Contract. Do not rename them.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces — base #0b0e13, three elevation steps by subtle lightness.
     Depth reads through hairline borders, not shadows. */
  --surface-0: #0b0e13;            /* page base */
  --surface-1: #10141c;            /* header, nav, sidebar, dialog */
  --surface-2: #151b26;            /* inputs, chips, hover fills */
  --surface-3: #1b2330;            /* active fills, pills, highest step */
  --canvas-bg: #0a0d12;            /* matches the JS canvas fill exactly */

  --hairline: #1e2634;             /* default border */
  --hairline-strong: #2b3546;      /* hover / emphasized border */

  /* Text */
  --text-primary: #e4eaf2;
  --text-secondary: #94a0b3;
  --text-tertiary: #5d6979;

  /* Signal palette — hexes anchored to the canvas drawing code in js/app.js */
  --rescue: #06d6a0;               /* survivor beacon, rescued outcome, free play */
  --rescue-bright: #43e6bd;
  --rescue-muted: rgba(6, 214, 160, .13);
  --correction: #4cc9f0;           /* human correction branch, primary actions */
  --correction-bright: #85dcf6;
  --correction-muted: rgba(76, 201, 240, .12);
  --model: #ef476f;                /* model flight, adverse outcome, danger */
  --model-bright: #ff7394;
  --model-muted: rgba(239, 71, 111, .12);
  --caution: #ffd166;              /* lost/timeout, queue notes, warnings */
  --caution-bright: #ffe1a1;
  --caution-muted: rgba(255, 209, 102, .11);

  /* Type — system stack for UI, ui-monospace for data */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;
  --track-caps: .08em;             /* tracking on uppercase labels */

  /* Space — 4px grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  /* Motion */
  --dur: 150ms;
  --ease: cubic-bezier(.25, .6, .3, 1);
  --dur-beacon: 1.4s;

  /* Focus ring */
  --ring: 0 0 0 2px rgba(76, 201, 240, .45);

  /* Legacy aliases — js/app.js writes inline styles against these names.
     They must always resolve. */
  --bg: var(--surface-0);
  --panel: var(--surface-1);
  --panel2: var(--surface-2);
  --line: var(--hairline);
  --text: var(--text-primary);
  --dim: var(--text-secondary);
  --accent: var(--correction);
  --good: var(--rescue);
  --bad: var(--model);
  --warn: var(--caution);
  --mono: var(--font-mono);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; }

body {
  background: var(--surface-0);
  color: var(--text-primary);
  font: var(--fs-14)/1.5 var(--font-ui);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(76, 201, 240, .28); }

/* Subtle scrollbars that belong to the surface, not the OS */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 5px;
  border: 2px solid var(--surface-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--hairline-strong); }

/* Focus is always visible, never decorative */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* Utility: the beacon pulse. 1.4s, matches the survivor beacon on canvas. */
@keyframes beacon-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(6, 214, 160, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(6, 214, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(6, 214, 160, 0); }
}
.u-beacon { animation: beacon-pulse var(--dur-beacon) var(--ease) infinite; }

.mono, td.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   3. Header — mission strip
   -------------------------------------------------------------------------- */
header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  min-height: 44px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-beacon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rescue);
  flex-shrink: 0;
}

header h1 {
  font-size: var(--fs-14);
  font-weight: 650;
  letter-spacing: var(--track-caps);
  white-space: nowrap;
}

header h1 span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: var(--sp-2);
  vertical-align: 2px;
  letter-spacing: .02em;
}

header .sub {
  color: var(--text-tertiary);
  font-size: var(--fs-12);
  border-left: 1px solid var(--hairline);
  padding-left: var(--sp-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-cluster {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

header .session {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 3px 10px;
}
header .session:empty { display: none; }

/* --------------------------------------------------------------------------
   4. Tabs — nav with underline glow + count pills
   -------------------------------------------------------------------------- */
nav {
  display: flex;
  gap: var(--sp-1);
  padding: 0 var(--sp-3);
  background: var(--surface-1);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

nav button {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 10px 14px;
  font: 500 var(--fs-13)/1 var(--font-ui);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

nav button::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

nav button:hover { color: var(--text-primary); }

nav button.active { color: var(--text-primary); }
nav button.active::after {
  background: var(--correction);
  box-shadow: 0 0 8px rgba(76, 201, 240, .55);
}

nav button .count {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--correction);
  background: var(--correction-muted);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
}
nav button .count:empty { display: none; }

/* --------------------------------------------------------------------------
   5. Layout — main / sidebar / panels
   -------------------------------------------------------------------------- */
main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#sidebar {
  width: 272px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--surface-1);
  border-right: 1px solid var(--hairline);
  padding-bottom: var(--sp-4);
}

/* World group headers — eyebrow labels (JS injects h3 elements) */
#sidebar h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--text-tertiary);
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
}

.ro-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px var(--sp-3) 5px 10px;
  border-left: 2px solid transparent;
  font-size: var(--fs-12);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}

.ro-row:hover { background: var(--surface-2); }

.ro-row.sel {
  background: var(--surface-2);
  border-left-color: var(--correction);
}

.ro-row .ck {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  width: 116px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ro-row .score {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--correction);
  min-width: 38px;
  text-align: right;
}

/* Panels — tab content containers. JS toggles .active. */
.panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-5) var(--sp-8);
  display: none;
}
.panel.active { display: block; }

/* --------------------------------------------------------------------------
   6. Section headers & text
   -------------------------------------------------------------------------- */
h2 {
  font-size: var(--fs-13);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--text-primary);
  margin: var(--sp-6) 0 var(--sp-2);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--hairline);
}
h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--text-tertiary);
}

/* Hints double as empty states ("No corrections yet — ...") */
.hint {
  color: var(--text-secondary);
  font-size: var(--fs-13);
  line-height: 1.55;
  margin: var(--sp-1) 0 var(--sp-3);
  max-width: 72ch;
}
.hint b { color: var(--text-primary); font-weight: 600; }

/* Meta lines — dense mono telemetry under headings */
.meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: var(--sp-2) 0 var(--sp-3);
}
.meta b { color: var(--text-primary); font-weight: 600; }

/* Inline labels inside control rows ("queue:", "margin:") */
.ctl-label {
  color: var(--text-tertiary);
  font-size: var(--fs-12);
}

/* Caution-toned mono note (queue mode annotations) */
.note-caution {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--caution);
}

/* --------------------------------------------------------------------------
   7. Buttons — primary / ghost (default) / danger / quiet
   -------------------------------------------------------------------------- */
button.btn {
  appearance: none;
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px 12px;
  font: 500 var(--fs-13)/1.2 var(--font-ui);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease),
              background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

button.btn:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-3);
}

button.btn:active { transform: translateY(1px); }

button.btn.primary {
  background: var(--correction-muted);
  border-color: rgba(76, 201, 240, .45);
  color: var(--correction-bright);
}
button.btn.primary:hover {
  border-color: var(--correction);
  background: rgba(76, 201, 240, .18);
}

button.btn.danger {
  background: transparent;
  border-color: rgba(239, 71, 111, .45);
  color: var(--model-bright);
}
button.btn.danger:hover {
  border-color: var(--model);
  background: var(--model-muted);
}

button.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
button.btn.quiet:hover {
  color: var(--text-primary);
  background: var(--surface-2);
}

button.btn:disabled {
  opacity: .4;
  cursor: default;
  transform: none;
}
button.btn:disabled:hover {
  border-color: var(--hairline);
  background: var(--surface-2);
}
button.btn.primary:disabled:hover {
  border-color: rgba(76, 201, 240, .45);
  background: var(--correction-muted);
}

/* Selects share the .btn class in markup — style them to match */
select.btn {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px 26px 6px 12px;
  font: 500 var(--fs-13)/1.2 var(--font-ui);
  cursor: pointer;
  /* chevron drawn with gradients — no external assets */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-tertiary) 50%),
    linear-gradient(135deg, var(--text-tertiary) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 10px) 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  transition: border-color var(--dur) var(--ease);
}
select.btn:hover { border-color: var(--hairline-strong); }

/* --------------------------------------------------------------------------
   8. Badges — outcome variants keyed to existing class hooks
   -------------------------------------------------------------------------- */
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .03em;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge.goal {          /* displayed as "rescued" */
  background: var(--rescue-muted);
  border-color: rgba(6, 214, 160, .28);
  color: var(--rescue);
}

.badge.crash {         /* displayed as "adverse" */
  background: var(--model-muted);
  border-color: rgba(239, 71, 111, .28);
  color: var(--model-bright);
}

.badge.timeout {       /* displayed as "lost" */
  background: var(--caution-muted);
  border-color: rgba(255, 209, 102, .25);
  color: var(--caution);
}

/* --------------------------------------------------------------------------
   9. Stat chips
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 3px 10px;
}
.chip b { color: var(--text-primary); font-weight: 600; }

/* --------------------------------------------------------------------------
   10. Canvas, legend, controls
   -------------------------------------------------------------------------- */
.canvas-wrap { position: relative; display: inline-block; }

canvas {
  background: var(--canvas-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  max-width: 100%;
  display: block;
}

.legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: var(--sp-2);
}

.legend .k {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: -1px;
  margin-right: 6px;
}
.legend .k-model { background: var(--model); }
.legend .k-correction { background: var(--correction); }
.legend .k-rescue { background: var(--rescue); }
.legend .k-nofly { background: transparent; border: 1px dashed var(--model); }

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: var(--sp-3) 0;
  flex-wrap: wrap;
}

.tickinfo {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 110px;
}

/* --------------------------------------------------------------------------
   11. Range inputs
   -------------------------------------------------------------------------- */
input[type=range] {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  min-width: 120px;
  height: 18px;
  background: transparent;
  cursor: pointer;
  accent-color: var(--correction);
}

input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--correction);
  border: 2px solid var(--surface-0);
  transition: transform var(--dur) var(--ease);
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }

input[type=range]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}
input[type=range]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--correction);
  border: 2px solid var(--surface-0);
}

input[type=range]:focus-visible { box-shadow: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }

/* --------------------------------------------------------------------------
   12. Takeover banner
   -------------------------------------------------------------------------- */
.takeover-banner {
  display: none;
  background: var(--model-muted);
  border: 1px solid rgba(239, 71, 111, .5);
  border-left: 3px solid var(--model);
  color: var(--model-bright);
  padding: 7px var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  margin: var(--sp-2) 0;
}
.takeover-banner.on { display: block; }

/* --------------------------------------------------------------------------
   13. Compare grid, judge bar, prediction line
   -------------------------------------------------------------------------- */
.compare-grid {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.compare-col h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.judge-bar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-4);
  flex-wrap: wrap;
}
.judge-bar .ctl-label { margin-left: var(--sp-2); }

.pred {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  color: var(--caution);
  margin-top: var(--sp-2);
}

/* --------------------------------------------------------------------------
   14. Data tables — sticky header, row hover, tabular numerals
   -------------------------------------------------------------------------- */
table {
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  margin-top: var(--sp-2);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-0);
  box-shadow: inset 0 -1px 0 var(--hairline-strong);
}

th, td {
  padding: 6px 14px 6px 0;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  white-space: nowrap;
}
th:first-child, td:first-child { padding-left: var(--sp-1); }

th {
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  border-bottom: none;
}

tbody tr { transition: background var(--dur) var(--ease); }
tbody tr:hover { background: var(--surface-2); }

/* --------------------------------------------------------------------------
   15. Weight bars (verifier explainability)
   -------------------------------------------------------------------------- */
.wbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 5px 0;
  font-size: var(--fs-12);
}

.wbar .lbl {
  width: 190px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.wbar .track {
  flex: 1;
  max-width: 320px;
  height: 8px;
  position: relative;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  /* center zero-line so positive/negative reads instantly */
  background-image: linear-gradient(var(--hairline-strong), var(--hairline-strong));
  background-size: 1px 100%;
  background-position: 50% 0;
  background-repeat: no-repeat;
}

.wbar .fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: var(--r-sm);
  transition: width var(--dur) var(--ease), left var(--dur) var(--ease);
}

.wbar .val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  width: 60px;
  text-align: right;
}

/* --------------------------------------------------------------------------
   16. Queue items, code preview
   -------------------------------------------------------------------------- */
.queue-item {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--caution);
  padding: 4px 0;
  border-bottom: 1px solid var(--hairline);
  transition: color var(--dur) var(--ease);
}
.queue-item:last-child { border-bottom: none; }
.queue-item:hover { color: var(--caution-bright); }

pre {
  background: var(--canvas-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-secondary);
  overflow: auto;
  max-height: 420px;
}

/* --------------------------------------------------------------------------
   17. Dialog
   -------------------------------------------------------------------------- */
dialog {
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  width: 440px;
  max-width: calc(100vw - 32px);
}

dialog::backdrop {
  background: rgba(4, 6, 10, .6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

dialog h3 {
  font-size: var(--fs-14);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

dialog label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--text-tertiary);
  margin: var(--sp-3) 0 var(--sp-1);
}

dialog select,
dialog textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 6px 8px;
  font: var(--fs-13)/1.4 var(--font-ui);
  transition: border-color var(--dur) var(--ease);
}
dialog select:hover,
dialog textarea:hover { border-color: var(--hairline-strong); }
dialog textarea { resize: vertical; font-family: var(--font-ui); }

dialog .row {
  display: flex;
  gap: 10px;
  margin-top: var(--sp-4);
  justify-content: flex-end;
}

/* Blame slider row + radio group in the annotate dialog */
.blame-row {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}
.blame-row .mono { font-size: 11px; min-width: 150px; }

.radio-row {
  display: flex;
  gap: var(--sp-4);
  font-size: var(--fs-13);
}
.radio-row label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: var(--fs-13);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  cursor: pointer;
}
.radio-row input[type=radio] { accent-color: var(--correction); }

#blame-suggestion, #attr-suggestion { margin: 2px 0 6px; }
#ann-confidence { width: 100%; }

/* --------------------------------------------------------------------------
   18. Toast
   -------------------------------------------------------------------------- */
#toast {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 40;
  background: var(--surface-3);
  border: 1px solid rgba(76, 201, 240, .5);
  border-left: 3px solid var(--correction);
  color: var(--text-primary);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

/* --------------------------------------------------------------------------
   19. kbd hint chips
   -------------------------------------------------------------------------- */
kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  padding: 1px 6px;
}

.kbd-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--fs-12);
  color: var(--text-secondary);
}
.kbd-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------------------
   20. Briefing overlay — "The correction loop"
   -------------------------------------------------------------------------- */
#briefing {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: rgba(4, 6, 10, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity 220ms var(--ease), visibility 220ms var(--ease);
}

#briefing.dismissed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.briefing-card {
  background: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  max-width: 720px;
  width: 100%;
}

.briefing-card .eyebrow { margin-bottom: var(--sp-2); }

.briefing-card h2 {
  font-size: var(--fs-24);
  font-weight: 650;
  text-transform: none;
  letter-spacing: -.01em;
  border: none;
  padding: 0;
  margin: 0 0 var(--sp-5);
}

.briefing-card p {
  font-size: var(--fs-14);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 62ch;
  margin: var(--sp-5) 0 var(--sp-6);
}
.briefing-card p b { color: var(--text-primary); font-weight: 600; }

/* Horizontal 5-step loop diagram — pure HTML/CSS */
.loop-diagram {
  list-style: none;
  display: flex;
  align-items: stretch;
  padding: 0;
  margin: 0;
}

.loop-diagram li {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  min-width: 0;
}

.loop-diagram li + li { margin-left: var(--sp-6); }

/* connector between steps */
.loop-diagram li + li::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sp-6));
  top: 50%;
  width: var(--sp-6);
  height: 1px;
  background: var(--hairline-strong);
}
.loop-diagram li + li::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  margin-top: -3px;
  border-left: 5px solid var(--hairline-strong);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

.loop-diagram .loop-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

.loop-diagram .loop-step {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.loop-diagram .loop-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

/* The human step is the product — single accent in the diagram */
.loop-diagram li.loop-human {
  background: var(--correction-muted);
  border-color: rgba(76, 201, 240, .4);
}
.loop-diagram li.loop-human .loop-num,
.loop-diagram li.loop-human .loop-sub { color: rgba(133, 220, 246, .75); }
.loop-diagram li.loop-human .loop-step { color: var(--correction-bright); }

.briefing-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.briefing-actions .btn.primary { padding: 8px 18px; font-size: var(--fs-14); }

/* --------------------------------------------------------------------------
   21. Print — nothing gaudy
   -------------------------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; height: auto; overflow: visible; }
  header, nav, #sidebar, #briefing, #toast, .controls, .judge-bar { display: none !important; }
  .panel { display: block; overflow: visible; }
}
