/* ==========================================================================
   INCUBA-PULSE MISSION CONTROL STYLESHEET
   Cyber-Physical Precision Avian Incubator IoT Dashboard
   Aesthetic: Double-Bezel (Doppelrand) Scientific Telemetry & Titanium/Ceramic Symmetry
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES & DUAL-THEME TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Dark Mode: Titanium Mission-Control OLED */
  --bg-body: #06080d;
  --bg-surface: #0b0f17;
  --bg-card: rgba(13, 18, 27, 0.85);
  --bg-card-inner: #111723;
  --bg-tile: #151d2c;
  --bg-subtle: rgba(255, 255, 255, 0.03);
  --bg-elevated: #1a2234;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-highlight: rgba(6, 182, 212, 0.45);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Telemetry Accents */
  --accent-cyan: #06b6d4;
  --accent-cyan-rgb: 6, 182, 212;
  --accent-temp: #f97316;
  --accent-temp-rgb: 249, 115, 22;
  --accent-humid: #0ea5e9;
  --accent-humid-rgb: 14, 165, 233;
  --accent-green: #10b981;
  --accent-green-rgb: 16, 185, 129;
  --accent-amber: #f59e0b;
  --accent-amber-rgb: 245, 158, 11;
  --accent-rose: #f43f5e;
  --accent-rose-rgb: 244, 63, 94;
  --accent-violet: #8b5cf6;

  /* Shadows & Depth */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-lg: 0 10px 25px -4px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-glow-cyan: 0 0 24px -2px rgba(6, 182, 212, 0.25);
  --shadow-glow-temp: 0 0 24px -2px rgba(249, 115, 22, 0.35);

  /* Geometry & Physics */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --trans-fast: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --trans-normal: 260ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Chart Colors (Dark) */
  --chart-grid: rgba(255, 255, 255, 0.06);
  --chart-tick: #64748b;
  --chart-tooltip-bg: rgba(11, 15, 23, 0.95);
  --chart-tooltip-border: rgba(255, 255, 255, 0.15);
}

/* --------------------------------------------------------------------------
   Light Mode Override: Ceramic High-Contrast Laboratory
   -------------------------------------------------------------------------- */
[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-inner: #f1f5f9;
  --bg-tile: #e2e8f0;
  --bg-subtle: rgba(0, 0, 0, 0.02);
  --bg-elevated: #ffffff;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  --border-highlight: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  /* Telemetry Accents (High Contrast WCAG AAA) */
  --accent-cyan: #0284c7;
  --accent-cyan-rgb: 2, 132, 199;
  --accent-temp: #ea580c;
  --accent-temp-rgb: 234, 88, 12;
  --accent-humid: #0284c7;
  --accent-humid-rgb: 2, 132, 199;
  --accent-green: #059669;
  --accent-green-rgb: 5, 150, 105;
  --accent-amber: #d97706;
  --accent-amber-rgb: 217, 119, 6;
  --accent-rose: #e11d48;
  --accent-rose-rgb: 225, 29, 72;
  --accent-violet: #7c3aed;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.12);
  --shadow-glow-cyan: 0 0 20px -2px rgba(2, 132, 199, 0.15);
  --shadow-glow-temp: 0 0 20px -2px rgba(234, 88, 12, 0.15);

  /* Chart Colors (Light) */
  --chart-grid: rgba(0, 0, 0, 0.06);
  --chart-tick: #475569;
  --chart-tooltip-bg: rgba(255, 255, 255, 0.98);
  --chart-tooltip-border: rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & BASE TYPOGRAPHY
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--trans-normal), color var(--trans-normal);
}

code, kbd, samp, pre {
  font-family: 'JetBrains Mono', monospace;
}

/* --------------------------------------------------------------------------
   3. AMBIENT ATMOSPHERIC BACKDROPS
   -------------------------------------------------------------------------- */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(140px);
  z-index: 0;
  opacity: 0.18;
  transition: opacity var(--trans-normal);
}

[data-theme="light"] .ambient-glow {
  opacity: 0.07;
}

.glow-cyan {
  width: 550px;
  height: 550px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
}

.glow-emerald {
  width: 600px;
  height: 600px;
  top: 30%;
  right: -150px;
  background: radial-gradient(circle, var(--accent-green) 0%, transparent 70%);
}

.glow-amber {
  width: 500px;
  height: 500px;
  bottom: -100px;
  left: 25%;
  background: radial-gradient(circle, var(--accent-temp) 0%, transparent 70%);
}

