/* Expo Upgrade Desk - one stylesheet, both themes, no external fonts. */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --ink: #e6edf3;
  --ink-dim: #9aa7b4;
  --line: #2a3441;
  --accent: #4c9aff;
  --accent-ink: #08131f;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --crit: #ff7b72;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
}

:root[data-theme="light"] {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel2: #f0f3f6;
  --ink: #1f2328;
  --ink-dim: #5b6570;
  --line: #d8dee4;
  --accent: #0969da;
  --accent-ink: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --crit: #a40e26;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

code, pre, .mono { font-family: var(--mono); }
.mono { font-size: 0.92em; }
.small { font-size: 0.85em; }
.muted { color: var(--ink-dim); }
.hidden { display: none !important; }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand .sep { color: var(--ink-dim); }
.backlink { text-decoration: none; }
.topactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.credits { font-family: var(--mono); font-size: 0.85em; color: var(--ink-dim); }
.topup {
  font-size: 0.85em;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

/* --- buttons -------------------------------------------------------------- */

button { font-family: inherit; font-size: 1em; cursor: pointer; }

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 11px;
}
.ghost:hover { background: var(--panel2); }

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-weight: 600;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }

.big {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
}
.big:hover { border-color: var(--accent); }

.mini {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85em;
}
.mini:hover { border-color: var(--accent); }

.linkish {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}

/* --- layout ---------------------------------------------------------------- */

main { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; }

.hero h1 { font-size: 1.9rem; line-height: 1.25; margin: 18px 0 10px; }
.lede { font-size: 1.05rem; color: var(--ink); max-width: 74ch; }
.herobtns { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0;
}
.card h2 { font-size: 1.15rem; margin: 0 0 10px; }
.card h3 { font-size: 1.05rem; margin: 0 0 10px; }
.count {
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 9px;
  margin-left: 6px;
}

.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.labelrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.labelrow label { font-weight: 600; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 1 1 240px; }

textarea, select, input[type="file"] {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.5;
}
select { font-family: var(--sans); font-size: 0.95rem; }
textarea { resize: vertical; }
textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.dropzone { border: 1px dashed transparent; border-radius: 10px; transition: border-color 0.15s, background 0.15s; }
.dropzone.dragging { border-color: var(--accent); background: rgba(76, 154, 255, 0.06); }
.droprow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.droprow input[type="file"] { width: auto; flex: 0 1 auto; font-size: 0.8rem; padding: 4px; }

.runrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }

.rungate {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  border-radius: 8px;
  background: rgba(210, 153, 34, 0.08);
  font-size: 0.92em;
}
.gateaction { font-weight: 600; cursor: pointer; }

/* --- prescan ---------------------------------------------------------------- */

.prescan {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel2);
  margin-bottom: 14px;
}
.prescan h2 { font-size: 1rem; }
.flaglist { list-style: none; padding: 0; margin: 8px 0 0; }
.flaglist li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 0.92em; }
.flaglist li:first-child { border-top: none; }
.flagid {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  margin-right: 6px;
  font-size: 0.82em;
  color: var(--ink-dim);
}

/* --- progress ----------------------------------------------------------------- */

.progresshead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.steps { list-style: none; padding: 0; margin: 12px 0 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: var(--ink-dim); }
.step-ic {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--line); flex: 0 0 auto;
}
.step.done { color: var(--ink); }
.step.done .step-ic { background: var(--ok); border-color: var(--ok); }
.step.live { color: var(--ink); }
.step.live .step-ic { border-color: var(--accent); background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* --- result ---------------------------------------------------------------------- */

.resulthead h2 { font-size: 1.35rem; }
.verdict {
  font-size: 1.03rem;
  border-left: 3px solid var(--line);
  padding-left: 12px;
  margin: 10px 0;
}
.verdict.posture-hardened { border-left-color: var(--ok); }
.verdict.posture-needs-hardening { border-left-color: var(--warn); }
.verdict.posture-exposed { border-left-color: var(--bad); }

.sdkstrip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}
.sdkbox { display: flex; flex-direction: column; min-width: 78px; }
.sdkbox strong { font-size: 1.25rem; }
.sdkarrow { color: var(--ink-dim); font-size: 1.3rem; }

.prose p { margin: 10px 0; }
.delta {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(76, 154, 255, 0.07);
  font-size: 0.92em;
}
.warnline {
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(210, 153, 34, 0.09);
}
.warnline ul { margin: 6px 0 0; padding-left: 18px; }
.warnline li { margin: 2px 0; word-break: break-word; }

/* --- settings patch table ---------------------------------------------------------- */

.patchwrap { margin: 10px 0; }

/* Full-file diff of a rewritten DAG against what the user pasted. Colour is a
   second signal only - each line keeps its own +/-/space prefix in the text, so
   the diff survives being copied and reads correctly without colour. */
