/* Innova Threat Intelligence — styles.
   Chart colours follow the dataviz reference palette (validated): one blue for single-series
   marks, a blue ordinal ramp for ordered bins, and reserved status colours (always icon + label). */

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --page: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f1f0ec;
  --hover: rgba(11, 11, 11, 0.045);
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a65;
  --faint: #898781;
  --line: #e7e6e1;
  --line-2: #d9d8d2;
  --grid: #e1e0d9;
  --axis: #c3c2b7;

  --brand: #ffa300;
  --brand-hover: #f09900;
  --brand-ink: #1f1300;
  --brand-wash: #fff4dc;
  --brand-text: #8f5400;
  --link: #1c5cab;
  --focus: #2a78d6;

  --series: #2a78d6;
  --series-hover: #1c5cab;
  --series-track: #cde2fb;
  --ord-1: #86b6ef;
  --ord-2: #5598e7;
  --ord-3: #2a78d6;
  --ord-4: #1c5cab;
  --ord-5: #104281;

  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --other: #898781;
  --unset: #d9d8d2;
  --good-text: #006300;
  --warning-text: #7a4a00;
  --critical-text: #b3261e;
  --good-wash: #e8f6e8;
  --warning-wash: #fff4d6;
  --critical-wash: #fdeceb;

  --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.05);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 12px 32px rgba(11, 11, 11, 0.07);
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #1f1f1e; --surface-3: #262624; --hover: rgba(255, 255, 255, 0.05);
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a29a; --faint: #898781;
    --line: #2c2c2a; --line-2: #383835; --grid: #2c2c2a; --axis: #383835;
    --brand-wash: rgba(255, 163, 0, 0.13); --brand-text: #ffb84d; --link: #86b6ef; --focus: #6da7ec;
    --series: #3987e5; --series-hover: #6da7ec; --series-track: #0d366b;
    --ord-1: #184f95; --ord-2: #256abf; --ord-3: #3987e5; --ord-4: #6da7ec; --ord-5: #9ec5f4;
    --unset: #4a4a46; --good-text: #46c346; --warning-text: #fab219; --critical-text: #ef7373;
    --good-wash: rgba(12, 163, 12, 0.15); --warning-wash: rgba(250, 178, 25, 0.14); --critical-wash: rgba(208, 59, 59, 0.18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5); --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #1f1f1e; --surface-3: #262624; --hover: rgba(255, 255, 255, 0.05);
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #a3a29a; --faint: #898781;
  --line: #2c2c2a; --line-2: #383835; --grid: #2c2c2a; --axis: #383835;
  --brand-wash: rgba(255, 163, 0, 0.13); --brand-text: #ffb84d; --link: #86b6ef; --focus: #6da7ec;
  --series: #3987e5; --series-hover: #6da7ec; --series-track: #0d366b;
  --ord-1: #184f95; --ord-2: #256abf; --ord-3: #3987e5; --ord-4: #6da7ec; --ord-5: #9ec5f4;
  --unset: #4a4a46; --good-text: #46c346; --warning-text: #fab219; --critical-text: #ef7373;
  --good-wash: rgba(12, 163, 12, 0.15); --warning-wash: rgba(250, 178, 25, 0.14); --critical-wash: rgba(208, 59, 59, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5); --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* ───────────── base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-sm { width: 15px; height: 15px; }
