/* =====================================================================
   DriftGate – styles.css  (Step 8 – light theme)
   ===================================================================== */

/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f2f6fd;
  --white: #ffffff;
  --panel: var(--white);
  --border: #dfe6f2;
  --shadow: 0 1px 3px rgba(16,24,40,0.06), 0 4px 12px rgba(16,24,40,0.04);
  --shadow-strong: 0 8px 40px rgba(16,24,40,0.14);
  --accent: #2f5bea;
  --accent-hover: #1e4acc;
  --accent-light: rgba(47,91,234,0.08);
  --intro-tint: rgba(47,91,234,0.07);
  --text: #1a1f2e;
  --text-muted: #5b6578;
  --text-muted-2: #8a93a5;
  --ok: #1f9d63;
  --ok-text: #176d48;
  --ok-bg: #f0faf5;
  --ok-border: #b7e8d1;
  --watching: #d99a1c;
  --watching-bg: #fef9ec;
  --watching-text: #875d08;
  --watching-border: #f5d87e;
  --restricted: #e8742a;
  --restricted-bg: #fff5f0;
  --restricted-text: #c45d1e;
  --restricted-border: #f7c4a6;
  --quarantined: #d62f45;
  --quarantined-bg: #fff0f2;
  --quarantined-border: #f5b0ba;
  --track: #e4eaf5;
  --edge: #98a2b3;
  --chart-grid: #e5e8ee;
  --frozen-baseline: #6b7a90;
  --neutral-hover: #f0f2f8;
  --overlay-wash: rgba(255,255,255,0.88);
  --panel-wash: rgba(255,255,255,0.8);
  --danger-shadow: rgba(214,47,69,0.2);
  --danger-row: rgba(214,47,69,0.04);
  --danger-region: rgba(214,47,69,0.10);
  --danger-line: rgba(214,47,69,0.60);
  --danger-label: rgba(214,47,69,0.9);
  --danger-fill: rgba(214,47,69,0.12);
  --danger-chart-fill: rgba(214,47,69,0.15);
  --warning-chart-fill: rgba(217,154,28,0.55);
  --warning-chart-line: rgba(217,154,28,0.8);
  --body-muted-svg: rgba(91,101,120,0.8);
  --edge-muted-svg: rgba(91,101,120,0.9);
  --neutral-line: rgba(26,31,46,0.60);
  --text-on-accent: var(--white);
  --nav-w: 200px;
  --topbar-h: 58px;
  --chapter-h: 36px;
  --radius: 10px;
  --nav-overview: #3b6fe0; --nav-overview-bg: #e8f0fe;
  --nav-timeline: #1b9aaa; --nav-timeline-bg: #e3f4f6;
  --nav-alert: #e8742a; --nav-alert-bg: #fdeee3;
  --nav-drift: #7c5cd6; --nav-drift-bg: #efeafb;
  --nav-chain: #1f9d63; --nav-chain-bg: #e3f5ec;
  --nav-metrics: #4f5bd5; --nav-metrics-bg: #eceefc;
  --nav-past: #d6477a; --nav-past-bg: #fbe8ef;
  --nav-active-bg: #eaf1ff;
  --kpi-detection: #3b6fe0; --kpi-detection-bg: #e8f0fe;
  --kpi-false: #d99a1c; --kpi-false-bg: #fdf4dc;
  --kpi-actions: #7c5cd6; --kpi-actions-bg: #efeafb;
  --kpi-permission: #6b7a90; --kpi-permission-bg: #eef1f6;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
svg { display: block; }
a { color: var(--accent); }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: relative;
  grid-row: 1;
  height: var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}

.topbar-col { display: flex; align-items: center; gap: 8px; }
.topbar-col.topbar-right { justify-content: flex-end; text-align: right; }
.topbar-col.topbar-center { justify-content: center; }

.topbar-shield { width: 22px; height: 26px; flex-shrink: 0; }
.brand { font-size: 17px; font-weight: 700; color: var(--accent); letter-spacing: -0.3px; }
.brand-sub { font-size: 11px; color: var(--text-muted-2); }

.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--ok-text);
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  border-radius: 20px; padding: 3px 10px;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.topbar-tag {
  font-size: 11px; color: var(--text-muted-2);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px;
}

