/* ============================================================================
   TESS-HUNTER // Vantage Security Operations (Ingot UI Design System)
   Neutral dark canvas (#1a1a1a) · Hairline #000000 structural dividers
   Elevated #232323 surfaces · Electric Violet (#7b5bff) primary accent
   Geist & Geist Mono typography · Tabular numerals
   ============================================================================ */

:root {
  /* Core Surfaces */
  --bg-canvas: #1a1a1a;
  --bg-surface: #232323;
  --bg-elevated: #232323;
  --bg-recessed: #191919;
  --bg-input: #191919;
  --bg-hover: #282828;
  --bg-deep: #141414;

  /* Structural Hairlines & Borders */
  --border-hairline: #000000;
  --border-card: #2e2e2e;
  --border: #2c2c2c;
  --border-bright: #3a3a3a;
  --border-row: #222222;
  --border-subtle: #262626;

  /* Typography */
  --text-strong: #ffffff;
  --text-main: #ededed;
  --text-control: #dadada;
  --text-soft: #b4b4b4;
  --text-label: #a0a0a0;
  --text-muted: #8a8a8a;
  --text-sub: #7c7c7c;
  --text-dim: #5f5f5f;

  /* Accent & Data Palette (Vantage Ingot) */
  --violet: #7b5bff;
  --violet-soft: #9e7bff;
  --violet-deep: #5a3bd6;
  --violet-dim: rgba(123, 91, 255, 0.14);
  --violet-pill-bg: #211b36;
  --violet-pill-border: #2e2650;

  --blue: #7aa2f7;
  --blue-dim: rgba(122, 162, 247, 0.14);
  --blue-pill-bg: #1b2233;
  --blue-pill-border: #24304a;
  /* Alias --cyan to Vantage Blue so legacy inline references stay on-palette */
  --cyan: #7aa2f7;
  --cyan-dim: rgba(122, 162, 247, 0.14);

  --rose: #e5559b;
  --rose-dim: rgba(229, 85, 155, 0.14);

  --green: #3fb37f;
  --green-bright: #6bcb8b;
  --green-dim: rgba(63, 179, 127, 0.12);
  --green-pill-bg: #16251c;
  --green-pill-border: #1f3326;

  --red: #e5484d;
  --red-soft: #f07178;
  --red-dim: rgba(229, 72, 77, 0.13);

  --amber: #e3b341;
  --amber-dim: rgba(227, 179, 65, 0.13);

  /* Fonts & Geometry */
  --font-ui: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 238px;
  --topbar-h: 62px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-card: inset 0 0 0 1px var(--border-card), 0 0 4.6px rgba(0, 0, 0, 0.5);
  --shadow-recessed: inset 0 2px 8px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-main);
  color-scheme: dark;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.text-cyan { color: var(--blue); }
.text-green { color: var(--green-bright); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red-soft); }
.text-violet { color: var(--violet-soft); }
.text-muted { color: var(--text-muted); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #303030; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #454545; }

/* ============================================================================
   APP SHELL
   ============================================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  width: 100vw;
  background: var(--bg-canvas);
}

/* ============================================================================
   SIDEBAR (238px Vantage Ingot Rail)
   ============================================================================ */
.sidebar {
  background: var(--bg-canvas);
  border-right: 1px solid var(--border-hairline);
  box-shadow: 1px 0 0 0 #232323;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  z-index: 2;
}

.sidebar-brand {
  height: var(--topbar-h);
  padding: 11px 12px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vantage-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 7px;
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-card);
  position: relative;
  overflow: hidden;
}
.vantage-logo .bar {
  position: absolute;
  width: 5px;
  border-radius: 2.5px;
  background: var(--violet);
}
.vantage-logo .bar.b1 { left: 10.5px; top: 21px; height: 9px; }
.vantage-logo .bar.b2 { left: 17.5px; top: 16px; height: 14px; }
.vantage-logo .bar.b3 { left: 24.5px; top: 10px; height: 20px; }

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-title {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text-strong);
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.brand-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-sub);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(63, 179, 127, 0.7);
  flex-shrink: 0;
}
.pulse-dot.busy {
  background: var(--violet);
  box-shadow: 0 0 8px rgba(123, 91, 255, 0.85);
  animation: pulse 1.2s infinite;
}
.pulse-dot.error {
  background: var(--red);
  box-shadow: 0 0 6px rgba(229, 72, 77, 0.8);
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.sidebar-sep {
  height: 1px;
  width: 100%;
  background: var(--border-hairline);
  flex-shrink: 0;
}

/* Navigation Groups */
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 12px 2px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-soft);
  font-family: var(--font-ui);
}

