/* ================================================
   dashboard.css — AirLimnos Dashboard (v3 Redesign)
   Modern glass-morphism aesthetic with ambient gradients
   ================================================ */

/* ── Custom Properties ──────────────────────────── */
:root {
  --bg-page: #edf5ef;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-glass-strong: rgba(255, 255, 255, 0.85);
  --bg-dark: #0f172a;
  --border-glass: rgba(255, 255, 255, 0.7);
  
  --clr-emerald-50: #ecfdf5;
  --clr-emerald-100: #d1fae5;
  --clr-emerald-200: #a7f3d0;
  --clr-emerald-300: #6ee7b7;
  --clr-emerald-500: #10b981;
  --clr-emerald-600: #059669;
  --clr-emerald-700: #047857;
  
  --clr-amber-50: #fffbeb;
  --clr-amber-100: #fef3c7;
  --clr-amber-200: #fde68a;
  --clr-amber-500: #f59e0b;
  --clr-amber-700: #b45309;
  --clr-amber-800: #92400e;
  --clr-amber-900: #78350f;
  
  --clr-sky-100: #e0f2fe;
  --clr-sky-200: #bae6fd;
  --clr-sky-500: #0ea5e9;
  --clr-sky-700: #0369a1;
  
  --clr-red-50: #fef2f2;
  --clr-red-100: #fee2e2;
  --clr-red-500: #ef4444;
  --clr-red-700: #b91c1c;
  
  --clr-slate-50: #f8fafc;
  --clr-slate-100: #f1f5f9;
  --clr-slate-200: #e2e8f0;
  --clr-slate-300: #cbd5e1;
  --clr-slate-400: #94a3b8;
  --clr-slate-500: #64748b;
  --clr-slate-600: #475569;
  --clr-slate-700: #334155;
  --clr-slate-800: #1e293b;
  --clr-slate-900: #0f172a;
  --clr-slate-950: #020617;
  
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-station-heading: 'Plus Jakarta Sans', var(--font-body);
  --font-station-meta: 'Plus Jakarta Sans', var(--font-body);
  /* Empty station pane — matches clean sans reference (Inter) */
  --font-station-idle: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --station-card-accent-soft: rgba(52, 131, 143, 0.12);
  --station-card-accent-faint: rgba(52, 131, 143, 0.06);
  
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-2xl: 48px;
  --r-pill: 999px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Frame panels & map — same hue as header “Air quality map & dashboard” (.topbar-heading → --clr-teal-dark) */
  --dashboard-accent-border: rgba(52, 131, 143, 0.48);

  /* Mobile map band (idle or selected — same height avoids layout jump). */
  --dashboard-split-row-height-mobile-idle: clamp(300px, 44vh, 420px);
  /* Desktop: map and station column share this fixed band (selected or idle). */
  --dashboard-split-row-height-idle: clamp(430px, 54vh, 600px);
}

/* ── Page Layout ────────────────────────────────── */
html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg-page);
  color: var(--clr-slate-950);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  line-height: 1.5;
}

/* ── Ambient Background Gradients ───────────────── */
.ambient-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: float 20s ease-in-out infinite;
}

.ambient-blob--emerald {
  width: 500px;
  height: 500px;
  background: var(--clr-emerald-200);
  left: -120px;
  top: -120px;
  animation-delay: 0s;
}

.ambient-blob--sky {
  width: 450px;
  height: 450px;
  background: var(--clr-sky-200);
  right: -80px;
  top: 150px;
  animation-delay: -7s;
}

.ambient-blob--lime {
  width: 400px;
  height: 400px;
  background: #d9f99d;
  bottom: -100px;
  left: 40%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -20px) scale(1.05); }
  50% { transform: translate(-20px, 30px) scale(0.95); }
  75% { transform: translate(20px, 20px) scale(1.02); }
}

/* ── Site header on dashboard (above ambient background) ─── */
.topbar--dashboard {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 100%;
}

/* ── Main Container ─────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Map + station details — two-column row (station left, map right) ─ */
.dashboard-map-station-split {
  display: grid;
  grid-template-columns: minmax(268px, 0.94fr) minmax(0, 1.26fr);
  gap: clamp(14px, 2.5vw, 24px);
  align-items: stretch;
  width: 100%;
}

