/* =============================================================================================
   STASIS design system — dark monochrome console.
   The chrome is black, white and greys. Colour appears only as data:
   covered = green, partial = amber, gap / overdue = red.
   ============================================================================================= */
:root {
  color-scheme: dark;
  /* Surfaces */
  /* Ink-green ground: the brand's deep green, taken almost to black */
  --bg: #07100d;
  --bg-1: #0b1612;
  --bg-2: #101e19;
  --bg-3: #172720;
  --line: rgba(190, 255, 225, 0.08);
  --line-2: rgba(190, 255, 225, 0.14);
  --line-3: rgba(190, 255, 225, 0.26);
  /* Text */
  --text: #eef3ef;
  --text-2: #c2cdc6;
  --muted: #85958d;
  --faint: #55655d;
  /* Data colours, and only data */
  --covered: #3fb37f;
  --partial: #e2a53a;
  --gap: #e5534b;
  --na: #686b65;
  --covered-a: rgba(63, 179, 127, 0.14);
  --partial-a: rgba(226, 165, 58, 0.14);
  --gap-a: rgba(229, 83, 75, 0.14);
  /* Type */
  --sans: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-label: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-body: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 28px;
  --fs-display: 44px;
  --fs-hero: 64px;
  /* Space: a 4/8 rhythm */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  /* Shape */
  --r1: 6px;
  --r2: 10px;
  --r3: 14px;
  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t1: 160ms;
  --t2: 260ms;
  --t3: 520ms;
  --t4: 900ms;
  --side-w: 232px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-body)/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; overflow-x: hidden; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: var(--fs-xl); line-height: 1.15; }
h2 { font-size: var(--fs-lg); line-height: 1.25; }
h3 { font-size: var(--fs-md); line-height: 1.3; }
p { margin: 0 0 var(--s2); }
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: var(--line-3); }
a:hover { text-decoration-color: var(--text); }
ul { margin: 0; padding-left: 18px; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: var(--s1) 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.6 var(--mono); margin: 0; color: var(--text-2); }
blockquote { margin: 0; font: 12.5px/1.55 var(--mono); color: var(--text-2); overflow-wrap: anywhere; }
kbd { font: 10px var(--mono); padding: 0 4px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); margin-left: 4px; }
::selection { background: rgba(255, 255, 255, 0.2); }
:focus-visible { outline: 1.5px solid var(--text); outline-offset: 2px; border-radius: 4px; }

.label { display: inline-block; font: 500 var(--fs-label)/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.strong { font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); }
.err { color: var(--gap); font-size: var(--fs-sm); }
.grow { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: var(--s3) 0 0; }
.actions.center { justify-content: center; }

