/* ==========================================================================
   FloodRadar PRO by PAPA AI - DESIGN SYSTEM & STYLESHEET
   Emergency Operations Center (EOC) Responsive Glassmorphic Interface
   ========================================================================== */

:root {
  --font-sans: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Prompt', 'Bai Jamjuree', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Color Palette - Aquatic Liquid Glass Theme (High Contrast) */
  --bg-app: #020814;
  --bg-surface: #06152d;
  --bg-surface-elevated: #0a2044;
  --bg-glass: rgba(6, 18, 40, 0.92);
  --bg-glass-card: rgba(8, 22, 48, 0.94);
  --border-glass: rgba(56, 189, 248, 0.35);
  --border-subtle: rgba(56, 189, 248, 0.18);

  --text-main: #ffffff;
  --text-muted: #e2e8f0;
  --text-dim: #bae6fd;

  /* Water Flood Depth Aqua-to-Dark-Navy Gradient Scale */
  --flood-aqua: #38bdf8;     /* 5-10 ซม. Sky Aqua (ฟ้าอ่อน) */
  --flood-ocean: #0284c7;    /* 10-15 ซม. Ocean Blue (ฟ้าเข้ม) */
  --flood-deep: #1e3a8a;     /* 15-20 ซม. Deep Blue */
  --flood-navy: #0a1931;     /* >20 ซม. Dark Navy Blue น้ำเงินเข้ม */

  /* Flood Emergency Status Levels */
  --lv5: #ef4444; /* ล้นตลิ่ง (วิกฤต) */
  --lv5-glow: rgba(239, 68, 68, 0.45);
  --lv4: #f59e0b; /* น้ำมาก (เตือนภัย) */
  --lv4-glow: rgba(245, 158, 11, 0.4);
  --lv3: #10b981; /* ปกติ */
  --lv2: #06b6d4; /* น้ำน้อย */
  --lv1: #8b5cf6; /* น้อยวิกฤต */

  --rain-heavy: #ec4899; /* ฝนตกหนักมาก >90 มม. */
  --dam-primary: #38bdf8; /* เขื่อน */
  --facebook-blue: #1877f2; /* Facebook */

  --accent-cyan: #38bdf8;
  --accent-blue: #0284c7;
  --shadow-hud: 0 14px 38px -5px rgba(0, 8, 24, 0.8), 0 0 1px 1px var(--border-glass);
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-glass-card: #ffffff;
  --border-glass: rgba(2, 132, 199, 0.25);
  --border-subtle: rgba(2, 132, 199, 0.14);

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #475569;

  --shadow-hud: 0 10px 28px -5px rgba(2, 132, 199, 0.15), 0 0 1px 1px var(--border-glass);
}

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

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  font-size: 15px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.font-mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

/* Glassmorphism Generic Utility (Liquid Glass) */
.glass-panel {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, var(--bg-glass) 100%);
  backdrop-filter: blur(24px) saturate(190%) contrast(105%);
  -webkit-backdrop-filter: blur(24px) saturate(190%) contrast(105%);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  box-shadow: 0 14px 40px 0 rgba(0, 10, 32, 0.68), 
              inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.22), 
              inset 0 0 24px 0 rgba(56, 189, 248, 0.06);
}

/* ==========================================================================
   EMERGENCY TICKER BANNER
   ========================================================================== */
.emergency-banner {
  flex-shrink: 0;
  background: linear-gradient(90deg, #b91c1c, #991b1b, #7f1d1d);
  color: #fff;
  padding: 6px 16px;
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1000;
  animation: slideDown 0.3s ease;
}

.banner-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-siren {
  background: #ffffff;
  color: #b91c1c;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  animation: pulseAlarm 1.2s infinite;
}

.ticker-wrap {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-content {
  font-weight: 500;
  letter-spacing: 0.2px;
}

.btn-icon-subtle {
  color: rgba(255, 255, 255, 0.7);
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}
.btn-icon-subtle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  height: 52px;
  flex-shrink: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: max-content;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #07152b 0%, #032b5f 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.4), inset 0 0 10px rgba(56, 189, 248, 0.2);
  flex-shrink: 0;
  transition: all 0.25s ease;
  cursor: pointer;
}
.logo-icon-wrapper:hover {
  transform: scale(1.05);
  border-color: #38bdf8;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.6), inset 0 0 14px rgba(56, 189, 248, 0.35);
}

.radar-logo-svg {
  width: 34px;
  height: 34px;
  display: block;
}

@keyframes radarSweep {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.radar-sweep-beam {
  transform-origin: 24px 24px;
  animation: radarSweep 3.2s linear infinite;
}

@keyframes radarBlip {
  0%, 100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

.radar-blip-dot {
  transform-origin: 34px 14px;
  animation: radarBlip 1.6s ease-in-out infinite;
}

@keyframes waveSurge {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-4px);
  }
  100% {
    transform: translateX(0);
  }
}

.wave-layer-front {
  animation: waveSurge 2.8s ease-in-out infinite;
}
.wave-layer-back {
  animation: waveSurge 3.8s ease-in-out infinite reverse;
}
.wave-layer-line {
  animation: waveSurge 2.8s ease-in-out infinite;
}

.pulse-beacon {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border: 2px solid var(--bg-surface);
  border-radius: 50%;
  animation: pulseBeacon 1.5s infinite;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

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

.brand-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-name {
  color: #ffffff;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.brand-accent {
  color: var(--accent-cyan);
}

.badge-pro {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.badge-by-papa {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.28), rgba(139, 92, 246, 0.32));
  border: 1px solid rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.35);
  color: #e0e7ff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  vertical-align: middle;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.badge-by-papa i {
  color: #c084fc;
  font-size: 0.66rem;
  filter: drop-shadow(0 0 4px rgba(192, 132, 252, 0.8));
}

.badge-by-papa:hover {
  border-color: rgba(192, 132, 252, 0.85);
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.55), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  transform: translateY(-1px) scale(1.02);
  color: #ffffff;
}

.system-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}
.system-status-dot.offline {
  background: #ef4444;
}

.tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Search Box */
.header-center {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 38px;
  border-radius: 20px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.btn-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}
.btn-clear:hover {
  color: var(--text-main);
}

.search-dropdown {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.4);
  max-height: 380px;
  overflow-y: auto;
  z-index: 1050;
}

.search-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s;
}
.search-item:hover {
  background: var(--bg-surface-elevated);
}
.search-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-item-title {
  font-weight: 600;
  font-size: 0.88rem;
}
.search-item-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.search-item-tag {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}

/* Header Action Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
  height: 38px;
  white-space: nowrap;
}

.btn-icon-glass {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  border-radius: 8px;
}
.btn-icon-glass:hover {
  color: var(--text-main);
  background: var(--border-glass);
}

.btn-glass {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}
.btn-glass:hover {
  background: var(--border-glass);
}

.btn-primary-glass {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: var(--accent-cyan);
}
.btn-primary-glass:hover {
  background: rgba(14, 165, 233, 0.28);
}

.btn-accent {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-accent:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* ==========================================================================
   KPI STRIP / OVERVIEW CARDS
   ========================================================================== */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 10px;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  flex-shrink: 0;
  height: 90px;
  min-height: 90px;
}

.kpi-card {
  background: var(--bg-glass-card);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-glass);
  border-radius: 12px;
  padding: 7px 12px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  height: 100%;
  box-shadow: 0 6px 20px rgba(0, 10, 30, 0.45), inset 0 1px 1.5px rgba(255, 255, 255, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.35);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.kpi-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 1px 0;
}

.kpi-value-group {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.kpi-unit {
  font-size: 0.84rem;
  font-weight: 700;
  color: #bae6fd;
}

.kpi-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: normal;
  line-height: 1.25;
}

.kpi-footer {
  font-size: 0.78rem;
  font-weight: 600;
  color: #e0f2fe;
  white-space: normal;
  line-height: 1.35;
}

/* Specific KPI Theme accents */
.kpi-threat {
  border-left: 3px solid var(--accent-cyan);
}
.kpi-danger {
  border-left: 3px solid var(--lv5);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), transparent);
}
.kpi-warning {
  border-left: 3px solid var(--lv4);
}
.kpi-rain {
  border-left: 3px solid var(--rain-heavy);
}
.kpi-dam {
  border-left: 3px solid var(--dam-primary);
}

.fti-meter {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}

.fti-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-badge {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  font-weight: 600;
}

.status-indicator-ping {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lv5);
}
.status-indicator-ping::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  border: 2px solid var(--lv5);
  animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.text-danger { color: var(--lv5); font-weight: 600; }
.text-warning { color: var(--lv4); font-weight: 600; }
.text-info { color: var(--accent-cyan); }
.text-muted { color: var(--text-muted); }

/* Mobile View Switcher (Segmented Switcher - Hidden on desktop) */
.mobile-view-switcher {
  display: none;
  flex-shrink: 0;
  height: 38px;
  min-height: 38px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.m-switch-btn {
  flex: 1;
  height: 100%;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.m-switch-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.m-switch-btn:not(.active):hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.m-switch-btn #m-crit-badge {
  background: var(--lv5);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* ==========================================================================
   WORKSPACE GRID (MAP + SIDEBAR)
   ========================================================================== */
.workspace-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Map Viewport Area */
.map-viewport {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-hud);
  height: 100%;
  min-height: 0;
  background: #1e293b;
}

.map-control-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 800;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.32s;
  will-change: transform, opacity;
}

