/* ==========================================================================
   FARHAN'S WATCHTOWER — AppSec Command · Threat Intelligence
   A dense enterprise SOC / threat-intel console. Deep slate-navy grounds,
   hairline borders, monospace data, corporate-azure accent + teal data marks.
   DARK-ONLY (light theme removed). PERF: static gradients/grid only — no
   backdrop-filter, no blur, no infinite background animation. The only loops
   are spinner / pulse / pulse-ring / the live-step ring. Transitions <=150ms.
   CLASS CONTRACT: every class app.js applies is styled here; names preserved.
   ========================================================================== */

/* ---------- design tokens (dark-only) ---------- */
:root {
  color-scheme: dark;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", ui-serif, serif;

  /* grounds — enterprise "executive slate": deep, cool slate-navy */
  --bg: #0b0f17;
  --bg-2: #0d1220;
  --panel: #121826;          /* solid: read by charts (doughnut border) */
  --panel-2: #161d2e;
  --elev: #1e2740;
  --border: rgba(148, 163, 199, 0.16);
  --border-2: rgba(148, 163, 199, 0.26);   /* gauge track / bar empty */
  --hairline: rgba(148, 163, 199, 0.08);
  --grid-line: rgba(148, 163, 199, 0.06);

  /* text — clean off-white on slate */
  --text: #e8ecf4;
  --text-dim: #9aa6bd;
  --text-faint: #6b7488;

  /* accent — trustworthy corporate azure */
  --accent: #3b82f6;
  --accent-hover: #5b97f8;
  --accent-active: #2f6bd8;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --accent-soft-2: rgba(59, 130, 246, 0.26);
  --on-accent: #ffffff;

  /* secondary — refined teal for links + data marks */
  --accent-2: #2bb3c0;
  --accent-2-soft: rgba(43, 179, 192, 0.14);
  --accent-2-soft-2: rgba(43, 179, 192, 0.26);

  /* functional semantics */
  --ok: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;

  /* severity — semantic + refined: critical red / high orange / medium amber /
     low green / info teal (kept distinct from the azure accent). */
  --sev-critical: #ef4444;
  --sev-high: #f97316;
  --sev-medium: #eab308;
  --sev-low: #22c55e;
  --sev-info: #2bb3c0;

  /* decision */
  --dec-go: #22c55e;
  --dec-cond: #eab308;
  --dec-nogo: #ef4444;

  /* chart theming (read via cssVar) */
  --chart-grid: rgba(148, 163, 199, 0.10);

  /* window-chrome traffic lights */
  --tl-red: #ff5f57;
  --tl-amber: #febc2e;
  --tl-green: #28c840;

  /* legacy alias kept for related-item (CSS-only; JS never reads it) */
  --glass-2: rgba(148, 163, 199, 0.05);

  /* shape — tight, tactical (less rounded than a consumer app) */
  --r-card: 9px;
  --r-ctl: 6px;
  --r-pill: 6px;

  --shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.85);
  --sheen: linear-gradient(180deg, rgba(148, 163, 199, 0.05), rgba(148, 163, 199, 0) 46%);

  --rail-w: 76px;
  --topbar-h: 66px;
  --maxw: 1360px;
}

/* Light theme intentionally removed — this console is dark-only. app.js always
   stamps data-theme="dark"; there is no light rendering path. */

/* ==========================================================================
   BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* static tactical grid — fixed, never animated (no blur, no loop) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px, 44px 44px;
  pointer-events: none;
}
/* static coral + cyan corner glows */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(58% 40% at 6% -6%, var(--accent-soft), transparent 70%),
    radial-gradient(48% 34% at 96% 2%, var(--accent-2-soft), transparent 72%);
  pointer-events: none;
}

/* theme toggle hidden — dark-only console (kept in DOM as the anchor boot()
   uses to inject the search bar + live chip; never shown / clickable) */