.nav-indicator {
  width: 5px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 0 6px 6px 0;
  background: transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.nav-surface {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-label {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-pill {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-label);
  background: #1f1f1f;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.4;
  flex-shrink: 0;
}
.nav-pill:empty { display: none; }
.nav-pill-warn { color: var(--amber); background: var(--amber-dim); }

.nav-item:hover .nav-surface {
  background: rgba(255, 255, 255, 0.035);
}
.nav-item:hover .nav-label { color: var(--text-main); }
.nav-item:hover .nav-ico { color: var(--text-control); }

.nav-item.active .nav-indicator {
  background: var(--violet);
  box-shadow: 0 0 7.2px rgba(123, 91, 255, 0.55);
}
.nav-item.active .nav-surface {
  background:
    linear-gradient(90deg, rgba(123, 91, 255, 0.18) 0%, rgba(123, 91, 255, 0.04) 16%, rgba(123, 91, 255, 0) 28%),
    linear-gradient(#232323, #232323);
  box-shadow: inset 0 0 0 1px var(--border-card), 0 0 4.6px rgba(0, 0, 0, 0.5);
}
.nav-item.active .nav-ico { color: var(--violet); }
.nav-item.active .nav-label { color: var(--text-strong); font-weight: 500; }
.nav-item.active .nav-pill { background: var(--violet-pill-bg); color: var(--violet-soft); }

/* Workspace Switcher & Sidebar Footer */
.ws-box {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.ws-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ws-path {
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-hairline);
  flex-shrink: 0;
}
.engine-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}
.meta-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-sub);
}

/* ============================================================================
   MAIN COLUMN & 62px TOP BREADCRUMB BAR
   ============================================================================ */
.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  background: var(--bg-canvas);
}

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-hairline);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.crumb-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  padding: 4px 2px;
  transition: color 0.14s ease;
}
.crumb-home:hover { color: var(--text-strong); }

.crumb-chev { color: var(--text-dim); flex-shrink: 0; }

.crumb-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.state-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-card);
  white-space: nowrap;
}
.state-idle {
  color: var(--green-bright);
  background: var(--green-pill-bg);
  border-color: var(--green-pill-border);
}
.state-running {
  color: var(--violet-soft);
  background: var(--violet-pill-bg);
  border-color: var(--violet-pill-border);
  animation: pulse 1.3s infinite;
}
.state-error {
  color: var(--red-soft);
  background: var(--red-dim);
  border-color: rgba(229, 72, 77, 0.35);
}

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

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-recessed);
  box-shadow: inset 0 0 0 1px #242424;
}
.hud-k {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.2;
}
.hud-v {
  font-size: 11.5px;
  color: var(--text-main);
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-clock {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px;
  white-space: nowrap;
}

.vantage-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  border: none;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}
.vantage-icon-btn:hover {
  color: var(--text-strong);
  background: var(--bg-hover);
}

/* ============================================================================
   VIEWPORT & VIEWS
   ============================================================================ */
.viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 28px;
}

.view {
  display: none;
  flex-direction: column;
  gap: 16px;
}
.view.active { display: flex; }

