/* ── Inter, self-hosted (OFL). Variable weight axis 100–900. ───────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ── GitHub Light High Contrast palette ─────────────────────────────────────
 * Foreground/accent values from the github-light-high-contrast Pygments style
 * (all WCAG-AA or better against #ffffff); surface and border values from the
 * matching Primer light_high_contrast theme.
 */
:root {
  --bg: #ffffff;
  --panel: #f0f3f6;
  --panel-2: #ffffff;
  --line: #20252c;        /* border.default — deliberately strong */
  --line-muted: #88929d;  /* border.muted */
  --text: #0e1116;        /* 18.91:1 */
  --muted: #66707b;       /* 5.04:1 */
  --subtle: #66707b;

  --accent: #0349b4;
  --accent-ink: #023b95;  /* 10.18:1 */
  --accent-soft: #dff7ff;

  --ok: #024c1a;          /* 10.24:1 */
  --ok-strong: #055d20;
  --ok-soft: #d2fedb;

  --warn: #4e2c00;
  --warn-ink: #702c00;    /* 10.25:1 */
  --warn-soft: #fcf7be;

  --bad: #a0111f;         /* 8.09:1 */
  --bad-ink: #6e011a;     /* 12.48:1 */
  --bad-soft: #fff0ee;

  --violet: #622cbc;      /* 8.06:1 */

  /* One code scale everywhere. LINE_HEIGHT/PAD_TOP in annotations.mjs must match. */
  --code-size: 11.5px;
  --code-lh: 18px;

  --ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'psudoFont Liga Mono', ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--ui);
  font-feature-settings: 'cv05' 1, 'ss03' 1, 'calt' 1; /* single-storey l, curved r */
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

:root { --topbar-h: 47px; }

::selection { background: var(--accent-soft); }

/* ── icons ─────────────────────────────────────────────────────────────── */

.icon {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  vertical-align: -0.16em;
  margin-right: 0.42em;
}
h2 .icon, h3 .icon { color: var(--muted); }

/* ── topbar ────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -0.015em; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok-strong);
  box-shadow: 0 0 0 3px rgb(5 93 32 / 0.18);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  font: 600 12px/1.35 var(--ui);
  padding: 4px 11px;
  border-radius: 2em;
  border: 1px solid var(--line-muted);
  background: var(--bg);
  color: var(--muted);
  white-space: nowrap;
}
.badge-test { color: var(--warn-ink); border-color: var(--warn-ink); background: var(--warn-soft); }
.badge-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge-bad { color: var(--bad-ink); border-color: var(--bad); background: var(--bad-soft); }

/* ── layout ────────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: minmax(400px, 1.05fr) minmax(360px, 0.95fr) minmax(460px, 1.3fr);
  align-items: stretch;
  min-height: calc(100vh - var(--topbar-h));
  background: var(--bg);
}

.col {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 13px 14px 26px;
  gap: 11px;
  border-right: 1px solid var(--line-muted);
}
.col:last-child { border-right: 0; }

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  background: var(--bg);
  padding: 9px 0;
  margin-top: -9px;
  border-bottom: 1px solid var(--line-muted);
}
.col-head h2 {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin: 0;
}
.col-head-sub { padding-top: 9px; border-top: 1px solid var(--line-muted); }
.col-head h3 {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  margin: 0;
}
.actions { display: flex; gap: 6px; }
.hint { color: var(--muted); font-weight: 400; font-size: 12.5px; }

/* ── controls ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 550 13px/1 var(--ui);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--panel); }
.btn:active:not(:disabled) { background: #e2e8ee; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { color: var(--muted); border-color: var(--line-muted); cursor: not-allowed; }
.btn:disabled .icon { opacity: 0.55; }
.btn-ghost { border-color: var(--line-muted); }
.btn-ghost:hover:not(:disabled) { border-color: var(--line); background: var(--panel); }
.btn-primary {
  background: var(--ok-strong);
  border-color: var(--ok);
  color: #fff;
  font-weight: 650;
}
.btn-primary:hover:not(:disabled) { background: var(--ok); }
.btn-primary:disabled { background: var(--panel); color: var(--muted); border-color: var(--line-muted); }
.btn-big { padding: 12px; width: 100%; font-size: 14px; flex: 0 0 auto; }

.toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }

.note-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--line-muted);
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--ui);
  flex: 0 0 auto;
}
.note-input::placeholder { color: var(--muted); }
.note-input:focus, textarea:focus, .qf input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(3 73 180 / 0.25);
}

/* ── quick fields ──────────────────────────────────────────────────────── */