/* ---------------------------------------------------------------- Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 500 var(--fs-sm)/1 var(--sans); padding: 9px 14px; border-radius: var(--r1); border: 1px solid var(--line-2); background: transparent; color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; transition: border-color var(--t1) var(--ease), background var(--t1) var(--ease), transform var(--t1) var(--ease); }
.btn:hover { border-color: var(--line-3); background: rgba(255, 255, 255, 0.04); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--text); border-color: var(--text); color: #0a0b0a; font-weight: 600; }
.btn.primary:hover { background: #fff; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn.danger { color: var(--text-2); }
.btn.danger:hover { border-color: var(--gap); }
.btn.sm { padding: 5px 9px; font-size: var(--fs-xs); }
.btn.block { width: 100%; padding: 11px 14px; }
.link { font: inherit; color: var(--text); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
input, textarea, select { font: inherit; font-size: var(--fs-body); color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r1); padding: 9px 11px; width: 100%; transition: border-color var(--t1) var(--ease); }
input:focus, textarea:focus { outline: none; border-color: var(--line-3); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 999px; font: 500 var(--fs-xs)/1.4 var(--sans); white-space: nowrap; border: 1px solid var(--line); color: var(--text-2); }
.pill i { font-style: normal; font-size: 10px; }
.pill.covered { color: var(--covered); border-color: rgba(63, 179, 127, 0.3); }
.pill.partial { color: var(--partial); border-color: rgba(226, 165, 58, 0.3); }
.pill.gap { color: var(--gap); border-color: rgba(229, 83, 75, 0.35); }
.pill.na, .pill.none { color: var(--muted); }
.tag, .chip, .tool { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--line-2); font: 500 var(--fs-label)/1.6 var(--mono); color: var(--muted); letter-spacing: 0.02em; }
.chip.flag.high { color: var(--gap); border-color: rgba(229, 83, 75, 0.35); }
.chip.flag.medium { color: var(--partial); border-color: rgba(226, 165, 58, 0.3); }
.idchip { display: inline-flex; font: 500 var(--fs-label)/1.6 var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--bg-3); color: var(--text-2); }
.idchip a, .idchip .link { color: inherit; text-decoration: none; font: inherit; }
.idchip a:hover, .idchip .link:hover { text-decoration: underline; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--na); flex: none; }
.dot.covered { background: var(--covered); } .dot.partial { background: var(--partial); } .dot.gap, .dot.none { background: var(--gap); }

.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s4); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.page-head { margin-bottom: var(--s5); max-width: 82ch; }
.page-head h1 { margin: var(--s1) 0 var(--s2); }
.page-head .muted { font-size: var(--fs-sm); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; margin-top: var(--s3); }
.block + .block { margin-top: var(--s6); }
.empty { max-width: 560px; margin: 14vh auto; text-align: center; }
.empty h2 { margin: var(--s2) 0; font-size: var(--fs-xl); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th { text-align: left; font: 500 var(--fs-label) var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 0 var(--s2) var(--s2); border-bottom: 1px solid var(--line); }
td { padding: var(--s2); border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }

/* ---------------------------------------------------------------- Shell */
.shell-side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20; display: flex; flex-direction: column; gap: var(--s5); padding: var(--s5) var(--s3) var(--s4); background: #050d0a; border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--s2); }
.wordmark { font-weight: 800; letter-spacing: 0.24em; font-size: 15px; }
.brand-tag { font-size: var(--fs-xs); color: var(--muted); }
.client { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.client-name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.3; }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r1); color: var(--muted); text-decoration: none; font-weight: 500; font-size: var(--fs-body); transition: color var(--t1) var(--ease); }
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); }
.nav-ind { position: absolute; top: 0; left: 0; z-index: 0; border-radius: var(--r1); background: rgba(255, 255, 255, 0.06); box-shadow: inset 2px 0 0 var(--text); pointer-events: none; }
.nav-ind.ready { transition: transform var(--t2) var(--ease), width var(--t2) var(--ease), height var(--t2) var(--ease); }
.nav-icon { width: 17px; height: 17px; flex: none; }
.nav-label { flex: 1; }
.badge { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bg-3); color: var(--text-2); font: 600 11px/20px var(--mono); text-align: center; }
.badge.hot { background: var(--gap); color: #fff; }
.badge.pop { animation: pop var(--t2) var(--ease); }
.side-foot { display: flex; flex-direction: column; gap: var(--s3); padding-top: var(--s4); border-top: 1px solid var(--line); }
.mode { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; font: 500 var(--fs-label) var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mode i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.mode.live i { background: var(--text); animation: pulse 1.2s ease-in-out infinite; }
.mode.bad { color: var(--gap); }
.mode.bad i { background: var(--gap); }
.who { display: flex; align-items: center; gap: 10px; padding: 6px; margin: 0 -6px; border: 0; border-radius: var(--r1); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background var(--t1) var(--ease); }
.who:hover { background: rgba(255, 255, 255, 0.05); }
.who-mark { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font: 600 11px var(--mono); color: var(--text); }
.who-mark.lg { width: 40px; height: 40px; font-size: 13px; }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-text b { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { font-size: var(--fs-xs); color: var(--muted); }
.side-foot .btn { align-self: flex-start; }

.view { padding: var(--s6) var(--s6) var(--s7); }
.view > * { max-width: 1360px; margin-left: auto; margin-right: auto; }
@media (min-width: 1024px) {
  .shell-side:not([hidden]) ~ .view, .shell-side:not([hidden]) ~ .busybar { margin-left: var(--side-w); }
}
.view.route-in { animation: viewIn var(--t2) var(--ease) both; }
.busybar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; overflow: hidden; opacity: 0; transition: opacity var(--t2) var(--ease); pointer-events: none; }
.busybar.on { opacity: 1; }
.busybar::after { content: ""; position: absolute; inset: 0; width: 35%; background: linear-gradient(90deg, transparent, var(--text), transparent); transform: translateX(-100%); }
.busybar.on::after { animation: indeterminate 1.2s var(--ease) infinite; }

/* ---------------------------------------------------------------- Readiness: the instrument */
.instrument { position: relative; overflow: hidden; display: grid; grid-template-columns: 168px minmax(0, 1fr) minmax(0, 0.95fr); grid-template-areas: "face main kpis" "face main actions"; gap: var(--s2) var(--s6); align-items: center; padding: var(--s5) var(--s5) var(--s4); border: 1px solid var(--line); border-radius: var(--r3); background-color: var(--bg-1);
  background-image: linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px), linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 48px 48px, 48px 48px, 12px 12px, 12px 12px; }
.instrument::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; }
.instrument.glow-up::after { box-shadow: inset 0 0 0 1px var(--covered), 0 0 40px rgba(63, 179, 127, 0.25) inset; animation: glow 1400ms var(--ease) 700ms both; }
.instrument.glow-down::after { box-shadow: inset 0 0 0 1px var(--partial), 0 0 40px rgba(226, 165, 58, 0.25) inset; animation: glow 1400ms var(--ease) 700ms both; }
.inst-face { grid-area: face; position: relative; width: 168px; height: 168px; }
.donut { width: 100%; height: 100%; display: block; }
.donut .tick { stroke: rgba(255, 255, 255, 0.16); stroke-width: 0.5; }
.donut .tick.long { stroke: rgba(255, 255, 255, 0.4); stroke-width: 0.8; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 5; }
.ring-inner { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 0.5; stroke-dasharray: 1 2; }
.arc { fill: none; stroke-width: 5; }
.arc.covered { stroke: var(--covered); } .arc.partial { stroke: var(--partial); } .arc.gap { stroke: var(--gap); } .arc.na { stroke: var(--na); }
.inst-read { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.inst-pct { font-size: 46px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.inst-read .label { font-size: 10px; margin-top: 4px; }
.inst-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: var(--s3); }
.inst-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
.ic { display: flex; flex-direction: column; gap: 2px; }
.ic-n { font-size: var(--fs-display); font-weight: 600; letter-spacing: -0.035em; line-height: 1; }
.ic-l { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-label) var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ic-l i { width: 7px; height: 7px; border-radius: 50%; background: var(--na); }
.ic.covered .ic-l i { background: var(--covered); } .ic.partial .ic-l i { background: var(--partial); } .ic.gap .ic-l i { background: var(--gap); }
.ic.na .ic-n { color: var(--muted); }
.sbar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.05); }
.sbar span { display: block; height: 100%; transition: width var(--t3) var(--ease); transition-delay: calc(var(--i) * 70ms + 200ms); }
.sbar .covered, .mini .covered { background: var(--covered); }
.sbar .partial, .mini .partial { background: var(--partial); }
.sbar .gap, .mini .gap { background: var(--gap); }
.sbar .na, .mini .na { background: var(--na); }
.inst-meta { margin: 0; font-size: var(--fs-label); letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; }
.kpis { grid-area: kpis; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid var(--line); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s4); color: inherit; text-decoration: none; min-width: 0; border-bottom: 1px solid var(--line); transition: background var(--t1) var(--ease); }
.kpi:nth-child(odd) { border-right: 1px solid var(--line); }
.kpi:nth-child(n + 3) { border-bottom: 0; }
a.kpi[href]:hover { background: rgba(255, 255, 255, 0.03); }
.kpi-n { font-size: 40px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; }
.kpi-sub { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.bad .kpi-n, .kpi.bad .kpi-sub { color: var(--gap); }
.inst-actions { grid-area: actions; display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; padding-left: var(--s4); }

/* Heat strip: sticks under the summary while the clauses scroll. */
.heat-wrap { position: sticky; top: 0; z-index: 6; padding: var(--s2) 0; background: var(--bg); }
.heat { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg-1); }
.cells { flex: 1; display: flex; gap: 3px; min-width: 0; }
.cell { flex: 1; min-width: 0; height: 30px; border: 0; border-radius: 4px; cursor: pointer; display: grid; place-items: center; font: 500 10px var(--mono); color: rgba(10, 11, 10, 0.78); background: var(--na); transition: transform var(--t1) var(--ease), opacity var(--t1) var(--ease); }
.cell span { overflow: hidden; white-space: nowrap; }
.cell.gap-before { margin-left: 6px; }
.cell.covered { background: var(--covered); } .cell.partial { background: var(--partial); } .cell.gap, .cell.none { background: var(--gap); }
.cell.na { background: var(--bg-3); color: var(--muted); }
.cell:hover { transform: translateY(-2px); }
.heat-pct { font-size: var(--fs-sm); color: var(--text); min-width: 36px; text-align: right; }

.alert { display: flex; align-items: center; gap: var(--s3); width: 100%; margin: var(--s2) 0 var(--s3); padding: var(--s3) var(--s4); border: 1px solid rgba(229, 83, 75, 0.35); border-radius: var(--r2); background: var(--bg-1); color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; transition: border-color var(--t1) var(--ease), background var(--t1) var(--ease); }
.alert:hover { border-color: var(--gap); background: var(--bg-2); }
.alert .label { color: var(--gap); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gap); flex: none; box-shadow: 0 0 0 0 rgba(229, 83, 75, 0.6); animation: beacon 2s ease-out infinite; }
.alert-text { flex: 1; color: var(--text-2); }
.alert-go { font: 500 var(--fs-xs) var(--mono); white-space: nowrap; transition: transform var(--t1) var(--ease); }
.alert:hover .alert-go { transform: translateX(3px); }

