/* ==========================================================================
   Pow Forecast - Modern UI
   ========================================================================== */

/* --- Design Tokens (Blue Square - Default Light) --- */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #f0f4f8;
  --bg-subtle: #e2e8f0;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --muted: #64748b;
  --card: #ffffff;
  --card-elevated: #ffffff;
  --line: #e2e8f0;
  --line-hover: #cbd5e1;
  --warn: #d97706;
  --ok: #059669;
  --accent: #3b82f6;
  --accent-soft: #dbeafe;
  --accent-hover: #2563eb;
  --panel-grad-top: #f0f4f8;
  --control-bg: #ffffff;
  --button-bg: #ffffff;
  --button-hover-bg: #f8fafc;
  --elev-pill-bg: #f1f5f9;
  --elev-pill-border: #cbd5e1;
  --elev-active-bg: #3b82f6;
  --elev-active-border: #2563eb;
  --elev-active-ink: #ffffff;
  --nav-active-bg: #eff6ff;
  --nav-active-border: #3b82f6;
  --nav-ink: #475569;
  --nav-active-ink: #1d4ed8;
  --overlay-bg: #ffffff;
  --overlay-shadow: rgba(15, 23, 42, 0.08);
  --chip-bg: #eff6ff;
  --chip-ink: #1e40af;
  --table-line: #f1f5f9;
  --table-stripe: #f8fafc;
  --card-soft-bg: #f8fafc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --snow-none: #64748b;
  --snow-low: #059669;
  --snow-mid: #2563eb;
  --snow-high: #c026d3;
  --snow-extreme: #dc2626;
  --snow-epic: #e2b603;
  --transition-fast: 120ms ease;
  --transition-base: 180ms ease;
  --transition-smooth: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Green Circle (Dark) --- */
body.theme-green-circle {
  --bg: #0c1410;
  --bg-subtle: #162019;
  --ink: #e2f0ea;
  --ink-secondary: #a3c4b6;
  --muted: #7da396;
  --card: #14201b;
  --card-elevated: #1a2b24;
  --line: #2a3f36;
  --line-hover: #3a5548;
  --warn: #fbbf24;
  --ok: #34d399;
  --accent: #34d399;
  --accent-soft: #14362a;
  --accent-hover: #6ee7b7;
  --panel-grad-top: #0f1a14;
  --control-bg: #162019;
  --button-bg: #1a2b24;
  --button-hover-bg: #223930;
  --elev-pill-bg: #1a2b24;
  --elev-pill-border: #3a5548;
  --elev-active-bg: #059669;
  --elev-active-border: #34d399;
  --elev-active-ink: #ffffff;
  --nav-active-bg: #14362a;
  --nav-active-border: #34d399;
  --nav-ink: #7da396;
  --nav-active-ink: #34d399;
  --overlay-bg: #14201b;
  --overlay-shadow: rgba(0, 0, 0, 0.4);
  --chip-bg: #14362a;
  --chip-ink: #6ee7b7;
  --table-line: #223930;
  --table-stripe: #182620;
  --card-soft-bg: #182620;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
  --snow-none: #94a3b8;
  --snow-low: #34d399;
  --snow-mid: #60a5fa;
  --snow-high: #e879f9;
  --snow-extreme: #f87171;
  --snow-epic: #e2b603;
}

/* --- Blue Square (Light - matches :root, explicit for toggle) --- */
body.theme-blue-square {
  --bg: #f0f4f8;
  --bg-subtle: #e2e8f0;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --muted: #64748b;
  --card: #ffffff;
  --card-elevated: #ffffff;
  --line: #e2e8f0;
  --line-hover: #cbd5e1;
  --warn: #d97706;
  --ok: #059669;
  --accent: #3b82f6;
  --accent-soft: #dbeafe;
  --accent-hover: #2563eb;
  --panel-grad-top: #f0f4f8;
  --control-bg: #ffffff;
  --button-bg: #ffffff;
  --button-hover-bg: #f8fafc;
  --elev-pill-bg: #f1f5f9;
  --elev-pill-border: #cbd5e1;
  --elev-active-bg: #3b82f6;
  --elev-active-border: #2563eb;
  --elev-active-ink: #ffffff;
  --nav-active-bg: #eff6ff;
  --nav-active-border: #3b82f6;
  --nav-ink: #475569;
  --nav-active-ink: #1d4ed8;
  --overlay-bg: #ffffff;
  --overlay-shadow: rgba(15, 23, 42, 0.08);
  --chip-bg: #eff6ff;
  --chip-ink: #1e40af;
  --table-line: #f1f5f9;
  --table-stripe: #f8fafc;
  --card-soft-bg: #f8fafc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
  --snow-none: #64748b;
  --snow-low: #059669;
  --snow-mid: #2563eb;
  --snow-high: #c026d3;
  --snow-extreme: #dc2626;
  --snow-epic: #e2b603;
}

/* --- Black Diamond (Dark charcoal) --- */
body.theme-black-diamond {
  --bg: #0a0e14;
  --bg-subtle: #141b24;
  --ink: #e8edf2;
  --ink-secondary: #94a3b8;
  --muted: #7a8da0;
  --card: #111820;
  --card-elevated: #1a2332;
  --line: #1e2d3d;
  --line-hover: #2d4050;
  --warn: #fbbf24;
  --ok: #34d399;
  --accent: #60a5fa;
  --accent-soft: #172554;
  --accent-hover: #93c5fd;
  --panel-grad-top: #0d1218;
  --control-bg: #141b24;
  --button-bg: #1a2332;
  --button-hover-bg: #223344;
  --elev-pill-bg: #1a2332;
  --elev-pill-border: #2d4050;
  --elev-active-bg: #2563eb;
  --elev-active-border: #60a5fa;
  --elev-active-ink: #ffffff;
  --nav-active-bg: #172554;
  --nav-active-border: #60a5fa;
  --nav-ink: #7a8da0;
  --nav-active-ink: #60a5fa;
  --overlay-bg: #111820;
  --overlay-shadow: rgba(0, 0, 0, 0.5);
  --chip-bg: #172554;
  --chip-ink: #93c5fd;
  --table-line: #1e2d3d;
  --table-stripe: #141d28;
  --card-soft-bg: #141d28;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.45);
  --snow-none: #94a3b8;
  --snow-low: #34d399;
  --snow-mid: #60a5fa;
  --snow-high: #e879f9;
  --snow-extreme: #f87171;
  --snow-epic: #e2b603;
}

