/* ==========================================================================
   EnvAir+ — Master Atmospheric & IAQ Mission Control
   Design System: Apple High-End / Linear-Tier Dark Obsidian Architecture
   ========================================================================== */

:root {
  /* Color Primitives (OLED Dark Mode) */
  --bg-space: #060608;
  --bg-surface: #0b0b10;
  --bg-surface-elevated: #111118;
  --bg-shell: rgba(255, 255, 255, 0.03);
  --border-outer: rgba(255, 255, 255, 0.08);
  --border-inner: rgba(255, 255, 255, 0.05);
  --inner-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.08);

  /* Typography */
  --text-primary: #f5f5f7;
  --text-secondary: #94949e;
  --text-tertiary: #60606a;
  --text-muted: #4a4a54;

  /* Accents & Gas Categories */
  --accent-blue: #2997ff;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  /* Fonts */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Smooth Physics Curve */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --radius-outer: 24px;
  --radius-inner: 20px;
}

/* Light Theme Overrides */
[data-theme="light"] {
  --bg-space: #fbfbfd;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f4f4f7;
  --bg-shell: rgba(0, 0, 0, 0.02);
  --border-outer: rgba(0, 0, 0, 0.08);
  --border-inner: rgba(0, 0, 0, 0.05);
  --inner-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.9);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-muted: #a1a1a6;
}

/* Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  background-color: var(--bg-space);
  color: var(--text-primary);
  font-family: var(--font-display);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* Ambient Subtle Lighting Mesh */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  transition: opacity 1s var(--ease-spring);
}
.glow-cyan {
  width: 480px;
  height: 480px;
  top: -100px;
  left: 20%;
  background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
}
.glow-emerald {
  width: 520px;
  height: 520px;
  top: 30%;
  right: -100px;
  background: radial-gradient(circle, var(--accent-emerald), transparent 70%);
}
.glow-violet {
  width: 600px;
  height: 600px;
  bottom: -150px;
  left: 10%;
  background: radial-gradient(circle, var(--accent-purple), transparent 70%);
}

/* Grain Noise Overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Deck Container */
.deck-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

/* Utility Classes */
.font-mono { font-family: var(--font-mono); }
.text-cyan { color: var(--accent-cyan) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-amber { color: var(--accent-amber) !important; }
.text-rose { color: var(--accent-rose) !important; }
.text-purple { color: var(--accent-purple) !important; }
.text-muted { color: var(--text-tertiary); }

/* ==========================================================================
   DOUBLE BEZEL (Doppelrand Architecture)
   ========================================================================== */
.double-bezel {
  background: var(--bg-shell);
  border: 1px solid var(--border-outer);
  border-radius: var(--radius-outer);
  padding: 4px;
  transition: transform 0.4s var(--ease-spring), border-color 0.4s var(--ease-spring), box-shadow 0.4s var(--ease-spring);
}
.double-bezel:hover {
  border-color: rgba(255, 255, 255, 0.14);
}
.double-bezel .bezel-inner {
  background: var(--bg-surface);
  border: 1px solid var(--border-inner);
  border-radius: var(--radius-inner);
  box-shadow: var(--inner-highlight);
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. FLOATING GLASS ISLAND NAVBAR
   ========================================================================== */
.island-nav-wrapper {
  position: sticky;
  top: 1.25rem;
  z-index: 100;
  margin-bottom: 2rem;
}
.island-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 11, 16, 0.72);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-outer);
  border-radius: 9999px;
  padding: 0.5rem 0.85rem 0.5rem 1.25rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .island-nav {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.06), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand-orb {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb-core {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
}
.orb-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent-cyan);
  opacity: 0.4;
  animation: pulse-ring 2.4s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}
.title-accent {
  color: var(--accent-cyan);
}
.brand-tag {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
  display: block;
  margin-top: 1px;
}

/* Center Status Pill */
.nav-status-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-inner);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}
.status-indicator-dot.online { background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }
.status-indicator-dot.offline { background: var(--accent-amber); box-shadow: 0 0 8px var(--accent-amber); }
.status-indicator-dot.sim { background: var(--accent-purple); box-shadow: 0 0 8px var(--accent-purple); }
.status-source-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-tertiary);
  padding-left: 0.25rem;
  border-left: 1px solid var(--border-inner);
}

