/* ==========================================================================
   Argus design system
   Calm, clean, modern: neutral surfaces, one accent, generous spacing.
   Light + dark themes driven entirely by CSS custom properties.
   ========================================================================== */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --nav-width: 76px;
  --topbar-height: 60px;
  --panel-width: 380px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --speed: 160ms;

  /* severity (shared) */
  --sev-critical: #e5484d;
  --sev-high: #f76b15;
  --sev-medium: #d4a106;
  --sev-low: #8b8d98;
  --ok: #30a46c;
  /* fills that carry white text (white on each is at least 4.8:1) */
  --sev-critical-solid: #c62a2f;
  --amber-solid: #9a6700;
  --ok-solid: #1a7f4f;
}

/* ---------------------------------------------------------------- light */
:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ebf0;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #16181d;
  --text-2: #4b5260;
  --text-3: #5f6675; /* muted text: 4.8:1 on every light surface (was 3.85:1) */
  --sev-critical-text: #c2292e;
  --sev-high-text: #ba3e0c;
  --sev-medium-text: #926200;
  --sev-low-text: #5f6675;
  --ok-text: #1e784d;
  --accent: #4f5bd5;
  --accent-hover: #3f4bc4;
  --accent-soft: rgba(79, 91, 213, 0.1);
  --accent-text: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.16);
  --overlay: rgba(15, 18, 25, 0.45);
  --graph-bg: #fbfbfd;
  --graph-grid: rgba(16, 24, 40, 0.045);
  --edge: #c3c8d2;
  --label: #3d4350;
  --label-bg: rgba(255, 255, 255, 0.85);
}

/* ---------------------------------------------------------------- dark */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1015;
  --surface: #15181f;
  --surface-2: #1b1f27;
  --surface-3: #232833;
  --border: #262b36;
  --border-strong: #343a47;
  --text: #eceef2;
  --text-2: #b0b6c3;
  --text-3: #9097a6; /* 4.8:1 on every dark surface (was 3.8:1) */
  --sev-critical-text: #ff8f8c;
  --sev-high-text: #ff9c66;
  --sev-medium-text: #f2c037;
  --sev-low-text: #b5b9c2;
  --ok-text: #4cd391;
  --accent: #7c86ff;
  --accent-hover: #929bff;
  --accent-soft: rgba(124, 134, 255, 0.14);
  --accent-text: #0e1015;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --overlay: rgba(4, 6, 10, 0.6);
  --graph-bg: #111319;
  --graph-grid: rgba(255, 255, 255, 0.035);
  --edge: #3a4150;
  --label: #c9cdd6;
  --label-bg: rgba(17, 19, 25, 0.85);
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
[hidden] { display: none !important; }

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

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

/* ---------------------------------------------------------------- shell */
.app {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  grid-template-areas: "nav top" "nav main";
  height: 100vh;
}

.nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  margin-bottom: 14px;
}
.brand svg { width: 22px; height: 22px; }

.nav-item {
  position: relative;
  width: 60px;
  padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; border-radius: var(--radius);
  background: transparent;
  color: var(--text-3);
  font: inherit; font-size: 10.5px; font-weight: 550;
  cursor: pointer;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-spacer { flex: 1; }
.nav-dot {
  position: absolute; top: 6px; right: 12px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  background: var(--sev-critical-solid); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 700;
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.context { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.context-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context-meta { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.scan-progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  overflow: hidden; pointer-events: none;
}
.scan-progress::after {
  content: ""; position: absolute; inset: 0; width: 35%;
  background: var(--accent);
  animation: indeterminate 1.4s var(--ease) infinite;
}
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.main { grid-area: main; position: relative; overflow: hidden; min-width: 0; }

.view {
  position: absolute; inset: 0;
  overflow-y: auto;
  visibility: hidden;
}
.view.active { visibility: visible; animation: view-in 220ms var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-head > div:first-child { min-width: 0; }
/* Pages with many actions (a case): the title keeps the full width, the actions wrap below it. */
.page-head.stacked { flex-direction: column; align-items: stretch; }
.page-head.stacked .page-actions { flex-wrap: wrap; justify-content: flex-start; }
.page-actions { display: flex; gap: 8px; flex-wrap: nowrap; flex: none; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-weight: 550; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease),
    color var(--speed) var(--ease), transform 80ms var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--sev-critical-text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 72px; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.hint { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--sev-critical-text); min-height: 18px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--surface-2); }
.segmented button {
  border: 0; background: transparent; color: var(--text-2);
  font: inherit; font-size: 12.5px; font-weight: 550;
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }

.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }

.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 12.5px; color: var(--text-3); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-sub { font-size: 12.5px; color: var(--text-2); }
.kpi-row { display: flex; align-items: center; gap: 16px; }

.gauge { width: 64px; height: 64px; flex: none; }
.gauge circle { fill: none; stroke-width: 7; }
.gauge .track { stroke: var(--surface-3); }
.gauge .value { stroke-linecap: round; transition: stroke-dashoffset 700ms var(--ease); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: 11px;
  font-size: 11.5px; font-weight: 650; text-transform: capitalize;
  background: var(--surface-2); color: var(--text-2);
  white-space: nowrap;
}
.pill.critical { background: color-mix(in srgb, var(--sev-critical) 14%, transparent); color: var(--sev-critical-text); }
.pill.high { background: color-mix(in srgb, var(--sev-high) 14%, transparent); color: var(--sev-high-text); }
.pill.medium { background: color-mix(in srgb, var(--sev-medium) 16%, transparent); color: var(--sev-medium-text); }
.pill.low { background: color-mix(in srgb, var(--sev-low) 16%, transparent); color: var(--sev-low-text); }
.pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok-text); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.status .dot { background: var(--text-3); }
.status.running .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.status.completed .dot { background: var(--ok); }
.status.failed .dot { background: var(--sev-critical); }
.status.cancelled .dot { background: var(--sev-medium); }
@keyframes pulse { 50% { opacity: 0.35; } }

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 600ms var(--ease); }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: 0; }
.list-row.clickable { cursor: pointer; border-radius: var(--radius-sm); }
.list-row.clickable:hover { background: var(--surface-2); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12.5px; color: var(--text-3); }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 40px 20px; color: var(--text-3);
}
.empty svg { width: 36px; height: 36px; opacity: 0.6; }
.empty h3 { color: var(--text); font-size: 15px; }

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* table */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--speed) var(--ease); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }

