/* RIVA — Mission Control Theme System */

/* ─── Dark Theme (default) ─── */
:root,
[data-theme="dark"] {
  --bg: #0a0e14;
  --bg-surface: #0f1419;
  --bg-card: #141a22;
  --bg-card-hover: #1a2230;
  --bg-elevated: #1c2433;
  --border: #1e2a3a;
  --border-subtle: #162030;
  --border-accent: #243447;
  --text: #d4dce8;
  --text-secondary: #8899aa;
  --text-dim: #5c6e80;
  --accent: #4da4ff;
  --accent-dim: rgba(77,164,255,0.12);
  --accent-glow: rgba(77,164,255,0.06);
  --green: #40d672;
  --green-dim: rgba(64,214,114,0.12);
  --yellow: #f0b429;
  --yellow-dim: rgba(240,180,41,0.12);
  --red: #f04e4e;
  --red-dim: rgba(240,78,78,0.12);
  --purple: #b48eff;
  --purple-dim: rgba(180,142,255,0.12);
  --orange: #e68a3a;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 6px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --sidebar-bg: #080c12;
  --sidebar-border: #1a2435;
  --sidebar-hover: rgba(77,164,255,0.08);
  --sidebar-active: rgba(77,164,255,0.14);
}

/* ─── Light Theme ─── */
[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-surface: #edf0f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f3f8;
  --bg-elevated: #ffffff;
  --border: #d8dde6;
  --border-subtle: #e4e8ef;
  --border-accent: #bfc8d4;
  --text: #1a2233;
  --text-secondary: #5a6a7e;
  --text-dim: #8896a7;
  --accent: #2b7de9;
  --accent-dim: rgba(43,125,233,0.10);
  --accent-glow: rgba(43,125,233,0.05);
  --green: #1fa855;
  --green-dim: rgba(31,168,85,0.10);
  --yellow: #d49a12;
  --yellow-dim: rgba(212,154,18,0.10);
  --red: #dc3545;
  --red-dim: rgba(220,53,69,0.10);
  --purple: #7c5cbf;
  --purple-dim: rgba(124,92,191,0.10);
  --orange: #c97328;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
  --sidebar-bg: #ffffff;
  --sidebar-border: #e4e8ef;
  --sidebar-hover: rgba(43,125,233,0.06);
  --sidebar-active: rgba(43,125,233,0.12);
}

/* System theme — follow OS preference */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg: #f5f7fa;
    --bg-surface: #edf0f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f3f8;
    --bg-elevated: #ffffff;
    --border: #d8dde6;
    --border-subtle: #e4e8ef;
    --border-accent: #bfc8d4;
    --text: #1a2233;
    --text-secondary: #5a6a7e;
    --text-dim: #8896a7;
    --accent: #2b7de9;
    --accent-dim: rgba(43,125,233,0.10);
    --accent-glow: rgba(43,125,233,0.05);
    --green: #1fa855;
    --green-dim: rgba(31,168,85,0.10);
    --yellow: #d49a12;
    --yellow-dim: rgba(212,154,18,0.10);
    --red: #dc3545;
    --red-dim: rgba(220,53,69,0.10);
    --purple: #7c5cbf;
    --purple-dim: rgba(124,92,191,0.10);
    --orange: #c97328;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
    --sidebar-bg: #ffffff;
    --sidebar-border: #e4e8ef;
    --sidebar-hover: rgba(43,125,233,0.06);
    --sidebar-active: rgba(43,125,233,0.12);
  }
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ─── App Layout ─── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: 220px;
  min-width: 220px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: 56px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  object-fit: contain;
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  transition: opacity 0.2s;
}

.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  color: var(--text);
  background: var(--sidebar-hover);
}

.sidebar.collapsed .sidebar-toggle {
  margin: 0 auto;
}
.sidebar.collapsed .sidebar-top {
  justify-content: center;
  padding: 16px 8px;
}
.sidebar.collapsed .sidebar-logo {
  display: none;
}

/* ─── Sidebar Nav ─── */
.sidebar-nav {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
}
.nav-item:hover {
  color: var(--text);
  background: var(--sidebar-hover);
}
.nav-item.active {
  color: var(--accent);
  background: var(--sidebar-active);
  border-color: rgba(77,164,255,0.15);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  stroke-width: 1.8;
}

.nav-label {
  transition: opacity 0.2s;
}

