/* ============================================================
   KGS Landslide Monitoring Network — style.css
   Theme: Scientific dashboard — dark, earthy, ADA-compliant
   All text meets WCAG AA contrast (4.5:1 normal, 3:1 large)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-dark:       #e8f1ef;
  --bg-panel:      #1a2420;
  --bg-card:       #222e29;
  --bg-card-hover: #2a3830;
  --bg-header:     #0d1f3c;

  --border:        rgba(140, 195, 160, 0.18);
  --border-bright: rgba(140, 195, 160, 0.40);

  --text-primary:   #f0f5f2;
  --text-secondary: #b8d4c0;
  --text-muted:     #b6d1c2;
  --text-on-accent: #ffffff;

  --accent-green:  #5ec47f;
  --accent-gold:   #d4a840;
  --accent-amber:  #e0844a;
  --accent-blue:   #55afd4;
  --accent-red:    #e07070;

  --dry-1:  #6b3a2a;
  --dry-2:  #9b5a2a;
  --dry-3:  #c4813c;
  --mid-1:  #c9a84c;
  --mid-2:  #8ab56e;
  --wet-1:  #5dba7d;
  --wet-2:  #3d9e6a;
  --wet-3:  #2a7a52;

  --panel-width: 440px;
  --header-h:    80px;
  --font-body:   'DM Sans', sans-serif;
  --font-mono:   'DM Mono', monospace;
  --radius:      6px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Layout ─────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────────── */
#header {
  height: var(--header-h);
  background: var(--bg-header);
  border-bottom: 2px solid rgba(100, 150, 220, 0.35);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  flex-shrink: 0;
  z-index: 100;
}

.kgs-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.2s;
  opacity: 1;
}
.kgs-logo-link:hover { opacity: 0.85; }

.kgs-logo {
  height: 40px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* ─── CLIMBS logo ────────────────────────────────────────────── */
.climbs-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  transition: opacity 0.2s;
}
.climbs-logo-link:hover { opacity: 0.85; }

.climbs-logo {
  height: 52px;
  width: auto;
  display: block;
  background: rgb(238, 238, 238);
  border-radius: 4px;
  padding: 4px 8px;
}

.logo-stack {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 32px;
  background: var(--border-bright);
  margin: 0 18px;
  flex-shrink: 0;
}

.title-block h1 {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.title-block p {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

#last-updated {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Info Button ────────────────────────────────────────────── */
.info-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  flex-shrink: 0;
}

.info-btn svg { width: 16px; height: 16px; }

.info-btn:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(94, 196, 127, 0.1);
}

.info-btn:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

/* ─── Map Container ──────────────────────────────────────────── */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map { width: 100%; height: 100%; }

#map-loading {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 14, 0.45);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

#map-loading.hidden { display: none; }

/* ─── Basemap Selector ───────────────────────────────────────── */
#basemap-selector {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 3px;
  box-shadow: var(--shadow);
  max-width: 450px;
}

.basemap-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 2px 4px;
}

.basemap-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 1px);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}

.basemap-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.basemap-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.basemap-btn.active {
  background: var(--bg-card);
  border-color: var(--border-bright);
  color: var(--accent-green);
}

.basemap-btn:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

/* ─── Map Toolbar (left-side floating) ───────────────────────── */
#map-toolbar {
  position: absolute;
  top: 130px;
  left: 15px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  width: 64px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.15s;
  line-height: 1.2;
  text-align: center;
}

.map-tool-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.map-tool-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.map-tool-btn.active {
  color: var(--accent-green);
  background: rgba(94, 196, 127, 0.1);
}

.map-tool-btn:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: -2px;
}

.map-tool-divider {
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

@media (max-width: 640px) {
  #map-toolbar {
    top: auto;
    bottom: 140px;
    left: 10px;
  }
  .map-tool-btn { width: 52px; padding: 8px 6px; }
}

/* ─── Mobile map controls toggle ────────────────────────────── */
#map-controls-toggle {
  display: none;
}

@media (max-width: 640px) {
  #map-controls-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 130px;
    left: 10px;
    transform: none;
    z-index: 51;
    width: 36px;
    height: 36px;
    background: var(--bg-panel);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    color: var(--text-secondary);
  }

  #map-controls-toggle svg { width: 16px; height: 16px; }

  #map-controls-toggle.active {
    color: var(--accent-green);
    border-color: var(--accent-green);
    background: rgba(94,196,127,0.08);
  }

  #basemap-selector {
    display: none;
    top: 130px;
    left: 10px;
    transform: none;
    max-width: calc(100vw - 20px);
  }

  #basemap-selector.mobile-open {
    display: flex;
  }
}

/* ─── Unified Map Legend Panel ───────────────────────────────── */
#map-legend-panel {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 320px;
  max-width: calc(100vw - 32px);
}

/* ── Legend header (always visible) ─────────────────────────── */
#legend-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
}