/* --- Double Black (Pitch dark AMOLED) --- */
body.theme-double-black {
  --bg: #000000;
  --bg-subtle: #0a0a0a;
  --ink: #f1f5f9;
  --ink-secondary: #94a3b8;
  --muted: #64748b;
  --card: #0a0a0a;
  --card-elevated: #111111;
  --line: #1a1a1a;
  --line-hover: #2a2a2a;
  --warn: #fbbf24;
  --ok: #34d399;
  --accent: #22c55e;
  --accent-soft: #052e16;
  --accent-hover: #4ade80;
  --panel-grad-top: #050505;
  --control-bg: #0a0a0a;
  --button-bg: #111111;
  --button-hover-bg: #1a1a1a;
  --elev-pill-bg: #111111;
  --elev-pill-border: #2a2a2a;
  --elev-active-bg: #16a34a;
  --elev-active-border: #22c55e;
  --elev-active-ink: #ffffff;
  --nav-active-bg: #052e16;
  --nav-active-border: #22c55e;
  --nav-ink: #64748b;
  --nav-active-ink: #22c55e;
  --overlay-bg: #0a0a0a;
  --overlay-shadow: rgba(0, 0, 0, 0.7);
  --chip-bg: #052e16;
  --chip-ink: #4ade80;
  --table-line: #1a1a1a;
  --table-stripe: #0f0f0f;
  --card-soft-bg: #0f0f0f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.7);
  --snow-none: #94a3b8;
  --snow-low: #4ade80;
  --snow-mid: #60a5fa;
  --snow-high: #e879f9;
  --snow-extreme: #f87171;
  --snow-epic: #e2b603;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--accent);
}

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

code {
  font-size: 0.85em;
  background: var(--bg-subtle);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ==========================================================================
   App Shell & Layout
   ========================================================================== */
.app-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ==========================================================================
   Hero / Header
   ========================================================================== */
.hero {
  margin-bottom: 0.5rem;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.hero-brand:hover,
.hero-brand:focus-visible {
  color: inherit;
  text-decoration: none;
}

.hero-logo {
  width: 60px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.hero h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--ink) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.main-nav {
  margin-top: 1rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.3rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--nav-ink);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-btn:hover {
  background: var(--bg-subtle);
  color: var(--ink);
}

.nav-btn.active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-border);
  color: var(--nav-active-ink);
  box-shadow: var(--shadow-sm);
}

.nav-btn.active svg {
  opacity: 1;
}

/* ==========================================================================
   Pages
   ========================================================================== */
.page-section.hidden {
  display: none;
}

/* ==========================================================================
   Panels / Cards
   ========================================================================== */
.panel {
  margin-top: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.panel:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Search
   ========================================================================== */
.search-panel label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search-input-wrap {
  position: relative;
  margin-top: 0.5rem;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

input[type="text"]#search {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem 0.75rem 2.6rem;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--control-bg);
  color: var(--ink);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

input[type="text"]#search::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

input[type="text"]#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
}

/* ==========================================================================
   Generic Form Elements
   ========================================================================== */
label {
  font-weight: 600;
}

input {
  width: 100%;
  margin-top: 0.4rem;
  margin-bottom: 0.3rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--control-bg);
  color: var(--ink);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  margin: 0 0.3rem 0 0;
  padding: 0;
  accent-color: var(--accent);
}