.map-control-bar.bar-hidden {
  transform: translateY(calc(-100% - 32px));
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Hide / Collapse Button in the control bar */
.btn-toggle-map-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(2, 132, 199, 0.15);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-toggle-map-bar:hover {
  background: rgba(2, 132, 199, 0.32);
  color: #ffffff;
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

/* Bottom Tab Handle hanging on the bottom center of the control bar */
.map-bar-bottom-tab {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 25, 50, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 2px 16px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
  z-index: 10;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.map-bar-bottom-tab:hover {
  color: #38bdf8;
  background: rgba(14, 35, 70, 0.98);
  border-color: #38bdf8;
  padding-bottom: 4px;
}

/* Floating Reveal Button when control bar is hidden */
.map-bar-reveal-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 810;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(10, 25, 50, 0.92);
  color: #ffffff;
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 15px rgba(2, 132, 199, 0.3);
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: revealFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes revealFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.map-bar-reveal-btn:hover {
  background: rgba(14, 40, 80, 0.98);
  border-color: #38bdf8;
  transform: translateY(1px);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.5);
}
.map-bar-reveal-btn i.fa-sliders {
  color: #38bdf8;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #f1f5f9;
}

.filter-chip {
  padding: 6px 13px;
  border-radius: 18px;
  font-size: 0.86rem;
  font-weight: 700;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  transition: all 0.15s;
}
.filter-chip:hover {
  background: var(--border-glass);
  color: var(--text-main);
  transform: translateY(-1px);
}
.filter-chip.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.45);
}

.chip-crit.active {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #f87171;
  box-shadow: 0 4px 14px var(--lv5-glow);
}
.chip-rising.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fcd34d;
}
.chip-rain.active {
  background: linear-gradient(135deg, #ec4899, #db2777);
  border-color: #f472b6;
}
.chip-dam.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border-color: #38bdf8;
}

.separator-v {
  width: 1px;
  height: 24px;
  background: var(--border-glass);
}

.layer-checkboxes {
  display: flex;
  align-items: center;
  gap: 12px;
}

.layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: #f8fafc;
}
.layer-toggle input {
  display: none;
}
.custom-chk {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-glass);
  background: var(--bg-surface-elevated);
  position: relative;
  transition: all 0.2s;
}
.layer-toggle input:checked + .custom-chk {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}
.layer-toggle input:checked + .custom-chk::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}
.custom-chk.chk-wl { border-color: var(--lv5); }
.custom-chk.chk-rain { border-color: var(--rain-heavy); }
.custom-chk.chk-dam { border-color: var(--dam-primary); }
.custom-chk.chk-roadflood { border-color: var(--accent-cyan); }
.custom-chk.chk-pumps { border-color: #10b981; }

.select-styled {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.select-sm {
  padding: 5px 10px;
  font-size: 0.84rem;
}

.filter-dropdown-wrap {
  flex-shrink: 0;
  max-width: 195px;
}
.filter-dropdown-wrap select {
  width: 100%;
  background: rgba(8, 22, 46, 0.96);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  color: #ffffff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-dropdown-wrap select:focus,
.filter-dropdown-wrap select:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.search-sm-wrap {
  position: relative;
  min-width: 160px;
  max-width: 210px;
  flex: 1;
}
.search-sm-wrap input {
  width: 100%;
  padding-left: 30px !important;
  padding-right: 10px;
  background: rgba(8, 22, 46, 0.96);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  color: #ffffff;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}
.search-sm-wrap input:focus,
.search-sm-wrap input:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  background: rgba(12, 30, 62, 0.98);
}
.search-sm-wrap input::placeholder {
  color: #94a3b8;
}
.search-sm-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.82rem;
  color: var(--accent-cyan);
  pointer-events: none;
}

.extra-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.btn-tool {
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}
.btn-tool:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100% !important;
  height: 100% !important;
  background: #cbd5e1;
  z-index: 1;
}

/* Leaflet Zoom & Scale Overrides */
.leaflet-bottom.leaflet-right {
  bottom: 30px !important;
  right: 14px !important;
  z-index: 750 !important;
}
.leaflet-bar {
  border: 1px solid var(--border-glass) !important;
  border-radius: 8px !important;
  overflow: hidden;
  box-shadow: var(--shadow-hud) !important;
}
.leaflet-bar a {
  background-color: var(--bg-surface-elevated) !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}
.leaflet-bar a:hover {
  background-color: var(--border-glass) !important;
  color: var(--accent-cyan) !important;
}

/* Floating Map Legend & Collapsed Pill Button */
.legend-pill-btn {
  position: absolute;
  bottom: 35px;
  left: 14px;
  z-index: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 700;
  background: rgba(10, 25, 50, 0.94);
  color: #ffffff;
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 8px 24px rgba(0, 8, 24, 0.6), 0 0 14px rgba(2, 132, 199, 0.35);
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: revealFadeIn 0.25s ease;
}
.legend-pill-btn:hover {
  background: rgba(14, 40, 80, 0.98);
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.5);
}
.legend-pill-btn i {
  color: var(--accent-cyan);
  font-size: 0.92rem;
}
.legend-pill-btn .pill-arrow {
  font-size: 0.72rem;
  margin-left: 2px;
  color: var(--accent-cyan);
  transition: transform 0.2s ease;
}
.legend-pill-btn:hover .pill-arrow {
  transform: translateY(-2px);
}
.legend-pill-btn.hidden {
  display: none !important;
}

@keyframes popInLegend {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.map-overlay-legend {
  position: absolute;
  bottom: 35px;
  left: 14px;
  z-index: 800;
  padding: 12px 16px;
  width: 275px;
  max-height: calc(100% - 70px);
  overflow-y: auto;
  font-size: 0.86rem;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 8, 24, 0.7);
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: popInLegend 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.map-overlay-legend.collapsed {
  display: none !important;
}

.legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}
.legend-header:hover {
  opacity: 0.92;
}
.legend-title-group {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ffffff;
}
.legend-title-group i {
  color: var(--accent-cyan);
  font-size: 0.95rem;
}
.legend-header strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

/* Explicit Collapse Button in Legend Header */
.btn-collapse-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-collapse-legend:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.45);
}
.btn-collapse-legend i {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.btn-collapse-legend:hover i {
  transform: translateY(1px);
}

/* Bottom Collapse Strip for Easy Reach on Mobile */
.btn-collapse-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-cyan);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  transition: all 0.2s ease;
}
.btn-collapse-bottom:hover {
  background: rgba(56, 189, 248, 0.18);
  border-style: solid;
  border-color: var(--accent-cyan);
  color: #ffffff;
}
.btn-collapse-bottom i {
  font-size: 0.72rem;
}
.legend-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend-section-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 4px;
  letter-spacing: 0.2px;
}
.legend-divider {
  height: 1px;
  background: var(--border-glass);
  margin: 6px 0;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f1f5f9;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-lv5 { background: var(--lv5); box-shadow: 0 0 10px var(--lv5); }
.dot-lv4 { background: var(--lv4); }
.dot-lv3 { background: var(--lv3); }
.dot-lv2 { background: var(--lv2); }
.dot-rain-heavy { background: var(--rain-heavy); }
.dot-dam { background: var(--dam-primary); border-radius: 3px; }
.dot-pump { background: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.8); border-radius: 3px; }
.legend-line {
  width: 18px;
  height: 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.line-rf-low { background: #38bdf8; box-shadow: 0 0 8px rgba(56, 189, 248, 0.7); }
.line-rf-med { background: #0284c7; box-shadow: 0 0 8px rgba(2, 132, 199, 0.8); }
.line-rf-high { background: #1e40af; box-shadow: 0 0 10px rgba(30, 64, 175, 0.8); }
.line-rf-crisis { background: #071329; border: 1.5px solid #38bdf8; box-shadow: 0 0 12px rgba(56, 189, 248, 0.95); }
.legend-arrow-up {
  color: var(--lv5);
  font-weight: 900;
  font-size: 0.85rem;
}
.legend-disclaimer {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  line-height: 1.35;
  padding-top: 2px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.legend-disclaimer i {
  color: var(--accent-cyan);
  font-size: 0.76rem;
  margin-top: 2px;
  flex-shrink: 0;
}

/* User Location Floating Card */
.user-location-card {
  position: absolute;
  top: 80px;
  left: 14px;
  z-index: 850;
  width: 320px;
  padding: 12px 16px;
  animation: fadeIn 0.2s ease;
}
.ulc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ulc-header h4 {
  font-size: 0.86rem;
  color: var(--accent-cyan);
}
.ulc-content {
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Floating Mobile Quick-Switch Button (Map -> List) */
.m-floating-switch-btn {
  display: none;
  position: absolute;
  bottom: 24px;
  right: 14px;
  z-index: 800;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 24px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 10, 30, 0.55), 0 0 16px rgba(2, 132, 199, 0.45);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: revealFadeIn 0.3s ease;
}
.m-floating-switch-btn:hover,
.m-floating-switch-btn:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.6);
}
.m-floating-switch-btn #m-crit-badge-floating {
  background: var(--lv5);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* Floating Mobile Back-to-Map Button (List -> Map) */
.m-floating-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  bottom: 8px;
  margin: 6px 12px 6px;
  padding: 9px 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  border: 1.5px solid #38bdf8;
  box-shadow: 0 8px 24px rgba(0, 8, 24, 0.65), 0 0 14px rgba(2, 132, 199, 0.4);
  cursor: pointer;
  z-index: 90;
  transition: all 0.2s ease;
}
.m-floating-back-btn:hover,
.m-floating-back-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.6);
}

/* Timestamp, Source & Disclaimer Bar */
.map-bottom-info {
  position: absolute;
  bottom: 6px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text-dim);
  z-index: 700;
  pointer-events: none;
  flex-wrap: wrap;
}
.map-bottom-info span {
  pointer-events: auto;
}
.disclaimer-tag {
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.9;
}
.disclaimer-tag i {
  color: var(--accent-cyan);
}

.share-disclaimer-note,
.guide-disclaimer-note {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.74rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.28);
  border-left: 3px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}
.share-disclaimer-note i,
.guide-disclaimer-note i {
  color: var(--accent-cyan);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ==========================================================================
   SIDEBAR INSPECTION PANEL
   ========================================================================== */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.tab-btn {
  width: 100%;
  padding: 8px 2px 7px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-bottom: 2.5px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  overflow: visible;
  background: transparent;
}
.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}
.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent-cyan);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, rgba(56, 189, 248, 0.22) 100%);
  box-shadow: inset 0 -2px 0 var(--accent-cyan);
}

