/* ==============================================================
   AegisMCP — Bespoke Developer Security Studio Design System
   Inspired by Linear, Cloudflare Security, Datadog & Vercel
   ============================================================== */

:root {
  /* Color Palette: Dark Obsidian & Zinc */
  --bg-canvas: #090a0f;
  --bg-surface: #0e1017;
  --bg-panel: #13151f;
  --bg-card: #161824;
  --bg-card-hover: #1c2030;
  --bg-input: #0e111a;
  --bg-code: #0a0b12;

  /* Hairline Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-bright: rgba(255, 255, 255, 0.22);
  --border-focus: rgba(56, 189, 248, 0.5);

  /* Refined Accent System (Non-Neon, High-Craft) */
  --accent-primary: #38bdf8;
  --accent-primary-hover: #0ea5e9;
  --accent-primary-faint: rgba(56, 189, 248, 0.1);

  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --accent-emerald-faint: rgba(16, 185, 129, 0.1);

  --accent-crimson: #f43f5e;
  --accent-crimson-hover: #e11d48;
  --accent-crimson-faint: rgba(244, 63, 94, 0.1);

  --accent-amber: #f59e0b;
  --accent-amber-faint: rgba(245, 158, 11, 0.1);

  --accent-purple: #c084fc;
  --accent-purple-faint: rgba(192, 132, 252, 0.1);

  --accent-indigo: #818cf8;
  --accent-indigo-faint: rgba(129, 140, 248, 0.1);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-code: #38bdf8;

  /* Typography Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: 'JetBrains Mono', "SF Mono", Menlo, Consolas, monospace;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows & Inner Bevels */
  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-popup: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="password"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
  background: #0f121d;
}

select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

code, pre {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==============================================================
   Top Navigation Header
   ============================================================== */
.aegis-header {
  height: 54px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

.logo-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

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

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-title .accent {
  color: var(--accent-primary);
  font-weight: 600;
  margin-left: 1px;
}

.version-tag {
  background: var(--accent-primary-faint);
  color: var(--accent-primary);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.protocol-badge {
  background: var(--accent-indigo-faint);
  color: var(--accent-indigo);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(129, 140, 248, 0.2);
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
}

/* Quick Scenarios Bar */
.quick-scenarios {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 17, 26, 0.7);
  padding: 3px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.scenario-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 4px;
}

.btn-scenario {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-scenario:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.scenario-icon {
  color: var(--text-muted);
}

.btn-scenario:hover .scenario-icon {
  color: var(--accent-primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-emerald-faint);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 3px 8px;
  border-radius: 20px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: pulseLight 2s infinite ease-in-out;
}

@keyframes pulseLight {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.status-label {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent-emerald);
  letter-spacing: 0.04em;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-github {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-github:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Command Palette Trigger Button */
.btn-palette-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 17, 26, 0.85);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-subtle);
}

.btn-palette-trigger:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  color: var(--text-primary);
}

.palette-btn-text {
  font-size: 11px;
}

.palette-btn-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 1px 4px;
  color: var(--text-muted);
}

/* Sound Control Widget */
.sound-control-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sound-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
}

.sound-vol-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 26px;
  text-align: right;
}

.sound-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-popup);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInPopup 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInPopup {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.sound-popover-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.sound-popover-val {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-primary);
}

.sound-slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.sound-mute-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  transition: color 0.15s ease;
}

.sound-mute-icon-btn:hover {
  color: var(--text-primary);
}

.sound-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sound-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid #090a0f;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.sound-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.sound-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid #090a0f;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
  cursor: pointer;
}