/* tooltips: data-tip="..." */
[data-tip] { position: relative; }
.tip-icon {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-3);
  font-size: 10.5px; font-weight: 700; cursor: help;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; z-index: 60;
  left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 280px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--text); color: var(--surface);
  font-size: 12px; font-weight: 450; line-height: 1.45; text-transform: none; letter-spacing: 0;
  white-space: normal; text-align: left;
  box-shadow: var(--shadow); pointer-events: none;
}

/* ---------------------------------------------------------------- attack paths */
.path-card { padding: 18px 20px; transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease); }
.path-card + .path-card { margin-top: 12px; }
.path-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.path-top { display: flex; align-items: center; gap: 10px; }
.path-title { font-size: 15px; font-weight: 650; flex: 1; min-width: 0; }
.score-badge {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  font-weight: 750; font-size: 16px;
  background: var(--surface-2);
}
.score-badge.critical { background: color-mix(in srgb, var(--sev-critical) 14%, transparent); color: var(--sev-critical-text); }
.score-badge.high { background: color-mix(in srgb, var(--sev-high) 14%, transparent); color: var(--sev-high-text); }
.score-badge.medium { background: color-mix(in srgb, var(--sev-medium) 16%, transparent); color: var(--sev-medium-text); }
.score-badge.low { background: color-mix(in srgb, var(--sev-low) 16%, transparent); color: var(--sev-low-text); }
.path-narrative { color: var(--text-2); margin: 12px 0 14px; line-height: 1.6; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chain-node {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 260px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12.5px;
}
.ico {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; color: #fff;
}
.ico svg { width: 15px; height: 15px; }
.chain-node .ico { width: 20px; height: 20px; }
.chain-node .ico svg { width: 12px; height: 12px; }
.chain-node span.txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chain-arrow { color: var(--text-3); }
.ttp-route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.ttp {
  display: inline-flex; flex-direction: column;
  padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 12px; color: var(--text); text-decoration: none;
}
.ttp:hover { border-color: var(--accent); text-decoration: none; }
.ttp small { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.path-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
details.more summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 550; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "›"; display: inline-block; margin-right: 6px; transition: transform var(--speed) var(--ease); }
details.more[open] summary::before { transform: rotate(90deg); }
details.more .more-body { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; font-size: 13px; color: var(--text-2); }
details.more ul, details.more ol { margin: 6px 0 0; padding-left: 18px; line-height: 1.6; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- workspaces */
.workspace-switch { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; color: var(--text-3); }
.workspace-switch svg { width: 16px; height: 16px; }
.workspace-switch .select { font-weight: 600; color: var(--text); max-width: 200px; }

/* ---------------------------------------------------------------- sign-in */
.sso-btn { width: 100%; justify-content: center; text-decoration: none; margin-top: 4px; }
.sso-btn:hover { text-decoration: none; }
.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 6px; color: var(--text-3); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.select.sm { height: 30px; padding: 0 8px; font-size: 12.5px; width: auto; }

/* ---------------------------------------------------------------- people */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.persona-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.persona-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.persona-card:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.persona-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.persona-name { min-width: 0; flex: 1; }
.persona-bio { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.persona-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.persona-meta span { display: inline-flex; align-items: center; gap: 5px; }
.persona-meta svg { width: 14px; height: 14px; color: var(--text-3); }
.persona-meta:empty { display: none; }
.persona-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; letter-spacing: 0.02em;
  color: var(--accent); background: var(--accent-soft);
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.dossier .grid { grid-template-columns: minmax(0, 1fr); }
.dossier .grid.two { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.dossier-head { display: flex; align-items: center; gap: 18px; }
.dossier-head h1 { font-size: 22px; letter-spacing: -0.01em; }
.account-bio { white-space: normal; margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 14px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -23px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline time { font-size: 12px; color: var(--text-3); }
.intel-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.intel-badges .pill, .persona-foot .pill { text-transform: none; }

/* ---------------------------------------------------------------- graph workspace */
.workspace { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr var(--panel-width); transition: grid-template-columns 220ms var(--ease); }
.workspace.panel-collapsed { grid-template-columns: 1fr 0; }
.canvas-wrap { position: relative; min-width: 0; background: var(--graph-bg); }
.canvas-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--graph-grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
#cy { position: absolute; inset: 0; }

.toolbar {
  position: absolute; top: 16px; left: 16px; right: 16px; z-index: 5;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: none;
}
.toolbar > * { pointer-events: auto; }
.floating {
  display: flex; align-items: center; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.floating .input, .floating .select { height: 30px; border: 0; box-shadow: none; background: transparent; font-size: 13px; }
.floating .input { width: 200px; }
.floating #graph-search { width: 320px; transition: width .2s ease; font-family: inherit; }
.floating #graph-search:focus { width: 440px; }

/* Query pane (Argus Query Language results) */
.query-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.query-error { border: 1px solid color-mix(in srgb, var(--sev-critical) 40%, transparent); background: color-mix(in srgb, var(--sev-critical) 8%, transparent); border-radius: 8px; padding: 10px; font-size: 13px; }
.query-error pre { margin: 6px 0 0; font-size: 12px; white-space: pre; overflow-x: auto; }
.query-example { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--border); padding: 8px 0; cursor: pointer; color: inherit; font: inherit; }
.query-example:first-of-type { border-top: 0; }
.query-example code { display: block; font-size: 12px; color: var(--accent); white-space: pre-wrap; word-break: break-word; }
.query-example span { font-size: 12px; color: var(--text-3); }
.query-path { font-size: 12.5px; line-height: 1.6; }
.query-path b { color: var(--text-3); font-weight: 500; }
.group-bar { height: 6px; border-radius: 3px; background: var(--accent); opacity: .65; }
.query-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.save-query { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
.save-query label { display: flex; gap: 6px; align-items: center; }
.saved-query { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.saved-query code { display: block; color: var(--text-3); word-break: break-word; margin-top: 2px; }
.saved-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 50%; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-pill { display: inline-flex; align-items: center; gap: 4px; text-transform: none; }
.tag-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 2px; font-size: 11px; opacity: .7; }
.tag-x:hover { opacity: 1; }
.tag-input { width: 150px; height: 26px; font-size: 12px; }
.note-input { width: 100%; margin-top: 8px; font: inherit; font-size: 13px; resize: vertical; }
.community-swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.floating .select { width: auto; padding-right: 8px; }
.toolbar .grow { flex: 1; }

.legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 32px);
}
.legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 12px; font-weight: 550; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: opacity var(--speed) var(--ease);
}
.legend-chip.off { opacity: 0.4; }
.legend-chip b { font-weight: 650; color: var(--text); }

.graph-empty {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center; pointer-events: none;
}
.graph-empty > div { pointer-events: auto; }

.panel {
  min-width: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
}
.panel-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--border); }
.panel-tab {
  border: 0; background: transparent; color: var(--text-3);
  font: inherit; font-weight: 600; font-size: 13px;
  padding: 8px 10px 10px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.panel-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; }
.panel-pane[hidden] { display: none; }

.entity-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.entity-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.entity-icon svg { width: 22px; height: 22px; }
.entity-value { font-weight: 650; word-break: break-all; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; word-break: break-word; }
.section { margin-top: 22px; }
.section-title { font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }

.feed { display: flex; flex-direction: column; gap: 2px; }
.feed-item { display: grid; grid-template-columns: 58px 1fr; gap: 8px; font-size: 12.5px; padding: 6px 0; animation: fade-in 220ms var(--ease); }
.feed-item time { color: var(--text-3); font-family: var(--font-mono); font-size: 11.5px; }
.feed-item.warn span { color: var(--sev-high-text); }
.feed-item.error span { color: var(--sev-critical-text); }
@keyframes fade-in { from { opacity: 0; transform: translateY(-3px); } }

.flag { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--border); }
.flag:first-child { border-top: 0; }
.flag .dot { margin-top: 6px; background: var(--sev-high); }