/* Overview uses flush full-bleed Vantage hairlines inside viewport */
#view-overview {
  margin: -20px -24px -28px;
  gap: 0;
}

/* ============================================================================
   VANTAGE HOME SCREEN ARCHITECTURE (Overview)
   ============================================================================ */
.v-hairline {
  height: 1px;
  width: 100%;
  background: var(--border-hairline);
  flex-shrink: 0;
}

.v-page-header {
  padding: 22px 24px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.v-h1 {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.v-h2 {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.v-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: -0.01em;
}

/* Vantage Control Buttons */
.v-control-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 6px;
  border: none;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  color: var(--text-control);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
  white-space: nowrap;
}
.v-control-btn:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px #3d3d3d, 0 0 6px rgba(0, 0, 0, 0.55);
}
.v-control-btn.btn-xs { padding: 4px 9px; font-size: 11.5px; }

/* Vantage Segmented Bar */
.v-seg-bar {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.v-segmented {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-recessed);
  box-shadow: var(--shadow-recessed), inset 0 0 0 1px #242424;
  flex-wrap: wrap;
}

.v-seg-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.v-seg-item:hover { color: var(--text-strong); }
.v-seg-item.active {
  background: var(--bg-surface);
  color: var(--text-strong);
  box-shadow:
    inset 0 0 0 1px #191919,
    0 0 4.6px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.16);
}

/* 6-Column Hairline-Divided KPI Strip */
.v-kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.v-kpi-cell {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-right: 1px solid var(--border-hairline);
  min-width: 0;
  transition: background 0.14s ease;
}
.v-kpi-cell:last-child { border-right: none; }
.v-kpi-cell:hover { background: rgba(255, 255, 255, 0.015); }

.v-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.v-kpi-label {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-label);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v-kpi-ico {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v-kpi-num {
  font-size: 28px;
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.v-kpi-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.v-delta {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v-delta-pos { color: var(--green-bright); background: rgba(63, 179, 127, 0.11); }
.v-delta-neg { color: var(--red-soft); background: rgba(229, 72, 77, 0.11); }
.v-delta-violet { color: var(--violet-soft); background: var(--violet-dim); }
.v-delta-blue { color: var(--blue); background: var(--blue-dim); }
.v-delta-neutral { color: var(--text-label); background: #232323; }

.v-kpi-note {
  font-size: 11px;
  color: var(--text-dim);
}

/* Asymmetric 2-Column Overview Split */
.v-overview-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  flex: 1;
}

.v-split-left {
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.v-split-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.v-section {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
}

.v-legend-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.v-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.v-leg i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.v-trend-wrap {
  width: 100%;
  min-height: 215px;
  margin-top: 8px;
}
.v-trend-wrap svg {
  width: 100%;
  height: 215px;
  display: block;
}

/* Vantage Stepped Violet Pipeline Bars */
.v-pipe-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.v-pipe-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.v-pipe-label {
  font-size: 12.5px;
  color: var(--text-soft);
}
.v-pipe-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}
.v-pipe-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
}
.v-pipe-pct {
  font-size: 11px;
  color: var(--green-bright);
}
.v-pipe-track {
  height: 8px;
  width: 100%;
  border-radius: 4px;
  background: var(--bg-recessed);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #242424;
}
.v-pipe-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Vantage Donut Chart Layout */
.v-donut-layout {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.v-donut-svg-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}
.v-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.v-donut-total {
  font-size: 24px;
  font-weight: 500;
  color: var(--text-strong);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.v-donut-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.v-donut-legend {
  flex: 1;
  min-width: 145px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.v-donut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}
.v-donut-key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
}
.v-donut-key i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.v-donut-val {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.v-donut-cnt { color: var(--text-strong); font-weight: 500; }
.v-donut-pct { color: var(--text-muted); font-size: 11.5px; }

/* ============================================================================
   SHARED PANELS, HEADINGS & GRIDS (Views 02–11)
   ============================================================================ */
.panel {
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.wrap-head { flex-wrap: wrap; }

.panel-kicker {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  margin-bottom: 2px;
}

.panel-head h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-strong);
  letter-spacing: -0.015em;
}

.panel-subhead {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin: 10px 0 8px;
}

.flex-between { display: flex; justify-content: space-between; align-items: center; }

.divider-line {
  height: 1px;
  background: var(--border-row);
  margin: 14px 0;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }

/* Attack Path */
.attack-path-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-recessed);
  box-shadow: inset 0 0 0 1px #242424;
  border-radius: var(--radius);
  min-height: 58px;
}
.ap-node {
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--border-card);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-main);
}
.ap-node-vuln {
  background: rgba(229, 72, 77, 0.1);
  box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.35);
  color: #ffc5c8;
}
.ap-node-obj {
  background: var(--violet-pill-bg);
  box-shadow: inset 0 0 0 1px var(--violet-pill-border);
  color: #ddd2ff;
}
.ap-arrow { color: var(--violet-soft); font-family: var(--font-mono); font-size: 12px; }