.sound-max-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.sound-presets-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.sound-preset-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 0;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sound-preset-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.sound-preset-chip.active {
  background: var(--accent-primary-faint);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.sound-test-row {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.sound-test-btn {
  width: 100%;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
}

/* ==============================================================
   Main Shell & Sidebar
   ============================================================== */
.aegis-container {
  display: flex;
  height: calc(100vh - 54px);
  overflow: hidden;
}

.aegis-sidebar {
  width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 8px;
  overflow-y: auto;
  flex-shrink: 0;
}

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

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  padding: 10px 8px 4px 8px;
  text-transform: uppercase;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-tab.active {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.2);
  color: var(--accent-primary);
  font-weight: 600;
}

.tab-svg {
  flex-shrink: 0;
  color: var(--text-faint);
  transition: color 0.15s ease;
}

.nav-tab:hover .tab-svg {
  color: var(--text-secondary);
}

.nav-tab.active .tab-svg {
  color: var(--accent-primary);
}

.tab-text {
  flex: 1;
}

.sidebar-footer {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 12px;
}

.server-fleet-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.fleet-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fleet-item {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fleet-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 5px rgba(16, 185, 129, 0.6);
  display: inline-block;
  margin-right: 5px;
}

.fleet-pill {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

/* ==============================================================
   Main Content Stage & Panels
   ============================================================== */
.aegis-stage {
  flex: 1;
  background: var(--bg-canvas);
  padding: 16px;
  overflow-y: auto;
  position: relative;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.15s ease;
}

.tab-pane.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(14, 16, 23, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 6px var(--accent-primary);
}

.live-tag {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
}

/* ==============================================================
   Cockpit Dashboard & Telemetry
   ============================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: border-color 0.15s ease;
}

.stat-card:hover {
  border-color: var(--border-medium);
}

.stat-card.cyan { border-top: 2px solid var(--accent-primary); }
.stat-card.red { border-top: 2px solid var(--accent-crimson); }
.stat-card.purple { border-top: 2px solid var(--accent-purple); }
.stat-card.green { border-top: 2px solid var(--accent-emerald); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-icon-svg {
  color: var(--text-faint);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Telemetry Chart Panel */
.telemetry-chart-panel {
  padding: 0;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
}

.legend-dot.green { background: var(--accent-emerald); }
.legend-dot.red { background: var(--accent-crimson); }

.legend-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

.telemetry-chart-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
}

.telemetry-svg {
  width: 100%;
  height: 90px;
  display: block;
}

.telemetry-footer-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

/* Dashboard Split Grid */
.dashboard-split {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 12px;
  height: calc(100vh - 360px);
  min-height: 380px;
}

/* Event Stream */
.stream-panel {
  display: flex;
  flex-direction: column;
}

/* Threat Filter Toolbar */
.threat-filter-toolbar {
  padding: 8px 10px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 3px 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  user-select: none;
}

.filter-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.filter-pill.active {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.filter-pill.pill-block.active {
  background: var(--accent-crimson-faint);
  border-color: var(--accent-crimson);
  color: var(--accent-crimson);
}

.filter-pill.pill-success.active {
  background: var(--accent-emerald-faint);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.filter-pill.pill-audit.active {
  background: var(--accent-amber-faint);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pill-dot.dot-red { background: var(--accent-crimson); }
.pill-dot.dot-green { background: var(--accent-emerald); }
.pill-dot.dot-amber { background: var(--accent-amber); }

.filter-pill-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  min-width: 16px;
  text-align: center;
}

.filter-pill-reset {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--accent-crimson);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
}

.filter-pill-reset:hover {
  background: var(--accent-crimson-faint);
}

.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-chips-title {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-right: 2px;
  flex-shrink: 0;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.filter-chip.active {
  background: var(--accent-crimson-faint);
  border-color: var(--accent-crimson);
  color: var(--accent-crimson);
  font-weight: 700;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.2);
}

.event-stream {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-card);
}

.event-item {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s ease;
}

.event-item:hover {
  border-color: var(--border-medium);
}

.event-item.block {
  border-left: 3px solid var(--accent-crimson);
  background: rgba(244, 63, 94, 0.04);
}

.event-item.success {
  border-left: 3px solid var(--accent-emerald);
}

.event-item.sanitized {
  border-left: 3px solid var(--accent-purple);
}

.event-item.audit {
  border-left: 3px solid var(--accent-amber);
}

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

.event-type-badge {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.04em;
}

.event-item.block .event-type-badge { background: var(--accent-crimson-faint); color: var(--accent-crimson); }
.event-item.success .event-type-badge { background: var(--accent-emerald-faint); color: var(--accent-emerald); }
.event-item.sanitized .event-type-badge { background: var(--accent-purple-faint); color: var(--accent-purple); }
.event-item.audit .event-type-badge { background: var(--accent-amber-faint); color: var(--accent-amber); }

.event-time {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.event-desc {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 11px;
  word-break: break-all;
}

.event-detail {
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.2);
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  overflow-x: auto;
}

.event-rule-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--accent-crimson-faint);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-crimson);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: 6px;
}

.event-rule-pill:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--accent-crimson);
}

.event-item.filter-hidden {
  display: none !important;
}

.event-stream-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg-panel);
  border-radius: var(--radius-xs);
  border: 1px dashed var(--border-subtle);
  margin: 10px 0;
}