.tab-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-icon-wrap i {
  font-size: 1.15rem;
  display: block;
}

.tab-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 9px;
  min-width: 15px;
  line-height: 1.2;
  text-align: center;
  font-family: var(--font-mono);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.badge-crit {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.badge-rf {
  background: #0284c7;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.badge-pump {
  background: #059669;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.badge-news {
  background: #1877f2;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.tab-label {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.tab-pane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
.tab-pane.active {
  display: flex;
}

.pane-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}
.pane-title h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}
.pane-sub {
  font-size: 0.76rem;
  color: #cbd5e1;
  margin-top: 1px;
  line-height: 1.2;
}

/* Station, Dam, and Basin Lists */
.station-list, .dam-list, .basin-list, .forecast-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.station-card {
  background: rgba(8, 22, 46, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.28);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0, 5, 20, 0.5);
}
.station-card:hover {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(12, 30, 62, 0.98);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
}

.st-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.st-name {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.4;
  color: #ffffff;
}

.st-loc {
  font-size: 0.92rem;
  color: #e0f2fe;
  margin-top: 3px;
  font-weight: 500;
}

.st-tag {
  font-size: 0.88rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.tag-crit {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}
.tag-warn {
  background: #d97706;
  color: #ffffff;
  border: 1px solid #fcd34d;
}
.tag-normal {
  background: #059669;
  color: #ffffff;
  border: 1px solid #6ee7b7;
}
.tag-low {
  background: #0891b2;
  color: #ffffff;
  border: 1px solid #67e8f9;
}
.tag-rain {
  background: #db2777;
  color: #ffffff;
  border: 1px solid #f472b6;
}

.st-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(2, 12, 28, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
}

.st-stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-lbl {
  color: #bae6fd;
  font-size: 0.82rem;
  font-weight: 600;
}
.stat-val {
  font-weight: 800;
  color: #ffffff;
  font-size: 1.05rem;
}

.st-gauge-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}
.st-gauge-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Province Filter Banner & Status */
.province-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  color: #e0f2fe;
  font-size: 0.95rem;
}
.province-filter-banner .pf-text {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-clear-pf {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-clear-pf:hover {
  background: rgba(239, 68, 68, 0.5);
  color: #fff;
}
.province-status-alert.normal {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  color: #6ee7b7;
  font-size: 0.92rem;
}
.province-status-alert.normal i {
  font-size: 1.4rem;
  margin-top: 2px;
}

/* Road Flood Cards & Pin Styles (Aqua to Dark Navy Gradient) */
.roadflood-card {
  border-left: 4px solid var(--accent-cyan);
}
.roadflood-card:hover {
  border-left-color: #38bdf8;
  box-shadow: 0 8px 26px rgba(56, 189, 248, 0.28);
}
.rf-card-advice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.96rem;
  line-height: 1.5;
  color: #ffffff;
  background: rgba(0, 16, 40, 0.72);
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 8px;
  border: 1.5px solid rgba(56, 189, 248, 0.28);
}
.rf-alert-icon.crisis { color: #f87171; }
.rf-alert-icon.high { color: #fb923c; }
.rf-alert-icon.med { color: #38bdf8; }
.rf-alert-icon.low { color: #7dd3fc; }

.stat-rf-status.rf-status-crisis { color: #f87171; font-weight: 800; }
.stat-rf-status.rf-status-high { color: #fb923c; font-weight: 800; }
.stat-rf-status.rf-status-med { color: #38bdf8; font-weight: 700; }
.stat-rf-status.rf-status-low { color: #7dd3fc; font-weight: 600; }
.roadflood-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 8, 24, 0.7);
  cursor: pointer;
  transition: transform 0.2s;
}
.roadflood-pin:hover {
  transform: scale(1.12);
}
.roadflood-pin.sky-aqua {
  background: #0284c7;
  border: 1.5px solid #7dd3fc;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}
.roadflood-pin.ocean-blue {
  background: #1d4ed8;
  border: 1.5px solid #93c5fd;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.7);
}
.roadflood-pin.deep-navy {
  background: #1e3a8a;
  border: 1.5px solid #60a5fa;
  box-shadow: 0 0 14px rgba(30, 58, 138, 0.8);
}
.roadflood-pin.extreme-navy {
  background: #071329;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.95);
  animation: pulseAlarm 1.2s infinite;
}
.roadflood-popup .rf-advice-box {
  background: rgba(0, 20, 50, 0.7);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.94rem;
  line-height: 1.5;
  color: #ffffff;
}

/* Strategic Water Pumping Stations (BMA & RID) */
/* Strategic Water Pumping Stations (BMA & RID) */
.pumps-summary-card {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.65) 0%, rgba(15, 23, 42, 0.92) 100%);
  border: 1px solid rgba(16, 185, 129, 0.38);
  border-radius: 10px;
  padding: 6px 10px;
  margin: 6px 10px 4px;
  box-shadow: 0 4px 14px rgba(6, 78, 59, 0.25);
  flex-shrink: 0;
}
.psc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.psc-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.psc-label {
  font-size: 0.72rem;
  color: #a7f3d0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
.psc-label i {
  color: #34d399;
  font-size: 0.75rem;
}
.psc-val-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.psc-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.psc-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
}
.psc-unit {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
}
.psc-meter {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 3px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.psc-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 70%, #f59e0b 100%);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}
.psc-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #cbd5e1;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.psc-footer .status-indicator-ping {
  background: #10b981;
  width: 6px;
  height: 6px;
  flex-shrink: 0;
}
.psc-footer #psc-status-headline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   INTERACTIVE CHIPS CAROUSEL SLIDER & EXPAND/WRAP CONTROLS
   ========================================================================== */
.chips-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px !important;
  background: rgba(0, 0, 0, 0.22) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  flex-shrink: 0 !important;
  transition: all 0.25s ease;
  user-select: none;
}

.chips-carousel-wrapper .chip-track,
.roadflood-quick-chips,
.pump-quick-chips,
.news-filter-chips {
  flex: 1;
  min-width: 0;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  overflow-x: auto !important;
  white-space: nowrap !important;
  scroll-behavior: smooth !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  cursor: grab;
  padding: 2px 2px !important;
  border: none !important;
  background: transparent !important;
}
.chips-carousel-wrapper .chip-track::-webkit-scrollbar,
.roadflood-quick-chips::-webkit-scrollbar,
.pump-quick-chips::-webkit-scrollbar,
.news-filter-chips::-webkit-scrollbar {
  display: none !important;
}
.chips-carousel-wrapper .chip-track.is-dragging {
  cursor: grabbing !important;
  scroll-behavior: auto !important;
}

/* Nav Chevron Buttons (Slide Left / Slide Right) */
.chip-nav-btn {
  width: 24px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  padding: 0;
}
.chip-nav-btn:hover:not(.is-disabled) {
  background: rgba(2, 132, 199, 0.45);
  border-color: #38bdf8;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
.chip-nav-btn:active:not(.is-disabled) {
  transform: scale(0.95);
}
.chip-nav-btn.is-disabled {
  opacity: 0.18;
  cursor: default;
  pointer-events: none;
  border-color: transparent;
}

/* Expand / Wrap Multi-Row Toggle Button */
.chip-expand-toggle-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
  margin-left: 2px;
  padding: 0;
}
.chip-expand-toggle-btn:hover {
  background: rgba(2, 132, 199, 0.4);
  border-color: #38bdf8;
  color: var(--accent-cyan);
}
.chip-expand-toggle-btn.active {
  background: rgba(2, 132, 199, 0.6) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

/* Expanded Multi-Row State (คลี่ออกทั้งหมด) */
.chips-carousel-wrapper.is-expanded {
  align-items: flex-start;
  padding: 6px 8px !important;
}
.chips-carousel-wrapper.is-expanded .chip-track,
.chips-carousel-wrapper.is-expanded .roadflood-quick-chips,
.chips-carousel-wrapper.is-expanded .pump-quick-chips,
.chips-carousel-wrapper.is-expanded .news-filter-chips {
  flex-wrap: wrap !important;
  white-space: normal !important;
  overflow: visible !important;
  gap: 5px !important;
  cursor: default !important;
  height: auto !important;
}
.chips-carousel-wrapper.is-expanded .chip-nav-btn {
  display: none !important;
}

.roadflood-quick-chips .filter-chip,
.pump-quick-chips .filter-chip,
.news-filter-chips .filter-chip {
  padding: 3px 9px !important;
  height: 28px !important;
  border-radius: 14px !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  transition: all 0.2s ease !important;
}

.news-filter-chips .chip-fb {
  border-color: rgba(24, 119, 242, 0.5) !important;
  color: #38bdf8 !important;
}
.news-filter-chips .chip-fb.active {
  background: #1877f2 !important;
  color: #ffffff !important;
  border-color: #1877f2 !important;
}

/* Pump Station Cards */
.pump-card {
  border-left: 4px solid #10b981;
}
.pump-card:hover {
  border-left-color: #34d399;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}
.pump-card.is-tunnel {
  border-left: 4px solid #0284c7;
}
.pump-card.is-tunnel:hover {
  border-left-color: #38bdf8;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.3);
}

.pump-badge-tunnel {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}
.pump-badge-agency {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}
.pump-badge-rid {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.pump-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}
.pump-stat-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pump-stat-box-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pump-stat-box-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pump-stat-box-val .p-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.pump-meter-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pump-meter-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.pump-meter-bar.pbar-high {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}
.pump-meter-bar.pbar-med {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
}
.pump-meter-bar.pbar-low {
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
}

.pump-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #cbd5e1;
  margin-top: 4px;
  line-height: 1.4;
}
.pump-info-row i {
  color: #34d399;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.pump-info-row.destination i {
  color: #38bdf8;
}

/* Leaflet Map Pump Markers */
.pump-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #059669 0%, #064e3b 100%);
  border: 2px solid #34d399;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.7);
  color: #ffffff;
  font-size: 0.85rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.pump-pin:hover {
  transform: scale(1.18);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.95);
}
.pump-pin.tunnel {
  background: linear-gradient(135deg, #0284c7 0%, #0c4a6e 100%);
  border-color: #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.75);
}
.pump-pin.tunnel:hover {
  box-shadow: 0 0 22px rgba(56, 189, 248, 1);
}
.pump-pin-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: #047857;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 9px;
  padding: 1px 5px;
  border: 1px solid #6ee7b7;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
}
.pump-pin.tunnel .pump-pin-badge {
  background: #0369a1;
  border-color: #7dd3fc;
}

/* Live News & Social Media Feeds (Facebook & Media) */
.news-card {
  background: rgba(8, 22, 46, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.28);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0, 5, 20, 0.5);
}
.news-card:hover {
  border-color: rgba(56, 189, 248, 0.65);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
}
.news-card.fb-post-card {
  border-left: 5px solid var(--facebook-blue);
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.16) 0%, rgba(8, 22, 46, 0.96) 100%);
}
.news-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.news-source-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 800;
}
.news-source-tag.fb-badge {
  background: #1877f2;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(24, 119, 242, 0.4);
}
.news-source-tag.media-badge {
  background: rgba(56, 189, 248, 0.22);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.45);
}
.news-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #bae6fd;
}
.news-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.5;
  color: #ffffff;
}
.news-card-title-link:hover .news-card-title {
  color: #38bdf8;
}
.news-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(56, 189, 248, 0.15);
}
.news-cat-pill {
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
}
.news-read-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: #38bdf8;
  font-weight: 700;
  transition: all 0.2s;
}
.news-read-btn:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* Dam Card Specifics */
.dam-card {
  background: rgba(8, 22, 46, 0.94);
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(0, 5, 20, 0.45);
}
.dam-card:hover {
  border-color: var(--dam-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.35);
}
.dam-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 600;
}
.inflow-pill {
  color: #38bdf8;
  font-weight: 700;
}
.outflow-pill {
  color: #f87171;
  font-weight: 700;
}

