/* OmniSight Command Center Stylesheet
   Premium, enterprise-grade dark/light mode system dashboard. */

:root {
  --bg-hue: 226;
  --bg-sat: 45%;
  --bg: hsl(var(--bg-hue), var(--bg-sat), 5%);
  --bg-card: hsl(var(--bg-hue), 35%, 8%);
  --panel: hsl(var(--bg-hue), 30%, 10%);
  --panel-light: hsl(var(--bg-hue), 25%, 13%);
  --glass: hsla(var(--bg-hue), 30%, 8%, 0.75);
  --line: hsla(var(--bg-hue), 20%, 25%, 0.4);
  --line-glowing: hsla(188, 86%, 53%, 0.35);
  --text: hsl(0, 0%, 98%);
  --muted: hsl(var(--bg-hue), 15%, 68%);
  --soft: hsl(var(--bg-hue), 20%, 84%);
  
  /* Semantic Colors */
  --cyan: hsl(188, 86%, 53%);
  --cyan-glow: hsla(188, 86%, 53%, 0.15);
  --blue: hsl(207, 95%, 55%);
  --blue-glow: hsla(207, 95%, 55%, 0.15);
  --violet: hsl(265, 88%, 64%);
  --violet-glow: hsla(265, 88%, 64%, 0.15);
  --green: hsl(142, 70%, 48%);
  --green-glow: hsla(142, 70%, 48%, 0.15);
  --yellow: hsl(45, 93%, 50%);
  --yellow-glow: hsla(45, 93%, 50%, 0.15);
  --red: hsl(350, 89%, 60%);
  --red-glow: hsla(350, 89%, 60%, 0.15);
  --orange: hsl(24, 95%, 55%);
  
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --radius: 20px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  transition: background-color 0.2s, border-color 0.2s, color 0.1s;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: 
    radial-gradient(circle at 10% 0%, hsla(207, 95%, 55%, 0.08) 0, transparent 40%),
    radial-gradient(circle at 90% 10%, hsla(265, 88%, 64%, 0.06) 0, transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Outfit', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

button, input, textarea, select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

/* Authentication Screen */
.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 10% 0%, #0c1224 0%, #030712 100%);
  z-index: 1000;
}

body.light .auth-screen {
  background: radial-gradient(circle at 10% 0%, #f1f5f9 0%, #cbd5e1 100%);
}

.auth-card {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  border-radius: var(--radius);
  padding: 40px;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  animation: modalIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.light .auth-card {
  background: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.06);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-lockup.center {
  grid-column: 1/-1;
  justify-content: center;
  margin-bottom: 8px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #030712;
  font-weight: 900;
  font-size: 20px;
  box-shadow: 0 8px 24px rgba(103, 232, 249, 0.3);
}

.brand-lockup h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-lockup p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.auth-hero {
  padding: 36px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-hero h2 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  margin: 16px 0;
  color: #ffffff !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  background-clip: initial !important;
  -webkit-text-fill-color: initial !important;
}

.auth-hero p {
  color: #94a3b8 !important;
  font-size: 14px;
  line-height: 1.6;
}

.hero-chip {
  align-self: start;
  border: 1px solid rgba(103, 232, 249, 0.35);
  background: rgba(103, 232, 249, 0.08);
  border-radius: 99px;
  padding: 6px 12px;
  color: var(--cyan);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-card label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.auth-card input {
  background: rgba(0, 0, 0, 0.2) !important;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  width: 100%;
  margin-top: 6px;
  font-size: 14px;
}

body.light .auth-card input {
  background: #f8fafc !important;
  border-color: #cbd5e1;
  color: #0f172a;
}

.auth-card button[type="submit"] {
  margin-top: 10px;
  height: 48px;
  border-radius: 12px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.auth-foot {
  grid-column: 1/-1;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 8px;
}

.auth-foot a {
  color: var(--cyan);
}
body.light .auth-foot a {
  color: #2563eb;
}
.auth-foot a:hover {
  text-decoration: underline;
}

/* App Shell Structure */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, #030712 0%, #070b16 100%);
  border-right: 1px solid var(--line);
  z-index: 10;
  overflow-y: auto;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  display: flex;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 4px solid transparent;
}

.nav-item span {
  width: 20px;
  color: var(--muted);
  font-size: 16px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(103, 232, 249, 0.12) 0%, rgba(103, 232, 249, 0.02) 100%);
  color: var(--cyan);
  border-left-color: var(--cyan);
  padding-left: 12px;
  box-shadow: inset 0 0 12px rgba(103, 232, 249, 0.05);
}

.nav-item.active span {
  color: var(--cyan);
}

.side-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 16px;
}

.side-card-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 12px;
}

.loop-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loop-list span {
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(103, 232, 249, 0.15);
  background: rgba(103, 232, 249, 0.04);
  color: var(--cyan);
  padding: 4px 8px;
  border-radius: 99px;
  text-transform: uppercase;
}

.sidebar-footer {
  margin-top: auto;
}

.user-pill {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--soft);
}
.user-pill b {
  color: var(--text);
  font-size: 13px;
}

