/* VISION analyst console.
   Design language: ASP customer frontend refresh of 2026-11-06/08 (frontend/src/app/globals.css): the component
   classes in the "ASP components" section below are ported verbatim (Tailwind @apply expanded to plain CSS, same
   names, same values). Shell/sidebar follows the ASP Master Console.
   Visual parity with the ASP Master Console (master-console/frontend: tailwind.config.ts + globals.css):
   same brand / status / severity colours, same surface + text CSS variable names, dark mode by class on <html>
   (".dark", set by theme-init.js from the saved choice or prefers-color-scheme), section-card / data-table /
   pill conventions. No external fonts: Manrope is used when installed or self-hosted (see static/fonts/README.txt). */

:root {
  --accelerynt-red: #CF0036;
  --accelerynt-teal: #60AB9A;
  --accelerynt-black: #070600;
  --accelerynt-white: #F7F7FF;
  --accelerynt-blue: #083D77;
  --accelerynt-celestial: #279AF1;
  --chart-teal: #22A385;

  --status-healthy: #38a169;
  --status-degraded: #d69e2e;
  --status-unreachable: #CF0036;
  --status-provisioning: #279AF1;

  --severity-critical: #CF0036;
  --severity-high: #dd6b20;
  --severity-medium: #d69e2e;
  --severity-low: #38a169;
  --severity-info: #279AF1;

  /* Risk levels (ASP names) */
  --critical: #CF0036;
  --high: #dd6b20;
  --medium: #d69e2e;
  --low: #38a169;
  --info: #279AF1;

  /* Light theme surfaces (Master Console names) */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-code: #f8fafc;
  --bg-hover: #f1f5f9;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.12);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8; /* ASP value; 2.6:1 on white, so VISION never puts essential text in muted alone */
  --overlay-subtle: rgba(0, 0, 0, 0.02);
  --overlay-hover: rgba(0, 0, 0, 0.04);
  --link: #1f6fb8;
  --focus: #279AF1;
  --glow-alpha: 0.07;

  --radius-sm: 6px;
  --radius: 8px;      /* rounded-lg */
  --radius-xl: 12px;  /* rounded-xl */
  --gutter: 24px;
  --sidebar-w: 256px; /* w-64 */
  --font-sans: 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, 'SFMono-Regular', Menlo, monospace;
  --ease-signature: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

.dark {
  --bg-primary: #070600;
  --bg-surface: #1a1a1a;
  --bg-surface-elevated: #2a2a2a;
  --bg-code: #0d1117;
  --bg-hover: #222222;
  --border-color: #2a2a2a;
  --border-light: #3a3a3a;
  --text-primary: #F7F7FF;
  --text-secondary: #b0b0b0;
  --text-muted: #888;
  --overlay-subtle: rgba(255, 255, 255, 0.02);
  --overlay-hover: rgba(255, 255, 255, 0.04);
  --link: #6cb8f6;
  --glow-alpha: 0.22;
  color-scheme: dark;
}

/* No-JS fallback: follow the OS unless the page was explicitly set to light. */
@media (prefers-color-scheme: dark) {
  html:not(.light):not(.dark) {
    --bg-primary: #070600; --bg-surface: #1a1a1a; --bg-surface-elevated: #2a2a2a; --bg-code: #0d1117;
    --bg-hover: #222222; --border-color: #2a2a2a; --border-light: #3a3a3a; --text-primary: #F7F7FF;
    --text-secondary: #b0b0b0; --text-muted: #888; --overlay-subtle: rgba(255,255,255,0.02);
    --overlay-hover: rgba(255,255,255,0.04); --link: #6cb8f6; --glow-alpha: 0.22; color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg-primary); color: var(--text-primary);
  font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--bg-surface); padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { top: 8px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.tabular { font-variant-numeric: tabular-nums; }
.wrap-anywhere { overflow-wrap: anywhere; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── Shell: sidebar + main ─────────────────────────────────────── */
.dev-banner { background: var(--accelerynt-red); color: #fff; text-align: center; font-weight: 700; font-size: 12px; padding: 4px 16px; letter-spacing: .04em; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column; background: var(--bg-surface); border-right: 1px solid var(--border-color);
}
.brand { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 20px; border-bottom: 1px solid var(--border-color); }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--radius); background: var(--accelerynt-red); color: #fff; font-weight: 800; font-size: 14px; }
.brand-name { font-size: 14px; font-weight: 800; letter-spacing: .02em; margin: 0; }
.brand-sub { font-size: 10px; color: var(--text-muted); margin: 0; }
.nav { flex: 1; overflow-y: auto; padding: 16px 8px; }
.nav-group { padding: 0 12px; margin-bottom: 8px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 4px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: var(--text-muted); text-decoration: none;
}
.nav a:hover { background: var(--bg-hover); color: var(--text-secondary); }
.nav a[aria-current="page"] { background: var(--bg-surface-elevated); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-light); }
.nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--border-color); }
.avatar { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--accelerynt-blue); color: #fff; font-size: 12px; font-weight: 700; }
.user-meta { flex: 1; min-width: 0; }
.user-meta p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-name { font-size: 14px; font-weight: 500; }
.user-role { font-size: 12px; color: var(--text-muted); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font: inherit; }
.icon-btn:hover { background: var(--bg-surface-elevated); color: var(--text-secondary); }
.icon-btn svg { width: 16px; height: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; padding: 0 var(--gutter); border-bottom: 1px solid var(--border-color); background: var(--bg-surface); position: sticky; top: 0; z-index: 20; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar .who { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.content { padding: var(--gutter); width: 100%; max-width: 1440px; }

/* ── Page header (ASP AdminPageHeader on .module-header) ──────── */
.page-head { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.page-head .eyebrow { margin: 0; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); }
.page-head h1 { margin: 8px 0 0; font-size: 24px; line-height: 32px; font-weight: 700; color: var(--text-primary); }
.page-head .subtitle { margin: 8px 0 0; max-width: 48rem; font-size: 14px; line-height: 1.625; color: var(--text-muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
@media (min-width: 640px) { .page-head { flex-direction: row; align-items: flex-start; justify-content: space-between; } }

/* ── Cards ─────────────────────────────────────────────────────── */
/* ── ASP components (verbatim port of frontend/src/app/globals.css @layer components) ── */
/* Texture belongs on summary/header surfaces, never dense table bodies. */
.surface-grid { background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px); background-size: 16px 16px; }
.metric-card {
  background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px); background-size: 16px 16px;
  position: relative; min-width: 0; border-radius: 12px; border: 1px solid var(--border-light); background-color: var(--bg-surface); padding: 16px;
}
.module-header {
  background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px); background-size: 16px 16px;
  min-width: 0; border-radius: 12px; border: 1px solid var(--border-light); background-color: var(--bg-surface); padding: 16px;
}
@media (min-width: 640px) { .module-header { padding: 20px; } }
.stat-card {
  background-image: radial-gradient(circle, var(--border-color) 1px, transparent 1px); background-size: 16px 16px;
  position: relative; min-width: 0; border-radius: 12px; border: 1px solid var(--border-light); background-color: var(--bg-surface); padding: 16px;
  text-align: center; color: var(--text-primary);
  box-shadow: inset 0 1px 0 var(--metric-accent, var(--accelerynt-teal));
}
.stat-card-critical { --metric-accent: var(--critical); }
.stat-card-high { --metric-accent: var(--high); }
.stat-card-moderate { --metric-accent: var(--medium); }
.stat-card-low { --metric-accent: var(--low); }
.stat-card-info { --metric-accent: var(--info); }
.stat-card-default { --metric-accent: var(--accelerynt-teal); }
.finding-card { border-left: 4px solid transparent; padding: 20px; margin-bottom: 16px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; transition: color .15s, background-color .15s, border-color .15s; }
.finding-card-critical { border-left-color: #CF0036; background: rgba(207, 0, 54, 0.06); }
.finding-card-high { border-left-color: #dd6b20; background: rgba(221, 107, 32, 0.06); }
.finding-card-moderate { border-left-color: #d69e2e; background: rgba(214, 158, 46, 0.06); }
.finding-card-low { border-left-color: #38a169; background: rgba(56, 161, 105, 0.06); }
.finding-card-info { border-left-color: #279AF1; background: rgba(39, 154, 241, 0.06); }
.risk-badge { display: inline-block; padding: 4px 12px; border-radius: 9999px; font-size: 12px; line-height: 16px; font-weight: 700; text-transform: uppercase; color: #fff; }
.section-card { min-width: 0; border-radius: 12px; padding: 16px; margin-bottom: 24px; background: var(--bg-surface); border: 1px solid var(--border-light); }
@media (min-width: 640px) { .section-card { padding: 24px; } }
/* Section header utility — uppercase muted label like SOC tools */
.section-header { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 12px; color: var(--text-muted); }
/* Metadata pill chips */
.meta-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 9999px; padding: 4px 12px; font-size: 11px; font-weight: 500; background: var(--overlay-hover); border: 1px solid var(--border-color); color: var(--text-secondary); }
.data-table { width: 100%; font-size: 14px; line-height: 20px; table-layout: fixed; border-collapse: collapse; }
.data-table th { padding: 12px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--overlay-subtle); }
.data-table td { padding: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--overlay-hover); }
.data-table tr { transition: background-color .15s; }
.data-table tbody tr:hover { background: var(--overlay-subtle); }
.data-table th:first-child { border-top-left-radius: 8px; }
.data-table th:last-child { border-top-right-radius: 8px; }
/* ── end of ASP port ── */

/* risk-badge colours (ASP uses bg-risk-* utilities alongside the class) */
.risk-critical { background: var(--critical); }
.risk-high { background: var(--high); }
.risk-medium { background: var(--medium); }
.risk-low { background: var(--low); }
.risk-info { background: var(--info); }
.section-card .section-card-sub { font-size: 12px; color: var(--text-secondary); }

/* StatCard / StatStrip structure (frontend/src/components/assessment/StatCard.tsx, admin/kit/StatStrip.tsx) */
.stat-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
@media (min-width: 640px) { .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .stat-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metric-card { overflow: hidden; }
.metric-card .metric-accent { position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--metric-accent, var(--accelerynt-teal)); }
.metric-label { position: relative; display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 16px; color: var(--text-secondary); margin: 0; font-weight: 400; }
.metric-dot { margin-top: 4px; width: 6px; height: 6px; flex-shrink: 0; border-radius: 2px; background: var(--metric-accent, var(--accelerynt-teal)); }
.metric-value { position: relative; margin-top: 12px; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; color: var(--text-primary); overflow-wrap: anywhere; }
.metric-value.mono { font-family: var(--font-mono); font-size: 24px; line-height: 32px; letter-spacing: 0; }
.metric-value .unit { font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--text-muted); margin-left: 4px; }
.metric-hint { position: relative; margin-top: 8px; font-size: 11px; line-height: 1.625; color: var(--text-muted); }
.metric-hint b { color: var(--text-secondary); font-weight: 600; }
.metric-split { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.metric-split > div { font-size: 11px; color: var(--text-secondary); min-width: 0; }
.metric-split b { display: block; font-size: 18px; line-height: 24px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.metric-card.alarm { border-color: var(--critical); }
.unknown { color: var(--text-muted); }
.section-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head-row .section-header { margin-bottom: 4px; }
.hairline-top::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--hairline-color, transparent), transparent); pointer-events: none; }
.accent-teal { --hairline-color: var(--chart-teal); }
.accent-celestial { --hairline-color: var(--accelerynt-celestial); }
.accent-red { --hairline-color: var(--accelerynt-red); }
.accent-amber { --hairline-color: var(--status-degraded); }
.card-sheen::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgba(255,255,255,0.05), transparent 40%); pointer-events: none; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-2 > .section-card { margin-bottom: 0; }
.grid-2 + .section-card, .grid-2 + .grid-2 { margin-top: 24px; }
.stack > * + * { margin-top: 24px; }

.tone-good { color: var(--chart-teal); }
.tone-warn { color: var(--status-degraded); }
.tone-bad { color: var(--accelerynt-red); }

/* Meter (UsageBar) and bars: SVG with width attributes, because the CSP forbids inline style attributes */
.meter-svg { display: block; width: 100%; height: 8px; margin-top: 10px; overflow: visible; }
.meter-svg .track { fill: var(--bg-surface-elevated); }
.meter-svg .fill { fill: var(--chart-teal); }
.meter-svg.warn .fill { fill: var(--status-degraded); }
.meter-svg.bad .fill { fill: var(--accelerynt-red); }
.meter-svg .tick { fill: var(--text-muted); }
.bar-svg { display: block; width: 100%; height: 10px; margin: 8px 0; border-radius: 999px; }
.bar-svg .agree { fill: var(--chart-teal); }
.bar-svg .disagree { fill: var(--accelerynt-red); }
.bar-svg .na { fill: var(--bg-surface-elevated); }

/* ── Pills ─────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  color: var(--pill, var(--text-secondary)); background: color-mix(in srgb, var(--pill, #888) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pill, #888) 25%, transparent); }
.pill.upper { text-transform: uppercase; letter-spacing: .03em; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.meta-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pill, var(--text-muted)); }
.sev-critical { --pill: var(--severity-critical); }
.sev-high { --pill: var(--severity-high); }
.sev-medium { --pill: var(--severity-medium); }
.sev-low { --pill: var(--severity-low); }
.sev-informational, .sev-info { --pill: var(--severity-info); }
.st-new { --pill: var(--accelerynt-celestial); }
.st-active { --pill: var(--status-degraded); }
.st-closed { --pill: var(--text-muted); }
.ok { --pill: var(--status-healthy); }
.warn { --pill: var(--status-degraded); }
.bad { --pill: var(--status-unreachable); }
.info { --pill: var(--status-provisioning); }
.neutral { --pill: var(--text-muted); }

/* ── Buttons and inputs ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid var(--border-light);
  background: var(--bg-surface); color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn-primary { background: var(--accelerynt-teal); border-color: transparent; color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accelerynt-teal) 80%, black); }
.btn-danger { background: var(--accelerynt-red); border-color: transparent; color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--accelerynt-red) 85%, black); }
.btn-sm { min-height: 28px; padding: 4px 10px; font-size: 12px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .5; cursor: not-allowed; }
.link-primary { font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated); color: var(--text-primary); font: inherit; font-size: 14px;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accelerynt-teal) 50%, transparent); }
label.field { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.field-row { margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; align-items: flex-end; }
.filters .input { width: auto; min-width: 140px; }
.filters .grow { flex: 1 1 220px; }
.filters .grow .input { width: 100%; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border-color); margin-bottom: 12px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--accelerynt-teal); background: color-mix(in srgb, var(--accelerynt-teal) 8%, transparent); }
.radio-card input { margin-top: 3px; }
.result { font-size: 13px; margin-top: 8px; min-height: 1em; }
.result.ok-text { color: var(--status-healthy); }
.result.err-text { color: var(--accelerynt-red); }

/* ── Tables (data-table) ───────────────────────────────────────── */
.table-wrap { border-radius: 12px; border: 1px solid var(--border-light); background: var(--bg-surface); overflow: hidden; }
.data-table td { vertical-align: top; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
/* fixed layout needs column widths (incident table) */
.col-num { width: 76px; } .col-sev { width: 104px; } .col-status { width: 104px; } .col-agent { width: 170px; }
.col-closer { width: 150px; } .col-card { width: 104px; } .col-age { width: 80px; } .col-links { width: 176px; }
.data-table tr.is-selected { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--accelerynt-red); }
.data-table .title-cell { color: var(--text-primary); font-weight: 500; overflow-wrap: anywhere; }
.data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table a.row-link { color: var(--text-primary); }
.cell-links { display: flex; flex-wrap: wrap; gap: 6px; }
.agent-read { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--text-muted); gap: 12px; flex-wrap: wrap; }
.empty { padding: 32px; text-align: center; color: var(--text-muted); }