/* --------------------------------------------------------------------------
   4. APP SHELL LAYOUT
   -------------------------------------------------------------------------- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .app-shell {
    padding: 0.75rem 0.75rem 2rem 0.75rem;
    gap: 1rem;
  }
}

/* --------------------------------------------------------------------------
   5. FLOATING ISLAND NAVIGATION BAR
   -------------------------------------------------------------------------- */
.navbar-wrapper {
  position: sticky;
  top: 0.75rem;
  z-index: 100;
  width: 100%;
}

.island-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.2rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  transition: all var(--trans-normal);
}

/* Brand Group */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-badge-orb {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent-cyan);
  opacity: 0.4;
  animation: orbPulse 3s infinite ease-in-out;
}

.orb-core {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(var(--accent-cyan-rgb), 0.25), rgba(var(--accent-green-rgb), 0.2));
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  box-shadow: 0 0 12px rgba(var(--accent-cyan-rgb), 0.3);
}

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

.brand-headings {
  display: flex;
  flex-direction: column;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-accent {
  color: var(--accent-cyan);
}

.brand-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  background: rgba(var(--accent-cyan-rgb), 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.3);
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.brand-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Center Status Capsule */
.nav-status-capsule {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.95rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  position: relative;
}

.status-dot.pulse-online::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-green);
  animation: dotRing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-dot.pulse-dormant {
  background-color: var(--accent-amber);
}

.status-dot.pulse-dormant::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--accent-amber);
  animation: dotRing 3s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes dotRing {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

.status-text {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}

.status-cadence {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  border-left: 1px solid var(--border-medium);
  padding-left: 0.6rem;
}

/* Action Controls */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--trans-fast);
}

.btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tile);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-card-inner);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  transform: translateY(-1px);
}

.nav-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.nav-icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--bg-card-inner);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   6. HERO STRIP: BIOLOGICAL STAGE, REGIME & SAFETY
   -------------------------------------------------------------------------- */
.hero-strip {
  display: grid;
  grid-template-columns: 1.1fr 1.6fr 1.1fr;
  gap: 1.25rem;
}

@media (max-width: 1024px) {
  .hero-strip {
    grid-template-columns: 1fr;
  }
}

.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--trans-normal), box-shadow var(--trans-normal);
}

.hero-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
}

.card-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tag-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-phase {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: rgba(var(--accent-cyan-rgb), 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.3);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

/* 2.1 Biological Lifecycle Specific */
.hero-day-block {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0.4rem 0 0.75rem 0;
}

.day-large {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

.day-total {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-tile);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border-subtle);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.sub-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.65rem;
}

.sub-meta-row strong {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

/* 2.2 Active Cybernetic Regime Card */
.badge-regime {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  transition: all var(--trans-normal);
}

/* Regime Colors */
.regime-boost {
  background: rgba(var(--accent-temp-rgb), 0.15);
  color: var(--accent-temp);
  border-color: rgba(var(--accent-temp-rgb), 0.4);
}

.regime-decel {
  background: rgba(var(--accent-amber-rgb), 0.15);
  color: var(--accent-amber);
  border-color: rgba(var(--accent-amber-rgb), 0.4);
}

.regime-soft {
  background: rgba(var(--accent-cyan-rgb), 0.15);
  color: var(--accent-cyan);
  border-color: rgba(var(--accent-cyan-rgb), 0.4);
}

.regime-eq {
  background: rgba(var(--accent-green-rgb), 0.15);
  color: var(--accent-green);
  border-color: rgba(var(--accent-green-rgb), 0.4);
}

.regime-coast {
  background: rgba(var(--accent-violet-rgb), 0.15);
  color: var(--accent-violet);
  border-color: rgba(var(--accent-violet-rgb), 0.4);
}

.regime-vent {
  background: rgba(var(--accent-rose-rgb), 0.15);
  color: var(--accent-rose);
  border-color: rgba(var(--accent-rose-rgb), 0.4);
}

.regime-headline {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.regime-explanation {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.85rem;
}

.regime-metrics-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-metric {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
}

.pill-k {
  color: var(--text-muted);
}

.pill-v {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-primary);
}

.highlight-green {
  color: var(--accent-green);
}

/* 2.3 Embryonic Safety Card */
.badge-status.status-optimal {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: rgba(var(--accent-green-rgb), 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(var(--accent-green-rgb), 0.35);
  border-radius: var(--radius-sm);
}

.safety-stat-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.85rem;
  margin: 0.4rem 0 0.85rem 0;
}

.stat-unit {
  text-align: center;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.stat-divider {
  width: 1px;
  height: 38px;
  background: var(--border-medium);
}

.safety-footer-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.45rem 0.75rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.safety-footer-alert strong {
  color: var(--accent-green);
  font-family: 'JetBrains Mono', monospace;
}

/* --------------------------------------------------------------------------
   7. PRIMARY TELEMETRY TILES GRID (6 CARDS)
   -------------------------------------------------------------------------- */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 1100px) {
  .telemetry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .telemetry-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  transition: all var(--trans-normal);
}

.metric-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Card Top Title */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-chip {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
}

.chip-temp {
  color: var(--accent-temp);
  background: rgba(var(--accent-temp-rgb), 0.1);
  border-color: rgba(var(--accent-temp-rgb), 0.25);
}

.chip-humid {
  color: var(--accent-humid);
  background: rgba(var(--accent-humid-rgb), 0.1);
  border-color: rgba(var(--accent-humid-rgb), 0.25);
}

.chip-vel {
  color: var(--accent-cyan);
  background: rgba(var(--accent-cyan-rgb), 0.1);
  border-color: rgba(var(--accent-cyan-rgb), 0.25);
}

.card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sensor-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
}