.ic-xl { width: 30px; height: 30px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────────── boot / spinner ───────────── */
.boot { min-height: 100vh; display: grid; place-content: center; gap: 12px; justify-items: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── buttons ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 550; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.spinning .ic { animation: spin 0.9s linear infinite; }
.toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.toggle:hover { background: var(--surface-3); }
.toggle[aria-pressed="true"] { background: var(--brand-wash); border-color: var(--brand); color: var(--ink); }

/* ───────────── sign-in ───────────── */
.login { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 32px 16px; }
.login-card {
  width: min(400px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px 24px; text-align: center;
}
.login-mark { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 14px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); }
.login-logo { max-height: 40px; max-width: 180px; margin: 0 auto 10px; display: block; }
.login h1 { font-size: 21px; font-weight: 650; }
.login-customer { margin: 4px 0 0; color: var(--ink-2); }
.login-form { display: grid; gap: 10px; margin-top: 22px; text-align: left; }
.login-form label { font-weight: 550; font-size: 13px; color: var(--ink-2); }
.login-form input {
  height: 42px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface); font-size: 15px;
}
.login-form input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
#otp { font-size: 22px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.login-hint { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.dev-otp { border: 1px dashed var(--brand); background: var(--brand-wash); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dev-otp strong { font-family: var(--mono); font-size: 16px; letter-spacing: 3px; }
.form-msg { min-height: 20px; margin: 14px 0 0; font-size: 13px; color: var(--critical-text); }
.form-msg.ok { color: var(--good-text); }
.login-foot { color: var(--muted); font-size: 12.5px; margin: 0; }

/* ───────────── top bar ───────────── */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { max-width: 1360px; margin: 0 auto; height: var(--topbar-h); padding: 0 20px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-weight: 650; font-size: 15px; white-space: nowrap; }
.brand-customer { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tabs { display: flex; gap: 2px; align-self: stretch; }
.tabs a {
  display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); font-weight: 550; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; background: var(--hover); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.sync { color: var(--muted); font-size: 12.5px; margin-right: 6px; white-space: nowrap; }
.user { position: relative; margin-left: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface-3); font-weight: 650; font-size: 12.5px; letter-spacing: 0.3px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 40;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-email { font-weight: 600; word-break: break-all; }
.menu-role { color: var(--muted); font-size: 12.5px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; text-align: left; }
.menu-item:hover { background: var(--hover); }

/* ───────────── filter bar ───────────── */
.filterbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.filterbar-inner { max-width: 1360px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 380px; }
.search .ic { position: absolute; left: 10px; color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 34px; padding: 0 10px 0 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface-2);
}
.search input:focus, .select select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; background: var(--surface); }
.select { display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); padding-left: 10px; }
.select span { color: var(--muted); font-size: 12.5px; margin-right: 2px; white-space: nowrap; }
.select select { height: 32px; border: 0; background: transparent; padding: 0 6px; font-weight: 550; max-width: 170px; border-radius: var(--radius-sm); }
.chips { display: contents; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px;
  background: var(--brand-wash); border: 1px solid var(--brand); font-size: 12.5px; font-weight: 550;
}
.chip-filter button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); }
.chip-filter button:hover { background: var(--hover); color: var(--ink); }
.chip-filter .ic { width: 13px; height: 13px; }

/* ───────────── layout ───────────── */
.content { max-width: 1360px; margin: 0 auto; padding: 20px 20px 48px; }
.page { display: grid; gap: 16px; transition: opacity 0.2s; }
.page.loading { opacity: 0.55; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-title { font-size: 15px; font-weight: 650; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 14px 18px 18px; }
.card-body.flush { padding: 10px 0 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 19px; font-weight: 650; }
.page-sub { color: var(--muted); margin-top: 2px; }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid var(--line-2); background: var(--surface); }
.banner.error { border-color: var(--critical); background: var(--critical-wash); }
.banner.info { border-color: var(--line-2); background: var(--surface-2); }
.banner .ic { margin-top: 1px; }

