/* ==========================================================================
   Regulatory Data Hub · market monitoring and surveillance prototype
   A dense, light console. Hairlines mark containers, colour is kept for
   state, numbers are tabular, and nothing floats unless it is a popover.
   ========================================================================== */

@font-face { font-family: "Stack Sans Text"; font-weight: 200 700; font-style: normal; font-display: swap; src: url("../assets/fonts/stack-sans-text-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Stack Sans Headline"; font-weight: 200 700; font-style: normal; font-display: swap; src: url("../assets/fonts/stack-sans-headline-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 100 800; font-style: normal; font-display: swap; src: url("../assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 200 800; font-style: normal; font-display: swap; src: url("../assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2"); }

/* ntell.ai theme. Tokens follow the company site: ink, crimson and paper, with
   plum as the quiet second colour. Red, amber and green are kept for status. */
:root {
  color-scheme: light;
  /* surfaces */
  --bg: #ffffff;
  --bg-2: #f4f4f6;          /* paper */
  --bg-3: #eaeaef;          /* paper-2 */
  --line: #e2e2e8;
  --line-2: #d1d1da;
  /* ink */
  --ink: #17090c;
  --ink-2: #454049;
  --ink-3: #706b76;
  --ink-4: #a29ea9;
  /* brand */
  --brand: #d7143c;         /* crimson: the signal orb, active markers, links */
  --brand-ink: #ae0f30;
  --brand-bg: #fbe8ec;
  --brand-line: #f0a9b8;
  --night: #160b10;
  --navy: #17090c;          /* primary fills use ink */
  --navy-2: #d7143c;        /* and turn crimson on hover, as on the site */
  /* quiet second colour: selection, information, citations */
  --accent: #5b2a6e;
  --accent-bg: #f4eef7;
  --accent-line: #d9c6e0;
  /* RAG status: reserved, never used for a series */
  --crit: #c0182b;   --crit-bg: #fbe8ec;   --crit-line: #f0a9b8;   --crit-fill: #d7143c;
  --high: #b45309;   --high-bg: #fdf0e3;   --high-line: #f2cba4;
  --warn: #8a6100;   --warn-bg: #fff6d9;   --warn-line: #ecd58a;   --warn-mark: #e0a100;
  --good: #15803d;   --good-bg: #e7f4ec;   --good-line: #b3dcc0;
  /* charts: ink for the measure, grey for the comparator, crimson for the anomaly */
  --s1: #17090c;
  --s2: #d7143c;
  --s3: #5b2a6e;
  --s-mute: #a29ea9;
  --grid: #ededf1;
  --axis: #d1d1da;
  /* type */
  --sans: "Stack Sans Text", "Helvetica Neue", Arial, sans-serif;
  --head: "Stack Sans Headline", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, Menlo, monospace;
  --r: 6px;
  --side: 232px;
  --top: 52px;
  --shadow-pop: 0 1px 2px rgba(23, 9, 12, .06), 0 10px 28px rgba(23, 9, 12, .14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 13px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::selection { background: #f6d5dc; }
.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--line); overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; height: var(--top); padding: 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__mark svg { width: 100%; height: 100%; }
.brand__name { font: 600 13.5px/1.15 var(--head); letter-spacing: -.01em; color: var(--ink); }
.brand__sub { font-size: 10.5px; color: var(--ink-3); line-height: 1.3; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 6px 8px 12px; }
.nav__group { margin-top: 12px; padding: 0 8px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-4); }
.nav a {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--r);
  color: var(--ink-2); font-weight: 500; text-decoration: none; position: relative;
}
.nav a svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.nav a:hover { background: var(--bg-3); }
.nav a.on { background: var(--bg-3); color: var(--ink); }
.nav a.on svg { color: var(--navy); }
.nav a.on::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; background: var(--brand); border-radius: 0 2px 2px 0; }
.nav .count { margin-left: auto; font: 500 10.5px/1 var(--mono); color: var(--ink-3); background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 3px 5px; }
.nav .count.crit { color: var(--crit); border-color: var(--crit-line); background: var(--crit-bg); }
.side__foot { flex: none; border-top: 1px solid var(--line); padding: 12px 14px; font-size: 11px; color: var(--ink-3); line-height: 1.4; }
.powered { display: inline-flex; align-items: center; gap: 2px; color: var(--ink-3); font-size: 11px; text-decoration: none; white-space: nowrap; }
.powered:hover { text-decoration: none; color: var(--ink); }
.powered img { height: 26px; width: auto; display: block; }
.side__foot .powered { margin: 0 0 6px; }
.pagefoot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: auto; padding: 10px 20px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 11.5px; }
.pagefoot .powered { margin-left: auto; }
#view { flex: 1; }
.main { min-height: 100vh; }
.side__foot b { color: var(--ink-2); font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--ink-3); white-space: nowrap; flex: none; }
.crumbs b { color: var(--ink); font-weight: 600; }
.crumbs svg { width: 12px; height: 12px; color: var(--ink-4); }
.askbar {
  flex: 1; min-width: 140px; max-width: 520px; margin-left: auto; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); color: var(--ink-3);
}
.askbar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.askbar svg { width: 14px; height: 14px; flex: none; }
.askbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); }
.askbar input::placeholder { color: var(--ink-4); }
.kbd { font: 500 10.5px/1 var(--mono); color: var(--ink-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 2px 4px; background: var(--bg-2); }
.top__meta { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; }
.watch { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); color: var(--ink-2); text-decoration: none; white-space: nowrap; background: var(--bg); }
.watch:hover { background: var(--bg-2); text-decoration: none; }
.pulse { width: 11px; height: 11px; border-radius: 50%; background: var(--orb) center / cover no-repeat; position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid var(--brand); opacity: 0; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
.clock { font: 500 11.5px/1 var(--mono); color: var(--ink-2); white-space: nowrap; }
.rolesel { max-width: 172px; height: 30px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); padding: 0 6px; color: var(--ink-2); }
.user { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; text-align: left; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font: 600 11px/28px var(--sans); text-align: center; flex: none; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; line-height: 20px; }
.avatar.agent, .orb { background: var(--orb) center / cover no-repeat; color: transparent; border-radius: 50%; }
.orb { display: inline-block; width: 14px; height: 14px; flex: none; }
.avatar.lg { width: 52px; height: 52px; }