.ready-grid { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: var(--s5); align-items: start; margin-top: var(--s2); }
.rail { position: sticky; top: 64px; display: flex; flex-direction: column; gap: var(--s4); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.rows a, .rows button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; padding: 10px 0; color: inherit; text-decoration: none; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.rows a:hover .row-text, .rows button:hover .row-text { text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.row-tag { font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.row-text { font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; }
.row-line { display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; }
.row-line .row-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-line .mono { color: var(--muted); }

/* PDCA flow */
.pdca { display: flex; gap: 0; margin-bottom: var(--s5); }
.seg { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px 22px 12px 26px; margin-right: -8px; border: 0; background: var(--bg-2); color: inherit; font: inherit; text-align: left; cursor: pointer; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%); transition: background var(--t1) var(--ease); }
.seg.first { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); padding-left: 14px; border-radius: var(--r2) 0 0 var(--r2); }
.seg.last { margin-right: 0; }
.seg:hover { background: var(--bg-3); }
.seg-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.seg-top .mono { color: var(--muted); font-size: var(--fs-xs); }
.seg-pct { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.seg-name { font: 500 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { display: flex; gap: 2px; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }

/* Clause groups and tiles */
.group { margin-bottom: var(--s5); scroll-margin-top: 72px; border-radius: var(--r2); }
.group.flash .group-head .label { animation: labelFlash 1200ms var(--ease); }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding-bottom: var(--s2); margin-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.group-head .label { color: var(--text-2); }
.group-counts { display: flex; gap: var(--s3); font-size: var(--fs-xs); color: var(--muted); }
.count { display: inline-flex; align-items: center; gap: 5px; }
.count i { width: 6px; height: 6px; border-radius: 50%; background: var(--na); }
.count.covered i { background: var(--covered); } .count.partial i { background: var(--partial); } .count.gap i { background: var(--gap); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s2); }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 104px; padding: 12px 14px 12px 16px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg-1); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: transform var(--t2) var(--ease), border-color var(--t1) var(--ease), background var(--t1) var(--ease); }
.tile::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 2px; border-radius: 0 2px 2px 0; background: var(--na); }
.tile.covered::before { background: var(--covered); } .tile.partial::before { background: var(--partial); } .tile.gap::before, .tile.none::before { background: var(--gap); }
.tile:hover { transform: translateY(-2px); border-color: var(--line-3); background: var(--bg-2); }
.tile-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.tile-title { flex: 1; font-size: var(--fs-body); font-weight: 600; line-height: 1.3; }
.tile-foot { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: var(--fs-xs); }
.ruled { font: 500 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--partial); }
.tile::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0; }