/* ───────────── KPIs ───────────── */
.kpis { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi-hero { grid-row: span 2; justify-content: center; padding: 22px 24px; }
.kpi-label { color: var(--ink-2); font-size: 13px; font-weight: 550; }
.kpi-value { font-size: 30px; font-weight: 650; line-height: 1.1; letter-spacing: -0.3px; }
.kpi-value small { font-size: 14px; font-weight: 550; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.kpi-hero .kpi-value { font-size: 60px; letter-spacing: -1.5px; }
.kpi-hero .kpi-label { font-size: 15px; color: var(--ink); font-weight: 600; }
.kpi-note { color: var(--muted); font-size: 12.5px; }
.game-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.game-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); font-weight: 550; font-size: 13px;
}
.game-chip strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.game-chip:hover:not(:disabled) { background: var(--surface-3); }
.game-chip[aria-pressed="true"] { background: var(--brand-wash); border-color: var(--brand); }
.game-chip:disabled { cursor: default; color: var(--muted); }
.kpi-hero .kpi-note { font-size: 13.5px; margin-top: 6px; }

/* ───────────── chips & status ───────────── */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 550; white-space: nowrap; }
.chip-warn { background: var(--warning-wash); color: var(--warning-text); }
.chip-new { background: var(--brand-wash); color: var(--brand-text); }
.chips-row { display: flex; flex-wrap: wrap; gap: 4px; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; white-space: nowrap; max-width: 220px; }
.status span { overflow: hidden; text-overflow: ellipsis; }
.status .ic { width: 15px; height: 15px; }
.status-resolved .ic { color: var(--good); }
.status-actioned .ic { color: var(--warning); }
.status-active .ic { color: var(--critical); }
.status-other .ic { color: var(--other); }
.status-unset { color: var(--muted); font-weight: 500; }
.status-unset .ic { color: var(--faint); }