/* Forecast Card Styles */
.forecast-card-daily {
  background: rgba(8, 22, 46, 0.94);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  box-shadow: 0 4px 16px rgba(0, 5, 20, 0.4);
}
.fc-date {
  font-weight: 700;
  font-size: 0.96rem;
  color: #ffffff;
}
.fc-rain-sum {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent-cyan);
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================================================
   MODALS (POPUP WINDOWS)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-container {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}
.modal-wide {
  max-width: 950px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.modal-title-group h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-title-group p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  transition: all 0.2s;
}
.btn-close-modal:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Pulse Tracker Diagrams */
.pulse-pipeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.pipeline-tributaries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
}
.trib-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.trib-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
}
.trib-val {
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 4px;
  color: var(--accent-cyan);
}
.pipeline-arrow {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pulse-station-hero {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px;
}
.hero-c2 { border-left: 5px solid #0284c7; }
.hero-c13 { border-left: 5px solid #f59e0b; }
.hero-c29 { border-left: 5px solid #10b981; }

.ps-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.badge-station {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}
.ps-data-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ps-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ps-metric .label {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.ps-metric .val {
  font-size: 1.05rem;
  font-weight: 700;
}
.badge-status {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  width: max-content;
}

/* Radar Selector & Preview */
.radar-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 14px;
}
.chip-radar {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  transition: all 0.2s;
}
.chip-radar:hover, .chip-radar.active {
  color: #fff;
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}
.radar-img-wrapper {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}
.radar-img-wrapper img {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
}
.radar-tip {
  margin-top: 10px;
  font-size: 0.76rem;
  color: var(--text-muted);
  text-align: center;
}

/* Hotline & Go-Bag Guide */
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.guide-col h4 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hotline-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hotline-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}
.hotline-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-cyan);
  transform: translateX(4px);
}
.hl-badge {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  min-width: 60px;
  text-align: center;
}
.hot-disaster .hl-badge { background: #b91c1c; }
.hot-water .hl-badge { background: #0284c7; }
.hot-medical .hl-badge { background: #16a34a; }
.hl-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hl-info strong {
  font-size: 0.85rem;
}
.hl-info span {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.checklist-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-surface-elevated);
  transition: background 0.15s;
}
.check-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.check-item input:checked + span {
  text-decoration: line-through;
  color: var(--text-dim);
}
.safety-rules {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.78rem;
  line-height: 1.5;
}
.safety-rules ol {
  padding-left: 20px;
  margin-top: 6px;
}

/* Share Modal & Scope Selector */
.modal-share-container {
  max-width: 620px;
}

.share-scope-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--bg-surface-elevated);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
}

.share-scope-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.share-scope-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.share-scope-tab.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.share-context-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-cyan);
}

.share-context-banner i {
  font-size: 0.95rem;
  flex-shrink: 0;
}

.share-textarea {
  width: 100%;
  border-radius: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.55;
  resize: vertical;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.share-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-line-accent {
  background: rgba(6, 199, 85, 0.16) !important;
  border: 1px solid rgba(6, 199, 85, 0.45) !important;
  color: #22c55e !important;
}
.btn-line-accent:hover {
  background: rgba(6, 199, 85, 0.28) !important;
  color: #4ade80 !important;
  transform: translateY(-1px);
}

.btn-fb-accent {
  background: rgba(24, 119, 242, 0.16) !important;
  border: 1px solid rgba(24, 119, 242, 0.45) !important;
  color: #60a5fa !important;
}
.btn-fb-accent:hover {
  background: rgba(24, 119, 242, 0.28) !important;
  color: #93c5fd !important;
  transform: translateY(-1px);
}

/* Quick Share inside Popups */
.btn-popup-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff !important;
  font-size: 0.86rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 10px;
}

.btn-popup-share:hover {
  opacity: 0.94;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
}

/* Floating Toast Notification */
.app-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: rgba(7, 19, 41, 0.92);
  border: 1.5px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 16px rgba(2, 132, 199, 0.4);
  color: #f8fafc;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  white-space: nowrap;
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   LEAFLET CUSTOM MAP POPUP & MARKER STYLES
   ========================================================================== */
.leaflet-popup-content-wrapper {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.45) !important;
  border-radius: 14px !important;
  box-shadow: 0 20px 45px rgba(0, 5, 20, 0.8) !important;
  padding: 0 !important;
  background: rgba(6, 18, 40, 0.96) !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}
.leaflet-popup-tip {
  background: rgba(6, 18, 40, 0.96) !important;
}

.map-popup-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 290px;
  max-width: 360px;
}
.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mp-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
}
.mp-sub {
  font-size: 0.92rem;
  color: #e0f2fe;
  font-weight: 500;
}
.mp-table {
  width: 100%;
  font-size: 0.92rem;
  border-collapse: collapse;
  margin-top: 6px;
}
.mp-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  color: #e2e8f0;
  font-weight: 500;
}
.mp-table td:last-child {
  text-align: right;
  font-weight: 800;
  font-size: 0.98rem;
  color: #ffffff;
  font-family: var(--font-mono);
}
.mp-footer {
  font-size: 0.82rem;
  color: #bae6fd;
  font-weight: 500;
  margin-top: 6px;
}

/* Pulsing Custom Marker Pin */
.marker-pin-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.marker-pin-custom:hover {
  transform: scale(1.3);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  z-index: 1000 !important;
}

.marker-rising-anim {
  animation: pulseAlarm 1.2s infinite;
}

/* Card active focus state */
.station-card.card-active {
  border-color: var(--accent-cyan) !important;
  background: rgba(56, 189, 248, 0.16) !important;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.45) !important;
  transform: translateX(4px);
}

/* Flood Plain Halo Pulse */
.station-flood-halo {
  animation: haloPulse 3s infinite ease-in-out;
}
@keyframes haloPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.75; }
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes pulseAlarm {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulseBeacon {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS & MOBILE SCREENS)
   ========================================================================== */
@media (max-width: 1360px) {
  .workspace-grid {
    grid-template-columns: 1fr 400px;
  }
  .tab-label {
    font-size: 0.78rem;
    letter-spacing: -0.3px;
  }
  .tab-icon-wrap i {
    font-size: 1.05rem;
  }
}

@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr 370px;
  }
  .tab-label {
    font-size: 0.74rem;
    letter-spacing: -0.4px;
  }
  .tab-btn {
    padding: 7px 1px 6px;
  }
}