/* ── Chapter bar ─────────────────────────────────────────────────────────── */
.chapter-bar {
  position: relative;
  grid-row: 2;
  height: var(--chapter-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 0 calc(var(--nav-w) + 24px);
}

.chapter-progress-wrap {
  position: absolute; bottom: 0; left: calc(var(--nav-w) + 24px); right: 24px; height: 3px;
  background: var(--track);
}
.chapter-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.3s linear;
}

.chapter-labels {
  position: relative;
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
}

.chapter-segment {
  height: 100%; min-width: 0; position: relative;
  display: flex; align-items: center;
  border-right: 1px solid var(--border);
}
.chapter-label {
  display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-size: 12px;
  color: var(--text-muted-2);
  white-space: nowrap;
  padding: 0 4px 0 8px;
  transition: color 0.3s;
}
.chapter-segment.current .chapter-label { color: var(--accent); font-weight: 600; }

/* ── Layout ────────────────────────────────────────────────────────────── */
.layout {
  grid-row: 3;
  display: flex;
  min-height: 0;
  overflow: hidden;
}
body { display: grid; grid-template-rows: var(--topbar-h) var(--chapter-h) minmax(0, 1fr); }

/* ── Sidenav ─────────────────────────────────────────────────────────────── */
.sidenav {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.nav-list { list-style: none; padding: 12px 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-item:hover { background: var(--neutral-hover); color: var(--text); }
.nav-item.active {
  border-left-color: var(--accent);
  background: var(--nav-active-bg);
  color: var(--text);
}

.nav-icon-wrap { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 32px; color: var(--icon-color); background: var(--icon-bg); }
.nav-svg-icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item[data-screen="overview"] { --icon-color: var(--nav-overview); --icon-bg: var(--nav-overview-bg); }
.nav-item[data-screen="timeline"] { --icon-color: var(--nav-timeline); --icon-bg: var(--nav-timeline-bg); }
.nav-item[data-screen="alert"] { --icon-color: var(--nav-alert); --icon-bg: var(--nav-alert-bg); }
.nav-item[data-screen="drift"] { --icon-color: var(--nav-drift); --icon-bg: var(--nav-drift-bg); }
.nav-item[data-screen="chain"] { --icon-color: var(--nav-chain); --icon-bg: var(--nav-chain-bg); }
.nav-item[data-screen="metrics"] { --icon-color: var(--nav-metrics); --icon-bg: var(--nav-metrics-bg); }
.nav-item[data-screen="past-runs"] { --icon-color: var(--nav-past); --icon-bg: var(--nav-past-bg); }
.nav-label { flex: 1; }

.nav-divider {
  list-style: none;
  font-size: 10px;
  color: var(--text-muted-2);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 16px 20px 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  min-height: 0;
  background: var(--bg);
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 24px 24px calc(var(--caption-reserve, 0px) + 24px);
  min-height: 100%;
  opacity: 0;
  transition: opacity 0.25s;
}
.screen.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.screen-header { margin-bottom: 4px; }
.screen-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.screen-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.screen-tag {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent-light);
  background: var(--accent-light);
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Panels ──────────────────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

/* ── Status chips ─────────────────────────────────────────────────────────── */
.status-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
  border: 1px solid transparent;
}
.chip-healthy    { background: var(--ok-bg);          color: var(--ok-text);     border-color: var(--ok-border); }
.chip-watching   { background: var(--watching-bg);    color: var(--watching-text); border-color: var(--watching-border); }
.chip-restricted { background: var(--restricted-bg);  color: var(--restricted-text); border-color: var(--restricted-border); }
.chip-quarantined{ background: var(--quarantined-bg); color: var(--quarantined); border-color: var(--quarantined-border); }

/* ── KPI row ─────────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: grid; grid-template-columns: 32px minmax(0,1fr); grid-template-rows: auto auto auto; column-gap: 12px; row-gap: 2px;
}
.kpi-icon { width: 32px; height: 32px; grid-row: 1 / 4; border-radius: 8px; display: grid; place-items: center; background: var(--kpi-icon-bg); color: var(--kpi-icon-color); }
.kpi-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi-detectionRate { --kpi-icon-color: var(--kpi-detection); --kpi-icon-bg: var(--kpi-detection-bg); }
.kpi-falseAlarmRate { --kpi-icon-color: var(--kpi-false); --kpi-icon-bg: var(--kpi-false-bg); }
.kpi-actionsUntilCaught { --kpi-icon-color: var(--kpi-actions); --kpi-icon-bg: var(--kpi-actions-bg); }
.kpi-permissionCheckDetects { --kpi-icon-color: var(--kpi-permission); --kpi-icon-bg: var(--kpi-permission-bg); }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.kpi-eval-label { font-size: 11px; color: var(--text-muted-2); }

/* ── Agent table ─────────────────────────────────────────────────────────── */
.agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.agent-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.agent-table td {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.agent-id { font-weight: 600; color: var(--text); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; }
.agent-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; }
.agent-avatar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.role-procurement { color: var(--nav-overview); background: var(--nav-overview-bg); }
.role-hr { color: var(--nav-past); background: var(--nav-past-bg); }
.role-orchestrator { color: var(--nav-drift); background: var(--nav-drift-bg); }
.role-support { color: var(--nav-timeline); background: var(--nav-timeline-bg); }

.risk-bar-wrap { display: flex; align-items: center; gap: 8px; }
.risk-bar-bg   { flex: 1; height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.risk-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.risk-score-num { font-size: 12px; font-weight: 600; min-width: 24px; text-align: right; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 900;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Intro overlay ──────────────────────────────────────────────────────── */
.intro-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease;
}
.intro-overlay.fade-out { opacity: 0; pointer-events: none; }

.intro-progress-track {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--track);
}
.intro-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 3s linear; }

