﻿/* Tokens are copied from chat.css so the console and the chat read as one product. */

:root {
  --bg: #FAFAF8;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --hairline: #ECECE8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --text: #1F2430;
  --muted: #5B6472;
  --faint: #9AA4B2;
  --brand: #0F3D77;
  --brand-int: #1E5FB0;
  --brand-soft: #EAF1FB;
  --success: #2E9E5B;
  --success-soft: #E7F5ED;
  --danger: #C7433D;
  --danger-soft: #FBEAE9;
  --warning: #B5710E;
  --warning-soft: #FBF1E1;
  --radius-bubble: 16px;
  --radius-card: 12px;
  --radius-pill: 999px;
  --maxw: min(1240px, 94%);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 2rem;
  --motion: 180ms cubic-bezier(.2, .6, .2, 1);
  --motion-slow: 320ms cubic-bezier(.2, .6, .2, 1);
}

[data-theme="dark"] {
  --bg: #0E1116;
  --bg-elev: #161A20;
  --surface: #161A20;
  --hairline: #252A32;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --text: #E7EAF0;
  --muted: #9AA4B2;
  --faint: #6B7480;
  --brand: #3E7BD6;
  --brand-int: #5C95E8;
  --brand-soft: #16243B;
  --success: #4FB87A;
  --success-soft: #14241B;
  --danger: #E0665F;
  --danger-soft: #2A1615;
  --warning: #D69440;
  --warning-soft: #2A2013;
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0ms; --motion-slow: 0ms; }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { font-size: 100%; }
/* Some components set display on elements that also carry [hidden]; this keeps hidden winning. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ---------- topbar ---------- */
header.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Content-left of the app shell: the centered column's gutter plus the shell's 24px padding. */
  padding: 12px calc((100% - var(--maxw)) / 2 + 24px);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--brand), var(--brand-int));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: var(--fs-sm);
}
.brand-name { font-weight: 650; letter-spacing: -.01em; font-size: var(--fs-base); }
.brand-sub { color: var(--faint); font-size: var(--fs-xs); margin-left: 2px; }
.lens-nav { display: flex; align-items: center; gap: 18px; }
.lens-nav a {
  color: var(--muted); font-size: var(--fs-sm); font-weight: 600; text-decoration: none;
  padding: 4px 2px; border-bottom: 2px solid transparent; transition: color var(--motion), border-color var(--motion);
}
.lens-nav a:hover { color: var(--text); }
.lens-nav a.active { color: var(--brand-int); border-bottom-color: var(--brand-int); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.preview-chip {
  background: var(--brand); color: #fff; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .04em;
  padding: 4px 10px; border-radius: var(--radius-pill); text-transform: uppercase;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--muted);
  border: 1px solid var(--hairline); background: var(--surface); border-radius: var(--radius-pill);
  padding: 5px 12px 5px 6px;
}
.user-chip .dot {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--brand-int), var(--brand));
  color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.theme-toggle {
  border: 1px solid var(--hairline); background: var(--surface); color: var(--muted);
  width: 34px; height: 34px; border-radius: var(--radius-pill); cursor: pointer;
  display: grid; place-items: center; transition: background var(--motion), color var(--motion);
}
.theme-toggle:hover { color: var(--text); background: var(--brand-soft); }
.theme-toggle svg { width: 17px; height: 17px; }

/* ---------- gate ---------- */
.gate { max-width: var(--maxw); margin: 60px auto; text-align: center; color: var(--muted); }
.gate.error { color: var(--danger); font-weight: 550; }

/* ---------- app shell ---------- */
.app-shell {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  max-width: var(--maxw); margin: 0 auto; width: 100%; padding: 16px 24px 40px;
  min-width: 0;
}

/* ---------- KPI band ---------- */
.kpi-band {
  display: grid;
  /* 210px fits a money value and a two-word label; auto-fit wraps the band instead of truncating. */
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}
@media (max-width: 560px) { .kpi-band { grid-template-columns: 1fr 1fr; } }

.kpi-tile {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.kpi-tile .kpi-label {
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
  display: flex; align-items: center; gap: 6px;
  /* Reserve two label lines so every value in the row shares a baseline. */
  min-height: 2.2em; align-items: flex-start;
}
.kpi-tile .kpi-sub { line-height: 1.35; }
.kpi-tile .kpi-label .kpi-icn { width: 14px; height: 14px; display: inline-grid; place-items: center; }
.kpi-tile .kpi-value {
  font-size: 1.625rem; font-weight: 650; letter-spacing: -.02em; color: var(--text);
  /* Wrap, never ellipsize: a truncated figure cannot tell $20.00 from $20,000. */
  overflow-wrap: anywhere; min-width: 0;
}
.kpi-tile .kpi-sub { font-size: var(--fs-xs); color: var(--muted); }
.kpi-tile-alert { border-color: #fdba74; background: #fff8f3; }
.kpi-tile-alert .kpi-value, .kpi-tile-alert .kpi-label { color: #9a3412; }

/* ---------- controls ---------- */
.controls {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.filter-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  overflow-x: auto; padding-bottom: 2px;
}
.filter-input, .filter-select {
  border: 1px solid var(--hairline); background: var(--bg-elev); color: var(--text);
  font: inherit; font-size: var(--fs-sm); border-radius: var(--radius-pill); padding: 8px 14px;
  transition: border-color var(--motion);
}
.filter-input { flex: 1 1 180px; min-width: 140px; }
.filter-input:focus, .filter-select:focus { outline: none; border-color: var(--brand-int); }
.report-actions { display: flex; gap: 8px; justify-content: flex-end; }
.print-title { display: none; }
.nl-row { display: flex; gap: 8px; }
.nl-input {
  flex: 1; min-width: 0; border: 1px solid var(--hairline); background: var(--bg-elev); color: var(--text);
  font: inherit; font-size: var(--fs-sm); border-radius: var(--radius-pill); padding: 10px 16px;
  transition: border-color var(--motion);
}
.nl-input:focus { outline: none; border-color: var(--brand-int); }
.compiled {
  font-size: var(--fs-xs); color: var(--muted); background: var(--brand-soft);
  border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; gap: 7px;
}
.compiled .compiled-icn { color: var(--brand-int); width: 14px; height: 14px; flex: none; display: inline-grid; place-items: center; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand-int), var(--brand)); color: #fff; border: 0;
  border-radius: var(--radius-pill); padding: 9px 18px; font-size: var(--fs-sm); font-weight: 550; cursor: pointer;
  transition: filter var(--motion), transform var(--motion); white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--hairline);
  border-radius: var(--radius-pill); padding: 8px 16px; font-size: var(--fs-sm); font-weight: 550; cursor: pointer;
  transition: background var(--motion), color var(--motion); white-space: nowrap;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }

.ledger-verify {
  margin-left: auto; padding: 3px 11px; font-size: var(--fs-xs); flex: none;
}
.ledger-verify[disabled] { opacity: .6; cursor: default; }
.ledger-err { display: block; width: 100%; margin-top: 6px; color: var(--danger); font-size: var(--fs-xs); }

/* ---------- page head, toolbar, presets ---------- */
.page-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 2px;
}
.page-head h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.page-head .page-sub { font-size: var(--fs-xs); color: var(--faint); }
.page-head .page-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.toolbar { display: flex; flex-direction: column; gap: 9px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; }