/* Legacy / Budget Bars */
.bar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.bar-track {
  height: 7px;
  background: var(--bg-recessed);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #242424;
}
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.25s ease; }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  background: #282828;
  color: var(--text-control);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
  white-space: nowrap;
}
.btn:hover { background: #303030; border-color: #3f3f3f; color: var(--text-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--violet);
  color: #ffffff;
  border-color: var(--violet);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-primary:hover {
  background: #8b6eff;
  border-color: #8b6eff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(123, 91, 255, 0.35);
}

.btn-cyan {
  background: var(--blue-pill-bg);
  color: var(--blue);
  border-color: var(--blue-pill-border);
}
.btn-cyan:hover { background: #232d45; color: #a7c2ff; border-color: #374a72; }

.btn-green {
  background: var(--green-pill-bg);
  color: var(--green-bright);
  border-color: var(--green-pill-border);
}
.btn-green:hover { background: #1e3326; color: #8be0a7; border-color: #2c4a38; }

.btn-amber {
  background: rgba(227, 179, 65, 0.12);
  color: var(--amber);
  border-color: rgba(227, 179, 65, 0.3);
}
.btn-amber:hover { background: rgba(227, 179, 65, 0.2); color: #f4cc6c; }

.btn-danger {
  background: rgba(229, 72, 77, 0.12);
  color: var(--red-soft);
  border-color: rgba(229, 72, 77, 0.3);
}
.btn-danger:hover { background: var(--red); color: #ffffff; border-color: var(--red); }

.btn-ghost {
  background: var(--bg-recessed);
  border-color: var(--border-card);
  color: var(--text-soft);
}
.btn-ghost:hover { background: #282828; color: var(--text-strong); }

.btn-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-soft);
  width: 24px;
  height: 24px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-strong); border-color: #444; }

/* ============================================================================
   BADGES & TAGS (Vantage Soft Tinted Pills)
   ============================================================================ */
.badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border-card);
  background: var(--bg-recessed);
  color: var(--text-soft);
  white-space: nowrap;
}
.tag {
  color: var(--violet-soft);
  border-color: var(--violet-pill-border);
  background: var(--violet-pill-bg);
  margin-bottom: 4px;
}
.tag-red, .badge-critical, .badge-confirmed, .badge-r4, .badge-r3 {
  color: var(--red-soft);
  background: rgba(229, 72, 77, 0.12);
  border-color: rgba(229, 72, 77, 0.28);
}
.badge-high {
  color: var(--rose);
  background: var(--rose-dim);
  border-color: rgba(229, 85, 155, 0.3);
}
.badge-medium, .badge-observed, .badge-r2, .badge-amber {
  color: var(--amber);
  background: var(--amber-dim);
  border-color: rgba(227, 179, 65, 0.28);
}
.badge-low, .badge-r1, .badge-cyan {
  color: var(--blue);
  background: var(--blue-pill-bg);
  border-color: var(--blue-pill-border);
}
.badge-green, .badge-r0, .badge-verified, .badge-stable {
  color: var(--green-bright);
  background: var(--green-pill-bg);
  border-color: var(--green-pill-border);
}
.badge-violet {
  color: var(--violet-soft);
  background: var(--violet-pill-bg);
  border-color: var(--violet-pill-border);
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */
input, select, textarea {
  width: 100%;
  background: var(--bg-recessed);
  color: var(--text-main);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, select:focus, textarea:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 2px rgba(123, 91, 255, 0.2);
}
select option { background: #1e1e1e; color: var(--text-main); }
textarea { resize: vertical; }
textarea.mono, input.mono { font-family: var(--font-mono); font-size: 12px; }

.select-compact { padding: 5px 8px; font-size: 12px; }
.select-compact-sm { width: auto; padding: 5px 10px; font-size: 12px; }
.input-compact { width: 220px; padding: 5px 10px; font-size: 12px; }

.form-stack { display: flex; flex-direction: column; gap: 11px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; font-weight: 500; color: var(--text-label); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form > input { flex: 1; }
.inline-form-sm { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inline-form-xs { display: flex; gap: 4px; width: 120px; }
.form-inline-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.checkbox-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-soft); cursor: pointer; }
.checkbox-label input, input[type="checkbox"] { width: auto; accent-color: var(--violet); box-shadow: none; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.form-error {
  color: var(--red-soft);
  font-size: 12px;
  padding: 7px 10px;
  background: var(--red-dim);
  border: 1px solid rgba(229, 72, 77, 0.3);
  border-radius: 6px;
}

/* ============================================================================
   AGENT CONSOLE
   ============================================================================ */
.console-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 44px);
}
.console-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 14px 16px;
}
.console-head { margin-bottom: 10px; flex-shrink: 0; }
.console-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  height: 100%;
}

.stream-container {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stream-welcome {
  padding: 14px;
  border: 1px dashed #343434;
  border-radius: 8px;
  background: rgba(123, 91, 255, 0.04);
  color: var(--text-soft);
  font-size: 13px;
}
.stream-welcome code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--violet-soft);
  background: var(--violet-pill-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  max-width: 82%;
  background: var(--violet-pill-bg);
  border: 1px solid var(--violet-pill-border);
  border-radius: 10px 10px 3px 10px;
  padding: 8px 13px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-strong);
  white-space: pre-wrap;
}