/* ── Activity timeline ─────────────────────────────────────────── */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-color); }
.timeline li:first-child { border-top: 0; }
.timeline .when { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline .what { min-width: 0; overflow-wrap: anywhere; }
.timeline .what .t { color: var(--text-primary); }

/* ── Drawer (detail) ───────────────────────────────────────────── */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(7,6,0,0.55); z-index: 50; animation: fade-in 150ms var(--ease-signature); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(720px, 100vw); overflow-y: auto;
  background: var(--bg-surface); border-left: 1px solid var(--border-color); box-shadow: -20px 0 50px rgba(0,0,0,0.35);
  animation: slide-in 220ms var(--ease-signature);
}
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 20px 24px; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); }
.drawer-head h2 { margin: 4px 0 0; font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }
.drawer-head h2:focus { outline: none; }
.drawer-body { padding: 20px 24px 40px; }
.drawer-section { margin-bottom: 24px; }
.drawer-section ul { margin: 0; padding-left: 18px; }
.drawer-section li { margin-bottom: 6px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--text-muted); font-size: 12px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.comment { padding: 12px; border-radius: var(--radius); background: var(--bg-surface-elevated); margin-bottom: 8px; }
.comment-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-family: inherit; }
.action-card { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.action-card h3 { margin: 0 0 12px; font-size: 14px; }
.readonly-note { padding: 12px 16px; border-radius: var(--radius); background: var(--bg-surface-elevated); color: var(--text-secondary); font-size: 13px; }
.callout { padding: 12px 16px; border-radius: var(--radius); border-left: 3px solid var(--accelerynt-celestial); background: var(--bg-surface-elevated); }
body.drawer-open { overflow: hidden; }
.drawer-page-fallback { margin-top: 24px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.reveal { animation: reveal 380ms var(--ease-signature) both; }
@media (prefers-reduced-motion: reduce) { .reveal, .drawer, .drawer-backdrop { animation: none !important; } }

/* ── Clients ───────────────────────────────────────────────────── */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 16px; }
.client-grid .section-card { margin-bottom: 0; }
.client-card h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.ws { border-top: 1px solid var(--border-color); padding: 12px 0 0; margin-top: 12px; }
.ws-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.ws-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.ws-counts div { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.ws-counts b { display: block; font-size: 18px; color: var(--text-primary); letter-spacing: 0; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .lg-agree { background: var(--chart-teal); }
.legend .lg-disagree { background: var(--accelerynt-red); }
.legend .lg-na { background: var(--bg-surface-elevated); box-shadow: inset 0 0 0 1px var(--border-light); }

/* Misc */
.signout { margin: 0; }
.spaced { margin-top: 20px; }
.spaced-top { margin-top: 24px; }
.summary-line { margin: 0 0 12px; }
.action-title { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
fieldset.plain { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
fieldset.plain > label { display: inline-flex; align-items: center; gap: 6px; margin: 4px 16px 4px 0; }
fieldset.plain > label.radio-card { display: flex; margin-right: 0; }
fieldset[disabled] .radio-card { cursor: not-allowed; opacity: .7; }
.err-callout { border-left-color: var(--accelerynt-red); margin-bottom: 24px; }
.err-callout ul { margin: 6px 0 0; padding-left: 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: var(--radius); background: var(--bg-surface-elevated); color: var(--text-primary);
  border: 1px solid var(--border-light); box-shadow: 0 10px 30px rgba(0,0,0,0.3); font-size: 13px; overflow-wrap: anywhere; display: none; }
.toast.show { display: block; animation: fade-in 150ms var(--ease-signature); }
details > summary { cursor: pointer; }
.drawer ol { margin: 0; padding-left: 20px; }

/* htmx request indicator (htmx's own inline indicator styles are disabled for CSP) */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1200px) { .data-table.wide .col-closer { width: 120px; } }
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform 200ms var(--ease-signature); }
  .sidebar.open { transform: none; box-shadow: 20px 0 50px rgba(0,0,0,0.35); }
  .menu-btn { display: inline-flex; }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .topbar .who { display: none; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .filters .input { min-width: 0; flex: 1 1 140px; width: 100%; }
  /* Tables collapse to cards */
  .data-table.collapse thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .data-table.collapse, .data-table.collapse tbody, .data-table.collapse tr, .data-table.collapse td { display: block; width: 100%; }
  .data-table.collapse tr { padding: 12px 16px; border-top: 1px solid var(--border-color); }
  .data-table.collapse tr:first-child { border-top: 0; }
  .data-table.collapse td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 96px 1fr; gap: 8px; min-width: 0; }
  .data-table.collapse td::before { content: attr(data-label); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
  .data-table.collapse td.title-cell { min-width: 0; }
  .data-table.collapse td > * { grid-column: 2; justify-self: start; max-width: 100%; }
  .data-table.collapse td { row-gap: 2px; }
  .data-table.collapse td.title-cell > * { justify-self: stretch; }
  .topbar .meta-pill { display: none; }
  .filters > div { flex: 1 1 140px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

/* Drawer head as an ASP finding card with the incident's severity accent */
.drawer-head .drawer-finding { flex: 1; min-width: 0; margin: 0; }
.drawer-head .drawer-finding h2 { margin-top: 10px; }
.drawer-ask { margin: 10px 0 0; font-size: 13px; color: var(--text-secondary); }
.drawer-ask .section-header { display: block; margin-bottom: 2px; }
.drawer-head { padding: 16px 16px 16px 0; align-items: flex-start; }
.data-table.collapse.wide td .risk-badge { padding: 2px 10px; font-size: 11px; }

/* ── Compute (drafting pool monitor) ───────────────────────────── */
@media (min-width: 1200px) { .stat-strip-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.load-card { padding: 12px 16px; }
@media (min-width: 640px) { .load-card { padding: 14px 24px; } }
.load-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.load-row .section-header { margin: 0; }
.load-item { display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; align-items: center; gap: 10px; flex: 1 1 220px; min-width: 0; }
.load-note { font-size: 12px; }
.compute-grid { align-items: start; margin-bottom: 24px; }
.compute-col > .section-card:last-child { margin-bottom: 0; }
.compute-col > .section-card { margin-bottom: 24px; }
.hbar { display: block; width: 100%; height: 6px; min-width: 0; }
.hbar .track { fill: var(--bg-surface-elevated); }
.hbar .fill { fill: var(--chart-teal); }
.hbar.m-vram .fill { fill: var(--high); }
.hbar.m-ram .fill { fill: var(--chart-teal); }
.hbar.m-disk .fill { fill: var(--accelerynt-celestial); }
.hbar.m-slots .fill { fill: var(--status-provisioning); }
.hbar.m-kv .fill { fill: var(--medium); }
.meter-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 6px 0; }
.meter-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); white-space: nowrap; }
.meter-num { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.node-card { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; background: var(--overlay-subtle); }
.node-card:first-of-type { margin-top: 0; }
.node-card.node-offline { border-left: 3px solid var(--status-unreachable); }
.node-card.node-degraded { border-left: 3px solid var(--status-degraded); }
.node-card.node-online { border-left: 3px solid var(--status-healthy); }
.node-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.node-title { min-width: 0; }
.node-name { margin: 0; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.node-sub { margin: 2px 0 0; color: var(--text-muted); overflow-wrap: anywhere; }
.node-pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.node-line { margin: 6px 0; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.node-line b { color: var(--text-primary); font-weight: 600; }
.node-cpu { display: flex; justify-content: space-between; gap: 12px; }
.node-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.node-job { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 13px; overflow-wrap: anywhere; }
.node-job a { font-weight: 600; }
.node-status { margin: 6px 0 0; font-size: 12px; }
.model-name { margin: 0; font-size: 16px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.model-file { margin: 4px 0 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.model-sub { margin: 10px 0 0; font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--bg-surface-elevated); margin: 8px 0; }
.stat-grid span { display: block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.stat-grid b { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 14px; color: var(--text-primary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-grid small { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.fill-svg { display: block; width: 100%; height: 18px; border-radius: 4px; margin: 4px 0 12px; }
.fill-svg .track { fill: var(--bg-surface-elevated); }
.seg-0 { fill: var(--high); } .seg-1 { fill: var(--medium); } .seg-2 { fill: var(--chart-teal); }
.seg-3 { fill: var(--accelerynt-celestial); } .seg-4 { fill: var(--status-provisioning); } .seg-5 { fill: var(--low); }
.lg-seg-0 { background: var(--high); } .lg-seg-1 { background: var(--medium); } .lg-seg-2 { background: var(--chart-teal); }
.lg-seg-3 { background: var(--accelerynt-celestial); } .lg-seg-4 { background: var(--status-provisioning); } .lg-seg-5 { background: var(--low); }
.fill-legend { gap: 8px 18px; }
.fill-legend b { color: var(--text-primary); font-family: var(--font-mono); font-size: 11px; }
.fill-note { margin: 10px 0 0; font-size: 12px; }
.jobs-table .col-when { width: 90px; } .jobs-table .col-inc { width: auto; } .jobs-table .col-sev { width: 140px; } .jobs-table .col-num { width: 96px; }
/* numbers right-aligned in columns wide enough for '530,000 / 7,400' and '1802.4' so neighbours never run together */
.jobs-table .col-node { width: 130px; } .jobs-table .col-model { width: 170px; } .jobs-table td { overflow-wrap: break-word; word-break: normal; }
.jobs-table .col-tokens { width: 170px; } .jobs-table .col-tps { width: 100px; } .jobs-table .col-outcome { width: 130px; }
.data-table .r { text-align: right; } .data-table td.num.r { overflow: hidden; text-overflow: ellipsis; }
.compute-foot { font-size: 12px; margin: -8px 0 0; }
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meter-row { grid-template-columns: 48px minmax(0, 1fr); }
  .meter-row .meter-num { grid-column: 2; }
  .node-head { flex-direction: column; }
  .node-pills { justify-content: flex-start; }
  .jobs-table .col-when, .jobs-table .col-inc, .jobs-table .col-sev, .jobs-table .col-num, .jobs-table .col-node, .jobs-table .col-model, .jobs-table .col-tokens, .jobs-table .col-tps, .jobs-table .col-outcome { width: auto; }
  .data-table.collapse td.r { text-align: left; }
}


/* ── Pipeline graph (WS-D, plan section 8.2) ──────────────────────
   Geometry is fixed and shared with vision/app/pipeline.py (COL_W, GUTTER, CARD_H, ROW_GAP, HALF): the server
   computes the SVG edge paths from the same numbers, so cards sit on a CSS grid and the connector layer is one SVG
   drawn underneath at 1:1. Change both together; tests/test_pipeline.py checks they agree. */
:root {
  --k-inbound: #CF0036; --k-evidence: #5b8fd6; --k-router: #60AB9A; --k-local: #22A385;
  --k-cloud: #279AF1; --k-merge: #d69e2e; --k-guardrail: #38a169;
  --edge-idle: rgba(15, 23, 42, 0.18); --edge-flow: rgba(39, 154, 241, 0.55); --canvas: #f3f6fa;
}
.dark { --edge-idle: rgba(255, 255, 255, 0.14); --edge-flow: rgba(39, 154, 241, 0.6); --canvas: #0e0e0d; }
@media (prefers-color-scheme: dark) { html:not(.light):not(.dark) { --edge-idle: rgba(255,255,255,0.14); --edge-flow: rgba(39,154,241,0.6); --canvas: #0e0e0d; } }

.content:has(.pg-root) { max-width: 1680px; }
.pg-card { padding: 16px; }
@media (min-width: 640px) { .pg-card { padding: 20px 24px; } }
.pg-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pg-legend { margin-top: 4px; }
.pg-legend i { width: 18px; height: 3px; border-radius: 2px; vertical-align: 3px; }
.pg-legend .lg-flow { background: var(--edge-flow); }
.pg-legend .lg-active { background: repeating-linear-gradient(90deg, var(--accelerynt-celestial) 0 6px, transparent 6px 10px); }
.pg-legend .lg-fail { background: var(--status-degraded); }
.pg-legend .lg-esc { background: repeating-linear-gradient(90deg, var(--accelerynt-red) 0 5px, transparent 5px 9px); }
.pg-zoom { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid var(--border-light); background: var(--bg-surface-elevated); }
.pg-zoom-level { min-width: 44px; text-align: center; font-size: 11px; color: var(--text-secondary); }
.pg-zoom .btn-sm { min-height: 26px; }

.pg-scroll { overflow-x: auto; overflow-y: hidden; border-radius: 12px; border: 1px solid var(--border-color); background: var(--canvas); }
.pg-stage { width: max-content; padding: 14px 20px 6px; }
.pg-heads, .pg-canvas { display: grid; grid-template-columns: 164px 164px 172px 244px 172px 172px 196px; column-gap: 52px; }
.pg-heads { margin-bottom: 10px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--text-muted); }
.pg-heads span { padding-left: 2px; border-left: 2px solid var(--border-light); padding-left: 8px; }
.pg-canvas { position: relative; grid-auto-rows: 60px; padding-bottom: 50px; background-color: transparent; }
.pg-edges { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 0; }
.pg-canvas > .col-0, .pg-heads > .col-0 { grid-column: 1; }
.pg-canvas > .col-1, .pg-heads > .col-1 { grid-column: 2; }
.pg-canvas > .col-2, .pg-heads > .col-2 { grid-column: 3; }
.pg-canvas > .col-3, .pg-heads > .col-3 { grid-column: 4; }
.pg-canvas > .col-4, .pg-heads > .col-4 { grid-column: 5; }
.pg-canvas > .col-5, .pg-heads > .col-5 { grid-column: 6; }
.pg-canvas > .col-6, .pg-heads > .col-6 { grid-column: 7; }
.pg-canvas > .row-0 { grid-row: 1 / span 2; }
.pg-canvas > .row-1 { grid-row: 2 / span 2; }
.pg-canvas > .row-2 { grid-row: 3 / span 2; }
.pg-canvas > .row-3 { grid-row: 4 / span 2; }
.pg-canvas > .row-4 { grid-row: 5 / span 2; }
.pg-canvas > .row-5 { grid-row: 6 / span 2; }
.pg-canvas > .row-6 { grid-row: 7 / span 2; }
.pg-canvas > .row-7 { grid-row: 8 / span 2; }
.pg-canvas > .row-8 { grid-row: 9 / span 2; }
.pg-canvas > .row-9 { grid-row: 10 / span 2; }
.pg-canvas > .row-10 { grid-row: 11 / span 2; }
.pg-canvas > .row-11 { grid-row: 12 / span 2; }
.pg-canvas > .row-12 { grid-row: 13 / span 2; }
.pg-canvas > .row-13 { grid-row: 14 / span 2; }
.pg-canvas > .row-14 { grid-row: 15 / span 2; }
.pg-canvas > .row-15 { grid-row: 16 / span 2; }
.pg-canvas > .row-16 { grid-row: 17 / span 2; }
.pg-canvas > .row-17 { grid-row: 18 / span 2; }
.pg-canvas > .row-18 { grid-row: 19 / span 2; }
.pg-canvas > .row-19 { grid-row: 20 / span 2; }
.pg-canvas > .row-20 { grid-row: 21 / span 2; }
.pg-canvas > .row-21 { grid-row: 22 / span 2; }
.pg-canvas > .row-22 { grid-row: 23 / span 2; }
.pg-canvas > .row-23 { grid-row: 24 / span 2; }
.pg-canvas > .row-24 { grid-row: 25 / span 2; }
.pg-canvas > .row-25 { grid-row: 26 / span 2; }

.pg-edge { fill: none; stroke: var(--edge-idle); stroke-linecap: round; transition: opacity .2s, stroke .2s; }
.pg-edge.s-idle { stroke-dasharray: 2 6; }
.pg-edge.s-flow { stroke: var(--edge-flow); }
.pg-edge.s-flow.t-mixed { stroke: color-mix(in srgb, var(--status-degraded) 75%, transparent); }
.pg-edge.s-flow.t-warn { stroke: color-mix(in srgb, var(--status-degraded) 85%, transparent); stroke-dasharray: 5 4; }
.pg-edge.t-escalate { stroke: color-mix(in srgb, var(--accelerynt-red) 80%, transparent); stroke-dasharray: 7 5; }
.pg-edge.s-active { stroke: var(--accelerynt-celestial); stroke-dasharray: 9 7; animation: pg-dash 0.9s linear infinite; filter: drop-shadow(0 0 4px rgba(39,154,241,.55)); }
@keyframes pg-dash { to { stroke-dashoffset: -32; } }
.pg-arrowhead { fill: var(--edge-flow); }
.pg-arrowhead.esc { fill: var(--accelerynt-red); }
.pg-badge rect { fill: var(--bg-surface-elevated); stroke: var(--border-light); stroke-width: 1; }
.pg-badge text { fill: var(--text-primary); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.pg-badge.t-mixed rect, .pg-badge.t-warn rect { stroke: var(--status-degraded); }
.pg-badge.t-escalate rect { stroke: var(--accelerynt-red); }
.pg-badge.s-active rect { stroke: var(--accelerynt-celestial); }

.pg-node {
  --k: var(--k-router);
  position: relative; z-index: 1; height: 96px; min-width: 0; padding: 10px 12px; border-radius: 12px; overflow: hidden;
  background: var(--bg-surface); border: 1px solid var(--border-light);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.55); transition: opacity .2s, border-color .2s, box-shadow .2s;
}
.pg-node::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--k), transparent 70%); opacity: .85; }
.k-inbound { --k: var(--k-inbound); } .k-evidence { --k: var(--k-evidence); } .k-router { --k: var(--k-router); }
.k-local { --k: var(--k-local); } .k-cloud { --k: var(--k-cloud); } .k-merge { --k: var(--k-merge); } .k-guardrail { --k: var(--k-guardrail); }
.k-disp.dt-ok { --k: var(--status-healthy); } .k-disp.dt-bad { --k: var(--accelerynt-red); } .k-disp.dt-warn { --k: var(--status-degraded); }
.pg-node-head { display: flex; align-items: flex-start; gap: 10px; }
.pg-icon { --k: inherit; display: inline-grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; color: var(--k);
  background: color-mix(in srgb, var(--k) 15%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--k) 38%, transparent); }
.pg-glyph { width: 17px; height: 17px; }
.pg-titles { flex: 1; min-width: 0; }
.pg-eyebrow { margin: 0; font-size: 10.5px; line-height: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-title { margin: 1px 0 0; font-size: 13px; line-height: 17px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-title a { color: inherit; }
.pg-line { margin: 7px 0 0; font-size: 11.5px; line-height: 15px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-line + .pg-line { margin-top: 3px; }
.pg-line b { color: var(--text-primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-line.muted { color: var(--text-muted); }
.pg-stats span + span::before { content: '·'; margin: 0 5px; color: var(--text-muted); }
.pg-now a { font-weight: 700; }
.pg-count { font-size: 22px; line-height: 26px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.pg-state { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; font-size: 10.5px; font-weight: 600; line-height: 16px; color: var(--pill, var(--text-muted)); white-space: nowrap; }
.pg-state .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.pg-node.is-busy { border-color: color-mix(in srgb, var(--accelerynt-celestial) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accelerynt-celestial) 45%, transparent), 0 0 28px -6px rgba(39,154,241,.5); }
.pg-node.st-offline .pg-icon, .pg-node.st-unknown .pg-icon { filter: grayscale(1); opacity: .6; }
.pg-node.st-offline { border-style: dashed; }
.pg-node.st-degraded { border-color: color-mix(in srgb, var(--status-degraded) 45%, var(--border-light)); }
.pg-modes { display: flex; gap: 4px; }
.pg-mode { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 600; line-height: 16px; white-space: nowrap;
  color: var(--m, var(--text-secondary)); background: color-mix(in srgb, var(--m, #888) 14%, transparent); }
.m-single { --m: var(--accelerynt-teal); } .m-consensus { --m: var(--accelerynt-celestial); } .m-draft-judge { --m: var(--k-merge); } .m-chain { --m: #a78bfa; }
.tone-info { color: var(--accelerynt-celestial); }
.pg-pulse { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--accelerynt-celestial); vertical-align: 0; animation: pg-pulse 1.6s ease-out infinite; }
@keyframes pg-pulse { 0% { box-shadow: 0 0 0 0 rgba(39,154,241,.6); } 100% { box-shadow: 0 0 0 9px rgba(39,154,241,0); } }

/* hover/focus on a card or a run highlights its path (vision.js) */
.pg-canvas.is-focus .pg-node, .pg-canvas.is-focus .pg-edge, .pg-canvas.is-focus .pg-badge { opacity: .22; }
.pg-canvas.is-focus .is-hot { opacity: 1; }
.pg-canvas.is-focus .pg-edge.is-hot { stroke: var(--accelerynt-celestial); }
[data-path] { cursor: default; }
tr[data-path]:focus-visible, li[data-path]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.pg-root[data-zoom="50"] .pg-stage { zoom: 0.5; }
.pg-root[data-zoom="60"] .pg-stage { zoom: 0.6; }
.pg-root[data-zoom="70"] .pg-stage { zoom: 0.7; }
.pg-root[data-zoom="80"] .pg-stage { zoom: 0.8; }
.pg-root[data-zoom="90"] .pg-stage { zoom: 0.9; }
.pg-root[data-zoom="100"] .pg-stage { zoom: 1; }
.pg-root[data-zoom="110"] .pg-stage { zoom: 1.1; }
.pg-root[data-zoom="120"] .pg-stage { zoom: 1.2; }
.pg-root[data-zoom="130"] .pg-stage { zoom: 1.3; }
.pg-root[data-zoom="140"] .pg-stage { zoom: 1.4; }
.pg-root[data-zoom="150"] .pg-stage { zoom: 1.5; }

/* Same data as a list: visible on small screens, always available to screen readers */
.pg-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (max-width: 900px) {
  .pg-list { position: static; width: auto; height: auto; clip: auto; white-space: normal; margin: 16px 0 0; padding-left: 20px; color: var(--text-secondary); }
  .pg-list li { margin-bottom: 6px; }
}

/* Drafting-now strip */
.pg-live { margin-bottom: 24px; padding: 14px 16px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accelerynt-celestial) 35%, var(--border-light));
  background: linear-gradient(90deg, color-mix(in srgb, var(--accelerynt-celestial) 9%, var(--bg-surface)), var(--bg-surface) 60%); }
.pg-live .section-header { margin-bottom: 8px; }
.pg-live-list { list-style: none; margin: 0; padding: 0; }
.pg-live-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 0; border-top: 1px solid var(--border-color); }
.pg-live-row:first-child { border-top: 0; }
.pg-live-inc { font-weight: 600; min-width: 0; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-live-title { color: var(--text-primary); font-weight: 500; }
.pg-live-age { font-size: 12px; margin-left: auto; }

/* Run path chips (Recent runs, Drafting now) */
.pg-runpath { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pg-fan { display: inline-flex; gap: 4px; }
.pg-fan.is-fan { flex-direction: column; align-items: flex-start; padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--accelerynt-celestial) 55%, transparent); border-radius: 2px; }
.pg-chip { --k: var(--k-local); display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 4px; border-radius: 8px; font-size: 11.5px; line-height: 18px;
  background: var(--bg-surface-elevated); border: 1px solid var(--border-light); white-space: nowrap; }
.pg-chip.k-cloud { --k: var(--k-cloud); }
.pg-chip .pg-glyph { width: 14px; height: 14px; color: var(--k); }
.pg-chip-merge { --k: var(--k-merge); } .pg-chip-final { padding-left: 6px; }
.pg-chip-final.ok .pg-glyph { color: var(--status-healthy); } .pg-chip-final.bad .pg-glyph { color: var(--accelerynt-red); } .pg-chip-final.warn .pg-glyph { color: var(--status-degraded); }
.pg-chip-name { font-weight: 600; color: var(--text-primary); }
.pg-chip-role { color: var(--text-muted); }
.pg-chip-res { font-weight: 600; color: var(--pill, var(--text-secondary)); }
.pg-arrow { position: relative; display: inline-block; width: 16px; height: 1px; background: var(--border-light); }
.pg-arrow::after { content: ''; position: absolute; right: -1px; top: -3px; border: 3.5px solid transparent; border-left: 5px solid var(--border-light); border-right: 0; }
.pg-sub { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.pg-runs .col-when { width: 96px; } .pg-runs .col-inc { width: 28%; } .pg-runs .col-st { width: 120px; }
.pg-foot { margin: 12px 0 0; font-size: 12px; }

/* Tabs */
.pg-tabs { display: flex; gap: 2px; margin: -4px 0 16px; border-bottom: 1px solid var(--border-color); overflow-x: auto; }
.pg-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.pg-tab:hover { color: var(--text-secondary); }
.pg-tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accelerynt-red); }
.pg-tab-count { min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; line-height: 18px; text-align: center; background: var(--overlay-hover); color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.pg-panel[hidden] { display: none; }

/* ── Incident page ─────────────────────────────────────────────── */
.ip-back { margin: 0 0 12px; font-size: 13px; }
.ip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; border-radius: 0 12px 12px 0; }
.ip-head-main { flex: 1 1 520px; min-width: 0; }
.ip-title { margin: 12px 0 0; font-size: 22px; line-height: 1.3; overflow-wrap: anywhere; }
.ip-ask { margin: 10px 0 0; color: var(--text-secondary); max-width: 80ch; }
.ip-ask-label { font-weight: 700; color: var(--text-primary); margin-right: 4px; }
/* Path strip: steps share the width (8 steps fit at 1920 px); narrower than min-width they scroll sideways, with a visible
   scrollbar and edge shadows that only show while more content sits beyond that edge (background-attachment local/scroll). */
.ip-strip { list-style: none; margin: 0; padding: 4px 2px 12px; display: flex; align-items: center; gap: 28px; overflow-x: auto;
  scrollbar-width: thin; scrollbar-color: var(--text-muted) transparent;
  background: linear-gradient(to right, var(--bg-surface), var(--bg-surface)) left / 24px 100% no-repeat local,
              linear-gradient(to left, var(--bg-surface), var(--bg-surface)) right / 24px 100% no-repeat local,
              radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.18), transparent) left / 12px 100% no-repeat scroll,
              radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), transparent) right / 12px 100% no-repeat scroll; }
.ip-strip::-webkit-scrollbar { height: 8px; }
.ip-strip::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }
.ip-strip:focus-visible { outline: 2px solid var(--accelerynt-celestial); outline-offset: 2px; }
.ip-step { position: relative; flex: 1 1 0; min-width: 132px; max-width: 240px; display: flex; flex-direction: column; gap: 6px; }
.ip-step.is-branch { min-width: 166px; }
.ip-step + .ip-step::before { content: ''; position: absolute; left: -24px; top: 50%; width: 20px; height: 2px; background: var(--edge-flow); }
.ip-step + .ip-step::after { content: ''; position: absolute; left: -9px; top: calc(50% - 4px); border: 5px solid transparent; border-left: 6px solid var(--edge-flow); border-right: 0; }
.ip-step.is-esc::before { background: var(--accelerynt-red); } .ip-step.is-esc::after { border-left-color: var(--accelerynt-red); }
.ip-step-label { position: absolute; top: -2px; left: 0; transform: translateY(-100%); font-size: 10.5px; font-weight: 600; color: var(--text-muted); }
.ip-strip:has(.ip-step-label) { padding-top: 22px; }
.ip-branch { display: flex; flex-direction: column; gap: 8px; }
.ip-step.is-branch .ip-branch { padding-left: 10px; border-left: 2px solid color-mix(in srgb, var(--accelerynt-celestial) 60%, transparent); }
.ip-card { --k: var(--k-router); display: flex; align-items: flex-start; gap: 10px; width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 12px; background: var(--bg-surface-elevated);
  border: 1px solid var(--border-light); box-shadow: inset 0 2px 0 -1px color-mix(in srgb, var(--pill, var(--k)) 70%, transparent); }
.ip-step.k-incident .ip-card { --k: var(--k-inbound); } .ip-step.k-evidence .ip-card { --k: var(--k-evidence); } .ip-step.k-merge .ip-card { --k: var(--k-merge); }
.ip-step.k-guardrail .ip-card { --k: var(--k-guardrail); } .ip-step.k-write .ip-card { --k: var(--accelerynt-celestial); } .ip-step.k-human .ip-card { --k: var(--text-secondary); }
.ip-card.k-local { --k: var(--k-local); } .ip-card.k-cloud { --k: var(--k-cloud); }
.ip-step.is-current .ip-card, .ip-card.info { border-color: color-mix(in srgb, var(--accelerynt-celestial) 70%, transparent); box-shadow: 0 0 22px -8px rgba(39,154,241,.6); }
.ip-card-text { min-width: 0; }
.ip-card-title { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.ip-card-sub { margin: 2px 0 0; font-size: 11.5px; color: var(--text-secondary); overflow-wrap: anywhere; }
.ip-card-sub.mono { font-size: 11px; color: var(--text-muted); }
.ip-timeline li { grid-template-columns: 120px 1fr; }
.ip-timeline .tl-comment .comment-text { margin-top: 4px; padding: 8px 10px; border-radius: var(--radius); background: var(--bg-surface-elevated); }
.ip-kv { margin-bottom: 8px; }
.ip-sub { margin-top: 20px; }
.ip-list { margin: 0; padding-left: 18px; } .ip-list li { margin-bottom: 6px; overflow-wrap: anywhere; }
.ip-note { font-size: 12px; margin: 10px 0 0; }
.ip-disp { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .ip-disp { grid-template-columns: 1fr; } }

/* ── Hardware boxes ────────────────────────────────────────────── */
.hw-boxes { margin-bottom: 24px; }
.hw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.hw-grid .section-card, .hw-detail .section-card { margin-bottom: 0; }
.hw-box { position: relative; }
.hw-box.st-offline { border-style: dashed; }
.hw-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.k-local-tile { --k: var(--k-local); width: 36px; height: 36px; }
.hw-titles { flex: 1; min-width: 0; }
.hw-title { margin: 0; font-size: 16px; font-weight: 700; }
.hw-title a { color: var(--text-primary); }
.hw-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.hw-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.hw-gpu { margin-top: 6px; }
.hw-models { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--border-color); }
.hw-models li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.hw-model-name { font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.hw-model-facts { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hw-endpoints { margin-top: 10px; display: grid; gap: 4px; font-size: 12.5px; }
.hw-ep { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hw-foot { margin: 10px 0 0; font-size: 12px; }
.hw-detail { margin-bottom: 24px; align-items: start; }
.hw-spark { display: block; width: 100%; height: 96px; margin: 8px 0; }
.hw-spark .line { fill: none; stroke: var(--accelerynt-celestial); stroke-width: 2; vector-effect: non-scaling-stroke; }
.hw-spark .area { fill: color-mix(in srgb, var(--accelerynt-celestial) 14%, transparent); }
.hw-spark .dot { fill: var(--accelerynt-celestial); }

/* ── Scorecard (Agent page) ────────────────────────────────────── */
.sc-models { display: grid; gap: 16px; }
.sc-model { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 14px 16px; background: var(--overlay-subtle); }
.sc-model-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sc-model-name { margin: 0; font-size: 15px; font-weight: 700; }
.sc-model-head .mono { margin: 2px 0 0; }
.sc-rate { text-align: right; }
.sc-rate b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sc-rate span { font-size: 11px; color: var(--text-muted); }
.sc-balance { margin: 8px 0 10px; font-size: 13px; color: var(--text-secondary); }

@media (prefers-reduced-motion: reduce) {
  .pg-edge.s-active { animation: none; stroke-dasharray: none; }
  .pg-pulse { animation: none; }
  .pg-node, .pg-edge { transition: none; }
}
.pg-eyerow { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.pg-eyerow .pg-eyebrow { flex: 1; min-width: 0; }
.content:has(.ip-strip) { max-width: 1680px; }
.ip-strip { gap: 20px; }
.ip-step + .ip-step::before { left: -18px; width: 14px; }
.ip-step + .ip-step::after { left: -7px; }
.ip-card .pg-icon { flex-shrink: 0; }
/* Settings: email sign-in invitations (admins, magic links enabled) */
.magic-invite { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 12px 0 4px; }
.magic-invite label.field { flex: 1 1 260px; margin: 0; }
.magic-invite label.field:nth-of-type(2) { flex: 0 1 200px; }
.magic-invite label.field span { display: block; margin-bottom: 4px; }
.magic-admin .table-wrap { margin-top: 12px; }

/* ── Help: contextual "?" link (macro help_link in _macros.html; the Help area itself is styled in help.css) ── */
.help-q { width: 28px; height: 28px; min-height: 28px; padding: 0; justify-content: center; border-radius: 9999px; font-weight: 700; line-height: 1; }
.ip-head-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