.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.preset {
  font: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 5px 12px;
  border: 1px solid var(--hairline); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--muted); cursor: pointer;
  transition: background var(--motion), color var(--motion), border-color var(--motion);
}
.preset:hover { color: var(--text); }
.preset.on { background: var(--brand-int); border-color: var(--brand-int); color: #fff; }

details.more > summary {
  font-size: var(--fs-xs); font-weight: 600; color: var(--brand-int); cursor: pointer;
  list-style: none; width: max-content;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "＋ "; }
details.more[open] > summary::before { content: "－ "; }
details.more .filter-row { padding-top: 10px; }

/* ---------- panel: one container for everything that is not a list ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel > h2 {
  margin: 0; padding: 11px 16px; font-size: var(--fs-sm); letter-spacing: -.01em;
  border-bottom: 1px solid var(--hairline); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.panel > h2 .panel-hint { margin-left: auto; font-size: var(--fs-xs); font-weight: 500; color: var(--faint); }
.panel .panel-body { padding: 13px 16px; }
.panel .panel-body-tight { padding: 0; }
.chart-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; overflow: hidden; }
.ch-grid line { stroke: var(--hairline); stroke-width: 1; }
.ch-axis { fill: var(--faint); font-size: 10.5px; }
.ch-line { fill: none; stroke: var(--brand-int); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-area { fill: var(--brand-int); opacity: .10; }
.ch-bar { fill: var(--brand-int); }
.ch-dot { fill: var(--brand-int); stroke: var(--surface); stroke-width: 2; }
/* Invisible hit target, larger than the 4px dot it covers. */
.ch-hit { fill: transparent; cursor: pointer; }
.ch-bar { cursor: pointer; }
.ch-hit:focus-visible, .ch-bar:focus-visible { outline: 2px solid var(--brand-int); outline-offset: 1px; }

/* Fixed so a panel's overflow cannot clip it; pointer-events none so it never steals the hover. */
.ch-tip {
  position: fixed; z-index: 40; pointer-events: none;
  background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow);
  border-radius: 8px; padding: 7px 10px; font-size: var(--fs-xs); color: var(--text);
  white-space: nowrap;
}
.ch-tip b {
  display: block; font-size: 10.5px; font-weight: 650; color: var(--faint);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
}
.ch-label { fill: var(--text); font-size: 11px; font-weight: 650; }

/* ---------- the needs-you list ---------- */
.todo {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--hairline); flex-wrap: wrap;
}
.todo:last-child { border-bottom: 0; }
.todo-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.todo-warn { background: var(--warning); }
.todo-bad { background: var(--danger); }
.todo-ok { background: var(--success); }
.todo-text { flex: 1; min-width: 180px; font-size: var(--fs-sm); }
.todo-text small { display: block; color: var(--faint); font-size: var(--fs-xs); }
.todo .btn-ghost { text-decoration: none; }

.empty-good { padding: 20px 4px; text-align: center; color: var(--success); font-weight: 600; font-size: var(--fs-sm); }
.empty-note { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }

/* ---------- horizontal bar rows (where the time went, knowledge used) ---------- */
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(60px, 1fr) max-content;
  gap: 12px; align-items: center; font-size: var(--fs-sm); margin-bottom: 10px;
}
.panel-body > .bar-row { max-width: 100%; }
@media (min-width: 720px) {
  .bar-row { grid-template-columns: minmax(0, clamp(140px, 32%, 340px)) minmax(60px, 1fr) max-content; }
}
.bar-row:last-of-type { margin-bottom: 0; }
.bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--brand-int); }
.bar-value { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.assume {
  margin: 14px 0 0; padding-top: 11px; border-top: 1px dashed var(--hairline);
  font-size: var(--fs-xs); color: var(--muted); line-height: 1.55;
}

/* ---------- KPI tiles: the lead tile, and a target that reads as a verdict ---------- */
.kpi-tile-lead {
  background: linear-gradient(170deg, var(--brand-soft), var(--surface) 70%);
  border-color: color-mix(in srgb, var(--brand-int) 22%, var(--hairline));
}
.chip-ok {
  font-size: var(--fs-xs); font-weight: 650; color: var(--success); background: var(--success-soft);
  padding: 2px 8px; border-radius: var(--radius-pill);
}
.chip-off {
  font-size: var(--fs-xs); font-weight: 650; color: var(--warning); background: var(--warning-soft);
  padding: 2px 8px; border-radius: var(--radius-pill);
}
.chip-flat {
  font-size: var(--fs-xs); font-weight: 650; color: var(--muted); background: var(--surface-2, transparent);
  padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--hairline);
}

.trust-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; padding: 4px 16px 0;
}
.trust-cell {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-decoration: none;
  border: 1px solid var(--hairline); border-radius: var(--radius-card); background: var(--surface);
  color: var(--text);
}
.trust-cell:hover { border-color: color-mix(in srgb, var(--brand-int) 40%, var(--hairline)); }
.trust-value { font-size: var(--fs-xl, 1.5rem); font-weight: 650; line-height: 1.1; }
.trust-label { font-size: var(--fs-sm); font-weight: 550; }
.trust-sub { font-size: var(--fs-xs); color: var(--muted); }
.trust-ok .trust-value { color: var(--success); }
.trust-warn .trust-value { color: var(--warning); }
.trust-bad .trust-value { color: var(--danger); }

