/* CS2 pipeline dashboard. The visual system is "Vellum", as used by the Sydney List Builder
   (D:/Sydney/causeiq/static/css): cool graphite neutrals, hairline borders, soft elevation, one confident
   accent (cobalt), mono figures. Light is the default; dark follows the OS, and the theme toggle overrides both ways. */

:root {
  color-scheme: light;
  --side-w: 236px;
  --top-h: 52px;

  --bg: #eef1f5;
  --frame: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceff3;
  --overlay: #ffffff;
  --border: #dde1e7;
  --border-strong: #c8cdd5;
  --text: #15191e;
  --text-2: #565b62;
  --text-3: #6a6f75;

  --accent: #0065c6;
  --accent-hover: #0056aa;
  --accent-press: #004b97;
  --accent-ink: #fafcff;
  --accent-text: #0065c6;
  --accent-soft: #e4f0ff;
  --accent-soft-2: #d1e5ff;
  --accent-line: #a5cafb;
  --ring: rgba(40, 133, 239, 0.35);

  --ok: #006b41;
  --ok-dot: #12a15a;
  --ok-soft: #d0f6df;
  --warn: #9c5906;
  --warn-soft: #ffebd1;
  --err: #c71c20;
  --err-ink: #ffffff;
  --err-soft: #ffe9e6;
  --neutral-soft: #eef0f3;
  --tone-blue: #1f5fbf; --tone-blue-bg: #e3eeff;
  --tone-violet: #6541c9; --tone-violet-bg: #eee8ff;
  --tone-rose: #b8325a; --tone-rose-bg: #ffe7ee;
  --tone-teal: #0f766e; --tone-teal-bg: #d9f4ef;
  --tone-amber: #9a5a06; --tone-amber-bg: #fff0d6;
  --tone-slate: #4b5563; --tone-slate-bg: #eceff3;

  --series: #2a78d6;
  --grid: #e2e4e6;
  --focus: #0065c6;

  --r-xs: 5px;
  --r-sm: 7px;
  --r: 9px;
  --r-md: 11px;
  --r-lg: 12px;
  --r-xl: 14px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.07), 0 0 0 0.5px rgba(16, 24, 40, 0.02);
  --card-highlight: 0 0 #0000;
  --shadow-2: 0 6px 18px rgba(16, 24, 40, 0.1), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-3: 0 22px 50px rgba(16, 24, 40, 0.2), 0 6px 14px rgba(16, 24, 40, 0.1);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #08090b; --frame: #101114; --surface: #17191d; --surface-2: #1e2025; --surface-3: #272a30; --overlay: #1d2024;
    --border: rgba(255, 255, 255, 0.1); --border-strong: rgba(255, 255, 255, 0.19);
    --text: #f4f5f7; --text-2: #a0a5ac; --text-3: #81878d;
    --accent: #2d6be4; --accent-hover: #3a78ee; --accent-press: #2560d6; --accent-ink: #ffffff; --accent-text: #62a8ff;
    --accent-soft: rgba(58, 142, 242, 0.16); --accent-soft-2: rgba(58, 142, 242, 0.26); --accent-line: rgba(58, 142, 242, 0.42);
    --ring: rgba(83, 160, 255, 0.45);
    --ok: #4dc588; --ok-dot: #4dc588; --ok-soft: rgba(77, 197, 136, 0.15);
    --warn: #eeb154; --warn-soft: rgba(238, 177, 84, 0.15);
    --err: #f66c6d; --err-ink: #1f0909; --err-soft: rgba(246, 108, 109, 0.15);
    --neutral-soft: rgba(255, 255, 255, 0.08);
    --tone-blue: #7fb2ff; --tone-blue-bg: rgba(80, 150, 255, 0.15);
    --tone-violet: #b39dff; --tone-violet-bg: rgba(150, 120, 255, 0.16);
    --tone-rose: #ff8fb0; --tone-rose-bg: rgba(255, 110, 150, 0.14);
    --tone-teal: #5eead4; --tone-teal-bg: rgba(45, 212, 191, 0.13);
    --tone-amber: #fbbf24; --tone-amber-bg: rgba(251, 191, 36, 0.13);
    --tone-slate: #aab2bd; --tone-slate-bg: rgba(255, 255, 255, 0.08);
    --series: #3987e5; --grid: rgba(255, 255, 255, 0.09); --focus: #53a0ff;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45); --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.55); --shadow-3: 0 26px 60px rgba(0, 0, 0, 0.66);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090b; --frame: #101114; --surface: #17191d; --surface-2: #1e2025; --surface-3: #272a30; --overlay: #1d2024;
  --border: rgba(255, 255, 255, 0.1); --border-strong: rgba(255, 255, 255, 0.19);
  --text: #f4f5f7; --text-2: #a0a5ac; --text-3: #81878d;
  --accent: #2d6be4; --accent-hover: #3a78ee; --accent-press: #2560d6; --accent-ink: #ffffff; --accent-text: #62a8ff;
  --accent-soft: rgba(58, 142, 242, 0.16); --accent-soft-2: rgba(58, 142, 242, 0.26); --accent-line: rgba(58, 142, 242, 0.42);
  --ring: rgba(83, 160, 255, 0.45);
  --ok: #4dc588; --ok-dot: #4dc588; --ok-soft: rgba(77, 197, 136, 0.15);
  --warn: #eeb154; --warn-soft: rgba(238, 177, 84, 0.15);
  --err: #f66c6d; --err-ink: #1f0909; --err-soft: rgba(246, 108, 109, 0.15);
  --neutral-soft: rgba(255, 255, 255, 0.08);
  --tone-blue: #7fb2ff; --tone-blue-bg: rgba(80, 150, 255, 0.15);
  --tone-violet: #b39dff; --tone-violet-bg: rgba(150, 120, 255, 0.16);
  --tone-rose: #ff8fb0; --tone-rose-bg: rgba(255, 110, 150, 0.14);
  --tone-teal: #5eead4; --tone-teal-bg: rgba(45, 212, 191, 0.13);
  --tone-amber: #fbbf24; --tone-amber-bg: rgba(251, 191, 36, 0.13);
  --tone-slate: #aab2bd; --tone-slate-bg: rgba(255, 255, 255, 0.08);
  --series: #3987e5; --grid: rgba(255, 255, 255, 0.09); --focus: #53a0ff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45); --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-2: 0 10px 28px rgba(0, 0, 0, 0.55); --shadow-3: 0 26px 60px rgba(0, 0, 0, 0.66);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--bg); color: var(--text);
  font: 13.5px/20px var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.plain { overflow: auto; }
svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
p { margin: 0; }
::selection { background: var(--accent-soft-2); }
h1 { margin: 0; font-size: 23px; line-height: 28px; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
h2 { margin: 0; font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -0.005em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-2) 32%, transparent) transparent; }

.skip { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface); color: var(--text); }
.skip:focus { top: 12px; }
.icon { width: 16px; height: 16px; flex: none; }
.muted { color: var(--text-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.lede { margin-top: 5px; color: var(--text-2); }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: relative; z-index: 30; height: var(--top-h); flex: none; padding: 0 16px;
  display: flex; align-items: center; gap: 14px; background: var(--frame); border-bottom: 1px solid var(--border);
}
.brand-slot { width: calc(var(--side-w) - 16px); flex: none; transition: width 0.2s var(--ease); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; border-radius: var(--r-sm); }
.brand-mark { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: var(--accent); }
.brand-mark svg { width: 15px; height: 15px; fill: none; stroke: var(--accent-ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.015em; white-space: nowrap; }
.brand-name span { color: var(--accent-text); }
.spacer { flex: 1; }
.conn {
  height: 32px; padding: 0 12px; flex: none; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-2);
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.conn:hover { background: var(--surface-2); color: var(--text); }
.conn-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--text-3); }
.conn[data-state="ok"] .conn-dot { background: var(--ok-dot); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn[data-state="warn"] .conn-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.conn[data-state="err"] .conn-dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.avatar {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; text-transform: uppercase;
}

/* ------------------------------------------------------------ sidebar */
.frame { height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); display: flex; }
.sidebar {
  width: var(--side-w); height: 100%; flex: none; padding: 12px 10px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  overflow-x: hidden; overflow-y: auto; background: var(--frame); border-right: 1px solid var(--border);
  transition: width 0.2s var(--ease);
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  padding: 14px 10px 6px; overflow: hidden; white-space: nowrap;
  color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.nav-label:first-child { padding-top: 4px; }
.side-nav a {
  height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 11px; border-radius: 8px;
  color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-line); }
