/* Proofdesk design system */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --surface-3: #e9ecf1;
  --border: #e1e5eb;
  --border-strong: #c9cfd8;
  --text: #0d1524;
  --text-2: #475263;
  --text-3: #778294;
  --accent: #3446d4;
  --accent-ink: #2534a8;
  --accent-soft: #eceffd;
  --ok: #13773a;
  --ok-soft: #e6f4ea;
  --ok-line: #9fd2b0;
  --bad: #be2d26;
  --bad-soft: #fcebea;
  --bad-line: #f0aaa5;
  --warn: #9a5a05;
  --warn-soft: #fcf2df;
  --warn-line: #ebc786;
  --info: #22599e;
  --info-soft: #e7eff9;
  --violet: #5b3fb8;
  --violet-soft: #efeafb;
  --g1: #8a4b08;  --g1-soft: #fbf0e1;
  --g2: #a12a51;  --g2-soft: #fbe8ee;
  --g3: #1d5f8f;  --g3-soft: #e3f0f9;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 21, 36, .05);
  --shadow: 0 1px 2px rgba(13, 21, 36, .04), 0 4px 16px rgba(13, 21, 36, .06);
  --shadow-lg: 0 12px 48px rgba(13, 21, 36, .18);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
.ic { flex: none; vertical-align: -3px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 60px; padding: 0 24px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 16px; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 28px; height: 28px; }
.brand small { font-weight: 500; font-size: 12.5px; color: var(--text-3); letter-spacing: 0; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: none; cursor: pointer;
  padding: 7px 16px; border-radius: 7px; font-weight: 550; color: var(--text-2);
}
.tab:hover { color: var(--text); }
.tab[aria-selected='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab .step-no { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; background: var(--surface-3); color: var(--text-2); }
.tab[aria-selected='true'] .step-no { background: var(--accent); color: #fff; }
.top-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.mode-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.mode-pill.live .dot { background: #1fa45a; box-shadow: 0 0 0 3px rgba(31, 164, 90, .18); }
.mode-pill b { color: var(--text); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .tab:focus-visible, .scenario:focus-visible, .doc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Layout ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 28px 28px 64px; }
.view[hidden] { display: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.view-head h1 { font-size: 24px; font-weight: 680; letter-spacing: -0.025em; }
.view-head p { color: var(--text-2); margin-top: 6px; max-width: 760px; font-size: 14.5px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-body { padding: 18px; }
.section-title { font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }

/* ---------- Endpoint tags ---------- */
.ep {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.ep-g1 { background: var(--g1-soft); color: var(--g1); }
.ep-g2 { background: var(--g2-soft); color: var(--g2); }
.ep-g3 { background: var(--g3-soft); color: var(--g3); }
.ep-g0 { background: var(--surface-2); color: var(--text-2); }
.ep-row { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- Chips and badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 550; white-space: nowrap; border: 1px solid transparent;
}
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-violet { background: var(--violet-soft); color: var(--violet); }
.chip-neutral { background: var(--surface-2); color: var(--text-2); }
.chip-outline { background: var(--surface); border-color: var(--border); color: var(--text-2); }

/* ---------- Meter ---------- */
.meter { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; vertical-align: middle; }
.meter > span { display: block; height: 100%; border-radius: 3px; }
.meter-ok > span { background: var(--ok); }
.meter-bad > span { background: var(--bad); }
.meter-warn > span { background: #d18a16; }
.meter-accent > span { background: var(--accent); }
.meter-neutral > span { background: var(--text-3); }

/* ---------- Source check ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat .num { font-size: 26px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.stat .by { margin-top: 10px; }
.stat.tone-bad .num { color: var(--bad); }
.stat.tone-warn .num { color: var(--warn); }
.stat.tone-violet .num { color: var(--violet); }
.stat.tone-ok .num { color: var(--ok); }
.stat.pending .num { color: var(--text-3); }

.source-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 20px; align-items: start; }
.doc-list { overflow: hidden; }
.doc-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; padding: 13px 18px; border: 0; border-bottom: 1px solid var(--border); background: none;
  text-align: left; cursor: pointer;
}
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: #fafbfc; }
.doc-row[aria-current='true'] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.doc-row .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .s { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.doc-row .flags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 260px; }
.doc-row .state { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.state-ok { background: var(--ok-soft); color: var(--ok); }
.state-bad { background: var(--bad-soft); color: var(--bad); }
.state-warn { background: var(--warn-soft); color: var(--warn); }
.state-pending { background: var(--surface-2); color: var(--text-3); }
.state-running { background: var(--accent-soft); color: var(--accent); }
.doc-row.excluded .t { color: var(--text-2); }

.viewer { position: sticky; top: 80px; }
.viewer .card-head { align-items: flex-start; }
.viewer-title { font-size: 16px; font-weight: 650; }
.viewer-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.viewer-meta b { color: var(--text); font-weight: 600; }
.ledger { border-bottom: 1px solid var(--border); }
.ledger-item { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; padding: 11px 18px; border-top: 1px solid var(--border); font-size: 13.5px; }
.ledger-item:first-child { border-top: 0; }
.ledger-item .what { color: var(--text); }
.ledger-item .then { color: var(--text-2); margin-top: 2px; }
.ledger-item .then b { color: var(--text); font-weight: 600; }
.doc-text {
  padding: 18px 20px 22px; max-height: 520px; overflow: auto;
  white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; line-height: 1.65; color: var(--text);
}
.md-h1 { font-size: 17px; font-weight: 680; letter-spacing: -0.02em; }
.md-h2 { font-weight: 650; }
.md-hash, .md-fence { color: var(--text-3); }
.md-hash { font-weight: 400; }
.md-fence { font-family: var(--mono); font-size: 11.5px; }
.md-bullet { color: var(--text-3); }
.md-code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); }
.m-meta { background: var(--accent-soft); box-shadow: inset 0 -2px 0 #a8b2f0; border-radius: 2px; }
.m-pii { background: var(--violet-soft); color: var(--violet); text-decoration: line-through; text-decoration-color: rgba(91, 63, 184, .6); border-radius: 2px; }
.m-inj { background: var(--bad-soft); box-shadow: inset 0 -2px 0 var(--bad-line); border-radius: 2px; }
.m-script-bad { background: #f9d6d3 !important; color: #7a1712; }
.m-script-ok { background: var(--ok-soft) !important; }
.m-conflict { background: var(--warn-soft); box-shadow: inset 0 -2px 0 var(--warn-line); border-radius: 2px; }
.m-evidence { background: #fff0b8; box-shadow: inset 0 -2px 0 #e7c34a; border-radius: 2px; }
.m-key { background: var(--accent-soft); box-shadow: inset 0 -2px 0 #a8b2f0; border-radius: 2px; }
.tagmark {
  display: inline-block; margin: 0 2px 0 4px; padding: 0 5px; border-radius: 4px; vertical-align: 1px;
  font-family: var(--font); font-size: 10.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; line-height: 16px;
  text-decoration: none;
}
.tagmark.pii { background: var(--violet); color: #fff; }
.tagmark.inj { background: var(--bad); color: #fff; }
.tagmark.script { background: var(--bad); color: #fff; }
.tagmark.meta { background: var(--accent); color: #fff; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-2); background: #fbfbfc; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .l-meta::before { background: #c9d0f7; }
.legend .l-pii::before { background: #d9cff4; }
.legend .l-inj::before { background: var(--bad-line); }
.legend .l-conflict::before { background: var(--warn-line); }

.conflicts { margin-top: 20px; }
.conflict { border-top: 1px solid var(--border); }
.conflict:first-of-type { border-top: 0; }
.conflict-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.conflict-head .pair { font-weight: 600; }
.conflict-head .res { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.finding { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 18px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.finding > div { padding: 10px 12px; font-size: 13px; }
.finding > div + div { border-left: 1px solid var(--border); }
.finding .who { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .04em; }
.finding .old { background: #fdfaf3; }
.finding .old q { text-decoration: line-through; text-decoration-color: rgba(154, 90, 5, .5); }
.finding q { quotes: none; }
.more-findings { padding: 0 18px 14px; font-size: 12.5px; color: var(--text-3); }

/* ---------- Answer check ---------- */
.answer-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }
.persona { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.select, .input, .textarea {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 9px;
  padding: 8px 10px; font-size: 14px; outline: none;
}
.select:focus, .input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 70, 212, .14); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
.scenarios { display: flex; flex-direction: column; gap: 6px; }
.scenario {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s;
}
.scenario:hover { border-color: var(--border-strong); background: #fafbfc; }
.scenario[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.scenario .n { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scenario .h { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.toggle { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.toggle input { margin-top: 3px; accent-color: var(--accent); }
.toggle b { color: var(--text); font-weight: 600; }

.empty { padding: 56px 32px; text-align: center; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }

.question-card { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); flex: none; }
.q-text { font-size: 15.5px; font-weight: 550; line-height: 1.45; }
.q-sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.masked-q { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.masked-q .tok { display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--violet-soft); color: var(--violet); font-weight: 600; font-size: 12px; }

/* pipeline stepper */
.stepper { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin: 16px 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.stp { position: relative; padding: 12px 14px 12px; border-left: 1px solid var(--border); min-width: 0; }
.stp:first-child { border-left: 0; }
.stp .top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stp .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stp .sum { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.35; min-height: 32px; }
.stp .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.stp.running .bar { background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 200% 100%; animation: slide 1.1s linear infinite; }
.stp.done .bar { background: var(--ok); }
.stp.error .bar { background: var(--bad); }
.stp.blocked .bar { background: var(--bad); }
.stp.skipped { background: #fbfbfc; }
.stp.skipped .name, .stp.pending .name { color: var(--text-3); }
.stp .st { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; }
@keyframes slide { from { background-position: 200% 0; } to { background-position: 0 0; } }

.compare-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.compare-grid.single { grid-template-columns: minmax(0, 1fr); }
.answer-card .card-head { padding: 12px 18px; }
.answer-card h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.route { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.route .badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; font-weight: 650; font-size: 14px; }
.route .badge.ok { background: var(--ok-soft); color: var(--ok); }
.route .badge.warn { background: var(--warn-soft); color: var(--warn); }
.route .badge.info { background: var(--info-soft); color: var(--info); }
.route .badge.bad { background: var(--bad-soft); color: var(--bad); }
.route .why { font-size: 13px; color: var(--text-2); }
.answer-body { padding: 16px 18px; font-size: 15px; line-height: 1.6; }
.claim { border-radius: 3px; }
.claim.supported { background: linear-gradient(transparent 62%, #d5eedc 62%); }
.claim.contradicted { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(190, 45, 38, .55); }
.claim.not_stated { background: linear-gradient(transparent 62%, #f6e2b8 62%); }
.cite {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 3px;
  border-radius: 5px; border: 0; cursor: pointer; vertical-align: 2px;
  font-size: 11px; font-weight: 650; font-family: var(--font);
}
.cite.supported { background: var(--ok); color: #fff; }
.cite.contradicted { background: var(--bad); color: #fff; }
.cite.not_stated { background: #c98a1b; color: #fff; }
.cite:hover { filter: brightness(.92); }
.notes { padding: 0 18px 14px; display: flex; flex-direction: column; gap: 8px; }
.note { display: flex; gap: 10px; padding: 10px 12px; border-radius: 9px; font-size: 13px; line-height: 1.45; }
.note .ic { margin-top: 2px; }
.note.bad { background: var(--bad-soft); color: #7d1d18; }
.note.warn { background: var(--warn-soft); color: #6b3f04; }
.note.info { background: var(--info-soft); color: #173f72; }
.note.ok { background: var(--ok-soft); color: #0c4f26; }
.note q { quotes: '\201C' '\201D'; font-style: normal; }
.keyrule { margin: 0 18px 16px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 9px 9px 0; font-size: 13.5px; }
.keyrule .k { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 4px; }
.facts { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 16px; }
.sources { border-top: 1px solid var(--border); padding: 14px 18px; }
.src { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; border-top: 1px dashed var(--border); }
.src:first-of-type { border-top: 0; }
.src .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src .nm button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font-weight: 550; }
.src .nm button:hover { color: var(--accent); text-decoration: underline; }
.src .kw { font-size: 11.5px; color: var(--text-3); margin-left: 6px; }
.src .right { display: flex; gap: 8px; align-items: center; }
.baseline-card { background: #fcfcfd; }
.baseline-card .answer-body { color: var(--text); }
.baseline-src { font-size: 12.5px; }
.danger-list { display: flex; flex-direction: column; gap: 6px; padding: 0 18px 16px; }

.ledger-card { margin-top: 16px; }
.lg { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; padding: 13px 18px; border-top: 1px solid var(--border); align-items: start; }
.lg:first-of-type { border-top: 0; }
.lg .l { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.lg .l b { font-size: 13px; font-weight: 600; }
.lg .r { font-size: 13.5px; }
.lg .r .imp { color: var(--text); }
.lg .r .sm { color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.lg .x { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lg.lane-baseline { background: #fcfcfd; }
.lg details { margin-top: 8px; }
.lg summary { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 550; list-style: none; }
.lg summary::-webkit-details-marker { display: none; }
.json { margin: 8px 0 0; padding: 12px 14px; max-height: 340px; overflow: auto; background: #0f1624; color: #d7deea; border-radius: 9px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; white-space: pre; }
.rr-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.rr-table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.rr-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rr-table tr:last-child td { border-bottom: 0; }
.rr-table .t { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-table .num { font-variant-numeric: tabular-nums; color: var(--text-2); }

.inline-error { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; background: var(--warn-soft); color: #6b3f04; font-size: 13.5px; margin: 16px 0; }
.inline-error.bad { background: var(--bad-soft); color: #7d1d18; }
.inline-error .btn { margin-left: auto; }

.paste-box { margin-top: 4px; }
.paste-box summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
.paste-box[open] summary { margin-bottom: 10px; }

/* ---------- Drawer and dialog ---------- */
.scrim { position: fixed; inset: 0; background: rgba(13, 21, 36, .32); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .18s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); z-index: 70;
  background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(102%); transition: transform .22s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { font-size: 16px; }
.drawer-body { overflow: auto; flex: 1; }
.drawer .doc-text { max-height: none; }
dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
dialog.modal::backdrop { background: rgba(13, 21, 36, .4); }
.modal-body { padding: 24px; }
.modal-body h3 { font-size: 18px; margin-bottom: 6px; }
.modal-body p { color: var(--text-2); font-size: 13.5px; }
.modal-body .input { margin-top: 16px; font-family: var(--mono); font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--border); }
.fineprint { font-size: 12.5px; color: var(--text-3); margin-top: 12px; line-height: 1.5; }

.footer { max-width: 1440px; margin: 0 auto; padding: 0 28px 40px; color: var(--text-3); font-size: 12.5px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.spin { width: 14px; height: 14px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.fade-in { animation: fadein .28s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .source-grid { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .compare-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .topbar { grid-template-columns: 1fr auto; height: auto; padding: 10px 16px; row-gap: 10px; }
  .topbar .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .tab { flex: 1; justify-content: center; }
  .brand small { display: none; }
  .answer-grid { grid-template-columns: 1fr; }
  .side { position: static; }
  .stepper { grid-template-columns: repeat(3, 1fr); }
  .stp:nth-child(4) { border-left: 0; }
  .stp:nth-child(n+4) { border-top: 1px solid var(--border); }
  .lg { grid-template-columns: 1fr; gap: 8px; }
  .lg .x { flex-direction: row; align-items: center; }
}
@media (max-width: 600px) {
  .page { padding: 18px 16px 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .view-head { flex-direction: column; align-items: flex-start; }
  .mode-pill .long { display: none; }
  .finding { grid-template-columns: 1fr; }
  .finding > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .doc-row { grid-template-columns: 22px minmax(0, 1fr); }
  .doc-row .flags { grid-column: 2; justify-content: flex-start; }
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .stp { border-left: 0 !important; border-top: 1px solid var(--border); }
  .stp:nth-child(-n+2) { border-top: 0; }
  .stp:nth-child(even) { border-left: 1px solid var(--border) !important; }
  .footer { padding: 0 16px 32px; }
}

/* hand-off and held drafts */
.handoff { margin: 14px 18px 4px; padding: 12px 14px; border-radius: 10px; background: var(--info-soft); color: #173f72; font-size: 14px; line-height: 1.5; }
.handoff .k, .held summary { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.handoff .k { color: var(--info); margin-bottom: 4px; }
.held { margin: 12px 18px 0; border: 1px dashed var(--border-strong); border-radius: 10px; }
.held summary { display: flex; align-items: center; gap: 6px; padding: 10px 12px; cursor: pointer; color: var(--text-2); list-style: none; }
.held summary::-webkit-details-marker { display: none; }
.held[open] summary .ic { transform: rotate(90deg); }
.held .answer-body { padding-top: 4px; }
.held .notes, .held .facts { padding-left: 12px; padding-right: 12px; }
.held .keyrule { margin-left: 12px; margin-right: 12px; }
.held + .sources { margin-top: 14px; }
.script-pre { margin: 8px 0 0; padding: 10px 12px; background: #fff; border: 1px solid var(--bad-line); border-radius: 8px; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--text); }

/* ---------- Review round 1 refinements ---------- */
.view-bar { display: flex; align-items: center; gap: 12px; margin: -4px 0 16px; flex-wrap: wrap; }
.view-bar h1 { font-size: 19px; font-weight: 680; letter-spacing: -0.02em; white-space: nowrap; }
.view-bar p { flex: 1 1 420px; color: var(--text-2); font-size: 13.5px; line-height: 1.45; min-width: 0; }
.view-bar .btn { margin-left: auto; }
.cp-tag { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; flex: none; }
.page { padding-top: 20px; }

.stat { padding: 12px 14px; display: flex; flex-direction: column; min-height: 104px; }
.stat .num { font-size: 24px; }
.stat .lbl { font-size: 12.5px; line-height: 1.35; }
.stat .by { margin-top: auto; padding-top: 8px; }
button.stat { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
button.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
button.stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Extract annotations: light, so they do not compete with the primary button */
.m-meta { background: #f1f3fe; box-shadow: inset 0 -1.5px 0 #b9c1f3; }
.tagmark.meta { background: transparent; color: var(--accent-ink); border: 1px solid #c9cff5; font-size: 9.5px; line-height: 14px; padding: 0 4px; }
.tagmark { font-size: 9.5px; line-height: 15px; }

/* Ledger evidence inside the source viewer */
.ev { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ev-quote { padding: 7px 10px; border-radius: 7px; background: var(--surface-2); font-size: 12.5px; color: var(--text); line-height: 1.45; }
.ev-quote.bad { background: var(--bad-soft); color: #7d1d18; }
.ev-quote.code { font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
.ev-pair { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: 12.5px; }
.ev-pair > div { padding: 7px 10px; line-height: 1.45; }
.ev-pair > div + div { border-left: 1px solid var(--border); }
.ev-pair .who { display: block; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; }
.ev-pair .old { background: #fdfaf3; }
.ev-pair .old q { text-decoration: line-through; text-decoration-color: rgba(154, 90, 5, .45); }
.ev-pii { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-pii span { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border-radius: 6px; background: var(--violet-soft); color: var(--violet); font-size: 12px; }
.ev-pii s { color: var(--text-2); }
.ev-more { font-size: 12px; color: var(--text-3); }

/* Pipeline steps coloured by what they did, not by "the call succeeded" */
.stp.done .bar { background: var(--border-strong); }
.stp.done .st.state-ok { background: var(--surface-2); color: var(--text-3); }
.stp.tone-act { background: #f5f6fe; }
.stp.tone-act .bar { background: var(--accent); }
.stp.tone-act .st { background: var(--accent); color: #fff; }
.stp.tone-act .sum { color: var(--accent-ink); font-weight: 550; }
.stp.tone-warn { background: #fffaf0; }
.stp.tone-warn .bar { background: #d18a16; }
.stp.tone-warn .st { background: #d18a16; color: #fff; }
.stp.tone-warn .sum { color: var(--warn); font-weight: 550; }
.stp.tone-bad { background: #fff6f5; }
.stp.tone-bad .bar, .stp.blocked .bar { background: var(--bad); }
.stp.tone-bad .st { background: var(--bad); color: #fff; }
.stp.tone-bad .sum { color: var(--bad); font-weight: 550; }
.stp.pop { animation: pop .45s ease both; }
@keyframes pop { 0% { box-shadow: inset 0 0 0 2px transparent; } 40% { box-shadow: inset 0 0 0 2px rgba(52, 70, 212, .35); } 100% { box-shadow: inset 0 0 0 2px transparent; } }

/* Unchecked desk: never green, visibly the unsafe baseline */
.baseline-card { background: #fffcfb; border-color: #f1d9d6; }
.baseline-card .card-head h3 .ic { color: var(--bad); }
.claim.neutral { background: none; }
.cite.neutral { background: var(--surface-3); color: var(--text-2); }

/* Passages list: the used ones first, the rest behind a toggle */
.src-more { margin-top: 6px; }
.src-more summary { cursor: pointer; font-size: 12.5px; color: var(--text-2); font-weight: 550; padding: 6px 0; list-style: none; }
.src-more summary::-webkit-details-marker { display: none; }
.lg details.rr summary { color: var(--text-2); }

/* Mobile overflow guards */
.answer-grid > *, .source-grid > *, .side, .side > *, .compare-grid > * { min-width: 0; }
.scenario .n { flex-wrap: wrap; }
@media (max-width: 920px) {
  .view-bar .btn { margin-left: 0; }
}
.baseline-card .claim.contradicted, .check-card .claim.contradicted { text-decoration: underline wavy rgba(190, 45, 38, .55); text-underline-offset: 4px; color: var(--text); background: var(--bad-soft); }
.stepper { grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); }
@media (max-width: 920px) { .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mode-pill { display: none; } .topbar { padding: 10px 12px; } .top-right .btn { padding: 0 10px; } .brand { font-size: 15px; } }
@media (max-width: 600px) { .btn .long { display: none; } }

/* Endpoint tags: neutral pill with a group-coloured dot (less colour noise) */
.ep { gap: 6px; padding: 0 7px 0 6px; background: #f4f5f8; color: #343c4c; border: 1px solid #e4e7ec; font-weight: 600; }
.ep::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, #94a3b8); flex: none; }
.ep-g1 { --dot: #d98a0b; background: #f4f5f8; color: #343c4c; }
.ep-g2 { --dot: #d6336c; background: #f4f5f8; color: #343c4c; }
.ep-g3 { --dot: #1c7ed6; background: #f4f5f8; color: #343c4c; }
.ep-g0 { --dot: #94a3b8; }

/* Icons in tiles and scenarios */
.stat { position: relative; }
.stat-ic { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.stat.tone-violet .stat-ic { background: var(--violet-soft); color: var(--violet); }
.stat.tone-bad .stat-ic { background: var(--bad-soft); color: var(--bad); }
.stat.tone-warn .stat-ic { background: var(--warn-soft); color: var(--warn); }
.stat.tone-ok .stat-ic { background: var(--ok-soft); color: var(--ok); }
.stat .lbl { padding-right: 34px; }
.scenario { display: flex; gap: 11px; align-items: flex-start; }
.sc-ic { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); margin-top: 1px; }
.scenario[aria-pressed="true"] .sc-ic { background: var(--accent); color: #fff; }
.sc-body { flex: 1; min-width: 0; display: block; }
.route .badge .ic { width: 16px; height: 16px; }
.answer-card h3 .ic { color: var(--text-2); }

/* Round 2 refinements */
.index-note { display: flex; gap: 9px; align-items: flex-start; margin: 12px 0 0; padding: 9px 14px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--border-strong); font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.index-note .ic { color: var(--ok); margin-top: 1px; }
.index-note b { color: var(--text); font-weight: 600; }
.src .nm { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.src .nm button { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.src .kw { flex: none; margin-left: 0; }
.src .right { flex: none; }
.scenario { padding: 8px 10px; }
.scenario .h { line-height: 1.32; font-size: 12px; }
.scenarios { gap: 5px; }
.sc-ic { width: 28px; height: 28px; }

/* Logo lockup: the mark is the P of "Proofdesk" */
.lockup { display: inline-flex; align-items: flex-end; font-weight: 650; letter-spacing: -0.03em; line-height: 1; color: inherit; }
.lockup img { display: block; width: var(--m, 28px); height: var(--m, 28px); margin-right: calc(var(--m, 28px) * .04); flex: none; }
.lockup .lk-word { font-size: calc(var(--m, 28px) * .86); padding-bottom: calc(var(--m, 28px) * .115); }
.brand { gap: 0; }
.brand small { margin-left: 14px; }
.answer-card h3 .lockup { font-size: inherit; }
