/* ==========================================================================
   Nexforge - High-Contrast Light & Dark Theme Dashboard Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   THEME DESIGN TOKENS
   Default: Light Theme (Crystal Clear High-Contrast Light Mode)
   ========================================================================== */
:root, [data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --border-color: #cbd5e1;
  --border-strong: #94a3b8;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Status Colors for Light Mode (High Contrast & High Legibility) */
  --color-primary: #059669;
  --color-healthy: #059669;
  --color-healthy-bg: #ecfdf5;
  --color-healthy-border: #a7f3d0;

  --color-stress: #d97706;
  --color-stress-bg: #fefce8;
  --color-stress-border: #fef08a;

  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fde68a;

  --color-info: #0284c7;
  --color-info-bg: #f0f9ff;
  --color-info-border: #bae6fd;

  --color-inactive: #475569;
  --color-inactive-bg: #f1f5f9;

  /* High-Contrast Light Mode Typography */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;
  --text-dim: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-dropdown: 0 10px 25px rgba(15, 23, 42, 0.12);

  --nav-height: 58px;
}

[data-theme="dark"] {
  --bg-main: #070a12;
  --bg-surface: #0e1526;
  --bg-surface-elevated: #151f36;
  --bg-surface-hover: #1c2947;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: #1e2e4a;

  --color-primary: #10b981;
  --color-healthy: #10b981;
  --color-healthy-bg: rgba(16, 185, 129, 0.1);
  --color-healthy-border: rgba(16, 185, 129, 0.3);

  --color-stress: #eab308;
  --color-stress-bg: rgba(234, 179, 8, 0.12);
  --color-stress-border: rgba(234, 179, 8, 0.35);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-warning-border: rgba(245, 158, 11, 0.3);

  --color-info: #06b6d4;
  --color-info-bg: rgba(6, 182, 212, 0.1);
  --color-info-border: rgba(6, 182, 212, 0.3);

  --color-inactive: #64748b;
  --color-inactive-bg: rgba(100, 116, 139, 0.1);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-dim: #475569;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-dropdown: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.mono {
  font-family: var(--font-mono);
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon-box {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #059669, #10b981);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.brand-text-box h1 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Navigation Links */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface-elevated);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s ease;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
}

/* Header Telemetry & Buttons */
.header-telemetry {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.theme-toggle-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--color-primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-badge.online {
  background: var(--color-healthy-bg);
  color: var(--color-healthy);
  border: 1px solid var(--color-healthy-border);
}

.status-badge.offline {
  background: var(--color-stress-bg);
  color: var(--color-stress);
  border: 1px solid var(--color-stress-border);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: pulse 1.8s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.demo-badge {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.mode-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.live-clock {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.mobile-nav-toggle {
  display: none;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

/* Mobile Navigation Drawer */
.mobile-drawer {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 999;
  box-shadow: var(--shadow-dropdown);
}

.mobile-drawer.hidden {
  display: none;
}

.mobile-nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border-left: 3px solid var(--color-primary);
}

/* ==========================================================================
   MAIN CONTAINERS & CARDS
   ========================================================================== */
.app-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.2px;
}

.section-title svg {
  color: var(--color-primary);
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, background-color 0.25s ease;
}

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

/* Overview Cards */
.system-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.status-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-card-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-card-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}

.status-card-subtext {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.status-card[data-status="connected"] .status-card-icon {
  background: var(--color-healthy-bg);
  color: var(--color-healthy);
  border-color: var(--color-healthy-border);
}

.status-card[data-status="disconnected"] .status-card-icon {
  background: var(--color-stress-bg);
  color: var(--color-stress);
  border-color: var(--color-stress-border);
}

/* Hero Section */
.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.25rem;
}

/* Camera Card (Always Dark Viewport for CV Reticle Contrast) */
.camera-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.camera-viewport-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #04070d;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

#cameraCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.camera-overlay-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.camera-overlay-tag {
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.camera-overlay-bottom {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.7);
}

.reticle-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  pointer-events: none;
}
.reticle-center::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -4px;
  right: -4px;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
}
.reticle-center::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.camera-offline-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 23, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-stress);
  z-index: 20;
  text-align: center;
  padding: 1rem;
}

.camera-telemetry-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem;
  background: var(--bg-surface-elevated);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