.theme-toggle { display: none !important; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

::selection { background: var(--accent-soft-2); color: var(--text); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }

/* ---------- utilities ---------- */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.accent { color: var(--accent); }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-0 { margin-top: 0 !important; }
.dot { color: var(--accent); }

.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.grid { display: grid; gap: 14px; }
.cols-2 { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

.hover-lift { transition: transform 0.13s ease, border-color 0.13s ease, box-shadow 0.13s ease; }
.hover-lift:hover { transform: translateY(-2px); border-color: var(--accent-soft-2); box-shadow: var(--shadow); }

/* ==========================================================================
   APP SHELL — left icon rail + top bar + workspace
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.content, .main-col { flex: 1 1 0%; min-width: 0; display: flex; flex-direction: column; }

/* ---------- LEFT ICON RAIL (~76px) ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px 10px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  z-index: 40;
}

/* brand glyph at top of the rail */
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 2px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}
.brand .brand-glyph {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--on-accent);
  background: linear-gradient(155deg, var(--accent-hover), var(--accent-active));
  box-shadow: 0 6px 18px -6px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.brand .brand-glyph svg { width: 24px; height: 24px; }
.brand .brand-text { display: flex; flex-direction: column; align-items: center; line-height: 1.05; min-width: 0; text-align: center; }
.brand .hud-wordmark {
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 8.5px;
  text-transform: uppercase;
  color: var(--text);
}
.brand .hud-wordmark .dot { color: var(--accent); }
.brand .hud-brand-sub {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* nav rail — vertical icon+label stack */
.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; padding-bottom: 6px; }
.nav::-webkit-scrollbar { width: 0; }
.nav-group-label {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  padding: 12px 0 3px;
  margin-top: 2px;
  border-top: 1px solid var(--hairline);
}
.nav-group-label:first-child { border-top: 0; padding-top: 2px; }

/* #nav button — icon over a tiny label; active gets coral left-bar + glow */
#nav button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 9px 3px 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
}
#nav button svg { width: 20px; height: 20px; flex: 0 0 20px; opacity: 0.9; }
#nav button:hover { background: var(--accent-soft); color: var(--text); }
#nav button.active { background: var(--accent-soft); color: var(--accent); }
#nav button.active svg { opacity: 1; }
#nav button.active::before {
  content: "";
  position: absolute;
  left: -8px; top: 12px; bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 10px 0 var(--accent);
}
.nav-label {
  min-width: 0;
  max-width: 100%;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* rail footer — engineer identity marker */
.rail-foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.rail-foot .rf-badge {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}
.rail-foot .rf-name {
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.25;
}

/* ---------- TOPBAR — big search + brand + live + whoami ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 20px;
  background: linear-gradient(180deg, var(--bg-2), color-mix(in srgb, var(--bg) 88%, transparent));
  border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1 1 auto; }

/* left cluster: wordmark + tagline over the dynamic breadcrumb */
.topbar-lead { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 0 0 auto; }
.topbar-brand { display: flex; flex-direction: column; line-height: 1.05; }
.topbar-brand .tb-word {
  font-weight: 850;
  font-size: 15.5px;
  letter-spacing: 0.01em;
  color: var(--text);
}
.topbar-brand .tb-word .dot { color: var(--accent); }
.topbar-brand .tb-tag {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* the big search bar is the injected .cmdk-hint; it fills the middle */
.topbar-search { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.sidebar-toggle {
  display: none;
  width: 38px; height: 38px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-ctl);
  background: var(--panel);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}

/* breadcrumb (topbar title) — sits under the wordmark */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; min-width: 0; }
.crumb-group { color: var(--text-faint); }
.crumb-leaf { color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb .sep { color: var(--text-faint); }

/* LIVE chip (env-chip, injected into .topbar-search) */
.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--ok) 34%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ok);
  flex: 0 0 auto;
}
.env-chip .pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: pulse 2s ease-out infinite;
}

/* the prominent full-width SEARCH bar */
.cmdk-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 14px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text-faint);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: text;
  transition: border-color 0.13s ease, color 0.13s ease;
}
.cmdk-hint:hover { border-color: var(--accent-soft-2); color: var(--text-dim); }
.cmdk-hint svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-dim); }
.cmdk-hint-text { display: inline; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-hint .kbd { margin-left: auto; flex: 0 0 auto; }

/* whoami — moved into the topbar */
.whoami { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.whoami b { font-size: 13px; font-weight: 700; color: var(--text); }

/* ==========================================================================
   WORKSPACE / PAGE
   ========================================================================== */
.container {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 22px 64px;
}

.page-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.page-title { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { margin: 0; color: var(--text-dim); font-size: 13.5px; max-width: 76ch; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ==========================================================================
   PANELS
   ========================================================================== */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px;
  margin-bottom: 16px;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 42%;
  background: var(--sheen);
  pointer-events: none;
}
.panel > * { position: relative; }
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}
.panel-title::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px 0 var(--accent-soft-2);
  flex: 0 0 8px;
}

/* window-chrome (auth hero cards) */
.win-chrome { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--hairline); }
.win-dots { display: inline-flex; gap: 7px; }
.win-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.win-dots i:nth-child(1) { background: var(--tl-red); }
.win-dots i:nth-child(2) { background: var(--tl-amber); }
.win-dots i:nth-child(3) { background: var(--tl-green); }
.win-title { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.06em; color: var(--text-dim); }
.win-live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease, transform 0.1s ease;
}
.btn:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); box-shadow: 0 8px 20px -12px var(--accent); }
.btn.primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn.primary:active { background: var(--accent-active); }

.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); color: var(--danger); }

