:root {
  --bg-deep: #05080f;
  --bg-surface: #0b1220;
  --bg-elevated: #111b2e;
  --bg-hover: #17243d;
  --border: #1e2f4d;
  --border-bright: #2c4570;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --amber: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.22);
  --red: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.28);
  --cyan: #06b6d4;
  --blue: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
}

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

html, body {
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

strong, .tele-metric strong, .pill-count, .map-zoom-readout, code {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* TOP COMMAND BAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(8, 14, 25, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 11px;
}

.radar-emblem {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.22) 0%, rgba(6, 10, 16, 0.95) 72%);
  border: 1.5px solid rgba(16, 185, 129, 0.65);
  overflow: hidden;
  flex-shrink: 0;
}

.radar-sweep {
  position: absolute;
  inset: -4px;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 290deg, rgba(16, 185, 129, 0.72) 360deg);
  animation: radarSpin 2.4s linear infinite;
}

.radar-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #10b981;
}

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

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

.brand-copy h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.pwa-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.brand-subtitle {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.brand-subtitle strong {
  color: #34d399;
}

/* TELEMETRY METRICS */
.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.tele-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.live {
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulseDot 1.6s ease-in-out infinite;
}

.status-dot.err {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.tele-metric {
  display: flex;
  flex-direction: column;
}

.tele-label {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
}

.tele-metric strong {
  font-size: 0.82rem;
  color: #e2e8f0;
}

/* ACTION BUTTONS */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #34d399;
  color: #03150e;
  font-weight: 700;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.btn-sim.active {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--amber);
  color: #fde68a;
}

.btn-icon.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--cyan);
  color: #67e8f9;
}

.btn-install {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.55);
  color: #bfdbfe;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--red);
  color: #fecaca;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 0.72rem;
}

.spinning {
  display: inline-block;
  animation: radarSpin 0.8s linear infinite;
}

/* SIMULATION & ERROR BANNERS */
.sim-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.12));
  border-bottom: 1px solid rgba(245, 158, 11, 0.55);
  color: #fef3c7;
  font-size: 0.82rem;
}

.sim-banner code {
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 6px;
  border-radius: 4px;
  color: #fde047;
  font-weight: 700;
}

.error-banner {
  padding: 9px 16px;
  background: rgba(239, 68, 68, 0.18);
  border-bottom: 1px solid rgba(239, 68, 68, 0.5);
  color: #fecaca;
  font-size: 0.82rem;
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-pill small {
  font-weight: 400;
  opacity: 0.8;
}

.mode-pill:hover {
  border-color: var(--border-bright);
  color: var(--text-main);
}

.mode-pill.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: var(--emerald);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.18);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pill-dot.target { background: var(--emerald); }
.pill-dot.amber { background: var(--amber); }
.pill-dot.cyan { background: var(--cyan); }
.pill-dot.neutral { background: #94a3b8; }

.pill-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  font-size: 0.74rem;
  color: #e2e8f0;
}

.search-wrap {
  position: relative;
  flex: 1 1 290px;
  max-width: 460px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 11px;
  font-size: 0.85rem;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  padding: 8px 34px 8px 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
}

#searchInput:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.clear-search {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.8rem;
}

/* MAIN GRID: LIVE ZOOM STAGE + CARDS LIST */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 14px;
  padding: 14px 16px;
  align-items: start;
}

.zoom-stage-card,
.detections-sidebar,
.full-map-section,
.events-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stage-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.target-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.target-badge {
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.target-badge.ref-mode {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.5);
}

.target-identity h2 {
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.direction-chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #bfdbfe;
}

.stage-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zoom-levels,
.tour-controls {
  display: inline-flex;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.z-btn,
.nav-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  border-right: 1px solid var(--border);
}

.z-btn:last-child,
.nav-btn:last-child {
  border-right: none;
}

.z-btn.active,
.nav-btn.active {
  background: rgba(16, 185, 129, 0.24);
  color: #6ee7b7;
}

.spot-location-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 9px 14px;
  background: rgba(11, 18, 32, 0.9);
  border-bottom: 1px solid var(--border);
}

.loc-lbl {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.loc-item strong {
  font-size: 0.83rem;
  color: #f8fafc;
}

/* OPTICAL LIVE ZOOM VIEWPORT */
.optical-viewport {
  position: relative;
  width: 100%;
  height: 430px;
  background: #000000;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.optical-viewport:active {
  cursor: grabbing;
}

.optical-canvas-wrap {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}

#spotPanelImg {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.sim-track-overlay {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.sim-track-prefix {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 900;
  font-size: 9.5px;
  line-height: 1;
  color: #ffffff;
  background: #000000;
  padding: 0 2px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.sim-track-bar {
  width: 38px;
  height: 8px;
  background: #ff0000;
}

/* TARGET RETICLE ON LIVE TRACK */
.target-reticle {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
}

.reticle-box {
  display: block;
  width: 56px;
  height: 30px;
  border: 2px solid #10b981;
  border-radius: 5px;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.9), inset 0 0 8px rgba(16, 185, 129, 0.35);
  animation: reticlePulse 1.3s ease-in-out infinite;
}

.reticle-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 84px;
  height: 84px;
  transform: translate(-50%, -50%);
  border: 1px dashed rgba(52, 211, 153, 0.65);
  border-radius: 50%;
  animation: radarSpin 8s linear infinite;
}