.msg-assistant {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 3px solid var(--violet);
  border-radius: 6px;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-main);
  word-break: break-word;
}
.msg-assistant h3, .msg-assistant h4 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 8px 0 4px;
  letter-spacing: -0.01em;
}
.msg-assistant p { margin: 4px 0; }
.msg-assistant ul, .msg-assistant ol { margin: 4px 0 6px 18px; }
.msg-assistant li { margin: 2px 0; }
.msg-assistant strong { color: var(--text-strong); font-weight: 600; }
.msg-assistant code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--violet-soft);
  background: var(--bg-recessed);
  padding: 1px 5px;
  border-radius: 4px;
}
.msg-assistant pre {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-deep);
  border: 1px solid var(--border-card);
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  white-space: pre-wrap;
}

.msg-thinking {
  border: 1px solid var(--violet-pill-border);
  background: rgba(123, 91, 255, 0.06);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-soft);
}
.msg-thinking summary { padding: 7px 11px; cursor: pointer; color: var(--violet-soft); font-weight: 500; }
.msg-thinking pre { padding: 0 11px 10px; white-space: pre-wrap; word-break: break-word; }

.msg-system {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-soft);
  background: var(--bg-surface);
  border-left: 2px solid var(--text-dim);
  border-radius: 4px;
  padding: 6px 10px;
  white-space: pre-wrap;
}
.msg-system.warn { color: var(--amber); border-left-color: var(--amber); background: var(--amber-dim); }
.msg-system.error { color: var(--red-soft); border-left-color: var(--red); background: var(--red-dim); }