/* Gauge timeline */
.gauges { margin-top: var(--s4); }
.tl { display: flex; flex-direction: column; }
.tl-row { display: grid; grid-template-columns: 76px minmax(110px, 1fr) 96px minmax(240px, 2.6fr) 176px 56px; gap: var(--s3); align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.tl-axis { border-top: 0; padding-top: 0; font: 500 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.tl-type { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.tl-type .mono { font-size: var(--fs-label); }
.tl-track { position: relative; height: 34px; }
.tl-axis .tl-track { height: 18px; }
.tl-tick { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.tl-today-label { position: absolute; top: 2px; transform: translateX(-50%); color: var(--text); background: var(--bg-1); padding: 0 4px; }
.tl-bar { position: absolute; top: 7px; height: 6px; border-radius: 3px; background: var(--na); transform-origin: left center; }
.tl-bar.covered { background: var(--covered); } .tl-bar.gap { background: rgba(229, 83, 75, 0.55); } .tl-bar.partial { background: var(--partial); }
.tl-due { position: absolute; top: 4px; width: 2px; height: 12px; background: var(--partial); }
.tl-over { position: absolute; top: 5px; height: 10px; border-radius: 0 3px 3px 0; background: repeating-linear-gradient(-45deg, rgba(229, 83, 75, 0.9) 0 3px, rgba(229, 83, 75, 0.25) 3px 6px); transform-origin: left center; }
.tl-today { position: absolute; top: -10px; bottom: -10px; width: 1px; background: rgba(255, 255, 255, 0.55); }
.tl-note { position: absolute; left: 0; bottom: 0; font: 500 10.5px var(--mono); color: var(--muted); white-space: nowrap; }
.tl-note.bad { color: var(--gap); }
.tl-dates { font-size: var(--fs-label); color: var(--muted); }
.tl-row.overdue .mono.strong { color: var(--gap); }

/* Motion: entrance choreography (Readiness) */
.m-enter .instrument { animation: fadeIn var(--t3) var(--ease) both; }
.m-enter .ic, .m-enter .kpi { animation: fadeUp var(--t3) var(--ease) both; animation-delay: 120ms; }
.m-enter .cell { animation: cellIn var(--t2) var(--ease) both; animation-delay: calc(240ms + var(--i) * 14ms); }
.m-enter .alert { animation: fadeUp var(--t3) var(--ease) 420ms both; }
.m-enter .seg { animation: fadeUp var(--t3) var(--ease) both; animation-delay: calc(360ms + var(--i) * 40ms); }
.m-enter .tile { animation: fadeUp var(--t3) var(--ease) both; animation-delay: calc(420ms + var(--i) * 16ms); }
.m-enter .rail-card { animation: fadeUp var(--t3) var(--ease) both; animation-delay: 820ms; }
.m-enter .rail-card + .rail-card { animation-delay: 900ms; }
.m-enter .tl-bar, .m-enter .tl-over { animation: growX var(--t3) var(--ease) both; animation-delay: calc(700ms + var(--i) * 60ms); }
/* Re-check: tiles work, changed tiles cross-fade and flash once */
.is-checking .tile { animation: checking 1s ease-in-out infinite; animation-delay: calc(var(--i) * 30ms); }
.is-checking .cell { animation: checking 1s ease-in-out infinite; animation-delay: calc(var(--i) * 30ms); }
.tile.changed::before { animation: statusIn var(--t4) var(--ease) both; }
.tile.changed::after { box-shadow: 0 0 0 1px var(--text), 0 0 24px rgba(255, 255, 255, 0.18); animation: ring 1100ms var(--ease) both; }
.m-enter .tile.changed::after, .m-enter .tile.changed::before { animation-delay: 1000ms; }
.m-update .tile.changed::after, .m-update .tile.changed::before { animation-delay: 150ms; }

/* ---------------------------------------------------------------- Drawer */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6); opacity: 0; visibility: hidden; transition: opacity var(--t2) var(--ease), visibility 0s linear var(--t2); }
.scrim.open { opacity: 1; visibility: visible; transition: opacity var(--t2) var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 41; width: min(600px, 100vw); background: var(--bg-1); border-left: 1px solid var(--line-2); overflow-y: auto; transform: translateX(100%); visibility: hidden; transition: transform var(--t3) var(--ease), visibility 0s linear var(--t3); }
.drawer.open { transform: none; visibility: visible; transition: transform var(--t3) var(--ease); }
.drawer-inner > div { min-height: 100vh; display: flex; flex-direction: column; padding: var(--s5) var(--s5) 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.drawer-id { display: flex; align-items: center; gap: var(--s2); }
.drawer-title { font-size: var(--fs-xl); letter-spacing: -0.025em; margin-bottom: var(--s2); }
.drawer-plain { font-size: var(--fs-md); color: var(--text-2); }
.expects { font-size: var(--fs-sm); color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.dsec { padding: var(--s4) 0; border-top: 1px solid var(--line); }
.dsec > .label { display: block; margin-bottom: var(--s2); }
.rule { margin-top: var(--s2); padding: var(--s2) var(--s3); border-left: 2px solid var(--partial); background: var(--bg-2); border-radius: 0 var(--r1) var(--r1) 0; font-size: var(--fs-sm); color: var(--text-2); }
.rule .label { display: block; color: var(--partial); }
.strength { display: flex; gap: 3px; margin-bottom: 4px; }
.strength span { flex: 1; height: 5px; border-radius: 2px; }
.strength .covered { background: var(--covered); } .strength .partial { background: var(--partial); }
.ev { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin-bottom: 6px; }
.ev-file { font-weight: 500; font-size: var(--fs-sm); }
.ev blockquote { padding-left: var(--s3); border-left: 1px solid var(--line-3); margin-bottom: 6px; }
.ev p:last-child { margin: 0; }
.doc { padding: var(--s2) 0; border-top: 1px solid var(--line); }
.doc summary { cursor: pointer; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc pre { margin: var(--s2) 0; padding: var(--s3); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r1); }
.drawer-foot { position: sticky; bottom: 0; margin: auto calc(-1 * var(--s5)) 0; padding: var(--s3) var(--s5); border-top: 1px solid var(--line); background: var(--bg-1); display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.fresh .drawer-title, .fresh .drawer-plain, .fresh .expects { animation: fadeUp var(--t3) var(--ease) both; animation-delay: 80ms; }
.fresh .dsec { animation: fadeUp var(--t3) var(--ease) both; animation-delay: 160ms; }
.fresh .ev { animation: fadeUp var(--t3) var(--ease) both; animation-delay: calc(200ms + var(--i) * 50ms); }

/* ---------------------------------------------------------------- Inbox */
.drop.big { position: relative; padding: var(--s6) var(--s5); text-align: center; border-radius: var(--r2); background: var(--bg-1);
  background-image: linear-gradient(90deg, var(--line-3) 50%, transparent 0), linear-gradient(90deg, var(--line-3) 50%, transparent 0), linear-gradient(0deg, var(--line-3) 50%, transparent 0), linear-gradient(0deg, var(--line-3) 50%, transparent 0);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y; background-size: 10px 1px, 10px 1px, 1px 10px, 1px 10px; background-position: 0 0, 0 100%, 0 0, 100% 0; transition: background-color var(--t2) var(--ease); }
.drop.big.over { background-color: var(--bg-2); background-image: linear-gradient(90deg, var(--text) 50%, transparent 0), linear-gradient(90deg, var(--text) 50%, transparent 0), linear-gradient(0deg, var(--text) 50%, transparent 0), linear-gradient(0deg, var(--text) 50%, transparent 0); animation: ants 0.6s linear infinite; }
.drop-art { width: 44px; height: 44px; margin: 0 auto var(--s3); display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; color: var(--text-2); }
.drop-art svg { width: 22px; height: 22px; }
.drop.big.over .drop-art { transform: translateY(-3px); transition: transform var(--t2) var(--ease); }
.drop.big h2 { margin-bottom: var(--s2); }
.drop.big .muted { max-width: 48ch; margin: 0 auto; font-size: var(--fs-sm); }
.answer.over { outline: 1px dashed var(--text); outline-offset: 4px; }
.asking.has { border-color: var(--line-3); }
.req { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.panel > .req:first-of-type, details > .req:first-of-type { border-top: 0; }
.req header { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 6px; }
.req h3 { font-size: var(--fs-body); font-weight: 600; margin-bottom: 4px; }
.req .answer { margin-top: var(--s3); }
.decline { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--line); }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.items { list-style: none; margin: 0 calc(-1 * var(--s4)); padding: 0; }
.items li { padding: var(--s3) var(--s4); border-top: 1px solid var(--line); transition: background var(--t1) var(--ease); }
.items li:hover { background: var(--bg-2); }
.item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.item-head b { font-weight: 600; font-size: var(--fs-sm); }
.items .sum { font-size: var(--fs-sm); color: var(--text-2); margin: 2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.items li.new { animation: fadeUp var(--t3) var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.items li.new .chip { animation: pop var(--t2) var(--ease) both; animation-delay: calc(var(--i) * 40ms + 200ms + var(--j, 0) * 40ms); }
.working { font-style: italic; }

/* ---------------------------------------------------------------- Decisions */
.decision { display: flex; flex-direction: column; gap: var(--s2); transition: transform var(--t2) var(--ease), border-color var(--t1) var(--ease); }
.decision:hover { transform: translateY(-2px); border-color: var(--line-2); }
.decision header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.decision h3 { font-size: 17px; }
.decision .body { color: var(--text-2); font-size: var(--fs-sm); white-space: pre-wrap; margin: 0; }
.decision footer { margin-top: auto; }
.decided .decision { opacity: 0.7; }
.history { font-size: var(--fs-xs); }
.view.route-in .decision { animation: fadeUp var(--t3) var(--ease) both; animation-delay: calc(80ms + var(--i) * 60ms); }

/* ---------------------------------------------------------------- People */
.person { display: flex; flex-direction: column; gap: var(--s2); }
.person-head { display: flex; align-items: center; gap: var(--s3); }
.person-head h3 { font-size: var(--fs-md); }
.person-tags { display: flex; gap: 6px; align-items: center; }
.person > p { font-size: var(--fs-sm); color: var(--text-2); margin: 0; }
.knows { display: flex; flex-wrap: wrap; gap: 4px; }
.person-stats { display: flex; gap: var(--s4); font-size: var(--fs-xs); color: var(--muted); padding-top: var(--s2); border-top: 1px solid var(--line); margin: 0; }
.person-stats b { color: var(--text); font-weight: 600; }
.person.inactive { opacity: 0.55; }
.note { padding: var(--s2) 0 var(--s2) var(--s3); border-left: 2px solid var(--partial); }
.note.accepted { border-left-color: var(--covered); }
.note blockquote { margin: 6px 0; }
.login-row { display: flex; gap: var(--s2); }
.login-row input { padding: 6px 10px; font-size: var(--fs-sm); }
.view.route-in .person { animation: fadeUp var(--t3) var(--ease) both; animation-delay: calc(60ms + var(--i) * 40ms); }
.form { display: grid; gap: var(--s3); }
.form.two { grid-template-columns: 1fr 1fr; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.form .wide { grid-column: 1 / -1; }
.form .check { flex-direction: row; align-items: center; gap: var(--s2); }
.form .check input { width: auto; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

/* ---------------------------------------------------------------- Vault */
.vault { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--s4); height: calc(100vh - 220px); min-height: 380px; }
.tree, .preview { overflow: auto; }
.tree ul { list-style: none; padding-left: 14px; margin: 0; }
.tree > ul { padding: 0; }
.tree summary { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); padding: 4px 6px; border-radius: var(--r1); }
.tree summary::before { content: ""; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform var(--t1) var(--ease); }
.tree details[open] > summary::before { transform: rotate(90deg); }
.tree summary:hover, .file:hover { background: var(--bg-2); }
.folder { flex: 1; }
.count.mono { font-size: 10px; color: var(--faint); }
.file { display: block; width: 100%; font: inherit; font-size: var(--fs-sm); text-align: left; color: var(--text-2); background: none; border: 0; padding: 4px 6px; border-radius: var(--r1); cursor: pointer; overflow-wrap: anywhere; }
.file.on { color: var(--text); background: var(--bg-3); }
.preview-head { position: sticky; top: calc(-1 * var(--s4)); display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); background: var(--bg-1); }
.preview-head > div { display: flex; flex-direction: column; min-width: 0; }
.preview img { max-width: 100%; }

/* ---------------------------------------------------------------- Agent */
.agent-hero { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: var(--s6); align-items: center; padding: var(--s5); margin-bottom: var(--s4); border: 1px solid var(--line); border-radius: var(--r3); background: var(--bg-1); }
.hero-state { display: flex; flex-direction: column; gap: 4px; }
.state { display: inline-flex; align-items: center; gap: 12px; font-size: var(--fs-hero); font-weight: 700; letter-spacing: -0.04em; line-height: 1; text-transform: uppercase; }
.state i { width: 12px; height: 12px; border-radius: 50%; background: var(--faint); flex: none; }
.state.ready i { background: var(--covered); }
.state.locked, .state.error { color: var(--gap); }
.state.locked i, .state.error i { background: var(--gap); }
.agent-hero.live .state i { background: var(--text); animation: beaconWhite 1.4s ease-out infinite; }
.hero-main p { margin: 0 0 6px; font-size: var(--fs-sm); color: var(--text-2); }
.hero-stats { display: flex; gap: var(--s5); }
.hero-stats span { display: flex; flex-direction: column; }
.hero-stats b { font-size: var(--fs-xl); font-weight: 600; line-height: 1.1; }
.job-tools { display: grid; grid-template-columns: 64px 1fr; gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.job-tools:first-of-type { border-top: 0; }
.job-tools > div { display: flex; flex-wrap: wrap; gap: 4px; }
.tool { color: var(--text-2); }
.rule-list li { position: relative; padding: 6px 0 6px 16px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--text-2); }
.rule-list li:first-child { border-top: 0; }
.rule-list li::before { content: "×"; position: absolute; left: 0; color: var(--faint); font-family: var(--mono); }
tr.running td { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
tr.bad td:first-child { box-shadow: inset 2px 0 0 var(--gap); }
.log { list-style: none; padding: 0; margin: 0; max-height: 520px; overflow: auto; font: 11.5px/1.5 var(--mono); }
.log li { display: grid; grid-template-columns: 64px 64px 48px minmax(0, 1fr); gap: var(--s2); padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; color: var(--text-2); }
.log li:first-child { border-top: 0; }
.log .kind { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.log .k-refused, .log .k-denied { color: var(--gap); }
.log .k-rule { color: var(--partial); }
.log li.new { animation: slideIn var(--t3) var(--ease) both; animation-delay: calc(var(--i) * 50ms); }

/* ---------------------------------------------------------------- Dialogs, toast */
.dialog { width: min(480px, 92vw); padding: var(--s5); border: 1px solid var(--line-2); border-radius: var(--r3); background: var(--bg-1); color: var(--text); }
.dialog[open] { animation: dialogIn var(--t2) var(--ease); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
.dialog h2 { margin-bottom: var(--s2); }
.dialog footer { display: flex; gap: var(--s2); margin-top: var(--s4); flex-wrap: wrap; }
.dialog.wide { width: min(980px, calc(100vw - 24px)); max-width: none; }
#rec video { width: 100%; max-height: 50vh; background: #000; border-radius: var(--r2); }
.captions { max-height: 120px; overflow: auto; font-size: var(--fs-sm); }
.captions p { margin: 2px 0; }
.viewer { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--s5); margin-top: var(--s3); }
.viewer .stage video, .viewer .stage img { width: 100%; max-height: 60vh; background: #000; border-radius: var(--r2); object-fit: contain; }
.viewer .stage audio { width: 100%; }
.viewer .side { max-height: 70vh; overflow: auto; }
.viewer .side section + section { margin-top: var(--s4); }
.viewer .side p { margin: 4px 0; }
.look { display: grid; grid-template-columns: 96px 1fr; gap: var(--s3); margin: var(--s3) 0; }
.look img { width: 96px; border-radius: var(--r1); }
.look:has(> div:only-child) { grid-template-columns: 1fr; }
.toast { position: fixed; left: 50%; bottom: var(--s5); z-index: 60; max-width: min(560px, 90vw); padding: 10px 16px; border-radius: var(--r2); border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text); font-size: var(--fs-sm); pointer-events: none; opacity: 0; transform: translate(-50%, 16px); transition: opacity var(--t2) var(--ease), transform var(--t2) var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: var(--s4); padding: var(--s7) clamp(32px, 6vw, 96px); border-right: 1px solid var(--line); }
.auth-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(ellipse at 30% 50%, #000 20%, transparent 75%); }
.auth-hero > * { position: relative; }
.auth-word { font-size: clamp(76px, 11vw, 168px); font-weight: 800; letter-spacing: -0.06em; line-height: 0.85; margin: var(--s2) 0 0 -0.04em; animation: fadeUp var(--t4) var(--ease) both; }
.auth-tag { font-size: clamp(18px, 1.6vw, 24px); font-weight: 500; color: var(--text-2); margin: 0; animation: fadeUp var(--t4) var(--ease) 80ms both; }
.auth-lede { max-width: 52ch; color: var(--muted); font-size: var(--fs-body); margin: 0; animation: fadeUp var(--t4) var(--ease) 140ms both; }
.auth-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: var(--s4) 0 0; max-width: 680px; border-top: 1px solid var(--line); animation: fadeUp var(--t4) var(--ease) 200ms both; }
.auth-facts div { padding: var(--s3) var(--s3) 0 0; }
.auth-facts dt { font: 500 var(--fs-label) var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.auth-facts dd { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }
.auth-side { display: flex; flex-direction: column; justify-content: center; gap: var(--s5); padding: var(--s7) clamp(24px, 5vw, 80px); }
.auth-side > * { width: 100%; max-width: 520px; }
.demo-head h2 { font-size: var(--fs-xl); letter-spacing: -0.025em; margin: 6px 0 4px; }
.demo-head p { margin: 0; font-size: var(--fs-sm); }
.demo-list { margin-top: var(--s4); border-top: 1px solid var(--line); }
.demo-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: var(--s3); width: 100%; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background var(--t1) var(--ease), padding var(--t2) var(--ease); }
.demo-row:hover { background: var(--bg-1); padding-left: 10px; }
.demo-role { font: 500 var(--fs-label) var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.demo-row:nth-child(-n + 2) .demo-role { color: var(--text); }
.demo-who { display: flex; flex-direction: column; min-width: 0; }
.demo-who b { font-size: var(--fs-md); font-weight: 600; }
.demo-who span { font-size: var(--fs-xs); color: var(--muted); }
.demo-go { color: var(--faint); transition: transform var(--t1) var(--ease), color var(--t1) var(--ease); }
.demo-row:hover .demo-go { transform: translateX(4px); color: var(--text); }
.auth-or { display: flex; align-items: center; gap: var(--s3); font: 500 var(--fs-label) var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tabs { display: flex; gap: 2px; padding: 3px; margin-bottom: var(--s4); border: 1px solid var(--line); border-radius: var(--r2); }
.auth-form [role="tablist"] button { flex: 1; font: 500 var(--fs-sm) var(--sans); padding: 7px; border: 0; border-radius: var(--r1); background: none; color: var(--muted); cursor: pointer; transition: background var(--t1) var(--ease), color var(--t1) var(--ease); }
.auth-form [role="tablist"] button.on { background: var(--bg-3); color: var(--text); }
.auth-form .err:empty { display: none; }
.auth-form .err { margin: var(--s3) 0 0; }

/* ---------------------------------------------------------------- Keyframes */
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes cellIn { from { opacity: 0; transform: scaleY(0.2); } to { opacity: 1; transform: none; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: none; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: none; } }
@keyframes pulse { 50% { opacity: 0.4; } }
@keyframes checking { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes ring { 0% { opacity: 0; transform: scale(0.98); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.04); } }
@keyframes statusIn { from { background: var(--was, var(--na)); opacity: 0.4; } to { opacity: 1; } }
@keyframes glow { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
@keyframes labelFlash { 0%, 100% { color: var(--text-2); } 20% { color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, 0.5); } }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(229, 83, 75, 0.55); } 100% { box-shadow: 0 0 0 10px rgba(229, 83, 75, 0); } }
@keyframes beaconWhite { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5); } 100% { box-shadow: 0 0 0 12px rgba(255, 255, 255, 0); } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes ants { to { background-position: 10px 0, -10px 100%, 0 -10px, 100% 10px; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes dialogIn { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1280px) {
  .instrument { grid-template-columns: 148px minmax(0, 1fr); grid-template-areas: "face main" "kpis kpis" "actions actions"; }
  .inst-face { width: 148px; height: 148px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--line); margin-top: var(--s2); }
  .kpi { border-bottom: 0; border-right: 1px solid var(--line); }
  .kpi:last-child { border-right: 0; }
  .inst-actions { justify-content: flex-start; padding-left: 0; }
  .ready-grid { grid-template-columns: minmax(0, 1fr) 280px; }
}

/* Voice memo: press and hold */
.btn.ptt { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn.ptt.on { background: var(--gap); border-color: var(--gap); color: #fff; }
.ptt-live { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 21; width: min(560px, calc(100vw - 32px)); background: var(--bg-3); color: var(--text); border: 1px solid var(--line-3); padding: 10px 16px; border-radius: var(--r2); box-shadow: 0 6px 24px rgb(0 0 0 / 0.4); }
.ptt-live p { margin: 2px 0; }
.ptt-live .ptt-words { font-size: 0.95em; max-height: 4.5em; overflow: hidden; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; margin-right: 8px; vertical-align: middle; animation: rec-pulse 1s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: 0.35; } }
@media (max-width: 1100px) {
  .ready-grid { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .tl-row { grid-template-columns: 70px minmax(90px, 1fr) 92px minmax(200px, 2.4fr) 56px; }
  .tl-dates { display: none; }
  .agent-hero { grid-template-columns: minmax(0, 1fr) auto; }
  .hero-main { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 1023px) {
  .shell-side { position: sticky; top: 0; inset: auto; width: auto; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4) 0; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(5, 13, 10, 0.92); backdrop-filter: blur(10px); }
  .brand { flex-direction: row; align-items: baseline; gap: var(--s3); padding: 0; }
  .brand-tag, .client { display: none; }
  .side-foot { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; padding: 0; border: 0; gap: var(--s2); }
  .side-foot .btn { align-self: center; }
  .who { margin: 0; padding: 2px; }
  .who-text { display: none; }
  .nav { grid-column: 1 / -1; grid-row: 2; flex-direction: row; overflow-x: auto; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s3) var(--s2); scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 7px 11px; }
  .nav-icon { display: none; }
  .nav-ind { box-shadow: inset 0 -2px 0 var(--text); }
  .view { padding: var(--s5) var(--s4) var(--s7); }
  .heat-wrap { top: 92px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .vault { grid-template-columns: minmax(0, 1fr); height: auto; }
  .tree { max-height: 320px; }
  .viewer { grid-template-columns: minmax(0, 1fr); }
  .viewer .side { max-height: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { border-right: 0; border-bottom: 1px solid var(--line); padding: var(--s6) var(--s4) var(--s5); }
  .auth-side { padding: var(--s5) var(--s4) var(--s7); justify-content: flex-start; }
}
@media (max-width: 640px) {
  .mode { display: none; }
  .view { padding: var(--s4) var(--s3) var(--s7); }
  .instrument { grid-template-columns: minmax(0, 1fr); grid-template-areas: "face" "main" "kpis" "actions"; padding: var(--s4); gap: var(--s3); }
  .inst-face { justify-self: center; }
  .inst-counts { gap: var(--s2); }
  .ic-n { font-size: var(--fs-xl); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: var(--s2) var(--s3); border-right: 0; border-bottom: 1px solid var(--line); }
  .kpi:nth-child(odd) { border-right: 1px solid var(--line); }
  .kpi:nth-child(n + 3) { border-bottom: 0; }
  .kpi-n { font-size: var(--fs-xl); }
  .inst-actions .btn { flex: 1; }
  .heat-wrap { top: 88px; }
  .heat > .label, .heat-pct { display: none; }
  .cell { height: 22px; }
  .cell span { display: none; }
  .cell.gap-before { margin-left: 3px; }
  .alert { flex-wrap: wrap; row-gap: var(--s2); }
  .alert-text { flex: 1 1 100%; order: 3; }
  .alert-go { order: 4; }
  .pdca { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pdca::-webkit-scrollbar { display: none; }
  .seg { flex: 0 0 118px; }
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tile { min-height: 96px; padding: 10px 10px 10px 14px; }
  .rail { grid-template-columns: minmax(0, 1fr); }
  .tl-axis { display: none; }
  .tl-row { grid-template-columns: auto 1fr auto; row-gap: 6px; }
  .tl-row .tl-type { grid-column: 2; }
  .tl-row .tl-track { grid-column: 1 / -1; grid-row: 2; }
  .tl-src { display: none; }
  .drawer-inner > div { padding: var(--s4) var(--s4) 0; }
  .drawer-foot { margin: auto calc(-1 * var(--s4)) 0; padding: var(--s3) var(--s4); }
  .drawer-title { font-size: var(--fs-lg); }
  .agent-hero { grid-template-columns: minmax(0, 1fr); gap: var(--s4); padding: var(--s4); }
  .hero-main { grid-row: auto; }
  .state { font-size: var(--fs-display); }
  .log li { grid-template-columns: 58px 54px minmax(0, 1fr); }
  .log li > span:nth-child(3) { display: none; }
  .form.two, .pair { grid-template-columns: minmax(0, 1fr); }
  .auth-facts { grid-template-columns: minmax(0, 1fr); }
  .auth-lede, .auth-facts { display: none; }
  .demo-row { grid-template-columns: 72px minmax(0, 1fr) auto; }
  input, textarea { font-size: 16px; }
}

/* ---------------------------------------------------------------- Reduced motion: final states, instantly */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .tile.changed::after, .instrument::after { animation: none !important; opacity: 0 !important; }
  .tile:hover, .decision:hover, .cell:hover { transform: none; }
}

/* =============================================================================================
   ui-viz: visual command view. Charts carry the story; text is a label or a tooltip.
   ============================================================================================= */
.cmd { display: flex; flex-direction: column; gap: var(--s3); }
.cmd-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.cmd-title h1 { font-size: var(--fs-xl); letter-spacing: -0.03em; margin-top: 2px; }
.cmd-actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }

/* Stat chips double as filters */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) repeat(2, minmax(0, 1.1fr)); gap: var(--s2); }
.stat { position: relative; display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg-1); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; overflow: hidden; transition: border-color var(--t1) var(--ease), transform var(--t2) var(--ease), background var(--t1) var(--ease); }
.stat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--c, transparent); transform: scaleX(0.25); transform-origin: left; opacity: 0.8; transition: transform var(--t3) var(--ease); }
.stat:hover { transform: translateY(-2px); border-color: var(--line-3); }
.stat:hover::after, .stat.on::after { transform: scaleX(1); }
.stat.on { border-color: var(--c, var(--line-3)); background: var(--bg-2); }
.stat.covered { --c: var(--covered); } .stat.partial { --c: var(--partial); } .stat.gap { --c: var(--gap); } .stat.na { --c: var(--na); }
.stat-n { font-size: 40px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat.covered .stat-n { color: var(--covered); } .stat.partial .stat-n { color: var(--partial); } .stat.gap .stat-n { color: var(--gap); } .stat.na .stat-n { color: var(--muted); }
.stat-l { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-label) var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-l i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }

.strip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); align-items: stretch; }
.strip .alert { margin: 0; height: 100%; }
.strip .alert-text b { color: var(--gap); }
.side-rail .panel { padding: var(--s2) var(--s3); height: 100%; display: flex; align-items: center; gap: var(--s4); }
.side-rail .panel-head { margin: 0; flex-direction: column; align-items: flex-start; gap: 0; }
.faces { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s2); padding-top: 4px; }
.face { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; color: inherit; text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-3); font: 600 11px var(--mono); transition: transform var(--t2) var(--ease), border-color var(--t1) var(--ease); }
.face:hover .avatar { transform: translateY(-2px); border-color: var(--text); }
.face-n { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--partial); color: #1a1100; font: 700 10.5px/18px var(--mono); text-align: center; }
.face-l { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 10px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* The two centre charts */
.stage { display: grid; grid-template-columns: minmax(330px, 0.82fr) minmax(0, 1.18fr); gap: var(--s3); align-items: stretch; }
.hero-viz, .flow-viz { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.hero-viz { background-image: radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 0.045), transparent 62%); }
.sunburst, .sankey { width: 100%; height: auto; display: block; flex: 1; }
.sunburst { max-height: 440px; margin: 0 auto; overflow: visible; }
.sb-halo { fill: none; stroke: rgba(255, 255, 255, 0.05); stroke-width: 1; stroke-dasharray: 2 4; }
.sb-ticks line { stroke: rgba(255, 255, 255, 0.18); stroke-width: 0.7; }
.sb-g path { fill: rgba(255, 255, 255, calc(0.035 + var(--p) * 0.09)); stroke: var(--bg-1); stroke-width: 1; transition: fill var(--t1) var(--ease); }
.sb-g text { text-anchor: middle; pointer-events: none; }
.sb-g-num { font: 600 13px var(--mono); fill: var(--text); }
.sb-g-pct { font: 500 9.5px var(--mono); fill: var(--muted); }
.sb-c { cursor: pointer; outline: none; transition: opacity var(--t1) var(--ease), filter var(--t1) var(--ease); }
.sb-c path { stroke: var(--bg-1); stroke-width: 1.2; fill: var(--na); }
.sb-c.covered path { fill: var(--covered); } .sb-c.partial path { fill: var(--partial); } .sb-c.gap path, .sb-c.none path { fill: var(--gap); }
.sb-c.na path { fill: var(--bg-3); }
.sb-c:hover, .sb-c:focus-visible, .sb-c.hl { filter: brightness(1.18) drop-shadow(0 0 10px rgba(255, 255, 255, 0.18)); }
.sb-c:focus-visible path { stroke: var(--text); stroke-width: 2; }
.sb-lab { font: 500 8.5px var(--mono); fill: var(--muted); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.sb-c.hl .sb-lab, .sb-c:hover .sb-lab { fill: var(--text); }
.sb-pct { font: 650 54px var(--sans); letter-spacing: -0.05em; fill: var(--text); text-anchor: middle; font-variant-numeric: tabular-nums; }
.sb-sub { font: 500 9.5px var(--mono); letter-spacing: 0.22em; fill: var(--muted); text-anchor: middle; }
.sk-link { fill: none; stroke-opacity: 0.38; stroke: var(--na); transition: stroke-opacity var(--t1) var(--ease), opacity var(--t1) var(--ease); }
.sk-link.covered { stroke: var(--covered); } .sk-link.partial { stroke: var(--partial); } .sk-link.gap, .sk-link.none { stroke: var(--gap); }
.sk-link.hl { stroke-opacity: 0.85; }
.sk-node rect { fill: var(--text-2); }
.sk-node.clause rect { fill: var(--na); }
.sk-node.clause.covered rect { fill: var(--covered); } .sk-node.clause.partial rect { fill: var(--partial); } .sk-node.clause.gap rect, .sk-node.clause.none rect { fill: var(--gap); }
.sk-node text { font: 400 10.5px var(--sans); fill: var(--text-2); transition: fill var(--t1) var(--ease); }
.sk-node.clause { cursor: pointer; }
.sk-node.hl text, .sk-node:hover text { fill: #fff; }
.sk-id { font-family: var(--mono); fill: var(--muted); }
.sk-node.clause.gap .sk-id { fill: var(--gap); }
/* Linked highlight and status filter */
.cmd [data-hl], .cmd [data-st] { transition: opacity var(--t1) var(--ease), filter var(--t1) var(--ease); }
.cmd.has-hl [data-hl]:not(.hl) { opacity: 0.16; }
.cmd.has-hl .sb-g:not(.hl) { opacity: 0.45; }
.cmd.f-covered [data-st]:not([data-st="covered"]), .cmd.f-partial [data-st]:not([data-st="partial"]), .cmd.f-gap [data-st]:not([data-st="gap"]):not([data-st="none"]), .cmd.f-na [data-st]:not([data-st="na"]) { opacity: 0.1; }

/* Plan-Do-Check-Act matrix */
.mx-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s2); }
.mx-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: var(--s2); border-radius: var(--r2); background: var(--bg); border: 1px solid var(--line); scroll-margin-top: 80px; }
.mx-col.flash { animation: labelFlash 1200ms var(--ease); }
.mx-col header { display: flex; align-items: baseline; gap: 6px; }
.mx-num { font: 600 var(--fs-sm) var(--mono); }
.mx-name { flex: 1; font: 500 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mx-pct { font-weight: 600; font-size: var(--fs-sm); }
.mx-bar { display: flex; gap: 2px; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.mx-bar .covered { background: var(--covered); } .mx-bar .partial { background: var(--partial); } .mx-bar .gap { background: var(--gap); } .mx-bar .na { background: var(--na); }
.mx-cell { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 8px 11px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--bg-1); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: transform var(--t2) var(--ease), border-color var(--t1) var(--ease), opacity var(--t1) var(--ease); }
.mx-cell::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--na); }
.mx-cell.covered::before { background: var(--covered); } .mx-cell.partial::before { background: var(--partial); } .mx-cell.gap::before, .mx-cell.none::before { background: var(--gap); }
.mx-cell:hover, .mx-cell.hl { transform: translateY(-2px); border-color: var(--line-3); }
.mx-id { font: 500 10.5px var(--mono); color: var(--muted); }
.mx-title { font-size: 12.5px; font-weight: 500; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pips { display: flex; gap: 2px; align-items: center; min-height: 6px; }
.pips i { width: 6px; height: 6px; border-radius: 1.5px; background: var(--text-2); opacity: 0.7; }
.pips b { font: 600 9.5px var(--mono); color: var(--muted); margin-left: 2px; }
.mx-cell.changed { box-shadow: 0 0 0 1px var(--text); }
.is-checking .sb-c, .is-checking .mx-cell, .is-checking .sk-link { animation: checking 1s ease-in-out infinite; }
.cmd.glow-up .hero-viz { box-shadow: 0 0 0 1px var(--covered); transition: box-shadow 1.2s var(--ease); }
.cmd.glow-down .hero-viz { box-shadow: 0 0 0 1px var(--partial); }

/* Tooltip */
.tip { position: fixed; left: 0; top: 0; z-index: 80; max-width: 280px; padding: 8px 10px; border-radius: var(--r1); border: 1px solid var(--line-2); background: rgba(20, 22, 20, 0.96); backdrop-filter: blur(8px); pointer-events: none; opacity: 0; transition: opacity var(--t1) var(--ease); display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-xs); }
.tip.on { opacity: 1; }
.tip b { font-weight: 600; color: var(--text); font-size: var(--fs-sm); }
.tip span { color: var(--muted); }