/* Main Panel Dashboard */
.main {
  padding: 20px;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 100;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar h2 {
  margin: 2px 0 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.global-search {
  height: 40px;
  width: min(320px, 30vw);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.global-search:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.global-search span {
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.global-search input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
  outline: 0;
  width: 100%;
  font-size: 14px;
  height: 100%;
  padding: 0;
}

/* Buttons */
.btn {
  height: 40px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--cyan);
  box-shadow: 0 4px 12px var(--cyan-glow);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--cyan), hsl(188, 86%, 40%));
  color: #030712;
  border: 0;
  font-weight: 700;
}
.btn.primary:hover {
  box-shadow: 0 4px 18px rgba(103, 232, 249, 0.45);
}

.btn.accent {
  background: linear-gradient(135deg, var(--violet), hsl(265, 88%, 50%));
  color: var(--text);
  border: 0;
  font-weight: 700;
}
.btn.accent:hover {
  box-shadow: 0 4px 18px rgba(167, 139, 250, 0.45);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.03);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn.wide {
  width: 100%;
}

/* Views & Dynamic Transitions */
.view {
  display: none;
  animation: viewFade 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view.active {
  display: block;
}

@keyframes viewFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Panels */
.panel {
  background: linear-gradient(180deg, hsl(var(--bg-hue), 30%, 9%), hsl(var(--bg-hue), 25%, 7%));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.panel.compact {
  padding: 16px;
}

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

.panel h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.panel h4 {
  margin: 16px 0 8px;
  font-weight: 700;
  font-size: 15px;
}

.panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Grids */
.content-grid {
  display: grid;
  gap: 24px;
}

.content-grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.content-grid.two-one {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
}

.content-grid.master-detail {
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.25fr);
}

.sticky-detail {
  position: sticky;
  top: 112px;
  align-self: start;
}

/* KPI Visualization Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, hsl(var(--bg-hue), 30%, 8%), hsl(var(--bg-hue), 20%, 6%));
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--glow, var(--cyan-glow));
  filter: blur(20px);
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 36px;
  font-weight: 900;
  margin-top: 10px;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--text), var(--soft));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.kpi-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  position: relative;
  z-index: 2;
}

/* Dynamic Cards / Item Stack */
.stack {
  display: grid;
  gap: 12px;
}

.small-stack {
  max-height: 400px;
  overflow-y: auto;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.item-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-sm);
  padding: 16px;
  transition: all 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.item-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.item-card.active-card {
  border-color: var(--cyan);
  background: rgba(103, 232, 249, 0.02);
}

.item-card h4 {
  margin: 10px 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.item-card p {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0;
}

/* Incident Specific Cards */
.incident-card {
  cursor: pointer;
}
.incident-card.active-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  bottom: 15px;
  width: 4px;
  background: var(--cyan);
  border-radius: 0 4px 4px 0;
}

/* Badge System */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.high, .badge.critical {
  background: var(--red-glow);
  border-color: rgba(251, 113, 133, 0.3);
  color: #fca5a5;
}

.badge.medium {
  background: var(--yellow-glow);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fde047;
}

.badge.low {
  background: var(--green-glow);
  border-color: rgba(52, 211, 153, 0.25);
  color: #86efac;
}

.badge.open {
  background: var(--green-glow);
  border-color: rgba(52, 211, 153, 0.25);
  color: #86efac;
}

.badge.acknowledged {
  background: var(--cyan-glow);
  border-color: rgba(103, 232, 249, 0.25);
  color: var(--cyan);
}

.badge.resolved, .badge.closed {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--muted);
}