.dashboard-map-station-split__station,
.dashboard-map-station-split__map {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/*
  Desktop: fixed equal-height band — map and station panel match; station body scrolls.
*/
@media (min-width: 993px) {
  .dashboard-map-station-split__station {
    align-self: stretch;
    min-height: var(--dashboard-split-row-height-idle);
    min-width: 0;
  }

  .dashboard-map-station-split__map {
    min-height: var(--dashboard-split-row-height-idle);
    min-width: 0;
  }

  .dashboard-map-station-split__map .map-area.map-area--unified {
    min-height: var(--dashboard-split-row-height-idle);
    height: 100%;
  }

  .dashboard-map-station-split__map .map-area.map-area--unified #map {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  .dashboard-map-station-split__station .station-info-card.station-hero-card {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }

  .dashboard-map-station-split__station .station-hero__inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .dashboard-map-station-split__station .station-hero__details {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.dashboard-map-station-split__map {
  position: relative;
  z-index: 1;
}

.dashboard-map-station-split__station .station-info-card.station-hero-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-self: stretch;
}

.dashboard-map-station-split__station .station-hero__inner {
  padding: clamp(12px, 2.3vw, 16px) clamp(13px, 2.3vw, 18px);
}

.dashboard-map-station-split__station .station-hero__name {
  font-size: clamp(1.22rem, 2.75vw, 1.58rem);
}

/*
  map.css .map-area sets min-height: 420px — include .map-area in the selector so the dashboard wins.
  Sensor dropdown is position:absolute so it does not consume flex space; #map fills the section.
*/
.dashboard-map-station-split__map .map-area.map-area--unified {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: var(--dashboard-split-row-height-idle);
  height: auto;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--dashboard-accent-border);
  box-shadow:
    var(--shadow-md),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
}

.dashboard-map-station-split__map .map-area.map-area--unified #map {
  flex: 1 1 auto;
  min-height: 160px;
  height: auto;
  width: 100%;
}

@media (max-width: 992px) {
  .dashboard-map-station-split {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .dashboard-map-station-split__station,
  .dashboard-map-station-split__map {
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .dashboard-map-station-split__station .station-info-card.station-hero-card {
    flex: 0 1 auto;
    height: auto;
    overflow: visible;
  }

  .dashboard-map-station-split__station .station-hero__inner {
    flex: 0 1 auto;
    overflow-y: visible;
  }

  .dashboard-map-station-split__map .map-area.map-area--unified {
    flex: 0 0 auto;
    height: var(--dashboard-split-row-height-mobile-idle);
    min-height: 200px;
    max-height: var(--dashboard-split-row-height-mobile-idle);
  }

  .dashboard-map-station-split__map .map-area.map-area--unified #map {
    flex: none;
    height: 100%;
    min-height: 0;
  }

  .dashboard-map-station-split__station .station-hero__name {
    font-size: clamp(1.2rem, 3.2vw, 1.68rem);
  }

  .dashboard-map-station-split--idle .dashboard-map-station-split__station .station-hero__inner {
    flex: 0 1 auto;
  }

  .dashboard-map-station-split--idle .station-hero-card--idle .station-hero__idle-wrap {
    flex: 0 1 auto;
  }
}

/* Empty state — illustration, no frame (shown only when idle) */
.station-hero__idle-art {
  display: none;
  width: 100%;
  max-width: min(228px, 76vw);
  margin: 0 auto;
  pointer-events: none;
  flex-shrink: 0;
}

.station-hero-card--idle .station-hero__idle-art {
  display: block;
  margin-bottom: clamp(22px, 4.5vw, 38px);
}

.station-hero__idle-art img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.station-hero-card--idle .station-hero__header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

.station-hero-card--idle .station-hero__thumb {
  display: none;
}

.station-hero-card--idle .station-hero__title-block {
  align-items: center;
}

.station-hero__idle-wrap {
  display: none;
}

.station-hero-card--idle .station-hero__idle-wrap {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: clamp(7px, 1.35vw, 13px);
  padding: 0;
  width: 100%;
  container-type: inline-size;
  container-name: station-idle-hint;
}

.station-hero__idle-hint {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0 clamp(8px, 3vw, 20px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  color: var(--clr-slate-500);
  /* Fallback when container query units are unavailable */
  font-size: clamp(0.58rem, 0.52rem + 0.85vw, 0.895rem);
  font-size: clamp(0.58rem, 0.52rem + 1.5cqi, 0.895rem);
  line-height: 1.55;
  font-family: var(--font-station-idle);
  font-weight: 400;
  letter-spacing: -0.02em;
  word-spacing: -0.03em;
  -webkit-font-smoothing: antialiased;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.station-hero__idle-hint-line {
  display: block;
}

.station-hero__idle-hint-line + .station-hero__idle-hint-line {
  margin-top: 0.12em;
}

.dashboard-map-station-split--idle .dashboard-map-station-split__station .station-info-card.station-hero-card {
  flex: 1 1 auto;
  min-height: 0;
}

.dashboard-map-station-split--idle .dashboard-map-station-split__station .station-hero__inner {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding-top: clamp(8px, 2vw, 20px);
  padding-bottom: clamp(8px, 2vw, 20px);
}

.dashboard-empty-hint {
  margin: 0;
  color: var(--clr-slate-500);
  font-size: 0.95rem;
  line-height: 1.45;
}

.dashboard-empty-hint--grid {
  grid-column: 1 / -1;
  padding: clamp(20px, 4vw, 28px);
  text-align: center;
  background: var(--bg-glass);
  border: 1px dashed var(--clr-slate-300);
  border-radius: var(--r-md);
}

/* ── Latest readings + history: stacked; compact = side‑by‑side on wide screens ── */
.dashboard-readings-history {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  overflow: visible;
}

.dashboard-readings-history[hidden] {
  display: none !important;
}

@media (min-width: 993px) {
  .dashboard-readings-history--compact {
    display: grid;
    /* Readings column only as wide as metric strips; chart takes the rest */
    grid-template-columns: max-content minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "readings history"
      "export export";
    gap: clamp(14px, 2.5vw, 24px);
    align-items: stretch;
  }

  /* Flatten so history + export participate in the parent grid (export on its own row). */
  .dashboard-readings-history--compact .content-grid {
    display: contents;
  }

  .dashboard-readings-history--compact .dashboard-panels {
    grid-area: readings;
    width: max-content;
    max-width: 100%;
    height: 100%;
    justify-self: start;
    align-self: stretch;
    display: grid;
    grid-template-rows: 1fr;
    min-height: 0;
    /* Stack above the history card so metric hint popups can extend over Daily Summary */
    position: relative;
    z-index: 2;
  }

  .dashboard-readings-history--compact .dashboard-panels .station-readings-card {
    width: fit-content;
    max-width: 100%;
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .dashboard-readings-history--compact .readings-card__sections {
    flex: 1;
    min-height: 0;
  }

  .dashboard-readings-history--compact .history-card {
    grid-area: history;
    min-width: 0;
    height: 100%;
    align-self: stretch;
    position: relative;
    z-index: 1;
  }

  .dashboard-readings-history--compact .export-card {
    grid-area: export;
    width: 100%;
    justify-self: stretch;
    margin-top: 0;
  }

  /*
    Card is width: fit-content (title row is often wider than a short metric strip).
    Force the flex row to span the full card so justify-content can center the tiles.
  */
  .dashboard-readings-history--compact .metrics-grid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: center;
    justify-content: safe center;
  }
}

/* ── Dashboard panels (combined station readings — full width) ── */
.dashboard-panels {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  overflow: visible;
}

.dashboard-panels .station-readings-card {
  width: 100%;
  max-width: 100%;
}

/* ── Station hero card — refined glass + typographic hierarchy ── */
.station-info-card.station-hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-2xl);
  border: 1px solid rgba(52, 131, 143, 0.38);
  padding: 0;
  isolation: isolate;
  animation: fadeSlideUp 0.5s ease-out both;
  background:
    linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.97) 0%,
      rgba(248, 250, 252, 0.88) 42%,
      rgba(236, 253, 245, 0.52) 100%
    ),
    var(--bg-glass);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
  box-shadow:
    0 10px 40px rgba(52, 131, 143, 0.07),
    0 2px 8px rgba(15, 23, 42, 0.04),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;
}

