/* ==========================================================================
   SPHEREx Discovery Engine - Modern Astronomical Control Suite Stylesheet
   Theme: Precision Dark Astrophysics (#0b0f19)
   Architecture: CSS Grid + Flexbox Layout, Responsive & Pixel-Perfect
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Design Tokens
   -------------------------------------------------------------------------- */
:root {
  --bg-primary: #07090e;
  --bg-workspace: #0b0f19;
  --bg-panel: rgba(13, 18, 28, 0.94);
  --bg-panel-dark: rgba(9, 12, 19, 0.98);
  --bg-card: rgba(18, 24, 38, 0.65);
  --bg-input: #080b12;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(56, 189, 248, 0.45);
  --border-cyan: rgba(56, 189, 248, 0.25);
  --border-amber: rgba(245, 158, 11, 0.3);

  --color-text-main: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-cyan-hover: #0ea5e9;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

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

  --header-height: 48px;
  --footer-height: 84px;
}

/* --------------------------------------------------------------------------
   2. Reset & Base Typography
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-workspace);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Helper Utilities */
.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }
.text-cyan { color: var(--accent-cyan); }
.text-amber { color: var(--accent-amber); }
.text-emerald { color: var(--accent-emerald); }
.text-rose { color: var(--accent-rose); }
.text-white { color: #ffffff; }
.text-slate { color: var(--color-text-main); }
.text-slate-muted { color: var(--color-text-muted); }
.font-bold { font-weight: 700; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-1-5 { gap: 6px; }
.gap-2 { gap: 8px; }
.mb-1 { margin-bottom: 4px; }
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   3. App Grid Layout Architecture
   -------------------------------------------------------------------------- */
.app-body {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.brand-icon {
  width: 16px;
  height: 16px;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.mission-tag {
  font-size: 9px;
  font-family: var(--font-mono);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
}

.citizen-tag {
  font-size: 9px;
  font-family: var(--font-mono);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.inline-icon {
  width: 10px;
  height: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-sub {
  font-size: 10px;
  color: var(--color-text-dim);
}

/* Header Telemetry HUD */
.header-telemetry {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10.5px;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hud-label {
  color: var(--color-text-dim);
}

.hud-val {
  font-weight: 600;
}

.hud-sep {
  width: 1px;
  height: 16px;
  background-color: var(--border-subtle);
}

/* --------------------------------------------------------------------------
   4. Three-Column CSS Grid Workspace
   Layout: 20% (Left) | 50% (Center) | 30% (Right)
   -------------------------------------------------------------------------- */
.workspace-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 20% 50% 30%;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  overflow: hidden;
  position: relative;
}

/* --------------------------------------------------------------------------
   5. Left Column (20%): Controls & Astronomical Filters
   -------------------------------------------------------------------------- */
.sidebar-left {
  background: var(--bg-panel-dark);
  border-right: 1px solid var(--border-subtle);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.highlight-panel {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.08) 0%, rgba(18, 24, 38, 0.75) 100%);
}

.url-badge {
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid var(--border-cyan);
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.target-badge {
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid var(--border-amber);
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.mission-pill {
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 1px 5px;
  border-radius: 4px;
}

.detector-badge {
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid var(--border-amber);
  padding: 1px 5px;
  border-radius: 4px;
}

.meta-tag {
  font-size: 9px;
  font-weight: 600;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Coordinate Inputs */
.coord-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.input-label {
  font-size: 8.5px;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--color-text-main);
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  outline: none;
  width: 100%;
  transition: all 0.15s ease;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.25);
}

.btn-query {
  width: 100%;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 10.5px;
  padding: 6px 8px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-query:hover {
  background: var(--accent-cyan);
  color: #030712;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* FOV Button Group */
.fov-button-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.btn-fov {
  background: #111827;
  border: 1px solid var(--border-subtle);
  color: var(--color-text-muted);
  padding: 5px 2px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-fov small {
  font-size: 8px;
  opacity: 0.7;
  display: block;
}

.btn-fov:hover {
  background: #1f2937;
  color: #ffffff;
}

.btn-fov.active {
  background: var(--accent-cyan);
  color: #030712;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

/* Mode Button Toggle Group */
.mode-button-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.mode-button-group.four-col {
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.comparison-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.anaglyph-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-size: 9px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.red {
  background: #f43f5e;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.7);
}

.legend-dot.cyan {
  background: #06b6d4;
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.7);
}

.legend-dot.white {
  background: #ffffff;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* Overlay Toggles */
.overlay-toggles {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.toggle-row:hover {
  color: #ffffff;
}

/* 6-Detector Array Chips */
.detector-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.chip {
  background: #111827;
  border: 1px solid var(--border-subtle);
  color: var(--color-text-dim);
  font-size: 9px;
  padding: 4px 2px;
  border-radius: 4px;
  text-align: center;
  font-weight: 600;
  transition: all 0.15s ease;
}

.chip small {
  display: block;
  font-size: 7.5px;
  opacity: 0.8;
}

.chip.active {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-icon {
  width: 13px;
  height: 13px;
  color: var(--color-text-muted);
}

.panel-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.panel-caption {
  font-size: 9.5px;
  color: var(--color-text-dim);
  line-height: 1.35;
}

/* Custom Select */
.custom-select-wrap {
  width: 100%;
}

.form-select {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--color-text-main);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

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

/* Mode Button Toggle Group */
.mode-button-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.btn-mode {
  background: #111827;
  border: 1px solid var(--border-subtle);
  color: var(--color-text-muted);
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-mode:hover {
  background: #1f2937;
  color: #ffffff;
}

.btn-mode.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #030712;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.btn-mode-icon {
  width: 12px;
  height: 12px;
}

/* Sub-control Sliders */
.sub-control-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--color-text-muted);
}

.slider-val {
  font-weight: 700;
  color: var(--color-text-main);
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--color-text-dim);
}

/* Custom Range Slider */
.custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #1e293b;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
  transition: transform 0.1s ease;
}

.custom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Badges */
.stretch-badge, .sn-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.stretch-badge {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid var(--border-amber);
}

.sn-badge {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Checkbox Row */
.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}

.checkbox-label {
  font-size: 10px;
  color: var(--color-text-muted);
  cursor: pointer;
}

.custom-checkbox {
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

/* Actions & Ledger */
.action-panel {
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #030712;
}

.btn-primary:hover {
  background: var(--accent-cyan-hover);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: #334155;
  border-color: var(--border-cyan);
  color: #ffffff;
}

.btn-tag {
  width: 100%;
  background: #059669;
  color: #ffffff;
}

.btn-tag:hover {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.discovery-ledger {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   6. Center Column (50%): Celestial Viewport & Canvas Stage
   -------------------------------------------------------------------------- */
.viewport-center {
  background: #030508;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.viewport-hud {
  height: 32px;
  background: rgba(8, 12, 19, 0.85);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 10px;
  z-index: 10;
  flex-shrink: 0;
}

.hud-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
}

.pulse-animation {
  animation: pulse-dot 1.5s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 8px var(--accent-cyan); }
}

.hud-epoch-text {
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hud-pipe {
  color: #334155;
}

/* Canvas Stage */
.canvas-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at center, #0a0e17 0%, #030509 100%);
  overflow: hidden;
}

.astronomical-canvas {
  max-width: 95%;
  max-height: 95%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(56, 189, 248, 0.1);
  cursor: crosshair;
}

/* Target Reticle Overlay */
.target-reticle {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 15;
}

.reticle-ring-outer {
  width: 44px;
  height: 44px;
  border: 2px dashed var(--accent-cyan);
  border-radius: 50%;
  animation: spin-reticle 6s linear infinite;
}

.reticle-ring-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(56, 189, 248, 0.6);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.reticle-crosshair-h, .reticle-crosshair-v {
  position: absolute;
  background: var(--accent-cyan);
}

.reticle-crosshair-h {
  top: 50%;
  left: -8px;
  width: 60px;
  height: 1px;
  transform: translateY(-50%);
  opacity: 0.6;
}

.reticle-crosshair-v {
  left: 50%;
  top: -8px;
  height: 60px;
  width: 1px;
  transform: translateX(-50%);
  opacity: 0.6;
}

.reticle-callout {
  position: absolute;
  top: 26px;
  left: 26px;
  background: rgba(3, 7, 18, 0.9);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

@keyframes spin-reticle {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Difference Badge */
.diff-badge {
  position: absolute;
  top: 14px;
  background: rgba(225, 29, 72, 0.85);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 15px rgba(225, 29, 72, 0.6);
  letter-spacing: 0.04em;
  z-index: 12;
}

.diff-badge-icon {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   7. Right Column (30%): Telemetry File & 102-Band SED Chart
   -------------------------------------------------------------------------- */
.sidebar-right {
  background: var(--bg-panel-dark);
  border-left: 1px solid var(--border-subtle);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.telemetry-panel, .sed-chart-panel, .validation-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.border-bottom {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.telemetry-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.class-badge {
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid var(--border-cyan);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Telemetry Grid */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.telemetry-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.telemetry-card.full-width {
  grid-column: span 2;
}

.telemetry-k {
  font-size: 9px;
  color: var(--color-text-dim);
  text-transform: uppercase;
}

.telemetry-v {
  font-size: 10.5px;
  font-weight: 600;
  word-break: break-all;
}

/* SED Chart Panel */
.sed-chart-panel {
  flex: 1;
  min-height: 220px;
}

.feature-pill {
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid var(--border-amber);
  padding: 1px 6px;
  border-radius: 4px;
}

.chart-canvas-wrapper {
  flex: 1;
  position: relative;
  min-height: 140px;
  width: 100%;
}

.chart-caption {
  font-size: 9.5px;
  color: var(--color-text-muted);
  line-height: 1.35;
}

/* Validation Panel */
.validation-panel {
  background: #080b12;
  border-color: rgba(16, 185, 129, 0.25);
}

.validation-body {
  font-size: 10px;
  color: #cbd5e1;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   8. Bottom Row (Full Width): 102 Spectral Channels Slicer Rail
   -------------------------------------------------------------------------- */
.app-footer {
  height: var(--footer-height);
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
  flex-shrink: 0;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-icon {
  width: 14px;
  height: 14px;
}

.footer-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.footer-range-tag {
  font-size: 9.5px;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--border-cyan);
  padding: 1px 6px;
  border-radius: 4px;
}

.footer-readout {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10.5px;
}

.readout-part {
  color: var(--color-text-muted);
}

.readout-sep {
  color: #334155;
}

.spectral-rail-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spectral-rail-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, 
    #3b82f6 0%,   /* 0.75 µm Optical Edge */
    #06b6d4 25%,  /* 1.50 µm NIR */
    #f59e0b 55%,  /* 2.45 µm */
    #ea580c 75%,  /* 3.30 µm Thermal */
    #dc2626 100%  /* 5.00 µm Deep Thermal */
  );
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.spectral-rail-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border: 2px solid #0284c7;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.spectral-rail-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.spectral-tick-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--color-text-dim);
}

/* --------------------------------------------------------------------------
   9. Custom Scrollbars
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

/* ── MOBILE VIEWPORT & TOUCH OPTIMIZATION (DESKTOP PARITY PRESERVED) ── */
@media (max-width: 1024px) {
  html, body {
    overflow-y: auto !important;
    height: auto !important;
  }
  .app-body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: visible !important;
  }
  .workspace-grid {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }
  .viewport-center {
    order: 1 !important;
    min-height: 340px !important;
    height: auto !important;
  }
  .sidebar-left {
    order: 2 !important;
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    overflow: visible !important;
  }
  .sidebar-right {
    order: 3 !important;
    width: 100% !important;
    border-left: none !important;
    overflow: visible !important;
  }
  .app-header {
    height: auto !important;
    min-height: 52px !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .header-telemetry, .brand-sub {
    display: none !important;
  }
  .header-right {
    margin-left: auto !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .header-right .btn span {
    display: none !important;
  }
  .app-footer {
    height: auto !important;
    padding: 10px 12px 16px !important;
    gap: 8px !important;
  }
  .spectral-tick-labels span:nth-child(2),
  .spectral-tick-labels span:nth-child(4),
  .spectral-tick-labels span:nth-child(5) {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .coord-input-grid, .telemetry-grid {
    grid-template-columns: 1fr !important;
  }
  .telemetry-card.full-width {
    grid-column: span 1 !important;
  }
}

/* ── VIEWPORT MODE TABS & LIVE ALADIN INTEGRATION ─────────── */
.viewport-mode-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px;
}
.v-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.v-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.v-tab-btn.active {
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}
.v-tab-pill {
  font-size: 9px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.3);
}

/* ── ALADIN LITE STAGE ─────────────────────────────────────── */
.aladin-stage {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #030508;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}
.aladin-lite-container {
  width: 100%;
  height: 512px;
  position: relative;
  background: #030508;
}
.aladin-lite-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.aladin-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
}
.aladin-hud-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.aladin-hud-label {
  font-weight: 600;
  letter-spacing: 0.5px;
}
.aladin-survey-select {
  background: rgba(3, 5, 8, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #f1f5f9;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 11px;
  outline: none;
}
.aladin-survey-select:focus {
  border-color: #00e5ff;
}

/* ── DATA FEED HEADER BADGE ─────────────────────────────────── */
.data-feed-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px 10px;
}
.form-select-header {
  background: transparent;
  border: none;
  color: #00e5ff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.form-select-header option {
  background: #0b1120;
  color: #f8fafc;
}
.btn-xs {
  padding: 4px 10px;
  font-size: 10.5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-xs:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: #00e5ff;
  color: #fff;
}

