/* SatView v3 — Dark Theme (SatDream Tech) */

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

:root {
  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:   clamp(0.6875rem, 0.65rem + 0.2vw, 0.75rem);
  --text-sm:   clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-base: clamp(0.8125rem, 0.78rem + 0.2vw, 0.875rem);
  --text-lg:   clamp(0.9375rem, 0.88rem + 0.3vw, 1.0625rem);
  --text-xl:   clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --text-2xl:  clamp(1.5rem, 1.2rem + 1vw, 2rem);

  /* 4px spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Dark Theme Palette */
  --color-bg:             #1A1F24;
  --color-surface:        #21272D;
  --color-surface-2:      #272D34;
  --color-surface-3:      #2E353C;
  --color-card:           #272D34;
  --color-border:         #333B43;
  --color-divider:        #2E353C;

  /* Text — high contrast on dark */
  --color-text:           #E8ECEF;
  --color-text-muted:     #8A949E;
  --color-text-faint:     #5E6972;
  --color-text-inverse:   #1A1F24;

  /* Accent — SatDream Teal */
  --color-accent:         #4FA8C9;
  --color-accent-hover:   #6BBAD5;
  --color-accent-active:  #3A8FAD;
  --color-accent-glow:    rgba(79, 168, 201, 0.12);
  --color-accent-light:   rgba(79, 168, 201, 0.16);

  /* Semantic */
  --color-success:        #34D399;
  --color-warning:        #FBBF24;
  --color-error:          #F87171;
  --color-info:           #60A5FA;

  /* Sensor Category Colors — brighter for dark bg */
  --color-optical:        #4FA8C9;
  --color-sar:            #34D399;
  --color-rf:             #F87171;
  --color-ir:             #FBBF24;
  --color-hyperspectral:  #A78BFA;
  --color-ais:            #60A5FA;
  --color-multispectral:  #10B981;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows — stronger for dark theme */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);

  /* Layout */
  --sidebar-width: 320px;
  --header-height: 48px;
  --drawer-collapsed: 40px;
  --drawer-expanded: 280px;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr auto;
  height: 100dvh;
  overflow: hidden;
}

.app-header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.app-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* SatDream Tech logo (inline SVG) */
.app-header__brand-logo {
  display: flex;
  align-items: center;
  height: 26px;
  text-decoration: none;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s;
}
.app-header__brand-logo:hover {
  opacity: 0.8;
}
.app-header__brand-logo svg {
  height: 26px;
  width: auto;
  display: block;
  object-fit: contain;
}

.app-header__divider {
  width: 1px;
  height: 22px;
  background: var(--color-border);
  margin: 0 var(--space-1);
}

.app-header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-accent);
  font-weight: 600;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
}

.app-header__logo svg {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
}