.badge.audit {
  background: var(--violet-glow);
  border-color: rgba(167, 139, 250, 0.25);
  color: var(--violet);
}

.muted {
  color: var(--muted) !important;
}

.mono {
  font-family: 'JetBrains Mono', Consolas, 'Fira Code', monospace;
  letter-spacing: -0.02em;
}

/* Empty States */
.empty-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px;
  background: rgba(0, 0, 0, 0.15);
}

/* Timeline Components */
.timeline {
  position: relative;
  display: grid;
  gap: 16px;
  padding-left: 20px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-glow);
  z-index: 2;
}

.timeline-body {
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.timeline-body b {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}

.timeline-body span {
  color: var(--muted);
  font-size: 12px;
}

/* Architecture Health Map */
.health-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.health-card {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.health-card::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  position: absolute;
  top: 14px;
  right: 14px;
}

.health-card b {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

/* Forms & Filters UI */
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.filter-group, .toolbar-actions, .filter-inline {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, textarea, select {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.span-2 {
  grid-column: 1/-1;
}

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

/* Multimodal Emitter Grid */
.emit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.emit-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, hsl(var(--bg-hue), 30%, 8%), hsl(var(--bg-hue), 25%, 5%));
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.emit-card b {
  display: block;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--cyan);
}

.emit-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  display: block;
}

.emit-card:hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--cyan-glow);
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--cyan-glow);
  border: 1px solid rgba(103, 232, 249, 0.2);
  color: var(--cyan);
  border-radius: 99px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  background: var(--bg-card);
}

th, td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: hsl(var(--bg-hue), 35%, 6%);
}

td {
  font-size: 13px;
  color: var(--soft);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

pre, .code {
  white-space: pre-wrap;
  word-break: break-all;
  background: #020617 !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: #93c5fd;
  font-size: 12px;
  max-height: 400px;
  overflow: auto;
}

.results .item-card {
  border-color: rgba(103, 232, 249, 0.18);
}

/* Interactive Tabs for War Room Workspace */
.detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.tab-content {
  display: none;
  animation: tabFadeIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tab-content.active {
  display: block;
}

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

/* Mitigation Playbook Interactive Checklist */
.playbook-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.playbook-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.playbook-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}
body.light .playbook-item {
  background: #ffffff;
  border-color: var(--line);
}
body.light .playbook-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.playbook-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  margin: 0;
}
.playbook-item input[type="checkbox"]:checked {
  background: var(--green) !important;
  border-color: var(--green) !important;
}
.playbook-item input[type="checkbox"]:checked::after {
  content: "✓";
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}
body.light .playbook-item input[type="checkbox"] {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.playbook-item span {
  font-weight: 600;
  font-size: 13px;
}

.playbook-item.checked {
  border-color: var(--green-glow);
  background: rgba(52, 211, 153, 0.02);
  text-decoration: line-through;
  color: var(--muted);
}

/* Threat Assessment Gauge */
.threat-scale {
  display: flex;
  gap: 4px;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.threat-bar {
  flex: 1;
  background: var(--line);
}
.threat-bar.filled-low { background: var(--green); }
.threat-bar.filled-med { background: var(--yellow); }
.threat-bar.filled-high { background: var(--red); }

/* Interactive Agent Pipeline Map */
.agent-pipeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 16px 0 24px;
  position: relative;
}

.agent-node {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
  z-index: 2;
  overflow: hidden;
}

.agent-node b {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--soft);
}

.agent-node span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.3;
}

.agent-node::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
}

/* Pipeline States */
.agent-node.completed {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.04);
}
.agent-node.completed b {
  color: var(--green);
}

.agent-node.active {
  border-color: rgba(103, 232, 249, 0.55);
  background: rgba(103, 232, 249, 0.08);
  box-shadow: 0 0 16px rgba(103, 232, 249, 0.25);
  transform: translateY(-2px);
}
.agent-node.active b {
  color: var(--cyan);
}
.agent-node.active::after {
  border-color: var(--cyan);
  animation: nodePulse 1.6s infinite;
}

@keyframes nodePulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.08); opacity: 0; }
}