select {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  background: var(--control-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

/* ==========================================================================
   Buttons
   ========================================================================== */
button {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  background: var(--button-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

button:hover:not(:disabled) {
  background: var(--button-hover-bg);
  border-color: var(--line-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ==========================================================================
   Row Utility
   ========================================================================== */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.button-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   Meta / Text
   ========================================================================== */
.meta,
.microclimate {
  color: var(--muted);
  margin-top: 0.3rem;
  font-size: 0.82rem;
}

/* ==========================================================================
   Resort Cards
   ========================================================================== */
.results {
  display: grid;
  gap: 0.6rem;
}

.browse-results {
  margin-top: 0.85rem;
}

.resort-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  cursor: pointer;
  background: var(--card);
  transition: all var(--transition-fast);
}

.resort-card:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.resort-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-md);
  background: var(--card-elevated);
}

.resort-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.elev-range {
  margin-top: 0.2rem;
  color: var(--ink-secondary);
  font-size: 0.78rem;
}

.snow5d-value {
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
}

.pass-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--chip-ink);
  background: var(--chip-bg);
  padding: 0.12rem 0.5rem;
  margin-top: 0.25rem;
  margin-right: 0.2rem;
}

/* ==========================================================================
   Snow Color Classes
   ========================================================================== */
.snow-none {
  color: var(--snow-none);
}

.snow-low {
  color: var(--snow-low);
}

.snow-mid {
  color: var(--snow-mid);
}

.snow-high {
  color: var(--snow-high);
}

.snow-extreme {
  color: var(--snow-extreme);
}

.snow-epic {
  color: var(--snow-epic);
}

.snow-loading {
  color: var(--muted);
  font-weight: 700;
}

/* ==========================================================================
   Warning / Status
   ========================================================================== */
.warning {
  margin-top: 0.45rem;
  color: var(--warn);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  line-height: 1.2;
}

.warning:empty {
  display: none;
}

.warning-inline-spinner {
  width: 0.88em;
  height: 0.88em;
  border-radius: var(--radius-pill);
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  display: inline-block;
  vertical-align: middle;
  animation: spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.warning-inline-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9em;
  height: 0.9em;
  flex: 0 0 auto;
}

.warning-inline-progress svg {
  width: 0.9em;
  height: 0.9em;
  display: block;
}

.warning-inline-progress-track,
.warning-inline-progress-value {
  fill: none;
  stroke-width: 2;
}

.warning-inline-progress-track {
  stroke: var(--line);
}

.warning-inline-progress-value {
  stroke: var(--accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Forecast Overlay
   ========================================================================== */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 25;
  animation: fade-in 200ms ease-out;
}

.forecast-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1020px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--overlay-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  z-index: 30;
  box-shadow: var(--shadow-xl);
  animation: slide-up 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.overlay-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.overlay-heading h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.overlay-flag-region {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.close-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  flex-shrink: 0;
}

.close-btn:hover:not(:disabled) {
  color: var(--ink);
  background: var(--bg-subtle);
}

/* ==========================================================================
   Source & Elevation Controls
   ========================================================================== */
.source-row {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.elevation-controls {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.elevation-controls .elevation-btn {
  border-color: var(--elev-pill-border);
  background: var(--elev-pill-bg);
  font-size: 0.78rem;
}

.elevation-controls .elevation-btn:hover:not(:disabled) {
  background: var(--elev-pill-bg);
  border-color: var(--elev-pill-border);
  color: var(--ink);
}

.elevation-btn.active {
  border-color: var(--elev-active-border);
  background: var(--elev-active-bg);
  color: var(--elev-active-ink);
  box-shadow: var(--shadow-sm);
}

.elevation-btn.active:hover:not(:disabled) {
  background: var(--elev-active-bg);
  border-color: var(--elev-active-border);
  color: var(--elev-active-ink);
}

.elevation-controls.iconized .elevation-btn {
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.7rem;
}

.elev-icon {
  margin-right: 0.25rem;
}

/* ==========================================================================
   Forecast Location
   ========================================================================== */
.forecast-location-row {
  margin-top: 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.forecast-location-label {
  font-weight: 600;
}

.forecast-location-link {
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}

/* ==========================================================================
   Totals Grid
   ========================================================================== */
.totals-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
}

.total-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.5rem;
  text-align: center;
  background: var(--card-soft-bg);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

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

.total-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.total-value {
  display: block;
  margin-top: 0.2rem;
  font-weight: 800;
  font-size: 1.15rem;
}

/* ==========================================================================
   Daily Totals
   ========================================================================== */
.daily-block {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.daily-block-title {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.daily-totals {
  margin-top: 0.45rem;
  display: grid;
  /* Always render as a single even row (up to 7 days) so we never get an
     uneven 4+3 wrap. On very narrow viewports the cards shrink down. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.daily-total-card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  background: var(--card-soft-bg);
  text-align: center;
  transition: border-color var(--transition-fast);
}

.daily-total-card:hover {
  border-color: var(--line-hover);
}

.daily-total-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.daily-total-risk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  background: #f6c445;
  color: #2f2200;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  box-shadow: 0 0 0 1px rgba(47, 34, 0, 0.12);
}

.daily-total-value {
  display: block;
  margin-top: 0.1rem;
  font-weight: 800;
  font-size: 0.92rem;
}

/* ==========================================================================
   Model Info Panel
   ========================================================================== */
.model-list {
  margin-top: 0.85rem;
}

.model-info {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-soft-bg);
  overflow: hidden;
}

.model-info-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  padding: 0.55rem 0.75rem;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  width: 100%;
  gap: 0.4rem;
  transition: background var(--transition-fast);
}

.model-info-summary:hover {
  background: var(--bg-subtle);
}

.model-info-summary::-webkit-details-marker {
  display: none;
}

.model-info-summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 0.3rem;
  color: var(--muted);
  transition: transform var(--transition-fast);
}

.model-info[open] .model-info-summary::before {
  content: "\25BE";
}

.model-info-summary-text {
  min-width: 0;
  flex: 1 1 auto;
}

.model-info-summary-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
  flex: 0 1 46%;
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--warn);
}

.model-info-summary-status-text {
  min-width: 0;
  text-align: right;
  line-height: 1.25;
}

.model-info-body {
  border-top: 1px solid var(--line);
  padding: 0.6rem 0.75rem 0.75rem;
}

.model-info-note {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--warn);
  font-weight: 600;
}

.model-info-warning {
  margin: 0 0 0.5rem;
}

.model-info-section-title {
  margin: 0.45rem 0 0.3rem;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.model-info-list {
  margin: 0;
  padding-left: 1rem;
}

.model-info-item {
  margin: 0.2rem 0;
  font-size: 0.78rem;
}

.model-info-name {
  display: inline-block;
  min-width: 88px;
  font-weight: 700;
  color: var(--chip-ink);
}

.model-info-meta {
  color: var(--muted);
}

.model-info-list-unavailable .model-info-item {
  color: var(--muted);
}

/* ==========================================================================
   Period Table
   ========================================================================== */
.period-table-wrap {
  margin-top: 0.85rem;
  overflow: auto;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
}

.period-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 1040px;
}

.period-table th {
  border-top: none;
  padding: 0.5rem 0.5rem;
  text-align: left;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--card-soft-bg);
  border-bottom: 1.5px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
}

.period-table td {
  border-top: 1px solid var(--table-line);
  padding: 0.4rem 0.5rem;
  text-align: left;
  white-space: nowrap;
}

.period-table tbody tr:hover {
  background: var(--table-stripe);
}