/* Action Buttons */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-inner);
  border-radius: 9999px;
  padding: 0.42rem 0.95rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
}
.nav-pill-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}
.nav-pill-btn:active {
  transform: scale(0.97);
}
.nav-pill-btn.btn-history {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-pill-btn.btn-history:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.6);
  color: #ffffff;
}

.nav-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-inner);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
}
.nav-icon-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}
.nav-icon-btn:active {
  transform: scale(0.95);
}

/* ==========================================================================
   3. HERO AIR EQUILIBRIUM & MISSION STATE
   ========================================================================== */
.hero-mission-strip {
  margin-bottom: 2rem;
}
.hero-card .hero-inner {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 2.25rem;
  gap: 2rem;
}
.hero-primary {
  max-width: 720px;
}
.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-inner);
  border-radius: 9999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}
.hero-headline {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.hero-subline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.hero-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-inner);
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.meta-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
}
.meta-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.meta-divider {
  width: 1px;
  height: 24px;
  background: var(--border-inner);
}

/* AQI Dial */
.hero-aqi-dial {
  flex-shrink: 0;
}
.aqi-card-bezel {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 20px;
  padding: 1.25rem 1.75rem;
}
.aqi-circle-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aqi-svg {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.aqi-bg-circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 12;
}
.aqi-progress-circle {
  fill: none;
  stroke: var(--accent-emerald);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 427;
  stroke-dashoffset: 280;
  transition: stroke-dashoffset 1s var(--ease-spring), stroke 0.5s ease;
}
.aqi-score-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.aqi-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
}
.aqi-number {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}
.aqi-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-top: 0.2rem;
}
.aqi-category.good { color: var(--accent-emerald); }
.aqi-category.moderate { color: var(--accent-amber); }
.aqi-category.unhealthy { color: var(--accent-rose); }
.aqi-footnote {
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--text-tertiary);
}
.aqi-footnote strong {
  color: var(--text-primary);
}

/* ==========================================================================
   4. NINE-SUBSYSTEM MASTER BENTO GRID
   ========================================================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.col-span-12 { grid-column: span 12; }
.col-span-8  { grid-column: span 8; }
.col-span-6  { grid-column: span 6; }
.col-span-4  { grid-column: span 4; }

/* Card Common Header */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sensor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 0.18rem 0.5rem;
  border-radius: 6px;
  width: fit-content;
}
.sensor-chip.laser    { background: rgba(56, 189, 248, 0.12); color: var(--accent-cyan); }
.sensor-chip.co2      { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); }
.sensor-chip.hcho     { background: rgba(245, 158, 11, 0.12); color: var(--accent-amber); }
.sensor-chip.alpha    { background: rgba(168, 85, 247, 0.12); color: var(--accent-purple); }
.sensor-chip.climate  { background: rgba(244, 63, 94, 0.12);  color: var(--accent-rose); }
.sensor-chip.storage  { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.sensor-chip.chart    { background: rgba(41, 151, 255, 0.12); color: var(--accent-blue); }
.sensor-chip.terminal { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.bus-badge {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
}

/* Card 1: Particulates */
.particulate-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-block {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.metric-eyebrow {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}
.metric-main {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.metric-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.metric-unit {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.metric-caption {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 0.2rem;
}

.particle-bins-section {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-inner);
  border-radius: 14px;
  padding: 1rem;
}
.bins-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}
.bins-bars-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  align-items: flex-end;
}
.bin-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.bin-bar-track {
  width: 100%;
  height: 60px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  padding: 2px;
}
.bin-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-cyan), rgba(56, 189, 248, 0.3));
  border-radius: 4px;
  min-height: 4px;
  transition: height 0.6s var(--ease-spring);
}
.bin-value {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.bin-label {
  font-size: 0.62rem;
  color: var(--text-tertiary);
}

/* Card 2: Dual CO2 & SGP30 */
.co2-primary-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}
.box-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
}
.box-reading {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.35rem 0;
}
.big-val {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.big-unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.co2-quality-pill {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}
.co2-quality-pill.good { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.co2-quality-pill.warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.co2-secondary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.sec-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-inner);
  border-radius: 10px;
  padding: 0.75rem;
}
.sec-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  display: block;
}
.sec-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.2rem;
  display: block;
}
.humidity-comp-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-inner);
}
.humidity-comp-footer strong {
  color: var(--text-secondary);
}