.chip-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tile);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.04em;
}

.chip-green {
  background: rgba(var(--accent-green-rgb), 0.12);
  color: var(--accent-green);
  border-color: rgba(var(--accent-green-rgb), 0.3);
}

/* Body Numeric Value */
.card-body-numeric {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.big-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.big-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.85rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.text-temp { color: var(--accent-temp); }
.text-humid { color: var(--accent-humid); }
.text-vel { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-cyan { color: var(--accent-cyan); }
.text-amber { color: var(--accent-amber); }

.big-unit {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Setpoint Controller Widget */
.setpoint-controller-widget {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.setpoint-display {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.sp-val {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.8rem;
}

.setpoint-quick-buttons {
  display: flex;
  gap: 0.3rem;
}

.btn-step {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tile);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.btn-step:hover {
  background: var(--bg-card-inner);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Meta boxes inside metrics */
.humid-meta-box, .velocity-meta-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.h-row strong, .v-row strong {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

/* Meter Bar Tracks */
.card-meter-bar {
  margin-bottom: 1rem;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.target-marker {
  color: var(--accent-cyan);
  font-weight: 700;
}

.meter-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg-tile);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  overflow: visible;
}

.meter-deadband {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(var(--accent-green-rgb), 0.25);
  border-left: 1px dashed var(--accent-green);
  border-right: 1px dashed var(--accent-green);
  border-radius: var(--radius-full);
}

.meter-indicator {
  position: absolute;
  top: -3px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent-temp);
  box-shadow: 0 0 8px rgba(var(--accent-temp-rgb), 0.6);
  transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#meterHumidIndicator {
  border-color: var(--accent-humid);
  box-shadow: 0 0 8px rgba(var(--accent-humid-rgb), 0.6);
}

/* Brake Safety Meter */
.brake-safety-meter {
  margin-bottom: 1rem;
}

.brake-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.brake-label span:last-child {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent-green);
}

.brake-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tile);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.brake-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-amber));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Card Footer */
.card-footer-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.65rem;
}

.card-footer-metrics strong {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}

/* Actuator Cards Specific */
.actuator-symbol {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  transition: all var(--trans-normal);
}

/* Bulb Glow */
.bulb-symbol {
  color: var(--accent-amber);
  background: rgba(var(--accent-amber-rgb), 0.12);
  border-color: rgba(var(--accent-amber-rgb), 0.3);
  box-shadow: 0 0 16px rgba(var(--accent-amber-rgb), 0.35);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Fan Rotating Turbine */
.fan-symbol {
  color: var(--accent-green);
  background: rgba(var(--accent-green-rgb), 0.12);
  border-color: rgba(var(--accent-green-rgb), 0.3);
}

.fan-symbol.circ-fan i {
  animation: fanSpin var(--circ-spin-speed, 1.8s) linear infinite;
}

.fan-symbol.exh-fan {
  color: var(--accent-rose);
  background: rgba(var(--accent-rose-rgb), 0.12);
  border-color: rgba(var(--accent-rose-rgb), 0.3);
}

.fan-symbol.exh-fan i {
  animation: fanSpin var(--exh-spin-speed, 0s) linear infinite;
}

@keyframes fanSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.duty-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-amber-rgb), 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(var(--accent-amber-rgb), 0.35);
}

.duty-circ {
  background: rgba(var(--accent-green-rgb), 0.15);
  color: var(--accent-green);
  border-color: rgba(var(--accent-green-rgb), 0.35);
}