/* ───────────── meter list ───────────── */
.meters { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.meter-row {
  display: grid; grid-template-columns: minmax(110px, 36%) minmax(60px, 1fr) auto; align-items: center; gap: 12px;
  width: calc(100% + 16px); padding: 7px 8px; margin: 0 -8px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left;
}
button.meter-row:hover { background: var(--hover); }
button.meter-row:hover .meter-fill { background: var(--series-hover); }
.meter-name { display: flex; flex-direction: column; min-width: 0; }
.meter-label { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-track { height: 8px; border-radius: 4px; background: var(--series-track); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 4px; background: var(--series); min-width: 4px; }
.meter-val { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); font-size: 13px; text-align: right; }
.meter-val strong { color: var(--ink); font-weight: 650; }
.meter-more { color: var(--muted); font-size: 12.5px; padding: 6px 0 0; }

/* ───────────── column chart ───────────── */
.colchart { position: relative; width: 100%; }
.colchart svg { display: block; overflow: visible; }
.colchart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.colchart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.colchart .tick { fill: var(--faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.colchart .xlabel { fill: var(--faint); font-size: 11px; }
.colchart .vlabel { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.colchart .col { fill: var(--series); pointer-events: none; }
.colchart .col.ord-1 { fill: var(--ord-1); }
.colchart .col.ord-2 { fill: var(--ord-2); }
.colchart .col.ord-3 { fill: var(--ord-3); }
.colchart .col.ord-4 { fill: var(--ord-4); }
.colchart .col.ord-5 { fill: var(--ord-5); }
.colchart .hit { fill: transparent; cursor: default; }
.colchart .hit:hover + .col, .colchart .hit:focus-visible + .col { filter: brightness(1.15); }
.colchart .hit:focus { outline: none; }
.colchart .hit:focus-visible { stroke: var(--focus); stroke-width: 2; }

/* ───────────── segmented bar ───────────── */
.segbar { display: flex; gap: 2px; height: 28px; }
.seg { position: relative; min-width: 6px; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; color: #fff; font-size: 12px; font-weight: 650; overflow: hidden; }
.seg span { white-space: nowrap; }
.seg-resolved { background: var(--good); }
.seg-actioned { background: var(--warning); color: #0b0b0b; }
.seg-active { background: var(--critical); }
.seg-other { background: var(--other); }
.seg-unset { background: var(--unset); color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ───────────── tables ───────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--ink-2);
  font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 4px; }
table.data th button:hover { color: var(--ink); }
table.data th .ic { width: 13px; height: 13px; opacity: 0; transition: transform 0.15s; }
table.data th[aria-sort] .ic { opacity: 1; }
table.data th[aria-sort="ascending"] .ic { transform: rotate(180deg); }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: var(--hover); }
table.data tbody tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
table.data .num, table.data td.r { text-align: right; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 12px; }
.t-target { min-width: 190px; }
.t-ref { width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; }
.simple-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.simple-table th, .simple-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.simple-table th { color: var(--ink-2); font-weight: 600; font-size: 12px; }
.simple-table td.r, .simple-table th.r { text-align: right; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .spacer { flex: 1; }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* latest list */
.latest { list-style: none; margin: 0; padding: 0; }
.latest li + li { border-top: 1px solid var(--line); }
.latest button {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%;
  padding: 10px 18px; border: 0; background: none; text-align: left;
}
.latest button:hover { background: var(--hover); }
.latest-date { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.latest-main { min-width: 0; }
.latest-main .cell-main, .latest-main .cell-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* empty states */
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { width: 26px; height: 26px; color: var(--faint); }
.empty strong { color: var(--ink); font-weight: 600; }

/* ───────────── drawer ───────────── */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(11, 11, 11, 0.32); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(600px, 100vw); background: var(--surface);
  box-shadow: var(--shadow); display: flex; flex-direction: column; border-left: 1px solid var(--line);
}
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
.drawer-top { display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h2 { font-size: 19px; font-weight: 650; word-break: break-word; flex: 1; }
.drawer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--ink-2); font-size: 13px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 6px 20px 24px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; flex-wrap: wrap; }
.section { padding: 16px 0 4px; }
.section + .section { border-top: 1px solid var(--line); }
.section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); font-weight: 650; margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.multiline { white-space: pre-line; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.link-list li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.link-list a, .link-list .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.platform { flex: none; min-width: 74px; }
.copy-btn { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--muted); }
.copy-btn:hover { background: var(--hover); color: var(--ink); }
.copy-btn .ic { width: 14px; height: 14px; }
.contact-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.contact-row + .contact-row { margin-top: 6px; }
.contact-row .grow { flex: 1; min-width: 0; }
.contact-value { font-weight: 600; overflow-wrap: anywhere; }
.evidence { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.evidence img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; background: var(--surface-3); }
.evidence-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; border-top: 1px solid var(--line); }
.evidence-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note { color: var(--muted); font-size: 12.5px; }
.issue { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 4px 0; }
.issue .ic { width: 15px; height: 15px; margin-top: 2px; }
.issue.warn .ic { color: var(--warning); }
.issue.info .ic { color: var(--faint); }

/* tooltip & toast */
.tooltip {
  position: fixed; z-index: 80; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 7px 10px;
  display: grid; gap: 1px; font-size: 12.5px; max-width: 260px;
}
.tooltip strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.tooltip span { color: var(--ink-2); }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--surface); padding: 9px 14px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow);
}

/* ───────────── responsive ───────────── */
@media (max-width: 1040px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 8px; gap: 0 12px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; height: 42px; margin: 0 -20px; padding: 0 12px; scrollbar-width: none; }
  .sync { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-hero { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 600px) {
  .topbar-inner, .filterbar-inner, .content { padding-left: 16px; padding-right: 16px; }
  .tabs { margin: 0 -16px; padding: 0 8px; }
  .brand-title { font-size: 14px; }
  .kpis { grid-template-columns: 1fr; }
  .kpi-hero .kpi-value { font-size: 50px; }
  .search { max-width: none; flex-basis: 100%; }
  .select { flex: 1 1 auto; }
  .select select { max-width: none; flex: 1; }
  .meter-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .meter-track { grid-column: 1 / -1; grid-row: 2; }
  .latest button { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px; }
  .latest-date { grid-column: 1 / -1; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .drawer-body { padding: 4px 16px 20px; }
  .drawer-head, .drawer-foot { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
  .meter-fill, .colchart .col, .seg { forced-color-adjust: none; }
}