@media (max-width: 900px) {
  .app-header {
    height: 48px;
    padding: 0 12px;
    gap: 8px;
  }

  .brand-logo {
    gap: 8px;
  }

  .logo-icon-wrapper {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .brand-titles h1 {
    font-size: 0.92rem;
  }

  .badge-by-papa {
    font-size: 0.62rem;
    padding: 1px 5px;
    gap: 3px;
  }

  .badge-by-papa i {
    font-size: 0.60rem;
  }

  .tagline {
    display: none;
  }

  /* Compact header buttons: icons only */
  .header-right {
    gap: 5px;
  }

  .btn-m-search-toggle {
    display: inline-flex !important;
  }

  .action-btn {
    height: 32px;
    padding: 0 7px;
    font-size: 0.78rem;
  }

  .action-btn .btn-text {
    display: none;
  }

  .btn-icon-glass {
    width: 32px;
    height: 32px;
  }

  .header-center {
    display: none;
  }

  /* Mobile Slide-down Search Bar */
  .mobile-search-bar {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 1200;
    padding: 8px 12px;
    background: rgba(6, 18, 40, 0.97);
    border-bottom: 1.5px solid var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fadeIn 0.2s ease;
  }
  .mobile-search-bar.hidden {
    display: none;
  }
  .mobile-search-box {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
  }
  .mobile-search-box input {
    width: 100%;
    height: 38px;
    padding: 0 68px 0 38px;
    border-radius: 10px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-glass);
    color: #ffffff;
    font-size: 0.88rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  .mobile-search-box input:focus {
    border-color: var(--accent-cyan);
    outline: none;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  }
  .mobile-search-box .search-icon {
    position: absolute;
    left: 12px;
    color: var(--accent-cyan);
    font-size: 0.95rem;
    pointer-events: none;
  }
  .mobile-search-box .btn-clear {
    position: absolute;
    right: 36px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px;
  }
  .btn-close-m-search {
    position: absolute;
    right: 6px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
  }
  .btn-close-m-search:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
  }
  #mobile-search-dropdown {
    position: absolute;
    top: 54px;
    left: 12px;
    right: 12px;
    max-height: 55vh;
    overflow-y: auto;
    border-radius: 12px;
    background: rgba(8, 22, 46, 0.98);
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
    z-index: 1250;
  }

  .main-container {
    padding: 4px 8px 6px;
    gap: 6px;
  }

  /* KPI Strip on Mobile: sleek horizontal swiper, exactly 56px height, zero vertical spill */
  .kpi-strip {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    height: 56px;
    min-height: 56px;
    gap: 8px;
    padding-bottom: 2px;
  }

  .kpi-strip::-webkit-scrollbar {
    height: 3px;
  }

  .kpi-strip::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 2px;
  }

  .kpi-card {
    flex: 0 0 165px;
    min-width: 155px;
    scroll-snap-align: start;
    padding: 6px 10px;
  }

  .kpi-label {
    font-size: 0.76rem;
    font-weight: 700;
  }

  .kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
  }

  .kpi-footer {
    font-size: 0.68rem;
    font-weight: 600;
  }

  /* Show the mobile segmented view switcher */
  .mobile-view-switcher {
    display: flex;
  }

  /* Single-column workspace locked to 100% of remaining height */
  .workspace-grid {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
  }

  /* In Map view (default): MAP 100%, SIDEBAR HIDDEN */
  .map-viewport {
    display: block !important;
    height: 100% !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  .sidebar-panel {
    display: none !important;
    height: 100% !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  /* When toggled to List view: MAP HIDDEN, SIDEBAR 100% */
  .workspace-grid.mobile-show-list .map-viewport {
    display: none !important;
  }

  .workspace-grid.mobile-show-list .sidebar-panel {
    display: flex !important;
  }

  /* Map HUD mobile adjustments */
  .map-control-bar {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 6px 8px;
    gap: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .map-control-bar::-webkit-scrollbar {
    display: none;
  }

  .map-bar-reveal-btn {
    top: 8px;
    left: 8px;
    padding: 6px 14px;
    font-size: 0.8rem;
  }
  .map-bar-bottom-tab {
    bottom: -19px;
    font-size: 0.7rem;
    padding: 1px 12px;
  }
  .btn-toggle-map-bar {
    padding: 4px 10px;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  .filter-group {
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 4px;
  }

  .filter-chip {
    padding: 4px 9px;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .basemap-selector {
    flex-shrink: 0;
  }

  .basemap-selector select {
    max-width: 155px;
    padding: 4px 8px;
    font-size: 0.78rem;
  }

  .layer-checkboxes {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .layer-toggle {
    background: rgba(12, 30, 62, 0.85);
    border: 1px solid var(--border-glass);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.76rem;
    white-space: nowrap;
    gap: 5px;
    color: #f8fafc;
  }

  .custom-chk {
    width: 14px;
    height: 14px;
  }

  .separator-v {
    display: inline-block;
    height: 16px;
    width: 1px;
    background: var(--border-glass);
    flex-shrink: 0;
  }

  .extra-tools {
    margin-left: 0;
    flex-shrink: 0;
    display: flex;
    gap: 4px;
  }

  .btn-tool {
    padding: 4px 8px;
    font-size: 0.76rem;
    white-space: nowrap;
  }

  .legend-pill-btn {
    bottom: 20px;
    left: 8px;
    padding: 7px 14px;
    font-size: 0.8rem;
  }

  .map-overlay-legend {
    bottom: 20px;
    left: 8px;
    width: 260px;
    max-width: calc(100vw - 16px);
    max-height: calc(100% - 80px);
    overflow-y: auto;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  /* Prevent Leaflet Zoom Controls from overlapping the Mobile Floating Button */
  .leaflet-bottom.leaflet-right {
    bottom: 82px !important;
    right: 12px !important;
  }
  .leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 16px !important;
  }

  .m-floating-switch-btn {
    display: inline-flex !important;
    bottom: 20px !important;
    right: 12px !important;
    padding: 9px 15px !important;
    font-size: 0.82rem !important;
    gap: 7px !important;
    box-shadow: 0 8px 24px rgba(0, 10, 30, 0.7), 0 0 16px rgba(2, 132, 199, 0.5) !important;
  }
  .workspace-grid.mobile-show-list .m-floating-switch-btn {
    display: none !important;
  }

  .m-floating-back-btn {
    display: inline-flex !important;
    bottom: 20px !important;
    right: 12px !important;
    padding: 9px 15px !important;
    font-size: 0.82rem !important;
    gap: 7px !important;
    box-shadow: 0 8px 24px rgba(0, 10, 30, 0.7), 0 0 16px rgba(2, 132, 199, 0.5) !important;
  }

  /* Compact Pane Headers & Filter Bars on Mobile */
  .pane-header {
    padding: 6px 10px;
    gap: 6px;
  }
  .pane-title h3 {
    font-size: 0.92rem;
  }
  .pane-sub {
    font-size: 0.72rem;
  }
  .pane-header .search-sm-wrap {
    min-width: 120px;
    max-width: 155px;
  }
  .pane-header .search-sm-wrap input {
    height: 26px;
    padding-left: 24px !important;
    font-size: 0.74rem;
  }
  .pane-header .search-sm-wrap i {
    left: 7px;
    font-size: 0.72rem;
  }
  .chips-carousel-wrapper {
    padding: 3px 5px !important;
    gap: 3px !important;
  }
  .chip-nav-btn {
    width: 22px !important;
    height: 26px !important;
    font-size: 0.7rem !important;
  }
  .chip-expand-toggle-btn {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.74rem !important;
  }
  .roadflood-quick-chips .filter-chip,
  .pump-quick-chips .filter-chip,
  .news-filter-chips .filter-chip {
    padding: 2px 7px !important;
    height: 25px !important;
    font-size: 0.72rem !important;
    border-radius: 13px !important;
  }
  .pumps-summary-card {
    padding: 5px 8px;
    margin: 4px 6px 3px;
    border-radius: 8px;
  }
  .psc-val {
    font-size: 1.05rem;
  }
  .psc-footer {
    font-size: 0.68rem;
  }

  /* Sidebar Tabs on Mobile: Horizontally Scrollable Bar with Smooth Momentum */
  .sidebar-tabs {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 4px 0;
    gap: 3px;
    background: rgba(0, 0, 0, 0.35);
  }
  .sidebar-tabs::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex: 0 0 auto !important;
    min-width: 68px !important;
    padding: 8px 10px 7px !important;
    scroll-snap-align: start;
    border-radius: 8px 8px 0 0;
  }
  .tab-label {
    font-size: 0.76rem !important;
    letter-spacing: normal !important;
    white-space: nowrap !important;
  }
  .tab-icon-wrap i {
    font-size: 1.12rem !important;
  }
  .tab-badge {
    top: -5px !important;
    right: -8px !important;
    font-size: 0.65rem !important;
  }

  /* Modals on Mobile Screens */
  .modal-overlay {
    padding: 8px 6px !important;
  }
  .modal-container {
    max-height: 94vh !important;
    max-height: 94dvh !important;
    border-radius: 14px !important;
  }
  .modal-header {
    padding: 12px 14px !important;
  }
  .modal-body {
    padding: 12px 14px !important;
  }
  .share-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }
  .share-actions .action-btn {
    width: 100% !important;
    justify-content: center !important;
    height: 38px !important;
    font-size: 0.88rem !important;
  }

  /* Map Popups and User Location on Mobile */
  .map-popup-card {
    max-width: calc(100vw - 36px) !important;
    min-width: min(280px, calc(100vw - 44px)) !important;
    padding: 12px 14px !important;
  }
  .user-location-card {
    width: calc(100vw - 24px) !important;
    left: 12px !important;
    right: 12px !important;
    top: 56px !important;
  }

  .map-bottom-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    bottom: 2px;
    left: 8px;
    right: 8px;
    font-size: 0.65rem;
  }

  .disclaimer-tag {
    font-size: 0.65rem;
  }

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

  .pipeline-tributaries {
    grid-template-columns: repeat(2, 1fr);
  }

  .ps-data-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .brand-titles h1 {
    font-size: 0.88rem;
  }
  .badge-by-papa {
    font-size: 0.58rem;
    padding: 1px 4px;
    gap: 3px;
  }
  .badge-by-papa i {
    font-size: 0.54rem;
  }
  .kpi-card {
    flex: 0 0 142px;
    min-width: 140px;
  }
  .tab-label {
    font-size: 0.72rem;
    letter-spacing: -0.4px;
  }
  .tab-btn {
    padding: 6px 1px 5px;
  }
}

/* ==========================================================================
   LIGHT THEME OVERRIDES (HIGH CONTRAST & LEGIBILITY)
   Ensures all text, cards, icons, inputs, and popups are crisp and dark
   ========================================================================== */

/* 1. Base App & Header */
[data-theme="light"] body {
  background-color: var(--bg-app);
  color: var(--text-main);
}
[data-theme="light"] .glass-panel {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 10px 30px rgba(0, 40, 90, 0.1);
}
[data-theme="light"] .brand-titles h1 {
  color: #0f172a !important;
}
[data-theme="light"] .brand-name {
  color: #0f172a !important;
}
[data-theme="light"] .brand-accent {
  color: #0284c7 !important;
}
[data-theme="light"] .logo-icon-wrapper {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
  border-color: rgba(2, 132, 199, 0.45) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25), inset 0 0 10px rgba(2, 132, 199, 0.15) !important;
}
[data-theme="light"] .brand-titles .tagline {
  color: #0369a1 !important;
}
[data-theme="light"] .badge-by-papa {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12), rgba(124, 58, 237, 0.15));
  border: 1px solid rgba(124, 58, 237, 0.35);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  color: #4338ca;
  font-weight: 750;
  text-decoration: none;
}
[data-theme="light"] .badge-by-papa:hover {
  color: #312e81;
  border-color: rgba(124, 58, 237, 0.65);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.22);
}
[data-theme="light"] .badge-by-papa i {
  color: #7c3aed;
  filter: drop-shadow(0 0 2px rgba(124, 58, 237, 0.4));
}
[data-theme="light"] .header-pill {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.22);
  color: #0369a1;
}
[data-theme="light"] .btn-icon-glass {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0f172a;
}
[data-theme="light"] .btn-icon-glass:hover {
  background: rgba(2, 132, 199, 0.16);
  color: #0284c7;
}
[data-theme="light"] .action-btn {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0f172a;
}
[data-theme="light"] .action-btn:hover {
  background: rgba(2, 132, 199, 0.16);
}
[data-theme="light"] .search-box input {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.3);
  color: #0f172a;
}
[data-theme="light"] .search-box input::placeholder {
  color: #64748b;
}
[data-theme="light"] .search-icon {
  color: #0284c7;
}
[data-theme="light"] .search-dropdown {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.3);
  box-shadow: 0 14px 35px rgba(2, 132, 199, 0.18);
}
[data-theme="light"] .search-item:hover {
  background: #f1f5f9;
}
[data-theme="light"] .search-item-title {
  color: #0f172a;
}
[data-theme="light"] .search-item-sub {
  color: #475569;
}