.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }

/* ─── Sidebar Bottom / Profile ─── */
.sidebar-bottom {
  padding: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
}
.sidebar-profile:hover {
  background: var(--sidebar-hover);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-avatar svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.profile-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.profile-role {
  font-size: 10.5px;
  color: var(--text-dim);
}

.sidebar.collapsed .profile-info { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-profile { justify-content: center; padding: 10px 0; }

/* ─── Mobile Sidebar ─── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ─── Settings Panel ─── */
.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  backdrop-filter: blur(2px);
}
.settings-overlay.open { display: block; }

.settings-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 301;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-panel.open {
  right: 0;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.settings-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.settings-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
}
.settings-close:hover {
  color: var(--text);
  background: var(--accent-dim);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.settings-section {
  margin-bottom: 24px;
}
.settings-section h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* ─── Theme Picker ─── */
.theme-picker {
  display: flex;
  gap: 8px;
}

.theme-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
}
.theme-option svg {
  width: 22px;
  height: 22px;
}
.theme-option:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  color: var(--text);
}
.theme-option.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(77,164,255,0.08);
}

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 28px 28px;
  max-width: 1480px;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Header ─── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1 span {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.live {
  background: var(--green);
  box-shadow: 0 0 6px rgba(64,214,114,0.5);
  animation: pulse-live 2s ease-in-out infinite;
}
.status-dot.offline { background: var(--red); box-shadow: 0 0 6px rgba(240,78,78,0.4); }

@keyframes pulse-live {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(64,214,114,0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 12px rgba(64,214,114,0.3); }
}

/* ─── Tab Panels ─── */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.25s ease; }

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

/* ─── Sections ─── */
section { margin-bottom: 28px; }
section h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: none;
}

/* ─── Tables ─── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-surface);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: color var(--transition);
}
th:hover { color: var(--text-secondary); }
th::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text-dim);
  opacity: 0;
  transition: opacity var(--transition);
}
th:hover::after { opacity: 0.4; }

td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  transition: background var(--transition);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-card-hover); }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}
.badge-running { background: var(--green-dim); color: var(--green); }
.badge-installed { background: var(--accent-dim); color: var(--accent); }
.badge-not_found { background: rgba(92,110,128,0.15); color: var(--text-dim); }

/* Severity badges */
.severity-critical { background: var(--red-dim); color: var(--red); font-weight: 700; border: 1px solid rgba(240,78,78,0.2); }
.severity-high { background: var(--red-dim); color: var(--red); }
.severity-medium { background: var(--yellow-dim); color: var(--yellow); }
.severity-low { background: var(--accent-dim); color: var(--accent); }
.severity-info { background: rgba(92,110,128,0.1); color: var(--text-dim); }

/* Network status */
.conn-established { color: var(--green); font-weight: 600; }
.conn-close-wait { color: var(--yellow); }
.conn-time-wait { color: var(--red); }

/* ─── Cards ─── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}
.card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}
.card-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}
.card-row .label { color: var(--text-dim); }
.card-row .value { color: var(--text); font-family: var(--font-mono); font-size: 12px; }

/* ─── Sparklines ─── */
.sparkline-container { margin-top: 12px; }
.sparkline-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
svg.sparkline { display: block; }

/* ─── Bar Charts ─── */
.bar-chart { margin-top: 8px; }
.bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  font-size: 12px;
}
.bar-label {
  width: 120px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11px;
}
.bar-track {
  flex: 1;
  height: 18px;
  background: var(--bg-surface);
  border-radius: 4px;
  margin: 0 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transition: width 0.4s var(--transition);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.bar-count {
  width: 40px;
  text-align: right;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ─── Accordion ─── */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  transition: border-color var(--transition);
}
.accordion:hover { border-color: var(--border-accent); }
.accordion + .accordion { margin-top: 6px; }
.accordion-header {
  padding: 11px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
  user-select: none;
  transition: background var(--transition);
}
.accordion-header:hover { background: var(--bg-card-hover); }
.accordion-arrow {
  transition: transform 0.25s ease;
  font-size: 10px;
  color: var(--text-dim);
}
.accordion.open .accordion-arrow { transform: rotate(90deg); }
.accordion-body { display: none; padding: 0 16px 16px; }
.accordion.open .accordion-body { display: block; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent-dim);
  border-color: rgba(77,164,255,0.3);
  color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: rgba(77,164,255,0.18);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(77,164,255,0.1);
}