.threat-row {
  cursor: pointer;
  border-radius: var(--radius-xs);
  padding: 2px 4px;
  transition: background 0.15s ease;
}

.threat-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Radar & Firewall Breakdown */
.radar-panel {
  display: flex;
  flex-direction: column;
}

.radar-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  background: var(--bg-card);
}

.threat-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.threat-row {
  display: grid;
  grid-template-columns: 190px 1fr 35px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.threat-name {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.rule-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0 4px;
  border-radius: var(--radius-xs);
}

.threat-bar-bg {
  background: rgba(255, 255, 255, 0.05);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.threat-bar.red {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.threat-count {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  color: var(--accent-crimson);
  font-size: 11px;
}

.mode-switcher-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.box-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mode-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-radio {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-radio:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.mode-radio input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--accent-primary);
}

.radio-label strong {
  display: block;
  font-size: 11px;
  color: var(--text-primary);
}

.radio-label small {
  color: var(--text-muted);
  font-size: 10px;
}

/* ==============================================================
   Tool Studio Layout
   ============================================================== */
.tool-studio-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  height: calc(100vh - 100px);
}

.tool-search-box {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.tool-search-box input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.tool-search-box input:focus {
  border-color: var(--border-focus);
}

.tool-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-card);
}

.tool-item {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--bg-panel);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tool-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
}

.tool-item.active {
  border-color: rgba(56, 189, 248, 0.4);
  background: var(--accent-primary-faint);
}

.tool-item-name {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tool-item-server {
  font-size: 10px;
  color: var(--text-muted);
}

.tool-runner-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  overflow-y: auto;
}