#legend-bar-row {
  flex: 1;
  display: flex;
  align-items: center;
}

#legend-sat,
#legend-precip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-label {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  white-space: nowrap;
}

.legend-unit {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: 4px;
  white-space: nowrap;
}

.legend-bar {
  width: 140px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right,
    var(--dry-1) 0%,
    var(--dry-3) 25%,
    var(--mid-1) 45%,
    var(--mid-2) 60%,
    var(--wet-1) 80%,
    var(--wet-3) 100%);
}

.legend-bar-precip {
  width: 140px;
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right,
    #c8d2c8 0%,
    #a0c3dc 15%,
    #5096d2 40%,
    #1e5ab4 70%,
    #0a2878 100%);
}

/* ── Collapse toggle button ──────────────────────────────────── */
#legend-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.15s;
}

#legend-collapse-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-green);
}

#legend-collapse-btn:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

#legend-chevron {
  transition: transform 0.2s ease;
}

/* ── Collapsible body ────────────────────────────────────────── */
#legend-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

#legend-body.open {
  max-height: 400px;
}

/* ── Sections inside the body ────────────────────────────────── */
.legend-section-divider {
  height: 1px;
  background: var(--border-bright);
  margin: 0 12px;
}

.legend-section-content {
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-section-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.legend-sub-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Time slider section ─────────────────────────────────────── */
.legend-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#time-slider-input {
  width: 220px;
  accent-color: var(--accent-green);
  flex-shrink: 0;
}

.legend-status {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent-green);
  min-width: 110px;
}

.legend-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Radar section ───────────────────────────────────────────── */
.legend-radar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#radar-opacity {
  width: 90px;
  accent-color: var(--accent-blue);
}

.radar-sep {
  width: 1px;
  height: 16px;
  background: var(--border-bright);
  flex-shrink: 0;
}

#radar-controls button,
.legend-radar-row button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.15s;
}

#radar-controls button:hover,
.legend-radar-row button:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* ── Susceptibility section ──────────────────────────────────── */
.legend-susc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.susc-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.susc-swatch.susc-very-low  { background: #5dba7d; }
.susc-swatch.susc-low       { background: #7dcf9a; }
.susc-swatch.susc-moderate  { background: #c9a84c; }
.susc-swatch.susc-high      { background: #e0844a; }
.susc-swatch.susc-very-high { background: #e07070; }

/* ─── Radar Toggle Button ────────────────────────────────────── */
.radar-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-family: var(--font-body);
}

.radar-toggle:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(85, 175, 212, 0.12);
}

.radar-toggle.active {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(85, 175, 212, 0.18);
  box-shadow: 0 0 0 1px rgba(85,175,212,0.3);
}

.radar-toggle svg { width: 14px; height: 14px; }

/* ─── ArcGIS Legend widget ───────────────────────────────────── */
.esri-legend {
  background: var(--bg-panel) !important;
  color: var(--text-primary) !important;
}

.esri-legend__service-label {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  color: var(--text-muted) !important;
}

.esri-legend__layer-caption {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
  color: var(--text-muted) !important;
  display: none;
}

.esri-legend__layer-cell--info {
  font-family: var(--font-body) !important;
  font-size: 12px !important;
  color: var(--text-secondary) !important;
}

.esri-expand__container .esri-widget--button {
  background-color: var(--bg-panel) !important;
  border: 1px solid var(--border-bright) !important;
  color: var(--text-secondary) !important;
}

.esri-expand__container .esri-widget--button:hover {
  background-color: var(--bg-card-hover) !important;
  color: var(--text-primary) !important;
}

/* ─── Detail Panel ───────────────────────────────────────────── */
#detail-panel {
  position: absolute;
  top: 0;
  right: -100%;
  width: var(--panel-width);
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-bright);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
  overflow: hidden;
}

#detail-panel.open { right: 0; }

#panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-bright);
  flex-shrink: 0;
  background: var(--bg-card);
}

#panel-header .panel-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
  padding-right: 36px;
}

#panel-header .panel-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

#panel-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-size: 18px;
  line-height: 1;
}

#panel-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-amber);
}

#panel-close:focus-visible,
.radar-toggle:focus-visible,
.kgs-logo-link:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

#panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

#panel-body::-webkit-scrollbar { width: 5px; }
#panel-body::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 3px;
}

/* ─── Panel Tabs ─────────────────────────────────────────────── */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-bright);
  background: var(--bg-card);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  transition: all 0.15s;
}

.panel-tab:hover { color: var(--text-primary); }

.panel-tab.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── Section Labels ─────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ─── Sensor Cards ───────────────────────────────────────────── */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.sensor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.sc-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.sc-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--accent-green);
}

.sc-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-left: 3px;
}

.sc-depth {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
}