/* ─── Empty State ─── */
.empty-msg {
  color: var(--text-dim);
  font-style: normal;
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
}

/* ─── Stat Cards ─── */
.stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0.5;
}
.stat-card:hover { border-color: var(--border-accent); box-shadow: var(--shadow-md); }
.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 4px;
}

/* ─── Footer ─── */
footer {
  margin-top: 32px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 11.5px;
}

/* ─── Timeline Bar ─── */
.timeline-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.timeline-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.timeline-live-btn {
  font-size: 10.5px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.timeline-live-btn.active {
  background: var(--green-dim);
  border-color: rgba(64,214,114,0.3);
  color: var(--green);
}
.timeline-play-btn {
  font-size: 10px;
  padding: 3px 8px;
  min-width: 28px;
  text-align: center;
}
.timeline-label {
  font-size: 11.5px;
  color: var(--text-dim);
  min-width: 140px;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 500;
}
.timeline-track {
  flex: 1;
  position: relative;
  height: 32px;
}
.timeline-buckets {
  display: flex;
  align-items: flex-end;
  height: 20px;
  gap: 1px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}
.timeline-bucket {
  flex: 1;
  background: rgba(77,164,255,0.2);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: background var(--transition);
}
.timeline-bucket.has-orphan {
  background: rgba(240,180,41,0.4);
}
.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  position: absolute;
  bottom: 0;
  left: 0;
}
.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px rgba(77,164,255,0.4);
  transition: box-shadow var(--transition);
}
.timeline-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 10px rgba(77,164,255,0.6);
}
.timeline-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

/* ─── Launch Type Colors ─── */
.launch-user_terminal { color: var(--green); }
.launch-ide { color: var(--accent); }
.launch-script { color: var(--yellow); }
.launch-system { color: var(--orange); }
.launch-unknown { color: var(--text-dim); }

/* ─── Forensic Timeline ─── */
.forensic-timeline {
  max-height: 600px;
  overflow-y: auto;
  padding: 4px 0;
}
.forensic-event {
  padding: 6px 10px;
  border-left: 2px solid var(--border-accent);
  margin-left: 10px;
  margin-bottom: 1px;
  font-size: 12px;
  font-family: var(--font-mono);
  transition: background var(--transition);
  border-radius: 0 4px 4px 0;
}
.forensic-event:hover { background: var(--accent-glow); }
.forensic-event.fail {
  border-left-color: var(--red);
  background: rgba(240,78,78,0.04);
}
.forensic-event.dead-end {
  border-left-color: var(--yellow);
  background: rgba(240,180,41,0.04);
}
.forensic-event-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.forensic-event-time {
  color: var(--text-dim);
  font-size: 10.5px;
  min-width: 60px;
}
.forensic-event-label {
  font-weight: 700;
  color: var(--accent);
  font-size: 11.5px;
}
.forensic-event-prompt {
  color: var(--text-secondary);
  padding-left: 68px;
  font-family: inherit;
  font-size: 11.5px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.forensic-action {
  padding-left: 68px;
  margin-left: 0;
  border-left: none;
}
.forensic-tool-name {
  color: var(--purple);
  font-weight: 700;
}
.forensic-back-btn { margin-bottom: 10px; }
.forensic-session-row { cursor: pointer; }
.forensic-session-row:hover td { background: var(--bg-card-hover); }

/* ─── Efficiency Bar ─── */
.efficiency-bar {
  width: 100px;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid var(--border-subtle);
}
.efficiency-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #6ddba7);
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ─── Connection Legend ─── */
.conn-legend {
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.conn-legend span { font-weight: 600; font-size: 11px; }

/* ─── Audit Actions ─── */
.audit-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -220px;
    top: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .sidebar.collapsed {
    left: -56px;
    width: 56px;
    min-width: 56px;
  }
  .sidebar.collapsed.mobile-open {
    left: 0;
  }
  .sidebar-backdrop.visible {
    display: block;
  }
  .main-content {
    padding: 0 16px 16px;
    width: 100%;
  }
  .card-grid { grid-template-columns: 1fr; }
  .stat-row { flex-direction: column; }
  .timeline-bar { flex-direction: column; align-items: stretch; }
  .timeline-label { min-width: auto; }
}