/* 2. KPI Strip & Metric Cards */
[data-theme="light"] .kpi-card {
  background: #ffffff !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
}
[data-theme="light"] .kpi-card:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.22) !important;
}
[data-theme="light"] .kpi-label {
  color: #0f172a !important;
  font-weight: 800;
}
[data-theme="light"] .kpi-value {
  color: #0f172a !important;
}
[data-theme="light"] .kpi-unit {
  color: #0284c7 !important;
  font-weight: 800;
}
[data-theme="light"] .kpi-sub {
  color: #334155 !important;
  font-weight: 700;
}
[data-theme="light"] .kpi-footer {
  color: #1e293b !important;
  font-weight: 700;
}
[data-theme="light"] .kpi-footer.text-danger {
  color: #dc2626 !important;
}
[data-theme="light"] .kpi-footer.text-warning {
  color: #d97706 !important;
}
[data-theme="light"] .kpi-badge {
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: #0369a1 !important;
  font-weight: 700;
}
[data-theme="light"] .fti-meter {
  background: rgba(0, 0, 0, 0.08);
}

/* 3. Map Control Bar */
[data-theme="light"] .map-control-bar {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 8px 24px rgba(0, 40, 90, 0.1);
}
[data-theme="light"] .filter-title {
  color: #0f172a !important;
  font-weight: 800;
}
[data-theme="light"] .filter-chip {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
  color: #1e293b;
  font-weight: 700;
}
[data-theme="light"] .filter-chip:hover {
  background: rgba(2, 132, 199, 0.18);
  color: #0284c7;
}
[data-theme="light"] .filter-chip.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}
[data-theme="light"] .layer-toggle {
  color: #0f172a !important;
  font-weight: 700;
}
[data-theme="light"] .layer-toggle span {
  color: #0f172a !important;
}
[data-theme="light"] .custom-chk {
  background: #ffffff;
  border-color: #94a3b8;
}
[data-theme="light"] .select-styled {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(2, 132, 199, 0.35);
}
[data-theme="light"] .btn-tool {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.25);
  color: #0f172a;
  font-weight: 700;
}
[data-theme="light"] .btn-tool:hover {
  background: rgba(2, 132, 199, 0.18);
  color: #0284c7;
}
[data-theme="light"] .btn-toggle-map-bar {
  background: rgba(2, 132, 199, 0.1);
  color: #0369a1 !important;
  border-color: rgba(2, 132, 199, 0.3);
}
[data-theme="light"] .btn-toggle-map-bar:hover {
  background: rgba(2, 132, 199, 0.2);
  color: #0c4a6e !important;
  border-color: #0284c7;
}
[data-theme="light"] .map-bar-bottom-tab {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.25);
  color: #475569 !important;
  box-shadow: 0 4px 12px rgba(0, 40, 90, 0.1);
}
[data-theme="light"] .map-bar-bottom-tab:hover {
  background: #ffffff;
  color: #0284c7 !important;
  border-color: #0284c7;
}
[data-theme="light"] .map-bar-reveal-btn {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a !important;
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 8px 24px rgba(0, 40, 90, 0.15);
}
[data-theme="light"] .map-bar-reveal-btn:hover {
  background: #ffffff;
  border-color: #0284c7;
  color: #0284c7 !important;
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.25);
}
[data-theme="light"] .map-bar-reveal-btn i.fa-sliders {
  color: #0284c7;
}

/* 4. Sidebar Tabs & Navigation */
[data-theme="light"] .side-panel {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 10px 30px rgba(0, 40, 90, 0.1);
}
[data-theme="light"] .sidebar-tabs {
  border-bottom-color: rgba(2, 132, 199, 0.18);
}
[data-theme="light"] .tab-btn {
  color: #475569;
}
[data-theme="light"] .tab-btn:hover {
  color: #0f172a;
  background: rgba(2, 132, 199, 0.08);
}
[data-theme="light"] .tab-btn.active {
  color: #0284c7 !important;
  border-bottom-color: #0284c7;
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.05) 0%, rgba(2, 132, 199, 0.15) 100%);
}
[data-theme="light"] .pane-header {
  border-bottom-color: rgba(2, 132, 199, 0.16);
}
[data-theme="light"] .pane-title h3 {
  color: #0f172a !important;
}
[data-theme="light"] .pane-sub {
  color: #334155 !important;
  font-weight: 600;
}
[data-theme="light"] .filter-dropdown-wrap select {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(2, 132, 199, 0.4) !important;
}
[data-theme="light"] .filter-dropdown-wrap select:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.25) !important;
}
[data-theme="light"] .search-sm-wrap input {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(2, 132, 199, 0.4) !important;
}
[data-theme="light"] .search-sm-wrap input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.25) !important;
  background: #ffffff !important;
}
[data-theme="light"] .search-sm-wrap input::placeholder {
  color: #64748b !important;
}
[data-theme="light"] .search-sm-wrap i {
  color: #0284c7 !important;
}

/* 5. Cards (Stations, Road Floods, News, Dams, Forecast) */
[data-theme="light"] .station-card {
  background: #ffffff !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08) !important;
}
[data-theme="light"] .station-card:hover {
  background: #f8fafc !important;
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.18) !important;
}
[data-theme="light"] .station-card.card-active {
  border-color: #0284c7 !important;
  background: #f0f9ff !important;
  box-shadow: 0 0 0 2px #0284c7, 0 8px 24px rgba(2, 132, 199, 0.2) !important;
}
[data-theme="light"] .st-name {
  color: #0f172a !important;
}
[data-theme="light"] .st-loc {
  color: #334155 !important;
  font-weight: 600;
}
[data-theme="light"] .st-stats-grid {
  background: #f1f5f9 !important;
  border: 1px solid rgba(2, 132, 199, 0.18) !important;
}
[data-theme="light"] .stat-lbl {
  color: #475569 !important;
  font-weight: 700;
}
[data-theme="light"] .stat-val {
  color: #0f172a !important;
  font-weight: 800;
}
[data-theme="light"] .st-gauge-bar {
  background: rgba(0, 0, 0, 0.08);
}