.banner { display: flex; align-items: center; gap: 10px; padding: 7px 20px; background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: #5c4100; font-size: 12px; }
.banner svg { width: 14px; height: 14px; flex: none; }
.banner button { margin-left: auto; }

.page { padding: 18px 20px 48px; max-width: 1680px; width: 100%; }
.phead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.phead h1 { font: 600 21px/1.25 var(--head); letter-spacing: -.02em; }
.phead p { color: var(--ink-3); margin-top: 2px; max-width: 86ch; }
.phead__act { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.ref { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1 var(--mono); color: var(--ink-3); border: 1px solid var(--line); border-radius: 3px; padding: 4px 6px; background: var(--bg-2); white-space: nowrap; vertical-align: 2px; margin-left: 8px; letter-spacing: 0; }

/* ---------- layout ---------- */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-3-1 { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.start { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.gap4 { gap: 4px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
@media (max-width: 1180px) {
  .g-2-1, .g-3-2, .g-1-2, .g-3-1, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1340px) { .user .who, .askbar .kbd { display: none; } }
@media (max-width: 1120px) { .clock, .watch .lbl { display: none; } .watch { padding: 0 9px; } }
@media (max-width: 860px) {
  .askbar { display: none; }
  .top__meta { margin-left: auto; gap: 6px; }
  .rolesel { max-width: 118px; }
  .crumbs > span, .crumbs > svg:first-of-type { display: none; }
  .watch { display: none; }
  .kan { grid-template-columns: repeat(6, 200px); }
  .zones { grid-template-columns: minmax(0, 1fr); }
  .zone { border-right-width: 1px; border-radius: 0 !important; margin-bottom: -1px; }
  .prio { grid-template-columns: 26px minmax(0, 1fr); }
  .prio__a { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: 6px; }
  .replay { grid-template-columns: minmax(0, 1fr); }
  .phead__act { margin-left: 0; flex-wrap: wrap; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; width: var(--side); transform: translateX(-100%); transition: transform .18s; }
  .side.open { transform: none; box-shadow: var(--shadow-pop); }
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  .top { padding: 0 12px; }
  .page { padding: 14px 12px 40px; }
  .phead { flex-wrap: wrap; }
}
.ibtn.menu-btn { display: none; }
@media (max-width: 860px) { .ibtn.menu-btn { display: inline-grid; } }

/* ---------- card ---------- */
.card { border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); min-width: 0; }
.card__h { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.card__h h3 { font: 600 13.5px/1.3 var(--head); letter-spacing: -.01em; white-space: nowrap; }
.card__h .sub { color: var(--ink-3); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__h .act { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.card__b { padding: 12px; }
.card__b.flush { padding: 0; overflow-x: auto; }
.card__f { padding: 7px 12px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 11.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.src { font: 400 11px/1.3 var(--mono); color: var(--ink-4); }
.src b { font-weight: 500; color: var(--ink-3); }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); overflow: hidden; }
.kpi { padding: 10px 12px 11px; border-right: 1px solid var(--line); margin-right: -1px; min-width: 0; position: relative; }
.kpi__l { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__v { font: 600 23px/1.2 var(--head); letter-spacing: -.015em; word-spacing: .04em; margin-top: 2px; white-space: nowrap; }
.kpi__v small { font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: 3px; }
.kpi__n { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.crit { box-shadow: inset 0 2px 0 var(--crit-fill); }
.kpi.warn { box-shadow: inset 0 2px 0 var(--warn-mark); }
.kpi.good { box-shadow: inset 0 2px 0 var(--good); }
a.kpi { color: inherit; text-decoration: none; }
a.kpi:hover { background: var(--bg-2); }
.delta { font: 500 11.5px/1 var(--sans); font-variant-numeric: tabular-nums; }
.delta.up-bad, .delta.down-bad { color: var(--crit); }
.delta.up-good, .delta.down-good { color: var(--good); }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); color: var(--ink); font-weight: 500;
  white-space: nowrap; text-decoration: none; flex: none;
}
.btn:hover { background: var(--bg-2); text-decoration: none; }
.btn:active { background: var(--bg-3); }
.btn svg { width: 14px; height: 14px; }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.pri:hover { background: var(--navy-2); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-3); }
.btn.danger { color: var(--crit); }
.btn[disabled], .btn.is-off { opacity: .45; pointer-events: none; }
.ibtn { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: var(--r); color: var(--ink-3); flex: none; }
.ibtn:hover { background: var(--bg-3); color: var(--ink); }
.ibtn svg { width: 15px; height: 15px; }
body.ro [data-write] { opacity: .45; pointer-events: none; }
.inp, .sel, textarea.inp {
  height: 30px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); padding: 0 8px; min-width: 0;
}
textarea.inp { height: auto; padding: 7px 8px; width: 100%; resize: vertical; line-height: 1.45; }
.inp:focus, .sel:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--bg); flex: none; }
.seg button { height: 28px; padding: 0 10px; border: 0; border-right: 1px solid var(--line-2); background: none; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--bg-2); }
.seg button.on { background: var(--navy); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--ink-2); font-size: 12px; white-space: nowrap; }
button.chip:hover { background: var(--bg-2); border-color: var(--ink-4); }
.chip.on { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); }