.station-info-card.station-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse 110% 70% at 100% -30%,
    rgba(52, 131, 143, 0.11),
    transparent 52%
  );
  opacity: 0.95;
}

.station-info-card.station-hero-card .station-hero__thumb {
  flex-shrink: 0;
  width: clamp(62px, 10.5vw, 88px);
  height: clamp(62px, 10.5vw, 88px);
  border-radius: 50%;
  border: 1px solid #b9d5eb;
  box-shadow: none;
  overflow: hidden;
  background-color: #fff;
  background-image: url("../assets/dashboard/station_icon.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: none;
}

.station-hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  flex: 0 1 auto;
  padding: clamp(14px, 2.7vw, 19px) clamp(16px, 2.8vw, 24px);
}

.station-hero__header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(12px, 2.4vw, 18px);
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

.station-hero__title-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
}

.station-hero__details {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: clamp(10px, 1.8vw, 14px) 0 0;
  padding: 0;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  box-shadow: none;
}

.station-hero__details-grid {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
}

.station-hero__grid-row {
  display: grid;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.station-hero__grid-row:last-of-type {
  border-bottom: none;
}

.station-hero__grid-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.station-hero__grid-row--2 {
  grid-template-columns: 1.45fr 1fr;
}

.station-hero__grid-row--full {
  grid-template-columns: 1fr;
}

.station-hero__upstream-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
}

.station-hero__upstream-inline > .station-hero__detail {
  flex: 1 1 40%;
  min-width: 0;
}

.station-hero__grid-row .station-hero__detail {
  margin: 0;
  padding: 13px 14px;
  border-radius: 0;
  border-right: 1px solid rgba(15, 23, 42, 0.07);
}

.station-hero__grid-row .station-hero__detail:last-child {
  border-right: none;
}

.station-hero__metrics-block {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.78), rgba(255, 255, 255, 0.52));
}

.station-hero__metrics-title {
  display: block;
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}

.station-hero__metrics-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.station-hero__metric-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(52, 131, 143, 0.12);
  color: var(--clr-teal-darkest, #2a6470);
  border: 1px solid rgba(52, 131, 143, 0.22);
}