#resDiff .diffadd { color: var(--ok); background: rgba(63, 185, 80, 0.12); display: block; }
#resDiff .diffdel { color: var(--bad); background: rgba(248, 81, 73, 0.12); display: block; }
#resDiff .diffsame { opacity: 0.72; display: block; }
.patch td { vertical-align: top; }
.patch td.mono { white-space: nowrap; }
.patch td:nth-child(3), .patch td:nth-child(4) {
  min-width: 180px;
  word-break: break-word;
  white-space: pre-wrap;
}
.patch td:nth-child(4) { color: var(--ok, var(--ink)); }

/* --- hops -------------------------------------------------------------------------- */

.hop { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: var(--panel2); }
.hop-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hop-badge {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 8px;
  font-weight: 600;
}
.hop-theme { font-weight: 600; }
.hop ul { margin: 8px 0 0; padding-left: 22px; }
.hop ul.watch { color: var(--ink-dim); }

/* --- findings ------------------------------------------------------------------------ */

.finding {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--panel2);
}
.finding.pri-critical { border-left-color: var(--crit); }
.finding.pri-high { border-left-color: var(--bad); }
.finding.pri-medium { border-left-color: var(--warn); }
.finding.pri-low { border-left-color: var(--line); }
.finding header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fid { font-weight: 700; }
.fres { color: var(--ink-dim); font-size: 0.88em; }
.ftags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tag {
  font-family: var(--mono);
  font-size: 0.74em;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.finding p { margin: 7px 0; }

.tag.ctl-present { color: var(--ok); border-color: var(--ok); }
.tag.ctl-weak { color: var(--warn); border-color: var(--warn); }
.tag.ctl-missing { color: var(--bad); border-color: var(--bad); }
.tag.ctl-unknown { color: var(--ink-dim); }
.snipwrap { position: relative; margin-top: 10px; }
.snipwrap .mini { position: absolute; top: 6px; right: 6px; }
pre.snippet, pre.bigpre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre;
  margin: 0;
}
pre.bigpre { max-height: 480px; overflow-y: auto; }

/* --- coverage ----------------------------------------------------------------------- */

.covlist { list-style: none; padding: 0; margin: 8px 0 0; }
.covlist li { padding: 5px 0; border-top: 1px solid var(--line); font-size: 0.9em; }
.covlist li:first-child { border-top: none; }
.covmark { display: inline-block; width: 20px; font-weight: 700; }
.covmark.yes { color: var(--ok); }
.covmark.no { color: var(--warn); }
.covmark.missed { color: var(--bad); }
.covnote { color: var(--ink-dim); }

/* --- inventory ------------------------------------------------------------------------ */

.tablewrap { overflow-x: auto; }
table.inv { width: 100%; border-collapse: collapse; font-size: 0.9em; min-width: 560px; }
table.inv th, table.inv td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.inv th { color: var(--ink-dim); font-weight: 600; font-size: 0.85em; }

.focus { padding: 7px 0; border-top: 1px solid var(--line); }
.focus:first-child { border-top: none; }

.exportrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* --- history ------------------------------------------------------------------------- */

.history { list-style: none; padding: 0; margin: 0 0 10px; }
.history li { border-top: 1px solid var(--line); }
.history li:first-child { border-top: none; }
.histbtn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  padding: 9px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.histbtn:hover { background: var(--panel2); }
.histtitle { font-weight: 600; }
.histmeta { color: var(--ink-dim); }
.histload { margin: 0 0 10px 4px; }

.explain p { max-width: 78ch; }

/* --- footer + toasts -------------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 20px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.9em;
}
.foot p { margin: 6px 0; max-width: 80ch; margin-left: auto; margin-right: auto; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(440px, calc(100vw - 32px)); }
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  font-size: 0.92em;
  transition: opacity 0.5s;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--bad); }
.toast.gone { opacity: 0; }
.toast a { margin-left: 8px; font-weight: 600; }

/* --- docs pages ---------------------------------------------------------------------- */

.doc { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-size: 1.2rem; margin-top: 30px; }
.doc h3 { font-size: 1rem; margin-top: 22px; }
.doc p, .doc li { max-width: 80ch; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin: 12px 0; }
.doc th, .doc td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--ink-dim); }
.doc code { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 0.88em; }
.doc pre code { background: none; border: none; padding: 0; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 0; }
.tab {
  background: var(--panel2);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 5px 12px;
  font-size: 0.85em;
}
.tab.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.codegroup pre { border-radius: 0 8px 8px 8px; margin-top: 0; }
.codegroup pre[hidden] { display: none; }

.tokenrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.tokenbox {
  flex: 1 1 320px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
  min-height: 44px;
}
.statebox { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel2); margin: 12px 0; }