.side-nav .icon { width: 17px; height: 17px; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-count { color: var(--text-3); font-family: var(--mono); font-size: 11.5px; font-weight: 500; }
.nav-count.alert { padding: 0 6px; border-radius: 5px; background: var(--err-soft); color: var(--err); font-weight: 600; }
.side-nav a[aria-current="page"] .nav-count:not(.alert) { color: inherit; }
.side-foot { display: flex; flex-direction: column; gap: 6px; }
.side-card {
  padding: 12px 13px; display: block; border-radius: var(--r-md); border: 1px solid var(--accent-line);
  background: linear-gradient(155deg, var(--accent-soft), transparent 70%); color: var(--text); text-decoration: none;
}
.side-card.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: linear-gradient(155deg, var(--warn-soft), transparent 70%); }
.side-card-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.side-card p { margin-top: 5px; color: var(--text-2); font-size: 11.5px; line-height: 16px; }
.collapse-btn {
  height: 34px; padding: 0 10px; text-align: left; display: flex; align-items: center; gap: 11px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-3);
  font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.collapse-btn:hover { background: var(--surface-2); color: var(--text); }
.collapse-btn .icon { transition: transform 0.2s var(--ease); }
@media (min-width: 721px) {
  html[data-sidebar="collapsed"] { --side-w: 60px; }
  html[data-sidebar="collapsed"] .nav-text, html[data-sidebar="collapsed"] .nav-count, html[data-sidebar="collapsed"] .side-card { display: none; }
  html[data-sidebar="collapsed"] .nav-label { height: 1px; margin: 10px 6px; padding: 0; background: var(--border); color: transparent; }
  html[data-sidebar="collapsed"] .side-nav a, html[data-sidebar="collapsed"] .collapse-btn { padding: 0; justify-content: center; }
  html[data-sidebar="collapsed"] .collapse-btn .icon { transform: rotate(180deg); }
  html[data-sidebar="collapsed"] .brand-slot { width: auto; }
}

