/* Vigil AML demo — styles.
   Palette continues the Transingenium schematics document: cool grey ground,
   deep teal accent, brass for explanation, a restrained critical red. */
:root {
  color-scheme: light;
  --ground: #EDF0F3; --surface: #FFFFFF; --surface-2: #F5F7F9; --surface-3: #E9EEF2;
  --ink: #0F141A; --ink-2: #444E59; --ink-3: #66717C;
  --rule: #D8DEE4; --rule-strong: #A9B4BD;
  --accent: #0F5B73; --accent-2: #0A4557; --accent-soft: #DCEBF1; --accent-ink: #FFFFFF;
  --brass: #8A6410; --brass-soft: #F6EDD9; --brass-rule: #D9BF86;
  --crit: #A3372A; --crit-soft: #F7E3DF; --ok: #1D7A3C; --ok-soft: #DDF1E3; --warn: #8F6400; --warn-soft: #FAEFD5; --info: #1F5FA0; --info-soft: #E0ECF8;
  --side: #0B2530; --side-2: #10313E; --side-ink: #C4D3DA; --side-ink-2: #7E97A2; --side-hi: #FFFFFF;
  --s1: #1570A6; --s2: #D0781E; --s3: #1BAF7A;
  --q1: #cde2fb; --q2: #9ec5f4; --q3: #6da7ec; --q4: #3987e5; --q5: #256abf; --q6: #184f95; --q0: #F0F3F6; --tile-inv: #FFFFFF;
  --r-lo: #0ca30c; --r-md: #fab219; --r-hi: #ec835a; --r-vh: #d03b3b;
  --shadow: 0 1px 2px rgba(15, 20, 26, .06), 0 8px 24px -16px rgba(15, 20, 26, .28);
  --shadow-lg: 0 24px 60px -20px rgba(8, 20, 28, .45);
  --radius: 10px; --radius-sm: 6px;
  --f-ui: "Chivo", "Helvetica Neue", Arial, sans-serif;
  --f-read: "Newsreader", Georgia, serif;
  --f-num: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #0B0F12; --surface: #13191D; --surface-2: #192126; --surface-3: #202A30;
    --ink: #E4EAEE; --ink-2: #A5B1BA; --ink-3: #85919B;
    --rule: #263037; --rule-strong: #46525B;
    --accent: #5BB8D4; --accent-2: #86CDE2; --accent-soft: #11303B; --accent-ink: #06222B;
    --brass: #D9AE4E; --brass-soft: #2A2415; --brass-rule: #5E4B20;
    --crit: #EE8A79; --crit-soft: #3A201B; --ok: #5FCB82; --ok-soft: #14301E; --warn: #E7B54A; --warn-soft: #33290F; --info: #7DB3EA; --info-soft: #142838;
    --side: #080D10; --side-2: #10181D; --side-ink: #B5C3CA; --side-ink-2: #6F828C;
    --s1: #3E9AD6; --s2: #C9731F; --s3: #1F9E72;
    --q1: #16324f; --q2: #1c4a78; --q3: #256abf; --q4: #3987e5; --q5: #6da7ec; --q6: #9ec5f4; --q0: #1A2227; --tile-inv: #0B1620;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -16px rgba(0, 0, 0, .9);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0B0F12; --surface: #13191D; --surface-2: #192126; --surface-3: #202A30;
  --ink: #E4EAEE; --ink-2: #A5B1BA; --ink-3: #85919B;
  --rule: #263037; --rule-strong: #46525B;
  --accent: #5BB8D4; --accent-2: #86CDE2; --accent-soft: #11303B; --accent-ink: #06222B;
  --brass: #D9AE4E; --brass-soft: #2A2415; --brass-rule: #5E4B20;
  --crit: #EE8A79; --crit-soft: #3A201B; --ok: #5FCB82; --ok-soft: #14301E; --warn: #E7B54A; --warn-soft: #33290F; --info: #7DB3EA; --info-soft: #142838;
  --side: #080D10; --side-2: #10181D; --side-ink: #B5C3CA; --side-ink-2: #6F828C;
  --s1: #3E9AD6; --s2: #C9731F; --s3: #1F9E72;
  --q1: #16324f; --q2: #1c4a78; --q3: #256abf; --q4: #3987e5; --q5: #6da7ec; --q6: #9ec5f4; --q0: #1A2227; --tile-inv: #0B1620;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -16px rgba(0, 0, 0, .9);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--ink); font-family: var(--f-ui); font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }
p { margin: 0; }
.num, .mono { font-family: var(--f-num); font-size: .92em; letter-spacing: -.01em; }
.dim { color: var(--ink-3); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* TBot wordmark — the T is always emphasised */
.tbot-name { font-weight: 700; white-space: nowrap; }
.tbot-name > span { color: var(--s2); font-weight: 800; }

/* ============ shell ============ */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 12px 14px; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--side-hi); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(145deg, #1B7FA0, #0B4557); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.brand-mark svg { width: 20px; height: 20px; }
.brand b { display: block; font-size: 18px; letter-spacing: -.02em; font-weight: 800; }
.brand small { display: block; font-size: 11px; color: var(--side-ink-2); letter-spacing: .01em; }
.nav-g { margin: 10px 0 4px; padding: 0 10px; font-size: 11px; color: var(--side-ink-2); font-weight: 600; letter-spacing: .02em; }
.nav-g em { font-style: normal; font-family: var(--f-read); font-weight: 400; font-size: 12px; opacity: .85; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink); text-decoration: none; font-size: 13.5px;
  position: relative;
}
.nav a:hover { background: var(--side-2); color: var(--side-hi); }
.nav a.on { background: rgba(91, 184, 212, .14); color: var(--side-hi); }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #5BB8D4; }
.nav .badge { margin-left: auto; background: #C2412F; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; line-height: 18px; min-width: 20px; text-align: center; }
.nav .badge.soft { background: rgba(255,255,255,.12); color: var(--side-ink); }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: var(--side-ink-2); }
.side-foot .res { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; color: var(--side-ink); }
.side-foot .res i { width: 8px; height: 8px; border-radius: 50%; background: #3BC46B; box-shadow: 0 0 0 3px rgba(59,196,107,.18); }
.love { color: var(--side-ink-2); }
.love a { color: var(--side-hi); font-weight: 700; text-decoration: none; }
.love a:hover { text-decoration: underline; }
.love .heart { color: #E5484D; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: color-mix(in srgb, var(--ground) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.menu-btn { display: none !important; }
.crumbs { font-size: 13px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.clock { font-family: var(--f-num); font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--rule); border-radius: 99px; background: var(--surface); white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #2FB463; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,180,99,.55); } 70% { box-shadow: 0 0 0 7px rgba(47,180,99,0); } 100% { box-shadow: 0 0 0 0 rgba(47,180,99,0); } }
.picker { position: relative; }
.picker > button { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border: 1px solid var(--rule); border-radius: 99px; background: var(--surface); cursor: pointer; font-size: 13px; }
.picker > button:hover { border-color: var(--rule-strong); }
.picker .who { text-align: left; line-height: 1.15; }
.picker .who b { display: block; font-weight: 600; }
.picker .who small { color: var(--ink-3); font-size: 11.5px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; min-width: 260px; z-index: 50; }
.menu button, .menu label, .menu a { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink); text-decoration: none; }
.menu button:hover, .menu label:hover, .menu a:hover { background: var(--surface-2); }
.menu small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.menu .sep { height: 1px; background: var(--rule); margin: 5px 4px; }
.menu .cur { background: var(--accent-soft); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.corp { border-radius: 8px; background: var(--brass); color: #fff; }

.content { padding: 22px 24px 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-h h1 { font-size: 26px; font-weight: 700; letter-spacing: -.025em; }
.page-h .lede { color: var(--ink-2); margin-top: 3px; font-size: 14.5px; max-width: 70ch; }
.page-h .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.app-foot { padding: 18px 24px 26px; color: var(--ink-3); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; border-top: 1px solid var(--rule); }
.app-foot .love { color: var(--ink-3); }
.app-foot .love a { color: var(--ink); }

/* ============ explain captions ============ */
.explain {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start;
  background: var(--brass-soft); border: 1px solid var(--brass-rule); border-left: 4px solid var(--brass);
  border-radius: var(--radius-sm); padding: 14px 14px 14px 16px; margin: 0 0 18px; font-family: var(--f-read); color: var(--ink);
}
.explain-mark { color: var(--brass); padding-top: 2px; }
.explain-mark .ic { width: 20px; height: 20px; }
.explain-what { font-size: 17px; line-height: 1.45; }
.explain-why, .explain-try { font-size: 15.5px; line-height: 1.45; color: var(--ink-2); margin-top: 6px; }
.explain b { font-family: var(--f-ui); font-size: 13px; color: var(--brass); font-weight: 700; margin-right: 4px; }
.explain-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 2px; border-radius: 4px; }
.explain-x:hover { color: var(--ink); background: rgba(0,0,0,.05); }
.note { font-family: var(--f-read); font-size: 14.5px; color: var(--ink-2); margin-top: 10px; line-height: 1.45; }
.note::before { content: "ⓘ "; color: var(--brass); font-family: var(--f-ui); }
body.no-explain .explain, body.no-explain .note, body.no-explain .cap { display: none; }
.cap { font-family: var(--f-read); font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.term { border: 0; background: none; padding: 0; font: inherit; color: inherit; border-bottom: 1.5px dotted var(--brass); cursor: help; }

/* ============ buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-crit { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn-brass { background: var(--brass); border-color: var(--brass); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--rule); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn .ic { width: 16px; height: 16px; }
.field { display: grid; gap: 5px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.input, .field input, .field select, .field textarea {
  height: 40px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); padding: 0 12px; width: 100%;
}
.field textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field .err { color: var(--crit); font-size: 12.5px; }
.input-mono { font-family: var(--f-num); letter-spacing: .06em; }

/* ============ cards & grid ============ */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 360px; }
.span-2 { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .sub { color: var(--ink-3); font-size: 12.5px; width: 100%; margin-top: -6px; }
.card-h .r { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 14px 16px 16px; }
.card-b.flush { padding: 10px 0 0; }
.card.tint { background: var(--surface-2); box-shadow: none; }
.sec-t { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }

/* KPI cards: clickable, drill down */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(162px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  position: relative; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 12px; min-height: 118px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.kpi:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.kpi-l { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.kpi-v { font-size: clamp(22px, 2.1vw, 28px); font-weight: 700; letter-spacing: -.03em; font-feature-settings: "tnum" 1; line-height: 1.15; }
.kpi-s { font-size: 12.5px; color: var(--ink-3); }
.kpi-s .up { color: var(--ok); font-weight: 600; } .kpi-s .dn { color: var(--crit); font-weight: 600; }
.kpi-spark { position: absolute; left: 16px; right: 16px; bottom: 10px; height: 22px; opacity: .85; }
.kpi:has(.kpi-spark) { padding-bottom: 40px; }
.kpi-go { position: absolute; right: 10px; top: 12px; color: var(--ink-3); opacity: 0; transition: opacity .12s; }
.kpi:hover .kpi-go { opacity: 1; }
.kpi-crit { border-top: 3px solid var(--crit); }
.kpi-ok { border-top: 3px solid var(--ok); }
.kpi-brass { border-top: 3px solid var(--brass); }
.kpi-accent { border-top: 3px solid var(--accent); }
.spark { width: 100%; height: 100%; overflow: visible; }
.spark-l { fill: none; stroke: var(--s1); stroke-width: 1.8; }
.spark-a { fill: var(--s1); opacity: .1; }
.spark circle { fill: var(--s1); }
.spark-s2 .spark-l { stroke: var(--s2); } .spark-s2 .spark-a, .spark-s2 circle { fill: var(--s2); }
.spark-s3 .spark-l { stroke: var(--s3); } .spark-s3 .spark-a, .spark-s3 circle { fill: var(--s3); }

/* ============ chips & risk ============ */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 99px; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-crit { background: var(--crit-soft); color: var(--crit); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-brass { background: var(--brass-soft); color: var(--brass); }
.chip-mute { background: var(--surface-3); color: var(--ink-3); }
.risk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.risk i { width: 10px; height: 10px; border-radius: 3px; }
.risk b { font-family: var(--f-num); font-weight: 600; min-width: 2ch; }
.risk em { font-style: normal; color: var(--ink-2); }
.risk-lo i { background: var(--r-lo); } .risk-md i { background: var(--r-md); } .risk-hi i { background: var(--r-hi); } .risk-vh i { background: var(--r-vh); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 5px; border: 1px solid var(--rule); color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.tag-ai { border-color: color-mix(in srgb, var(--s2) 45%, transparent); color: var(--s2); background: color-mix(in srgb, var(--s2) 8%, var(--surface)); font-weight: 600; }
.tag-plug { border-style: dashed; color: var(--info); border-color: var(--info); }

/* ============ tables ============ */
.dt { display: flex; flex-direction: column; min-width: 0; }
.dt-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.dt-search { display: flex; align-items: center; gap: 8px; height: 34px; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 0 10px; background: var(--surface); min-width: 220px; flex: 0 1 300px; color: var(--ink-3); }
.dt-search:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.dt-search input { border: 0; outline: 0; background: none; width: 100%; color: var(--ink); height: 32px; }
.dt-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dt-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.dt-count { font-size: 12.5px; color: var(--ink-3); margin-right: 4px; white-space: nowrap; }
.dt-colpick { position: relative; }
.dt-colpick .menu { min-width: 200px; }
.sel { display: inline-flex; align-items: center; gap: 0; height: 34px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--surface); overflow: hidden; font-size: 12.5px; }
.sel span { padding: 0 8px 0 10px; color: var(--ink-3); border-right: 1px solid var(--rule); height: 100%; display: grid; place-items: center; background: var(--surface-2); }
.sel select { border: 0; background: none; height: 100%; padding: 0 8px; outline: 0; max-width: 190px; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 8px; overflow: hidden; height: 34px; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 11px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--rule); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.dt-scroll { overflow-x: auto; }
.dt table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dt th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; user-select: none; }
.dt th.sortable { cursor: pointer; }
.dt th.sortable:hover { color: var(--ink); }
.dt th.sorted { color: var(--accent); }
.dt th .arr { margin-left: 4px; }
.dt td { padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.dt td.r, .dt th.r { text-align: right; }
.dt tr.click { cursor: pointer; }
.dt tr.click:hover td { background: var(--surface-2); }
.dt tr.hot td { background: color-mix(in srgb, var(--crit) 7%, var(--surface)); }
.dt tr.new td { animation: rowIn 1.4s ease-out; }
@keyframes rowIn { from { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); } to { background: transparent; } }
.dt td.empty { text-align: center; color: var(--ink-3); padding: 28px; font-family: var(--f-read); font-size: 15px; }
.dt-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; font-size: 12.5px; color: var(--ink-3); gap: 10px; flex-wrap: wrap; }
.dt-pager { display: flex; gap: 8px; align-items: center; }
.dt-dense td { padding: 6px 12px; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { display: block; color: var(--ink-3); font-size: 12px; }

/* ============ charts ============ */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-family: var(--f-ui); }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart .ln.dash { stroke-dasharray: 5 4; }
.chart .s1.ln { stroke: var(--s1); } .chart .s2.ln { stroke: var(--s2); } .chart .s3.ln { stroke: var(--s3); }
.chart .area { fill: var(--s1); opacity: .09; stroke: none; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.s1, .chart .col.s1 { fill: var(--s1); } .chart .dot.s2, .chart .col.s2 { fill: var(--s2); } .chart .dot.s3, .chart .col.s3 { fill: var(--s3); }
.chart .col.mute { fill: var(--rule-strong); }
.chart .col.dimmed { opacity: .45; }
.chart .col:hover { filter: brightness(1.1); }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .band { fill: var(--accent-soft); opacity: .7; }
.chart .band-l { fill: var(--accent); font-weight: 600; }
.chart .thresh { stroke: var(--crit); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .thresh-l { fill: var(--crit); font-weight: 600; }
.chart .dlabel { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 4px; border-radius: 2px; background: var(--s1); flex: none; }
.sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); } .sw.mute { background: var(--rule-strong); }
.sw.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); color: var(--s2); }
.tip { position: fixed; z-index: 200; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 9px 11px; font-size: 12.5px; max-width: 320px; display: none; line-height: 1.4; }
.tip b { display: block; margin-bottom: 4px; font-size: 13px; }
.tip-row { display: flex; align-items: center; gap: 7px; justify-content: space-between; white-space: nowrap; }
.tip-row em { font-style: normal; font-family: var(--f-num); font-weight: 600; margin-left: 14px; }
.tip-row .sw { margin-right: 2px; }
.tip-hint { display: block; margin-top: 6px; color: var(--accent); font-weight: 600; font-size: 11.5px; }
.hbar { display: grid; gap: 2px; }
.hbar-r { display: grid; grid-template-columns: minmax(120px, 42%) 1fr auto; align-items: center; gap: 10px; border: 0; background: none; padding: 5px 4px; border-radius: 6px; text-align: left; cursor: pointer; }
.hbar-r:disabled { cursor: default; }
.hbar-r:not(:disabled):hover { background: var(--surface-2); }
.hbar-l { font-size: 13px; line-height: 1.25; min-width: 0; }
.hbar-l small { display: block; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-t { height: 10px; background: var(--surface-3); border-radius: 0 4px 4px 0; position: relative; }
.hbar-b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--s1); transition: width .5s; }
.hbar-b.s2 { background: var(--s2); } .hbar-b.s3 { background: var(--s3); } .hbar-b.crit { background: var(--r-vh); } .hbar-b.mute { background: var(--rule-strong); }
.hbar-v { font-family: var(--f-num); font-size: 12.5px; font-weight: 600; min-width: 5ch; text-align: right; }
.tilemap rect { stroke: var(--surface); stroke-width: 1; transition: filter .12s; }
.tilemap .tile:hover rect, .tilemap .tile:focus rect { stroke: var(--ink); stroke-width: 2; }
.tilemap .q0 { fill: var(--q0); } .tilemap .q1 { fill: var(--q1); } .tilemap .q2 { fill: var(--q2); } .tilemap .q3 { fill: var(--q3); } .tilemap .q4 { fill: var(--q4); } .tilemap .q5 { fill: var(--q5); } .tilemap .q6 { fill: var(--q6); }
.tile-l { font-size: 10.5px; font-weight: 700; fill: var(--ink); letter-spacing: .02em; pointer-events: none; }
.tile-v { font-size: 10px; fill: var(--ink-2); font-family: var(--f-num); pointer-events: none; }
.tile-l.inv, .tile-v.inv { fill: var(--tile-inv); }
.georisk { fill: var(--r-vh); stroke: var(--surface); stroke-width: 1.5; }
.legend-seq i { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.legend-seq i.q1 { background: var(--q1); } .legend-seq i.q2 { background: var(--q2); } .legend-seq i.q3 { background: var(--q3); } .legend-seq i.q4 { background: var(--q4); } .legend-seq i.q5 { background: var(--q5); } .legend-seq i.q6 { background: var(--q6); }
.legend-seq { gap: 3px; } .legend-seq > span:first-child { margin-right: 4px; } .legend-seq > span:nth-last-child(2) { margin-left: 4px; }
.legend-geo { margin-left: 14px; } .georisk-k { width: 8px; height: 8px; border-radius: 50%; background: var(--r-vh); display: inline-block; }
.sbar { display: flex; gap: 2px; height: 46px; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.sbar-s { display: flex; flex-direction: column; justify-content: center; padding: 0 8px; color: #fff; min-width: 0; cursor: help; animation: grow .9s cubic-bezier(.2,.8,.2,1) both; }
.sbar-s b { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbar-s em { font-style: normal; font-family: var(--f-num); font-size: 12.5px; font-weight: 600; }
.sb0 { background: #7A2419; } .sb1 { background: #A3372A; } .sb2 { background: #C4533A; } .sb3 { background: #D9714A; } .sb4 { background: #E18E5E; }
.sbar-s:nth-child(2) { animation-delay: .1s; } .sbar-s:nth-child(3) { animation-delay: .2s; } .sbar-s:nth-child(4) { animation-delay: .3s; } .sbar-s:nth-child(5) { animation-delay: .4s; }
@keyframes grow { from { flex-grow: 0; opacity: 0; } }
.sbar-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 5px; }
.gauge { width: 150px; height: auto; }
.g-track { fill: none; stroke: var(--surface-3); stroke-width: 12; stroke-linecap: round; }
.g-val { fill: none; stroke-width: 12; stroke-linecap: round; }
.g-lo { stroke: var(--r-lo); } .g-md { stroke: var(--r-md); } .g-hi { stroke: var(--r-hi); } .g-vh { stroke: var(--r-vh); }
.g-n { font-size: 26px; font-weight: 800; fill: var(--ink); font-family: var(--f-ui); }
.g-l { font-size: 9.5px; fill: var(--ink-3); }
.net .edge { stroke: var(--rule-strong); stroke-width: 1.5; }
.net .edge-own { stroke: var(--brass); stroke-width: 2; stroke-dasharray: 5 3; }
.net .edge-money { stroke: var(--crit); stroke-width: 2.4; }
.net .edge-device { stroke: var(--s1); stroke-dasharray: 2 3; }
.net .edge-l { font-size: 10.5px; fill: var(--ink-3); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.net .node circle, .net .node rect { fill: var(--surface); stroke: var(--rule-strong); stroke-width: 2; }
.net .node-company rect { fill: var(--brass-soft); stroke: var(--brass); }
.net .node-bdc rect { fill: var(--crit-soft); stroke: var(--crit); }
.net .node-person circle { fill: var(--accent-soft); stroke: var(--accent); }
.net .node-device rect { fill: var(--info-soft); stroke: var(--info); }
.net .node.focus circle, .net .node.focus rect { stroke-width: 3.5; }
.net .node.hot circle, .net .node.hot rect { stroke: var(--crit); }
.net .node-l { font-size: 12px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.net .node-s { font-size: 10.5px; fill: var(--ink-3); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.net.hovering .edge:not(.lit), .net.hovering .node:not(.lit) { opacity: .35; }
.bands { display: flex; gap: 2px; height: 54px; border-radius: 8px; overflow: hidden; }
.bands-s { border: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 0 10px; cursor: pointer; color: #1a1a1a; min-width: 0; }
.bands-s b { font-size: 12px; white-space: nowrap; } .bands-s em { font-style: normal; font-family: var(--f-num); font-size: 13px; font-weight: 600; }
.bs-lo { background: color-mix(in srgb, var(--r-lo) 70%, #fff); } .bs-md { background: color-mix(in srgb, var(--r-md) 75%, #fff); } .bs-hi { background: color-mix(in srgb, var(--r-hi) 85%, #fff); } .bs-vh { background: var(--r-vh); color: #fff; }
.bands-s:hover { filter: brightness(1.06); }

/* ============ drawer / modal / toast ============ */
.drawer-wrap, .modal-wrap { position: fixed; inset: 0; z-index: 100; }
.drawer-scrim, .modal-scrim { position: absolute; inset: 0; background: rgba(6, 14, 18, .42); opacity: 0; transition: opacity .2s; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(720px, 94vw); background: var(--ground); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.drawer-wide { width: min(1040px, 96vw); }
.drawer-wrap.open .drawer-scrim, .modal-wrap.open .modal-scrim { opacity: 1; }
.drawer-wrap.open .drawer { transform: none; }
.drawer-h { display: flex; gap: 12px; align-items: flex-start; padding: 18px 22px 14px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.drawer-h > div { flex: 1; min-width: 0; }
.drawer-k { font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 3px; }
.drawer-h h2 { font-size: 21px; font-weight: 700; }
.drawer-sub { color: var(--ink-2); margin-top: 4px; font-size: 13.5px; }
.drawer-b { padding: 18px 22px 40px; overflow-y: auto; flex: 1; }
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%); opacity: 0; width: min(560px, 94vw); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); transition: transform .18s, opacity .18s; }
.modal-wide { width: min(900px, 96vw); }
.modal-wrap.open .modal { transform: translate(-50%, -50%); opacity: 1; }
.modal-h { display: flex; align-items: center; padding: 16px 18px 12px; border-bottom: 1px solid var(--rule); }
.modal-h h2 { font-size: 18px; flex: 1; }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--rule); }
.toasts { position: fixed; right: 18px; bottom: 22px; z-index: 150; display: grid; gap: 10px; width: min(420px, 92vw); }
.toast { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 10px 12px 14px; animation: tIn .3s cubic-bezier(.2,.8,.2,1); }
.toast > div { flex: 1; min-width: 0; }
.toast b { display: block; font-size: 13.5px; }
.toast span { display: block; font-size: 12.5px; color: var(--ink-2); }
.toast-crit { border-left-color: var(--crit); } .toast-ok { border-left-color: var(--ok); } .toast-warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .25s; }
.toast-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; }
@keyframes tIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

/* ============ tabs, kv, misc ============ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-n { background: var(--surface-3); color: var(--ink-2); border-radius: 99px; padding: 0 7px; font-size: 11.5px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 18px; margin: 0; }
.kv dt { font-size: 12px; color: var(--ink-3); }
.kv dd { margin: 1px 0 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.list { display: grid; }
.list > * { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.list > *:last-child { border-bottom: 0; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-sb { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -.035em; }
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 16px 0; }

/* live feed */
.feed { max-height: 480px; overflow: hidden; position: relative; }
.feed-r { display: grid; grid-template-columns: 62px minmax(0, 1.3fr) 104px 110px 92px; gap: 10px; align-items: center; padding: 8px 16px; border-bottom: 1px solid var(--rule); font-size: 13px; cursor: pointer; }
.feed-r:hover { background: var(--surface-2); }
.feed-r.fresh { animation: rowIn 1.4s ease-out; }
.feed-r.alert { background: color-mix(in srgb, var(--crit) 8%, var(--surface)); }
.feed-r.hero { background: var(--crit-soft); box-shadow: inset 4px 0 0 var(--crit); animation: heroIn 2.4s ease-out; }
@keyframes heroIn { 0% { background: var(--crit); } 100% { background: var(--crit-soft); } }
.feed-r .who { min-width: 0; }
.feed-r .who b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-r .who small { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; font-size: 12px; }
.feed-r .amt { text-align: right; font-family: var(--f-num); font-weight: 600; }
.feed-r .t { font-family: var(--f-num); color: var(--ink-3); font-size: 12px; }
.scorepill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-num); font-weight: 600; font-size: 12.5px; }
.scorepill .m { width: 40px; height: 6px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: hidden; }
.scorepill .m i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }

.feed-compact .feed-r { grid-template-columns: 58px minmax(0, 1fr) 96px 64px; }
.feed-compact .feed-r > :nth-child(4) { display: none; }
.feed-compact .scorepill .m { width: 24px; }
/* ai */
.ai-band { background: linear-gradient(135deg, var(--side) 0%, #0F3A48 100%); color: #DCE8ED; border-radius: var(--radius); padding: 18px 20px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; margin-bottom: 16px; position: relative; overflow: hidden; }
.ai-band::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(208,120,30,.25), transparent 70%); pointer-events: none; }
.ai-band h3 { font-size: 18px; color: #fff; display: flex; align-items: center; gap: 8px; }
.ai-band .tbot-name > span { color: #F0A04B; }
.ai-band p { color: #B7C9D1; font-size: 13.5px; margin-top: 4px; }
.ai-band .cap { color: #CBD9DF; font-size: 15px; margin-top: 8px; }
.ai-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.ai-stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 8px; padding: 10px 12px; text-align: left; color: inherit; cursor: pointer; }
.ai-stat:hover { background: rgba(255,255,255,.1); }
.ai-stat b { display: block; font-size: 22px; color: #fff; letter-spacing: -.02em; font-weight: 700; }
.ai-stat span { font-size: 12px; color: #A9BEC7; }
.ai-feed { font-size: 13px; display: grid; gap: 0; align-content: start; }
.ai-feed .it { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.08); animation: tIn .5s; }
.ai-feed .it:last-child { border-bottom: 0; }
.ai-feed .it .ic { width: 15px; height: 15px; color: #F0A04B; margin-top: 2px; }
.ai-feed .it time { font-family: var(--f-num); font-size: 11px; color: #7E97A2; }
.ai-human { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; font-size: 12px; color: #CFE0E6; background: rgba(255,255,255,.07); border-radius: 99px; padding: 4px 10px; }
.ai-human i { width: 7px; height: 7px; border-radius: 50%; background: #3BC46B; }
.copilot { display: flex; flex-direction: column; height: 100%; min-height: 420px; }
.copilot-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.bot-ava { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(145deg, #D0781E, #9E5410); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.copilot-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: grid; gap: 12px; align-content: start; max-height: 520px; }
.msg { font-size: 13.5px; line-height: 1.5; max-width: 94%; }
.msg.me { justify-self: end; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 12px 12px 3px 12px; }
.msg.bot { background: var(--surface-2); border: 1px solid var(--rule); padding: 10px 12px; border-radius: 12px 12px 12px 3px; }
.msg.bot ul { margin: 6px 0 0; padding-left: 18px; } .msg.bot li { margin: 3px 0; }
.msg.bot .src { display: block; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }
.msg.bot .human { display: block; margin-top: 8px; font-size: 12px; color: var(--brass); font-weight: 600; }
.caret { display: inline-block; width: 7px; height: 14px; background: var(--ink-3); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.chips button { border: 1px solid var(--rule-strong); background: var(--surface); border-radius: 99px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; }
.chips button:hover { border-color: var(--s2); color: var(--s2); }
.copilot-in { display: flex; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--rule); }
.copilot-in input { flex: 1; height: 38px; border: 1px solid var(--rule-strong); border-radius: 8px; padding: 0 12px; background: var(--surface); }

/* api call visualiser */
.api { border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface); margin-top: 12px; }
.api-h { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--rule); font-size: 12.5px; flex-wrap: wrap; }
.api-m { font-family: var(--f-num); font-weight: 700; color: var(--ok); }
.api-h code { font-family: var(--f-num); font-size: 12px; }
.api-svc { color: var(--ink-3); } .api-ms { margin-left: auto; font-family: var(--f-num); color: var(--ink-3); }
.api-b { display: grid; grid-template-columns: 1fr 1fr; }
.api-b > div { min-width: 0; } .api-b > div + div { border-left: 1px solid var(--rule); }
.api-k { font-size: 11.5px; color: var(--ink-3); padding: 8px 12px 0; font-weight: 600; }
.api pre { margin: 0; padding: 6px 12px 12px; font-family: var(--f-num); font-size: 11.5px; line-height: 1.5; overflow-x: auto; color: var(--ink-2); max-height: 260px; }
.api-plug { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-top: 1px dashed var(--info); background: var(--info-soft); font-size: 12.5px; color: var(--ink-2); }
.api-plug .ic { color: var(--info); width: 16px; height: 16px; margin-top: 1px; }

/* steps (onboarding + processes) */
.steps { display: grid; gap: 0; counter-reset: s; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.step::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--rule); }
.step:last-child::before { display: none; }
.step-n { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--rule-strong); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--ink-3); background: var(--surface); z-index: 1; }
.step.run .step-n { border-color: var(--accent); color: var(--accent); animation: spinring 1s linear infinite; border-top-color: transparent; }
@keyframes spinring { to { transform: rotate(360deg); } }
.step.done .step-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.warn .step-n { background: var(--warn); border-color: var(--warn); color: #fff; }
.step.bad .step-n { background: var(--crit); border-color: var(--crit); color: #fff; }
.step-t { font-weight: 700; font-size: 14.5px; padding-top: 6px; }
.step-d { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.step-body { margin-top: 8px; }

/* timeline */
.tl { display: grid; gap: 0; }
.tl-i { display: grid; grid-template-columns: 76px 14px 1fr; gap: 10px; padding-bottom: 14px; position: relative; }
.tl-i time { font-family: var(--f-num); font-size: 12px; color: var(--ink-3); text-align: right; padding-top: 1px; }
.tl-i .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); margin-top: 3px; z-index: 1; }
.tl-i::before { content: ""; position: absolute; left: 91px; top: 16px; bottom: 0; width: 2px; background: var(--rule); }
.tl-i:last-child::before { display: none; }
.tl-i.human .dot { background: var(--brass); border-color: var(--brass); }
.tl-i.sys .dot { border-color: var(--ink-3); }
.tl-i.crit .dot { background: var(--crit); border-color: var(--crit); }
.tl-i b { font-size: 13.5px; } .tl-i p { font-size: 13px; color: var(--ink-2); }

/* frozen state card */
.frozen { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.frozen > div { background: var(--surface); padding: 10px 12px; }
.frozen small { display: block; font-size: 11.5px; color: var(--ink-3); }
.frozen b { font-size: 13px; }
.frozen .ic { width: 14px; height: 14px; color: var(--accent); vertical-align: -2px; margin-right: 4px; }

/* hash chain */
.chain { display: grid; gap: 8px; }
.blk { display: grid; grid-template-columns: 48px 1fr 190px; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; position: relative; }
.blk::after { content: ""; position: absolute; left: 34px; bottom: -9px; width: 2px; height: 8px; background: var(--rule-strong); }
.blk:last-child::after { display: none; }
.blk-n { font-family: var(--f-num); font-weight: 700; color: var(--ink-3); font-size: 12px; }
.blk-d b { font-size: 13.5px; } .blk-d p { font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.blk-h { font-family: var(--f-num); font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; line-height: 1.35; }
.blk-h span { display: block; }
.blk.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--rule)); }
.blk.ok .blk-n { color: var(--ok); }
.blk.bad { border-color: var(--crit); background: var(--crit-soft); }
.blk.bad .blk-n { color: var(--crit); }
.blk.broken { border-color: var(--crit); border-style: dashed; }
.blk.verifying { animation: rowIn .6s; }

/* rules */
.rule-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 16px; border-bottom: 1px solid var(--rule); align-items: center; }
.rule-card:last-child { border-bottom: 0; }
.rule-card h4 { font-size: 14.5px; }
.rule-card p { font-size: 13px; color: var(--ink-2); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--rule-strong); border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* coverage */
.cov { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cov-i { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; text-align: left; cursor: pointer; display: grid; gap: 6px; align-content: start; box-shadow: var(--shadow); }
.cov-i:hover { border-color: var(--accent); }
.cov-i .sec { font-family: var(--f-num); font-size: 12px; color: var(--accent); font-weight: 700; }
.cov-i h4 { font-size: 15px; }
.cov-i p { font-size: 13px; color: var(--ink-2); }
.cov-i .ev { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.meter { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* doc (report preview on screen + print) */
.doc { background: #fff; color: #10161C; max-width: 860px; margin: 0 auto; padding: 48px 56px; box-shadow: var(--shadow-lg); border-radius: 4px; font-family: var(--f-ui); font-size: 13.5px; }
.doc h1 { font-size: 26px; letter-spacing: -.02em; margin-bottom: 4px; }
.doc h2 { font-size: 16px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #D8DEE4; }
.doc p { margin: 0 0 10px; line-height: 1.55; color: #2A333C; }
.doc .doc-top { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #0F5B73; padding-bottom: 14px; margin-bottom: 18px; gap: 16px; }
.doc .doc-top small { display: block; color: #5A6570; font-size: 12px; }
.doc .doc-class { font-size: 11px; font-weight: 700; color: #A3372A; border: 1.5px solid #A3372A; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0 12px; }
.doc th { text-align: left; font-weight: 600; color: #5A6570; border-bottom: 1.5px solid #A9B4BD; padding: 6px 8px; font-size: 11.5px; }
.doc td { border-bottom: 1px solid #E3E8EC; padding: 6px 8px; vertical-align: top; }
.doc td.r, .doc th.r { text-align: right; }
.doc .rag { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.doc .rag.g { background: #1D7A3C; } .doc .rag.a { background: #D99A0B; } .doc .rag.r { background: #A3372A; }
.doc .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; }
.doc .sig div { border-top: 1px solid #A9B4BD; padding-top: 6px; font-size: 12px; color: #5A6570; }
.doc .doc-foot { margin-top: 30px; padding-top: 10px; border-top: 1px solid #D8DEE4; font-size: 11px; color: #6B7680; display: flex; justify-content: space-between; }
.doc .kpirow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 6px; }
.doc .kpirow div { border: 1px solid #D8DEE4; border-radius: 6px; padding: 10px; }
.doc .kpirow b { display: block; font-size: 20px; letter-spacing: -.02em; }
.doc .kpirow small { color: #5A6570; font-size: 11.5px; }
.doc .chart .axis { fill: #66717C; } .doc .chart .grid { stroke: #E3E8EC; }
.doc { --s1: #1570A6; --s2: #D0781E; --s3: #1BAF7A; --rule: #E3E8EC; --rule-strong: #A9B4BD; --ink-3: #66717C; --surface: #fff; --crit: #A3372A; --accent-soft: #DCEBF1; --accent: #0F5B73; --ink-2: #444E59; }
.xml { font-family: var(--f-num); font-size: 12px; line-height: 1.55; background: #0B1A20; color: #CFE3EA; padding: 16px 18px; border-radius: 8px; overflow: auto; max-height: 520px; white-space: pre; }
.xml .t { color: #7FC8E0; } .xml .a { color: #F0B35E; } .xml .v { color: #A8E0A0; } .xml .c { color: #6F8791; }

/* checklist */
.checks { display: grid; gap: 6px; }
.checks > div { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.checks .ic { width: 18px; height: 18px; color: var(--ok); flex: none; margin-top: 1px; }
.checks .x .ic { color: var(--crit); }
.checks .p .ic { color: var(--ink-3); }

/* ============ story mode ============ */
.story { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90; width: min(860px, calc(100vw - 32px)); background: var(--side); color: #E7EFF2; border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06); overflow: hidden; }
.story-bar { height: 3px; background: rgba(255,255,255,.1); }
.story-bar i { display: block; height: 100%; background: linear-gradient(90deg, #5BB8D4, #F0A04B); transition: width .4s; }
.story-in { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 14px 18px 14px 20px; align-items: center; }
.story-k { font-size: 12px; color: #F0A04B; font-weight: 700; margin-bottom: 3px; display: flex; gap: 10px; }
.story-k span { color: #7E97A2; font-weight: 500; }
.story h4 { font-size: 17px; color: #fff; margin-bottom: 4px; letter-spacing: -.01em; }
.story p { font-family: var(--f-read); font-size: 16px; line-height: 1.45; color: #C6D6DC; }
.story-acts { display: flex; gap: 8px; align-items: center; }
.story .btn-ghost { color: #E7EFF2; border-color: rgba(255,255,255,.2); }
.story .btn-ghost:hover { border-color: rgba(255,255,255,.5); }
.story-x { position: absolute; right: 8px; top: 8px; border: 0; background: none; color: #7E97A2; cursor: pointer; }
.spot { position: relative; z-index: 5; box-shadow: 0 0 0 3px #F0A04B, 0 0 0 9px rgba(240,160,75,.25) !important; border-radius: 10px; transition: box-shadow .3s; }
.story-launch { position: fixed; right: 18px; bottom: 18px; z-index: 80; }
body.in-story .content { padding-bottom: 170px; }
body.in-story .toasts { bottom: 150px; }
@media (min-width: 1400px) { body.in-story .toasts { bottom: 22px; } }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: var(--side); color: #DCE8ED; padding: 44px 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-art h1 { font-size: clamp(30px, 3.4vw, 46px); color: #fff; letter-spacing: -.035em; line-height: 1.05; max-width: 15ch; margin-top: auto; }
.login-art p { font-family: var(--f-read); font-size: 18px; color: #B4C7CF; max-width: 44ch; margin-top: 14px; line-height: 1.45; }
.login-art .flow { margin: 28px 0 auto; display: grid; gap: 8px; max-width: 460px; }
.login-art .flow div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; font-size: 13px; padding: 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.login-art .flow b { color: #F0A04B; font-weight: 700; }
.login-form { padding: 44px 48px; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.login-form h2 { font-size: 24px; letter-spacing: -.02em; }
.role-opt { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: flex-start; border: 1.5px solid var(--rule); border-radius: 10px; padding: 12px 14px; cursor: pointer; text-align: left; background: var(--surface); width: 100%; }
.role-opt:hover { border-color: var(--rule-strong); }
.role-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-opt b { display: block; } .role-opt small { color: var(--ink-3); font-size: 12.5px; line-height: 1.35; display: block; margin-top: 2px; }
.otp { display: flex; gap: 8px; }
.otp input { width: 46px; height: 54px; text-align: center; font-size: 22px; font-family: var(--f-num); border: 1.5px solid var(--rule-strong); border-radius: 8px; background: var(--surface); }
.otp input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* print: report documents only */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; }
  .side, .top, .app-foot, .story, .story-launch, .toasts, .explain, .no-print, .drawer-h, .drawer-scrim, .page-h .acts { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; }
  .drawer-wrap { position: static; } .drawer { position: static; transform: none; width: auto; box-shadow: none; background: #fff; }
  .drawer-b { overflow: visible; padding: 0; }
  body.printing-doc .main > *:not(.print-host) { display: none !important; }
  .doc { box-shadow: none; padding: 0; max-width: none; }
  .doc h2 { break-after: avoid; } .doc table, .doc .kpirow, .doc svg { break-inside: avoid; }
}

/* ============ responsive ============ */
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-side { grid-template-columns: 1fr; } }
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex !important; }
  .g-main, .g-3, .g-2 { grid-template-columns: 1fr; }
  .ai-band { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; } .login-art { padding: 30px 24px; } .login-art .flow { display: none; }
}
@media (max-width: 680px) {
  .content { padding: 16px 16px 60px; } .top { padding: 8px 16px; }
  .clock .lbl, .picker .who, .top .hide-sm { display: none; }
  .g-4 { grid-template-columns: 1fr; }
  .feed-r { grid-template-columns: 52px minmax(0, 1fr) 90px; } .feed-r > :nth-child(4), .feed-r > :nth-child(5) { display: none; }
  .api-b { grid-template-columns: 1fr; } .api-b > div + div { border-left: 0; border-top: 1px solid var(--rule); }
  .blk { grid-template-columns: 36px 1fr; } .blk-h { grid-column: 1 / -1; }
  .story-in { grid-template-columns: 1fr; } .story p { font-size: 15px; }
  .doc { padding: 22px 18px; } .doc .kpirow { grid-template-columns: repeat(2, 1fr); }
  .login-form { padding: 28px 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.frozen > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