.btn.small { padding: 6px 11px; font-size: 12px; }
.btn.btn-full { width: 100%; }
/* link-style button variant (.btn.link) */
.btn.link { background: transparent; border-color: transparent; color: var(--accent-2); padding-left: 6px; padding-right: 6px; }
.btn.link:hover { background: var(--accent-2-soft); color: var(--accent-2); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.link-btn { border: 0; background: none; color: var(--accent-2); font: inherit; font-weight: 600; padding: 2px 0; cursor: pointer; }
.link-btn:hover { color: var(--accent); text-decoration: underline; }

/* ==========================================================================
   KPI / STAT CARDS — big mono numerals
   ========================================================================== */
.kpi-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 15px 17px;
  overflow: hidden;
}
.kpi-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi-card.crit::before { background: var(--sev-critical); }
.kpi-card.high::before { background: var(--sev-high); }
.kpi-card.med::before  { background: var(--sev-medium); }
.kpi-card.low::before,
.kpi-card.ok::before   { background: var(--ok); }
.kpi-card .num {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.kpi-card .label {
  margin-top: 4px;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: var(--mono);
}
.trend { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.trend svg { width: 12px; height: 12px; }
.trend.up { color: var(--danger); }
.trend.down { color: var(--ok); }

/* ==========================================================================
   RISK GAUGE / POSTURE
   ========================================================================== */
.posture { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.risk-gauge { flex: 0 0 auto; }
.gauge-arc { transition: stroke-dashoffset 0.6s ease; }
.gauge-meta { display: flex; flex-direction: column; gap: 6px; min-width: 220px; flex: 1 1 240px; }
.gauge-tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); }
.gauge-verdict { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.gauge-verdict.tone-go { color: var(--dec-go); }
.gauge-verdict.tone-cond { color: var(--dec-cond); }
.gauge-verdict.tone-nogo { color: var(--dec-nogo); }
.gauge-sub { color: var(--text-dim); font-size: 13px; }

/* ==========================================================================
   SEVERITY BAR + LEGEND + SPARKLINE
   ========================================================================== */
.sev-bar { display: flex; height: 9px; border-radius: var(--r-pill); overflow: hidden; background: var(--border-2); margin: 10px 0; }
.sev-seg { display: block; height: 100%; }
.sev-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-dim); }
.sev-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.sparkline { display: block; width: 100%; }
.spark-area { opacity: 0.85; }

/* ==========================================================================
   BADGES / CHIPS / PILLS — coloured tag pills, dense
   ========================================================================== */
.tag, .dec, .gate, .conf, .status-chip, .pill, .kind-badge, .role-badge, .pre-badge, .new-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.55;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chips { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* severity tags — tinted fill + coloured text + hairline */
.tag { background: var(--border-2); color: var(--text); }
.tag.s-crit { background: color-mix(in srgb, var(--sev-critical) 16%, transparent); color: var(--sev-critical); border-color: color-mix(in srgb, var(--sev-critical) 34%, transparent); }
.tag.s-high { background: color-mix(in srgb, var(--sev-high) 16%, transparent); color: var(--sev-high); border-color: color-mix(in srgb, var(--sev-high) 34%, transparent); }
.tag.s-med  { background: color-mix(in srgb, var(--sev-medium) 18%, transparent); color: var(--sev-medium); border-color: color-mix(in srgb, var(--sev-medium) 36%, transparent); }
.tag.s-low  { background: color-mix(in srgb, var(--sev-low) 16%, transparent); color: var(--sev-low); border-color: color-mix(in srgb, var(--sev-low) 34%, transparent); }
.tag.s-info { background: color-mix(in srgb, var(--sev-info) 16%, transparent); color: var(--sev-info); border-color: color-mix(in srgb, var(--sev-info) 34%, transparent); }

/* decision badges */
.dec { text-transform: uppercase; letter-spacing: 0.06em; }
.dec.d-go   { background: color-mix(in srgb, var(--dec-go) 18%, transparent); color: var(--dec-go); border-color: color-mix(in srgb, var(--dec-go) 38%, transparent); }
.dec.d-cond { background: color-mix(in srgb, var(--dec-cond) 20%, transparent); color: var(--dec-cond); border-color: color-mix(in srgb, var(--dec-cond) 40%, transparent); }
.dec.d-nogo { background: color-mix(in srgb, var(--dec-nogo) 18%, transparent); color: var(--dec-nogo); border-color: color-mix(in srgb, var(--dec-nogo) 40%, transparent); }

/* gate badges */
.gate { text-transform: uppercase; letter-spacing: 0.08em; }
.gate.g-pass { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 36%, transparent); }
.gate.g-fail { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 36%, transparent); }
.gate.g-na   { background: var(--border-2); color: var(--text-dim); }
.gate.gate-hero { font-size: 12.5px; padding: 5px 13px; }