.intro-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
}

.intro-shield { width: 80px; height: 90px; margin-bottom: 8px; }
.intro-brand {
  font-size: 64px; font-weight: 700; color: var(--accent);
  letter-spacing: -1px; line-height: 1;
}
.intro-tagline {
  font-size: 22px; color: var(--text); font-weight: 400; letter-spacing: 0.2px;
}
.intro-byline { font-size: 13px; color: var(--text-muted-2); }

/* ── End card overlay ────────────────────────────────────────────────────── */
.end-overlay {
  position: fixed; inset: 0; z-index: 700;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.end-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-strong);
  border-radius: 14px;
  padding: 48px 56px;
  max-width: 860px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.end-title {
  font-size: 24px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px;
}

.end-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.end-col-heading {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
}

.end-line, .end-check-line {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text);
  margin-bottom: 8px;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.end-line.revealed, .end-check-line.revealed {
  opacity: 1; transform: none;
}
.end-line-bullet { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.end-check-bullet { color: var(--ok-text); flex-shrink: 0; margin-top: 2px; }

.end-kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
.end-kpi-item {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.end-kpi-val { font-size: 30px; font-weight: 700; color: var(--accent); }
.end-kpi-lbl { font-size: 11px; color: var(--text-muted); }
.end-kpi-eval { font-size: 10px; color: var(--text-muted-2); }

/* ── Callout overlay ─────────────────────────────────────────────────────── */
.callout-layer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 500;
}

.callout-frame {
  position: absolute;
  border: 2px solid var(--quarantined);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.25s;
  box-shadow: 0 2px 10px var(--danger-shadow);
}

.callout-label {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--quarantined);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px; font-weight: 600; color: var(--quarantined);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.25s;
}