.gap-line {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px;
  padding: 9px 16px; border-bottom: 1px solid var(--hairline);
  text-decoration: none; color: var(--text);
}
@media (min-width: 720px) {
  .gap-line { grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 12px; align-items: baseline; }
}
.gap-line:last-of-type { border-bottom: 0; }
.gap-line:hover { background: var(--brand-soft); }
.gap-when {
  font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.gap-q { min-width: 0; font-size: var(--fs-sm); }
.gap-q, .gap-q small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-q small { display: block; color: var(--faint); font-size: var(--fs-xs); margin-top: 2px; }
.gap-who { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.gap-noword { color: var(--faint); font-style: italic; }


.def-line {
  display: flex; align-items: baseline; gap: 14px; padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
}
.def-line:last-child { border-bottom: 0; }
.def-line-main { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.def-line-main small { display: block; color: var(--faint); font-size: var(--fs-xs); margin-top: 2px; }
.def-line-num {
  flex: none; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- the definer (what a door counts) ---------- */
.def-intro { margin: 0 0 12px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; }
.def-row {
  border: 1px solid var(--hairline); border-radius: 10px; padding: 11px 12px; margin-bottom: 9px;
  background: var(--bg);
}
.def-retired { opacity: .5; }
.def-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.def-top .def-label { flex: 1 1 200px; min-width: 150px; }
.def-min, .def-target { width: 86px; }
.def-unit-label { font-size: var(--fs-xs); color: var(--muted); }
.def-rule { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.def-rule select { font-size: var(--fs-xs); padding: 5px 9px; }
.def-row input[type="text"], .def-row input[type="number"], .def-row select {
  border: 1px solid var(--hairline); background: var(--bg-elev); color: var(--text);
  font: inherit; font-size: var(--fs-sm); border-radius: 8px; padding: 6px 10px;
}
.def-note {
  margin-top: 16px; padding: 10px 12px; border-radius: 8px; font-size: var(--fs-xs); color: var(--muted);
  background: color-mix(in srgb, var(--text) 5%, transparent); line-height: 1.55;
}
.def-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.def-status { font-size: var(--fs-xs); color: var(--muted); }
.def-status.def-ok { color: var(--success); }
.def-status.def-err { color: var(--danger); }
.btn-tiny { padding: 4px 10px; font-size: var(--fs-xs); }

/* ---------- timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.timeline-meta { font-size: var(--fs-xs); color: var(--faint); padding: 0 2px 2px; }
.timeline-warn {
  font-size: var(--fs-xs); line-height: 1.45; margin: 0 2px 8px; padding: 8px 10px;
  border: 1px solid var(--warn, #B45309); background: var(--warn-soft, #FCF0E4);
  color: var(--ink, #1F2430); border-radius: 8px;
}
.timeline-empty {
  text-align: center; color: var(--muted); padding: 40px 20px; border: 1px dashed var(--hairline);
  border-radius: var(--radius-card); font-size: var(--fs-sm);
}
.timeline-scroll { overflow-x: auto; }

.trow {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: var(--shadow); cursor: pointer; min-width: 560px;
  transition: border-color var(--motion), transform var(--motion);
  animation: rise var(--motion-slow) both;
}
.trow:hover { border-color: var(--brand-int); transform: translateY(-1px); }
.trow:focus-visible { outline: 2px solid var(--brand-int); outline-offset: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tglyph {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--evt-color, var(--brand-int)) 14%, transparent);
  color: var(--evt-color, var(--brand-int));
}
.tglyph svg { width: 17px; height: 17px; }

.tmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tmain .ttitle { display: flex; align-items: baseline; gap: 8px; }
.tmain .tuser { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.tmain .tevent { font-size: var(--fs-xs); color: var(--faint); }
.tmain .tsummary {
  font-size: var(--fs-sm); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.tmeta { display: flex; align-items: center; gap: 10px; flex: none; }
.ttime { font-size: var(--fs-xs); color: var(--faint); white-space: nowrap; min-width: 80px; text-align: right; }
.tartifact {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600;
  color: var(--brand-int); background: var(--brand-soft); border-radius: var(--radius-pill); padding: 4px 10px;
  white-space: nowrap; text-decoration: none;
}
.tartifact svg { width: 11px; height: 11px; }
/* No recorded link: plain text, and it must not look clickable. */
span.tartifact, span.cchip-art { color: var(--muted); background: var(--surface-2, rgba(127,127,127,0.10)); cursor: default; }

.outcome {
  font-size: var(--fs-xs); font-weight: 600; border-radius: var(--radius-pill); padding: 4px 10px; white-space: nowrap;
}
.outcome.o-success { color: var(--success); background: var(--success-soft); }
.outcome.o-failure { color: var(--danger); background: var(--danger-soft); }
.outcome.o-pending { color: var(--warning); background: var(--warning-soft); }
.outcome.o-neutral { color: var(--muted); background: color-mix(in srgb, var(--text) 6%, transparent); }

.tcost { font-size: var(--fs-xs); color: var(--faint); min-width: 56px; text-align: right; white-space: nowrap; }

/* ---------- case list (the default view) ---------- */
.kpi-unit { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.crow-list { display: flex; flex-direction: column; gap: 10px; }
.crow {
  display: flex; align-items: center; gap: 16px; padding: 15px 18px; min-width: 560px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: var(--shadow); cursor: pointer;
  transition: border-color var(--motion), transform var(--motion);
  animation: rise var(--motion-slow) both;
}
.crow:hover { border-color: var(--brand-int); transform: translateY(-1px); }
.crow:focus-visible { outline: 2px solid var(--brand-int); outline-offset: 2px; }
.cr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cr-top { display: flex; align-items: baseline; gap: 10px; }
.cr-user { font-weight: 650; font-size: var(--fs-sm); color: var(--text); }
.cr-time { font-size: var(--fs-xs); color: var(--faint); margin-left: auto; white-space: nowrap; }
.cr-title {
  font-size: var(--fs-base); color: var(--text); font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cr-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.cchip {
  font-size: var(--fs-xs); color: var(--muted); background: color-mix(in srgb, var(--text) 4%, transparent);
  border-radius: var(--radius-pill); padding: 4px 10px; font-variant-numeric: tabular-nums;
}
.cchip-tok { color: var(--brand-int); background: var(--brand-soft); }
.cchip-recovered { color: var(--success); background: var(--success-soft); }
.cchip-recovered svg { width: 12px; height: 12px; }
.cchip-sched { color: var(--brand-int); background: var(--brand-soft); }
.cchip-safety {
  color: #9a3412; background: #fff2e8; border: 1px solid #fdba74; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.cchip-safety svg { width: 12px; height: 12px; }
.cchip-art {
  color: var(--brand-int); background: var(--brand-soft); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
}
a.cchip-art:hover { text-decoration: underline; }
.cchip-art svg { width: 12px; height: 12px; }
.cr-cost { flex: none; text-align: right; min-width: 68px; }
.cr-cost-v { font-size: var(--fs-base); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.cr-cost-l { font-size: var(--fs-xs); color: var(--faint); margin-top: 1px; }

.ce-tok { color: var(--brand-int); font-weight: 600; }
.ce-model { margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.rc-cost .rc-evt-text { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 20, 30, .32); z-index: 29;
  opacity: 0; transition: opacity var(--motion-slow);
}
.drawer-backdrop.show { opacity: 1; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); z-index: 30;
  background: var(--bg-elev); border-left: 1px solid var(--hairline); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform var(--motion-slow);
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer.show { transform: translateX(0); }
.drawer-wide { width: min(640px, 100vw); }
.drawer-close {
  position: absolute; top: 14px; right: 14px; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--hairline); background: var(--surface);
  color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 16px;
  transition: background var(--motion), color var(--motion);
}
.drawer-close::before { content: "\2715"; }
.drawer-close:hover { background: var(--brand-soft); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 22px 32px; }

.case-block + .case-block { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--hairline); }
.case-header { padding-right: 34px; }
.case-slug { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; color: var(--text); margin: 0 0 4px; }
.case-user { font-size: var(--fs-sm); color: var(--muted); }
.case-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.case-stat {
  font-size: var(--fs-xs); color: var(--muted); background: color-mix(in srgb, var(--text) 4%, transparent);
  border-radius: var(--radius-pill); padding: 5px 11px;
}

.integrity {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 650;
  border-radius: var(--radius-pill); padding: 5px 12px; margin-top: 10px;
}
.integrity svg { width: 13px; height: 13px; }
.integrity.ok { color: var(--success); background: var(--success-soft); }
.integrity.broken { color: var(--danger); background: var(--danger-soft); }
/* Verification could not run: amber, so "not checked" is distinct from failed and from passed. */
.integrity.unknown { color: var(--warn, #92400e); background: var(--warn-soft, rgba(217, 119, 6, 0.12)); }

.integrity.ledger-banner {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 10px;
  margin: 0 0 18px; padding: 11px 14px; border-radius: 10px; line-height: 1.5;
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--hairline);
}
.integrity.ledger-banner > svg { flex: none; margin-top: 2px; }
.integrity.ledger-banner.ok { background: var(--success-soft); border-color: transparent; }
.integrity.ledger-banner.broken { background: var(--danger-soft); border-color: transparent; }

.case-timeline { margin-top: 20px; display: flex; flex-direction: column; }
.case-event { position: relative; padding: 0 0 20px 26px; }
.case-event::before {
  content: ""; position: absolute; left: 5px; top: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--evt-color, var(--brand-int));
}
.case-event::after {
  content: ""; position: absolute; left: 9px; top: 14px; bottom: 0; width: 1px; background: var(--hairline);
}
.case-event:last-child::after { display: none; }
.case-event .ce-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.case-event .ce-type { font-size: var(--fs-xs); font-weight: 650; color: var(--evt-color, var(--brand-int)); }
.case-event .ce-time { font-size: var(--fs-xs); color: var(--faint); }
.case-event .ce-summary { font-size: var(--fs-sm); color: var(--text); margin-top: 3px; }
.case-event .ce-extra { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.case-event .ce-docs { font-size: var(--fs-xs); color: var(--muted); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.case-event .ce-docs ul { margin: 3px 0 0 16px; padding: 0; }
.case-event .ce-doc { display: inline-flex; align-items: center; gap: 4px; }
.case-event .ce-doc svg { width: 12px; height: 12px; flex: 0 0 auto; opacity: .8; }

/* ---------- unauthorized ---------- */
.unauth {
  max-width: 560px; margin: 80px auto; text-align: center; padding: 32px 28px;
  border: 1px solid var(--hairline); border-radius: var(--radius-card); background: var(--surface);
  box-shadow: var(--shadow);
}
.unauth .unauth-icn { color: var(--danger); margin-bottom: 10px; }
.unauth .unauth-icn svg { width: 30px; height: 30px; }
.unauth h2 { font-size: var(--fs-lg); margin: 0 0 6px; }
.unauth p { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.unauth .btn-primary { margin-top: 18px; }

:focus-visible { outline: 2px solid var(--brand-int); outline-offset: 2px; border-radius: 6px; }

.timeline-scroll::-webkit-scrollbar, .drawer-body::-webkit-scrollbar, .filter-row::-webkit-scrollbar { height: 8px; width: 8px; }
.timeline-scroll::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb, .filter-row::-webkit-scrollbar-thumb {
  background: var(--hairline); border-radius: 8px;
}

/* ---------- loading skeletons (shown while KPIs + cases are in flight) ---------- */
@keyframes sk-shimmer { 0% { background-position: -420px 0; } 100% { background-position: 420px 0; } }
.sk {
  border-radius: 6px;
  background-color: color-mix(in srgb, var(--text) 8%, transparent);
  background-image: linear-gradient(90deg,
    transparent 0, color-mix(in srgb, var(--text) 7%, transparent) 40px, transparent 80px);
  background-size: 640px 100%; background-repeat: no-repeat;
  animation: sk-shimmer 1.15s infinite linear;
}
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.sk-label { height: 11px; width: 58%; margin-bottom: 14px; }
.sk-value { height: 26px; width: 44%; }
.sk-line { height: 12px; margin: 7px 0; }
.sk-chip-row { width: 52%; margin-top: 12px; }
.sk-cost { height: 30px; width: 60px; flex: none; align-self: center; }
.crow-sk { cursor: default; pointer-events: none; animation: none; }

/* ---------- print ---------- */
@media print {
  .topbar, .controls, .lens-nav, #themeBtn, .drawer, .drawer-backdrop, #previewBadge, #userChip {
    display: none !important;
  }
  .print-title { display: block; font-size: 1.5rem; font-weight: 650; margin: 0 0 16px; color: #000; }
  body { background: #fff; }
  .app-shell { padding: 0; max-width: 100%; }
  .kpi-band, #timeline { width: 100%; }
  .kpi-tile, .crow, .trow { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .timeline-scroll { overflow: visible; }
  .crow, .trow { min-width: 0; }
}

.authline { font-size: var(--fs-xs); color: var(--muted); margin-top: 3px; }

.authchain { border-left: 2px solid var(--brand-int); padding: 8px 0 8px 12px; margin: 12px 0; }
.authchain.refused { border-left-color: var(--danger); }
.ac-step { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text); margin: 3px 0; }
.ac-step svg { width: 12px; height: 12px; flex: none; }

.ce-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ce-tool {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); color: var(--muted);
  background: var(--brand-soft); border-radius: 999px; padding: 2px 8px;
}
.ce-tool svg { width: 11px; height: 11px; flex: none; }

/* ---------- conversation replay (transcripts lens) ---------- */
/* This stylesheet has no --surface-2 or --border; the raised surface uses the same color-mix as .cchip. */
.replay-stream { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.replay-msg { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 12px; border-radius: 8px; }
.replay-user { background: color-mix(in srgb, var(--text) 4%, transparent); }
.replay-assistant { background: transparent; }
.replay-gutter { display: flex; flex-direction: column; gap: 2px; }
.replay-role { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.replay-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.replay-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: var(--fs-sm); }
.replay-evt { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 24px;
              margin-left: 8px; border-left: 2px solid var(--hairline); font-size: var(--fs-xs); color: var(--muted); }
.replay-evt-glyph { display: inline-flex; flex: none; }
.replay-evt-glyph svg { width: 12px; height: 12px; }
.replay-evt-label { font-weight: 600; }
.replay-evt-detail { overflow-wrap: anywhere; }
.replay-evt-failed { color: var(--danger); border-left-color: var(--danger); }
.replay-actions { display: flex; gap: 8px; margin-top: 12px; }
.replay-raw { max-height: 320px; overflow: auto; padding: 12px; border-radius: 8px;
              background: color-mix(in srgb, var(--text) 4%, transparent); font-size: var(--fs-xs);
              white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- shared report table (cost and budgets lenses) ---------- */
.bd-table-wrap { overflow-x: auto; }
.bd-table {
  width: 100%; border-collapse: collapse; min-width: 720px;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: var(--shadow); overflow: hidden; font-variant-numeric: tabular-nums;
}
.bd-table thead th {
  text-align: left; font-size: var(--fs-xs); font-weight: 650; letter-spacing: .03em;
  text-transform: uppercase; color: var(--faint); padding: 12px 14px;
  border-bottom: 1px solid var(--hairline); vertical-align: bottom; white-space: nowrap;
}
.bd-table tbody td {
  font-size: var(--fs-sm); color: var(--text); padding: 12px 14px;
  border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.bd-table tbody tr:last-child td { border-bottom: 0; }
.bd-table tbody tr:hover td { background: color-mix(in srgb, var(--brand-int) 5%, transparent); }
.bd-num { text-align: right; }
.bd-mono { font-variant-numeric: tabular-nums; color: var(--muted); }
.bd-th-sub {
  display: block; text-transform: none; letter-spacing: 0; font-weight: 500;
  color: var(--faint); font-size: 11px; margin-top: 2px;
}
.bd-unavail { color: var(--faint); font-style: italic; font-weight: 500; }

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px;
  border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 1;
  background: var(--warning, #b5710e); color: #fff;
}

/* ---------- the health lens ---------- */
/* Blind states (stale, never reported, unmeasured) get their own color so they never pass for healthy. */
.health-headline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.health-overall { font-size: var(--fs-sm); font-weight: 700; padding: 4px 12px; border-radius: var(--radius-pill); }
.health-overall.s-healthy { background: var(--success-soft); color: var(--success); }
.health-overall.s-failing { background: var(--danger-soft); color: var(--danger); }
.health-overall.s-stale,
.health-overall.s-never,
.health-overall.s-inconclusive { background: var(--warning-soft); color: var(--warning); }
.health-asof { font-size: var(--fs-xs); color: var(--faint); }

.health-body { margin-top: 18px; }
.health-pill {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--warning-soft); color: var(--warning); white-space: nowrap;
}
.health-summary { margin: 0; font-size: var(--fs-sm); color: var(--muted); }

.health-checks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.hc { display: flex; gap: 8px; align-items: baseline; font-size: var(--fs-xs); }
.hc::before { content: "•"; font-weight: 700; }
.hc-pass::before { color: var(--success); }
.hc-fail::before { color: var(--danger); }
.hc-unknown::before { color: var(--warning); content: "?"; }
.hc-name { color: var(--text); font-weight: 600; }
.hc-detail { color: var(--faint); }

.health-runbook {
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--hairline);
  font-size: var(--fs-xs); color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.health-loading { color: var(--faint); font-size: var(--fs-sm); padding: 20px 0; }

.health-caption { margin: 6px 0 12px; font-size: var(--fs-sm); color: var(--muted); }
.health-table td { vertical-align: top; }
.health-table .health-name { font-weight: 600; color: var(--text); white-space: nowrap; }
.health-table .health-when,
.health-table .health-cadence { font-size: var(--fs-xs); color: var(--faint); white-space: nowrap; }
.health-row.s-healthy td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.health-row.s-failing td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.health-row.s-stale td:first-child,
.health-row.s-never td:first-child,
.health-row.s-inconclusive td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.health-row.s-healthy .health-pill { background: var(--success-soft); color: var(--success); }
.health-row.s-failing .health-pill { background: var(--danger-soft); color: var(--danger); }
.health-row.s-stale .health-pill,
.health-row.s-never .health-pill,
.health-row.s-inconclusive .health-pill { background: var(--warning-soft); color: var(--warning); }
.health-row .health-summary { margin: 0; }
.health-detail { margin-top: 6px; }
.health-detail > summary { cursor: pointer; font-size: var(--fs-xs); color: var(--faint); }
.health-detail > summary:hover { color: var(--muted); }
.health-detail .health-checks { margin-top: 8px; }
.health-blind {
  border: 1px solid var(--warning); background: var(--warning-soft);
  border-radius: var(--radius-card); padding: 16px; color: var(--text);
}
.health-blind p { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--muted); }
/* Sign-in gate (signin.js renderSignInGate). */
.signin-gate { max-width: var(--maxw); margin: 60px auto; display: flex; justify-content: center; }
.signin-card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: var(--shadow); padding: 28px 30px; max-width: 460px; text-align: left;
}
.signin-title { margin: 0 0 10px; font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.signin-detail { margin: 0 0 18px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.55; }
.signin-btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 650;
  background: var(--brand); color: #fff; padding: 10px 18px; border-radius: var(--radius-pill);
}
.signin-btn:hover:not(:disabled) { filter: brightness(1.08); }
.signin-btn:disabled { opacity: .6; cursor: default; }
/* chat.css names this --warn and audit.css names it --danger; the fallback lets one block serve both. */
.signin-error { margin: 14px 0 0; color: var(--danger, var(--warn)); }


    /* Budget lens components (audit.js wireCosts / refreshCostManagement). */
    .cm-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
    @media (max-width: 720px) { .cm-summary { grid-template-columns: 1fr; } }

    .cm-table-title { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; color: var(--text); margin: 0 0 6px; }

    .cm-basis {
      font-size: var(--fs-sm); color: var(--faint); margin: 0 0 14px; line-height: 1.5;
      padding: 10px 14px; background: var(--surface-2, var(--surface));
      border-left: 3px solid var(--hairline); border-radius: 0 8px 8px 0;
    }
    .cm-basis strong { color: var(--text); font-weight: 650; }

    .cm-measured { color: var(--brand-int); }
    .cm-allocated { color: var(--warning); }

    .cm-chip {
      display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 650;
      border-radius: 8px; padding: 4px 9px;
    }
    .cm-chip-over { color: var(--danger, #b42318); background: var(--danger-soft, #fef3f2); }
    .cm-chip-near { color: var(--warning); background: var(--warning-soft); }
    .cm-chip-ok { color: var(--faint); background: var(--surface-2, transparent); }
    .cm-chip-none { color: var(--faint); background: transparent; font-weight: 500; font-style: italic; }

    .cm-meter { display: block; width: 110px; height: 6px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
    .cm-meter > span { display: block; height: 100%; border-radius: 3px; background: var(--brand-int); }
    .cm-meter.over > span { background: var(--danger, #b42318); }
    .cm-meter.near > span { background: var(--warning); }

    .cm-unavail { color: var(--faint); font-style: italic; font-weight: 500; }

    .cm-editor {
      background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
      box-shadow: var(--shadow); padding: 16px 18px; margin: 0 0 22px;
    }
    .cm-editor h2 { font-size: var(--fs-base); font-weight: 650; color: var(--text); margin: 0 0 4px; }
    .cm-editor-note { font-size: var(--fs-sm); color: var(--faint); margin: 0 0 14px; max-width: 78ch; }
    .cm-editor-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
    .cm-field { display: flex; flex-direction: column; gap: 5px; }
    .cm-field label { font-size: var(--fs-xs); font-weight: 650; color: var(--faint); text-transform: uppercase; letter-spacing: .03em; }
    .cm-field input, .cm-field select {
      font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--hairline);
      background: var(--surface); color: var(--text); min-width: 130px;
    }
    .cm-save { align-self: flex-end; }
    .cm-editor-status { font-size: var(--fs-sm); margin: 10px 0 0; min-height: 1.2em; }
    .cm-ok { color: var(--success); }
    .cm-err { color: var(--danger, #b42318); }
    .cm-editor-who { font-size: var(--fs-xs); color: var(--faint); margin: 8px 0 0; }
    .cm-row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; white-space: nowrap; }
    .cm-row-actions .btn-ghost { padding: 5px 10px; font-size: var(--fs-xs); }
    .cm-grant-amt {
      font: inherit; width: 76px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--hairline);
      background: var(--surface); color: var(--text);
    }
    .cm-decline { color: var(--danger, #b42318); }
    .cm-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .cm-ceiling-row {
      display: flex; align-items: center; gap: 12px; padding: 9px 0;
      border-top: 1px solid var(--hairline); font-size: var(--fs-sm);
    }
    .cm-ceiling-row:first-of-type { border-top: 0; }
    .cm-ceiling-label { font-weight: 650; color: var(--text); min-width: 120px; }
    .cm-ceiling-spent { color: var(--faint); font-variant-numeric: tabular-nums; }

    /* Cost lens components. */
    .bd-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
    @media (max-width: 720px) { .bd-summary { grid-template-columns: 1fr; } }

    .bd-table-title { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; color: var(--text); margin: 0 0 12px; }
    #bdModelTable { margin-top: 22px; }

    .bd-unavail { color: var(--faint); font-style: italic; font-weight: 500; }

    .bd-badge {
      display: inline-flex; flex-direction: column; gap: 1px;
      font-size: var(--fs-xs); font-weight: 650; border-radius: 8px; padding: 5px 10px;
    }
    .bd-badge-sub { font-weight: 500; font-size: 11px; color: var(--faint); text-transform: none; letter-spacing: 0; }
    .bd-badge-fixed { color: var(--brand-int); background: var(--brand-soft); }
    .bd-badge-usage { color: var(--warning); background: var(--warning-soft); }
    .bd-badge-usage .bd-badge-sub { color: color-mix(in srgb, var(--warning) 70%, var(--faint)); }

    .bd-banner {
      display: flex; align-items: center; gap: 10px; padding: 12px 16px;
      background: var(--warning-soft); border: 1px solid var(--warning); color: var(--warning);
      border-radius: var(--radius-card); font-size: var(--fs-sm); font-weight: 550;
    }
    .bd-banner svg { width: 18px; height: 18px; flex: none; }

    .bd-table-wrap { overflow-x: auto; }
    .bd-table {
      width: 100%; border-collapse: collapse; min-width: 720px;
      background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-card);
      box-shadow: var(--shadow); overflow: hidden; font-variant-numeric: tabular-nums;
    }
    .bd-table thead th {
      text-align: left; font-size: var(--fs-xs); font-weight: 650; letter-spacing: .03em;
      text-transform: uppercase; color: var(--faint); padding: 12px 14px;
      border-bottom: 1px solid var(--hairline); vertical-align: bottom; white-space: nowrap;
    }
    .bd-table tbody td {
      font-size: var(--fs-sm); color: var(--text); padding: 12px 14px;
      border-bottom: 1px solid var(--hairline); white-space: nowrap;
    }
    .bd-table tbody tr:last-child td { border-bottom: 0; }
    .bd-table tbody tr:hover td { background: color-mix(in srgb, var(--brand-int) 5%, transparent); }
    .bd-num { text-align: right; }
    .bd-mono { font-variant-numeric: tabular-nums; color: var(--muted); }
    .bd-th-sub {
      display: block; text-transform: none; letter-spacing: 0; font-weight: 500;
      color: var(--faint); font-size: 11px; margin-top: 2px;
    }

    /* Token attribution (audit.js renderAttribution). */
    #bdAttribution { margin-bottom: 26px; }
    .attr-scope { font-size: var(--fs-sm); color: var(--muted); margin: 0 0 12px; max-width: 82ch; }
    .attr-sub { font-size: var(--fs-base); font-weight: 650; color: var(--text); margin: 24px 0 10px; }
    .attr-sub-note { font-weight: 500; font-size: var(--fs-xs); color: var(--faint); }

    /* Drift badge for the 2% attribution gate. */
    .attr-drift {
      display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-pill);
      padding: 5px 12px; font-size: var(--fs-xs); font-weight: 650; font-variant-numeric: tabular-nums;
    }
    .attr-ok { color: var(--success); background: var(--success-soft); }
    .attr-bad { color: var(--danger); background: var(--danger-soft); }

    .attr-bar {
      display: flex; height: 28px; border-radius: 6px; overflow: hidden;
      background: var(--hairline); margin: 12px 0;
    }
    .attr-seg { display: block; height: 100%; }
    .attr-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: var(--fs-xs); color: var(--muted); }
    .attr-legend-item { display: inline-flex; align-items: center; gap: 6px; }
    .attr-legend-item b { color: var(--text); font-variant-numeric: tabular-nums; }
    .attr-legend-tok { color: var(--faint); }
    .attr-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
    /* Literal colors, not tokens, so a segment keeps its color in light and dark. Order follows the server's segments. */
    .attr-seg-0 { background: #0F3D77; }
    .attr-seg-1 { background: #1E5FB0; }
    .attr-seg-2 { background: #4C8FD6; }
    .attr-seg-3 { background: #2E9E5B; }
    .attr-seg-4 { background: #B5710E; }
    .attr-seg-5 { background: #7A5AA8; }

    .attr-chart { margin-top: 4px; }
    .attr-chart svg { width: 100%; height: 170px; display: block; overflow: visible; }
    .attr-gridline { stroke: var(--hairline); stroke-width: 1; }
    .attr-axis { fill: var(--faint); font-size: 10px; font-family: var(--font); }
    .attr-axis-end { text-anchor: end; }
    .attr-line { fill: none; stroke: var(--brand-int); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
    .attr-dot-pt { fill: var(--brand-int); }
    .attr-dot-zero { fill: var(--danger); }
    .attr-trend-table { margin-top: 10px; }
    .attr-trend-table > summary { cursor: pointer; font-size: var(--fs-xs); color: var(--faint); }
    .attr-trend-table > summary:hover { color: var(--muted); }
    .attr-trend-table .bd-table-wrap { margin-top: 8px; }

    .attr-drift-note {
      margin: 8px 0 0; font-size: var(--fs-sm); color: var(--muted);
      border-left: 3px solid var(--warning); padding-left: 10px;
    }
    #attrCsv { margin-top: 14px; }

    @media print {
      #attrCsv { display: none; }
      /* Keep segment colors in print. */
      .attr-seg, .attr-line, .attr-dot-pt, .attr-dot-zero {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
      }
      .attr-trend-table[open] > summary, .attr-trend-table > summary { list-style: none; color: #000; }
      .attr-trend-table > div { display: block !important; }
      #bdAttribution { break-inside: avoid; }
      .bd-banner { border-color: #999; color: #000; background: #f4f4f4; }
      .bd-table { box-shadow: none; border: 1px solid #ccc; min-width: 0; }
      .bd-table-wrap { overflow: visible; }
      .bd-summary, #bdResourceTable, #bdModelTable { width: 100%; break-inside: avoid; }
    }

/* ---------- the roster pager ---------- */
.cm-ceiling-note .cm-ceiling-says { flex: 1; color: var(--muted); font-size: var(--fs-xs); }
.cm-ceiling-note .cm-ceiling-says strong { color: var(--text); font-variant-numeric: tabular-nums; }
.cm-search { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.cm-search .filter-input { min-width: 260px; }
.cm-search-note { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.cm-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 2px 2px; flex-wrap: wrap;
}
.cm-pager-count { font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: baseline; gap: 8px; }
.cm-pager-sub { font-size: var(--fs-xs); color: var(--muted); opacity: .8; }
.cm-pager-btns { display: flex; gap: 8px; }
.cm-page-btn {
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--text);
  border-radius: var(--radius-pill); padding: 5px 14px;
}
.cm-page-btn:hover:not(:disabled) { border-color: var(--muted); }
.cm-page-btn:disabled { opacity: .45; cursor: default; }

/* Visibility, not display, so the header keeps its height. Only resolveAccess adds lens-ready; never reveal on a timeout. */
.lens-nav:not(.lens-ready) a[data-lens] { visibility: hidden; }
.lens-nav a[data-lens] { transition: opacity 120ms ease; }

/* ---------- the lockup is the way out ---------- */
.brand-lockup { text-decoration: none; color: inherit; border-radius: 8px; }
.brand-lockup:hover .brand-name { text-decoration: underline; text-underline-offset: 3px; }
.brand-lockup:focus-visible { outline: 2px solid var(--brand-int); outline-offset: 3px; }

/* ---------- why somebody asked ---------- */
.cm-reason { max-width: 34ch; font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
.cm-noreason { color: var(--faint); font-style: italic; }

/* ---------- feedback lens (/admin/feedback) ---------- */
.fb-card {
  border: 1px solid var(--hairline); border-radius: var(--radius-card);
  background: var(--surface); padding: 15px 17px; margin-bottom: 12px;
}
.fb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fb-verdict {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
/* Restated rather than reusing .outcome, which would bring the case row's sizing with it. */
.fb-verdict.o-success { color: var(--success); background: var(--success-soft); }
.fb-verdict.o-failure { color: var(--danger); background: var(--danger-soft); }
.fb-verdict.o-pending { color: var(--warning); background: var(--warning-soft); }
.fb-verdict.o-neutral { color: var(--muted); background: var(--hairline); }
.fb-reason {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text);
  padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid var(--hairline);
}
.fb-who { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.fb-door {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted);
}
.fb-when { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); }

.fb-quote {
  margin: 0; padding: 2px 0 2px 13px; border-left: 3px solid var(--hairline);
  font-size: var(--fs-base); color: var(--text); line-height: 1.55;
}
.fb-nocomment { margin: 0; font-size: var(--fs-sm); color: var(--faint); }

.fb-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.fb-noshare { font-size: var(--fs-xs); color: var(--faint); }

.fb-transcript {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-card);
  background: var(--bg); border: 1px solid var(--hairline);
}
.fb-msg { display: flex; gap: 10px; padding: 6px 0; align-items: baseline; }
.fb-msg + .fb-msg { border-top: 1px dashed var(--hairline); }
.fb-role {
  flex: none; width: 74px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--faint);
}
.fb-msg.fb-user .fb-text { color: var(--text); font-weight: 560; }
.fb-text { font-size: var(--fs-sm); color: var(--muted); line-height: 1.55; white-space: pre-wrap; }
.fb-expiry { margin: 10px 0 0; font-size: var(--fs-xs); color: var(--faint); }

.ov-meta {
  max-width: var(--maxw); margin: -6px auto 14px; padding: 0 2px;
  font-size: var(--fs-xs); color: var(--muted);
}

.target-strip { display: flex; flex-direction: column; }
.target {
  display: grid; grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 12px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--hairline);
}
.target:last-of-type { border-bottom: 0; }
.target-label { font-size: var(--fs-sm); min-width: 0; }
.target-value { font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.target-goal { font-size: var(--fs-xs); color: var(--faint); white-space: nowrap; }
.target-off .target-value { color: var(--danger); }
.target-off .target-goal { color: var(--warning); }

.gap-terms { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 0 2px; }
.gap-term {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-int);
  font-size: var(--fs-xs); font-weight: 600;
}
.gap-term b { font-variant-numeric: tabular-nums; opacity: 0.75; }
.gap-terms-note { margin-top: 8px; }

/* ---------- four groups, not fourteen tiles ---------- */
.kpi-group {
  flex: 1 1 200px; min-width: 190px;
  padding: 14px 16px 12px;
  background: var(--bg-elev); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  display: flex; flex-direction: column; gap: 2px;
}
.kpi-group .g-label {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted);
}
.kpi-group .g-value { font-size: 1.55rem; font-weight: 680; line-height: 1.15; margin-top: 2px; }
.kpi-group .g-delta { margin: 3px 0 1px; }
.kpi-group .g-sub { font-size: var(--fs-xs); color: var(--muted); }
.kpi-group .spark { margin-top: auto; padding-top: 8px; color: var(--brand-int); align-self: flex-start; }

/* ---------- the funnel ---------- */
.funnel { display: flex; flex-direction: column; }
.fn-step {
  display: grid; grid-template-columns: 4.5rem minmax(0, 11rem) minmax(0, 1fr);
  gap: 12px; align-items: center; padding: 7px 0;
  text-decoration: none; color: var(--text);
}
a.fn-step:hover .fn-label { color: var(--brand-int); }
.fn-n { font-size: var(--fs-md); font-weight: 680; text-align: right; font-variant-numeric: tabular-nums; }
.fn-label { font-size: var(--fs-sm); color: var(--muted); }
.fn-bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.fn-bar > span { display: block; height: 100%; background: var(--brand-int); border-radius: 999px; }
.fn-drop {
  margin: 0 0 0 5.5rem; padding: 3px 0 5px;
  font-size: var(--fs-xs); color: var(--faint); border-left: 2px solid var(--hairline); padding-left: 10px;
}
.fn-drop b { color: var(--warning); font-variant-numeric: tabular-nums; }
.fn-aside { margin-left: 0; border-left: 0; padding-left: 0; margin-top: 10px; }

/* ---------- what it was worth: the only assumption on the page ---------- */
.worth-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: baseline; }
.worth-net { display: flex; align-items: baseline; gap: 8px; }
.worth-value { font-size: 1.7rem; font-weight: 680; }
.worth-label { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.worth-bad .worth-value { color: var(--danger); }
.worth-parts { font-size: var(--fs-sm); color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.worth-parts b { color: var(--text); font-variant-numeric: tabular-nums; }
.worth-note { font-size: var(--fs-xs); color: var(--faint); margin-top: 3px; }
a.fn-drop { display: block; text-decoration: none; }
a.fn-drop:hover { color: var(--brand-int); border-left-color: var(--brand-int); }

/* ---------- who is using it ---------- */
.who-row {
  display: grid; grid-template-columns: minmax(0, 12rem) minmax(60px, 1fr) 3rem 4.5rem;
  gap: 12px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm);
}
.who-row:last-of-type { border-bottom: 0; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.who-weeks { text-align: right; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.meter { height: 8px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand-int); border-radius: 99px; }
@media (max-width: 640px) {
  .who-row { grid-template-columns: minmax(0, 1fr) 3rem 4.5rem; }
  .who-row .meter { display: none; }
}

/* ---------- who is using it: department, expandable ---------- */
.dept { border-bottom: 1px solid var(--hairline); }
.dept:last-of-type { border-bottom: 0; }
.dept > summary {
  display: grid; grid-template-columns: minmax(0, 13rem) minmax(60px, 1fr) 3rem 5rem;
  gap: 12px; align-items: center; padding: 9px 0; cursor: pointer;
  font-size: var(--fs-sm); list-style: none;
}
.dept > summary::-webkit-details-marker { display: none; }
.dept > summary:hover .who-name { color: var(--brand-int); }
.dept[open] > summary .who-name { font-weight: 650; }
.dept-kids { padding: 2px 0 10px 14px; margin-left: 6px; border-left: 2px solid var(--hairline); }
.kid-row {
  display: grid; grid-template-columns: minmax(0, 11rem) 3rem 5rem; gap: 12px;
  padding: 5px 0; font-size: var(--fs-xs); color: var(--muted);
}
@media (max-width: 640px) {
  .dept > summary { grid-template-columns: minmax(0, 1fr) 3rem 5rem; }
  .dept > summary .meter { display: none; }
}

/* ---------- the one-ask modal ---------- */
.modal-host {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 24, 35, 0.42);
  display: flex; align-items: center; justify-content: center; padding: 22px;
}
.modal-card {
  background: var(--bg-elev); border: 1px solid var(--hairline); border-radius: var(--radius-card);
  box-shadow: 0 18px 48px rgba(15, 24, 35, 0.22);
  max-width: 620px; width: 100%; max-height: 80vh; overflow: auto; padding: 18px 20px 16px;
}
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal-head b { font-size: var(--fs-md); }
.modal-x {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted); padding: 0 4px;
}
.modal-x:hover { color: var(--text); }
.modal-q {
  margin: 0; padding: 12px 14px; border-left: 3px solid var(--brand-int);
  background: var(--surface); border-radius: 0 var(--radius-card) var(--radius-card) 0;
  font-size: var(--fs-md); line-height: 1.6; white-space: pre-wrap;
}
.modal-meta { margin: 12px 0 0; font-size: var(--fs-xs); color: var(--muted); }
button.gap-line {
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--hairline);
  font: inherit; cursor: pointer;
}
button.gap-line:last-of-type { border-bottom: 0; }

.who-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.who-table th {
  text-align: left; font-weight: 700; color: var(--faint); padding: 2px 10px 6px 0;
  text-transform: uppercase; letter-spacing: 0.03em; font-size: 10.5px; white-space: nowrap;
}
.who-table td { padding: 5px 10px 5px 0; border-top: 1px solid var(--hairline); color: var(--muted); }
.who-table td:first-child { color: var(--text); }
.who-table .cm-num { text-align: right; font-variant-numeric: tabular-nums; }
.who-table th.cm-num { text-align: right; }

/* `.bd-table thead th` outranks `.cm-num`, so numeric headers need this to right-align. */
.bd-table thead th.cm-num { text-align: right; }

.replay-evt-files { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; }
.replay-doc {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 12px; line-height: 1.4;
  padding: 2px 8px; border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.replay-doc:hover:not(:disabled) { border-color: var(--brand-int); color: var(--brand-int); }
.replay-doc:disabled { opacity: .6; cursor: default; }
.replay-doc svg { width: 13px; height: 13px; flex: none; }

.cr-replay {
  display: inline-flex; align-items: center; gap: 6px; align-self: center;
  flex: none;
  font-size: 12px; font-weight: 600; line-height: 1;
  padding: 6px 12px; border: 1px solid var(--hairline); border-radius: 999px;
  color: var(--muted); background: var(--surface);
  transition: color .12s ease, border-color .12s ease;
}
.cr-replay svg { width: 14px; height: 14px; }
.crow:hover .cr-replay, .crow:focus-visible .cr-replay { color: var(--brand-int); border-color: var(--brand-int); }

/* Shaped like the door shell on purpose, without importing its stylesheet or per-door tokens. */
.replay-chat { display: flex; flex-direction: column; gap: 4px; padding: 4px 2px; }
.rc-row { display: flex; flex-direction: column; margin: 8px 0; max-width: 100%; }
.rc-row.rc-user { align-items: flex-end; }
.rc-row.rc-assistant { align-items: flex-start; }
.rc-bubble {
  max-width: 82%; padding: 11px 15px; border-radius: 16px; line-height: 1.55;
  font-size: var(--fs-sm); overflow-wrap: anywhere;
}
.rc-user .rc-bubble { background: var(--brand-int); color: #fff; border-bottom-right-radius: 5px; }
.rc-assistant .rc-bubble {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--hairline); border-bottom-left-radius: 5px;
}
.rc-stamp { font-size: 10px; color: var(--faint); margin: 3px 4px 0; font-variant-numeric: tabular-nums; }
.rc-plain { margin: 0; white-space: pre-wrap; }

.rc-bubble p { margin: 7px 0; }
.rc-bubble p:first-child { margin-top: 0; }
.rc-bubble p:last-child { margin-bottom: 0; }
.rc-bubble ul, .rc-bubble ol { margin: 8px 0 8px 20px; padding: 0; }
.rc-bubble li { margin: 3px 0; }
.rc-bubble h1, .rc-bubble h2, .rc-bubble h3, .rc-bubble h4 {
  font-size: var(--fs-sm); font-weight: 680; margin: 14px 0 5px; line-height: 1.3;
}
.rc-bubble h1:first-child, .rc-bubble h2:first-child,
.rc-bubble h3:first-child, .rc-bubble h4:first-child { margin-top: 0; }
.rc-bubble a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
.rc-assistant .rc-bubble a { color: var(--brand-int); }
.rc-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  background: color-mix(in srgb, var(--text) 8%, transparent); padding: 1px 5px; border-radius: 5px;
}
.rc-user .rc-bubble code { background: rgba(255, 255, 255, .22); }
.rc-bubble pre {
  background: color-mix(in srgb, var(--text) 6%, transparent);
  padding: 10px; border-radius: 8px; overflow-x: auto; margin: 8px 0;
}
.rc-bubble pre code { background: none; padding: 0; }
.rc-bubble blockquote {
  margin: 8px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--hairline); color: var(--muted);
}
.rc-bubble table { border-collapse: collapse; margin: 8px 0; font-size: var(--fs-xs); }
.rc-bubble th, .rc-bubble td { border: 1px solid var(--hairline); padding: 4px 8px; text-align: left; }
.rc-bubble hr { border: 0; border-top: 1px solid var(--hairline); margin: 12px 0; }

.rc-evt {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px;
  margin: 6px 0; padding: 4px 10px; font-size: var(--fs-xs); color: var(--faint); text-align: center;
}
.rc-evt-glyph { display: inline-flex; flex: none; }
.rc-evt-glyph svg { width: 13px; height: 13px; }
.rc-evt-failed { color: var(--danger); }

.drawer-grip {
  position: absolute; top: 0; left: 0; bottom: 0; width: 9px;
  cursor: ew-resize; z-index: 2; background: transparent;
}
/* Inside the edge: .drawer has overflow:hidden, so a negative-margin handle would be clipped. */
.drawer-grip::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px;
  background: var(--brand-int); opacity: 0; transition: opacity var(--motion);
}
.drawer-grip:hover::after, .drawer-grip:focus-visible::after { opacity: .85; }
.drawer-grip:focus-visible { outline: none; }
body.drawer-resizing { user-select: none; cursor: ew-resize; }
body.drawer-resizing .drawer-body { pointer-events: none; }
body.drawer-resizing .drawer { transition: none; }

.replay-evt-detail a, .rc-evt-text a { color: var(--brand-int); text-decoration: underline; }
.replay-evt-detail a:hover, .rc-evt-text a:hover { color: var(--text); }
.rc-sources { display: inline; }
.rc-sources > summary { display: inline; cursor: pointer; text-decoration: underline dotted; list-style: none; }
.rc-sources > summary::-webkit-details-marker { display: none; }
.rc-sources[open] > summary { margin-right: 6px; }

.replay-nokeep {
  font-size: 11px; font-style: italic; color: var(--faint);
  border: 1px dashed var(--hairline); border-radius: 999px; padding: 1px 8px; cursor: help;
}
/* An anchor whose href sanitizeReplay stripped. */
.rc-deadlink { color: inherit !important; text-decoration: none !important; cursor: text; }

.lens-need {
  margin: 0 0 18px; padding: 2px 16px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-left: 3px solid var(--warning); border-radius: var(--radius-card);
}
.lens-need .todo { border: 0; padding: 12px 0; }

.def-unit {
  flex: none; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap;
  align-self: center; min-width: 62px;
}

.bd-bar-wrap { margin: 0 0 18px; }
.bd-bar {
  display: flex; height: 26px; border-radius: 8px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--hairline);
}
.bd-bar-seg { display: block; height: 100%; }
.bd-seg-0 { background: var(--brand); }
.bd-seg-1 { background: color-mix(in srgb, var(--brand-int) 82%, white); }
.bd-seg-2 { background: color-mix(in srgb, var(--brand-int) 62%, white); }
.bd-seg-3 { background: color-mix(in srgb, var(--brand-int) 44%, white); }
.bd-seg-4 { background: color-mix(in srgb, var(--brand-int) 28%, white); }
.bd-seg-5 { background: color-mix(in srgb, var(--brand-int) 16%, white); }
.bd-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 9px; }
.bd-key { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.bd-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.cm-section-title {
  margin: 30px 0 14px; padding-bottom: 8px;
  font-size: var(--fs-base); font-weight: 680; letter-spacing: -.01em; color: var(--text);
  border-bottom: 1px solid var(--hairline);
}
.cm-section-title:first-of-type { margin-top: 0; }

/* ---------- left rail ---------- */
:root { --rail-w: 212px; --topbar-h: 59px; }  /* --topbar-h is re-measured by audit.js */
.rail-h {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  padding: 16px 12px 6px;
}
.rail-h:first-child { padding-top: 4px; }
@media (min-width: 900px) {
  body { padding-left: var(--rail-w); }
  header.topbar { margin-left: calc(-1 * var(--rail-w)); padding-left: 20px; padding-right: 20px; }
  .rail {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--rail-w); z-index: 15;
    border-right: 1px solid var(--hairline); background: var(--bg); overflow-y: auto; padding: 14px 10px 24px;
  }
  .rail .lens-nav { flex-direction: column; align-items: stretch; gap: 2px; }
  .rail .lens-nav a { padding: 7px 12px; border-bottom: 0; border-radius: 8px; }
  .rail .lens-nav a:hover { background: var(--brand-soft); color: var(--text); }
  .rail .lens-nav a.active { background: var(--brand-soft); color: var(--brand-int); }
}
@media (max-width: 899px) {
  .rail { border-bottom: 1px solid var(--hairline); overflow-x: auto; }
  .rail .lens-nav { padding: 8px 16px; gap: 14px; }
  .rail-h { display: none; }
}
@media print { .rail { display: none; } body { padding-left: 0; } header.topbar { margin-left: 0; } }