.telemetry-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.telemetry-val {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Controls Column */
.controls-column {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Decision Hero Card */
.decision-card {
  padding: 1.15rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
}

.decision-card.spray-active {
  background: var(--color-stress-bg);
  border: 1px solid var(--color-stress);
}

.decision-card.no-spray {
  background: var(--color-healthy-bg);
  border: 1px solid var(--color-healthy);
}

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

.decision-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.decision-icon-large {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.spray-active .decision-icon-large {
  background: var(--color-stress);
  color: #ffffff;
}

.no-spray .decision-icon-large {
  background: var(--color-healthy);
  color: #ffffff;
}

.decision-title-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.spray-active .decision-title-text {
  color: var(--color-stress);
}

.no-spray .decision-title-text {
  color: var(--color-healthy);
}

.decision-subtext {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.decision-reason-box {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  border-left: 3px solid currentColor;
  box-shadow: var(--shadow-card);
}

.spray-active .decision-reason-box {
  border-color: var(--color-stress);
}

.no-spray .decision-reason-box {
  border-color: var(--color-healthy);
}

/* Rover Controls */
.rover-control-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.control-row-power-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.power-toggle-btn {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.825rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.power-toggle-btn.active {
  background: var(--color-healthy-bg);
  color: var(--color-healthy);
  border-color: var(--color-healthy);
}

.power-toggle-btn:not(.active) {
  background: var(--color-stress-bg);
  color: var(--color-stress);
  border-color: var(--color-stress);
}

.segmented-control {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
  height: 44px;
}

.segmented-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented-btn.active {
  background: var(--bg-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-card);
}

.manual-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.manual-controls-grid.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-actuator {
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-actuator:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-actuator.active-spray {
  background: var(--color-stress);
  color: #ffffff;
  border-color: var(--color-stress);
}

.btn-reset-demo {
  width: 100%;
  height: 36px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-reset-demo:hover {
  border-color: var(--color-warning);
  color: var(--color-warning);
  background: var(--color-warning-bg);
}

/* Actuator Cards */
.actuator-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.actuator-overview-grid.single-card {
  grid-template-columns: 1fr;
}

.actuator-card {
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-card);
}

.actuator-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.actuator-card[data-state="active"] .actuator-icon {
  background: var(--color-stress-bg);
  color: var(--color-stress);
  border: 1px solid var(--color-stress-border);
}

.actuator-card[data-state="open"] .actuator-icon {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid var(--color-info-border);
}

.actuator-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.actuator-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.actuator-status-text {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.actuator-meta {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Metrics Banner */
.metrics-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-card);
}

.metric-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.metric-sub {
  font-size: 0.68rem;
  color: var(--color-primary);
  font-weight: 600;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
  width: 100%;
}

.chart-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  overflow: hidden;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 250px;
  min-height: 230px;
  overflow: hidden;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Table Card */
.table-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.telemetry-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.78rem;
  white-space: nowrap;
}

.telemetry-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.telemetry-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 500;
}

.telemetry-table tr:hover td {
  background: var(--bg-surface-elevated);
}

.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 700;
}

.pill-yellow { background: var(--color-stress-bg); color: var(--color-stress); border: 1px solid var(--color-stress-border); }
.pill-green { background: var(--color-healthy-bg); color: var(--color-healthy); border: 1px solid var(--color-healthy-border); }
.pill-gray { background: var(--color-inactive-bg); color: var(--color-inactive); border: 1px solid var(--border-color); }

/* Toast System */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 340px;
}

.toast.info { border-left: 3px solid var(--color-info); }
.toast.success { border-left: 3px solid var(--color-healthy); }
.toast.warn { border-left: 3px solid var(--color-warning); }

.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.25rem;
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

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

@media (max-width: 1024px) {
  .system-overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .metrics-banner {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
  }

  .app-header {
    padding: 0 0.85rem;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .app-container {
    padding: 0.75rem;
    gap: 0.85rem;
  }

  .system-overview-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .status-card {
    padding: 0.75rem;
  }

  .status-card-value {
    font-size: 0.95rem;
  }

  .status-card-icon {
    width: 34px;
    height: 34px;
  }

  .camera-telemetry-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .control-row-power-mode {
    grid-template-columns: 1fr;
  }

  .manual-controls-grid {
    grid-template-columns: 1fr 1fr;
  }

  .actuator-overview-grid {
    grid-template-columns: 1fr;
  }

  .metrics-banner {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .metric-card {
    padding: 0.75rem;
  }

  .metric-value {
    font-size: 1.25rem;
  }

  .chart-container {
    height: 210px;
  }

  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: 100%;
  }

  .live-clock {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-text-box h1 {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    display: none;
  }

  .system-overview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .camera-telemetry-bar {
    grid-template-columns: 1fr 1fr;
  }

  .manual-controls-grid {
    grid-template-columns: 1fr;
  }

  .metrics-banner {
    grid-template-columns: 1fr 1fr;
  }

  .decision-title-text {
    font-size: 1.1rem;
  }
}