/* Clock display in header */
.app-header__clock {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.app-header__clock-icon {
  width: 14px;
  height: 14px;
  color: var(--color-accent);
}

.app-header__date {
  color: var(--color-text);
  font-weight: 500;
}

.app-header__time {
  color: var(--color-accent);
  font-weight: 600;
}

.app-header__center {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ===== SIDEBAR with resizable handle ===== */
.sidebar-wrapper {
  grid-column: 1;
  grid-row: 2 / -1;
  position: relative;
  display: flex;
  min-width: 240px;
  max-width: 600px;
}

.app-sidebar {
  flex: 1;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}

.sidebar-resize-handle {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  transition: background 150ms ease;
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: var(--color-accent);
}

.sidebar-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 32px;
  border-radius: 2px;
  background: var(--color-text-faint);
  opacity: 0;
  transition: opacity 150ms ease;
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.dragging::after {
  opacity: 1;
  background: var(--color-accent);
}

.app-map {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  overflow: hidden;
}

.app-drawer {
  grid-column: 2;
  grid-row: 3;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  overflow: hidden;
  transition: height 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-drawer.collapsed {
  height: var(--drawer-collapsed);
}

.app-drawer.expanded {
  height: var(--drawer-expanded);
}

/* ===== TIME CONTROL BAR ===== */
.time-control-bar {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(33, 39, 45, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 8px 16px;
  box-shadow: var(--shadow-lg);
  min-width: 480px;
  max-width: 90%;
}

.time-control-bar__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.time-control-bar__inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.time-control-bar__input {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  outline: none;
  width: auto;
  color-scheme: dark;
}

.time-control-bar__input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.time-control-bar__slider {
  flex: 1;
  min-width: 120px;
  accent-color: var(--color-accent);
  cursor: pointer;
  height: 4px;
}

.time-control-bar__offset {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: 600;
  min-width: 60px;
  text-align: center;
  white-space: nowrap;
}

.time-control-bar__reset {
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.time-control-bar__reset:hover {
  background: var(--color-accent);
  color: #fff;
}

/* ===== NEXT-PASS PANEL ===== */
.next-pass-panel {
  position: absolute;
  top: 60px;
  right: 10px;
  z-index: 1000;
  background: rgba(33, 39, 45, 0.97);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 420px;
  min-width: 320px;
  max-height: calc(100vh - 160px);
  overflow: hidden;
  display: none;
}

.next-pass-panel.visible {
  display: block;
}

.next-pass-panel__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.next-pass-panel__title svg {
  width: 16px;
  height: 16px;
  color: var(--color-accent);
}

.next-pass-panel__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  cursor: pointer;
}

.next-pass-panel__close:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.next-pass-panel__content {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.next-pass-panel__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 5px 0;
  border-bottom: 1px solid var(--color-divider);
}

.next-pass-panel__item:last-child {
  border-bottom: none;
}

.next-pass-panel__item-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.next-pass-panel__sat-name {
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-pass-panel__pass-num {
  font-size: 9px;
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}

.next-pass-panel__item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.next-pass-panel__date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
}

.next-pass-panel__time {
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-weight: 600;
}

.next-pass-panel__hint {
  font-size: 10px;
  color: var(--color-text-faint);
  margin-top: var(--space-2);
  font-style: italic;
}

/* ===== HEADER BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn--primary:hover {
  background: var(--color-accent-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn--ghost:hover {
  color: var(--color-text);
  border-color: var(--color-text-faint);
  background: var(--color-surface-2);
}

.btn--sm {
  padding: 3px 10px;
  font-size: var(--text-xs);
}

.btn--icon {
  padding: var(--space-1);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}

.btn--icon:hover {
  color: var(--color-accent);
  background: var(--color-accent-glow);
}

/* ===== SIDEBAR ===== */
.sidebar-section {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.sidebar-section__title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.sidebar-section__toggle {
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  transition: transform 200ms ease;
}

.sidebar-section__toggle.collapsed {
  transform: rotate(-90deg);
}

.sidebar-section__count {
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Resolution Slider */
.resolution-slider {
  width: 100%;
  padding: var(--space-2) 0;
}

.resolution-slider__ticks {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-1);
  padding: 0 2px;
}

.resolution-slider__tick {
  font-size: 10px;
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}

.resolution-slider__tick.active {
  color: var(--color-accent);
}

.resolution-slider__value {
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: var(--space-1);
  font-family: var(--font-mono);
}

/* Sensor Chips */
.sensor-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
}

.sensor-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  width: 100%;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  transition: all 180ms ease;
  box-sizing: border-box;
}

.sensor-chip:hover {
  border-color: var(--color-text-faint);
}

.sensor-chip.active {
  color: #fff;
  border-color: transparent;
}

.sensor-chip.active[data-type="optical"] { background: var(--color-optical); }
.sensor-chip.active[data-type="sar"] { background: var(--color-sar); }
.sensor-chip.active[data-type="rf"] { background: var(--color-rf); }
.sensor-chip.active[data-type="ir"] { background: var(--color-ir); }
.sensor-chip.active[data-type="hyperspectral"] { background: var(--color-hyperspectral); }
.sensor-chip.active[data-type="ais"] { background: var(--color-ais); }
.sensor-chip.active[data-type="multispectral"] { background: var(--color-multispectral); }

.sensor-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sensor-chip__dot[data-type="optical"] { background: var(--color-optical); }
.sensor-chip__dot[data-type="sar"] { background: var(--color-sar); }
.sensor-chip__dot[data-type="rf"] { background: var(--color-rf); }
.sensor-chip__dot[data-type="ir"] { background: var(--color-ir); }
.sensor-chip__dot[data-type="hyperspectral"] { background: var(--color-hyperspectral); }
.sensor-chip__dot[data-type="ais"] { background: var(--color-ais); }
.sensor-chip__dot[data-type="multispectral"] { background: var(--color-multispectral); }

.sensor-chip__count {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.7;
}

/* Operator List */
.operator-list {
  list-style: none;
}

.operator-item {
  border-bottom: 1px solid var(--color-divider);
}

.operator-item:last-child {
  border-bottom: none;
}

.operator-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-md);
}

.operator-header:hover {
  background: var(--color-accent-glow);
  margin: 0 calc(-1 * var(--space-3));
  padding: var(--space-2) var(--space-3);
}

.operator-checkbox {
  width: 16px;
  height: 16px;
  appearance: none;
  border: 1.5px solid var(--color-text-faint);
  border-radius: 3px;
  background: var(--color-surface-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.operator-checkbox:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.operator-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.operator-checkbox:indeterminate {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.operator-checkbox:indeterminate::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 5px;
  width: 8px;
  height: 2px;
  background: #fff;
}

.operator-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  flex: 1;
}

.operator-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

.operator-expand {
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.operator-expand.open {
  transform: rotate(90deg);
}

/* Satellite sub-items */
.satellite-list {
  list-style: none;
  padding-left: var(--space-6);
  overflow: hidden;
  transition: max-height 300ms ease;
}

.satellite-list.hidden {
  max-height: 0;
}

.satellite-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 3px 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.satellite-item:hover {
  background: var(--color-accent-glow);
}

.satellite-item__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.satellite-item__name {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.satellite-item:hover .satellite-item__name {
  color: var(--color-accent);
}

.satellite-item__res {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--color-text-faint);
  flex-shrink: 0;
}

.satellite-item__checkbox {
  width: 14px;
  height: 14px;
  appearance: none;
  border: 1.5px solid var(--color-text-faint);
  border-radius: 3px;
  background: var(--color-surface-2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.satellite-item__checkbox:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.satellite-item__checkbox:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* ===== SELECTED SATELLITES BAR ===== */
.selected-bar {
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  min-height: 40px;
}

.selected-bar__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

.selected-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  border: 1px solid rgba(79, 168, 201, 0.25);
  font-weight: 500;
}

.selected-pill__close {
  width: 12px;
  height: 12px;
  cursor: pointer;
  color: var(--color-text-faint);
}

.selected-pill__close:hover {
  color: var(--color-error);
}

/* ===== MAP OVERRIDES ===== */
#map {
  width: 100%;
  height: 100%;
  background: #1A1F24;
}

/* Leaflet overrides for dark theme */
.leaflet-control-zoom a {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--color-surface-2) !important;
}

.leaflet-bar {
  border: 1px solid var(--color-border) !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-control-attribution {
  background: rgba(26, 31, 36, 0.85) !important;
  color: var(--color-text-faint) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--color-text-muted) !important;
}

/* Draw toolbar dark theme */
.leaflet-draw-toolbar a {
  background-color: var(--color-surface) !important;
  border-color: var(--color-border) !important;
}

.leaflet-draw-actions a {
  background: var(--color-surface-2) !important;
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}

/* Satellite popup — dark */
.sat-popup {
  min-width: 220px;
}

.sat-popup .leaflet-popup-content-wrapper {
  background: var(--color-card) !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-lg) !important;
}

.sat-popup .leaflet-popup-tip {
  background: var(--color-card) !important;
  border: 1px solid var(--color-border) !important;
}

.sat-popup .leaflet-popup-close-button {
  color: var(--color-text-muted) !important;
}

.sat-card {
  padding: 0;
}

.sat-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-2);
}