/* ── Caption bar ─────────────────────────────────────────────────────────── */
.caption-bar {
  position: fixed;
  bottom: 12px;
  left: calc(50vw + 100px);
  transform: translateX(-50%);
  width: min(900px, max(0px, calc(90vw - 180px)));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 18px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.caption-bar.visible { opacity: 1; pointer-events: auto; }

.caption-step-badge {
  display: inline-block;
  background: var(--quarantined);
  color: var(--text-on-accent);
  font-size: 10px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  width: fit-content;
}

.caption-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.caption-text {
  font-size: 19px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 1366px) {
  .caption-title { font-size: 20px; }
  .caption-text  { font-size: 16px; }
}

/* ── Clean mode ──────────────────────────────────────────────────────────── */
.clean-mode #sidenav       { display: none; }
.clean-mode .chapter-labels{ display: none; }

/* ── OVERVIEW SCREEN ─────────────────────────────────────────────────────── */
/* (uses shared panel / agent-table / kpi-row styles) */

/* ── TIMELINE SCREEN ─────────────────────────────────────────────────────── */
.tl-agent-cards {
  display: flex; gap: 12px; flex-wrap: wrap;
}

.tl-agent-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  cursor: pointer;
  min-width: 180px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tl-agent-card:hover { border-color: var(--accent); }
.tl-agent-card.selected {
  border-color: var(--quarantined);
  box-shadow: 0 0 0 2px var(--danger-shadow), var(--shadow);
}

.tl-card-id   { font-size: 12px; font-weight: 700; color: var(--text); }
.tl-card-role { font-size: 11px; color: var(--text-muted-2); }
.tl-card-meta { display: flex; align-items: center; gap: 8px; }
.tl-card-score { font-size: 13px; font-weight: 700; margin-left: auto; }

.tl-filter-bar {
  display: flex; align-items: center; gap: 8px;
}
.tl-filter-label { font-size: 12px; color: var(--text-muted); }
.tl-filter-chip {
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tl-filter-chip.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.tl-body {
  display: grid; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); gap: 16px;
  flex: 1; min-height: 0;
  align-items: flex-start;
  width: 100%;
}

.tl-feed-wrap {
  flex: 0 0 65%;
  padding: 0;
  overflow: visible;
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.4s ease;
}
.tl-feed-wrap.alert-flash {
  box-shadow: 0 0 0 3px var(--quarantined), var(--shadow);
}

.tl-feed {
  width: 100%;
  overflow: visible;
  padding: 16px;
  display: flex; flex-direction: column; gap: 0;
  scroll-behavior: smooth;
}

.tl-empty {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted-2); font-size: 13px;
  font-style: italic; padding: 24px;
}
.tl-empty-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--track); display: inline-block;
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* Timeline rows */
.tl-row {
  display: flex; align-items: flex-start; gap: 0;
  position: relative;
  padding-bottom: 0;
  animation: rowSlideIn 0.3s ease;
  width: 100%;
}
@keyframes rowSlideIn {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:none; }
}
.tl-row.hidden { display: none; }

.tl-node {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  margin-right: 10px;
  position: relative; z-index: 1;
  border: 2px solid transparent;
}
.tl-node-healthy    { background: var(--ok);          border-color: var(--ok-border); }
.tl-node-watching   { background: var(--watching);    border-color: var(--watching-border); }
.tl-node-restricted { background: var(--restricted);  border-color: var(--restricted-border); }
.tl-node-quarantined{ background: var(--quarantined); border-color: var(--quarantined-border); animation: nodeFlash 1.2s ease infinite; }
@keyframes nodeFlash { 0%,100%{opacity:1} 50%{opacity:0.35} }

/* Vertical timeline line — pseudo-element on the feed */
.tl-feed::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
  z-index: 0;
}

.tl-link-connector {
  height: 26px; position: relative; display: flex; align-items: center;
  width: 100%;
}
.tl-link-line {
  position: absolute; left: 6px; top: 0; height: 100%; width: 0;
  border-left: 2px dashed var(--watching);
}
.tl-link-chip {
  position: absolute; left: 6px; transform: translateX(-50%);
  font-size: 10px; color: var(--watching-text);
  background: var(--watching-bg);
  border: 1px solid var(--watching-border);
  border-radius: 6px; padding: 2px 8px;
  white-space: nowrap;
}

.tl-card {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.tl-card.border-watching   { border-color: var(--watching); }
.tl-card.border-restricted { border-color: var(--restricted); }
.tl-card.border-quarantined{ border-color: var(--quarantined); }

.tl-card-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.tl-card-time  { font-size: 11px; color: var(--text-muted-2); font-variant-numeric: tabular-nums; }
.tl-card-text  { flex: 1; font-size: 13px; color: var(--text); }
.tl-card-score-pill {
  font-size: 11px; font-weight: 600;
  border: 1px solid currentColor;
  border-radius: 10px; padding: 1px 8px;
}

.tl-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  border: 1px solid currentColor;
}
.tl-tag-untrusted { background: var(--watching-bg);    color: var(--watching-text); border-color: var(--watching-border); }
.tl-tag-outrole   { background: var(--restricted-bg);  color: var(--restricted-text); border-color: var(--restricted-border); }
.tl-tag-canary    { background: var(--quarantined-bg); color: var(--quarantined); border-color: var(--quarantined-border);
                    animation: canaryPulse 2s infinite; }