/* confidence chips */
.conf.c-high { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.conf.c-med  { background: color-mix(in srgb, var(--sev-medium) 16%, transparent); color: var(--sev-medium); }
.conf.c-low  { background: var(--border-2); color: var(--text-dim); }

/* triage status chips */
.status-chip { text-transform: capitalize; }
.status-chip.st-open      { background: color-mix(in srgb, var(--sev-high) 16%, transparent); color: var(--sev-high); }
.status-chip.st-ack       { background: color-mix(in srgb, var(--sev-info) 16%, transparent); color: var(--sev-info); }
.status-chip.st-fp        { background: var(--border-2); color: var(--text-dim); }
.status-chip.st-resolved  { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* generic pill + tones */
.pill { background: var(--border-2); color: var(--text-dim); }
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.pill.ok, .pill.low { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.high { background: color-mix(in srgb, var(--sev-high) 16%, transparent); color: var(--sev-high); }
.pill.mag { background: var(--accent-2-soft); color: var(--accent-2); border-color: var(--accent-2-soft-2); }

/* kind badges */
.kind-badge { text-transform: capitalize; background: var(--border-2); color: var(--text-dim); }
.kind-badge.backend  { background: var(--accent-2-soft); color: var(--accent-2); }
.kind-badge.frontend { background: var(--accent-soft); color: var(--accent); }
.kind-badge.other    { background: var(--border-2); color: var(--text-dim); }

/* role badges */
.role-badge { background: var(--border-2); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-size: 9.5px; }
.role-badge.owner { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.role-badge.viewer { background: var(--border-2); color: var(--text-dim); }

/* pre-existing / new markers */
.pre-badge { background: var(--border-2); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; font-size: 9.5px; }
.new-badge { background: var(--accent); color: var(--on-accent); text-transform: uppercase; letter-spacing: 0.1em; font-size: 9.5px; font-weight: 700; }

/* keyboard hint */
.kbd {
  display: inline-flex;
  align-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* status dot (+ live / ok / err) */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: 0 0 8px; }
.status-dot.ok { background: var(--ok); }
.status-dot.err { background: var(--danger); }
.status-dot.live { background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); animation: pulse 2s ease-out infinite; }

/* job status text */
[class^="job-"], [class*=" job-"] { font-family: var(--mono); font-size: 12px; text-transform: capitalize; }
.job-queued { color: var(--text-dim); }
.job-cloning, .job-diffing, .job-reviewing { color: var(--accent-2); }
.job-done { color: var(--ok); }
.job-error { color: var(--danger); }

/* ==========================================================================
   DECISION HERO + DECISION LINE
   ========================================================================== */
.decision-hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 17px 19px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  background: var(--panel-2);
  overflow: hidden;
}
.decision-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--text-faint); }
.decision-hero.dh-go::before { background: var(--dec-go); }
.decision-hero.dh-cond::before { background: var(--dec-cond); }
.decision-hero.dh-nogo::before { background: var(--dec-nogo); }
.dh-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: var(--text-faint); flex: 0 0 12px; }
.dh-go .dh-dot { background: var(--dec-go); }
.dh-cond .dh-dot { background: var(--dec-cond); }
.dh-nogo .dh-dot { background: var(--dec-nogo); }
.dh-main { min-width: 0; }
.dh-tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.dh-verdict { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 2px 0; }
.dh-go .dh-verdict { color: var(--dec-go); }
.dh-cond .dh-verdict { color: var(--dec-cond); }
.dh-nogo .dh-verdict { color: var(--dec-nogo); }
.dh-sub { color: var(--text-dim); font-size: 13.5px; }

.decision-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.decision-line .fl { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.dr { color: var(--text-dim); font-size: 13px; }

/* ==========================================================================
   DENSE DATA TABLES — monospace cells, row hover highlight
   ========================================================================== */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  overflow-x: auto;
  background: var(--panel);
  margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 9px 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--panel-2);
}
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th.right, td.right { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.row-link { cursor: pointer; transition: background 0.13s ease; }
tbody tr.row-link:hover { background: var(--accent-soft); }
tbody tr.row-link:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ==========================================================================
   FINDING CARDS
   ========================================================================== */
.finding-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--text-faint);
  border-radius: var(--r-card);
  padding: 15px 17px;
  margin-bottom: 12px;
}
.finding-card.lvl-critical { border-left-color: var(--sev-critical); }
.finding-card.lvl-high { border-left-color: var(--sev-high); }
.finding-card.lvl-medium { border-left-color: var(--sev-medium); }
.finding-card.lvl-low { border-left-color: var(--sev-low); }
.finding-card.lvl-info { border-left-color: var(--sev-info); }
.finding-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.finding-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; }
.finding-loc { font-family: var(--mono); font-size: 12px; color: var(--text-dim); word-break: break-all; }

/* fields */
.field { display: flex; flex-direction: column; gap: 3px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 12px 0; }
.field-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.field-value { font-size: 13.5px; color: var(--text); }
.field-value.mono { font-family: var(--mono); }

/* path / url display */
.path { color: var(--text-dim); word-break: break-all; }

/* ==========================================================================
   CODE + DIFF
   ========================================================================== */