.sat-card__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sat-card__title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}

.sat-card__operator {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.sat-card__row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: var(--text-xs);
}

.sat-card__label {
  color: var(--color-text-faint);
}

.sat-card__value {
  color: var(--color-text);
  font-weight: 500;
  font-family: var(--font-mono);
}

.sat-card__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-divider);
}

.sat-card__btn {
  flex: 1;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: transparent;
}

.sat-card__btn:hover {
  background: var(--color-accent-glow);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.sat-card__btn--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ===== BOTTOM DRAWER ===== */
.drawer-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  user-select: none;
  height: var(--drawer-collapsed);
}

.drawer-handle:hover {
  background: var(--color-surface-2);
}

.drawer-handle__left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.drawer-handle__chevron {
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  transition: transform 200ms ease;
}

.drawer-handle__chevron.open {
  transform: rotate(180deg);
}

.drawer-handle__stats {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.drawer-handle__stats strong {
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.drawer-content {
  padding: 0 var(--space-4) var(--space-3);
  overflow-y: auto;
  max-height: calc(var(--drawer-expanded) - var(--drawer-collapsed));
  overscroll-behavior: contain;
}

/* Drawer Table */
.drawer-table {
  width: 100%;
  font-size: var(--text-xs);
}

.drawer-table thead th {
  text-align: left;
  padding: var(--space-1) var(--space-2);
  color: var(--color-text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
}

.drawer-table tbody td {
  padding: var(--space-1) var(--space-2);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums lining-nums;
}

.drawer-table tbody tr:hover td {
  background: var(--color-accent-glow);
  color: var(--color-text);
}

.orbit-toggle {
  width: 32px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  cursor: pointer;
  position: relative;
  transition: all 200ms ease;
}

.orbit-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-text-faint);
  transition: all 200ms ease;
}

.orbit-toggle.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.orbit-toggle.active::after {
  left: 16px;
  background: #fff;
}

/* Status dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot--active { background: var(--color-success); }
.status-dot--inactive { background: var(--color-text-faint); }

/* Compatibility badge */
.compat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 500;
}