/* Date column for the day/night period table — shared (rowspan) cell that
   visually anchors a paired Day + Night row group together. */
.period-table .period-date-cell {
  vertical-align: middle;
  text-align: center;
  font-weight: 700;
  color: var(--ink);
  background: var(--card-soft-bg);
  border-right: 1px solid var(--line);
  white-space: nowrap;
  line-height: 1.1;
}

.period-table .period-date-cell .period-date-text {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
}

.period-table .period-date-cell .period-date-weekday {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.period-table tr.date-group-start td {
  border-top: 2px solid var(--line);
}

/* ==========================================================================
   Detailed 24h
   ========================================================================== */
.detailed-24h-section {
  margin-top: 0.85rem;
}

.detailed-24h-title {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ==========================================================================
   Chart
   ========================================================================== */
.chart-wrap {
  margin-top: 0.85rem;
  min-height: 160px;
}

.chart-title {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.chart-unit-tag {
  color: var(--muted);
  font-size: 0.72rem;
}

.chart {
  width: 100%;
  height: 200px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-soft-bg);
}

/* ==========================================================================
   Region Explorer
   ========================================================================== */
.region-explorer {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 0.7rem;
}

.region-explorer h3 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.explorer-list {
  margin-top: 0.4rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  padding: 0.35rem;
  display: grid;
  gap: 0.2rem;
}

.explorer-btn {
  text-align: left;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.explorer-btn.active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-border);
  color: var(--nav-active-ink);
}

/* ==========================================================================
   Favorites / Saved
   ========================================================================== */
.saved-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.saved-header-row h2 {
  margin: 0;
}

.favorites-edit-btn {
  flex-shrink: 0;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--button-bg);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.favorites-edit-btn:hover {
  border-color: var(--line-hover);
  background: var(--button-hover-bg);
}

.favorites-edit-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.favorites-list {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.favorite-row-clickable {
  cursor: pointer;
  user-select: none;
}

.favorite-row-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.favorite-remove-btn {
  color: var(--warn);
  border-color: var(--line);
}

.favorite-remove-btn:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.08);
  border-color: var(--warn);
}

.favorite-row {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.85rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  background: var(--card);
}

.favorite-row:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.favorite-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.favorite-main {
  display: grid;
  gap: 0.2rem;
}

.favorite-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.favorite-stat {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.4rem;
  background: var(--card-soft-bg);
}