.quick, .checklist {
  border: 1px solid var(--line-muted);
  border-radius: 6px;
  background: var(--bg);
  flex: 0 0 auto;
}
.quick > summary, .checklist > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  color: var(--text);
  background: var(--panel);
  border-radius: 5px 5px 0 0;
  border-bottom: 1px solid transparent;
}
.quick > summary > span, .checklist > summary > span { display: inline-flex; align-items: center; }
.quick[open] > summary, .checklist[open] > summary { border-bottom-color: var(--line-muted); }

.quick-body { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 10px; }
.qf { display: grid; grid-template-columns: 1fr; gap: 4px; }
.qf label { font: 500 12.5px/1.4 var(--ui); color: var(--text); }
.qf label .box {
  display: inline-block;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid rgb(3 73 180 / 0.25);
  padding: 0 5px;
  border-radius: 3px;
  font: 700 11.5px/1.5 var(--mono);
  margin-right: 4px;
}
.qf label .hint { font: 400 11.5px/1.4 var(--mono); color: var(--muted); }
.qf input {
  padding: 6px 9px;
  border-radius: 5px;
  border: 1px solid var(--line-muted);
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--mono);
  width: 100%;
}
.qf-missing input { border-color: var(--warn-ink); background: #fffdf0; }

/* ── editor ────────────────────────────────────────────────────────────── */

/* The textarea stays a plain textarea; highlight bands render behind it and a
   gutter of box markers sits to its left, both slaved to its scroll position. */
.editor-shell {
  flex: 0 0 auto;
  height: 68vh;
  min-height: 480px;
  position: relative;
  display: flex;
  border: 1px solid var(--line-muted);
  border-radius: 6px;
  background: var(--bg);
  overflow: hidden;
}
.editor-gutter {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 30px;
  background: var(--panel);
  border-right: 1px solid var(--line-muted);
  overflow: hidden;
  z-index: 2;
}
.editor-bands {
  position: absolute;
  left: 31px; right: 0; top: 0; bottom: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.band { position: absolute; left: 0; right: 0; }
.band-fixed { background: #d2fedb; }
.band-blocked { background: #fcf7be; }
.band-guard { background: #dff7ff; }

.mark {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 9px/1 var(--mono);
  cursor: help;
  border-left: 3px solid transparent;
}
.mark-fixed { color: var(--ok); border-left-color: var(--ok-strong); background: #d2fedb; }
.mark-blocked { color: var(--warn-ink); border-left-color: var(--warn-ink); background: #fcf7be; }
.mark-guard { color: var(--accent-ink); border-left-color: var(--accent); background: #dff7ff; }
.mark:hover { filter: brightness(0.94); }

textarea#editor {
  flex: 1 1 auto;
  position: relative;
  z-index: 1;
  resize: none;
  padding: 10px 13px 10px 39px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: var(--code-size)/var(--code-lh) var(--mono);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editor-legend { display: flex; flex-wrap: wrap; gap: 10px; flex: 0 0 auto; }
.lg { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.lg::before { content: ""; width: 11px; height: 11px; border-radius: 3px; border: 1px solid; }
.lg-fixed::before { background: #d2fedb; border-color: var(--ok); }
.lg-blocked::before { background: #fcf7be; border-color: var(--warn-ink); }
.lg-guard::before { background: #dff7ff; border-color: var(--accent); }

/* ── annotation tooltip ────────────────────────────────────────────────── */

.tip {
  position: fixed;
  z-index: 50;
  max-width: 340px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  box-shadow: 0 8px 24px rgb(31 35 40 / 0.18);
  pointer-events: none;
}
.tip-head { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.tip-box {
  font: 700 11px/1.4 var(--mono);
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid rgb(3 73 180 / 0.25);
  padding: 0 5px;
  border-radius: 3px;
}
.tip-kind { font: 700 9.5px/1.4 var(--ui); letter-spacing: 0.03em; padding: 1px 7px; border-radius: 2em; }
.tip-fixed { color: var(--ok); background: var(--ok-soft); }
.tip-blocked { color: var(--warn-ink); background: var(--warn-soft); }
.tip-guard { color: var(--accent-ink); background: var(--accent-soft); }
.tip-title { font-size: 12.5px; font-weight: 650; margin-bottom: 3px; }
.tip-why { font-size: 12px; line-height: 1.5; color: var(--muted); }

.statusline {
  display: flex;
  align-items: center;
  font: 500 12.5px/1.45 var(--ui);
  color: var(--muted);
  flex: 0 0 auto;
  min-height: 19px;
}
.statusline.ok { color: var(--ok); }
.statusline.bad { color: var(--bad-ink); }
.statusline.warn { color: var(--warn-ink); }

/* ── panels ────────────────────────────────────────────────────────────── */

.panel {
  border: 1px solid var(--line-muted);
  border-radius: 6px;
  background: var(--panel);
  padding: 10px 12px;
  font-size: 13px;
  flex: 0 0 auto;
}
.panel:empty { display: none; }
.panel.scroll { overflow: auto; }
.panel h4 {
  margin: 0 0 7px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.panel pre {
  margin: 0;
  font: var(--code-size)/var(--code-lh) var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--accent-ink);
}

.msg { display: flex; gap: 8px; padding: 4px 0; font-size: 13px; line-height: 1.5; }
.msg .icon { margin: 0.16em 0 0; }
.msg-bad { color: var(--bad-ink); }
.msg-bad .icon { color: var(--bad); }
.msg-warn { color: var(--warn-ink); }
.msg-warn .icon { color: var(--warn-ink); }
.msg-ok { color: var(--ok); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font: var(--code-size)/var(--code-lh) var(--mono); }
.kv dt { color: var(--muted); font-family: var(--ui); font-size: 11.5px; }
.kv dd { margin: 0; word-break: break-all; }

/* ── runs ──────────────────────────────────────────────────────────────── */

.runs {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
}
.run {
  border: 1px solid var(--line-muted);
  border-radius: 6px;
  background: var(--bg);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.run:hover { background: var(--panel); border-color: var(--line); }
.run.active { border-color: var(--accent); background: var(--accent-soft); }
.run-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-time { font: 500 11.5px/1.4 var(--mono); }
.run-note { font-size: 12.5px; color: var(--muted); }
.run-pill {
  display: inline-flex;
  align-items: center;
  font: 700 11px/1.4 var(--ui);
  padding: 2px 8px;
  border-radius: 2em;
  border: 1px solid transparent;
}
.run-pill .icon { width: 0.95em; height: 0.95em; margin-right: 0.3em; }
.run-pill.ok { color: var(--ok); background: var(--ok-soft); border-color: rgb(2 76 26 / 0.3); }
.run-pill.bad { color: var(--bad-ink); background: var(--bad-soft); border-color: rgb(160 17 31 / 0.3); }

/* ── pdf ───────────────────────────────────────────────────────────────── */

.pdf-wrap {
  flex: 0 0 auto;
  height: 88vh;
  min-height: 620px;
  border: 1px solid var(--line-muted);
  border-radius: 6px;
  background: #fff;
  position: relative;
  overflow: hidden;
}
#pdfFrame { width: 100%; height: 100%; border: 0; display: none; background: #fff; }
#pdfFrame.visible { display: block; }
.empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}
.empty p { margin: 0; }
.empty-icon .icon { width: 30px; height: 30px; margin: 0; color: var(--line-muted); }

/* ── checklist ─────────────────────────────────────────────────────────── */

.checklist ul { list-style: none; margin: 0; padding: 7px 9px 9px; display: flex; flex-direction: column; gap: 2px; }
.ck {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 9px;
  align-items: start;
  padding: 6px;
  border-radius: 5px;
}
.ck:hover { background: var(--panel); }
.ck input { margin: 3px 0 0; accent-color: var(--ok-strong); width: 15px; height: 15px; }
.ck-box {
  font: 700 11.5px/1.55 var(--mono);
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid rgb(3 73 180 / 0.25);
  padding: 0 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.ck-body { min-width: 0; }
.ck-label { font-size: 13px; font-weight: 600; }
.ck-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ck-act {
  display: inline-block;
  font: 700 10.5px/1.5 var(--ui);
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 2em;
  margin-left: 7px;
  vertical-align: 1px;
  border: 1px solid transparent;
}
.ck-act.fill { color: var(--warn-ink); background: var(--warn-soft); border-color: rgb(112 44 0 / 0.3); }
.ck-act.remove { color: var(--bad-ink); background: var(--bad-soft); border-color: rgb(160 17 31 / 0.3); }
.ck-act.keep, .ck-act.keep-blank { color: var(--ok); background: var(--ok-soft); border-color: rgb(2 76 26 / 0.3); }
.ck-act.verify { color: var(--accent-ink); background: var(--accent-soft); border-color: rgb(3 73 180 / 0.3); }
.ck.done .ck-label, .ck.done .ck-note {
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ── scrollbars ────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-muted);
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@media (max-width: 1280px) {
  .grid { grid-template-columns: 1fr; }
  .col { border-right: 0; border-bottom: 1px solid var(--line-muted); }
  .editor-shell { height: 60vh; }
  .pdf-wrap { height: 75vh; }
}

/* Spinner for in-flight actions. */
.icon.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .icon.spin { animation: none; } }

/* ── auto-verify rows ──────────────────────────────────────────────────── */

.vr { grid-template-columns: auto auto 1fr; }
.vr-mark { display: inline-flex; padding-top: 1px; }
.vr-mark .icon { margin: 0; width: 1.15em; height: 1.15em; }
.vr-pass .vr-mark { color: var(--ok); }
.vr-fail .vr-mark { color: var(--bad); }
.vr-blocked .vr-mark { color: var(--warn-ink); }
.vr .ck-note b { font-family: var(--mono); font-weight: 600; font-size: 11px; }
.vr-pass { opacity: 0.72; }
.vr-fail { background: var(--bad-soft); }
.vr-fail:hover { background: #ffe3e0; }

.ck-act.pass { color: var(--ok); background: var(--ok-soft); border-color: rgb(2 76 26 / 0.3); }
.ck-act.fail { color: var(--bad-ink); background: var(--bad-soft); border-color: rgb(160 17 31 / 0.3); }
.ck-act.blocked { color: var(--warn-ink); background: var(--warn-soft); border-color: rgb(112 44 0 / 0.3); }

/* ── login ─────────────────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--panel); padding: 24px; }
.login {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 8px 28px rgb(31 35 40 / 0.10);
}
.login-brand { display: flex; align-items: center; gap: 9px; }
.login-brand h1 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -0.015em; }
.login-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.login-label { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.logout-form { display: inline-flex; margin: 0; }

/* ── demo payload picker ───────────────────────────────────────────────── */

.sc-list { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 7px; }
.sc {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--line-muted);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.sc:hover:not(:disabled) { border-color: var(--line); background: var(--panel); }
.sc:disabled { opacity: 0.6; cursor: wait; }
.sc.active { border-color: var(--accent); background: var(--accent-soft); }
.sc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-title { font-size: 12.5px; font-weight: 650; }
.sc-summary { font-size: 12px; color: var(--muted); line-height: 1.45; }

.sc-expect {
  font: 700 9px/1.5 var(--ui);
  letter-spacing: 0.03em;
  padding: 1px 7px;
  border-radius: 2em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.sc-expect.accepted { color: var(--ok); background: var(--ok-soft); border-color: rgb(2 76 26 / 0.3); }
.sc-expect.rejected { color: var(--bad-ink); background: var(--bad-soft); border-color: rgb(160 17 31 / 0.3); }
.sc-expect\.accepted-but-wrong,
.sc-expect.accepted-but-wrong { color: var(--warn-ink); background: var(--warn-soft); border-color: rgb(112 44 0 / 0.3); }

.run-scenario { display: inline-block; align-self: flex-start; }

.sent { margin-top: 9px; border-top: 1px solid var(--line-muted); padding-top: 7px; }
.sent > summary { font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.sent > summary:hover { color: var(--text); }
.sent pre { margin-top: 7px; max-height: 260px; overflow: auto; font: var(--code-size)/var(--code-lh) var(--mono); }

/* ── submit row (now in column 1, under the editor) ────────────────────── */

.submit-row { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.submit-row .btn-big { width: auto; flex: 1 1 auto; }

/* ── run history as a full column ──────────────────────────────────────── */

.runs-full { gap: 7px; }
.run { padding: 0; overflow: hidden; }
.run-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 11px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.run-head:hover { background: var(--panel); }
.run.active > .run-head { background: var(--accent-soft); }
.run.active { border-color: var(--accent); }

.run-detail {
  border-top: 1px solid var(--line-muted);
  padding: 10px 11px 11px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.run-detail .kv { font-size: 12px; }
.run-detail .msg { font-size: 12px; }

.run-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 11px;
  color: var(--muted);
  font-size: 12.5px;
  border: 1px dashed var(--line-muted);
  border-radius: 6px;
}

/* Scenario cards stay legible when the picker is always open. */
.scenarios { max-height: none; }

/* Both grading panels are open by default, which would squeeze the form itself.
   Give the PDF a floor, cap the panels, and let the column scroll if it must. */
/* Column 1 pins to the viewport; run history and the form scroll past it. */
.grid > .col:first-child {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  padding-bottom: 13px;
}

/* Inside that pinned column the editor takes whatever height is left, so the
   payload gets the space and Submit sits at the bottom without needing sticky. */
.grid > .col:first-child .editor-shell {
  flex: 1 1 auto;
  height: auto;
  min-height: 160px;
}
.grid > .col:first-child .scenarios { max-height: 34vh; overflow: auto; }
.grid > .col:first-child .col-head { position: static; margin-top: 0; }

.submit-row {
  background: var(--bg);
  padding-top: 9px;
  border-top: 1px solid var(--line-muted);
}

/* ── read-only annotated JSON (the payload a run sent) ─────────────────── */

.ajson {
  margin-top: 7px;
  border: 1px solid var(--line-muted);
  border-radius: 5px;
  background: var(--bg);
  max-height: 340px;
  overflow: auto;
  font: var(--code-size)/var(--code-lh) var(--mono);
}
.ajson-line { display: flex; align-items: stretch; white-space: pre; }
.ajson-line code { padding-right: 11px; font: inherit; }
.ajson-mark {
  flex: 0 0 26px;
  text-align: center;
  font: 700 9px/var(--code-lh) var(--mono);
  color: var(--muted);
  background: var(--panel);
  border-right: 1px solid var(--line-muted);
  position: sticky;
  left: 0;
}
.ajson-fixed { background: #d2fedb; }
.ajson-fixed .ajson-mark { color: var(--ok); background: #b9f8c7; border-right-color: var(--ok-strong); }
.ajson-blocked { background: #fcf7be; }
.ajson-blocked .ajson-mark { color: var(--warn-ink); background: #f8f0a0; border-right-color: var(--warn-ink); }
.ajson-guard { background: #dff7ff; }
.ajson-guard .ajson-mark { color: var(--accent-ink); background: #c9efff; border-right-color: var(--accent); }

.legend-sm { margin-top: 6px; gap: 9px; }
.legend-sm .lg { font-size: 10.5px; }

/* ── what to expect from the run you're looking at ─────────────────────── */

.sc-banner {
  border: 1px solid var(--line-muted);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}
.sc-banner-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.sc-banner-why { font-size: 12px; line-height: 1.5; color: var(--muted); }
.sc-banner-accepted { border-left-color: var(--ok-strong); background: var(--ok-soft); }
.sc-banner-rejected { border-left-color: var(--bad); background: var(--bad-soft); }
.sc-banner-accepted-but-wrong { border-left-color: var(--warn-ink); background: var(--warn-soft); }

/* ── column 1: payload collapsed by default ────────────────────────────── */

.sep { border: 0; border-top: 1px solid var(--line-muted); margin: 3px 0 0; }

.payload-body > summary { display: flex; justify-content: space-between; align-items: center; }
.payload-body-inner { padding: 10px; display: flex; flex-direction: column; gap: 9px; }
/* Fixed height here: the editor is no longer the flex filler of the column. */
.grid > .col:first-child .payload-body .editor-shell {
  flex: 0 0 auto;
  height: 58vh;
  min-height: 300px;
}
/* All four scenario cards visible without a scrollbar. */
.grid > .col:first-child .scenarios { max-height: none; overflow: visible; }
/* Opening the payload can overflow the pinned column, so let it scroll. */
.grid > .col:first-child { overflow-y: auto; }

/* ── run history: score badges ─────────────────────────────────────────── */

.run-pills { display: inline-flex; align-items: center; gap: 6px; }
.run-score {
  font: 700 10px/1.4 var(--mono);
  padding: 2px 7px;
  border-radius: 2em;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line-muted);
  white-space: nowrap;
}
.run-score.best {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok);
}

/* ── open questions: the billing team's ask vs Stedi's output ───────────── */

.vr-open { background: var(--warn-soft); }
.vr-open:hover { background: #f9f1a8; }
.vr-open .vr-mark { color: var(--warn-ink); }
.ck-act.open { color: var(--warn-ink); background: #f8f0a0; border-color: rgb(112 44 0 / 0.35); }
.vr-side { display: block; }
.vr-side b { font-family: var(--ui); font-weight: 650; font-size: 11.5px; }
.vr-cite {
  display: block;
  margin-top: 3px;
  padding-left: 8px;
  border-left: 2px solid rgb(112 44 0 / 0.3);
  font-style: italic;
}

.vr-source {
  margin: 0;
  padding: 9px 11px 11px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  border-top: 1px solid var(--line-muted);
}
.vr-source a { color: var(--accent-ink); }