/* Agent: layers and job timeline */
.agent-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s3); align-items: start; }
.layers { width: 100%; height: auto; display: block; }
.layer rect { fill: rgba(255, 255, 255, 0.022); stroke: var(--line-2); stroke-width: 1; transition: stroke var(--t1) var(--ease), fill var(--t1) var(--ease); }
.layer:hover rect { stroke: var(--text); fill: rgba(255, 255, 255, 0.05); }
.layer-n { font: 600 9.5px var(--mono); letter-spacing: 0.12em; fill: var(--text-2); }
.layer-s { font: 400 9.5px var(--mono); fill: var(--muted); }
.core circle { fill: var(--text); }
.core text { font: 700 8.5px var(--mono); letter-spacing: 0.14em; fill: #0a0b0a; }
.agent-hero.live .core circle { animation: pulse 1.2s ease-in-out infinite; }
.toolbelt { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s3); }
.toolbelt > div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.toolbelt .strong { width: 54px; font-size: var(--fs-xs); }
.jt { display: flex; flex-direction: column; gap: 4px; }
.jt-row { display: grid; grid-template-columns: 48px 52px minmax(0, 1fr) 40px; gap: var(--s2); align-items: center; font-size: var(--fs-xs); }
.jt-type { color: var(--muted); }
.jt-track { position: relative; height: 12px; border-radius: 3px; background: rgba(255, 255, 255, 0.04); }
.jt-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; background: var(--text-2); cursor: default; }
.jt-bar.assess { background: var(--text); } .jt-bar.draft { background: var(--muted); }
.jt-row.error .jt-bar { background: var(--gap); }
.jt-row.running .jt-bar { animation: pulse 1s ease-in-out infinite; }
.audit-head { margin-top: var(--s4); }
.hero-stats .bad b { color: var(--gap); }