.reticle-tag {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #10b981;
  color: #02140d;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

@keyframes reticlePulse {
  0%, 100% { transform: scale(1); border-color: #10b981; }
  50% { transform: scale(1.07); border-color: #fde047; }
}

.viewport-hud-corner {
  position: absolute;
  z-index: 10;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(5, 8, 15, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.22);
  font-size: 0.69rem;
  color: #cbd5e1;
  pointer-events: none;
}
.viewport-hud-corner.top-left { top: 10px; left: 10px; color: #6ee7b7; font-weight: 700; }
.viewport-hud-corner.bottom-right { bottom: 10px; right: 10px; }

/* SIDEBAR ZOOM CARDS */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 0.94rem;
  font-weight: 800;
}

.sidebar-header p {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.zero-todd-box {
  margin: 10px 12px 0;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(52, 211, 153, 0.35);
  font-size: 0.79rem;
  color: #e2e8f0;
}

.zero-todd-box strong {
  color: #6ee7b7;
}

.zero-todd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.station-matches {
  padding: 8px 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.st-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.14);
  color: #a5f3fc;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.st-chip:hover {
  background: rgba(6, 182, 212, 0.28);
}

.zoom-cards-list {
  max-height: 505px;
  overflow-y: auto;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zoom-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-deep);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.zoom-card:hover {
  border-color: var(--emerald);
  transform: translateY(-1px);
}

.zoom-card.selected {
  border-color: #34d399;
  box-shadow: 0 0 0 1px #34d399, 0 8px 22px rgba(16, 185, 129, 0.22);
}

.zoom-card.is-t-odd {
  border-left: 4px solid #10b981;
}

.zoom-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  background: var(--bg-elevated);
}

.zc-prefix-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zc-prefix {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 900;
  color: #ffffff;
}

.zc-tag {
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

.zc-tag.even {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.zc-tag.lic {
  background: rgba(234, 179, 8, 0.22);
  color: #fef08a;
}

.zc-tag.moved {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
}

.zc-loc {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 600;
}

.zc-crop-box {
  position: relative;
  width: 100%;
  height: 112px;
  background: #000000;
  overflow: hidden;
}

.zc-crop-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.65);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.zc-crosshair {
  position: absolute;
  width: 44px;
  height: 24px;
  transform: translate(-50%, -50%);
  border: 1.8px solid #10b981;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.85);
  pointer-events: none;
}

/* FULL 3-PANEL CTC EXPLORER */
.full-map-section {
  margin: 0 16px 14px;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.panel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text-muted);
  cursor: pointer;
}

.panel-tab strong {
  font-size: 0.82rem;
  color: var(--text-main);
}

.panel-tab span {
  font-size: 0.7rem;
}

.panel-tab em {
  font-style: normal;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  font-weight: 700;
}

.panel-tab.active {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.14);
}

.map-tools-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

#stationJumpSelect {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text-main);
  font-size: 0.79rem;
  max-width: 310px;
}

.map-zoom-controls {
  display: inline-flex;
  align-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.map-zoom-readout {
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #e2e8f0;
}

.full-board-viewport {
  position: relative;
  width: 100%;
  height: 540px;
  overflow: auto;
  background: #000000;
}

.full-board-inner {
  position: relative;
  transform-origin: 0 0;
}

#fullBoardImg {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.board-pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.board-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  border: 1.5px solid rgba(56, 189, 248, 0.85);
  background: rgba(8, 18, 34, 0.9);
  color: #bae6fd;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.85);
  transition: transform 0.12s ease;
}

.board-pin:hover {
  transform: translate(-50%, -108%) scale(1.12);
  z-index: 25;
}

.board-pin.t-odd {
  background: #10b981;
  color: #021810;
  border-color: #fde047;
  font-size: 12.5px;
  z-index: 20;
  animation: reticlePulse 1.2s ease-in-out infinite;
}

.board-pin.t-even {
  background: rgba(245, 158, 11, 0.94);
  color: #1a0f00;
  border-color: #fef08a;
  z-index: 15;
}

/* DISPATCH LOG */
.events-section {
  margin: 0 16px 24px;
}

.events-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.events-header h3 {
  font-size: 0.88rem;
}

.events-header span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.events-list {
  max-height: 190px;
  overflow-y: auto;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ev-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 9px;
  border-radius: 6px;
  background: var(--bg-deep);
  border: 1px solid rgba(30, 47, 77, 0.7);
  font-size: 0.78rem;
  cursor: pointer;
}

.ev-row:hover {
  border-color: var(--emerald);
}

.ev-row.ev-todd {
  border-left: 3px solid var(--emerald);
  background: rgba(16, 185, 129, 0.08);
}

.ev-time {
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
  font-size: 0.74rem;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-size: 0.96rem;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field input,
.field select {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text-main);
  font-size: 0.85rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.install-guide {
  font-size: 0.84rem;
  color: #cbd5e1;
}

.install-guide ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* RESPONSIVE MOBILE CAB / PHONE LAYOUT */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .optical-viewport {
    height: 330px;
  }
  .spot-location-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .btn-label {
    display: none;
  }
  .btn-primary .btn-label,
  .btn-sim .btn-label {
    display: inline;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .optical-viewport {
    height: 270px;
  }
  .full-board-viewport {
    height: 380px;
  }
}