@media (max-width: 640px) {
  .station-hero__grid-row--3 {
    grid-template-columns: 1fr;
  }

  .station-hero__grid-row--3 .station-hero__detail {
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  }

  .station-hero__grid-row--3 .station-hero__detail:last-child {
    border-bottom: none;
  }

  .station-hero__grid-row--2 {
    grid-template-columns: 1fr;
  }

  .station-hero__grid-row--2 .station-hero__detail {
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  }

  .station-hero__grid-row--2 .station-hero__detail:last-child {
    border-bottom: none;
  }
}

.station-hero__detail {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 0;
  padding: 5px 6px;
  margin: 0 -5px;
  border-radius: var(--r-md);
  transition: background-color var(--transition-fast);
}

.station-hero__grid-row .station-hero__detail:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

.station-hero__detail:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.station-hero__detail-icon-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  margin-top: 2px;
  border-radius: var(--r-sm, 8px);
  background: rgba(52, 131, 143, 0.1);
  border: none;
  box-shadow: none;
  color: var(--clr-teal-dark, #34838f);
}

.station-hero__detail-icon {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  stroke-width: 2;
  opacity: 1;
}

.station-hero__detail-stack {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.station-hero__detail-kicker {
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.35;
}

.station-hero__detail-primary {
  font-family: var(--font-station-meta);
  font-size: clamp(0.8825rem, 1.92vw, 0.9425rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  word-spacing: 0.04em;
  line-height: 1.48;
  color: var(--clr-slate-900);
  word-break: break-word;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

/* Station IDs are single tokens — never break across lines; scroll horizontally if the column is narrow. */
#stationIdText.station-hero__detail-primary {
  display: block;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  word-break: normal;
  scrollbar-width: thin;
}

/* Location row: pin + two labeled columns (place | coordinates), screenshot layout */
.station-hero__detail--location {
  align-items: center;
}

.station-hero__detail--location .station-hero__detail-icon-wrap {
  margin-top: 0;
  align-self: center;
}

.station-hero__location-columns {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(18px, 5vw, 36px);
}

.station-hero__location-col {
  flex: 1 1 140px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.station-hero__location-col .station-hero__detail-primary {
  max-width: 100%;
}

.station-hero__location-col--coords .station-hero__detail-primary {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}

.station-hero__detail-placeholder {
  font-family: var(--font-body);
  font-size: clamp(0.8125rem, 1.85vw, 0.875rem);
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1.42;
  color: var(--clr-slate-500);
}

.station-hero__name {
  margin: 0;
  font-family: var(--font-station-heading);
  font-size: clamp(1.28rem, 3vw, 1.68rem);
  font-weight: 700;
  letter-spacing: -0.036em;
  line-height: 1.14;
  color: var(--clr-slate-900);
}

.station-hero__name.skeleton {
  border-radius: var(--r-md);
}

.station-hero__name.skeleton.skeleton-text--lg {
  height: 34px;
  min-height: 34px;
}

.station-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: clamp(0.72rem, 1.65vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.station-status-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.station-status-badge--online {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98), rgba(209, 250, 229, 0.85));
  color: var(--clr-emerald-700);
  border: 1px solid rgba(52, 211, 153, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 2px 8px rgba(16, 185, 129, 0.12);
}

.station-status-badge--online .station-status-badge__dot {
  background: var(--clr-emerald-500);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.station-status-badge--offline {
  background: linear-gradient(180deg, rgba(254, 242, 242, 0.98), rgba(254, 226, 226, 0.82));
  color: var(--clr-red-700);
  border: 1px solid rgba(248, 113, 113, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 2px 8px rgba(239, 68, 68, 0.1);
}

.station-status-badge--offline .station-status-badge__dot {
  background: var(--clr-red-500);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.22);
}

.station-readings-card {
  background: var(--bg-glass);
  border: 1px solid var(--dashboard-accent-border);
  border-radius: var(--r-2xl);
  padding: 28px 32px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  animation: fadeSlideUp 0.5s ease-out 0.06s both;
  overflow: visible;
}

.readings-card__header {
  margin-bottom: 8px;
  overflow: visible;
}

.readings-card__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  overflow: visible;
}

.readings-card__title {
  margin: 0;
}

.readings-card__refresh {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--clr-slate-500);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
  box-shadow: none;
}

.readings-card__refresh:hover:not(:disabled) {
  background: var(--clr-slate-100);
  border-color: var(--clr-slate-200);
  color: var(--clr-slate-800);
}

.readings-card__refresh:focus-visible {
  outline: 2px solid var(--clr-sky-500);
  outline-offset: 2px;
}

.readings-card__refresh:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.readings-card__refresh:not(:disabled):hover,
.readings-card__refresh:not(:disabled):focus-visible {
  z-index: 20;
}

.readings-card__refresh[data-tip]:not(:disabled)::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  box-sizing: border-box;
  /* Avoid shrink-to-fit inside the narrow button box (~38px), which forces many tiny wraps */
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  color: var(--clr-slate-800);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--clr-slate-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-fast),
    visibility var(--transition-fast);
}

@media (hover: hover) {
  .readings-card__refresh[data-tip]:not(:disabled):hover::after {
    opacity: 1;
    visibility: visible;
  }
}