.tool-card {
  border: 1px solid var(--border-card);
  border-radius: 6px;
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.tool-card.running { border-color: rgba(123, 91, 255, 0.5); }
.tool-card.ok { border-color: rgba(63, 179, 127, 0.35); }
.tool-card.err { border-color: rgba(229, 72, 77, 0.45); }
.tool-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  cursor: pointer;
}
.tool-card summary::-webkit-details-marker { display: none; }
.tool-card-body {
  border-top: 1px solid var(--border-row);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mono-label { font-size: 10px; color: var(--text-dim); letter-spacing: 0.06em; }
.tool-pre {
  background: var(--bg-deep);
  border: 1px solid var(--border-row);
  border-radius: 5px;
  padding: 8px 10px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  color: var(--text-soft);
}

.slash-hints {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0 6px;
  flex-shrink: 0;
}
.chip {
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.chip:hover { border-color: var(--violet); color: var(--text-strong); background: var(--violet-pill-bg); }

.console-input-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 8px 10px;
  flex-shrink: 0;
}
.console-input-bar:focus-within {
  border-color: var(--violet);
  box-shadow: 0 0 0 2px rgba(123, 91, 255, 0.16);
}
.prompt-glyph {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--violet);
  line-height: 1.5;
  padding-top: 1px;
}
.console-input-bar textarea {
  border: none;
  background: transparent;
  padding: 2px 4px;
  box-shadow: none !important;
  resize: none;
  min-height: 36px;
  max-height: 140px;
}

/* ============================================================================
   TABS & CLEAN VANTAGE HAIRLINE TABLES
   ============================================================================ */
.tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-recessed);
  padding: 4px;
  border-radius: 8px;
  box-shadow: var(--shadow-recessed), inset 0 0 0 1px #242424;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tabs-spacer { flex: 1; }
.tab-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}
.tab-btn:hover { color: var(--text-strong); }
.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-strong);
  box-shadow:
    inset 0 0 0 1px #191919,
    0 0 4.6px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.14);
}
.ftab-panel, .ttab-panel { display: none; }
.ftab-panel.active, .ttab-panel.active { display: block; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-row);
  color: var(--text-main);
  vertical-align: top;
}
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Flags Grid */
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.flag-card {
  background: var(--violet-pill-bg);
  border: 1px solid var(--violet-pill-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flag-val { font-family: var(--font-mono); font-size: 13px; color: var(--violet-soft); font-weight: 600; word-break: break-all; }

/* ============================================================================
   PROVENANCE GRAPH VIEW
   ============================================================================ */
.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 104px);
}
.graph-stage-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.graph-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-endpoint { background: var(--blue); }
.dot-evidence { background: var(--violet); }
.dot-hypothesis { background: var(--amber); }
.dot-vuln { background: var(--red); }
.dot-exploit { background: var(--rose); }

.graph-canvas-wrap {
  position: relative;
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  overflow: hidden;
}
#graph-canvas { width: 100%; height: 100%; display: block; cursor: grab; }
#graph-canvas:active { cursor: grabbing; }
.empty-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 20px;
  text-align: center;
  pointer-events: none;
}
.graph-inspector { overflow-y: auto; height: 100%; }

/* ============================================================================
   GUARDRAILS, SYSTEM & SHARED LISTS
   ============================================================================ */
.scope-lists { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.rule-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  color: var(--text-main);
}
.rule-pill-inc { border-color: var(--green-pill-border); background: var(--green-pill-bg); color: var(--green-bright); }
.rule-pill-exc { border-color: rgba(229, 72, 77, 0.35); background: var(--red-dim); color: var(--red-soft); }
.rule-pill button {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  font-size: 11px;
}
.rule-pill button:hover { opacity: 1; }