.tl-tag-newdest   { background: var(--quarantined-bg); color: var(--quarantined); border-color: var(--quarantined-border); }
@keyframes canaryPulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.tl-card-caption {
  font-size: 11px; color: var(--text-muted); margin-top: 6px; font-style: italic;
}
.tl-card-badges { margin-top: 8px; }
.tl-resp-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 10px;
}
.tl-resp-restricted  { background: var(--restricted-bg);  color: var(--restricted-text);  border: 1px solid var(--restricted-border); }
.tl-resp-quarantined { background: var(--quarantined-bg); color: var(--quarantined); border: 1px solid var(--quarantined-border); }

/* Risk panel */
.tl-risk-panel {
  flex: 0 0 35%;
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 0; align-self: flex-start;
}
.tl-risk-title {
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 0;
}

.tl-gauge-wrap { display: flex; justify-content: center; }
.tl-gauge-svg  { width: 160px; height: 160px; }
.tl-gauge-bg   {
  fill: none;
  stroke: var(--track);
  stroke-width: 12;
}
.tl-gauge-ring {
  fill: none;
  stroke: var(--ok);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 402.124;
  stroke-dashoffset: 402.124;
  transform: rotate(-90deg);
  transform-origin: 80px 80px;
  transition: stroke-dashoffset 0.05s linear, stroke 0.05s;
}
.tl-gauge-num {
  fill: var(--text);
  font-size: 32px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
}
.tl-gauge-sub {
  fill: var(--text-muted-2);
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  text-anchor: middle;
  dominant-baseline: middle;
}

.tl-risk-status-wrap { display: flex; justify-content: center; }

.tl-sparkline-label { font-size: 11px; color: var(--text-muted); }
.tl-sparkline-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  height: 60px;
}
.tl-sparkline-svg { width: 100%; height: 60px; }
.tl-sparkline-line {
  fill: none; stroke: var(--accent); stroke-width: 2;
}
.tl-sparkline-dot { fill: var(--accent); }

.tl-counters {
  display: flex; justify-content: space-around;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.tl-counter { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tl-counter-val { font-size: 20px; font-weight: 700; color: var(--text); }
.tl-counter-lbl { font-size: 10px; color: var(--text-muted-2); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── ALERT SCREEN ─────────────────────────────────────────────────────────── */
.al-header-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.al-title-col { display: flex; flex-direction: column; gap: 6px; }
.al-tabs { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }

.al-tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.al-tab.active {
  color: var(--quarantined);
  border-color: var(--quarantined);
  border-bottom: 2px solid var(--quarantined);
  background: var(--quarantined-bg);
}
.al-tab.dim { opacity: 0.5; cursor: default; }

.al-meta { font-size: 13px; color: var(--text-muted); }
.al-severity-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  margin-left: 4px;
}
.al-sev-high     { background: var(--restricted-bg);  color: var(--restricted-text);  border: 1px solid var(--restricted-border); }
.al-sev-critical { background: var(--quarantined-bg); color: var(--quarantined); border: 1px solid var(--quarantined-border); }

.al-empty {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-muted-2); font-size: 13px; font-style: italic;
  padding: 32px;
}

.al-body { display: flex; flex-direction: column; gap: 16px; }

/* Compare strip */
.al-compare-strip {
  display: flex; align-items: stretch; gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.al-compare-card {
  flex: 1; padding: 18px 24px;
  display: flex; flex-direction: column; gap: 6px;
}
.al-compare-plain { background: var(--ok-bg); }
.al-compare-dg    { background: var(--restricted-bg); transition: box-shadow 0.4s; }
.al-compare-dg.glow-restrict   { box-shadow: inset 0 0 0 2px var(--restricted); }
.al-compare-dg.glow-quarantine { box-shadow: inset 0 0 0 2px var(--quarantined); background: var(--quarantined-bg); }

.al-compare-icon  { font-size: 24px; }
.al-compare-verdict { font-size: 20px; font-weight: 700; }
.al-verdict-allow     { color: var(--ok-text); }
.al-verdict-restrict  { color: var(--restricted-text); }
.al-verdict-quarantine{ color: var(--quarantined); }
.al-compare-caption { font-size: 12px; color: var(--text-muted); }
.al-compare-label { font-size: 10px; font-weight: 600; color: var(--text-muted-2); text-transform: uppercase; letter-spacing: 0.7px; margin-top: 4px; }
.al-compare-vs {
  display: flex; align-items: center; justify-content: center;
  width: 40px; flex-shrink: 0;
  background: var(--bg); font-size: 12px; font-weight: 600; color: var(--text-muted-2);
}

/* Main row */
.al-main-row { display: flex; gap: 16px; align-items: flex-start; }
.al-left { flex: 0 0 55%; }
.al-right { flex: 1; display: flex; flex-direction: column; gap: 16px; }

.al-why-panel {}

.al-gauge-signals-row { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.al-gauge-wrap { flex-shrink: 0; }

.al-signals-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.al-signal-chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-muted);
  transition: opacity 0.3s;
}
.al-signal-chip.fired-red    { background: var(--quarantined-bg); border-color: var(--quarantined); color: var(--quarantined); }
.al-signal-chip.fired-orange { background: var(--restricted-bg);  border-color: var(--restricted);  color: var(--restricted-text); }
.al-signal-chip.fired-amber  { background: var(--watching-bg);    border-color: var(--watching);    color: var(--watching-text); }
.al-signal-chip.fired-green  { background: var(--ok-bg);          border-color: var(--ok);          color: var(--ok-text); }
.al-signal-chip.dim { opacity: 0.4; }
.al-signal-pts { font-weight: 700; font-size: 12px; }

.al-stacked-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.al-stacked-bar-wrap {
  height: 14px; background: var(--track); border-radius: 7px; overflow: hidden; margin-bottom: 8px;
}
.al-stacked-bar {
  height: 100%; display: flex; border-radius: 7px; overflow: hidden;
  transition: width 0.8s ease;
}
.al-stacked-seg { height: 100%; }
.al-stacked-empty { height: 100%; background: var(--track); }

.al-stacked-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.al-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.al-legend-swatch { width: 10px; height: 10px; border-radius: 2px; }

.al-reasons-list { display: flex; flex-direction: column; gap: 8px; }
.al-reason-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  opacity: 0; transform: translateX(-8px);
  transition: opacity 0.35s, transform 0.35s;
}
.al-reason-row.revealed { opacity: 1; transform: none; }
.al-reason-icon { font-size: 10px; flex-shrink: 0; }
.al-reason-text { flex: 1; color: var(--text); }
.al-reason-pts  { font-weight: 700; flex-shrink: 0; }
.al-reason-bar-wrap {
  flex-shrink: 0; width: 70px; height: 4px;
  background: var(--track); border-radius: 2px; overflow: hidden;
}
.al-reason-bar-fill { height: 100%; border-radius: 2px; }