.duty-exh {
  background: rgba(var(--accent-rose-rgb), 0.15);
  color: var(--accent-rose);
  border-color: rgba(var(--accent-rose-rgb), 0.35);
}

.actuator-body {
  margin-bottom: 1.1rem;
}

.actuator-level-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.actuator-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

.pulse-visualizer {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.actuator-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-tile);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.actuator-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-bulb {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.fill-circ {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}

.fill-exh {
  background: linear-gradient(90deg, #f43f5e, #dc2626);
}

/* --------------------------------------------------------------------------
   8. FULL-SESSION CHARTING SUITE
   -------------------------------------------------------------------------- */
.chart-section {
  width: 100%;
}

.chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.chart-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.chart-headings {
  max-width: 650px;
}

.chart-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.chart-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.chart-scope-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.scope-group {
  display: flex;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.25rem;
  gap: 0.2rem;
}

/* Dynamic Setpoint Episode Selector Wrap */
.episode-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.65rem;
}

.scope-dropdown-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  white-space: nowrap;
}

.scope-select {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans-fast);
}

.scope-select:focus {
  border-color: var(--accent-cyan);
}

.scope-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--trans-fast);
}

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

.scope-btn.active {
  background: var(--bg-surface);
  color: var(--accent-cyan);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-medium);
}

.chart-tools-group {
  display: flex;
  gap: 0.4rem;
}

.tool-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--trans-fast);
}

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

.tool-btn.btn-highlight {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.4);
  color: #06b6d4;
}

.tool-btn.btn-highlight:hover {
  background: rgba(6, 182, 212, 0.22);
  border-color: #06b6d4;
  color: #38bdf8;
}

/* Tool Button Active States */
.tool-btn.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.55);
  color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.tool-btn.active:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #34d399;
}

.tool-btn.active-cyan {
  background: rgba(6, 182, 212, 0.16);
  border-color: rgba(6, 182, 212, 0.55);
  color: #06b6d4;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.tool-btn.active-cyan:hover {
  background: rgba(6, 182, 212, 0.25);
  border-color: #06b6d4;
  color: #38bdf8;
}

.tool-btn.btn-off {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  opacity: 0.65;
}

/* Scope State & Identification Banner */
.scope-state-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.9rem;
  margin-bottom: 0.65rem;
  transition: all var(--trans-normal);
}

[data-theme="light"] .scope-state-banner {
  background: rgba(248, 250, 252, 0.85);
  border-color: var(--border-medium);
}

.scope-banner-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.scope-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.35);
  letter-spacing: 0.03em;
}

.scope-mode-chip.chip-transient {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.4);
}

.scope-mode-chip.chip-steady {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

.scope-classification-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.scope-tolerance-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.02em;
}

.scope-banner-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
}

.scope-time-range {
  color: var(--text-primary);
  font-weight: 600;
}

.scope-count-badge {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.45rem;
  color: var(--accent-cyan);
  font-weight: 700;
}

/* Custom Timeline Drawer */
.timeline-drawer {
  background: var(--bg-tile);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.65rem;
}

.timeline-drawer-content {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.td-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.timeline-time-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  outline: none;
  transition: border-color var(--trans-fast);
}

.timeline-time-input:focus {
  border-color: var(--accent-cyan);
}

.td-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--trans-fast);
}

.btn-apply-timeline {
  background: rgba(6, 182, 212, 0.2);
  border: 1px solid rgba(6, 182, 212, 0.5);
  color: #38bdf8;
}

.btn-apply-timeline:hover {
  background: rgba(6, 182, 212, 0.35);
  color: #ffffff;
}

.btn-reset-timeline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-reset-timeline:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.timeline-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-left: auto;
}

/* Chart Canvas Containers */
.chart-canvas-container {
  position: relative;
  width: 100%;
  height: 380px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.sub-chart-container {
  height: 200px;
  margin-top: -0.25rem;
  transition: all var(--trans-normal);
}

.sub-chart-label {
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

/* Chart Stats Strip */
.chart-stats-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
}

.stat-pill .k {
  color: var(--text-muted);
}

.stat-pill .v {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   9. DIAGNOSTIC EVENT STREAM & REGIME LOG TABLE
   -------------------------------------------------------------------------- */
.log-section {
  width: 100%;
}

.log-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.95rem;
}

.log-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.log-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.log-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.log-clear-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.log-clear-btn:hover {
  background: var(--bg-tile);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.log-table-wrapper {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-card-inner);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}

.log-table th {
  position: sticky;
  top: 0;
  background: var(--bg-tile);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}

.log-table td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  white-space: nowrap;
}