/* Custom Live Terminal Log in Agent Trace */
.agent-terminal {
  background: #020617;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #a7f3d0;
  font-size: 12px;
  min-height: 160px;
  max-height: 240px;
  overflow-y: auto;
}
.agent-terminal .log-ln {
  margin: 4px 0;
  opacity: 0.85;
}
.agent-terminal .log-ln.info { color: #67e8f9; }
.agent-terminal .log-ln.success { color: #34d399; }
.agent-terminal .log-ln.warning { color: #fde047; }
.agent-terminal .log-ln.error { color: #fca5a5; }

/* Interactive SVG Knowledge Graph Dashboard */
.graph-canvas {
  min-height: 540px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at center, hsl(var(--bg-hue), 35%, 8%), #030712 70%);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.graph-canvas svg {
  width: 100%;
  height: 540px;
  cursor: grab;
}
.graph-canvas svg:active {
  cursor: grabbing;
}

.graph-node {
  cursor: pointer;
}
.graph-node circle {
  transition: r 0.2s ease, fill-opacity 0.2s ease;
}
.graph-node:hover circle:first-of-type {
  r: 25;
  fill-opacity: 1;
}

.node-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.edge-label {
  fill: var(--muted);
  font-size: 8px;
  font-weight: 500;
  text-anchor: middle;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.graph-canvas.dimmed .graph-node:not(.highlighted) {
  opacity: 0.15;
}
.graph-canvas.dimmed line:not(.highlighted) {
  opacity: 0.05;
}

.graph-canvas line.highlighted {
  stroke: var(--cyan) !important;
  stroke-width: 2.5px !important;
}

/* Metric Bars */
.metric-bars {
  display: grid;
  gap: 16px;
}

.metric-row {
  display: grid;
  grid-template-columns: 160px 1fr 80px;
  align-items: center;
  gap: 12px;
  color: var(--soft);
  font-size: 13px;
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 1px solid var(--line);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.link-grid a {
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--cyan);
  font-weight: 700;
  text-align: center;
}

.link-grid a:hover {
  border-color: var(--cyan);
  background: rgba(103, 232, 249, 0.03);
}

/* Toast Alerts */
.toast-host {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  display: grid;
  gap: 12px;
}

.toast {
  width: min(380px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  animation: toastIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  color: var(--text);
}

.toast b {
  font-size: 14px;
  display: block;
  margin-bottom: 4px;
}

.toast div {
  font-size: 13px;
  color: var(--soft);
}

.toast.error {
  border-left-color: var(--red);
}
.toast.error b {
  color: var(--red);
}

.toast.success {
  border-left-color: var(--green);
}
.toast.success b {
  color: var(--green);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 5000;
  padding: 24px;
}

.modal {
  width: min(900px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-head {
  position: sticky;
  top: 0;
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  z-index: 10;
}

.modal-body {
  padding: 24px;
}

.modal h3 {
  margin: 0;
  font-size: 18px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.icon-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Spotlight Command Palette */
.spotlight {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 6000;
  display: grid;
  place-items: start center;
  padding-top: 10vh;
}

.spotlight-card {
  width: min(720px, calc(100vw - 32px));
  border-radius: var(--radius);
  overflow: hidden;
  animation: modalIn 0.25s ease;
}

.spotlight-input {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
  color: var(--cyan);
}

.spotlight-input input {
  border: 0;
  background: transparent;
  font-size: 16px;
  width: 100%;
  box-shadow: none;
  color: var(--text);
}

.spotlight-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.spotlight-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.spotlight-item:hover, .spotlight-item.active {
  background: rgba(103, 232, 249, 0.08);
}

.spotlight-item b {
  display: block;
  font-size: 14px;
}

.spotlight-item span {
  font-size: 12px;
  color: var(--muted);
}

.spotlight-help {
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  color: var(--muted);
  font-size: 12px;
}

.kbd {
  font-family: ui-monospace, monospace;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--muted);
  font-size: 11px;
}

/* Insight Cards & Sparklines */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.insight-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(103, 232, 249, 0.05), rgba(167, 139, 250, 0.03));
  border-radius: var(--radius);
  padding: 16px;
}

.insight-card b {
  font-size: 14px;
  font-weight: 700;
  display: block;
}

.insight-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}

.spark-wrap {
  height: 80px;
  margin-top: 12px;
}

.spark-wrap canvas {
  width: 100%;
  height: 100%;
}

/* Advanced UX styling layers */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent, rgba(103, 232, 249, 0.03), transparent);
  transform: translateX(-100%);
  animation: sheen 10s infinite;
  z-index: 100;
}

@keyframes sheen {
  50% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* Light Theme Variables & Overrides */
body.light {
  --bg: hsl(226, 30%, 96%);
  --bg-card: hsl(226, 25%, 98%);
  --panel: hsl(226, 20%, 100%);
  --panel-light: hsl(226, 15%, 95%);
  --glass: rgba(255, 255, 255, 0.85);
  --line: hsl(226, 15%, 88%);
  --text: hsl(226, 40%, 10%);
  --muted: hsl(226, 12%, 48%);
  --soft: hsl(226, 15%, 28%);
  --shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  background: radial-gradient(circle at 10% 0%, #dbeafe 0%, #f1f5f9 40%), #f1f5f9;
}

body.light .sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-right-color: #e2e8f0;
}

body.light .nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.01) 100%);
  color: #2563eb;
  border-left-color: #2563eb;
}

body.light .panel, 
body.light .item-card, 
body.light table, 
body.light .timeline-body, 
body.light .health-card, 
body.light .global-search, 
body.light input, 
body.light textarea, 
body.light select,
body.light .playbook-item,
body.light .link-grid a {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

body.light .kpi {
  background: linear-gradient(145deg, var(--bg-card), var(--panel));
  border-color: var(--line);
}

body.light .kpi-value {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: initial;
  color: var(--text);
}

body.light .emit-card {
  background: linear-gradient(145deg, var(--bg-card), var(--panel));
  border-color: var(--line);
}

body.light .emit-card b {
  color: hsl(207, 95%, 45%);
}

body.light .emit-card span {
  color: var(--muted);
}

body.light .btn.secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
  border-color: var(--line);
}

body.light .btn.secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.light .btn.ghost {
  color: var(--text);
}

body.light .btn.ghost:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.light .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.light .user-pill {
  background: #ffffff;
  border-color: var(--line);
}

body.light .agent-node {
  background: var(--bg-card);
  border-color: var(--line);
}

body.light .agent-node b {
  color: var(--soft);
}

body.light .agent-node.completed {
  background: rgba(52, 211, 153, 0.08);
  border-color: var(--green);
}

body.light .agent-node.active {
  background: rgba(103, 232, 249, 0.15);
  border-color: var(--cyan);
}

body.light .graph-canvas {
  background: radial-gradient(circle at center, rgba(103, 232, 249, 0.15), var(--bg) 70%);
  border-color: var(--line);
}

body.light .graph-canvas line {
  stroke: var(--line);
}

body.light .graph-canvas marker path {
  fill: var(--line);
}

body.light .btn.secondary {
  background: var(--panel-light);
  border-color: var(--line);
}

body.light .btn.ghost:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.light .empty-state {
  background: rgba(0, 0, 0, 0.02);
  border-color: var(--line);
}

body.light th {
  background: hsl(226, 15%, 93%);
  color: var(--muted);
}

body.light td {
  color: var(--soft);
}

body.light .topic {
  background: rgba(103, 232, 249, 0.15);
  border-color: rgba(103, 232, 249, 0.3);
  color: hsl(207, 95%, 45%);
}

/* Light Theme Badges Contrast */
body.light .badge {
  background: rgba(0, 0, 0, 0.04);
  color: var(--soft);
  border-color: var(--line);
}

body.light .badge.acknowledged {
  background: rgba(103, 232, 249, 0.2);
  color: hsl(207, 95%, 45%);
  border-color: rgba(103, 232, 249, 0.4);
}

body.light .kpi-sparkline {
  opacity: 0.18;
}

body.light .badge.high, body.light .badge.critical {
  background: rgba(251, 113, 133, 0.15);
  color: hsl(350, 89%, 45%);
  border-color: rgba(251, 113, 133, 0.3);
}

body.light .badge.medium {
  background: rgba(251, 191, 36, 0.15);
  color: hsl(35, 90%, 35%);
  border-color: rgba(251, 191, 36, 0.3);
}

body.light .badge.low, body.light .badge.open {
  background: rgba(52, 211, 153, 0.12);
  color: hsl(142, 70%, 25%);
  border-color: rgba(52, 211, 153, 0.25);
}

body.light .pre, body.light .code, body.light .agent-terminal {
  background: #0f172a !important;
  color: #e2e8f0;
}

/* Compact layout mode settings */
body.compact {
  --radius: 12px;
}
body.compact .panel {
  padding: 16px;
  margin-bottom: 16px;
}
body.compact .item-card {
  padding: 12px;
}
body.compact .topbar {
  padding: 12px 20px;
}
body.compact .main {
  padding: 20px;
}

.fade-in-up {
  animation: fadeUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pulse-ring {
  position: relative;
}
.pulse-ring::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid rgba(103, 232, 249, 0.55);
  animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
  to {
    opacity: 0;
    transform: scale(1.12);
  }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  min-height: 80px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: skel 1.2s infinite;
}

@keyframes skel {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.progress-strip {
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--green));
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  z-index: 10000;
  transition: width 0.25s ease, opacity 0.25s ease;
}
.progress-strip.done {
  opacity: 0;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive Styles */
#logoutBtn span {
  margin-right: 8px;
  color: var(--red);
  font-size: 16px;
  transition: transform 0.2s;
}
#logoutBtn:hover span {
  transform: translateX(-2px);
}