.readings-card__refresh[data-tip]:not(:disabled):focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.readings-card__refresh-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

.readings-card__refresh-icon svg {
  width: 100%;
  height: 100%;
}

.readings-card__refresh--busy .readings-card__refresh-icon {
  animation: readingsRefreshSpin 0.65s linear infinite;
}

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

.readings-card__timestamp {
  margin: 4px 0 0;
}

.readings-card__sections {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3vw, 26px);
}

.metrics-subsection {
  min-width: 0;
}

.metrics-subsection__title {
  margin: 0 0 12px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--clr-slate-500);
}

.metrics-grid.metrics-grid--subsection {
  margin-top: 0;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Pills ──────────────────────────────────────── */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  ring: 1px;
}

.pill--green {
  background: var(--clr-emerald-100);
  color: var(--clr-emerald-700);
  box-shadow: inset 0 0 0 1px var(--clr-emerald-200);
}

.pill--blue {
  background: var(--clr-sky-100);
  color: var(--clr-sky-700);
  box-shadow: inset 0 0 0 1px var(--clr-sky-200);
}

.pill--slate {
  background: var(--clr-slate-100);
  color: var(--clr-slate-700);
  box-shadow: inset 0 0 0 1px var(--clr-slate-200);
}

.pill--amber {
  background: var(--clr-amber-100);
  color: var(--clr-amber-800);
  box-shadow: inset 0 0 0 1px var(--clr-amber-200);
}

.pill--red {
  background: var(--clr-red-100);
  color: var(--clr-red-700);
  box-shadow: inset 0 0 0 1px var(--clr-red-100);
}

.pill svg {
  width: 13px;
  height: 13px;
}

/* ── Metric cards — single horizontal row, scroll if needed ── */
.metrics-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 14px;
  margin-top: 28px;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.metrics-grid::-webkit-scrollbar {
  height: 8px;
}

.metrics-grid::-webkit-scrollbar-track {
  background: var(--clr-slate-100);
  border-radius: var(--r-pill);
}

.metrics-grid::-webkit-scrollbar-thumb {
  background: var(--clr-slate-300);
  border-radius: var(--r-pill);
}

.metrics-grid:focus-visible {
  outline: 2px solid var(--clr-emerald-500);
  outline-offset: 2px;
}

.metric-card {
  position: relative;
  overflow: visible;
  background: #ffffff;
  border: 1px solid rgba(52, 131, 143, 0.26);
  border-radius: 16px;
  padding: 20px 16px 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  flex: 0 0 auto;
  width: 168px;
  min-width: 148px;
  max-width: min(168px, 78vw);
}

.metrics-grid > .skeleton-card,
.metrics-grid > .skeleton {
  flex: 0 0 auto;
  min-width: 148px;
  width: 168px;
  height: 220px;
}

.metric-card__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100%;
  gap: 0;
}

.metric-card__icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-bottom: 10px;
  background: var(--clr-slate-100);
}

@supports (background: color-mix(in srgb, red, white)) {
  .metric-card__icon-ring {
    background: color-mix(in srgb, var(--metric-accent) 16%, white);
  }
}

.metric-card__icon {
  display: grid;
  place-items: center;
  line-height: 0;
  color: var(--metric-accent, var(--clr-slate-600));
}

.metric-card__icon svg {
  width: 26px;
  height: 26px;
}

.metric-card__label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--clr-slate-900);
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

/* Label + info: shrink-wrap anchor and center on cross-axis (stretch was full-width and looked skewed vs plain labels). */
.metric-card__hint-anchor {
  position: relative;
  display: block;
  align-self: center;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  z-index: 1;
}

.metric-card__hint-anchor:hover,
.metric-card__hint-anchor:focus-within {
  z-index: 40;
}

.metric-card__label-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 5px;
  max-width: 100%;
  margin: 0;
  line-height: 1.2;
  cursor: help;
}

.metric-card__label-row .metric-card__label {
  display: block;
  margin: 0;
  padding: 0;
  line-height: inherit;
}

.metric-card__label-row.metric-card__label-row--with-hint {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  min-height: 18px;
  margin: 0;
  padding: 0;
  cursor: help;
  /* Shift right by half (gap + icon): centers glyph column with sibling cards that have no trailing info control. */
  transform: translateX(calc((4px + 18px) / 2));
}

.metric-card__label-row--with-hint .metric-card__label {
  text-align: center;
  min-width: 0;
}

.metric-card__label-row--with-hint .metric-card__info {
  flex-shrink: 0;
}