@media (max-width: 620px) {
  .hero h1 { font-size: 1.5rem; }
  .ftags { margin-left: 0; }
  main, .doc { padding: 16px 14px 48px; }
}

@media print {
  .topbar, .toasts, .exportrow, form, .prescan, #progressPanel, #historyZone, .herobtns, .foot { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; break-inside: avoid; }
}

/* --- Py Shift additions ---------------------------------------------------------
 *
 * The shared shell above is unchanged; these are the classes this app's markup
 * introduces on top of it: the posture verdict, the check-status and step
 * badges, the prescan resource list and the per-flag reconciliation states. */

.verdict.rd-modern { border-left-color: var(--ok); }
.verdict.rd-partial { border-left-color: var(--warn); }
.verdict.rd-legacy { border-left-color: var(--bad); }

.findhead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.findhead code { font-weight: 700; }
.findhead strong { font-size: 0.95em; }
.flabel { color: var(--ink-dim); font-weight: 600; }

.badge {
  font-family: var(--mono);
  font-size: 0.74em;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.badge.st-pass { color: var(--ok); border-color: var(--ok); }
.badge.st-fail { color: var(--bad); border-color: var(--bad); }
.badge.st-partial { color: var(--warn); border-color: var(--warn); }
.badge.st-unknown { color: var(--ink-dim); }
.badge.b-priority.v-critical { color: var(--crit); border-color: var(--crit); }
.badge.b-priority.v-high { color: var(--bad); border-color: var(--bad); }
.badge.b-priority.v-medium { color: var(--warn); border-color: var(--warn); }
.badge.b-risk.v-high, .badge.b-effort.v-high { color: var(--bad); border-color: var(--bad); }
.badge.b-risk.v-medium, .badge.b-effort.v-medium { color: var(--warn); border-color: var(--warn); }
.badge.b-phase { color: var(--accent); border-color: var(--line); }
.badge.diff-still-open { color: var(--warn); border-color: var(--warn); }
.badge.diff-new { color: var(--accent); border-color: var(--accent); }

.reslist { list-style: none; padding: 0; margin: 8px 0 0; }
.reslist li {
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 0.88em;
  color: var(--ink-dim);
}
.reslist li:first-child { border-top: none; }

.covlist li.cov-ok code { color: var(--ok); }
.covlist li.cov-aside code { color: var(--warn); }
.covlist li.cov-missed code { color: var(--bad); }
.covlist li.cov-missed { color: var(--ink); }

.focusitem { padding: 9px 0; border-top: 1px solid var(--line); }
.focusitem:first-child { border-top: none; }
.focusitem p { margin: 5px 0 0; color: var(--ink-dim); }
.focusitem code { font-size: 0.8em; color: var(--ink-dim); }

.history li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 2px;
}
.history li .mini { margin-left: auto; }

/* ---------------------------------------------------------------------------
 * Entry Desk
 *
 * Everything below is specific to this app: the lane switcher grouped by
 * pipeline stage, the register/schedule tables, the entry cards, the per-item
 * verdict badges and the two reconciliation panels. Both themes are driven off
 * the same custom properties declared at the top of this file, so nothing here
 * hardcodes a colour that would break in the other theme.
 * ------------------------------------------------------------------------ */

/* The lane switcher, grouped by stage. Past a flat row of tabs the grouping is
 * what keeps three lanes reading as one app rather than three tools. */