.log-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

[data-theme="light"] .log-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

.badge-log {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   10. APP FOOTER
   -------------------------------------------------------------------------- */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.25rem 0.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-footer code {
  color: var(--accent-cyan);
}

.footer-sep {
  margin: 0 0.4rem;
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
   11. MODALS & DRAWERS (EXPORT, SETTINGS, SIMULATOR)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--trans-normal);
  padding: 1.5rem;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(12px);
  transition: transform var(--trans-normal);
  overflow: hidden;
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.modal-icon {
  font-size: 1.5rem;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: color var(--trans-fast);
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-inner);
}

.modal-btn {
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--trans-fast);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

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

/* Export Modal Specifics */
.export-preview-box {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

@media (max-width: 600px) {
  .export-preview-box {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ep-col {
  display: flex;
  flex-direction: column;
}

.ep-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ep-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.radio-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

@media (max-width: 600px) {
  .radio-card-grid {
    grid-template-columns: 1fr;
  }
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.radio-card input {
  margin-top: 0.2rem;
}

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

.radio-card.active {
  border-color: var(--accent-green);
  background: rgba(var(--accent-green-rgb), 0.08);
}

.rc-content strong {
  display: block;
  font-size: 0.78rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.rc-content span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Modal Timeline Selection Box */
.modal-timeline-box {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: all var(--trans-normal);
}

.mt-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mt-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mt-presets-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.preset-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.preset-pill:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.mt-fields-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.mt-field {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.mt-field.flex-grow {
  flex: 1;
  min-width: 200px;
}

/* Cloud Telemetry Cadence Notice */
.export-cadence-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-secondary);
  margin-top: 0.75rem;
}

.export-cadence-notice strong {
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
}

.format-button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

@media (max-width: 600px) {
  .format-button-row {
    grid-template-columns: 1fr;
  }
}

.fmt-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.fmt-btn i {
  font-size: 1.4rem;
  margin-top: 0.15rem;
}

.fmt-btn strong {
  display: block;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.fmt-btn span {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.fmt-btn.active {
  border-color: var(--accent-cyan);
  background: rgba(var(--accent-cyan-rgb), 0.08);
}

.checkbox-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.45rem;
}

.chk-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.chk-pill input {
  accent-color: var(--accent-cyan);
}

/* Settings Modal Specifics */
.toggle-mode-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.mode-select-btn {
  padding: 0.75rem;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--trans-fast);
}

.mode-select-btn.active {
  background: rgba(var(--accent-cyan-rgb), 0.1);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.firebase-fields-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  background: var(--bg-tile);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.flex-1 { flex: 1; }

.text-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--trans-fast);
}

.text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(var(--accent-cyan-rgb), 0.2);
}

.input-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.info-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: rgba(var(--accent-cyan-rgb), 0.08);
  border: 1px solid rgba(var(--accent-cyan-rgb), 0.25);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-alert-box strong {
  display: block;
  color: var(--accent-cyan);
  margin-bottom: 0.2rem;
}

/* Stress Simulator Modal */
.sim-scenario-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.scenario-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--trans-fast);
}

@media (max-width: 600px) {
  .scenario-card {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
}

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

.sc-icon {
  font-size: 1.5rem;
  text-align: center;
}

.sc-info h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.sc-info p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.sc-trigger-btn {
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all var(--trans-fast);
}

.btn-cold {
  background: rgba(var(--accent-cyan-rgb), 0.15);
  color: var(--accent-cyan);
  border-color: rgba(var(--accent-cyan-rgb), 0.4);
}
.btn-cold:hover {
  background: var(--accent-cyan);
  color: #ffffff;
}

.btn-heat {
  background: rgba(var(--accent-amber-rgb), 0.15);
  color: var(--accent-amber);
  border-color: rgba(var(--accent-amber-rgb), 0.4);
}
.btn-heat:hover {
  background: var(--accent-amber);
  color: #ffffff;
}

.btn-brake {
  background: rgba(var(--accent-green-rgb), 0.15);
  color: var(--accent-green);
  border-color: rgba(var(--accent-green-rgb), 0.4);
}
.btn-brake:hover {
  background: var(--accent-green);
  color: #ffffff;
}

.btn-bio {
  background: rgba(var(--accent-violet-rgb), 0.15);
  color: var(--accent-violet);
  border-color: rgba(var(--accent-violet-rgb), 0.4);
}
.btn-bio:hover {
  background: var(--accent-violet);
  color: #ffffff;
}