.al-score-total { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 10px; }

/* Evidence trail */
.al-evidence-trail { display: flex; flex-direction: column; gap: 4px; }
.al-ev-item {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  display: flex; gap: 10px; align-items: flex-start;
}
.al-ev-time { font-size: 11px; color: var(--text-muted-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.al-ev-text { font-size: 12px; color: var(--text); }
.al-ev-connector {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
}
.al-ev-conn-line { width: 2px; height: 16px; background: var(--watching); margin-left: 6px; }
.al-ev-conn-label { font-size: 10px; color: var(--watching-text); background: var(--watching-bg); border: 1px solid var(--watching-border); border-radius: 6px; padding: 2px 8px; }

/* Judge panel */
.al-judge-quote {
  font-size: 13px; color: var(--text);
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
  margin: 0 0 8px;
}
.al-judge-caption { font-size: 11px; color: var(--text-muted-2); }

/* Response panel */
.al-response-panel {}
.al-response-heading { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 14px; }

.al-ladder {
  display: flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}
.al-ladder-step {
  flex: 1; padding: 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative; border-right: 1px solid var(--border);
  background: var(--bg);
}
.al-ladder-step:last-child { border-right: none; }
.al-ladder-step.filled { background: var(--ok-bg); }
.al-ladder-step.active { background: var(--quarantined-bg); }
.al-ladder-step.dim    { opacity: 0.4; }
.al-ladder-icon   { font-size: 18px; }
.al-ladder-name   { font-size: 12px; font-weight: 600; color: var(--text); }
.al-ladder-range  { font-size: 10px; color: var(--text-muted-2); }
.al-ladder-active-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--quarantined);
  animation: nodeFlash 1.2s infinite;
}

.al-response-bottom { display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.al-checklist { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.al-check-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.4s;
}
.al-check-item.checked { opacity: 1; color: var(--text); }
.al-check-icon {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--track);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-muted-2);
  transition: background 0.4s, color 0.4s;
}
.al-check-item.checked .al-check-icon { background: var(--ok); color: var(--text-on-accent); }