@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage { grid-template-columns: minmax(0, 1fr); }
  .sunburst { max-width: 440px; }
  .mx-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-n { font-size: var(--fs-xl); }
  .strip { grid-template-columns: minmax(0, 1fr); }
  .mx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sankey text { font-size: 13px; }
  .cmd-actions { width: 100%; }
  .cmd-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .stat:hover, .mx-cell:hover, .mx-cell.hl, .face:hover .avatar { transform: none; }
}

.sk-leader { fill: none; stroke: var(--line-3); stroke-width: 0.7; }
.side-rail .panel-head .mono { font-size: var(--fs-lg); color: var(--text); }
.jt-bar { left: 0; }
.jt-ms { position: absolute; right: 4px; top: -1px; font-size: 10px; color: var(--muted); line-height: 14px; }

/* Inbox: submissions as a grid of file cards; the summary lives in the tooltip */
@media (min-width: 1024px) { .cols:has(.subs) { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); } }
.subs .items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s2); margin: 0; }
.subs .items li { position: relative; display: flex; flex-direction: column; gap: 6px; padding: var(--s3); padding-top: 34px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--bg); transition: transform var(--t2) var(--ease), border-color var(--t1) var(--ease); }
.subs .items li:hover { transform: translateY(-2px); border-color: var(--line-3); background: var(--bg-2); }
.subs .items .sum { display: none; }
.subs .item-head { flex-direction: column; align-items: flex-start; gap: 2px; }
.subs .item-head .idchip { position: absolute; top: 10px; right: 10px; }
.subs .item-head b { font-size: var(--fs-sm); line-height: 1.3; }
.subs .items li > .muted.small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-glyph { position: absolute; top: 10px; left: 12px; font: 600 9.5px var(--mono); letter-spacing: 0.08em; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--text-2); }
.k-video .file-glyph, .k-image .file-glyph { color: var(--text); border-color: var(--text-2); }
@media (max-width: 640px) { .subs .items { grid-template-columns: minmax(0, 1fr); } }