.sc-moisture .sc-value { color: var(--accent-green); }
.sc-matric   .sc-value { color: var(--accent-amber); }
.sc-temp     .sc-value { color: var(--accent-blue);  }
.sc-precip   .sc-value { color: var(--accent-gold);  }
.sc-airtemp  .sc-value { color: #a0c4e8; }
.sc-humidity .sc-value { color: #7ecec4; }

/* ─── Charts ─────────────────────────────────────────────────── */
.chart-section { margin-bottom: 22px; }

.chart-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.chart-wrapper canvas { max-height: 200px; }

/* ─── Loading State ──────────────────────────────────────────── */
#panel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  gap: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#panel-loading p {
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ─── Error State ────────────────────────────────────────────── */
.panel-error {
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.35);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 13px;
  color: #f09090;
  margin-bottom: 16px;
}

/* ─── Download button ────────────────────────────────────────── */
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  margin-top: 8px;
}

.download-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.download-btn:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
  background: rgba(94,196,127,0.08);
  text-decoration: none;
}

.download-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.download-format {
  background: var(--bg-panel);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 7px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.download-format:hover {
  border-color: var(--accent-green);
  color: var(--text-primary);
}

/* ─── Site Info Tab ──────────────────────────────────────────── */
.station-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.station-photo-placeholder {
  width: 100%;
  height: 120px;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  gap: 8px;
}

.station-photo-placeholder svg {
  width: 20px;
  height: 20px;
  opacity: 0.4;
}

.site-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.site-info-table tr {
  border-bottom: 1px solid var(--border);
}

.site-info-table tr:last-child {
  border-bottom: none;
}

.site-info-table td {
  padding: 9px 16px;
  vertical-align: top;
  line-height: 1.4;
}

.site-info-table td:first-child {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  width: 38%;
  padding-top: 10px;
}

.site-info-table td:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

.susc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.susc-very-low  { background: rgba(93,186,125,0.15);  color: #5dba7d; }
.susc-low       { background: rgba(93,186,125,0.12);  color: #7dcf9a; }
.susc-moderate  { background: rgba(201,168,76,0.15);  color: #c9a84c; }
.susc-high      { background: rgba(224,132,74,0.15);  color: #e0844a; }
.susc-very-high { background: rgba(224,112,112,0.15); color: #e07070; }
.susc-unknown   { background: rgba(140,195,160,0.08); color: var(--text-muted); }

.coords-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) {
  .logo-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .kgs-logo   { height: 32px; }
  .climbs-logo { height: 32px; }
  .title-block h1 {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-right {
    width: 100%;
    margin-left: 15px;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  .title-block p:first-of-type { display: none; }
}

@media (max-width: 640px) {
  :root { --panel-width: 100vw; --header-h: auto; }

  #header {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }

  .kgs-logo    { height: 28px; }
  .climbs-logo { height: 28px; }
  .header-divider { display: none; }

  .logo-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .title-block {
    flex: 1;
    min-width: 0;
    margin-left: 5px;
  }

  .title-block h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-right {
    width: 100%;
    margin-left: 5px;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .radar-toggle {
    font-size: 11px;
    padding: 5px 9px;
  }

  #last-updated { font-size: 10px; }

  #detail-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    height: 80vh;
    width: 100%;
  }
  #detail-panel.open { bottom: 0; right: 0; }

  /* Legend panel on mobile: full width, pinned to bottom */
  #map-legend-panel {
    bottom: 10px;
    min-width: 0;
    width: calc(100vw - 20px);
  }
  #time-slider-input { width: 140px; }
  .legend-hint { display: none; }
}

/* ─── Panel Tab Bar ──────────────────────────────────────────── */
#panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-bright);
  background: var(--bg-card);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.panel-tab svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.panel-tab:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.panel-tab.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
  background: rgba(94, 196, 127, 0.06);
}

.panel-tab:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: -2px;
}

/* ─── Tab Pane Visibility ────────────────────────────────────── */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ─── Station Info Pane ──────────────────────────────────────── */
#tab-info { padding: 0; }

.station-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.station-photo-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  gap: 8px;
}

.station-photo-placeholder svg {
  width: 20px;
  height: 20px;
  opacity: 0.4;
}

/* ─── Sensor Cards ───────────────────────────────────────────── */
.latest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.sensor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color 0.2s;
}

.sensor-card:hover { border-color: var(--border-bright); }

.sensor-card .sc-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.sensor-card .sc-value {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 2px;
}

.sensor-card .sc-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sensor-card .sc-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
}

.sc-moisture .sc-value { color: var(--accent-green); }
.sc-matric   .sc-value { color: var(--accent-amber); }
.sc-temp     .sc-value { color: var(--accent-blue);  }
.sc-precip   .sc-value { color: var(--accent-gold);  }
.sc-airtemp  .sc-value { color: #a0c4e8; }
.sc-humidity .sc-value { color: #7ecec4; }