.al-action-btns { display: flex; flex-direction: column; gap: 8px; }
.btn {
  padding: 9px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer; transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.al-btn-reject { background: var(--bg); color: var(--text-muted); }
.al-btn-reject:hover { background: var(--restricted-bg); color: var(--restricted-text); border-color: var(--restricted); }

/* ── DRIFT SCREEN ─────────────────────────────────────────────────────────── */
.dr-header-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.dr-title-col { display: flex; flex-direction: column; gap: 4px; }
.dr-caption { font-size: 12px; color: var(--text-muted); font-style: italic; }

.dr-status-chip {
  display: inline-flex; align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: var(--watching-bg); color: var(--watching-text);
  border: 1px solid var(--watching-border);
  transition: background 0.4s, color 0.4s, border-color 0.4s;
}
.dr-status-chip.alert {
  background: var(--quarantined-bg); color: var(--quarantined);
  border-color: var(--quarantined-border);
}

.dr-main-row { display: flex; gap: 16px; align-items: flex-start; }
.dr-main-panel { flex: 0 0 68%; min-width: 0; position: relative; }
.dr-chart-wrap { position: relative; height: 340px; }
.dr-overlay-msg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text-muted-2); font-style: italic;
  background: var(--panel-wash);
}
.dr-overlay-msg.hidden { display: none; }

.dr-right-col { flex: 0 0 32%; display: flex; flex-direction: column; gap: 16px; }
.dr-naive-chart-wrap { height: 160px; }
.dr-naive-status {
  font-size: 11px; color: var(--text-muted); text-align: center;
  margin-top: 8px; font-style: italic;
  opacity: 0; transition: opacity 0.4s;
}
.dr-naive-status.visible { opacity: 1; }

.dr-callouts-list { display: flex; flex-direction: column; gap: 8px; }
.dr-callout-row {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 12px; color: var(--text-muted-2);
  opacity: 0.3; transition: opacity 0.4s, color 0.4s;
}
.dr-callout-row.lit      { opacity: 1; color: var(--text); }
.dr-callout-row.lit-alert { opacity: 1; color: var(--quarantined); }
.dr-callout-num {
  font-size: 10px; font-weight: 700; color: var(--text-muted-2);
  min-width: 22px; text-align: right; flex-shrink: 0;
}