.compat-badge--yes {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.compat-badge--no {
  background: rgba(94, 105, 114, 0.15);
  color: var(--color-text-faint);
}

/* ===== SIDEBAR ACTIONS ===== */
.sidebar-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.sidebar-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
}

/* ===== SEARCH ===== */
.search-input {
  width: 100%;
  padding: var(--space-1) var(--space-3);
  padding-left: 32px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--text-sm);
  outline: none;
}

.search-input::placeholder {
  color: var(--color-text-faint);
}

.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.search-wrapper {
  position: relative;
}

.search-wrapper svg {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-faint);
  pointer-events: none;
}

/* ===== ORBIT STYLES ON MAP ===== */
.satellite-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(79, 168, 201, 0.5);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(79, 168, 201, 0.3); }
  50% { box-shadow: 0 0 16px rgba(79, 168, 201, 0.7); }
}

/* ===== LOADING STATES ===== */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 36, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== FOOTER ===== */
.app-footer {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--color-text-faint);
  z-index: 50;
  display: flex;
  gap: var(--space-3);
  background: rgba(26, 31, 36, 0.85);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  pointer-events: all;
  border: 1px solid var(--color-border);
}

.app-footer a {
  color: var(--color-text-faint);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--color-accent);
}

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.empty-state__text {
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  max-width: 200px;
}

/* ===== LAYER SWITCHER ===== */
.layer-switcher {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
  display: flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.layer-switcher__btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: rgba(33, 39, 45, 0.92);
  backdrop-filter: blur(8px);
  cursor: pointer;
  border: none;
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
  transition: all 150ms ease;
}

.layer-switcher__btn:last-child {
  border-right: none;
}

.layer-switcher__btn:hover {
  color: var(--color-text);
  background: rgba(46, 53, 60, 0.95);
}

.layer-switcher__btn.active {
  color: #fff;
  background: var(--color-accent);
}

.layer-switcher__btn svg {
  width: 14px;
  height: 14px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
  }

  .sidebar-wrapper {
    display: none;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    z-index: 200;
    grid-column: 1;
    grid-row: 2;
  }

  .sidebar-wrapper.mobile-open {
    display: flex;
  }

  .app-map {
    grid-column: 1;
  }

  .app-drawer {
    grid-column: 1;
  }

  .time-control-bar {
    min-width: auto;
    width: calc(100% - 20px);
    flex-wrap: wrap;
  }

  .app-header__clock {
    display: none;
  }

  .sidebar-resize-handle {
    display: none;
  }

  .layer-switcher {
    top: auto;
    bottom: 100px;
    left: 10px;
  }
}

/* ===== TOOLTIP ===== */
.tooltip {
  position: absolute;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
}

/* Select all / deselect all */
.select-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.select-all-row button {
  font-size: var(--text-xs);
  color: var(--color-accent);
  cursor: pointer;
  padding: 2px 4px;
  font-weight: 500;
}

.select-all-row button:hover {
  text-decoration: underline;
}

/* Mobile menu button hidden on desktop */
.mobile-menu-btn {
  display: none;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

/* Next-pass button on map */
.next-pass-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  background: rgba(33, 39, 45, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  white-space: nowrap;
  z-index: 1000;
}

.next-pass-btn:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.next-pass-btn svg {
  width: 14px;
  height: 14px;
}

/* ====================================================
   SatView v3 — New Styles
   ==================================================== */

/* ===== SIDEBAR TABS ===== */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: all 150ms ease;
  white-space: nowrap;
  position: relative;
}