.code-block {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  margin: 10px 0;
}
.code-block.ok { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

.diff-view {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  overflow: hidden;
  overflow-x: auto;
  margin: 10px 0;
}
.diff-row { display: flex; align-items: flex-start; padding: 1px 12px; white-space: pre; }
.diff-gutter { flex: 0 0 20px; text-align: center; user-select: none; opacity: 0.7; }
.diff-line { white-space: pre; }
.diff-removed { background: color-mix(in srgb, var(--danger) 12%, transparent); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.diff-removed .diff-gutter { color: var(--danger); }
.diff-added { background: color-mix(in srgb, var(--ok) 12%, transparent); color: color-mix(in srgb, var(--ok) 82%, var(--text)); }
.diff-added .diff-gutter { color: var(--ok); }

/* ==========================================================================
   LIVE CONSOLE (pipeline)
   ========================================================================== */
.live-console { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; margin: 10px 0; }
.live-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.live-step { display: flex; align-items: center; gap: 8px; color: var(--text-faint); }
.live-dot {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  flex: 0 0 26px;
}
.live-dot svg { width: 14px; height: 14px; }
.live-label { font-size: 12.5px; font-weight: 600; }
.live-connector { width: 26px; height: 2px; border-radius: 2px; background: var(--border-2); margin: 0 4px; }
.live-step.done { color: var(--text); }
.live-step.done .live-dot { background: color-mix(in srgb, var(--ok) 20%, transparent); border-color: transparent; color: var(--ok); }
.live-step.done .live-connector { background: color-mix(in srgb, var(--ok) 45%, transparent); }
.live-step.active { color: var(--text); }
.live-step.active .live-dot {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: 0 0 0 0 var(--accent-soft-2);
  animation: pulse-ring 1.6s ease-out infinite;
}
.live-step.err { color: var(--danger); }
.live-step.err .live-dot { background: color-mix(in srgb, var(--danger) 20%, transparent); border-color: transparent; color: var(--danger); }

.live-progress { height: 6px; border-radius: var(--r-pill); background: var(--border-2); overflow: hidden; margin: 14px 0 10px; }
.live-bar { height: 100%; border-radius: var(--r-pill); background: var(--accent); transition: width 0.3s ease; }
.live-progress.indeterminate .live-bar { background: linear-gradient(90deg, var(--accent-active), var(--accent-hover)); }
.live-caption { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }

/* ==========================================================================
   FORMS
   ========================================================================== */
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin: 12px 0 6px; }
input, textarea, select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  transition: border-color 0.13s ease, box-shadow 0.13s ease;
}
input.mono, textarea.mono { font-family: var(--mono); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 12px 0; }
.check-row input { width: auto; }
.check-row label { margin: 0; }
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }

/* ==========================================================================
   searchSelect — combobox (text field + filtering popup listbox)
   ========================================================================== */
.combo { position: relative; }
.combo > .combo-input { width: 100%; }
/* caret affordance so it reads as a picker, not a bare text field */
.combo > .combo-input {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%);
  background-position: right 13px center, right 8px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.combo > .combo-input[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.combo > .combo-input:disabled { opacity: 0.6; cursor: not-allowed; }

.combo-pop {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  z-index: 400;                       /* above modal body + sibling fields */
  max-height: 264px;
  overflow-y: auto;
  padding: 4px;
  background: var(--elev);
  border: 1px solid var(--border-2);
  border-radius: var(--r-ctl);
  box-shadow: var(--shadow);
}
.combo-pop.up { top: auto; bottom: calc(100% + 4px); }
.combo-opt {
  padding: 7px 10px;
  border-radius: var(--r-ctl);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-opt.selected { color: var(--accent); }
.combo-opt.active { background: var(--accent-soft); color: var(--text); }
.combo-opt.active.selected { background: var(--accent); color: var(--on-accent); }
.combo-empty, .combo-more { padding: 7px 10px; font-size: 12px; color: var(--text-faint); }
.combo-more { border-top: 1px solid var(--hairline); margin-top: 2px; }

.otp-input { font-family: var(--mono); font-size: 26px; letter-spacing: 0.6em; text-align: center; padding-left: 0.6em; }

/* banners */
.banner { padding: 11px 14px; border-radius: var(--r-ctl); border: 1px solid var(--border); font-size: 13px; margin: 12px 0; background: var(--panel-2); }
.banner.error, .banner.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: color-mix(in srgb, var(--danger) 88%, var(--text)); }
.banner.info { background: var(--accent-2-soft); border-color: var(--accent-2-soft-2); color: var(--text); }

/* ==========================================================================
   COMMAND PALETTE — opaque (no blur)
   ========================================================================== */
.cmdk-backdrop { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(0, 0, 0, 0.62); }
.cmdk {
  width: 100%;
  max-width: 660px;
  background: var(--elev);
  border: 1px solid var(--border-2);
  border-radius: var(--r-card);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.cmdk-input-wrap svg { width: 18px; height: 18px; flex: 0 0 18px; }
.cmdk-input { border: 0; background: none; padding: 0; font-size: 16px; box-shadow: none; }
.cmdk-input:focus { box-shadow: none; }
.cmdk-results { overflow-y: auto; padding: 6px; }
.cmdk-section { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); padding: 10px 12px 5px; }
.cmdk-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-ctl); cursor: pointer; color: var(--text); }
.cmdk-row svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--text-dim); }
.cmdk-row.selected { background: var(--accent); color: var(--on-accent); }
.cmdk-row.selected svg { color: var(--on-accent); }
.cmdk-row.selected .cmdk-row-sub, .cmdk-row.selected .cmdk-row-kind { color: color-mix(in srgb, var(--on-accent) 75%, transparent); }
.cmdk-row-main { flex: 1 1 auto; min-width: 0; }
.cmdk-row-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row-sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row-kind { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.cmdk-empty { padding: 22px 16px; text-align: center; color: var(--text-dim); }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }

/* ==========================================================================
   TOASTS + MODAL
   ========================================================================== */
#toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  background: var(--elev);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-ctl);
  padding: 12px 15px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--ok); }

.modal-backdrop { position: fixed; inset: 0; z-index: 250; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; background: rgba(0, 0, 0, 0.62); }
.modal {
  width: 100%;
  max-width: 560px;
  background: var(--elev);
  border: 1px solid var(--border-2);
  border-radius: var(--r-card);
  padding: 22px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  max-height: 84vh;
  overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }

/* ==========================================================================
   EMPTY / LOADING / SPINNER / CHART
   ========================================================================== */
.empty { text-align: center; padding: 46px 20px; color: var(--text-dim); }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }
.empty p { margin: 0; font-size: 13px; }

.loading-row { display: flex; align-items: center; gap: 10px; padding: 14px 0; color: var(--text-dim); font-size: 13px; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--accent-soft-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex: 0 0 15px; }

.chart-box { position: relative; height: 280px; }
.chart-box canvas { max-width: 100%; }

/* ==========================================================================
   VIEW-SPECIFIC COMPOSITES
   ========================================================================== */
.scan-grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 12px; }
.scan-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.scan-status { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.sc-label { color: var(--text-dim); font-size: 13px; }

.repo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; }
.repo-row-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 22px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; }

.x { border: 0; background: none; color: var(--text-dim); cursor: pointer; font-size: 18px; line-height: 1; padding: 4px; border-radius: 6px; }
.x:hover { color: var(--accent); }

/* ==========================================================================
   NEW THREAT-INTEL COMPONENTS (next phase builds the DOM; styled here)
   ========================================================================== */

/* ---- world / threat MAP — choropleth + dot markers ---- */
.threat-map {
  position: relative;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 30px 30px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 30px 30px,
    radial-gradient(120% 90% at 50% 0%, var(--panel-2), var(--panel) 70%);
  padding: 8px;
  overflow: hidden;
}
.threat-map svg { display: block; width: 100%; height: auto; }
/* choropleth regions: quantile fill q0 (none) .. q5 (hottest) */
.map-region { fill: var(--panel-2); stroke: var(--bg); stroke-width: 0.4; transition: fill 0.13s ease; }
.map-region.q0 { fill: #10192b; }
.map-region.q1 { fill: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); }
.map-region.q2 { fill: color-mix(in srgb, var(--accent) 32%, var(--panel-2)); }
.map-region.q3 { fill: color-mix(in srgb, var(--accent) 52%, var(--panel-2)); }
.map-region.q4 { fill: color-mix(in srgb, var(--accent) 74%, var(--panel-2)); }
.map-region.q5 { fill: var(--accent); }
.map-region:hover { fill: var(--accent-hover); }
/* incident dot markers (severity-coloured) */
.map-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 1; }
.map-dot.crit { fill: var(--sev-critical); }
.map-dot.high { fill: var(--sev-high); }
.map-dot.med  { fill: var(--sev-medium); }
.map-dot.low  { fill: var(--sev-low); }
.map-dot.info { fill: var(--sev-info); }
.map-dot.pulse { animation: pulse 2s ease-out infinite; }
/* HTML overlay legend (optional) */
.map-legend { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.map-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 4px; }

/* ---- top-submitters LEADERBOARD ---- */
.leaderboard { display: flex; flex-direction: column; }
.lb-row { display: flex; align-items: center; gap: 11px; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.lb-row:last-child { border-bottom: 0; }
.lb-rank { flex: 0 0 24px; font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-faint); text-align: right; }
.lb-row:nth-child(1) .lb-rank, .lb-row.top .lb-rank { color: var(--accent); }
.lb-flag { flex: 0 0 auto; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.lb-label { flex: 0 0 150px; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar { flex: 1 1 auto; height: 7px; border-radius: var(--r-pill); background: var(--border-2); overflow: hidden; }
.lb-fill { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--accent-active), var(--accent)); }
.lb-fill.alt { background: linear-gradient(90deg, color-mix(in srgb, var(--accent-2) 70%, black), var(--accent-2)); }
.lb-count { flex: 0 0 auto; min-width: 44px; text-align: right; font-family: var(--mono); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }

/* ---- dense TAG PILLS (distinct from .tag/.pill vocab) ---- */
.tagpill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.tagpill.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft-2); }
.tagpill.data   { background: var(--accent-2-soft); color: var(--accent-2); border-color: var(--accent-2-soft-2); }
/* severity variants */
.tagpill.sev-critical { background: color-mix(in srgb, var(--sev-critical) 16%, transparent); color: var(--sev-critical); border-color: color-mix(in srgb, var(--sev-critical) 34%, transparent); }
.tagpill.sev-high     { background: color-mix(in srgb, var(--sev-high) 16%, transparent); color: var(--sev-high); border-color: color-mix(in srgb, var(--sev-high) 34%, transparent); }
.tagpill.sev-medium   { background: color-mix(in srgb, var(--sev-medium) 18%, transparent); color: var(--sev-medium); border-color: color-mix(in srgb, var(--sev-medium) 36%, transparent); }
.tagpill.sev-low      { background: color-mix(in srgb, var(--sev-low) 16%, transparent); color: var(--sev-low); border-color: color-mix(in srgb, var(--sev-low) 34%, transparent); }
.tagpill.sev-info     { background: color-mix(in srgb, var(--sev-info) 16%, transparent); color: var(--sev-info); border-color: color-mix(in srgb, var(--sev-info) 34%, transparent); }
/* category variants — hash a category name to c1..c8 */
.tagpill.c1 { background: color-mix(in srgb, #f7564f 15%, transparent); color: #ff8079; border-color: color-mix(in srgb, #f7564f 32%, transparent); }
.tagpill.c2 { background: color-mix(in srgb, #4aa8ff 15%, transparent); color: #7cc0ff; border-color: color-mix(in srgb, #4aa8ff 32%, transparent); }
.tagpill.c3 { background: color-mix(in srgb, #f5c451 15%, transparent); color: #f7d178; border-color: color-mix(in srgb, #f5c451 32%, transparent); }
.tagpill.c4 { background: color-mix(in srgb, #34d399 15%, transparent); color: #5fe0b3; border-color: color-mix(in srgb, #34d399 32%, transparent); }
.tagpill.c5 { background: color-mix(in srgb, #b98cff 15%, transparent); color: #cbacff; border-color: color-mix(in srgb, #b98cff 32%, transparent); }
.tagpill.c6 { background: color-mix(in srgb, #ff8a3d 15%, transparent); color: #ffa869; border-color: color-mix(in srgb, #ff8a3d 32%, transparent); }
.tagpill.c7 { background: color-mix(in srgb, #2dd4bf 15%, transparent); color: #5fe0d1; border-color: color-mix(in srgb, #2dd4bf 32%, transparent); }
.tagpill.c8 { background: color-mix(in srgb, #f472b6 15%, transparent); color: #f894cb; border-color: color-mix(in srgb, #f472b6 32%, transparent); }

/* ---- analytics MATRIX / heatmap grid ---- */
.matrix { display: grid; gap: 3px; }
.matrix .matrix-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); display: flex; align-items: center; }
.heatcell {
  aspect-ratio: 1 / 1;
  min-height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid var(--hairline);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  transition: outline-color 0.13s ease;
}
.heatcell:hover { outline: 1px solid var(--accent); outline-offset: -1px; }
/* intensity ramp lvl-0 (empty) .. lvl-5 (hottest coral) */
.heatcell.lvl-0 { background: #10192b; color: var(--text-faint); }
.heatcell.lvl-1 { background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); }
.heatcell.lvl-2 { background: color-mix(in srgb, var(--accent) 34%, var(--panel-2)); }
.heatcell.lvl-3 { background: color-mix(in srgb, var(--accent) 54%, var(--panel-2)); color: var(--text); }
.heatcell.lvl-4 { background: color-mix(in srgb, var(--accent) 76%, var(--panel-2)); color: #fff; }
.heatcell.lvl-5 { background: var(--accent); color: var(--on-accent); }
/* severity-tinted cells (alternate ramp) */
.heatcell.sev-critical { background: color-mix(in srgb, var(--sev-critical) 55%, var(--panel-2)); color: #fff; }
.heatcell.sev-high { background: color-mix(in srgb, var(--sev-high) 50%, var(--panel-2)); color: var(--text); }
.heatcell.sev-medium { background: color-mix(in srgb, var(--sev-medium) 46%, var(--panel-2)); color: var(--text); }
.heatcell.sev-low { background: color-mix(in srgb, var(--sev-low) 40%, var(--panel-2)); color: var(--text); }

/* ---- node GRAPH container ---- */
.nodegraph {
  position: relative;
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 26px 26px,
    radial-gradient(90% 90% at 50% 50%, var(--panel-2), var(--panel) 80%);
  overflow: hidden;
}
.nodegraph svg { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.ng-edge { stroke: var(--border-2); stroke-width: 1; fill: none; }
.ng-edge.active { stroke: var(--accent-2); stroke-width: 1.5; }
.ng-edge.hot { stroke: color-mix(in srgb, var(--accent) 60%, transparent); }
.ng-node { fill: var(--panel-2); stroke: var(--accent-2); stroke-width: 1.5; transition: stroke 0.13s ease; }
.ng-node.center { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.ng-node.crit { stroke: var(--sev-critical); }
.ng-node.high { stroke: var(--sev-high); }
.ng-node.med  { stroke: var(--sev-medium); }
.ng-node.low  { stroke: var(--sev-low); }
.ng-node.info { stroke: var(--sev-info); }
.ng-node:hover { stroke: var(--accent); }
.ng-label { font-family: var(--mono); font-size: 10px; fill: var(--text-dim); pointer-events: none; }
/* HTML node variant (absolute-positioned chips) */
.ng-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--accent-2-soft-2);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
}
.ng-chip.center { border-color: var(--accent-soft-2); background: var(--accent-soft); color: var(--accent); }

/* ==========================================================================
   AUTH PAGES — hero
   ========================================================================== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
  position: relative;
  width: 100%;
  max-width: 410px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 30px 28px 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 50%; background: var(--sheen); pointer-events: none; }
.auth-card > * { position: relative; }
.auth-card .win-chrome { margin: -30px -28px 22px; }

.ascii-shield { font-family: var(--mono); font-size: 10px; line-height: 1.15; color: var(--accent); opacity: 0.3; text-align: center; margin: 0 0 14px; white-space: pre; overflow: hidden; }
.auth-mark {
  display: grid; place-items: center;
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border-radius: 14px;
  color: var(--on-accent);
  background: linear-gradient(155deg, var(--accent-hover), var(--accent-active));
  box-shadow: 0 10px 24px -10px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.auth-mark svg { width: 28px; height: 28px; }
.auth-mark.danger { background: linear-gradient(155deg, #ff7a72, var(--danger)); }

.auth-card h1 { font-size: 24px; font-weight: 850; letter-spacing: 0.005em; margin-bottom: 4px; }
.auth-card h1 .dot { color: var(--accent); }
.brand-line { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }
.brand-line .accent { color: var(--accent); }
.auth-note { color: var(--text-dim); font-size: 13px; line-height: 1.55; margin: 0 0 8px; }
.auth-note b { color: var(--text); }
.auth-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); letter-spacing: 0.04em; }
.auth-code { font-family: var(--mono); font-size: 46px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }

.emph { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--accent); }

/* ==========================================================================
   MOBILE — rail becomes a drawer via .nav-open on #app-shell
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar-toggle { display: grid; place-items: center; }
  .cmdk-hint-text { display: none; }
  .topbar-brand .tb-tag { display: none; }
  .whoami b { display: none; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.15s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 35; }
  .container { padding: 18px 14px 56px; }
}

/* ==========================================================================
   MOTION SAFETY
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .gauge-arc { transition: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 var(--accent-soft-2); }
  70% { box-shadow: 0 0 0 7px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* --- skeleton / shimmer placeholders (loading UX, e.g. Push-to-Jira modal) --- */
@keyframes shimmer { 100% { background-position: -200% 0; } }
.skeleton {
  display: block;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--glass-2) 0%, var(--accent-soft) 40%, var(--glass-2) 80%);
  background-size: 200% 100%;
  background-position: 200% 0;
  animation: shimmer 1.25s ease-in-out infinite;
}
.skeleton-bar { height: 34px; margin-top: 6px; }
.skeleton-label { height: 11px; width: 34%; margin-top: 12px; border-radius: 5px; }
.skeleton-bar.tall { height: 74px; }

/* --- cross-scan correlation (Related issues on finding cards) --- */
.related-wrap { margin-top: 10px; border-top: 1px solid var(--hairline); padding-top: 8px; }
.related-toggle { padding-left: 0; }
.related-body { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.related-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--glass-2); }
.related-title { color: var(--text); font-weight: 600; text-decoration: none; }
.related-title:hover { color: var(--accent); }
.related-meta { color: var(--text-dim); font-size: 11.5px; }
.related-why { font-size: 11px; }
.related-act { margin-left: auto; }

/* Login: Sign-in-with-Google primary CTA + small collapsed password fallback */
a.btn { text-decoration: none; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pw-details { margin-top: 2px; }
.pw-details > summary { cursor: pointer; color: var(--text-dim); font-size: 13px; text-align: center; list-style: none; padding: 6px 0; }
.pw-details > summary::-webkit-details-marker { display: none; }
.pw-details > summary::marker { content: ""; }
.pw-details[open] > summary { color: var(--text); margin-bottom: 6px; }