/* Group the four status filters apart from the two counts */
.stats > a.stat:first-of-type { margin-left: var(--s3); }
.stats > .stat.neutral { background: transparent; }
.hero-viz { background-image: radial-gradient(circle at 50% 56%, rgba(120, 255, 200, 0.06), transparent 60%); }
@media (max-width: 1200px) { .stats > a.stat:first-of-type { margin-left: 0; } }

/* Demo role switcher */
.demo-switch { display: flex; flex-direction: column; gap: 6px; padding: var(--s2) var(--s3) var(--s3); margin: 0 calc(-1 * var(--s1)); border: 1px solid var(--line-2); border-radius: var(--r2); background: rgba(190, 255, 225, 0.03); }
.demo-switch .label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.demo-switch .label i { width: 6px; height: 6px; border-radius: 50%; background: var(--text); animation: pulse 2s ease-in-out infinite; }
.demo-switch select { width: 100%; padding: 7px 28px 7px 10px; font: 500 var(--fs-sm) var(--sans); color: var(--text); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2385958d' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 10px center; border: 1px solid var(--line-2); border-radius: var(--r1); appearance: none; -webkit-appearance: none; cursor: pointer; }
.demo-switch select:hover { border-color: var(--line-3); }
@media (max-width: 1023px) {
  .demo-switch { flex-direction: row; align-items: center; padding: 0; margin: 0; border: 0; background: none; }
  .demo-switch .label { display: none; }
  .demo-switch select { width: auto; max-width: 46vw; padding: 5px 24px 5px 8px; font-size: var(--fs-xs); }
}

/* Readiness layout v2: stats on the left, the clause map as the centrepiece, evidence flow on the right */
.stage { grid-template-columns: 232px minmax(0, 1.12fr) minmax(0, 1fr); gap: var(--s3); align-items: stretch; }
.left-col { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.left-col .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.left-col .stats > a.stat:first-of-type { margin-left: 0; }
.left-col .stat { padding: 10px 12px; }
.left-col .stat-n { font-size: 34px; }
.left-col .stat.neutral { background: var(--bg-1); }
.left-col .stat.neutral .stat-n { font-size: 28px; }
.left-col .alert { margin: 0; flex-direction: column; align-items: flex-start; gap: 6px; padding: var(--s3); }
.alert-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: var(--fs-sm); color: var(--text-2); }
.alert-days { display: block; width: 100%; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; color: var(--gap); line-height: 1.1; }
.left-col .alert-dot { position: absolute; top: 14px; right: 14px; }
.left-col .alert { position: relative; }
.left-col .people { padding: var(--s3); flex: 1; }
.left-col .people .panel-head { margin-bottom: var(--s2); }
.left-col .people .panel-head .mono { font-size: var(--fs-lg); color: var(--text); }
.hero-viz { justify-content: center; }
.hero-viz .sunburst { max-height: none; width: 100%; max-width: 620px; }
.flow-viz .sankey { max-height: 640px; }
.sankey .sk-node text { font-size: 13.5px; }
.sankey text.sk-id { font: 500 11.5px var(--mono); fill: var(--text-2); }
.sankey .sk-node.clause.gap text.sk-id { fill: var(--gap); }
@media (max-width: 1200px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .left-col .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .left-col { display: grid; grid-template-columns: minmax(0, 1fr); }
  .hero-viz .sunburst { max-width: 520px; }
}
@media (max-width: 640px) {
  .left-col .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sankey .sk-node text { font-size: 13px; }
}

.back-home { position: absolute; top: var(--s5); left: clamp(32px, 6vw, 96px); font: 500 var(--fs-label) var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.back-home:hover { color: var(--text); }
@media (max-width: 1023px) { .back-home { position: static; margin-bottom: var(--s2); } }

/* Layer legend: the counts sit beside the diagram, so nothing overlaps inside the frames */
.layer-legend { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); }
.layer-legend li { display: grid; grid-template-columns: 22px minmax(0, 0.9fr) minmax(0, 1.4fr); gap: var(--s2); align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.layer-legend .mono { color: var(--muted); font-size: var(--fs-xs); }
.layer-legend b { font-weight: 600; }
.layer-legend .muted { font-size: var(--fs-xs); text-align: right; }
@media (max-width: 640px) { .layer-legend li { grid-template-columns: 22px minmax(0, 1fr); } .layer-legend .muted { grid-column: 2; text-align: left; } }

/* Inbox card meta: submitter and time always readable; the file name may truncate below them */
.item-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: var(--fs-xs); color: var(--text-2); }
.item-meta span + span::before { content: "·"; margin-right: 8px; color: var(--faint); }
.subs .item-file { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); }