.sidebar-tab:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.sidebar-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.sidebar-tab svg {
  flex-shrink: 0;
}

.sidebar-tab__badge {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  background: var(--color-accent-light);
  color: var(--color-accent);
  padding: 0 5px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

/* Sidebar tab content panels */
.sidebar-tab-content {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-tab-content.active {
  display: flex;
}

/* ===== AOI TAB ===== */
.aoi-tab-actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.aoi-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2);
}

.aoi-tab-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ===== AOI CARD ===== */
.aoi-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: all 150ms ease;
}

.aoi-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent-glow);
}

.aoi-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 6px;
}

.aoi-card__type {
  color: var(--color-text-faint);
  flex-shrink: 0;
  display: flex;
}

.aoi-card__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aoi-card__priority-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.aoi-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.aoi-card__actions {
  display: flex;
  gap: var(--space-1);
  border-top: 1px solid var(--color-divider);
  padding-top: 6px;
}

.aoi-card__action {
  width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 150ms ease;
}

.aoi-card__action:hover {
  background: var(--color-accent-glow);
  color: var(--color-accent);
}

.aoi-card__action--danger:hover {
  background: rgba(248, 113, 113, 0.12);
  color: var(--color-error);
}

/* ===== RIGHT PANEL ===== */
.right-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

.right-panel.open {
  transform: translateX(0);
}

.right-panel__header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.right-panel__header-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.right-panel__name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  outline: none;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.right-panel__name:focus {
  border-bottom-color: var(--color-accent);
}

.right-panel__close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  cursor: pointer;
  border: none;
  background: transparent;
  flex-shrink: 0;
}

.right-panel__close:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

/* Right Panel Tabs */
.right-panel__tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.right-panel__tab {
  flex: 1;
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: all 150ms ease;
}

.right-panel__tab:hover {
  color: var(--color-text);
}

.right-panel__tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.right-panel__content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.right-panel__tab-content {
  display: none;
  padding: var(--space-3);
}

.right-panel__tab-content.active {
  display: block;
}

/* Right panel info styles */
.rp-info-grid {
  margin-bottom: var(--space-3);
}

.rp-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--color-divider);
}

.rp-info-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.rp-info-value {
  font-size: var(--text-xs);
  color: var(--color-text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rp-form-group {
  margin-bottom: var(--space-3);
}

.rp-form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rp-form-select {
  width: 100%;
  padding: 5px 8px;
  font-size: var(--text-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  outline: none;
  cursor: pointer;
  color-scheme: dark;
}

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

.rp-form-textarea {
  width: 100%;
  padding: 6px 8px;
  font-size: var(--text-xs);
  font-family: var(--font-body);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  outline: none;
  resize: vertical;
  min-height: 40px;
}

.rp-form-textarea:focus {
  border-color: var(--color-accent);
}

.rp-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: var(--space-3) 0 var(--space-2);
}

.rp-sat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--space-3);
}

.rp-sat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.rp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.rp-action--danger {
  color: var(--color-error) !important;
  border-color: rgba(248, 113, 113, 0.3) !important;
}

.rp-action--danger:hover {
  background: rgba(248, 113, 113, 0.12) !important;
}

/* History tab */
.rp-history-list {
  padding-left: 0;
}

.rp-history-item {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
}

.rp-history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-top: 4px;
  flex-shrink: 0;
}

.rp-history-content {
  flex: 1;
  min-width: 0;
}

.rp-history-action {
  font-size: var(--text-xs);
  color: var(--color-text);
}

.rp-history-date {
  font-size: 10px;
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.rp-history-empty {
  padding: var(--space-6) var(--space-3);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-faint);
}

.rp-loading {
  padding: var(--space-6) var(--space-3);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-faint);
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ===== OPPORTUNITY CARDS ===== */
.opp-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.opp-sort {
  max-width: 130px;
}

.opp-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.opp-filter-label {
  font-size: 10px;
  color: var(--color-text-faint);
  white-space: nowrap;
}

.opp-cloud-slider {
  flex: 1;
  min-width: 60px;
  accent-color: var(--color-accent);
  cursor: pointer;
  height: 3px;
}

.opp-cloud-val {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-weight: 600;
  min-width: 32px;
}

.opp-timeline {
  /* scrollable container */
}