.favorite-stat-label {
  font-size: 0.65rem;
  color: var(--muted);
  display: block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.favorite-stat-value {
  font-size: 0.82rem;
  font-weight: 800;
}

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-panel h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.settings-group {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.settings-group:first-of-type {
  margin-top: 0.75rem;
  padding-top: 0;
  border-top: none;
}

.settings-subtitle {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
  color: var(--ink);
  font-weight: 700;
}

.settings-row {
  margin-top: 0.65rem;
}

.settings-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.settings-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 500;
}

.settings-option-label {
  font-size: 0.88rem;
  color: var(--ink);
}

/* Theme picker grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.theme-card {
  cursor: pointer;
  font-weight: 500;
}

.theme-card input[type="radio"] {
  display: none;
}

.theme-card-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  transition: all var(--transition-fast);
  background: var(--card-soft-bg);
}

.theme-card-inner:hover {
  border-color: var(--line-hover);
  box-shadow: var(--shadow-sm);
}

.theme-card input[type="radio"]:checked+.theme-card-inner {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--card);
}

.theme-shape {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.theme-shape-circle {
  border-radius: var(--radius-pill);
}

.theme-shape-square {
  border-radius: 0.2rem;
}

.theme-shape-diamond {
  transform: rotate(45deg);
  border-radius: 0.12rem;
}

.theme-shape-double-black {
  width: 1.4rem;
  height: 0.9rem;
  border: none;
  background: transparent;
  position: relative;
}

.theme-shape-double-black::before,
.theme-shape-double-black::after {
  content: "";
  position: absolute;
  top: 0.18rem;
  width: 0.38rem;
  height: 0.38rem;
  background: #0a0a0a;
  border: 1px solid #555;
  border-radius: 0.04rem;
  transform: rotate(45deg);
}

.theme-shape-double-black::before {
  left: 0.14rem;
}

.theme-shape-double-black::after {
  left: 0.72rem;
}

.theme-preview-green-circle .theme-shape {
  background: #059669;
  border: 1.5px solid #34d399;
}

.theme-preview-blue-square .theme-shape {
  background: #2563eb;
  border: 1.5px solid #60a5fa;
}

.theme-preview-black-diamond .theme-shape {
  background: #1e293b;
  border: 1.5px solid #60a5fa;
}

.theme-preview-double-black .theme-shape {
  background: transparent;
  border-color: transparent;
}

/* Keep original class compatibility for theme-option in old HTML */
.theme-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* ==========================================================================
   Map
   ========================================================================== */
.map-controls {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.map-controls label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.interactive-map {
  margin-top: 0.6rem;
  height: 560px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.map-status {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.map-progress-wrap {
  margin-top: 0.35rem;
}

.map-progress-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-progress-bar {
  width: min(420px, 100%);
  height: 0.6rem;
  border-radius: var(--radius-pill);
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

.map-progress-bar::-webkit-progress-bar {
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
}

.map-progress-bar::-webkit-progress-value {
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width var(--transition-base);
}

.map-progress-bar::-moz-progress-bar {
  background: var(--accent);
  border-radius: var(--radius-pill);
}

.map-progress-label {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 700;
  min-width: 3.2rem;
}

.map-legend {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.map-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  display: inline-block;
}

.leaflet-popup-content .map-popup-open {
  margin-top: 0.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  background: var(--button-bg);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.82rem;
}

/* ==========================================================================
   About
   ========================================================================== */
.about-refresh-status {
  margin: 0.85rem 0 0;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.about-operator {
  margin: 1rem 0 0;
  color: var(--ink-secondary);
}

.about-operator-bottom {
  margin-top: 1rem;
}

.site-refresh-btn {
  display: inline-block;
  padding: 0.4em 1em;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.site-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.site-refresh-btn:active:not(:disabled) {
  opacity: 0.8;
}

.about-list {
  margin: 0.85rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.65rem;
}

.about-list li {
  color: var(--ink);
  line-height: 1.45;
  font-size: 0.9rem;
}

.about-list a {
  margin-left: 0.3rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.about-list a:hover {
  text-decoration: underline;
}

.legal-actions {
  margin-top: 1rem;
}

.secondary-action-btn {
  padding: 0.65rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--button-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.secondary-action-btn:hover {
  background: var(--button-hover-bg);
  border-color: var(--line-hover);
}

.legal-links-card {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1rem;
}

.legal-links-card a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.legal-links-card a:hover {
  text-decoration: underline;
}

.legal-shell {
  min-height: 100vh;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.legal-page {
  max-width: 860px;
  margin: 0 auto;
}

.legal-page-header {
  margin-bottom: 1rem;
}

.legal-page h1 {
  margin-bottom: 0.35rem;
}

.legal-page p {
  color: var(--ink-secondary);
  line-height: 1.7;
}

.snow-report-page {
  max-width: 1220px;
  margin: 0 auto;
}

.snow-report-page-header {
  display: flex;
  justify-content: flex-start;
}

.snow-report-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.snow-report-title-row h1 {
  margin-bottom: 0.25rem;
}

.snow-report-subtitle {
  margin: 0;
  color: var(--ink-secondary);
}

.snow-report-stats {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  flex: 0 0 auto;
}

.snow-report-stat {
  color: var(--ink-secondary);
  font-size: 0.88rem;
  font-weight: 600;
}

.snow-report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.snow-report-search {
  display: grid;
  gap: 0.3rem;
  min-width: min(460px, 100%);
  flex: 1 1 420px;
}

.snow-report-search span,
.snow-report-toggle span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.snow-report-search input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--ink);
  font: inherit;
}

.snow-report-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 46px;
  padding-bottom: 0.1rem;
}

.snow-report-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: color-mix(in srgb, var(--card) 92%, white 8%);
}

.snow-report-table {
  width: 100%;
  border-collapse: collapse;
}

.snow-report-table th,
.snow-report-table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.9rem;
}

.snow-report-table th {
  background: color-mix(in srgb, var(--bg-subtle) 78%, white 22%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.snow-report-table tbody tr:last-child td {
  border-bottom: none;
}

.snow-report-resort-name a,
.snow-report-resort-name {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.snow-report-resort-name a:hover {
  text-decoration: underline;
}

.snow-report-resort-meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.snow-report-empty {
  text-align: center !important;
  color: var(--ink-secondary);
  padding: 1.25rem !important;
}

.consent-banner {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 2rem));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card-elevated);
  box-shadow: var(--shadow-lg);
  z-index: 1200;
}

.consent-copy strong {
  display: block;
  margin-bottom: 0.1rem;
}

.consent-copy p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.35;
  font-size: 0.92rem;
}

.consent-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 0 0 160px;
}

.consent-actions button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
}

@media (max-width: 760px) {
  .consent-banner {
    align-items: stretch;
    flex-direction: column;
    bottom: 0.75rem;
  }

  .consent-actions {
    width: 100%;
    flex-direction: column;
  }

  .consent-actions button {
    width: 100%;
  }
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.hidden {
  display: none;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Compat aliases for old animation names used in app.js */
@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes overlay-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes overlay-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */
.print-only {
  display: none;
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.35in;
  }

  body {
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-shell,
  #forecast-overlay-backdrop {
    display: none !important;
  }

  #forecast-overlay.hidden {
    display: block !important;
  }

  #forecast-overlay {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    animation: none !important;
  }

  #forecast-overlay .button-row,
  #forecast-overlay .source-row,
  #forecast-overlay .elevation-controls,
  #forecast-overlay #forecast-location-row,
  #forecast-overlay #model-list {
    display: none !important;
  }

  #forecast-overlay #chart-wrap {
    display: block !important;
    margin-top: 0.28rem !important;
    min-height: 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #forecast-overlay .chart {
    height: 126px !important;
  }

  #forecast-overlay .chart-title {
    margin-bottom: 0.02rem !important;
    font-size: 0.74rem !important;
  }

  #forecast-overlay .chart-unit-tag {
    margin-bottom: 0.08rem !important;
    font-size: 0.62rem !important;
  }

  #forecast-overlay .period-table-wrap {
    margin-top: 0.35rem !important;
    overflow: visible !important;
    border-color: #d0d0d0 !important;
  }

  #forecast-overlay .period-table {
    min-width: 0 !important;
    font-size: 0.67rem !important;
  }

  #forecast-overlay .period-table th,
  #forecast-overlay .period-table td {
    padding: 0.2rem 0.24rem !important;
  }

  #forecast-overlay .period-table th:nth-child(10),
  #forecast-overlay .period-table td:nth-child(10),
  #forecast-overlay .period-table th:nth-child(11),
  #forecast-overlay .period-table td:nth-child(11),
  #forecast-overlay .period-table th:nth-child(12),
  #forecast-overlay .period-table td:nth-child(12),
  #forecast-overlay .period-table th:nth-child(13),
  #forecast-overlay .period-table td:nth-child(13) {
    display: none !important;
  }

  #forecast-overlay #detailed-24h-section {
    display: block !important;
    margin-top: 0.24rem !important;
  }

  #forecast-overlay .print-only {
    display: block !important;
  }

  #forecast-overlay .print-meta {
    margin: 0 0 0.3rem 0;
    color: #333333;
    font-size: 0.78rem;
    font-weight: 600;
  }

  #forecast-overlay .print-summary-sheet {
    position: relative;
    min-height: auto;
    break-after: auto;
    page-break-after: auto;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #forecast-overlay .print-summary-sheet .daily-block,
  #forecast-overlay .print-summary-sheet .totals-grid,
  #forecast-overlay #daily-totals {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #forecast-overlay .row,
  #forecast-overlay .overlay-header {
    gap: 0.2rem;
  }

  #forecast-overlay .overlay-heading h2 {
    font-size: 1.45rem !important;
    line-height: 1.04;
  }

  #forecast-overlay .overlay-flag-region {
    font-size: 0.88rem !important;
  }

  #forecast-overlay .meta {
    margin-top: 0.2rem !important;
    font-size: 0.82rem !important;
  }

  #forecast-overlay .totals-grid {
    margin-top: 0.3rem !important;
    gap: 0.26rem !important;
  }

  #forecast-overlay .total-card {
    padding: 0.22rem 0.2rem !important;
  }

  #forecast-overlay .total-label {
    font-size: 0.6rem !important;
  }

  #forecast-overlay .total-value {
    margin-top: 0.04rem !important;
    font-size: 0.8rem !important;
  }

  #forecast-overlay .daily-block {
    margin-top: 0.25rem !important;
    padding-top: 0.2rem !important;
  }

  #forecast-overlay .daily-block-title {
    font-size: 0.68rem !important;
  }

  #forecast-overlay .daily-total-card {
    padding: 0.16rem 0.22rem !important;
  }

  #forecast-overlay #daily-totals {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 0.22rem !important;
  }

  #forecast-overlay .print-summary-sheet .print-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-22deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    opacity: 0.09;
    pointer-events: none;
    z-index: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #forecast-overlay .print-watermark-logo {
    width: 280px;
    height: auto;
    display: block;
    filter: grayscale(100%);
  }

  #forecast-overlay .print-watermark-name {
    font-size: 3.4rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #000000;
    text-transform: uppercase;
    white-space: nowrap;
  }

  #forecast-overlay .print-summary-sheet>*:not(.print-watermark) {
    position: relative;
    z-index: 1;
  }

  #forecast-overlay #period-table-body tr:nth-child(n + 9) {
    display: none !important;
  }

  #forecast-overlay #detailed-24h-body tr:nth-child(n + 9) {
    display: none !important;
  }

  #forecast-overlay .daily-total-day {
    font-size: 0.58rem !important;
    line-height: 1.1;
    gap: 0.15rem !important;
  }

  #forecast-overlay .daily-total-risk {
    width: 0.72rem !important;
    height: 0.72rem !important;
    font-size: 0.56rem !important;
  }

  #forecast-overlay .daily-total-value {
    font-size: 0.74rem !important;
    margin-top: 0.02rem !important;
  }
}