/* Compact Quick Chips & Carousel Slider in Light Theme */
[data-theme="light"] .chips-carousel-wrapper {
  background: rgba(2, 132, 199, 0.06) !important;
  border-bottom: 1px solid rgba(2, 132, 199, 0.16) !important;
}
[data-theme="light"] .chip-nav-btn {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
  color: #0284c7 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15) !important;
}
[data-theme="light"] .chip-nav-btn:hover:not(.is-disabled) {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
[data-theme="light"] .chip-expand-toggle-btn {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
  color: #64748b !important;
}
[data-theme="light"] .chip-expand-toggle-btn:hover {
  background: #e0f2fe !important;
  color: #0284c7 !important;
}
[data-theme="light"] .chip-expand-toggle-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
[data-theme="light"] .roadflood-quick-chips .filter-chip,
[data-theme="light"] .pump-quick-chips .filter-chip,
[data-theme="light"] .news-filter-chips .filter-chip {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.28);
  color: #1e293b;
}
[data-theme="light"] .roadflood-quick-chips .filter-chip:hover,
[data-theme="light"] .pump-quick-chips .filter-chip:hover,
[data-theme="light"] .news-filter-chips .filter-chip:hover {
  background: rgba(2, 132, 199, 0.14);
  color: #0284c7;
}
[data-theme="light"] .roadflood-quick-chips .filter-chip.active,
[data-theme="light"] .pump-quick-chips .filter-chip.active,
[data-theme="light"] .news-filter-chips .filter-chip.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
[data-theme="light"] .rf-card-advice {
  background: #e0f2fe !important;
  border: 1.5px solid rgba(2, 132, 199, 0.35) !important;
  color: #0f172a !important;
}
[data-theme="light"] .rf-card-advice span,
[data-theme="light"] .rf-advice-text {
  color: #0f172a !important;
}
[data-theme="light"] .rf-alert-icon.high { color: #dc2626 !important; }
[data-theme="light"] .rf-alert-icon.med { color: #0284c7 !important; }
[data-theme="light"] .rf-alert-icon.low { color: #0369a1 !important; }

[data-theme="light"] .stat-rf-status.rf-status-high { color: #dc2626 !important; }
[data-theme="light"] .stat-rf-status.rf-status-med { color: #0284c7 !important; }
[data-theme="light"] .stat-rf-status.rf-status-low { color: #0369a1 !important; }

/* Pump Stations in Light Theme */
[data-theme="light"] .pumps-summary-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%) !important;
  border: 1.5px solid rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12) !important;
}
[data-theme="light"] .psc-label {
  color: #047857 !important;
}
[data-theme="light"] .psc-val {
  color: #064e3b !important;
}
[data-theme="light"] .psc-sub,
[data-theme="light"] .psc-unit {
  color: #475569 !important;
}
[data-theme="light"] .psc-meter {
  background: #e2e8f0 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}
[data-theme="light"] .psc-footer {
  color: #334155 !important;
}
[data-theme="light"] .pump-card {
  background: #ffffff !important;
  border: 1.5px solid rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08) !important;
}
[data-theme="light"] .pump-stat-box {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
[data-theme="light"] .pump-stat-box-val {
  color: #0f172a !important;
}
[data-theme="light"] .pump-badge-agency {
  background: #d1fae5 !important;
  color: #065f46 !important;
  border-color: #a7f3d0 !important;
}
[data-theme="light"] .pump-meter-track {
  background: #e2e8f0 !important;
}
[data-theme="light"] .pump-info-row {
  color: #475569 !important;
}

/* News Cards */
[data-theme="light"] .news-card {
  background: #ffffff !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08) !important;
}
[data-theme="light"] .news-card:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.18) !important;
}
[data-theme="light"] .news-card.fb-post-card {
  background: linear-gradient(135deg, rgba(24, 119, 242, 0.08) 0%, #ffffff 100%) !important;
  border-left-color: #1877f2 !important;
}
[data-theme="light"] .news-card-title {
  color: #0f172a !important;
}
[data-theme="light"] .news-card-title-link:hover .news-card-title {
  color: #0284c7 !important;
}
[data-theme="light"] .news-time {
  color: #0369a1 !important;
  font-weight: 700;
}
[data-theme="light"] .news-cat-pill {
  color: #475569 !important;
  font-weight: 700;
}
[data-theme="light"] .news-read-btn {
  color: #0284c7 !important;
  font-weight: 800;
}
[data-theme="light"] .news-read-btn:hover {
  color: #0369a1 !important;
}
[data-theme="light"] .news-source-tag.media-badge {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
  border-color: rgba(2, 132, 199, 0.35);
}

/* Dams */
[data-theme="light"] .dam-card {
  background: #ffffff !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08) !important;
}
[data-theme="light"] .inflow-pill {
  color: #0284c7 !important;
  font-weight: 800;
}
[data-theme="light"] .outflow-pill {
  color: #dc2626 !important;
  font-weight: 800;
}

/* Forecast */
[data-theme="light"] .forecast-card-daily {
  background: #ffffff !important;
  border: 1.5px solid rgba(2, 132, 199, 0.25) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08) !important;
}
[data-theme="light"] .fc-date {
  color: #0f172a !important;
  font-weight: 800;
}
[data-theme="light"] .fc-rain-sum {
  color: #0284c7 !important;
}

/* Province Filter Banner & Alerts */
[data-theme="light"] .province-filter-banner {
  background: #e0f2fe;
  border-color: rgba(2, 132, 199, 0.4);
  color: #0369a1;
}
[data-theme="light"] .province-filter-banner strong {
  color: #0c4a6e;
}
[data-theme="light"] .province-status-alert.normal {
  background: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}
[data-theme="light"] .province-status-alert.normal strong {
  color: #065f46;
}
[data-theme="light"] .province-status-alert.normal p {
  color: #047857;
}

/* 6. Map Popups */
[data-theme="light"] .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1.5px solid rgba(2, 132, 199, 0.35) !important;
  box-shadow: 0 12px 32px rgba(2, 132, 199, 0.2) !important;
}
[data-theme="light"] .leaflet-popup-tip {
  background: #ffffff !important;
}
[data-theme="light"] .mp-title {
  color: #0f172a !important;
}
[data-theme="light"] .mp-sub {
  color: #475569 !important;
  font-weight: 600;
}
[data-theme="light"] .mp-table td {
  color: #334155 !important;
  border-bottom: 1px solid rgba(2, 132, 199, 0.15) !important;
}
[data-theme="light"] .mp-table td:last-child {
  color: #0f172a !important;
}
[data-theme="light"] .mp-footer {
  color: #0369a1 !important;
}
[data-theme="light"] .roadflood-popup .rf-advice-box {
  background: #e0f2fe !important;
  color: #0f172a !important;
}
[data-theme="light"] .roadflood-popup .rf-advice-box strong {
  color: #0f172a !important;
}

/* 7. Floating Legend & GPS Tool Card */
[data-theme="light"] .map-legend {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.3);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.15);
}
[data-theme="light"] .legend-header strong {
  color: #0f172a !important;
}
[data-theme="light"] .legend-row {
  color: #334155 !important;
  font-weight: 700;
}
[data-theme="light"] .legend-divider {
  background: rgba(2, 132, 199, 0.2);
}
[data-theme="light"] .user-location-card {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.3);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.15);
}
[data-theme="light"] .ulc-header h4 {
  color: #0284c7;
}
[data-theme="light"] .ulc-content {
  color: #1e293b;
}

/* 8. Modals (Pulse Tracker, Hotline, Emergency Guide, Share) */
[data-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.55);
}
[data-theme="light"] .modal-container {
  background: #ffffff !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
  box-shadow: 0 25px 60px rgba(2, 132, 199, 0.25) !important;
  color: #0f172a;
}
[data-theme="light"] .modal-header {
  border-bottom-color: rgba(2, 132, 199, 0.18);
}
[data-theme="light"] .modal-title-group h3 {
  color: #0f172a !important;
}
[data-theme="light"] .modal-title-group p {
  color: #475569 !important;
}
[data-theme="light"] .btn-close-modal {
  background: #f1f5f9;
  color: #334155;
}
[data-theme="light"] .btn-close-modal:hover {
  background: #e2e8f0;
  color: #0f172a;
}
[data-theme="light"] .modal-body {
  color: #1e293b;
}
[data-theme="light"] .modal-footer {
  background: #f8fafc;
  border-top-color: rgba(2, 132, 199, 0.18);
}
[data-theme="light"] .trib-card {
  background: #f1f5f9;
  border-color: rgba(2, 132, 199, 0.2);
}
[data-theme="light"] .trib-name {
  color: #475569;
}
[data-theme="light"] .trib-val {
  color: #0284c7;
}
[data-theme="light"] .pulse-station-hero {
  background: #f8fafc;
  border-color: rgba(2, 132, 199, 0.25);
}
[data-theme="light"] .ps-metric .label {
  color: #475569;
}
[data-theme="light"] .ps-metric .val {
  color: #0f172a;
}
[data-theme="light"] .hotline-card {
  background: #f8fafc;
  border-color: rgba(2, 132, 199, 0.25);
}
[data-theme="light"] .hotline-card:hover {
  background: #f1f5f9;
}
[data-theme="light"] .hl-info strong {
  color: #0f172a;
}
[data-theme="light"] .hl-info span {
  color: #475569;
}
[data-theme="light"] .check-item {
  background: #f8fafc;
  color: #0f172a;
}
[data-theme="light"] .check-item:hover {
  background: #f1f5f9;
}
[data-theme="light"] .share-textarea {
  background: #f8fafc;
  color: #0f172a;
  border-color: rgba(2, 132, 199, 0.3);
}
[data-theme="light"] .share-scope-nav {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
[data-theme="light"] .share-scope-tab {
  color: #475569;
}
[data-theme="light"] .share-scope-tab:hover {
  color: #0f172a;
  background: #e2e8f0;
}
[data-theme="light"] .share-scope-tab.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
}
[data-theme="light"] .share-context-banner {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.28);
  color: #0369a1;
}
[data-theme="light"] .btn-line-accent {
  background: rgba(6, 199, 85, 0.12) !important;
  border-color: rgba(6, 199, 85, 0.35) !important;
  color: #15803d !important;
}
[data-theme="light"] .btn-fb-accent {
  background: rgba(24, 119, 242, 0.12) !important;
  border-color: rgba(24, 119, 242, 0.35) !important;
  color: #1d4ed8 !important;
}
[data-theme="light"] .app-toast {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(2, 132, 199, 0.35);
  color: #0f172a;
  box-shadow: 0 10px 30px rgba(0, 40, 90, 0.2);
}