/* Cockpit Header and Detail Action wraps */
.top-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Sidebar slide-out overlay backdrop */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  transition: opacity 0.3s ease;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 9999;
    border-right: 1px solid var(--line);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.3);
  }
  
  body.light .sidebar {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border-right-color: #e2e8f0;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  #consoleMobileMenuBtn {
    display: flex !important;
  }
  
  .main {
    padding: 12px;
  }
  
  .topbar {
    position: sticky;
    top: 0;
    padding: 8px 12px;
    margin-bottom: 12px;
    z-index: 100;
  }
  
  .top-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
    align-items: flex-start;
  }
  
  .top-buttons {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .top-buttons::-webkit-scrollbar {
    display: none;
  }
  
  .global-search {
    width: 100%;
    min-width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
  }
  
  .playground-grid {
    grid-template-columns: 1fr;
  }
  
  .content-grid.two-one, 
  .content-grid.master-detail, 
  .content-grid.two {
    grid-template-columns: 1fr;
  }
  
  .sticky-detail {
    position: static;
  }
  
  .agent-pipeline {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .emit-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .auth-card {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 20px;
  }
  
  .auth-hero {
    display: none;
  }

  .graph-layout-grid {
    grid-template-columns: 1fr !important;
  }

  .insight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .top-actions {
    justify-content: flex-start;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .agent-pipeline {
    grid-template-columns: 1fr;
  }
  
  .modal {
    width: 100%;
    max-height: 95vh;
  }
  
  .modal-body {
    padding: 16px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  #customEventForm > div {
    grid-template-columns: 1fr !important;
  }

  .metric-row {
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
  }
  .metric-row .bar {
    grid-column: 1 / -1;
    order: 3;
    margin-top: 4px;
  }
  .metric-row span {
    text-align: right;
  }

  .feed-header .cam-id {
    display: none;
  }
}

/* Additional Light Theme Accessibility Overrides */
body.light .tab-btn.active {
  color: hsl(207, 95%, 45%);
  border-bottom-color: hsl(207, 95%, 45%);
}

body.light .spotlight-input {
  color: hsl(207, 95%, 45%);
}

/* Premium CCTV Camera Feed HUD */
.camera-feed {
  position: relative;
  width: 100%;
  height: 240px;
  background: #020617;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
  margin-top: 12px;
}
.scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.22) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.04),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.04)
  );
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 5;
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(103, 232, 249, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103, 232, 249, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 2;
}
.feed-header {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 1px 4px #000;
}
.live-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--red);
  margin-right: 6px;
  display: inline-block;
}
.pulse-dot {
  animation: liveBlink 1.4s infinite;
}
@keyframes liveBlink {
  50% { opacity: 0.2; }
}
.feed-content {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.target-box {
  position: absolute;
  width: 160px;
  height: 110px;
  border: 1px dashed var(--red);
  background: rgba(239, 68, 68, 0.03);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.08);
  animation: targetPulse 2.2s infinite ease-in-out;
  transform: translate(-10px, 10px);
}
@keyframes targetPulse {
  50% { border-color: var(--yellow); background: rgba(245, 158, 11, 0.03); }
}
.target-label {
  position: absolute;
  top: -18px;
  left: 0;
  background: var(--red);
  color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  padding: 2px 6px;
  font-weight: bold;
  white-space: nowrap;
}
.confidence {
  position: absolute;
  bottom: 4px;
  right: 6px;
  color: var(--yellow);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  font-weight: 700;
}
.target-corner {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid var(--red);
}
.target-corner.top-left { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.target-corner.top-right { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
.target-corner.bottom-left { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
.target-corner.bottom-right { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

.crosshair {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 50%;
  position: relative;
}
.crosshair::before, .crosshair::after {
  content: "";
  position: absolute;
  background: rgba(103, 232, 249, 0.2);
}
.crosshair::before { left: 50%; top: -6px; bottom: -6px; width: 1px; }
.crosshair::after { top: 50%; left: -6px; right: -6px; height: 1px; }

.telemetry-bar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  color: var(--cyan);
  text-shadow: 0 1px 3px #000;
}

/* CCTV HUD Scanner effect */
.camera-feed .scanner {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  box-shadow: 0 0 10px var(--red);
  animation: scanMove 4s infinite linear;
  z-index: 6;
  opacity: 0.85;
}
@keyframes scanMove {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}

/* KPI Card Sparklines */
.kpi-sparkline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  width: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.45;
}
.kpi-label, .kpi-value, .kpi-sub {
  position: relative;
  z-index: 2;
}

/* Ingestion API Playground */
.playground-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
}
.playground-response {
  background: #020617;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: #34d399;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 280px;
  max-height: 320px;
  overflow-y: auto;
}
.response-header-val {
  color: #a78bfa;
}
.curl-code {
  color: #38bdf8;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 10px;
  word-break: break-all;
  white-space: pre-wrap;
}

/* RAG Chunk Grid Visualizer */
.chunk-grid-container {
  margin-top: 20px;
}
.chunk-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.chunk-block {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.chunk-block:hover {
  transform: scale(1.2);
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}
.chunk-block.matched-chunk {
  background: var(--cyan-glow);
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(103, 232, 249, 0.4);
}
.chunk-tooltip {
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  background: #020617;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 10.5px;
  color: var(--soft);
  z-index: 1000;
  pointer-events: none;
  box-shadow: var(--shadow);
  display: none;
  text-align: left;
  line-height: 1.4;
}
.chunk-block:hover .chunk-tooltip {
  display: block;
}

/* Enterprise Graph Layout Drawer */
.graph-layout-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}
.graph-drawer {
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 540px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.drawer-search {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.15);
}
.drawer-search input {
  border: 0;
  background: transparent;
  outline: 0;
  font-size: 13px;
  width: 100%;
  color: var(--text);
}
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 4px;
}
.drawer-tab-btn {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}
.drawer-tab-btn:hover {
  color: var(--text);
}
.drawer-tab-btn.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}
.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