.tabstage {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stagename {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  min-width: 8.5em;
}
.lanehead { padding-top: 12px; padding-bottom: 12px; }
.lanehead h2 { margin-bottom: 4px; }

.disclaimer { margin-top: 12px; opacity: 0.85; }
.coafield summary { cursor: pointer; padding: 6px 0; }
.coafield textarea { width: 100%; margin-top: 8px; }

.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:first-of-type { border-top: none; padding-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.faq summary::marker { color: var(--ink-dim); }
.faq details p { margin: 8px 0 2px; color: var(--ink-dim); max-width: 74ch; }

.runrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.estimate { color: var(--ink-dim); font-size: 0.9rem; }
.estimate strong { color: var(--ink); }
.progress h2 { display: flex; gap: 10px; align-items: baseline; }

/* --- tables --------------------------------------------------------------- */

.grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  margin: 8px 0 4px;
}
.grid th, .grid td {
  border-bottom: 1px solid var(--line);
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
.grid th {
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.grid td.r, .grid th.r { text-align: right; }
.grid td.strong, .strong { font-weight: 600; }
.grid tr.totalrow td { border-top: 2px solid var(--line); border-bottom: none; }
.grid tr.thisperiod { background: rgba(76, 154, 255, 0.1); }
.grid tr.thisperiod td:first-child::after { content: " (this period)"; color: var(--ink-dim); font-size: 0.78rem; }
.num { font-family: var(--mono); white-space: nowrap; }
.num.neg { color: var(--bad); }

.roles { margin: 6px 0 10px; }
.roles summary { cursor: pointer; color: var(--ink-dim); font-size: 0.88rem; }

.sumline { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--panel2); }
.okline { color: var(--ok); }
.warn { color: var(--warn); }

/* --- schedules and entries ------------------------------------------------ */

.schedbox, .entrybox {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
  background: var(--panel2);
}
.schedhead, .entryhead { margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.memo { margin: 6px 0; }
.je {
  font-family: var(--mono);
  font-size: 0.84rem;
  white-space: pre-wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0 0;
  overflow-x: auto;
}
.raw {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  max-height: 26rem;
  overflow: auto;
}

/* --- findings, reasoning, checklists -------------------------------------- */

.block { margin: 12px 0; }
.plainlist { margin: 6px 0 0; padding-left: 18px; }
.plainlist li { margin: 3px 0; }

.findings, .reasonlist { list-style: none; padding: 0; margin: 8px 0 0; }
.findings > li, .reasonlist > li {
  border-left: 3px solid var(--line);
  padding: 8px 0 8px 12px;
  margin: 10px 0;
}
.findings > li.sev-critical { border-left-color: var(--crit); }
.findings > li.sev-high { border-left-color: var(--bad); }
.findings > li.sev-medium { border-left-color: var(--warn); }
.findings > li.sev-low { border-left-color: var(--ink-dim); }
.findhead, .reasonhead { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin: 0 0 4px; }
.findtitle { font-size: 0.98rem; }
.why { margin: 4px 0; color: var(--ink-dim); }
.fix { margin: 4px 0; }
.rowid {
  font-family: var(--mono);
  font-size: 0.76rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel2);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.checklist { list-style: none; padding: 0; margin: 0; font-size: 0.84rem; }
.checklist li { margin: 3px 0; }
.ck-pass strong { color: var(--ok); }
.ck-fail strong { color: var(--bad); }
.ck-na strong { color: var(--ink-dim); }
td.ck-pass { color: var(--ok); }
td.ck-fail { color: var(--bad); }
td.ck-na { color: var(--ink-dim); }
td.st-confirmed { color: var(--ok); }
td.st-noted { color: var(--ink-dim); }
td.st-set-aside { color: var(--warn); }
td.st-superseded { color: var(--accent); }
td.st-missing { color: var(--bad); font-weight: 600; }

/* --- badges --------------------------------------------------------------- */

.badge.b-sev, .badge.b-verdict, .badge.b-type, .badge.b-lane,
.badge.b-period, .badge.b-rev, .badge.b-warn {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.v-critical { color: var(--crit); border-color: var(--crit); }
.badge.v-high { color: var(--bad); border-color: var(--bad); }
.badge.v-medium { color: var(--warn); border-color: var(--warn); }
.badge.v-low { color: var(--ink-dim); }
.badge.vd-book { color: var(--ok); border-color: var(--ok); }
.badge.vd-defer { color: var(--warn); border-color: var(--warn); }
.badge.vd-reject { color: var(--bad); border-color: var(--bad); }
.badge.vd-query { color: var(--accent); border-color: var(--accent); }
.badge.b-lane { color: var(--accent); border-color: var(--accent); }
.badge.b-period, .badge.b-rev { color: var(--ink-dim); }
.badge.b-warn { color: var(--warn); border-color: var(--warn); }
.badge.b-type { text-transform: none; letter-spacing: 0; color: var(--ink-dim); }
.badge.t-unknown { color: var(--warn); border-color: var(--warn); }
.tally { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }

/* --- result shell --------------------------------------------------------- */

.result .reshead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.verdict.posture-ready-to-review { border-left-color: var(--ok); }
.verdict.posture-queries-outstanding { border-left-color: var(--warn); }
.verdict.posture-blocked { border-left-color: var(--bad); }
.tag.ps-ready-to-review { color: var(--ok); border-color: var(--ok); }
.tag.ps-queries-outstanding { color: var(--warn); border-color: var(--warn); }
.tag.ps-blocked { color: var(--bad); border-color: var(--bad); }

.handoff {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(76, 154, 255, 0.06);
}
.handoff p { margin: 0 0 8px; }

.histhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.histactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 640px) {
  .stagename { min-width: 0; width: 100%; }
  .grid { font-size: 0.82rem; }
}

/* The api.html language tabs. A code group's tabs sit tight above its <pre>, and
 * api-docs.js switches every group on the page at once so scrolling never lands
 * you in a different language than you chose. */
.codetabs {
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.codetabs .tab { font-size: 0.8rem; padding: 3px 9px; }
.codegroup { margin: 10px 0 18px; }
.codegroup pre { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
.codegroup pre[hidden] { display: none; }