/* ---------------------------------------------------------------- modals */
.modal-root {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity 180ms var(--ease), visibility 0s linear 180ms;
}
.modal-root.open { opacity: 1; visibility: visible; transition: opacity 180ms var(--ease); }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(0.98);
  transition: transform 220ms var(--ease);
}
.modal-root.open .modal { transform: none; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.modal-head p { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }

.type-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.depth-row { display: flex; align-items: center; gap: 12px; }
.depth-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.callout {
  display: flex; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius); background: var(--surface-2);
  font-size: 12.5px; color: var(--text-2); line-height: 1.55;
}
.callout.warn { background: color-mix(in srgb, var(--sev-high) 12%, var(--surface)); color: var(--text); border-left: 3px solid var(--sev-high); }
.callout.accent { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--text); border-left: 3px solid var(--accent); }
.modal.wide { max-width: 860px; width: calc(100vw - 32px); }
.inspect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.inspect-grid .kv { grid-template-columns: 110px 1fr; font-size: 12.5px; }
.inspect-section { margin-top: 16px; }
.inspect-section h3 { font-size: 13px; margin: 0 0 8px; }
.ela-view { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); background: #000; }
.sun-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: end; }
.callout.safe { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); color: var(--text); border-left: 3px solid var(--ok); }