/* Light theme support overrides for new components */
body.light .playground-response {
  background: #0f172a;
}
body.light .chunk-block {
  background: rgba(0, 0, 0, 0.02);
}
body.light .chunk-block:hover {
  border-color: var(--blue);
}
body.light .chunk-block.matched-chunk {
  background: var(--blue-glow);
  border-color: var(--blue);
}
body.light .chunk-tooltip {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}
body.light .graph-drawer {
  background: var(--panel);
}
body.light .drawer-search {
  background: var(--bg-card);
}
body.light .drawer-tab-btn.active {
  color: hsl(207, 95%, 45%);
  border-bottom-color: hsl(207, 95%, 45%);
}

/* AI Chat Card Styles */
.ai-chat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  margin-bottom: 24px;
}
.ai-chat-header {
  padding: 16px 20px;
  background: rgba(103, 232, 249, 0.05);
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #000;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
}
.ai-chat-body {
  padding: 24px 20px;
}
.ai-summary-box {
  background: linear-gradient(145deg, rgba(16, 24, 45, 0.6), rgba(12, 18, 34, 0.6));
  border-left: 3px solid var(--cyan);
  padding: 16px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 16px;
}
body.light .ai-chat-card {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}
body.light .ai-summary-box {
  background: rgba(103, 232, 249, 0.05);
}