/* Card 3: Formaldehyde */
.hcho-fused-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.hcho-gauge-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.hcho-main-reading {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.hcho-val {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.hcho-unit {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.hcho-ppb-reading {
  font-size: 1rem;
  font-weight: 600;
}
.who-status-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.who-status-strip.excellent { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.who-status-strip.normal { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.who-status-strip.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.who-status-strip.danger { background: rgba(244, 63, 94, 0.15); color: #f87171; }

.dual-channel-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 12px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
}
.ch-name {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ch-val {
  color: var(--text-primary);
  font-weight: 600;
}

/* Card 4: Alphasense 4-Gas */
.alphasense-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.gas-channel-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 14px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
}
.gas-channel-top {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.65rem;
}
.gas-formula {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}
.gas-full {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}
.gas-pin {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
}
.gas-val-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.gas-val {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.gas-unit {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.gas-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.gas-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s var(--ease-spring);
}
.color-no2 { background: var(--accent-purple); }
.color-co  { background: var(--accent-amber); }
.color-o3  { background: var(--accent-cyan); }
.color-so2 { background: var(--accent-rose); }
.gas-limit-text {
  font-size: 0.62rem;
  color: var(--text-tertiary);
}

/* Card 5: BME680 Climate */
.climate-primary-quad {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.climate-tile {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 12px;
  padding: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.climate-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent-rose);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.tile-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
}
.tile-val-row {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-top: 0.15rem;
}
.tile-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.tile-unit {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.derived-physics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-inner);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
}
.phys-name {
  color: var(--text-tertiary);
}
.phys-val {
  color: var(--text-primary);
  font-weight: 600;
  margin-left: 0.25rem;
}

/* Card 6: Storage & Diagnostics */
.storage-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.diag-tile {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 12px;
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.diag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.diag-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.badge-status-pill {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
}
.badge-status-pill.ok { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-status-pill.cloud-live { background: rgba(41, 151, 255, 0.15); color: #7dd3fc; }
.diag-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.diag-body strong {
  color: var(--text-primary);
}
.diag-body code {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 4px;
}

/* ==========================================================================
   5. WAVEFORMS & CHARTS
   ========================================================================== */
.waveform-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 9999px;
  padding: 3px;
}
.wtab-btn {
  background: transparent;
  border: none;
  border-radius: 9999px;
  padding: 0.4rem 0.95rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s var(--ease-spring);
}
.wtab-btn:hover {
  color: var(--text-primary);
}
.wtab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.chart-container-box {
  position: relative;
  width: 100%;
  height: 320px;
  margin-top: 0.5rem;
}

/* ==========================================================================
   6. TERMINAL & PACKET INSPECTOR
   ========================================================================== */
.terminal-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.terminal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-inner);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.terminal-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}
.terminal-window {
  background: #040406;
  border: 1px solid var(--border-inner);
  border-radius: 12px;
  padding: 1rem;
  height: 160px;
  overflow-y: auto;
}
.terminal-content {
  font-size: 0.72rem;
  line-height: 1.6;
}
.term-line {
  margin-bottom: 0.15rem;
  word-break: break-all;
}
.term-line.info { color: #94a3b8; }
.term-line.success { color: #34d399; }
.term-line.warning { color: #fbbf24; }
.term-line.error { color: #f87171; }
.term-line.packet { color: #7dd3fc; }

/* ==========================================================================
   7. HISTORICAL TELEMETRY VAULT MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-backdrop.hidden {
  display: none;
}
.modal-container {
  max-width: 600px;
  width: 100%;
}
.history-modal-container {
  max-width: 1040px !important;
  width: 95vw;
}
.modal-inner {
  padding: 1.75rem !important;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title-group h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.35rem;
}
.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.modal-subtitle code {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.4rem;
  transition: color 0.2s ease;
}
.modal-close-btn:hover { color: var(--text-primary); }

/* Modal Toolbar */
.modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-inner);
  border-radius: 12px;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.pack-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #6ee7b7;
  font-family: var(--font-mono);
}
.pack-badge .pulse-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}
.toolbar-hint {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}
.toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.limit-selector-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-inner);
  border-radius: 8px;
  padding: 0.2rem 0.4rem;
}
.limit-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-right: 0.2rem;
}
.btn-limit {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-limit.active, .btn-limit:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}
.btn-modal-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-inner);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-modal-action:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}
.btn-modal-action.btn-export {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}
.btn-modal-action.btn-export:hover {
  background: rgba(56, 189, 248, 0.22);
}

/* History Table */
.history-table-container {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border-inner);
  border-radius: 12px;
  background: rgba(8, 8, 12, 0.6);
  position: relative;
}
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}
.history-table th {
  position: sticky;
  top: 0;
  background: rgba(14, 14, 20, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  border-bottom: 1px solid var(--border-inner);
  z-index: 10;
  white-space: nowrap;
}
.history-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}
.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
.history-table td.table-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-tertiary);
  font-family: var(--font-main);
  font-style: italic;
}
.table-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.table-badge.good { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.table-badge.warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }
.table-badge.danger { background: rgba(244, 63, 94, 0.15); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.3); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-inner);
}
.footer-note {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-modal-secondary {
  background: transparent;
  border: 1px solid var(--border-inner);
  border-radius: 8px;
  padding: 0.55rem 1.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-modal-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ==========================================================================
   8. FOOTER
   ========================================================================== */
.deck-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--border-inner);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.footer-brand {
  color: var(--text-secondary);
  font-weight: 600;
}
.footer-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-link:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   RESPONSIVE DESIGN (Universal Mobile Collapse)
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-card .hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-aqi-dial {
    align-self: center;
    width: 100%;
  }
  .aqi-card-bezel {
    width: 100%;
  }
  .col-span-8, .col-span-6, .col-span-4 {
    grid-column: span 12;
  }
  .alphasense-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .deck-container {
    padding: 1rem 1rem 3rem;
  }
  .island-nav {
    border-radius: 20px;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem;
  }
  .nav-brand {
    width: 100%;
    justify-content: space-between;
  }
  .nav-status-pill {
    width: 100%;
    justify-content: center;
  }
  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }
  .hero-headline {
    font-size: 1.75rem;
  }
  .particulate-metrics-row {
    grid-template-columns: 1fr;
  }
  .bins-bars-grid {
    gap: 0.4rem;
  }
  .climate-primary-quad {
    grid-template-columns: 1fr;
  }
  .storage-diagnostics-grid {
    grid-template-columns: 1fr;
  }
  .alphasense-grid {
    grid-template-columns: 1fr;
  }
  .sim-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .waveform-tabs {
    overflow-x: auto;
    width: 100%;
  }
  .deck-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   LIGHT THEME REFINEMENTS FOR REPORT FIGURES & PRINT
   ========================================================================== */