.check-result {
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.check-result.allow { background: var(--green-pill-bg); border: 1px solid var(--green-pill-border); color: var(--green-bright); }
.check-result.deny { background: var(--red-dim); border: 1px solid rgba(229, 72, 77, 0.35); color: var(--red-soft); }

.policy-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.budget-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }
.budget-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.kv-list { display: flex; flex-direction: column; gap: 4px; }
.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-row);
}
.kv-row:last-child { border-bottom: none; }
.kv-row span:first-child { color: var(--text-muted); }
.kv-row span:last-child { font-family: var(--font-mono); font-size: 11.5px; text-align: right; }

.item-card {
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.item-card:hover { border-color: #3d3d3d; }
.item-card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.compact-feed {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}
.feed-line {
  padding: 5px 9px;
  background: var(--bg-recessed);
  border-radius: 5px;
  border-left: 2px solid var(--violet);
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.binary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; max-height: 270px; overflow-y: auto; }
.binary-pill {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  background: var(--bg-recessed);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.binary-pill.installed { border-color: var(--green-pill-border); background: rgba(63, 179, 127, 0.06); }

.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 360px; overflow-y: auto; }

.code-box {
  background: var(--bg-deep);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 340px;
}
.code-tall { min-height: 220px; max-height: 400px; }
.muted-note { color: var(--text-muted); font-size: 12px; }
.empty-state { color: var(--text-muted); font-size: 12.5px; padding: 10px 0; }
.banner-box {
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  background: var(--bg-recessed);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-bottom: 12px;
}
.export-group { display: inline-flex; gap: 4px; }

/* ============================================================================
   MODALS, AUTH GATE & TOASTS
   ============================================================================ */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: radial-gradient(circle at 50% 25%, rgba(123, 91, 255, 0.14), #121212 65%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card), 0 24px 60px rgba(0, 0, 0, 0.65);
  border-radius: var(--radius-lg);
  padding: 26px;
}
.auth-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }
.auth-foot { margin-top: 16px; font-size: 11px; color: var(--text-dim); text-align: center; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-card), 0 24px 64px rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide { max-width: 780px; }
.modal-danger { box-shadow: inset 0 0 0 1px rgba(229, 72, 77, 0.55), 0 24px 64px rgba(0, 0, 0, 0.7); }
.modal-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-row);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.modal-head h2 { font-size: 15.5px; font-weight: 500; color: var(--text-strong); }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-actions { padding: 12px 18px; border-top: 1px solid var(--border-row); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.meta-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-soft); }

.toast-root {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 3px solid var(--violet);
  border-radius: 7px;
  padding: 10px 13px;
  font-size: 12.5px;
  color: var(--text-main);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }

/* ============================================================================
   PROXY & HTTP REPEATER (CAIDO + XALGORIX SENDRAW)
   ============================================================================ */