.metric-card__tooltip {
  /* Fixed + JS placement: avoids widening `.metrics-grid` scroll width (wide box was forcing a scrollbar). */
  position: fixed;
  z-index: 4000;
  margin: 0;
  right: auto;
  width: min(320px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 8px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.38;
  letter-spacing: 0.01em;
  color: var(--clr-slate-800);
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  box-shadow:
    0 4px 6px -1px rgba(15, 23, 42, 0.06),
    0 10px 24px rgba(15, 23, 42, 0.1);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.04s ease-out, visibility 0.04s ease-out;
  overflow-x: hidden;
  overflow-y: auto;
}

.metric-card__hint-anchor:hover .metric-card__tooltip,
.metric-card__hint-anchor:focus-within .metric-card__tooltip {
  opacity: 1;
  visibility: visible;
}

.metric-card__tooltip-text {
  margin: 0;
  font-weight: 500;
  color: var(--clr-slate-800);
  overflow-wrap: break-word;
  line-height: 1.45;
}

.metric-card__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: none;
  background: transparent;
  color: var(--clr-slate-400);
  border-radius: 6px;
  cursor: help;
  line-height: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.metric-card__info:hover,
.metric-card__info:focus-visible {
  color: var(--metric-accent, var(--clr-slate-600));
  background: color-mix(in srgb, var(--metric-accent) 10%, transparent);
}

.metric-card__info:focus-visible {
  outline: 2px solid var(--metric-accent, var(--clr-emerald-500));
  outline-offset: 2px;
}

.metric-card__info svg {
  width: 14px;
  height: 14px;
}

.metric-card__value-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  flex: 1;
  justify-content: center;
  min-width: 0;
  width: 100%;
}

.metric-card__value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--metric-accent, var(--clr-slate-950));
  min-width: 0;
  word-break: break-word;
}

.metric-card__unit {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--clr-slate-500);
  line-height: 1.2;
}

.metric-card__signal-bubble {
  display: inline-block;
  margin-top: 2px;
  padding: 0.2rem 0.5rem;
  max-width: 100%;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  text-align: center;
  color: var(--clr-slate-600);
  background: var(--clr-slate-100);
  border-radius: 999px;
  border: 1px solid var(--clr-slate-200);
  word-break: break-word;
}

.metric-card__footer {
  width: 100%;
  margin-top: 14px;
  padding-top: 2px;
}

.metric-card__footer--empty {
  min-height: 36px;
}

/* ── Per-metric "Measured …" freshness line ─────── */
/* Sits at the bottom of every metric card, separated from the rest of the
   card by a hairline divider. Muted by default so a fresh reading never
   reads as an error; the colour shifts to amber/red only when the sample
   is genuinely old (see measuredState() in dashboard.js). */
.metric-card__measured {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  align-self: stretch;
  width: 100%;
  box-sizing: border-box;
  margin: 12px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--clr-slate-200);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--clr-slate-500);
  transition: color 200ms ease, border-color 200ms ease;
  cursor: default;
}

.metric-card__measured-icon {
  display: inline-flex;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.85;
}

.metric-card__measured-icon svg {
  width: 100%;
  height: 100%;
}

.metric-card__measured-text {
  white-space: nowrap;
}

.metric-card__measured--fresh {
  color: var(--clr-slate-500);
}

.metric-card__measured--stale {
  color: var(--clr-amber-700);
}

.metric-card__measured--very-stale {
  color: var(--clr-red-700);
}

.metric-card__measured--nodata {
  color: var(--clr-slate-400);
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.quality-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

.quality-pill--good {
  background: #ecfdf5;
  color: #059669;
}

.quality-pill--ok {
  background: #ecfdf5;
  color: #059669;
}

.quality-pill--moderate {
  background: #fffbeb;
  color: #d97706;
}

.quality-pill--poor {
  background: #fef2f2;
  color: #dc2626;
}

.quality-pill--neutral {
  background: var(--clr-slate-100);
  color: var(--clr-slate-600);
}

.quality-pill--nodata {
  background: var(--clr-slate-100);
  color: var(--clr-slate-500);
}

/* ── Content Grid (history full width) ──────────── */
.content-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.section-header__left {
  flex: 1;
}

.section-header__label {
  font-size: 0.85rem;
  color: var(--clr-slate-500);
}

.section-header__title {
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--clr-slate-950);
}

.section-header__left > .section-header__title {
  margin-bottom: 4px;
}

.readings-card__title-row .section-header__title {
  margin: 0;
}

.section-header--tight {
  margin-bottom: 0;
}

.section-header--chart {
  align-items: flex-end;
  justify-content: space-between;
}

.section-header--chart .section-header__left {
  flex: 0 1 auto;
  min-width: 140px;
}

.section-header--chart .tab-switcher-scroll {
  flex: 0 1 auto;
  margin-left: auto;
  min-width: 0;
  max-width: min(100%, 72vw);
}

.history-card .section-header--chart {
  margin-bottom: 12px;
}

/* ── Export Data card ─────────────────────────── */

.export-card {
  background: var(--bg-glass);
  border: 1px solid var(--dashboard-accent-border);
  border-radius: var(--r-2xl);
  padding: 24px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  animation: fadeSlideUp 0.5s ease-out 0.2s both;
}

.export-card__header {
  margin-bottom: 16px;
}

.export-card__header .section-header__title {
  margin-bottom: 4px;
}

.export-card__header .section-header__label {
  margin: 0;
}