.tool-selected-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tool-header-title {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

.tool-header-server {
  font-size: 12px;
  color: var(--text-muted);
}

.tool-desc-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.section-subhead {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.form-input, .form-select, .form-group input, .form-group textarea, .form-group select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-group input:focus, .form-group textarea:focus {
  border-color: var(--border-focus);
}

.execution-output-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 200px;
}

.tab-subnav {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
}

.subnav-btn {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.subnav-btn:hover {
  color: var(--text-primary);
}

.subnav-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

.subtab-pane {
  display: none;
  padding: 10px;
  flex: 1;
}

.subtab-pane.active {
  display: block;
}

.code-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

.preflight-box {
  padding: 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
}

.preflight-status.safe {
  color: var(--accent-emerald);
}

.preflight-status.danger {
  color: var(--accent-crimson);
}

/* ==============================================================
   Rules Table & Custom Rule Studio
   ============================================================== */
.rules-table-container {
  overflow-x: auto;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.rules-table th {
  padding: 8px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-surface);
}

.rules-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.rules-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.custom-rule-card {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.custom-rule-grid {
  display: grid;
  grid-template-columns: 110px 220px 1fr 110px 130px;
  gap: 8px;
}

/* ==============================================================
   Protocol Fuzzer & Exploit Studio
   ============================================================== */
.fuzzer-controls {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fuzzer-config-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.config-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.fuzzer-scorecard-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease;
}

.scorecard-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

.grade-badge {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-emerald-faint);
  border: 1.5px solid var(--accent-emerald);
  color: var(--accent-emerald);
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}

.scorecard-metrics h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.scorecard-metrics p {
  font-size: 12px;
  color: var(--text-muted);
}

.scorecard-actions {
  margin-left: auto;
}

.scorecard-grid {
  display: grid;
  grid-template-columns: 140px repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

.score-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.score-val {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.grade-val.green {
  color: var(--accent-emerald);
}

.fuzz-results-scroll {
  max-height: 380px;
  overflow-y: auto;
}

.fuzz-results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.fuzz-results-table th {
  background: var(--bg-surface);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.fuzz-results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.fuzz-results-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ==============================================================
   Visual DAG Pipeline
   ============================================================== */
.pipeline-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 100px);
}

.pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pipeline-name {
  font-size: 12px;
  color: var(--text-secondary);
}

.dag-canvas-container {
  flex: 1;
  background-color: var(--bg-code);
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 220px;
}

.dag-canvas-wrapper {
  position: relative;
  min-width: 1060px;
  height: 100%;
  min-height: 220px;
}

#dag-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.dag-nodes-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.dag-node-card {
  position: absolute;
  width: 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  transition: all 0.2s ease;
}

.dag-node-card.running {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.dag-node-card.success {
  border-color: var(--accent-emerald);
}

.dag-node-card.failed {
  border-color: var(--accent-crimson);
}

.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.node-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.node-tool-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  background: var(--accent-primary-faint);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

.node-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

.pipeline-console-panel {
  height: 160px;
  display: flex;
  flex-direction: column;
}

.pipeline-log-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-code);
}

/* ==============================================================
   Audit Ledger & Forensics
   ============================================================== */
.ledger-container,
.forensics-container,
.synthesizer-container,
.configs-container,
.servers-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ledger-status-panel {
  padding: 14px;
  gap: 12px;
}

.chain-status-badge.pristine {
  background: var(--accent-emerald-faint);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.chain-status-badge.compromised {
  background: var(--accent-crimson-faint);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-crimson);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.merkle-banner {
  display: flex;
  gap: 20px;
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.merkle-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.merkle-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hash-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
  word-break: break-all;
}

.blocks-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.block-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.block-card:hover {
  transform: translateX(2px);
  border-color: var(--border-medium);
}

.block-card.tampered {
  border-color: var(--accent-crimson);
  background: rgba(244, 63, 94, 0.05);
}

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

.block-index {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent-primary);
}

.block-hash-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.block-hash-val {
  color: var(--text-secondary);
  word-break: break-all;
}

/* Timeline Scrubber */
.timeline-scrubber-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.scrubber-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.timeline-slider {
  flex: 1;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.snapshot-card {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.snapshot-payload {
  background: var(--bg-code);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  color: var(--text-secondary);
  max-height: 180px;
  overflow-y: auto;
}

.blast-radius-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-crimson-faint);
  color: var(--accent-crimson);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.blast-radius-badge.pristine {
  background: var(--accent-emerald-faint);
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

.diff-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 8px;
}

.diff-table th, .diff-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.diff-table th {
  background: var(--bg-panel);
  color: var(--text-muted);
}

.diff-table tr.tampered-row {
  background: rgba(244, 63, 94, 0.08);
  color: #fb7185;
}

/* Synthesizer Cards */
.synthesizer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.synthesized-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.synthesized-card:hover {
  border-color: var(--border-medium);
}

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

/* Client Configs */
.client-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.client-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.client-tab-btn.active {
  background: var(--accent-primary-faint);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.config-target-row {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.target-label {
  margin-right: 6px;
}

.target-path {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent-primary);
  border: 1px solid var(--border-subtle);
}

.config-code-box {
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  position: relative;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 380px;
  overflow-y: auto;
}

.config-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.config-copy-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Shielded Fleet Cards */
.fleet-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ==============================================================
   Generic Buttons, Badges, Switches & Utilities
   ============================================================== */
.btn-primary {
  background: var(--accent-primary);
  color: #080a10;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.btn-danger {
  background: var(--accent-crimson-faint);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-crimson);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background: var(--accent-crimson);
  color: #fff;
}

.btn-sm {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.badge.green {
  background: var(--accent-emerald-faint);
  color: var(--accent-emerald);
}

.badge.red {
  background: var(--accent-crimson-faint);
  color: var(--accent-crimson);
}

.badge-enforce {
  background: var(--accent-crimson-faint);
  color: var(--accent-crimson);
  border: 1px solid rgba(244, 63, 94, 0.25);
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  transition: .2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-faint);
  border-radius: 50%;
  transition: .2s;
}

input:checked + .slider {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}

input:checked + .slider:before {
  transform: translateX(14px);
  background-color: #080a10;
}

.empty-state {
  color: var(--text-faint);
  font-size: 12px;
  padding: 12px;
  text-align: center;
}

/* Color Helper Classes */
.text-cyan { color: var(--accent-primary); }
.text-green { color: var(--accent-emerald); }
.text-crimson { color: var(--accent-crimson); }
.text-purple { color: var(--accent-purple); }

/* ==============================================================
   Fuzzer Empty State & Feature Badges
   ============================================================== */
.fuzzer-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-md);
  margin-top: 14px;
}