.proxy-cfg-drawer {
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.repeater-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.repeater-pane {
  background: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.repeater-resp-box {
  min-height: 360px;
  max-height: 520px;
  overflow: auto;
  margin: 0;
}
[data-rep-mode].active,
[data-resp-tab].active {
  background: var(--violet-pill-bg);
  border-color: var(--violet-pill-border);
  color: var(--text-strong);
}
@media (max-width: 1080px) {
  .repeater-split {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   CIPHER & HUNTDECK VIEWS (Vantage Styled)
   ============================================================================ */
.subview { display: none; flex-direction: column; gap: 16px; }
.subview.active { display: flex; }

/* Vantage Leaderboard / Preflight Rows */
.pf-item {
  background: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pf-item.ok { border-left: 3px solid var(--green); }
.pf-item.warn { border-left: 3px solid var(--amber); }

.history-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.hkpi {
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 7px;
  padding: 10px 12px;
}
.hkpi-k { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hkpi-v { font-size: 20px; font-weight: 500; color: var(--text-strong); margin-top: 3px; font-variant-numeric: tabular-nums; }

.wiki-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
  min-height: 540px;
}
.wiki-sidebar { max-height: calc(100vh - 180px); overflow-y: auto; }
.wiki-content-panel { display: flex; flex-direction: column; gap: 10px; }
.wiki-cat {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 8px 0 4px;
  text-transform: uppercase;
}
.wiki-link {
  width: 100%;
  text-align: left;
  background: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text-soft);
  font-family: var(--font-ui);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.wiki-link:hover, .wiki-link.active {
  border-color: var(--violet-pill-border);
  color: var(--text-strong);
  background: var(--violet-pill-bg);
}

.wiki-builder-intro {
  background: var(--bg-recessed);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 11px 13px;
}
.wiki-dropzone {
  border: 1px dashed #3d3d3d;
  border-radius: 8px;
  background: var(--bg-recessed);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.wiki-dropzone:hover, .wiki-dropzone.dragover {
  border-color: var(--violet);
  background: rgba(123, 91, 255, 0.08);
}
.wiki-drop-title { font-size: 13px; font-weight: 500; color: var(--text-main); }
.wiki-drop-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.wiki-file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.wiki-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--violet-pill-bg);
  border: 1px solid var(--violet-pill-border);
  color: var(--violet-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}
.wiki-file-chip button {
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
}
.wiki-file-chip button:hover { color: var(--text-strong); }
.wiki-gen-banner {
  background: var(--green-pill-bg);
  border: 1px solid var(--green-pill-border);
  border-radius: 7px;
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-main);
}
.wiki-auto-bar {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px;
  flex-wrap: wrap;
}

.score-pill {
  display: inline-block;
  min-width: 38px;
  text-align: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
}
.score-high { background: var(--red-dim); color: var(--red-soft); border: 1px solid rgba(229, 72, 77, 0.35); }
.score-med { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(227, 179, 65, 0.35); }
.score-low { background: var(--blue-pill-bg); color: var(--blue); border: 1px solid var(--blue-pill-border); }

/* HuntDeck Multi-Platform Catalog */
.hd-platform-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.hd-plat-card {
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 7px;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.hd-plat-card:hover { border-color: #444; background: #1f1f1f; }
.hd-plat-card.active {
  border-color: var(--violet);
  background: var(--violet-pill-bg);
  box-shadow: inset 0 2px 0 var(--violet);
}
.hd-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hd-filter-bar > input { flex: 1; min-width: 200px; }
.hd-main-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: start;
}
.hd-scroll-list { max-height: 620px; overflow-y: auto; padding-right: 4px; }
.hd-detail-panel { max-height: 690px; overflow-y: auto; }
.hd-prog-card {
  background: var(--bg-recessed);
  border: 1px solid var(--border-card);
  border-radius: 7px;
  padding: 11px 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.hd-prog-card:hover { border-color: #444; }
.hd-prog-card.selected { border-color: var(--violet); background: rgba(123, 91, 255, 0.08); }
.hd-scope-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */
@media (max-width: 1280px) {
  .v-kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v-kpi-cell { border-bottom: 1px solid var(--border-hairline); }
  .v-kpi-cell:nth-child(3n) { border-right: none; }
  .v-overview-split { grid-template-columns: 1fr; }
  .v-split-left { border-right: none; border-bottom: 1px solid var(--border-hairline); }
  .hd-platform-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2, .grid-2-1, .console-layout, .graph-layout, .wiki-layout, .hd-main-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .history-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .console-main { height: 70vh; }
  .graph-stage-panel { height: 60vh; }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .v-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v-kpi-cell:nth-child(3n) { border-right: 1px solid var(--border-hairline); }
  .v-kpi-cell:nth-child(2n) { border-right: none; }
  .hud-stat { display: none; }
}