.key-reveal {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface-2); font-family: var(--font-mono); font-size: 12.5px; word-break: break-all;
}

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 380px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 13px;
  animation: toast-in 240ms var(--ease);
}
.toast .dot { margin-top: 6px; background: var(--accent); }
.toast.success .dot { background: var(--ok); }
.toast.error .dot { background: var(--sev-critical); }
.toast.leaving { opacity: 0; transform: translateX(12px); transition: all 200ms var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- sign-in */
.readonly-banner { position: fixed; left: 50%; top: calc(var(--topbar-height) + 8px); transform: translateX(-50%); z-index: 60; max-width: min(720px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--sev-high) 14%, var(--surface)); border: 1px solid var(--sev-high); color: var(--text); font-size: 13px; box-shadow: var(--shadow); }
.signin-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.signin { width: 100%; max-width: 400px; padding: 32px; }
.signin .brand { margin: 0 0 18px; }
.signin h1 { margin-bottom: 6px; }
.signin p { color: var(--text-2); margin-bottom: 22px; font-size: 13.5px; }

/* ---------------------------------------------------------------- welcome / tour */
.hero { padding: 40px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: 28px; line-height: 1.2; margin-bottom: 10px; }
.hero p { color: var(--text-2); font-size: 15px; line-height: 1.6; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px;
}
.step h3 { margin-bottom: 2px; }
.step p { font-size: 13px; color: var(--text-2); margin: 0; }
.tour-progress { display: flex; gap: 6px; }
.tour-progress span { width: 22px; height: 4px; border-radius: 2px; background: var(--surface-3); transition: background var(--speed) var(--ease); }
.tour-progress span.on { background: var(--accent); }
.tour-illustration {
  height: 120px; border-radius: var(--radius); margin-bottom: 18px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), transparent), var(--surface-2);
  color: var(--accent);
}
.tour-illustration svg { width: 48px; height: 48px; }

.kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
  font-family: var(--font-mono); font-size: 11.5px; text-align: center; color: var(--text-2);
  background: var(--surface-2);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .dossier .grid.two { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: 1fr; padding: 28px; }
  :root { --panel-width: 340px; }
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--topbar-height) 1fr 64px;
    grid-template-areas: "top" "main" "nav";
  }
  /* Eleven destinations do not fit a phone's width: the bar scrolls sideways, the page does not. */
  .nav { flex-direction: row; justify-content: flex-start; padding: 6px; border-right: 0; border-top: 1px solid var(--border);
         overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; min-width: 0; }
  .nav::-webkit-scrollbar { display: none; }
  .brand, .nav-spacer { display: none; }
  .nav-item { width: auto; flex: 1; }
  .page { padding: 20px 16px 32px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-actions { flex-wrap: wrap; }
  .context-title { max-width: 46vw; }
  .grid.kpis { grid-template-columns: 1fr 1fr; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr 45%; }
  .workspace.panel-collapsed { grid-template-rows: 1fr 0; grid-template-columns: 1fr; }
  .panel { border-left: 0; border-top: 1px solid var(--border); }
  .context-meta, .hide-sm { display: none; }
  details.more .more-body { grid-template-columns: 1fr; }
  .floating .input, .floating #graph-search, .floating #graph-search:focus { width: 130px; }
  .nav-item { font-size: 10px; padding-left: 0; padding-right: 0; flex: 0 0 auto; min-width: 58px; }
  .persona-grid { grid-template-columns: 1fr; }
  .dossier-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
.list-row > svg { color: var(--text-3); flex: none; }

/* ------------------------------------------------------------------ notifications */
.channel-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.channel-type {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.channel-type small { color: var(--text-3); font-size: 11.5px; }
.channel-type:hover { border-color: var(--border-strong, var(--accent)); }
.channel-type[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.channel-type:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.channel-type:disabled { opacity: .45; cursor: not-allowed; }
.pill.warn { background: color-mix(in srgb, var(--sev-high) 14%, transparent); color: var(--sev-high-text); }
.delivery-error { color: var(--text-3); font-size: 12px; max-width: 360px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ reports */
.brand-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 20px; align-items: end; }
.brand-form .field + .field { margin-top: 0; }
.brand-form > :last-child { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-form > .field:nth-last-child(2) { grid-column: 1 / -1; }
.brand-logo { display: flex; gap: 10px; align-items: center; }
#brand-logo-preview { min-width: 120px; height: 44px; display: flex; align-items: center; padding: 4px 8px; border: 1px dashed var(--border); border-radius: var(--radius); background: #fff; }
#brand-logo-preview img { max-height: 36px; max-width: 160px; }
.verify { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-top: 10px; font-size: 13px; }
.verify svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.verify.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--text); }
.verify.ok svg { color: var(--ok); }
.verify.bad { background: color-mix(in srgb, var(--sev-critical) 12%, transparent); color: var(--text); }
.verify.bad svg { color: var(--sev-critical); }

/* ------------------------------------------------------------------ scheduled reports */
.schedule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.schedule-grid .field + .field { margin-top: 0; }
.schedule-grid .span-2 { grid-column: 1 / -1; }
.schedule-when { display: flex; gap: 8px; flex-wrap: wrap; }
.schedule-when .select, .schedule-when .input { width: auto; flex: 1 1 120px; }
.schedule-channels { display: flex; flex-wrap: wrap; gap: 8px 16px; }
@media (max-width: 760px) { .schedule-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ guided first scan */
.guide .modal-body { min-height: 340px; }
.guide-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 10px 0 0; flex-wrap: wrap; }
.guide-steps li { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.guide-steps li + li::before { content: ""; width: 18px; height: 1px; background: var(--border); }
.guide-steps li .dot { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 650; background: var(--surface-2); color: var(--text-3); }
.guide-steps li.on { color: var(--text); font-weight: 600; }
.guide-steps li.on .dot { background: var(--accent); color: #fff; }
.guide-steps li.done .dot { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok-text); }
.guide-ok { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.guide-ok > div { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 13px; line-height: 1.5; }
.guide-ok h4 { margin: 0 0 6px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.guide-ok .yes h4 svg { color: var(--ok); }
.guide-ok .no h4 svg { color: var(--sev-critical); }
.guide-ok ul { margin: 0; padding-left: 18px; color: var(--text-2); }
.guide-warning { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 10px; font-size: 13px; line-height: 1.5; border: 1px solid var(--border); }
.guide-warning svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.guide-warning.danger { background: color-mix(in srgb, var(--sev-critical) 9%, transparent); border-color: color-mix(in srgb, var(--sev-critical) 35%, transparent); }
.guide-warning.danger svg { color: var(--sev-critical); }
.guide-warning.warning { background: color-mix(in srgb, var(--sev-high) 9%, transparent); border-color: color-mix(in srgb, var(--sev-high) 35%, transparent); }
.guide-warning.warning svg { color: var(--sev-high); }
.guide-warning.info svg { color: var(--accent); }
.guide-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.guide-mode { text-align: left; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; line-height: 1.5; }
.guide-mode[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.guide-mode b { display: block; margin-bottom: 4px; }
.guide-mode small { color: var(--text-2); font-size: 12.5px; }
.guide-live { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.guide-live > div { padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
.guide-live b { font-size: 22px; display: block; }
.guide-sources { max-height: 190px; overflow: auto; font-size: 12.5px; }
.guide-sources li { padding: 4px 0; color: var(--text-2); list-style: none; display: flex; gap: 8px; }
.guide-sources li b { color: var(--text); min-width: 140px; font-weight: 600; }
.guide-tip { font-size: 13px; color: var(--text-2); padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; }
.checklist { display: grid; gap: 2px; margin-top: 8px; }
.checklist-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.checklist-row:last-child { border-bottom: 0; }
.checklist-row .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.checklist-row.done .tick { background: var(--ok-solid); border-color: var(--ok-solid); color: #fff; }
.checklist-row.done .tick svg { width: 13px; height: 13px; }
.checklist-row .what { flex: 1; min-width: 0; }
.checklist-row .what b { font-weight: 600; }
.checklist-row.done .what b { color: var(--text-3); text-decoration: line-through; }
.checklist-row .what div { font-size: 12.5px; color: var(--text-3); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
@media (max-width: 760px) { .guide-ok, .guide-modes, .guide-live { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ security ratings */
.grade { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 750; font-size: 15px; color: #fff; background: var(--text-3); flex: none; }
.grade.sm { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
.grade.xl { width: 84px; height: 84px; font-size: 46px; border-radius: 18px; }
.grade-A { background: #2f9e44; } .grade-B { background: #5c940d; } .grade-C { background: #c99a06; }
.grade-D { background: #e8590c; } .grade-F { background: #c0262d; } .grade-none { background: var(--surface-2); color: var(--text-3); }
.grade-fill-A { background: #2f9e44; } .grade-fill-B { background: #5c940d; } .grade-fill-C { background: #c99a06; }
.grade-fill-D { background: #e8590c; } .grade-fill-F { background: #c0262d; }
.rating-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.rating-summary { flex: 1; min-width: 240px; }
.rating-summary h2 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.rating-summary p { margin: 2px 0; }
.rating-trend { text-align: right; }
.rating-body { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; margin-top: 18px; }
.factor-list { display: grid; gap: 8px; }
.factor-row { display: grid; grid-template-columns: 210px minmax(0, 1fr) 24px; gap: 10px; align-items: center; font-size: 13px; }
.factor-row .bar-track { height: 8px; }
.rating-plan h3 { font-size: 14px; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.rating-plan ol { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; }
.kpi-grade { display: flex; gap: 14px; align-items: center; }
/* five grades in a row where they fit, wrapping on narrow screens instead of crushing the numbers */
.grid.kpis:has(.kpi-grade) { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
.sparkline { display: block; }
@media (max-width: 900px) { .rating-body { grid-template-columns: 1fr; } .factor-row { grid-template-columns: 150px minmax(0, 1fr) 24px; } }

/* ------------------------------------------------------------------ supplier risk matrix */
.risk-matrix { display: grid; grid-template-columns: 90px repeat(5, minmax(0, 1fr)); gap: 4px; font-size: 12px; }
.rm-corner { font-size: 11px; color: var(--text-3); align-self: end; }
.rm-head { text-align: center; padding-bottom: 2px; }
.rm-row { display: flex; align-items: center; color: var(--text-2); }
.rm-cell { height: 38px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; opacity: .35; color: #fff; }
.rm-cell.has { opacity: 1; box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); font-size: 15px; }
.rm-low { background: #2f9e44; } .rm-medium { background: #c99a06; } .rm-high { background: #e8590c; } .rm-critical { background: #c0262d; }

/* Copyable code snippets (Settings → API & integrations) */
.snippet { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.snippet pre { margin: 0; padding: 12px 14px; padding-right: 80px; font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet .btn { position: absolute; top: 6px; right: 6px; }
.card-head.wrap { flex-wrap: wrap; gap: 12px; }
.card-head.wrap > div:first-child { flex: 1 1 280px; }
.table-scroll { overflow-x: auto; }

/* Remediation */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 12px 10px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent, #4f46e5); }
@media (max-width: 1100px) { #rem-layout { grid-template-columns: minmax(0, 1fr) !important; } }

/* Executive overview */
.rag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; }
.rag-red { background: var(--sev-critical-solid); }
.rag-amber { background: var(--amber-solid); }
.rag-green { background: var(--ok-solid); }
.rag-grey { background: var(--surface-3); color: var(--text-3); }
.overall { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 18px 22px; border-radius: var(--radius); color: #fff; }
.overall p { margin: 0; font-size: 15px; flex: 1 1 260px; }
.overall .muted { color: rgba(255, 255, 255, .94); }
.overall-label { font-size: 26px; font-weight: 800; line-height: 1.1; }
.overall-red { background: var(--sev-critical-solid); }
.overall-amber { background: var(--amber-solid); }
.overall-green { background: var(--ok-solid); }
.overall-grey { background: var(--surface-3); color: var(--text); }
.overall-grey .muted { color: var(--text-3); }
.area-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.area-card { display: block; color: inherit; text-decoration: none; border-left: 4px solid var(--surface-3); }
.area-card:hover { background: var(--surface-2); }
.area-red { border-left-color: var(--sev-critical); }
.area-amber { border-left-color: var(--sev-medium); }
.area-green { border-left-color: var(--ok); }
.messages { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; }
@media (max-width: 1100px) { #exec-layout { grid-template-columns: minmax(0, 1fr) !important; } }

/* Compliance */
.fw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fw-card { text-align: left; cursor: pointer; font: inherit; color: inherit; border: 1px solid var(--border); }
.fw-card.active { outline: 2px solid var(--accent, #4f46e5); outline-offset: -2px; }
.cbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: 10px; background: var(--surface-3); }
.cbar-met { background: var(--ok); }
.cbar-partial { background: var(--sev-medium); }
.cbar-gap { background: var(--sev-critical); }
.cbar-not_assessed { background: var(--surface-3); }
.control { border-top: 1px solid var(--border); }
.control > summary { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 4px; cursor: pointer; list-style: none; }
.control > summary::-webkit-details-marker { display: none; }
.control-title { display: flex; flex-direction: column; gap: 2px; }
.control-body { padding: 0 4px 14px 92px; }
@media (max-width: 760px) {
  .control > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .control-ref, .control > summary > .pill:not(.ok):not(.warn):not(.critical) { display: none; }
  .control-body { padding-left: 4px; }
}

/* Cases & evidence */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.case-card { text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--border); }
.case-card:hover { background: var(--surface-2); }
.evidence-card { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 14px; margin-top: 10px; }
.evidence-thumb { width: 160px; height: 120px; object-fit: cover; object-position: top; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.evidence-thumb.none { display: grid; place-items: center; color: var(--text-3); }
.entity-card, .note { border-top: 1px solid var(--border); padding: 10px 0; }
.entity-card:first-of-type, .note:first-of-type { border-top: 0; }
@media (max-width: 1100px) { #case-layout { grid-template-columns: minmax(0, 1fr) !important; } }
@media (max-width: 560px) { .evidence-card { grid-template-columns: minmax(0, 1fr); } .evidence-thumb { width: 100%; height: 160px; } }

/* ---------------------------------------------------------------- case timeline and map */
.tl-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; height: 76px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.tl-bar { flex: 1 1 0; min-width: 2px; max-width: 48px; border: 0; padding: 0; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .55; cursor: pointer; }
.tl-bar:hover, .tl-bar.on { opacity: 1; }
.tl-gap { flex: 1 1 0; min-width: 2px; max-width: 48px; height: 2px; background: var(--border); }
.tl-day { margin-top: 14px; }
.tl-entry { display: grid; grid-template-columns: 52px auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); }
@media (max-width: 640px) { .tl-entry { grid-template-columns: 44px minmax(0, 1fr); } .tl-entry .pill { grid-column: 2; justify-self: start; } .tl-entry > div { grid-column: 1 / -1; } }
.map { position: relative; height: min(520px, 62vh); overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border);
  background-color: var(--surface-2); background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px; cursor: grab; touch-action: none; user-select: none; }
.map:active { cursor: grabbing; }
.map:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.map-tiles, .map-marks { position: absolute; inset: 0; }
.map-tile { position: absolute; left: 0; top: 0; width: 256px; height: 256px; pointer-events: none; }
:root[data-theme="dark"] .map-tile { filter: brightness(.8) contrast(1.1); }
.map-mark { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid #fff;
  background: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: pointer; }
.map-mark.photo { background: var(--sev-high); }
.map-mark.on { transform-origin: center; outline: 3px solid var(--accent); outline-offset: 2px; z-index: 2; }
.map-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.map-dot.photo { background: var(--sev-high); }
.map-zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-zoom .btn { background: var(--surface); }
.map-credit { position: absolute; right: 0; bottom: 0; padding: 2px 6px; font-size: 11px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text-2); }
.map-pop { position: absolute; left: 0; top: 0; width: 220px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 3; pointer-events: none; }

/* Link chart: the network beside its details; stacked on narrow screens */
.chart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; }
@media (max-width: 860px) { .chart-layout { grid-template-columns: 1fr; } #chart-canvas { height: 420px !important; } }

/* Business dashboard */
.biz-chart { width: 100%; height: auto; display: block; }
.biz-chart .chart-axis { font-size: 11px; fill: var(--text-3); }
.biz-chart .bar-hit:hover path, .biz-chart .bar-hit:focus path { fill: var(--accent-hover); }
.biz-chart .bar-hit:focus { outline: none; }
.biz-bar { height: 8px; background: var(--accent-soft); border-radius: 4px; overflow: hidden; }
.biz-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* Plan choice (Argus Personal) */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 10px; }
.plan-card { padding: 16px; display: flex; flex-direction: column; }
.plan-card.current { border-color: var(--accent); }
.plan-price { font-size: 18px; font-weight: 700; margin-top: 4px; }
.plan-list { margin: 0; padding-left: 18px; color: var(--text-2); line-height: 1.6; flex: 1; }

/* Owner console */
.owner-console { background: var(--bg); }
.owner-card { max-width: 440px; }
.owner-badge { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.owner-qr { width: 220px; max-width: 100%; margin: 12px auto; background: #fff; padding: 6px; border-radius: 8px; }
.owner-qr svg { width: 100%; height: auto; display: block; }
.owner-codes { columns: 2; padding-left: 22px; margin: 12px 0; line-height: 1.9; }
.owner-shell { max-width: 1100px; margin: 0 auto; padding: 16px; }
.owner-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0 14px; }
.owner-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.owner-tabs button { background: none; border: 0; padding: 10px 12px; color: var(--text-2); font: inherit; font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.owner-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.owner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.owner-settings { display: grid; gap: 14px; margin-top: 10px; }
.owner-field { display: grid; gap: 4px; max-width: 620px; }
.owner-field-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ navigation: groups, overflow, phones */
/* Sixteen destinations read as three jobs: investigate, watch, act. The rail scrolls on short screens
   instead of pushing Settings off the bottom. */
.nav { overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.nav-item { flex-shrink: 0; }
.nav-group { width: 100%; flex-shrink: 0; margin: 6px 0 2px; padding-top: 8px; border-top: 1px solid var(--border); text-align: center; line-height: 1; }
.nav-group span { font-size: 9px; font-weight: 650; letter-spacing: 0.02em; color: var(--text-3); }
.nav-more { display: none; }
.nav-item:focus-visible, .nav-sheet-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.nav-sheet-group + .nav-sheet-group { margin-top: 14px; }
.nav-sheet-group h3 { font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin: 0 0 8px; }
.nav-sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.nav-sheet-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 6px; min-height: 64px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 550; cursor: pointer;
}
.nav-sheet-item svg { width: 22px; height: 22px; }
.nav-sheet-item:hover { background: var(--surface-2); color: var(--text); }
.nav-sheet-item.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.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; }

@media (max-width: 760px) {
  /* Phones: four everyday tabs and "More" (a sheet with every page), instead of a strip of sixteen
     that scrolls sideways and hides where you are. */
  .nav { overflow: hidden; justify-content: space-around; padding: 4px 6px; }
  .nav-group { display: none; }
  .nav-item:not([data-primary]):not(.nav-more) { display: none; }
  .nav-item, .nav-more { display: flex; flex: 1 1 0; min-width: 0; width: auto; font-size: 10.5px; }
  .nav-item[hidden] { display: none; }
  #nav-sheet { place-items: end stretch; padding: 0; }
  #nav-sheet .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 80vh; }
}
.recent-open-list { display: flex; flex-direction: column; align-items: stretch; gap: 6px; max-width: 360px; margin: 0 auto; }
.recent-open-list .btn { justify-content: flex-start; gap: 8px; }
.recent-open-list .btn .muted { margin-left: auto; font-weight: 400; }
/* A button inside an empty state keeps a button-sized icon (".empty svg" is meant for the illustration). */
.empty .btn svg { width: 16px; height: 16px; opacity: 1; }
/* A denser rail: every destination fits a 900px-tall screen without scrolling. */
.nav { gap: 1px; padding: 12px 8px; }
.nav .brand { margin-bottom: 8px; }
.nav-item { padding: 5px 4px 4px; }
.nav-group { margin: 3px 0 1px; padding-top: 6px; }

/* ------------------------------------------------------------------ command palette (Ctrl K / ⌘K) */
.palette-trigger { gap: 8px; color: var(--text-3); border: 1px solid var(--border); min-width: 0; }
.palette-trigger .kbd { font-size: 11px; }
@media (min-width: 761px) { .palette-trigger { width: 220px; justify-content: flex-start; } .palette-trigger .kbd { margin-left: auto; } }
#palette-modal { place-items: start center; padding-top: 12vh; }
.palette { max-width: 620px; overflow: hidden; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 55vh); overflow-y: auto; }
.palette-option { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
                  padding: 9px 10px; border-radius: var(--radius); cursor: pointer; color: var(--text-2); }
.palette-option[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.palette-icon { display: grid; place-items: center; color: var(--text-3); }
.palette-icon svg { width: 18px; height: 18px; }
.palette-option[aria-selected="true"] .palette-icon { color: var(--accent); }
.palette-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.palette-kind { font-size: 11px; color: var(--text-3); }
.palette-hint { font-size: 11px; color: var(--text-3); }
.palette-empty { padding: 24px 12px; text-align: center; color: var(--text-3); }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
@media (max-width: 760px) {
  #palette-modal { padding: 8px; padding-top: 8px; }
  .palette-foot { display: none; }
  .palette-kind { display: none; }
}

/* ------------------------------------------------------------------ settings: index, filter, scroll-spy */
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-index { position: sticky; top: 16px; max-height: calc(100vh - var(--topbar-height) - 32px); overflow-y: auto;
                  display: flex; flex-direction: column; gap: 2px; padding: 2px 4px 2px 2px; }
.settings-index .input { margin-bottom: 4px; }
.settings-index-group { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.settings-index-label { font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); margin: 0 0 4px 10px; }
.settings-index a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: 13px; }
.settings-index a:hover { background: var(--surface-2); color: var(--text); }
.settings-index a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.settings-index a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings-content > :first-child { margin-top: 0 !important; }
.settings-content .card { scroll-margin-top: 16px; }
.card-head h2:focus { outline: none; }
.card:has(> .card-head h2:focus) { box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm); } /* where a jump landed */
@media (max-width: 1100px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .settings-index { position: static; max-height: none; overflow: visible; }
  .settings-index-group { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .settings-index-label { width: 100%; margin: 0; }
  .settings-index a { border: 1px solid var(--border); padding: 4px 10px; font-size: 12.5px; }
}