/* ---------- tags and state ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: 3px; font-size: 11.5px; font-weight: 500; white-space: nowrap; border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); }
.tag svg { width: 11px; height: 11px; }
.tag.crit { background: var(--crit-bg); border-color: var(--crit-line); color: var(--crit); }
.tag.high { background: var(--high-bg); border-color: var(--high-line); color: var(--high); }
.tag.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.tag.good { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.tag.info { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); }
.tag.plain { background: none; }
.tag.mono { font-family: var(--mono); font-size: 11px; }
.tag.wrap { white-space: normal; height: auto; padding: 2px 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--ink-4); }
.dot.crit { background: var(--crit-fill); } .dot.high { background: var(--high); } .dot.warn { background: var(--warn-mark); } .dot.good { background: var(--good); } .dot.info { background: var(--accent); }
.score { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 5px; border-radius: 3px; font: 600 12px/1 var(--mono); border: 1px solid var(--line-2); color: var(--ink-2); background: var(--bg); }
.score.crit { background: var(--crit-fill); border-color: var(--crit-fill); color: #fff; }
.score.high { background: var(--high-bg); border-color: var(--high-line); color: var(--high); }
.score.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.score.lg { min-width: 44px; height: 34px; font-size: 17px; }
.ai { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.ai svg { width: 12px; height: 12px; }
.cite { display: inline-flex; align-items: center; height: 17px; padding: 0 4px; margin: 0 1px; border: 1px solid var(--accent-line); border-radius: 3px; background: var(--accent-bg); color: var(--accent); font: 500 10.5px/1 var(--mono); vertical-align: 1px; text-decoration: none; white-space: nowrap; }
.cite:hover { background: #e8dbee; text-decoration: none; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg-2); position: sticky; top: 0; }
.tbl td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.dense td { padding: 5px 12px; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--bg-2); }
.tbl tbody tr.sel { background: var(--accent-bg); }
.tbl tbody tr.hl td { background: var(--brand-bg); }
.tbl .t1 { font-weight: 500; color: var(--ink); }
.tbl .t2 { color: var(--ink-3); font-size: 12px; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { position: relative; height: 34px; padding: 0 12px; border: 0; background: none; color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); font-weight: 600; }
.tabs button.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--brand); }
.tabs .n { font: 500 11px/1 var(--mono); color: var(--ink-4); margin-left: 5px; }

/* ---------- bars, meters ---------- */
.meter { height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; min-width: 40px; }
.meter i { display: block; height: 100%; background: var(--s1); border-radius: 3px; }
.meter.crit i { background: var(--crit-fill); } .meter.high i { background: #d9772c; } .meter.warn i { background: var(--warn-mark); } .meter.good i { background: var(--good); } .meter.ink i { background: var(--navy); }
.hbar { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) max-content; gap: 6px 10px; align-items: center; }
.hbar .trk { height: 12px; position: relative; }
.hbar .trk i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--s1); border-radius: 0 3px 3px 0; min-width: 2px; }
.hbar .trk i.mute { background: #d1d1da; }
.hbar .trk i.em { background: var(--navy); }
.hbar .trk b { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink-2); }
.hbar .v { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-weight: 500; }
.chart .ann { fill: var(--ink-2); font-size: 11px; }
.tip {
  position: fixed; z-index: 90; pointer-events: none; min-width: 150px; max-width: 280px; padding: 8px 10px; background: var(--bg);
  border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: 12px; opacity: 0; transition: opacity .08s;
}
.tip.on { opacity: 1; }
.tip h5 { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.tip .r { display: flex; align-items: center; gap: 6px; color: var(--ink-2); line-height: 1.6; }
.tip .r b { margin-left: auto; padding-left: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.key { width: 12px; height: 3px; border-radius: 2px; flex: none; display: inline-block; }
.key.sq { height: 10px; width: 10px; border-radius: 2px; }
.key.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat { display: grid; gap: 2px; font-size: 11px; }
.heat .c { height: 20px; border-radius: 2px; }
.heat .rl { color: var(--ink-2); white-space: nowrap; padding-right: 8px; align-self: center; }
.heat .cl { color: var(--ink-4); text-align: center; font-variant-numeric: tabular-nums; }
.spark { width: 84px; height: 22px; }

/* ---------- drawer, modal, toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(23, 9, 12, .32); opacity: 0; pointer-events: none; transition: opacity .15s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 75; width: min(640px, 96vw); background: var(--bg); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transform: translateX(102%); visibility: hidden; transition: transform .18s ease-out, visibility 0s .18s; }
.drawer.on { transform: none; visibility: visible; transition: transform .18s ease-out; }
.drawer.wide { width: min(860px, 96vw); }
.drawer__h { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.drawer__h h2 { font: 600 16px/1.3 var(--head); letter-spacing: -.015em; }
.drawer__b { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }
.drawer__f { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--bg-2); flex-wrap: wrap; }
.modal { position: fixed; z-index: 80; left: 50%; top: 12vh; transform: translateX(-50%); width: min(560px, 94vw); max-height: 78vh; display: none; flex-direction: column; background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow-pop); }
.modal.on { display: flex; }
.modal.wide { width: min(820px, 94vw); }
.modal__h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal__h h2 { font: 600 14.5px/1.3 var(--head); letter-spacing: -.01em; }
.modal__b { padding: 14px 16px; overflow-y: auto; }
.modal__f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--bg-2); border-radius: 0 0 6px 6px; }
.toasts { position: fixed; z-index: 95; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: flex-start; gap: 9px; max-width: 380px; padding: 9px 12px; background: var(--ink); color: #fff; border-radius: var(--r); box-shadow: var(--shadow-pop); font-size: 12.5px; animation: rise .18s ease-out; }
.toast svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.toast small { display: block; color: #c9bcc2; font-size: 11.5px; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.sect { margin-top: 18px; }
.sect:first-child { margin-top: 0; }
.sect > h4 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sect > h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.note { padding: 9px 11px; border: 1px solid var(--line); border-left: 3px solid var(--ink-4); border-radius: var(--r); background: var(--bg-2); color: var(--ink-2); font-size: 12.5px; }
.note.info { border-left-color: var(--accent); background: #f9f6fb; }
.note.warn { border-left-color: var(--warn-mark); background: #fffbee; }
.note.crit { border-left-color: var(--crit-fill); background: #fff5f6; }
.note.good { border-left-color: var(--good); background: #f4faf6; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }
.empty::before { content: ""; display: block; width: 22px; height: 22px; margin: 0 auto 10px; background: var(--orb) center / cover no-repeat; opacity: .9; }
pre.code { margin: 0; padding: 10px 12px; background: #f4f4f6; border: 1px solid var(--line); border-radius: var(--r); font: 400 11.5px/1.55 var(--mono); color: #2a2530; overflow-x: auto; white-space: pre; }
pre.code .k { color: #5b2a6e; font-weight: 500; } pre.code .s { color: #96500d; } pre.code .c { color: #8f8a98; }
.hash { font: 400 11px/1.4 var(--mono); color: var(--ink-3); overflow-wrap: anywhere; }

/* ---------- lists and timelines ---------- */
.list > li { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.list .t1 { font-weight: 500; }
.list .t2 { color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.tl { position: relative; }
.tl > li { position: relative; display: grid; grid-template-columns: 64px 14px minmax(0, 1fr); gap: 8px; padding: 0 0 12px; }
.tl > li::before { content: ""; position: absolute; left: 78px; top: 14px; bottom: -2px; width: 1px; background: var(--line); }
.tl > li:last-child::before { display: none; }
.tl time { font: 400 11px/1.6 var(--mono); color: var(--ink-3); text-align: right; white-space: nowrap; }
.tl .pt { width: 9px; height: 9px; margin: 5px auto 0; border-radius: 50%; border: 2px solid var(--ink-4); background: var(--bg); position: relative; z-index: 1; }
.tl .pt.crit { border-color: var(--crit-fill); background: var(--crit-fill); } .tl .pt.agent { border-color: var(--navy); } .tl .pt.good { border-color: var(--good); background: var(--good); } .tl .pt.warn { border-color: var(--warn-mark); background: var(--warn-mark); }
.tl .t1 { font-weight: 500; }
.tl .t2 { color: var(--ink-3); font-size: 12px; }
.steps { display: flex; align-items: stretch; gap: 0; overflow-x: auto; }
.step { flex: 1 1 0; min-width: 108px; padding: 9px 12px 10px; border: 1px solid var(--line); border-right-width: 0; background: var(--bg); position: relative; }
.step:first-child { border-radius: var(--r) 0 0 var(--r); }
.step:last-child { border-right-width: 1px; border-radius: 0 var(--r) var(--r) 0; }
.step .n { font: 500 10.5px/1 var(--mono); color: var(--ink-4); }
.step .t { font-weight: 600; margin-top: 4px; }
.step .d { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; }
.step.done { background: var(--bg-2); }
.step.done .n { color: var(--good); }
.step.now { background: var(--navy); border-color: var(--navy); color: #fff; }
.step.now .n, .step.now .d { color: #c9bcc2; }
.step.now + .step { border-left-color: var(--navy); }
.step.run { box-shadow: inset 0 -2px 0 var(--accent); }
.steps.v { flex-direction: column; }
.steps.v .step { border-right-width: 1px; border-bottom-width: 0; border-radius: 0; min-width: 0; padding: 7px 12px 8px; }
.steps.v .step:first-child { border-radius: var(--r) var(--r) 0 0; }
.steps.v .step:last-child { border-bottom-width: 1px; border-radius: 0 0 var(--r) var(--r); }
.steps.v .step.now + .step { border-left-color: var(--line); }
.smcr { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; vertical-align: middle; }
.smcr i { width: 5px; background: var(--navy); border-radius: 1px 1px 0 0; }
.smcr i:nth-child(n) { opacity: .85; }

/* ---------- workspace: brief, priorities, ask ---------- */
.brief { font-size: 14px; line-height: 1.6; color: var(--ink); max-width: 92ch; }
.brief .lede { display: block; font: 400 23px/1.25 var(--serif); letter-spacing: -.015em; color: var(--ink); margin-bottom: 8px; }
.brief p + p { margin-top: 8px; }
.prio { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
.prio:last-child { border-bottom: 0; }
.prio.done { background: var(--bg-2); }
.prio.done .prio__t { text-decoration: line-through; color: var(--ink-3); }
.prio__n { font: 600 13px/22px var(--mono); color: var(--ink-3); text-align: center; height: 22px; border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg); }
.prio.p1 .prio__n { background: var(--navy); border-color: var(--navy); color: #fff; }
.prio__t { font: 600 14px/1.35 var(--head); letter-spacing: -.01em; }
.prio__w { color: var(--ink-2); margin-top: 2px; max-width: 80ch; }
.prio__m { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 7px; color: var(--ink-3); font-size: 12px; }
.prio__m span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.prio__m svg { width: 12px; height: 12px; }
.prio__a { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.why { grid-column: 2 / -1; margin-top: 8px; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); }
.factors { display: grid; grid-template-columns: max-content 110px max-content minmax(0, 1fr); gap: 5px 10px; align-items: center; font-size: 12px; }
.ask { max-width: 980px; }
.ask__box { border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); padding: 10px 12px 8px; }
.ask__box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.ask__box textarea { width: 100%; border: 0; outline: 0; resize: none; background: none; font-size: 14px; line-height: 1.5; min-height: 44px; }
.qa { border-top: 1px solid var(--line); padding: 16px 0; }
.qa__q { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; }
.qa__a { margin: 10px 0 0 30px; }
.qa__a .lead { font-size: 13.5px; line-height: 1.6; max-width: 86ch; }
.qa__a .lead p + p { margin-top: 7px; }
.trace { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-3); }
.trace li { display: flex; gap: 8px; align-items: center; }
.trace svg { width: 12px; height: 12px; color: var(--good); flex: none; }
.trace li.run svg { color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
details.how { border: 1px solid var(--line); border-radius: var(--r); margin-top: 10px; background: var(--bg); }
details.how > summary { list-style: none; cursor: pointer; padding: 7px 10px; font-size: 12px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
details.how > summary::-webkit-details-marker { display: none; }
details.how > summary::before { content: ""; width: 5px; height: 5px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform .12s; flex: none; }
details.how[open] > summary::before { transform: rotate(45deg); }
details.how > div { padding: 2px 10px 10px; }
.hyp > li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.hyp > li:last-child { border-bottom: 0; }
.stream { font-size: 12px; }
.stream li { display: grid; grid-template-columns: 62px 74px minmax(0, 1fr); gap: 10px; padding: 5px 12px; border-bottom: 1px solid var(--line); align-items: baseline; }
.stream li.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-bg); } }
.stream time { font: 400 11px/1.5 var(--mono); color: var(--ink-3); }
.stream .k { font: 500 10.5px/1.5 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.stream .k.detect { color: var(--crit); } .stream .k.data { color: var(--warn); } .stream .k.action { color: var(--accent); } .stream .k.analysis { color: var(--navy); }

/* ---------- specific figures ---------- */
.zones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.zone { padding: 12px 14px; border: 1px solid var(--line); border-right-width: 0; position: relative; background: var(--bg); }
.zone:last-child { border-right-width: 1px; border-radius: 0 var(--r) var(--r) 0; }
.zone:first-child { border-radius: var(--r) 0 0 var(--r); }
.zone h4 { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.zone h4 .n { font: 500 11px/18px var(--mono); width: 18px; height: 18px; text-align: center; border-radius: 3px; background: var(--navy); color: #fff; }
.lin { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding-bottom: 2px; }
.lin__n { flex: 1; min-width: 150px; border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 11px; background: var(--bg); cursor: pointer; text-align: left; }
.lin__n:hover { border-color: var(--ink-4); }
.lin__n.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.lin__n .z { font: 500 10.5px/1 var(--mono); color: var(--ink-4); text-transform: uppercase; letter-spacing: .05em; }
.lin__n .t { font-weight: 600; margin-top: 5px; }
.lin__n .d { color: var(--ink-3); font-size: 11.5px; margin-top: 2px; overflow-wrap: anywhere; }
.lin__a { flex: none; width: 26px; display: grid; place-items: center; color: var(--ink-4); }
.lin__a svg { width: 14px; height: 14px; }
.doc { border: 1px solid var(--line-2); background: #fff; padding: 22px 24px; font: 400 11.5px/1.7 Georgia, "Times New Roman", serif; color: #1c1c1c; box-shadow: 0 1px 0 var(--line); }
.doc h5 { font: 700 13px/1.3 Georgia, serif; margin: 0 0 2px; }
.doc mark { background: #fff1b8; padding: 0 2px; border-bottom: 1.5px solid var(--warn-mark); }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.doc td { border: 1px solid #c9c9c9; padding: 3px 6px; }
.teams { border: 1px solid var(--line-2); border-left: 3px solid var(--crit-fill); border-radius: var(--r); padding: 10px 12px; background: var(--bg); font-size: 12.5px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 18px 14px; text-align: center; color: var(--ink-3); background: var(--bg-2); }
.drop.over { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.kan { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; }
.kan__c { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); min-height: 120px; }
.kan__c > h4 { padding: 8px 10px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.kan__i { display: block; margin: 8px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); color: inherit; text-decoration: none; }
.kan__i:hover { border-color: var(--navy); text-decoration: none; }
.replay { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); }
.replay input[type=range] { width: 100%; accent-color: var(--navy); }
.replay .t { font: 600 18px/1 var(--mono); color: var(--ink); }
.sys { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sys:last-child { border-bottom: 0; }
.sys__i { width: 28px; height: 28px; border-radius: var(--r); border: 1px solid var(--line-2); display: grid; place-items: center; font: 600 10.5px/1 var(--mono); color: var(--navy); background: var(--bg-2); flex: none; }
.sys.ok .sys__i { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.sys.run .sys__i { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); }
.matrix td.full { color: var(--good); font-weight: 500; }
.matrix td.none { color: var(--ink-4); }
.matrix th.me, .matrix td.me { background: var(--accent-bg); }
.funnel { display: flex; flex-direction: column; gap: 4px; }
.funnel > div { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 12px; }
.funnel i { display: block; height: 16px; background: var(--navy); border-radius: 2px; min-width: 3px; }
.ctrl { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); align-items: start; }
.ctrl .n { font: 500 11px/20px var(--mono); width: 22px; height: 20px; text-align: center; border: 1px solid var(--line-2); border-radius: 3px; color: var(--ink-3); }
@media print { .side, .top, .phead__act, .toasts { display: none !important; } .app { display: block; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- RAG status ---------- */
.rag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.rag i { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ink-4); }
.rag.r i { background: var(--crit-fill); } .rag.a i { background: var(--warn-mark); } .rag.g i { background: var(--good); }
.rag.r { color: var(--crit); } .rag.a { color: var(--warn); } .rag.g { color: var(--good); }
.ragrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.ragcell { display: block; padding: 10px 12px 11px 13px; border-right: 1px solid var(--line); margin-right: -1px; color: inherit; text-decoration: none; position: relative; min-width: 0; }
.ragcell::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink-4); }
.ragcell.r::before { background: var(--crit-fill); } .ragcell.a::before { background: var(--warn-mark); } .ragcell.g::before { background: var(--good); }
a.ragcell:hover { background: var(--bg-2); text-decoration: none; }
.ragcell b { display: block; font: 600 13.5px/1.3 var(--head); letter-spacing: -.01em; margin-top: 5px; }
.ragcell p { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.kpi__n .rag i { width: 8px; height: 8px; }
.agenthead { display: flex; align-items: flex-start; gap: 14px; }
.agenthead .avatar { margin-top: 2px; }