.export-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.export-field {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.export-field__legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--clr-slate-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding: 0;
}

/* Preset chips & segmented control share a base */
.export-presets,
.export-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.export-preset,
.export-segmented__opt {
  appearance: none;
  border: 1px solid var(--clr-slate-200);
  background: white;
  color: var(--clr-slate-700);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.export-preset:hover,
.export-segmented__opt:hover {
  background: var(--clr-slate-100);
  border-color: var(--clr-slate-300);
  color: var(--clr-slate-950);
}

.export-preset:focus-visible,
.export-segmented__opt:focus-visible {
  outline: 2px solid var(--clr-sky-500);
  outline-offset: 2px;
}

.export-preset.is-active,
.export-segmented__opt.is-active {
  background: var(--clr-slate-900);
  border-color: var(--clr-slate-900);
  color: white;
}

.export-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.export-date {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--clr-slate-600);
}

.export-date input[type="date"] {
  border: 1px solid var(--clr-slate-200);
  background: white;
  border-radius: var(--r-md);
  padding: 6px 10px;
  font-size: 0.88rem;
  color: var(--clr-slate-900);
  min-width: 150px;
}

.export-date input[type="date"]:focus-visible {
  outline: 2px solid var(--clr-sky-500);
  outline-offset: 1px;
}

.export-error {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--clr-red-700);
}

.export-metrics-toolbar {
  display: flex;
  gap: 14px;
  margin-bottom: 8px;
}

.export-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--clr-sky-700);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.export-link-btn:hover {
  text-decoration: underline;
}

.export-link-btn:focus-visible {
  outline: 2px solid var(--clr-sky-500);
  outline-offset: 2px;
  border-radius: 2px;
}

.export-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 14px;
  border: 1px solid var(--clr-slate-200);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--clr-slate-50);
  max-height: 260px;
  overflow-y: auto;
}

.export-metrics__group {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--clr-slate-500);
  margin-top: 6px;
}

.export-metrics__group:first-child {
  margin-top: 0;
}

.export-metrics__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--clr-slate-800);
  cursor: pointer;
}

.export-metrics__item input[type="checkbox"] {
  accent-color: var(--clr-slate-900);
}

.export-metrics__empty {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.85rem;
  color: var(--clr-slate-500);
  font-style: italic;
}

.export-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--clr-slate-200);
  padding-top: 16px;
}

.export-summary {
  margin: 0;
  font-size: 0.85rem;
  color: var(--clr-slate-600);
}

.export-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--clr-slate-900);
  background: var(--clr-slate-900);
  color: white;
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.export-submit:hover:not(:disabled) {
  background: var(--clr-slate-950);
  box-shadow: var(--shadow-md);
}

.export-submit:focus-visible {
  outline: 2px solid var(--clr-sky-500);
  outline-offset: 2px;
}

.export-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.tab-switcher-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  flex: 1;
  min-width: 120px;
  padding-bottom: 6px;
}

.tab-switcher-scroll::-webkit-scrollbar {
  height: 6px;
}

.tab-switcher-scroll::-webkit-scrollbar-thumb {
  background: var(--clr-slate-300);
  border-radius: var(--r-pill);
}

.tab-switcher-scroll .tab-switcher {
  display: flex;
  flex-wrap: nowrap;
  width: max-content;
}

.chart-panel-state {
  text-align: center;
  color: var(--clr-slate-500);
  font-size: 0.9rem;
  margin: 0 0 8px;
  padding: 8px 12px;
}

.chart-panel-state[hidden] {
  display: none !important;
}

/* ── History Card ───────────────────────────────── */
.history-card {
  background: var(--bg-glass);
  border: 1px solid var(--dashboard-accent-border);
  border-radius: var(--r-2xl);
  padding: 24px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    var(--shadow-sm),
    0 0 0 1px rgba(255, 255, 255, 0.55) inset;
  animation: fadeSlideUp 0.5s ease-out 0.15s both;
}

/* ── Tab Switcher ───────────────────────────────── */
.tab-switcher {
  display: flex;
  background: var(--clr-slate-100);
  border-radius: var(--r-pill);
  padding: 4px;
}

.tab-switcher__btn {
  padding: 8px 16px;
  border: none;
  background: none;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-slate-500);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-switcher__btn--active {
  background: white;
  color: var(--clr-slate-950);
  box-shadow: var(--shadow-sm);
}

.tab-switcher__btn:not(.tab-switcher__btn--active):hover {
  color: var(--clr-slate-700);
}

/* ── Bar Chart ──────────────────────────────────── */
.bar-chart {
  height: 268px;
  margin-top: 12px;
}

.bar-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

.daily-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--clr-slate-500);
}

.daily-chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.daily-chart-legend__swatch {
  display: inline-block;
  flex-shrink: 0;
}

.daily-chart-legend__swatch--low {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2px rgba(14, 165, 233, 0.35);
}

.daily-chart-legend__swatch--high {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9333ea, #7c3aed);
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2px rgba(147, 51, 234, 0.35);
}