/* ------------------------------------------------------------ main column */
.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; }
.scroller { position: relative; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.view { max-width: 1440px; margin: 0 auto; padding: 20px 28px 56px; outline: none; container: view / inline-size; animation: view-in 0.22s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.page-head { margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.eyebrow {
  margin-bottom: 8px; display: flex; align-items: center; gap: 9px;
  color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
}
.eyebrow i { color: var(--accent); font-style: normal; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); align-items: start; gap: 16px; }
@container view (max-width: 1000px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ buttons and forms */
.btn {
  height: 34px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-1);
  color: var(--text); font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease), transform 0.12s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.btn .icon { width: 15px; height: 15px; }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 30px; padding: 0 11px; }
.btn.block { width: 100%; }
.icon-btn {
  all: unset; box-sizing: border-box; width: 34px; height: 34px; flex: none; display: inline-grid; place-items: center;
  border-radius: var(--r-sm); color: var(--text-3); cursor: pointer; transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.theme-light, .theme-dark { display: none; }
:root:not([data-theme="dark"]) .theme-dark { display: block; }
:root[data-theme="dark"] .theme-light { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-dark { display: none; }
  :root:not([data-theme="light"]) .theme-light { display: block; }
}
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.field > span { color: var(--text); font-size: 13px; font-weight: 600; }
.field input {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text); font-size: 13.5px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field input:hover { border-color: var(--border-strong); }
.field input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }

/* a switch is a form button, so it works without scripts and goes through the CSRF check */
.toggle { all: unset; box-sizing: border-box; position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: background-color 0.15s var(--ease); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.18s var(--ease); }
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { transform: translateX(16px); }
.toggle.danger[aria-checked="true"] { background: var(--err); }
.toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-row { padding: 14px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row strong { display: block; font-weight: 600; }
.switch-row span { color: var(--text-2); font-size: 13px; }
.switch-row small { display: block; margin-top: 4px; color: var(--text-3); font-size: 11.5px; }

/* ------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1), var(--card-highlight); }
.card-head { padding: 14px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.card-head p { margin-top: 2px; color: var(--text-3); font-size: 11.5px; }
.card-body { padding: 14px 16px; }
.badge {
  padding: 2px 8px; display: inline-flex; align-items: center; gap: 5px; vertical-align: 1px;
  border-radius: 6px; background: var(--neutral-soft); color: var(--text-2); font-size: 11.5px; font-weight: 600; line-height: 15px; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--accent-soft); color: var(--accent-text); }
.notice { padding: 12px 14px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); color: var(--text-2); }
.notice .icon { margin-top: 2px; color: var(--text-3); }
.notice strong { color: var(--text); font-weight: 600; }
.notice.ok { border-color: transparent; background: var(--ok-soft); }
.notice.ok .icon, .notice.ok strong { color: var(--ok); }
.notice.warn { border-color: transparent; background: var(--warn-soft); }
.notice.warn .icon { color: var(--warn); }
.notice.err { border-color: transparent; background: var(--err-soft); }
.notice.err .icon, .notice.err strong { color: var(--err); }
.notice-body { flex: 1; min-width: 0; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li + li { margin-top: 3px; }

/* ------------------------------------------------------------ pipeline stages */
.stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@container view (max-width: 900px) { .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stage { min-width: 0; padding: 11px 13px; display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
a.stage:hover { border-color: var(--border-strong); }
.stage-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.stage-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--text-3); }
.stage[data-state="ok"] .stage-dot { background: var(--ok-dot); box-shadow: 0 0 0 3px var(--ok-soft); }
.stage[data-state="warn"] .stage-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.stage[data-state="err"] .stage-dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.stage[data-state="off"] { background: var(--surface-2); box-shadow: none; }
.stage-state { margin-left: auto; color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.stage[data-state="err"] .stage-state { color: var(--err); }
.stage[data-state="warn"] .stage-state { color: var(--warn); }
.stage-detail { color: var(--text-2); font-size: 12px; line-height: 17px; }

/* ------------------------------------------------------------ tiles */
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; }
@container view (max-width: 1100px) { .kpis { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container view (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { min-width: 0; padding: 12px 13px; display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--border-strong); }
.k-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--tone-bg, var(--accent-soft)); color: var(--tone-fg, var(--accent-text)); }
.k-icon .icon { width: 17px; height: 17px; }
.k-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.k-label { overflow: hidden; color: var(--text-2); font-size: 11.5px; font-weight: 500; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.k-value { color: var(--text); font-family: var(--mono); font-size: 20px; line-height: 26px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.k-sub { min-width: 0; overflow: hidden; color: var(--text-3); font-size: 11.5px; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.kpi[data-tone="blue"] { --tone-bg: var(--tone-blue-bg); --tone-fg: var(--tone-blue); }
.kpi[data-tone="violet"] { --tone-bg: var(--tone-violet-bg); --tone-fg: var(--tone-violet); }
.kpi[data-tone="rose"] { --tone-bg: var(--tone-rose-bg); --tone-fg: var(--tone-rose); }
.kpi[data-tone="teal"] { --tone-bg: var(--tone-teal-bg); --tone-fg: var(--tone-teal); }
.kpi[data-tone="amber"] { --tone-bg: var(--tone-amber-bg); --tone-fg: var(--tone-amber); }
.kpi[data-tone="slate"] { --tone-bg: var(--tone-slate-bg); --tone-fg: var(--tone-slate); }

/* ------------------------------------------------------------ tables */
.table-card { position: relative; overflow: clip; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 2; height: 36px; padding: 0 16px; text-align: left; white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.table td { height: 46px; padding: 6px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color 0.12s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.fig { font-family: var(--mono); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.wrap-text { max-width: 520px; color: var(--text-2); white-space: normal; }
.t-main { color: var(--text); font-weight: 600; line-height: 18px; }
.t-sub { margin-top: 1px; color: var(--text-3); font-size: 11.5px; line-height: 16px; }
.table tr.group td { height: auto; padding-top: 14px; padding-bottom: 6px; border-bottom: 0; background: var(--surface); }
.table tr.group:hover { background: transparent; }
.table tr.sub td { height: 36px; }
.table tr.sub td:first-child { padding-left: 30px; }
.empty-row td { height: auto; padding: 48px 16px; text-align: center; color: var(--text-3); }
.move-up { color: var(--ok); } .move-down { color: var(--err); }
.limit-up { color: var(--accent-text); font-weight: 600; }

.tabs { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; box-shadow: inset 0 -1px 0 var(--border); padding: 0 16px; }
.tab {
  height: 42px; flex: none; padding: 0 2px; display: inline-flex; align-items: center; gap: 7px;
  border-bottom: 2px solid transparent; color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none;
  transition: color 0.12s var(--ease), border-color 0.12s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-current="true"] { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.tab .count { padding: 0 6px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); font-family: var(--mono); font-size: 10.5px; font-weight: 600; line-height: 17px; }
.tab[aria-current="true"] .count { background: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------ charts */
.columns { height: 150px; padding: 8px 0 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 3px; }
.column { position: relative; height: 100%; display: flex; align-items: flex-end; border-radius: 3px; }
.column > span {
  display: block; width: 100%; min-height: 2px; height: calc(var(--h) * 100%); border-radius: 3px 3px 1px 1px;
  background: var(--series); transform-origin: bottom; animation: col-in 0.35s var(--ease) both;
}
.column.zero > span { background: var(--grid); }
.column:hover > span { opacity: 0.8; }
.column:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@keyframes col-in { from { transform: scaleY(0); } }
.axis { margin-top: 6px; display: flex; justify-content: space-between; color: var(--text-3); font-family: var(--mono); font-size: 10.5px; }
.chart-note { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); font-size: 12px; }
.chart-note b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.meter { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.meter > span { display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: 999px; background: var(--accent); }
.meter.warn > span { background: var(--warn); }
.meter.err > span { background: var(--err); }

/* ------------------------------------------------------------ linking */
.table td.side { min-width: 230px; padding-top: 10px; padding-bottom: 10px; vertical-align: top; }
.cands { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; }
.cands form { display: contents; }
.cands .btn .muted { font-weight: 500; font-size: 11px; }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
@container view (max-width: 640px) { .search-form { grid-template-columns: minmax(0, 1fr); } }
.facts { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.fact-miss { background: var(--warn-soft); color: var(--warn); }
.inline-form { display: inline; }
.bar-row { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr); align-items: center; gap: 12px; }
.bar-row + .bar-row { margin-top: 8px; }
.bar-label { overflow: hidden; color: var(--text-2); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }

.dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.dl dt { color: var(--text-3); font-size: 12px; }
.dl dd { margin: 0; color: var(--text); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ login */
.login-wrap { min-height: 100%; padding: 24px; display: grid; place-items: center; }
.login { width: min(400px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login .brand { margin-bottom: 4px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login footer { color: var(--text-3); font-size: 11.5px; text-align: center; }

@media (max-width: 720px) {
  .brand-slot { width: auto; }
  .brand-name, .conn .conn-text, .user-chip .name { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; width: auto; height: auto;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); flex-direction: row; overflow: visible; border-right: 0; border-top: 1px solid var(--border);
  }
  .side-nav { flex: 1; flex-direction: row; justify-content: space-between; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .side-nav a { flex: none; }
  .nav-label, .nav-count, .side-foot { display: none; }
  .side-nav a { height: 52px; min-width: 58px; padding: 0 8px; flex-direction: column; justify-content: center; gap: 3px; font-size: 10.5px; }
  .side-nav a .nav-text { flex: none; }
  .side-nav a[aria-current="page"] { box-shadow: none; }
  .view { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .view { animation-name: fade-in; }
  .btn:active { transform: none; }
  .toggle::after, .sidebar, .brand-slot { transition: none; }
  .column > span { animation: none; }
}
@keyframes fade-in { from { opacity: 0; } }