.fuzzer-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-primary-faint);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.fuzzer-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.fuzzer-empty-desc {
  max-width: 580px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.fuzzer-features-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.fuzzer-feature-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ==============================================================
   Mobile Menu Button & Drawer Backdrop
   ============================================================== */
.mobile-menu-btn {
  display: none;
  margin-right: 4px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* ==============================================================
   Responsive Layout & Media Breakpoints (Linear/Cloudflare Spec)
   ============================================================== */

/* 1. Large Laptops / Screens <= 1240px */
@media (max-width: 1240px) {
  .quick-scenarios {
    gap: 4px;
  }
  .scenario-label {
    display: none;
  }
  .btn-scenario span {
    display: none;
  }
  .btn-scenario {
    padding: 6px 9px;
  }
  .dashboard-split {
    grid-template-columns: 1fr 340px;
  }
}

/* 2. Compact Desktops & Tablets <= 1024px */
@media (max-width: 1024px) {
  .dashboard-split {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .tool-studio-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .tool-selector-panel {
    max-height: 260px;
  }
  .custom-rule-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .custom-rule-grid button {
    grid-column: span 2;
  }
  .synthesizer-grid {
    grid-template-columns: 1fr !important;
  }
  .connect-server-grid {
    grid-template-columns: 1fr !important;
  }
  .fleet-cards-grid {
    grid-template-columns: 1fr !important;
  }
  .scorecard-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* 3. Small Tablets & Rail Sidebar Mode <= 840px */
@media (max-width: 840px) {
  .mobile-menu-btn {
    display: flex;
  }
  .brand-tagline, .protocol-badge {
    display: none;
  }
  .aegis-sidebar {
    width: 60px;
    padding: 10px 6px;
    transition: width 0.2s ease;
  }
  .aegis-sidebar .nav-group-label,
  .aegis-sidebar .tab-text,
  .aegis-sidebar .sidebar-footer {
    display: none;
  }
  .nav-tab {
    justify-content: center;
    padding: 8px;
  }
  .nav-tab .tab-svg {
    margin: 0;
  }
}

/* 4. Mobile Viewports <= 640px */
@media (max-width: 640px) {
  .quick-scenarios {
    display: none;
  }
  .aegis-header {
    height: 48px;
    padding: 0 10px;
  }
  .version-tag {
    display: none;
  }
  .status-label {
    display: none;
  }
  .status-indicator {
    padding: 4px;
  }
  .btn-github span {
    display: none;
  }
  .btn-github {
    padding: 6px;
  }
  .aegis-sidebar {
    position: fixed;
    top: 48px;
    bottom: 0;
    left: 0;
    width: 240px !important;
    z-index: 90;
    background: var(--bg-surface);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.6);
    transform: translateX(-100%);
  }
  .aegis-sidebar.mobile-open {
    transform: translateX(0);
  }
  .aegis-sidebar.mobile-open .nav-group-label,
  .aegis-sidebar.mobile-open .tab-text,
  .aegis-sidebar.mobile-open .sidebar-footer {
    display: block;
  }
  .aegis-sidebar.mobile-open .nav-tab {
    justify-content: flex-start;
    padding: 8px 12px;
  }
  .aegis-sidebar.mobile-open .tab-svg {
    margin-right: 8px;
  }
  .aegis-stage {
    padding: 10px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .fuzzer-config-row {
    flex-direction: column;
    align-items: stretch !important;
  }
  .client-tabs {
    flex-wrap: wrap;
  }
  .scorecard-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .palette-modal {
    max-width: calc(100% - 24px);
    margin: 0 12px;
  }
  .palette-btn-text {
    display: none;
  }
  .sound-popover {
    right: -10px;
    width: 210px;
  }
}

/* ==============================================================
   Quick-Action Command Palette (Cmd+K / Ctrl+K)
   ============================================================== */
.palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: fadeInBackdrop 0.15s ease-out;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.palette-modal {
  width: 100%;
  max-width: 600px;
  background: #111420;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideDown {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.palette-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.palette-search-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.palette-search-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: 14px !important;
  color: var(--text-primary) !important;
  outline: none !important;
}

.palette-search-input::placeholder {
  color: var(--text-faint);
}

.palette-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.palette-close-btn kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
  color: var(--text-muted);
}

.palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette-category-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 10px 4px 10px;
}

.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

.palette-item:hover,
.palette-item.active-item {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

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

.palette-item-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.palette-item.active-item .palette-item-icon {
  color: var(--accent-primary);
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

.palette-item-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.palette-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-item-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-faint);
  flex-shrink: 0;
}

.palette-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.palette-footer {
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
}

.palette-shortcuts {
  display: flex;
  align-items: center;
  gap: 12px;
}

.palette-shortcut kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 1px 4px;
  margin-right: 3px;
  color: var(--text-secondary);
}

.palette-summary {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}