[data-theme="light"] .chip-radar {
  background: #f1f5f9;
  border-color: rgba(2, 132, 199, 0.25);
  color: #334155;
}
[data-theme="light"] .chip-radar:hover,
[data-theme="light"] .chip-radar.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}
[data-theme="light"] .radar-tip {
  color: #475569;
}
[data-theme="light"] .checklist-sub {
  color: #475569;
}
[data-theme="light"] .safety-rules {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
[data-theme="light"] .pipeline-arrow {
  color: #0369a1;
}

/* 9. Mobile Segmented Switcher & Controls */
[data-theme="light"] .mobile-view-switcher {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(2, 132, 199, 0.25);
}
[data-theme="light"] .m-switch-btn {
  color: #475569;
}
[data-theme="light"] .m-switch-btn.active {
  background: #0284c7;
  color: #ffffff;
}
[data-theme="light"] .m-switch-btn:not(.active):hover {
  color: #0f172a;
  background: rgba(2, 132, 199, 0.08);
}
@media (max-width: 900px) {
  [data-theme="light"] .layer-toggle {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(2, 132, 199, 0.3);
    color: #0f172a;
  }
}

/* 10. Road Flood Depth Tiers & Legend (Light Mode) */
[data-theme="light"] .rf-alert-icon.crisis { color: #dc2626 !important; }
[data-theme="light"] .rf-alert-icon.high { color: #ea580c !important; }
[data-theme="light"] .rf-alert-icon.med { color: #0284c7 !important; }
[data-theme="light"] .rf-alert-icon.low { color: #0284c7 !important; }

[data-theme="light"] .stat-rf-status.rf-status-crisis { color: #dc2626 !important; font-weight: 800; }
[data-theme="light"] .stat-rf-status.rf-status-high { color: #ea580c !important; font-weight: 800; }
[data-theme="light"] .stat-rf-status.rf-status-med { color: #0284c7 !important; font-weight: 700; }
[data-theme="light"] .stat-rf-status.rf-status-low { color: #0284c7 !important; font-weight: 700; }

[data-theme="light"] .line-rf-low { background: #38bdf8; }
[data-theme="light"] .line-rf-med { background: #0284c7; }
[data-theme="light"] .line-rf-high { background: #1e40af; }
[data-theme="light"] .line-rf-crisis { background: #071329; border: 1.5px solid #0284c7; }

/* 11. Collapsible Legend, Disclaimer & Mobile Floating Buttons (Light Mode) */
[data-theme="light"] .legend-pill-btn {
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
}
[data-theme="light"] .legend-pill-btn i {
  color: #0284c7;
}
[data-theme="light"] .legend-title-group {
  color: #0f172a;
}
[data-theme="light"] .legend-title-group i {
  color: #0284c7;
}
[data-theme="light"] .legend-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .legend-header strong {
  color: #0f172a;
}
[data-theme="light"] .btn-collapse-legend {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1.5px solid rgba(2, 132, 199, 0.4);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}
[data-theme="light"] .btn-collapse-legend:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
[data-theme="light"] .btn-collapse-bottom {
  background: rgba(2, 132, 199, 0.07);
  color: #0284c7;
  border: 1px dashed rgba(2, 132, 199, 0.35);
}
[data-theme="light"] .btn-collapse-bottom:hover {
  background: #0284c7;
  color: #ffffff;
  border-style: solid;
}
[data-theme="light"] .legend-disclaimer {
  color: #475569;
}
[data-theme="light"] .legend-disclaimer i {
  color: #0284c7;
}
[data-theme="light"] .disclaimer-tag {
  color: #475569;
}
[data-theme="light"] .disclaimer-tag i {
  color: #0284c7;
}
[data-theme="light"] .share-disclaimer-note,
[data-theme="light"] .guide-disclaimer-note {
  background: rgba(241, 245, 249, 0.95);
  color: #334155;
  border-left-color: #0284c7;
}
[data-theme="light"] .share-disclaimer-note i,
[data-theme="light"] .guide-disclaimer-note i {
  color: #0284c7;
}
[data-theme="light"] .m-floating-switch-btn {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}
[data-theme="light"] .m-floating-back-btn {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

[data-theme="light"] .mobile-search-bar {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: #0284c7;
  box-shadow: 0 10px 30px rgba(0, 40, 90, 0.15);
}
[data-theme="light"] .mobile-search-box input {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(2, 132, 199, 0.3);
}
[data-theme="light"] .btn-close-m-search {
  background: rgba(2, 132, 199, 0.08);
  color: #0369a1;
  border-color: rgba(2, 132, 199, 0.25);
}
[data-theme="light"] #mobile-search-dropdown {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.35);
  box-shadow: 0 14px 35px rgba(2, 132, 199, 0.18);
}

/* ==========================================================================
   PHYSICAL OBJECT BENCHMARK & CITIZEN ACTION GUIDE (เกณฑ์วัตถุจริง & แผนรับมือ)
   ========================================================================== */

/* 1. Object Benchmark Pill in Road & Station Cards */
.rf-benchmark-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 9px;
  margin: 7px 0 6px;
  font-size: 0.83rem;
  font-weight: 700;
  line-height: 1.35;
  transition: all 0.2s ease;
}
.rf-benchmark-badge strong {
  font-weight: 800;
}
.rf-benchmark-badge.low {
  background: rgba(6, 182, 212, 0.22);
  border: 1.5px solid #22d3ee;
  color: #cffafe;
}
.rf-benchmark-badge.med {
  background: rgba(2, 132, 199, 0.25);
  border: 1.5px solid #38bdf8;
  color: #e0f2fe;
}
.rf-benchmark-badge.high {
  background: rgba(234, 88, 12, 0.28);
  border: 1.5px solid #fb923c;
  color: #ffedd5;
}
.rf-benchmark-badge.crisis {
  background: rgba(220, 38, 38, 0.35);
  border: 1.5px solid #f87171;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}
.rf-benchmark-badge.catastrophic {
  background: rgba(185, 28, 28, 0.45);
  border: 1.5px solid #ef4444;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

.rf-bench-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 0.88rem;
  flex-shrink: 0;
}

/* 2. Citizen Action Guide Box inside Card */
.rf-citizen-guide {
  background: rgba(3, 15, 38, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rf-guide-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
@media (max-width: 480px) {
  .rf-guide-row {
    grid-template-columns: 1fr;
  }
}

.rf-guide-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(56, 189, 248, 0.4);
  font-size: 0.76rem;
  line-height: 1.35;
}
.rf-guide-item.urgent {
  background: rgba(239, 68, 68, 0.14);
  border-left-color: #ef4444;
}
.rf-guide-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 4px;
}
.rf-guide-item.urgent .rf-guide-lbl {
  color: #f87171;
}
.rf-guide-val {
  color: #e2e8f0;
  font-weight: 500;
}
.rf-guide-item.urgent .rf-guide-val {
  color: #fef2f2;
  font-weight: 600;
}

.rf-electric-notice {
  border-left-color: #eab308;
  background: rgba(234, 179, 8, 0.1);
}
.rf-electric-notice .rf-guide-lbl {
  color: #fde047;
}

/* 3. River Station Overflow Benchmark Alert */
.st-overflow-alert {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  font-size: 0.78rem;
  line-height: 1.35;
}
.st-overflow-alert strong {
  color: #fca5a5;
}
.st-overflow-details {
  margin-top: 3px;
  font-size: 0.74rem;
  color: #fee2e2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st-safe-alert {
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 0.75rem;
  color: #86efac;
  display: flex;
  align-items: center;
  gap: 6px;
}
.st-warn-alert {
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.3);
  font-size: 0.75rem;
  color: #fde047;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 4. Height Guide Modal Design */
.height-guide-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hg-tier-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  border: 1.5px solid var(--border-subtle);
  transition: all 0.25s ease;
}
@media (max-width: 640px) {
  .hg-tier-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.hg-tier-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.hg-scale-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}
.hg-scale-icon {
  font-size: 1.8rem;
  margin-bottom: 4px;
}
.hg-scale-depth {
  font-size: 1.12rem;
  font-weight: 800;
  font-family: var(--font-mono);
}
.hg-scale-name {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 2px;
}

.hg-actions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}
.hg-action-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.83rem;
  line-height: 1.35;
}
.hg-action-row i {
  font-size: 0.95rem;
  margin-top: 2px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Light Theme Overrides */
[data-theme="light"] .rf-benchmark-badge.low {
  background: #ecfeff !important;
  border: 1.5px solid #06b6d4 !important;
  color: #0e7490 !important;
  font-weight: 700 !important;
}
[data-theme="light"] .rf-benchmark-badge.med {
  background: #f0f9ff !important;
  border: 1.5px solid #0284c7 !important;
  color: #0369a1 !important;
  font-weight: 700 !important;
}
[data-theme="light"] .rf-benchmark-badge.high {
  background: #fff7ed !important;
  border: 1.5px solid #ea580c !important;
  color: #9a3412 !important;
  font-weight: 700 !important;
}
[data-theme="light"] .rf-benchmark-badge.crisis {
  background: #fff1f2 !important;
  border: 1.5px solid #e11d48 !important;
  color: #9f1239 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.12) !important;
}
[data-theme="light"] .rf-benchmark-badge.catastrophic {
  background: #fee2e2 !important;
  border: 2px solid #dc2626 !important;
  color: #7f1d1d !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.15) !important;
}
[data-theme="light"] .rf-bench-icon {
  background: rgba(0, 0, 0, 0.08) !important;
  color: inherit !important;
}
[data-theme="light"] .rf-benchmark-badge strong {
  color: inherit !important;
  font-weight: 800 !important;
}
[data-theme="light"] .rf-citizen-guide {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 2px 8px rgba(0, 40, 80, 0.06);
}
[data-theme="light"] .rf-guide-item {
  background: #f8fafc;
  border-left-color: #0284c7;
}
[data-theme="light"] .rf-guide-item.urgent {
  background: #fef2f2;
  border-left-color: #dc2626;
}
[data-theme="light"] .rf-guide-lbl {
  color: #0284c7;
}
[data-theme="light"] .rf-guide-item.urgent .rf-guide-lbl {
  color: #dc2626;
}
[data-theme="light"] .rf-guide-val {
  color: #1e293b;
}
[data-theme="light"] .rf-guide-item.urgent .rf-guide-val {
  color: #991b1b;
}
[data-theme="light"] .rf-electric-notice {
  background: #fefce8 !important;
  border-left-color: #ca8a04 !important;
}
[data-theme="light"] .rf-electric-notice .rf-guide-lbl {
  color: #a16207 !important;
}
[data-theme="light"] .rf-electric-notice .rf-guide-val {
  color: #713f12 !important;
}
[data-theme="light"] .st-overflow-alert {
  background: #fee2e2 !important;
  border: 1.5px solid #f87171 !important;
  color: #7f1d1d !important;
}
[data-theme="light"] .st-overflow-alert strong {
  color: #991b1b !important;
}
[data-theme="light"] .st-overflow-details {
  color: #7f1d1d !important;
}
[data-theme="light"] .st-safe-alert {
  background: #f0fdf4 !important;
  border: 1px solid #86efac !important;
  color: #166534 !important;
}
[data-theme="light"] .st-warn-alert {
  background: #fefce8 !important;
  border: 1px solid #fde047 !important;
  color: #854d0e !important;
}
[data-theme="light"] .hg-tier-card {
  background: #ffffff;
  border-color: rgba(2, 132, 199, 0.25);
  box-shadow: 0 4px 14px rgba(0, 30, 70, 0.08);
}
[data-theme="light"] .hg-scale-visual {
  background: #f0f9ff;
}