[data-theme="light"] .history-table-container {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .history-table th {
  background: #f4f4f7;
  color: #6e6e73;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .history-table td {
  border-bottom-color: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}
[data-theme="light"] .history-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="light"] .modal-backdrop {
  background: rgba(240, 240, 245, 0.85);
}
[data-theme="light"] .modal-close-btn {
  background: rgba(0, 0, 0, 0.05);
  color: #6e6e73;
}
[data-theme="light"] .modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #1d1d1f;
}
[data-theme="light"] .btn-modal-action {
  background: #ffffff;
  color: #1d1d1f;
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .btn-modal-action:hover {
  background: #f4f4f7;
}
[data-theme="light"] .btn-modal-secondary {
  background: #f4f4f7;
  color: #1d1d1f;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .btn-modal-secondary:hover {
  background: #e5e5ea;
}
[data-theme="light"] .table-badge.good {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.25);
}
[data-theme="light"] .table-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.25);
}
[data-theme="light"] .sensor-chip.storage {
  background: rgba(0, 0, 0, 0.05);
  color: #1d1d1f;
}
[data-theme="light"] .sensor-chip.terminal {
  background: rgba(0, 0, 0, 0.05);
  color: #6e6e73;
}
[data-theme="light"] .terminal-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .terminal-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