.opp-day {
  margin-bottom: var(--space-3);
}

.opp-day__label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-2);
}

.opp-day__count {
  font-weight: 400;
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: 6px;
}

.opportunity-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  transition: border-color 150ms ease;
}

.opportunity-card:hover {
  border-color: var(--color-text-faint);
}

.opportunity-card--clickable {
  cursor: pointer;
  position: relative;
}
.opportunity-card--clickable:hover {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent-glow);
}
.opportunity-card--clickable::after {
  content: 'Click to create Task Order';
  position: absolute;
  bottom: -2px;
  right: 8px;
  font-size: 9px;
  color: var(--color-accent);
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.opportunity-card--clickable:hover::after {
  opacity: 0.7;
}

.opportunity-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.opportunity-card__sat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}

.sat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.opportunity-card__time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-weight: 600;
}

.opportunity-card__score-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 6px;
}

.score-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.opportunity-card__score-bar {
  flex: 1;
  height: 4px;
  background: var(--color-surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.opportunity-card__score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 300ms ease;
}

.opportunity-card__metrics {
  display: flex;
  gap: var(--space-3);
}

.opp-metric {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--color-text-faint);
}

.opp-metric svg {
  color: var(--color-text-faint);
  flex-shrink: 0;
}

/* ===== AOI MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.visible {
  display: flex;
}

.aoi-modal {
  width: 90vw;
  max-width: 1100px;
  height: 80vh;
  max-height: 700px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aoi-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.aoi-modal__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.aoi-modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  cursor: pointer;
  border: none;
  background: transparent;
}

.aoi-modal__close:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}

.aoi-modal__body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.aoi-modal__map {
  flex: 6;
  position: relative;
  border-right: 1px solid var(--color-border);
}

.aoi-modal__map #modalMapContainer {
  width: 100%;
  height: 100%;
}

.aoi-modal__form {
  flex: 4;
  padding: var(--space-4);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Modal form controls */
.modal-form-group {
  margin-bottom: var(--space-3);
}

.modal-form-group label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-form-group input,
.modal-form-group select,
.modal-form-group textarea {
  width: 100%;
  padding: 6px 10px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  outline: none;
  color-scheme: dark;
  box-sizing: border-box;
}

.modal-form-group input:focus,
.modal-form-group select:focus,
.modal-form-group textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.modal-form-group input[readonly] {
  color: var(--color-text-muted);
  cursor: default;
}

.modal-form-group textarea {
  resize: vertical;
  min-height: 50px;
}

/* Coordinate input fields */
.modal-coord-fields {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
}
.modal-coord-fields > label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 8px;
  display: block;
}
.coord-input-row {
  display: flex;
  gap: 10px;
}
.coord-input-field {
  flex: 1;
}
.coord-input-field .coord-label {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  display: block;
}
.coord-input-field input {
  width: 100%;
  padding: 6px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}
.coord-input-field input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
  outline: none;
}

.aoi-modal__buttons {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
}

/* ===== SWATH TOGGLE ===== */
.swath-toggle {
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  background: rgba(33, 39, 45, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 150ms ease;
}

.swath-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-text-faint);
}

.swath-toggle.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

/* ===== KPI BAR ===== */
.kpi-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.kpi-bar__item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-bar__item--wide {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.kpi-bar__value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-mono);
}

.kpi-bar__value--sm {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
}

.kpi-bar__label {
  font-size: 10px;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.kpi-bar__sub {
  font-size: 10px;
  color: var(--color-success);
  font-family: var(--font-mono);
}

.kpi-bar__divider {
  width: 1px;
  height: 20px;
  background: var(--color-border);
}

.kpi-bar__dots {
  display: flex;
  gap: 2px;
  align-items: center;
}

.kpi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== RESPONSIVE for v3 ===== */
@media (max-width: 768px) {
  .right-panel {
    width: 100%;
  }

  .aoi-modal {
    width: 98vw;
    height: 95vh;
    max-height: none;
  }

  .aoi-modal__body {
    flex-direction: column;
  }

  .aoi-modal__map {
    flex: 1;
    min-height: 250px;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .aoi-modal__form {
    flex: 1;
    overflow-y: auto;
  }

  .kpi-bar {
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .kpi-bar__item--wide {
    display: none;
  }

  .swath-toggle {
    top: auto;
    bottom: 160px;
    right: 10px;
  }
}