/* ==========================================================================
   MOBILE UI — Purpose-built for phones (≤720px) and small tablets (≤900px)
   ==========================================================================
   This is NOT the desktop UI shrunk down. The mobile experience is:

   1. A FIXED BOTTOM TAB BAR that re-uses the existing .main-nav element. This
      keeps navigation reachable and never scrolls off-screen.
   2. A scrolling content column with safe-area-aware top padding so the hero
      title is never tucked under a notch / status bar.
   3. The forecast overlay becomes a FULL-SCREEN page (not a bottom sheet —
      sheets fight sticky headers and waste landscape height). The overlay
      header is fixed to the top with safe-area-inset-top padding so close /
      save are always tappable, and the body scrolls underneath.
   4. The elevation pills become a 4-column grid that always fits the viewport
      so they cannot get clipped on the right side.
   5. Tables stay horizontally scrollable but the first column (Date / Time)
      is sticky so context never disappears, and the wrap is full-bleed.
   ========================================================================== */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --mobile-tabbar-h: 60px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@keyframes pf-mobile-fade-in {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes pf-mobile-overlay-in {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ---------- Tablet (≤1024px): just looser layout, no UI rewrite -------- */
@media (max-width: 1024px) {
  .app-shell {
    max-width: 100%;
    padding: calc(1.25rem + var(--safe-top))
             max(1rem, var(--safe-left))
             calc(2.5rem + var(--safe-bottom))
             max(1rem, var(--safe-right));
  }

  .region-explorer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .interactive-map {
    height: 480px;
  }

  /* Kill iOS focus zoom */
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
  }
}

/* ==========================================================================
   PHONE LAYOUT (≤900px) — purpose-built mobile UI
   ========================================================================== */
@media (max-width: 900px) {

  /* --- Body / shell ----------------------------------------------------- */
  body {
    /* Make the body itself the scroll surface so the bottom tab bar can sit
       on top of it without affecting any internal scroll containers. */
    background-attachment: scroll;
  }

  .app-shell {
    max-width: 100%;
    margin: 0;
    /* Top padding includes safe-area so the hero clears the notch.
       Bottom padding clears the fixed bottom tab bar + home indicator. */
    padding:
      calc(0.85rem + var(--safe-top))
      max(0.9rem, var(--safe-left))
      calc(var(--mobile-tabbar-h) + 1rem + var(--safe-bottom))
      max(0.9rem, var(--safe-right));
  }

  .panel {
    margin-top: 0.7rem;
    padding: 0.95rem 0.9rem;
    border-radius: var(--radius-md);
  }

  /* --- Hero ------------------------------------------------------------- */
  .hero {
    margin: 0 0 0.4rem;
  }

  .hero-brand {
    gap: 0.65rem;
  }

  .hero-logo {
    width: 48px;
    height: 34px;
  }

  .hero h1 {
    font-size: 1.3rem;
    line-height: 1.15;
  }

  .hero-tagline {
    font-size: 0.78rem;
  }

  /* --- Hide the in-flow nav and re-purpose .main-nav as a fixed tab bar - */
  .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 40;
    margin: 0;
    padding: 0.35rem max(0.5rem, var(--safe-left))
             calc(0.35rem + var(--safe-bottom))
             max(0.5rem, var(--safe-right));
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    background: var(--card);
    border: none;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
  }

  .nav-btn {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.35rem 0.25rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--nav-ink);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .nav-btn svg {
    width: 20px;
    height: 20px;
    opacity: 0.85;
    flex-shrink: 0;
  }

  .nav-btn:hover {
    background: transparent;
  }

  .nav-btn.active {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--nav-active-ink);
  }

  .nav-btn.active svg {
    opacity: 1;
  }

  /* Subtle pill behind active label so it still reads as "selected" */
  .nav-btn.active::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    width: 28px;
    height: 3px;
    border-radius: 999px;
    background: var(--nav-active-border);
    transform: translateX(-50%);
  }

  .nav-btn {
    position: relative;
  }

  /* --- Search ----------------------------------------------------------- */
  .search-panel label {
    font-size: 0.74rem;
  }

  input[type="text"]#search {
    padding: 0.85rem 1rem 0.85rem 2.7rem;
    font-size: 16px;
    border-radius: var(--radius-md);
  }

  .search-footer {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* --- Resort cards ----------------------------------------------------- */
  .results {
    gap: 0.55rem;
  }

  .resort-card {
    padding: 0.95rem 1rem;
    border-radius: var(--radius-md);
    min-height: 48px;
    animation: pf-mobile-fade-in 280ms ease-out both;
  }

  .resort-card:hover {
    transform: none;
  }

  .resort-card .row {
    align-items: flex-start;
    gap: 0.6rem;
  }

  .resort-name {
    font-size: 1rem;
    line-height: 1.25;
  }

  .snow5d-value {
    font-size: 1rem;
  }

  /* --- Region explorer -------------------------------------------------- */
  .region-explorer {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .explorer-list {
    max-height: 220px;
  }

  /* --- Interactive map -------------------------------------------------- */
  .interactive-map {
    height: 380px;
    margin-left: -0.9rem;
    margin-right: -0.9rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .map-controls {
    gap: 0.5rem;
  }

  /* --- Favorites -------------------------------------------------------- */
  .favorites-list {
    gap: 0.55rem;
  }

  .favorite-row {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding: 0.95rem 1rem;
    min-height: 48px;
  }

  .favorite-actions {
    justify-content: flex-end;
  }

  .favorite-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  /* --- Settings & themes ------------------------------------------------ */
  .theme-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .theme-card-inner {
    padding: 0.85rem 0.9rem;
    min-height: 48px;
  }

  .settings-options {
    gap: 0.65rem;
  }

  .settings-option {
    min-height: 36px;
  }

  /* --- FORECAST OVERLAY: full-screen page on mobile --------------------- */
  /* Use position:fixed inset:0 so it owns the whole viewport. The header
     bar inside is sticky to the top so close/save are always tappable.
     The body scrolls underneath. No bottom-sheet drag-handle gymnastics. */

  .overlay-backdrop {
    background: rgba(0, 0, 0, 0.5);
  }

  .forecast-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    height: 100dvh;
    height: 100vh;
    max-width: 100%;
    max-height: 100dvh;
    max-height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    /* Push body content below the sticky header (header is ~58px + safe-top)
       and clear the home indicator on the bottom. */
    padding: 0 max(0.9rem, var(--safe-left))
             calc(1.25rem + var(--safe-bottom))
             max(0.9rem, var(--safe-right));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: pf-mobile-overlay-in 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Sticky header bar — always reachable, safe-area-inset-top padded */
  .forecast-overlay .overlay-header {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 calc(-1 * max(0.9rem, var(--safe-left)))
            0.7rem calc(-1 * max(0.9rem, var(--safe-right)));
    padding: calc(var(--safe-top) + 0.55rem)
             max(0.9rem, var(--safe-right))
             0.6rem
             max(0.9rem, var(--safe-left));
    background: var(--overlay-bg);
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
  }

  .forecast-overlay .overlay-heading {
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.4rem;
  }

  .forecast-overlay .overlay-heading h2 {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .overlay-flag-region {
    font-size: 0.72rem;
  }

  .button-row {
    gap: 0.3rem;
    flex-shrink: 0;
  }

  .button-row button {
    padding: 0.45rem 0.65rem;
    font-size: 0.76rem;
    min-height: 38px;
  }

  /* Hide Print on phones — irrelevant on mobile and saves header space */
  #print-forecast-btn {
    display: none;
  }

  .close-btn {
    width: 38px;
    height: 38px;
  }

  /* --- Source mode + raw model select ----------------------------------- */
  .source-row {
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.82rem;
  }

  .source-row label {
    flex: 0 0 auto;
  }

  .source-row select {
    flex: 1 1 100%;
    min-height: 40px;
    padding: 0.55rem 0.7rem;
  }

  /* --- ELEVATION CONTROLS: 4-col grid that always fits ------------------ */
  .elevation-controls,
  .elevation-controls.iconized {
    margin-top: 0.7rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .elevation-controls .elevation-btn,
  .elevation-controls.iconized .elevation-btn {
    flex: none;
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.25rem;
    font-size: 0.7rem;
    line-height: 1.15;
    min-height: 44px;
    border-radius: var(--radius-sm);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .elev-icon {
    margin-right: 0;
    display: block;
    margin-bottom: 0.15rem;
  }

  /* --- Totals grid ------------------------------------------------------ */
  .totals-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .total-card {
    padding: 0.75rem 0.55rem;
  }

  .total-value {
    font-size: 1.2rem;
  }

  .daily-totals {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.32rem;
  }

  .daily-total-card {
    padding: 0.42rem 0.25rem;
  }

  .daily-total-day {
    font-size: 0.62rem;
  }

  .daily-total-value {
    font-size: 0.78rem;
  }

  /* --- Period tables: full-bleed, sticky first column ------------------ */
  .period-table-wrap {
    margin-left: calc(-1 * max(0.9rem, var(--safe-left)));
    margin-right: calc(-1 * max(0.9rem, var(--safe-right)));
    border-left: none;
    border-right: none;
    border-radius: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Visual cue that the table can scroll horizontally */
    background:
      linear-gradient(to right, var(--card) 30%, rgba(255, 255, 255, 0)),
      linear-gradient(to right, rgba(255, 255, 255, 0), var(--card) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 36px 100%, 36px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  .period-table {
    font-size: 0.74rem;
    min-width: 920px;
  }

  .period-table th,
  .period-table td {
    padding: 0.5rem 0.55rem;
  }

  .detailed-24h-section .period-table {
    min-width: 880px;
  }

  .period-table th:first-child,
  .period-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--card);
    box-shadow: 1px 0 0 var(--table-line);
  }

  .period-table th:first-child {
    background: var(--card-soft-bg);
    z-index: 2;
  }

  /* --- Snow report ------------------------------------------------------ */
  .snow-report-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .snow-report-stats {
    justify-items: start;
  }

  .snow-report-table-wrap {
    margin-left: calc(-1 * max(0.9rem, var(--safe-left)));
    margin-right: calc(-1 * max(0.9rem, var(--safe-right)));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .snow-report-table {
    min-width: 720px;
  }

  /* --- Consent banner: bottom dock above the tab bar ------------------- */
  .consent-banner {
    left: 0.5rem;
    right: 0.5rem;
    bottom: calc(var(--mobile-tabbar-h) + 0.5rem + var(--safe-bottom));
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
  }

  .consent-actions {
    display: flex;
    gap: 0.5rem;
  }

  .consent-actions button {
    flex: 1 1 0;
    min-height: 44px;
  }

  /* --- Touch-target safety net ----------------------------------------- */
  button,
  select {
    min-height: 40px;
  }

  /* --- Kill iOS focus zoom on every text input ------------------------- */
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
  }
}

/* ---------- Landscape phones: keep the tab bar but shorten it --------- */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  :root {
    --mobile-tabbar-h: 48px;
  }

  .nav-btn {
    flex-direction: row;
    gap: 0.35rem;
    font-size: 0.72rem;
  }

  .nav-btn svg {
    width: 16px;
    height: 16px;
  }

  .nav-btn.active::before {
    display: none;
  }

  .forecast-overlay .overlay-header {
    padding-top: calc(var(--safe-top) + 0.4rem);
    padding-bottom: 0.45rem;
  }

  .forecast-overlay .overlay-heading h2 {
    font-size: 0.98rem;
  }

  .interactive-map {
    height: 280px;
  }
}

/* ---------- Small phones (≤380px) ------------------------------------- */
@media (max-width: 380px) {
  .app-shell {
    padding-left: max(0.7rem, var(--safe-left));
    padding-right: max(0.7rem, var(--safe-right));
  }

  .hero h1 {
    font-size: 1.18rem;
  }

  .hero-tagline {
    font-size: 0.74rem;
  }

  .nav-btn {
    font-size: 0.6rem;
  }

  .nav-btn svg {
    width: 18px;
    height: 18px;
  }

  .panel {
    padding: 0.85rem 0.8rem;
  }

  .totals-grid {
    grid-template-columns: 1fr 1fr;
  }

  .total-value {
    font-size: 1.08rem;
  }

  .button-row button {
    padding: 0.4rem 0.55rem;
    font-size: 0.72rem;
  }

  .forecast-overlay .overlay-heading h2 {
    font-size: 0.98rem;
  }

  .elevation-controls .elevation-btn,
  .elevation-controls.iconized .elevation-btn {
    font-size: 0.65rem;
    padding: 0.45rem 0.2rem;
  }

  .interactive-map {
    height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .forecast-overlay,
  .overlay-backdrop,
  .resort-card {
    animation: none !important;
  }
}

/* ==========================================================================
   Hidden analytics page
   ========================================================================== */

.analytics-page {
  display: grid;
  gap: 1.25rem;
}

.analytics-page-header {
  margin-bottom: 0;
}

.analytics-title-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.analytics-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.analytics-page-meta {
  display: grid;
  gap: 0.4rem;
  justify-items: end;
}

.analytics-page-stat {
  color: var(--muted);
  font-size: 0.92rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

.analytics-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.analytics-card-label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-card-value {
  font-size: 1.4rem;
}

.analytics-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr);
  gap: 0.85rem;
}

.analytics-search,
.analytics-select {
  display: grid;
  gap: 0.35rem;
}

.analytics-search span,
.analytics-select span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-section {
  display: grid;
  gap: 0.8rem;
}

.analytics-section-header {
  display: grid;
  gap: 0.25rem;
}

.analytics-section-header h2 {
  margin: 0;
}

.analytics-section-header p,
.analytics-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.analytics-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.analytics-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: auto;
  background: rgba(255, 255, 255, 0.8);
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.analytics-table th,
.analytics-table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.95rem;
}

.analytics-table th {
  position: sticky;
  top: 0;
  background: rgba(244, 248, 252, 0.97);
  z-index: 1;
}

.analytics-table tbody tr:last-child td {
  border-bottom: none;
}

.analytics-empty {
  color: var(--muted);
}

.analytics-row-active td {
  background: rgba(59, 130, 246, 0.08);
}

@media (max-width: 980px) {
  .analytics-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .analytics-toolbar {
    grid-template-columns: 1fr;
  }

  .analytics-page-meta {
    justify-items: start;
  }

  .analytics-table {
    min-width: 520px;
  }
}
