/* Tokens: Titans Global brand (titans.global: gold on near-black), dark first.
   Gold is UI chrome only (buttons, links, focus, active states, meter); data keeps the fixed
   status colours for severity. Every text pair below measures at least 4.5:1. */
:root {
  color-scheme: dark;
  --page: #060607;
  --surface: #0c0c0e;
  --surface-2: #121317;
  --surface-3: #1a1b20;
  --ink: #edebe6;
  --ink-2: #b9b5ac;
  --muted: #8f8b81;
  --grid: #24252b;
  --axis: #34353c;
  --border: rgba(237, 235, 230, 0.10);
  --border-strong: rgba(237, 235, 230, 0.18);
  --accent: #c5a572;
  --accent-hover: #d4b98a;
  --accent-strong: #d4b98a;
  --accent-wash: rgba(197, 165, 114, 0.14);
  --accent-ink: #0c0c0e;
  --focus: #c5a572;
  --meter-track: #2e2719;
  --meter-fill: #c5a572;
  --good: #0ca30c;
  --bad: #e66767;
  --sev-critical: #d03b3b;
  --sev-high: #ec835a;
  --sev-medium: #fab219;
  --sev-low: #8f8d86;
  --warn-wash: rgba(250, 178, 25, 0.12);
  --bad-wash: rgba(230, 103, 103, 0.12);
  /* severity chips: solid letter badge, tinted count box, count ink (all pairs >= 5.7:1) */
  --chip-critical: #b42a2a; --chip-critical-bg: #3a1f1e; --chip-critical-ink: #f4a8a5;
  --chip-high: #a8461b; --chip-high-bg: #3b2619; --chip-high-ink: #f3b694;
  --chip-medium: #865700; --chip-medium-bg: #382d12; --chip-medium-ink: #f1cd7f;
  --chip-low: #635d56; --chip-low-bg: #2e2d2a; --chip-low-ink: #d3d0c8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.55);
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f6f4ef;
  --surface: #fffdf9;
  --surface-2: #efebe3;
  --surface-3: #e6e1d6;
  --ink: #14110a;
  --ink-2: #55524b;
  --muted: #625e56;
  --grid: #e4e0d6;
  --axis: #cfc9bb;
  --border: rgba(20, 17, 10, 0.10);
  --border-strong: rgba(20, 17, 10, 0.18);
  --accent: #bb9d62;
  --accent-hover: #a88a52;
  --accent-strong: #7a5f2e;
  --accent-wash: rgba(187, 157, 98, 0.16);
  --accent-ink: #14110a;
  --focus: #7a5f2e;
  --meter-track: #ece3cf;
  --meter-fill: #8c6f3a;
  --good: #006300;
  --bad: #b8302f;
  --warn-wash: rgba(250, 178, 25, 0.14);
  --bad-wash: rgba(208, 59, 59, 0.10);
  --chip-critical: #a3191b; --chip-critical-bg: #fde3e1; --chip-critical-ink: #8b1517;
  --chip-high: #b0431a; --chip-high-bg: #fde6da; --chip-high-ink: #8c3511;
  --chip-medium: #865400; --chip-medium-bg: #fcecd0; --chip-medium-ink: #6b4300;
  --chip-low: #686059; --chip-low-bg: #ebe9e5; --chip-low-ink: #4d4640;
  --shadow: 0 1px 2px rgba(20, 17, 10, 0.05), 0 8px 24px rgba(20, 17, 10, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
svg { fill: currentColor; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-2); }
.faint { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); padding: 4px 8px; text-decoration: none !important; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand svg path:first-child { fill: var(--accent); }
.brand svg .tick { fill: none; stroke: var(--accent-ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand span { display: flex; flex-direction: column; font-weight: 650; line-height: 1.2; }
.brand small { font-weight: 500; color: var(--ink-2); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 550; text-decoration: none; }
.nav a svg { width: 18px; height: 18px; opacity: 0.8; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-wash); color: var(--accent-strong); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.sys { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.sys a { color: inherit; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot-ok { background: var(--good); }
.dot-warn { background: var(--sev-medium); }
.dot-bad { background: var(--sev-critical); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--ink-2); font-size: 13px; min-width: 0; }
.crumbs a { color: var(--ink-2); }
.crumbs .sep { color: var(--muted); }
.crumbs .here { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.view { padding: 24px 28px 64px; max-width: 1360px; width: 100%; outline: none; transition: opacity 0.15s; }
.view.refreshing { opacity: 0.55; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.page-head .lead { margin: 4px 0 0; color: var(--ink-2); max-width: 760px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.source-line { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-2); font-size: 13px; margin-top: 6px; }
.source-line > span { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--bad); }
.btn-danger.confirm { background: var(--sev-critical); border-color: var(--sev-critical); color: #fff; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-strong); font: inherit; font-weight: 550; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); font: inherit; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
label.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
details.advanced { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
details.advanced summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
details.advanced[open] summary { margin-bottom: 14px; }
.form-error { color: var(--bad); font-weight: 550; margin: 10px 0 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.card + .card, .grid-2 + .card, .card + .grid-2, .kpis + .card, .kpis + .grid-2, .notice + .card, .notice + .kpis, .tabs + .card { margin-top: 16px; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.card-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.grid-2 > .card { margin: 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--warn-wash); margin-bottom: 16px; font-size: 13.5px; }
.notice.bad { background: var(--bad-wash); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ink-2); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- stat tiles & meter ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.tile-label { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 550; }
.tile-value { font-size: 28px; font-weight: 650; line-height: 1.2; margin-top: 4px; letter-spacing: -0.02em; }
.tile-delta { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.tile-delta .up-bad, .tile-delta .down-bad { color: var(--bad); font-weight: 600; }
.tile-delta .down-good, .tile-delta .up-good { color: var(--good); font-weight: 600; }
.meter { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-2); }
.meter-top { display: flex; justify-content: space-between; gap: 8px; }
.meter-top strong { color: var(--ink); font-weight: 600; }
.meter-track { height: 6px; border-radius: 3px; background: var(--meter-track); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 0 3px 3px 0; background: var(--meter-fill); }
.meter-fill.warn { background: var(--sev-medium); }
.meter-fill.over { background: var(--sev-critical); }

/* ---------- severity & status badges ---------- */
.sev { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 550; }
.sev-ic { width: 11px; height: 11px; flex: none; }
.sev-ic.critical { fill: var(--sev-critical); }
.sev-ic.high { fill: var(--sev-high); }
.sev-ic.medium { fill: var(--sev-medium); }
.sev-ic.low { fill: var(--sev-low); }
.sev-chips { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; vertical-align: middle; }
.sev-chip { display: inline-flex; border-radius: 5px; overflow: hidden; font-size: 12.5px; line-height: 24px; font-variant-numeric: tabular-nums; }
.sev-chip-n { min-width: 40px; padding: 0 7px; text-align: right; font-weight: 500; }
.sev-chip-l { width: 22px; text-align: center; font-weight: 700; color: #fff; }
.sev-chip.critical .sev-chip-n { background: var(--chip-critical-bg); color: var(--chip-critical-ink); }
.sev-chip.critical .sev-chip-l { background: var(--chip-critical); }
.sev-chip.high .sev-chip-n { background: var(--chip-high-bg); color: var(--chip-high-ink); }
.sev-chip.high .sev-chip-l { background: var(--chip-high); }
.sev-chip.medium .sev-chip-n { background: var(--chip-medium-bg); color: var(--chip-medium-ink); }
.sev-chip.medium .sev-chip-l { background: var(--chip-medium); }
.sev-chip.low .sev-chip-n { background: var(--chip-low-bg); color: var(--chip-low-ink); }
.sev-chip.low .sev-chip-l { background: var(--chip-low); }
.sev-chip.zero { opacity: 0.42; }
.table td.chips-cell { padding-top: 7px; padding-bottom: 7px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.done::before { background: var(--good); }
.status.failed::before, .status.canceled::before { background: var(--sev-critical); }
.status.running::before { background: var(--accent); animation: pulse 1.2s infinite; }
.status.queued::before, .status.skipped::before { background: var(--sev-medium); }
.import-table { max-height: 460px; overflow-y: auto; border: 1px solid var(--border); }
.import-table thead th { position: sticky; top: 0; z-index: 1; }
.import-foot { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-top: 14px; }
.import-summary { color: var(--ink-2); font-size: 13.5px; }
.import-summary strong { color: var(--ink); }
@keyframes pulse { 50% { opacity: 0.3; } }
.tag { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.new { background: var(--accent-wash); color: var(--accent-strong); }
.tag.license { background: var(--surface-3); }

/* ---------- charts ---------- */
.chart { margin: 0; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: baseline; margin-bottom: 10px; }
.chart-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 0; list-style: none; font-size: 12.5px; color: var(--ink-2); }
.legend li { display: inline-flex; gap: 6px; align-items: center; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 30%) minmax(0, 1fr); gap: 12px; align-items: center; }
.hbar-label { min-width: 0; font-size: 13px; line-height: 1.3; }
.hbar-label a, .hbar-label span.name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 550; }
.hbar-label small { display: block; color: var(--ink-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-area { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 0; border-radius: 4px; cursor: default; }
.hbar-area:focus-visible { outline-offset: 0; }
.hbar-bar { display: flex; flex: none; gap: 2px; height: 16px; min-width: min-content; }
.hbar-seg { height: 100%; min-width: 3px; transition: filter 0.1s; }
.hbar-seg:last-child { border-radius: 0 4px 4px 0; }
.hbar-seg.critical { background: var(--sev-critical); }
.hbar-seg.high { background: var(--sev-high); }
.hbar-seg.medium { background: var(--sev-medium); }
.hbar-seg.low { background: var(--sev-low); }
.hbar-area:hover .hbar-seg, .hbar-area:focus-visible .hbar-seg { filter: saturate(0.75) brightness(1.04); }
.hbar-area .hbar-seg.hot { filter: none; }
.hbar-val { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-zero { font-size: 12.5px; color: var(--ink-2); }
.cols { width: 100%; display: block; overflow: visible; }
.cols .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.cols .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.cols text { fill: var(--ink-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cols .cap { fill: var(--ink-2); font-size: 12px; font-weight: 600; }
.cols .seg.critical { fill: var(--sev-critical); }
.cols .seg.high { fill: var(--sev-high); }
.cols .seg.medium { fill: var(--sev-medium); }
.cols .seg.low { fill: var(--sev-low); }
.cols .hit { fill: transparent; cursor: pointer; }
.cols .col:hover .hit, .cols .col:focus-visible .hit { fill: var(--accent-wash); }
.cols .col:focus { outline: none; }
.chart-table { margin-top: 12px; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 170px; max-width: 320px; padding: 10px 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow);
  font-size: 12.5px;
}
.tooltip .tt-title { color: var(--ink-2); margin-bottom: 6px; font-weight: 550; overflow-wrap: anywhere; }
.tooltip .tt-row { display: grid; grid-template-columns: 14px auto 1fr; gap: 8px; align-items: center; }
.tooltip .tt-row + .tt-row { margin-top: 3px; }
.tooltip .tt-row strong { font-variant-numeric: tabular-nums; font-size: 13px; }
.tooltip .tt-row span { color: var(--ink-2); }
.tooltip .tt-row.dim { opacity: 0.55; }
.tooltip .tt-key { width: 14px; height: 3px; border-radius: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 8px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--axis); white-space: nowrap; background: var(--surface); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.n, .table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.zero { color: var(--muted); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table .title { font-weight: 550; }
.table .keep, .table .sub.keep { overflow-wrap: normal; word-break: normal; }
.table .sub { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.table th.sortable { cursor: pointer; }
.issue-detail td { background: var(--surface-2); padding: 14px 16px 16px; }
/* Long advisory text in the expanded row must not widen or squeeze the table's columns. */
.issue-detail td > div { width: 0; min-width: 100%; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; font-size: 13px; }
.detail-grid dt { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.detail-grid dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.paths { margin: 10px 0 0; padding-left: 18px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.advisory { max-width: 920px; margin: 0 0 16px; }
.advisory.refs-block { margin: 16px 0 0; }
.advisory h4 { margin: 0 0 6px; font-size: 13px; font-weight: 650; color: var(--ink); }
.md { font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md code, .refs code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--surface); border: 1px solid var(--border); }
.md pre { margin: 0 0 8px; padding: 8px 10px; overflow-x: auto; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); }
.md pre code { padding: 0; border: 0; background: none; }
.refs { margin: 0; padding-left: 18px; font-size: 13px; }
.refs li { margin: 2px 0; overflow-wrap: anywhere; }
.paths li { overflow-wrap: anywhere; }
.chev { width: 14px; height: 14px; transition: transform 0.15s; color: var(--muted); vertical-align: -2px; }
tr.open .chev { transform: rotate(90deg); }
.more-row { display: flex; justify-content: center; padding: 12px; }

/* ---------- filters & tabs ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 14px; }
.filters input[type="search"] { width: 260px; max-width: 100%; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--focus); color: var(--ink); }
.chip .count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.result-count { color: var(--ink-2); font-size: 13px; margin-left: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--focus); }
.tabs .count { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ---------- menus ---------- */
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); }
.menu-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--surface-2); }
.menu-list button small { color: var(--ink-2); font-size: 12px; }
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }

/* ---------- job pill, drawer, toasts ---------- */
.job-pill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; max-width: 360px; }
.job-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-wash); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.drawer {
  position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(820px, calc(100vw - 32px)); height: min(52vh, 560px);
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.drawer-title { display: flex; gap: 10px; align-items: center; min-width: 0; }
.drawer-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-actions { display: flex; gap: 6px; align-items: center; }
.steps { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 0; padding: 8px 16px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--border); }
.steps li { display: inline-flex; align-items: center; gap: 6px; }
.steps li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.steps li.done::before { background: var(--good); }
.steps li.running::before { background: var(--accent); animation: pulse 1.2s infinite; }
.steps li.failed::before { background: var(--sev-critical); }
.log { flex: 1; margin: 0; padding: 10px 16px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--ink-2); background: var(--page); white-space: pre-wrap; overflow-wrap: anywhere; }
.log.full { max-height: 70vh; border-radius: 8px; border: 1px solid var(--border); }
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); font-weight: 550; max-width: 420px; }
.toast.bad { border-left: 3px solid var(--sev-critical); }
.toast.good { border-left: 3px solid var(--good); }
.toast a, .toast button { margin-left: auto; }

/* ---------- sign-in and accounts ---------- */
.auth-mode .app, .auth-mode .skip { display: none; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--page); }
.auth-wrap { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-brand { display: flex; gap: 10px; align-items: center; justify-content: center; font-weight: 650; }
.auth-brand svg { width: 32px; height: 32px; }
.auth-brand svg path:first-child { fill: var(--accent); }
.auth-brand svg .tick { fill: none; stroke: var(--accent-ink); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.auth-brand span { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand small { font-weight: 500; color: var(--ink-2); font-size: 12px; }
.auth-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 19px; }
.auth-card p { margin: -6px 0 0; }
.auth-card input { height: 40px; }
.auth-card .form-actions { margin-top: 4px; }
.btn-block { width: 100%; height: 40px; }
.notice.info { background: var(--accent-wash); }
.secret { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.secret code { font-size: 14px; padding: 4px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border-strong); user-select: all; overflow-wrap: anywhere; }
#userMenu .btn { height: 32px; }

.sys-list { display: grid; gap: 10px; }
.sys-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.sys-row:last-child { border-bottom: 0; }
.sys-row .label { font-weight: 600; }
.sys-row .val { color: var(--ink-2); overflow-wrap: anywhere; }
.file-drop { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1.5px dashed var(--border-strong); border-radius: 10px; text-align: center; color: var(--ink-2); }
.file-drop.over { border-color: var(--accent); background: var(--accent-wash); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 0; width: 100%; }
  .sys { display: none; }
  .top { padding: 10px 16px; position: static; flex-wrap: wrap; }
  .crumbs { flex: 1 1 100%; }
  .top-actions { width: 100%; justify-content: flex-end; }
  .job-pill { max-width: calc(100% - 44px); margin-right: auto; }
  .view { padding: 18px 16px 48px; }
  .hbar { grid-template-columns: 1fr; gap: 2px; }
  .sys-row { grid-template-columns: 1fr; gap: 2px; }
  .result-count { margin-left: 0; width: 100%; }
}
@media (forced-colors: active) {
  .hbar-seg, .cols .seg, .meter-fill { forced-color-adjust: none; }
}