.dr-explainers {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px;
}
.dr-explainer-card {
  flex: 1; min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.dr-explainer-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.dr-explainer-text  { font-size: 11px; color: var(--text-muted); }

/* ── CHAIN SCREEN ─────────────────────────────────────────────────────────── */
.ch-header-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.ch-title-col { display: flex; flex-direction: column; gap: 4px; }
.ch-caption { font-size: 12px; color: var(--text-muted); font-style: italic; }

.ch-toggle-wrap { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ch-toggle-btn {
  padding: 6px 16px;
  background: var(--bg);
  border: none;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.ch-toggle-btn.active { background: var(--accent); color: var(--text-on-accent); }
.ch-toggle-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ch-main-row {
  display: grid;
  grid-template-columns: minmax(0,7fr) minmax(300px,3fr);
  gap: 16px;
  align-items: flex-start;
}

.ch-graph-panel { min-width: 0; overflow: visible; padding: 12px; }
.ch-graph-wrap  { width: 100%; }
#ch-svg { display: block; width: 100%; height: auto; max-height: none; }

.ch-right-col { display: flex; flex-direction: column; gap: 14px; }

.ch-counters-row { display: flex; gap: 16px; }
.ch-counter { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; }
.ch-counter-val { font-size: 24px; font-weight: 700; color: var(--text); transition: color 0.4s; }
.ch-counter-lbl { font-size: 10px; color: var(--text-muted-2); text-align: center; text-transform: uppercase; letter-spacing: 0.5px; }

.ch-auth-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ch-auth-row  { display: flex; align-items: center; gap: 8px; }
.ch-auth-label{ font-size: 11px; color: var(--text-muted); flex-shrink: 0; min-width: 80px; }
.ch-auth-bar-bg  { flex: 1; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.ch-auth-bar-fill{ width: 0; height: 100%; border-radius: 4px; transition: width 0.4s ease, background-color 0.4s ease; }
.ch-auth-extra { font-size: 10px; color: var(--text-muted-2); flex-shrink: 0; }
.ch-auth-note { font-size: 11px; color: var(--text-muted-2); font-style: italic; margin-top: 4px; }
.ch-auth-extra-label {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border: 1px solid var(--quarantined-border); border-radius: 10px;
  background: var(--quarantined-bg); color: var(--quarantined);
  font-size: 9px; font-style: normal; white-space: nowrap;
}

.ch-log-feed {
  max-height: 180px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.ch-log-entry { display: flex; gap: 8px; font-size: 11px; }
.ch-log-time  { color: var(--text-muted-2); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ch-log-text  { color: var(--text); }

/* SVG node pulse animation */
@keyframes chPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

/* ── METRICS SCREEN ───────────────────────────────────────────────────────── */
.metrics-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metrics-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.metrics-card-label   { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; }
.metrics-card-val     { font-size: 36px; font-weight: 700; color: var(--accent); line-height: 1; }
.metrics-card-def     { font-size: 12px; color: var(--text-muted); }
.metrics-card-formula { font-family: monospace; font-size: 11px; color: var(--text-muted-2); }
.metrics-bar-bg       { height: 6px; background: var(--track); border-radius: 3px; margin: 8px 0; }
.metrics-bar-fill     { height: 100%; background: var(--accent); border-radius: 3px; }

.metrics-compare-panel { margin-top: 0; }
.metrics-compare-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.metrics-compare-label { font-size: 12px; color: var(--text-muted); min-width: 130px; }
.metrics-compare-bar-bg { flex: 1; height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.metrics-compare-bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }
.metrics-compare-dg { background: var(--ok); }
.metrics-compare-permission { background: var(--watching); }
.metrics-compare-val { font-weight: 700; font-size: 14px; min-width: 42px; text-align: right; color: var(--text); }

.metrics-setup-panel { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── PAST RUNS SCREEN ─────────────────────────────────────────────────────── */
.pr-summary-row {
  display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 4px;
}
.pr-summary-item {
  display: flex; flex-direction: column; gap: 2px;
}
.pr-summary-val { font-size: 28px; font-weight: 700; color: var(--text); }
.pr-summary-lbl { font-size: 11px; color: var(--text-muted-2); }

.pr-filter-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.pr-filter {
  padding: 4px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; font-size: 12px; color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pr-filter.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.pr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pr-table-panel { overflow-x: auto; }
.pr-table th {
  text-align: left; color: var(--text-muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.pr-table td {
  padding: 11px 0; border-bottom: 1px solid var(--border);
  vertical-align: middle; padding-right: 10px;
}
.pr-row-missed td { background: var(--danger-row); }

.pr-chip {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; border: 1px solid transparent;
}
.pr-chip-detected    { background: var(--ok-bg);          color: var(--ok-text);     border-color: var(--ok-border); }
.pr-chip-missed      { background: var(--quarantined-bg); color: var(--quarantined); border-color: var(--quarantined-border); }
.pr-chip-clean       { background: var(--ok-bg);          color: var(--ok-text);     border-color: var(--ok-border); }
.pr-chip-false-alarm { background: var(--watching-bg);    color: var(--watching-text); border-color: var(--watching-border); }
.pr-chip-attack      { background: var(--restricted-bg);  color: var(--restricted-text); border-color: var(--restricted-border); }
.pr-chip-normal      { background: var(--bg);             color: var(--text-muted);  border-color: var(--border); }
.pr-chip-allowed     { background: var(--bg);             color: var(--text-muted-2);border-color: var(--border); }
.pr-chip-na          { color: var(--text-muted-2); font-size: 11px; }

@media (max-width: 1100px) {
  .metrics-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-main-row { grid-template-columns: minmax(0, 1fr); }
  .ch-right-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { padding: 0 10px; }
  .brand-sub { display: none; }
  .topbar-tag { font-size: 9px; padding: 2px 6px; }
  .screen { padding: 24px 24px calc(var(--caption-reserve, 0px) + 24px); }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .end-card { padding: 28px 22px; }
  .end-cols { grid-template-columns: 1fr; gap: 18px; }
  .end-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ch-right-col { grid-template-columns: minmax(0, 1fr); }
  .pr-summary-row { gap: 14px; }
}

@media (max-width: 900px) {
  .chapter-bar { padding-left: calc(var(--nav-w) + 12px); padding-right: 12px; }
  .chapter-progress-wrap { left: calc(var(--nav-w) + 12px); right: 12px; }
  .tl-body { grid-template-columns: minmax(0,1fr); }
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