.daily-chart-legend__swatch--avg {
  width: 9px;
  height: 9px;
  background: #d97706;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2px rgba(217, 119, 6, 0.4);
}

@media (max-width: 480px) {
  .bar-chart {
    height: auto;
    min-height: 254px;
  }
}

/* ── Loading States ─────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--clr-slate-100) 25%,
    var(--clr-slate-50) 50%,
    var(--clr-slate-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 120px;
  border-radius: var(--r-xl);
}

.skeleton-text {
  height: 20px;
  width: 60%;
}

.skeleton-text--lg {
  height: 48px;
  width: 80%;
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  main {
    padding: 12px 14px 40px;
    gap: 16px;
  }

  .station-readings-card,
  .history-card,
  .export-card {
    padding: 20px;
    border-radius: var(--r-xl);
  }

  .station-info-card.station-hero-card {
    border-radius: var(--r-xl);
  }

  .station-hero__inner {
    padding: 17px 16px;
  }

  .station-hero__name {
    font-size: 1.32rem;
  }
  
  .metric-card {
    padding: 14px 16px;
    width: 168px;
    min-width: 132px;
  }
  
  .metric-card__value {
    font-size: 1.8rem;
  }
  
  .tab-switcher {
    width: 100%;
    justify-content: space-around;
  }
}

@media (max-width: 520px) {
  .station-hero__inner {
    padding-right: 14px;
    padding-bottom: 14px;
  }
}

@media (max-width: 480px) {
  .pills {
    gap: 6px;
  }
  
  .pill {
    padding: 4px 10px;
    font-size: 0.68rem;
  }
  
  .ambient-blob {
    display: none;
  }
}

/* ── State Text ─────────────────────────────────── */
.state-text {
  padding: 32px 20px;
  text-align: center;
  color: var(--clr-slate-500);
  font-size: 0.9rem;
}

/* ── Site footer — ECS gradient band + ECS / EU marks ─ */
.site-footer {
  position: relative;
  z-index: 2;
  isolation: isolate;
  width: 100%;
  flex-shrink: 0;
  margin-top: auto;
  box-sizing: border-box;
  --site-footer-grad: linear-gradient(
    145deg,
    var(--clr-teal-dark) 0%,
    var(--clr-teal-mid) 48%,
    var(--clr-teal-light) 100%
  );

  background: var(--site-footer-grad);
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.site-footer__inner {
  box-sizing: border-box;
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px clamp(18px, 3vw, 26px);
}

.site-footer__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
}

.site-footer__ecs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: transparent;
  text-decoration: none;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: none;
}

.site-footer__ecs-badge:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: none;
  box-shadow: none;
}

.site-footer__ecs-badge:focus-visible {
  outline: 2px solid var(--clr-white);
  outline-offset: 3px;
}

.site-footer__ecs-badge:active {
  background: rgba(255, 255, 255, 0.12);
}

.site-footer__ecs-badge img {
  display: block;
  height: clamp(26px, 3.8vw, 32px);
  width: auto;
  max-width: min(118px, 26vw);
  object-fit: contain;
}

.site-footer__line-wrap {
  justify-self: stretch;
  min-width: 0;
  max-width: 100%;
  display: flex;
  justify-content: safe center;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.site-footer__line-wrap::-webkit-scrollbar {
  height: 5px;
}

.site-footer__line-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: var(--r-pill);
}

.site-footer__line {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: clamp(0.785rem, 1.06vw, 0.8625rem);
  line-height: 1.5;
  font-weight: 500;
  font-family: var(--font-body);
  color: rgba(255, 255, 255, 0.92);
}

.site-footer__line a {
  color: var(--clr-white);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 2px;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.site-footer__line a:hover {
  color: var(--clr-white);
  opacity: 0.88;
  text-decoration: underline;
}

.site-footer__line a:focus-visible {
  outline: 2px solid var(--clr-white);
  outline-offset: 3px;
  border-radius: 2px;
}

.site-footer__sep {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
}

.site-footer__eu-shell {
  justify-self: end;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.site-footer__eu-mark {
  display: block;
  height: clamp(32px, 4.6vw, 42px);
  width: auto;
  max-width: min(208px, 38vw);
  object-fit: contain;
}

@media (max-width: 760px) {
  .site-footer__inner {
    padding: 16px clamp(14px, 4vw, 20px);
  }

  .site-footer__row {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }

  .site-footer__line-wrap {
    order: -1;
    width: 100%;
    justify-content: safe center;
  }

  .site-footer__eu-shell {
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .site-footer__inner {
    padding: 14px 14px;
  }

  .site-footer__line {
    font-size: 0.8rem;
  }

  .site-footer__row {
    gap: 14px;
  }

  .site-footer__ecs-badge img {
    max-width: min(104px, 44vw);
  }

  .site-footer__eu-mark {
    height: clamp(30px, 12vw, 38px);
  }
}

/* ── Hidden Utility ─────────────────────────────── */
[hidden] {
  display: none !important;
}
