/* ==========================================================================
   Houston Bayou Watch — Glassmorphic Bento-Box Dark Design System
   Pure Custom CSS — Zero External Framework Dependencies
   ========================================================================== */

:root {
    /* Cosmic Glass Palette */
    --bg-primary: #070a12;
    --bg-dark-base: #080c14;
    --bg-surface: #0d131f;
    --bg-card: rgba(13, 19, 31, 0.75);
    --bg-card-hover: rgba(24, 34, 60, 0.85);
    --bg-glass-subtle: rgba(255, 255, 255, 0.03);
    --bg-glass-input: rgba(15, 23, 42, 0.6);
    
    /* Bento Geometry */
    --radius-bento: 20px;
    --radius-card: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 9999px;

    /* Frosted Glass & Depth */
    --glass-blur: blur(16px);
    --glass-border: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(56, 189, 248, 0.3);
    --glass-border-glow: rgba(56, 189, 248, 0.25);
    --glass-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);

    /* Water Theme Neon Accents */
    --accent-primary: #38bdf8;       /* Electric Sky Blue */
    --accent-primary-glow: rgba(56, 189, 248, 0.4);
    --accent-secondary: #0ea5e9;     /* Deep Bayou Blue */
    --accent-cyan: #06b6d4;          /* Glowing Cyan Vector Paths */
    --accent-teal: #14b8a6;
    --accent-indigo: #6366f1;
    --accent-magenta: #d946ef;
    
    /* Hydrologic Flood Stage Colors (USGS & NWS AHPS Standard) */
    --gauge-normal: #10b981;         /* Emerald Green */
    --gauge-normal-glow: rgba(16, 185, 129, 0.45);
    --gauge-action: #f59e0b;         /* Amber Yellow */
    --gauge-action-glow: rgba(245, 158, 11, 0.5);
    --gauge-minor: #f97316;          /* Vivid Orange */
    --gauge-minor-glow: rgba(249, 115, 22, 0.55);
    --gauge-moderate: #ef4444;       /* Crimson Red */
    --gauge-moderate-glow: rgba(239, 68, 68, 0.65);
    --gauge-major: #d946ef;          /* Magenta / Deep Purple */
    --gauge-major-glow: rgba(217, 70, 239, 0.75);
    --gauge-offline: #64748b;        /* Slate Grey */

    /* Typography & Contrast */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;
    --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Micro-Interactions */
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.2s var(--ease-spring);
    --transition-normal: 0.35s var(--ease-spring);
    --transition-smooth: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark-base);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessible Focus Outlines */
button:focus-visible,
input:focus-visible,
[tabindex="0"]:focus-visible,
.preset-pill:focus-visible,
.mode-btn:focus-visible {
    outline: 2px solid var(--accent-primary) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 12px var(--accent-primary-glow) !important;
}

/* Monospace Helpers */
.mono {
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}

/* Ambient Background Glow */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.22;
    animation: blob-drift 24s infinite alternate ease-in-out;
}

.blob-cyan {
    width: 55vw;
    height: 55vw;
    top: -12vw;
    left: -12vw;
    background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
}

.blob-blue {
    width: 48vw;
    height: 48vw;
    bottom: -10vw;
    right: 10vw;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    animation-delay: -7s;
}

.blob-indigo {
    width: 38vw;
    height: 38vw;
    top: 35vh;
    left: 40vw;
    background: radial-gradient(circle, var(--accent-indigo) 0%, transparent 70%);
    animation-delay: -14s;
}

@keyframes blob-drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 20px) scale(1.05); }
    100% { transform: translate(-20px, 35px) scale(1.08); }
}

/* Glassmorphism Containers */
.glass-panel {
    background: var(--bg-card);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.glass-box {
    background: var(--bg-glass-input);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}

/* App Main Layout Structure */
.app-layout {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    height: 68px;
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    background: rgba(8, 12, 20, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

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

.logo-badge {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 0 20px var(--accent-primary-glow);
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.logo-badge:hover {
    transform: rotate(5deg) scale(1.05);
}

.wave-icon {
    width: 24px;
    height: 24px;
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-sub {
    font-size: 0.80rem;
    color: var(--text-secondary);
    display: block;
    font-weight: 600;
}

/* Mode Switcher Navigation */
.mode-nav {
    display: flex;
    padding: 5px;
    border-radius: var(--radius-pill);
    gap: 6px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--glass-border);
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
}

.mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22) 0%, rgba(14, 165, 233, 0.32) 100%);
    color: var(--accent-primary);
    border: 1px solid var(--border-accent);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
    font-weight: 700;
}

.status-dot.live-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--gauge-normal);
    box-shadow: 0 0 8px var(--gauge-normal);
    animation: radar-pulse 2s infinite ease-out;
}

@keyframes radar-pulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Header Actions: Search, Sync, Buttons */
.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    width: 290px;
    position: relative;
    transition: var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
    width: 340px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    width: 100%;
}

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

.search-dropdown {
    position: absolute;
    top: 46px;
    left: 0;
    width: 100%;
    border-radius: var(--radius-md);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1100;
    padding: 6px;
    background: rgba(13, 19, 31, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
}

.search-suggestion-item {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-suggestion-item:hover,
.search-suggestion-item.active,
.search-suggestion-item:focus-visible {
    background: rgba(56, 189, 248, 0.22);
    color: #ffffff;
    outline: none;
}

.sync-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--gauge-normal);
    box-shadow: 0 0 6px var(--gauge-normal-glow);
}

.sync-dot.stale {
    background-color: var(--gauge-action);
    box-shadow: 0 0 6px var(--gauge-action-glow);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn.spinning svg {
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   NWS Active Alerts Banner
   ========================================================================== */
.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: rgba(239, 68, 68, 0.16);
    border-bottom: 1px solid rgba(239, 68, 68, 0.45);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.25);
    z-index: 999;
    transition: var(--transition-fast);
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alert-badge {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.pulse-danger {
    background: var(--gauge-moderate);
    color: #ffffff;
    box-shadow: 0 0 10px var(--gauge-moderate-glow);
    animation: danger-glow 1.5s infinite alternate;
}

.pulse-warning {
    background: var(--gauge-action);
    color: #000000;
    box-shadow: 0 0 10px var(--gauge-action-glow);
}

@keyframes danger-glow {
    from { box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
    to { box-shadow: 0 0 18px rgba(239, 68, 68, 0.9); }
}

.alert-headline {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
}

.alert-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.alert-action-btn {
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition-fast);
}

.alert-action-btn:hover {
    background: var(--gauge-moderate);
}

.alert-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.alert-close-btn:hover {
    color: #ffffff;
}

/* ==========================================================================
   Main Workspace: Map + Bento Sidebar
   ========================================================================== */
.app-body {
    display: flex;
    flex: 1;
    height: calc(100vh - 68px);
    position: relative;
    overflow: hidden;
}

/* Map Viewport */
.map-viewport {
    flex: 1;
    position: relative;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    background: #080c14;
}

/* Leaflet Custom Overrides */
.leaflet-container {
    background: #080c14 !important;
    font-family: var(--font-body) !important;
}

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

.leaflet-bar a {
    background: rgba(13, 19, 31, 0.85) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--glass-border) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    transition: var(--transition-fast) !important;
}

.leaflet-bar a:hover {
    background: rgba(56, 189, 248, 0.25) !important;
    color: #ffffff !important;
}

/* Floating Map HUD Controls */
.map-hud-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hud-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    background: rgba(13, 19, 31, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: var(--glass-shadow);
}

.hud-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--border-accent);
}

.layer-menu-dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    width: 230px;
    padding: 14px;
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 600;
    background: rgba(13, 19, 31, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.layer-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--glass-border);
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.layer-item input[type="checkbox"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.layer-item:hover {
    color: var(--text-primary);
}

/* Floating Gauge Legend HUD */
/* Floating Comprehensive Map Legend HUD */
.map-hud-bottom-left {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 500;
    max-width: 440px;
    padding: 14px 18px;
    border-radius: var(--radius-card);
    background: rgba(13, 19, 31, 0.94);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-hud-bottom-left.in-history-mode {
    bottom: 160px;
}

.legend-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 2px;
}

.legend-collapse-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-fast);
}

.legend-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.hwm-legend-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
    border: 1.5px solid #ffffff;
    font-size: 0.72rem;
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.5);
    flex-shrink: 0;
}

.legend-section {
    margin-bottom: 12px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-section-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.legend-items-grid {
    display: flex;
    gap: 10px 16px;
    flex-wrap: wrap;
}

.legend-features-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item, .legend-feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: #f8fafc;
    font-weight: 600;
}

.legend-swatch {
    width: 26px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-swatch.line-bayou {
    background: #00f0ff;
    height: 5px;
    box-shadow: 0 0 10px #00f0ff;
}

.legend-swatch.line-creek {
    background: #38bdf8;
    height: 4px;
    box-shadow: 0 0 8px #38bdf8;
}

.legend-swatch.poly-water {
    background: rgba(2, 132, 199, 0.6);
    border: 1px solid #38bdf8;
    height: 14px;
}

.legend-swatch.poly-watershed {
    background: rgba(14, 165, 233, 0.08);
    border: 1.5px dashed #94a3b8;
    height: 14px;
}

.color-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.color-dot.normal { background: var(--gauge-normal); box-shadow: 0 0 10px var(--gauge-normal-glow); }
.color-dot.action { background: var(--gauge-action); box-shadow: 0 0 10px var(--gauge-action-glow); }
.color-dot.minor { background: var(--gauge-minor); box-shadow: 0 0 10px var(--gauge-minor-glow); }
.color-dot.moderate { background: var(--gauge-moderate); box-shadow: 0 0 10px var(--gauge-moderate-glow); }
.color-dot.major { background: var(--gauge-major); box-shadow: 0 0 10px var(--gauge-major-glow); }

/* SVG & High-Contrast Solid Pulsating Markers on Leaflet */
.gage-marker-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.gage-marker-pulse {
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    pointer-events: none;
    animation: marker-pulse-anim 2s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gage-marker-core {
    position: relative;
    z-index: 2;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
    transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.gage-marker-pip {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

.gage-marker-wrap:hover .gage-marker-core {
    transform: scale(1.35);
}

@keyframes marker-pulse-anim {
    0% { transform: scale(0.5); opacity: 0.95; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* ==========================================================================
   Unreal-Engine Fluid Animated Waterways
   ========================================================================== */
.bayou-vector-path {
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    stroke-dasharray: 4, 6 !important;
    animation: unreal-water-flow 3.6s linear infinite, unreal-water-pulse 5s ease-in-out infinite alternate !important;
    filter: drop-shadow(0 0 5px rgba(0, 240, 255, 0.95)) drop-shadow(0 0 14px rgba(14, 165, 233, 0.6)) !important;
    transition: stroke-width 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.bayou-vector-path:hover {
    stroke-width: 5.5px !important;
    opacity: 1 !important;
    filter: drop-shadow(0 0 8px #00f0ff) drop-shadow(0 0 22px rgba(0, 240, 255, 0.95)) !important;
    cursor: pointer;
}

.creek-vector-path {
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    stroke-dasharray: 2, 6 !important;
    opacity: 0.65 !important;
    animation: unreal-water-flow 4.8s linear infinite, unreal-water-pulse 6s ease-in-out infinite alternate !important;
    filter: drop-shadow(0 0 2px rgba(56, 189, 248, 0.6)) !important;
    transition: stroke-width 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.creek-vector-path:hover {
    stroke-width: 2.8px !important;
    opacity: 1 !important;
    filter: drop-shadow(0 0 6px #38bdf8) drop-shadow(0 0 14px rgba(56, 189, 248, 0.9)) !important;
    cursor: pointer;
}

/* Downstream Current Flow & Shimmer Pulse */
@keyframes unreal-water-flow {
    from {
        stroke-dashoffset: 40;
    }
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes unreal-water-pulse {
    0% {
        stroke-opacity: 0.82;
    }
    50% {
        stroke-opacity: 1.0;
    }
    100% {
        stroke-opacity: 0.88;
    }
}

/* Waterbody Polygons */
.waterbody-polygon {
    filter: drop-shadow(0 0 6px rgba(2, 132, 199, 0.5));
    transition: fill-opacity 0.2s ease;
}

.waterbody-polygon:hover {
    fill-opacity: 0.55 !important;
}

/* Custom Leaflet Popups */
.leaflet-popup-content-wrapper {
    background: rgba(13, 19, 31, 0.92) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    backdrop-filter: blur(20px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--radius-card) !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7) !important;
    color: var(--text-primary) !important;
    padding: 6px !important;
}

.leaflet-popup-tip {
    background: rgba(13, 19, 31, 0.92) !important;
    border: 1px solid var(--glass-border) !important;
}

.gauge-popup-card {
    padding: 10px;
    min-width: 220px;
}

.popup-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

.popup-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.popup-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.popup-metric-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.popup-metric-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.popup-metric-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.popup-status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.popup-btn {
    width: 100%;
    padding: 7px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    border: none;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.popup-btn:hover {
    box-shadow: 0 0 12px var(--accent-primary-glow);
}

/* USGS High-Water Mark Markers on Leaflet */
.hwm-leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

.hwm-marker-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hwm-marker-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    font-size: 0.76rem;
    font-weight: 800;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.6), 0 3px 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.hwm-marker-wrap:hover .hwm-marker-badge {
    transform: scale(1.18);
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.95);
    z-index: 1000;
}

.hwm-marker-wrap.is-nearest .hwm-marker-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #ffffff;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.9), 0 0 30px rgba(245, 158, 11, 0.5);
}

.hwm-nearest-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #f59e0b;
    animation: radar-pulse 2s infinite ease-out;
    pointer-events: none;
}

.hwm-marker-icon {
    font-size: 0.82rem;
    line-height: 1;
}

.hwm-marker-depth {
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}

/* High-Water Mark Interactive Popup */
.hwm-popup-card {
    min-width: 250px;
    max-width: 300px;
    padding: 2px;
    color: #f8fafc;
    font-family: var(--font-body);
}

.hwm-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hwm-badge-pill {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #f43f5e;
}

.hwm-storm-pill {
    font-size: 0.70rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(217, 70, 239, 0.2);
    border: 1px solid rgba(217, 70, 239, 0.4);
    color: #d946ef;
    font-weight: 700;
}

.hwm-popup-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 10px;
    line-height: 1.3;
}

.hwm-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.hwm-stat-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hwm-stat-box.highlight {
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.35);
}

.hwm-stat-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
}

.hwm-stat-number {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
}

.hwm-stat-number.danger {
    color: #f87171;
}

.hwm-details-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.78rem;
    color: #cbd5e1;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 8px;
}

.hwm-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hwm-detail-label {
    color: #94a3b8;
    font-weight: 600;
}

.hwm-detail-val {
    color: #f1f5f9;
    font-weight: 700;
}

.quality-excellent {
    color: #34d399;
}

/* ==========================================================================
   Bento Sidebar & Panels
   ========================================================================== */
.sidebar-bento {
    width: 530px;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    z-index: 500;
    background: rgba(8, 12, 20, 0.90);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    transition: transform var(--transition-normal);
}

/* Bento Card Surface */
.bento-card {
    background: var(--bg-card);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-bento);
    padding: 18px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition-normal);
}

.bento-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.card-header h3 {
    font-size: 1.12rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #ffffff;
}

.badge-tag {
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-weight: 700;
}

/* KPI Counter Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.kpi-box {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition-fast);
}

.kpi-box:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.kpi-box.clickable-kpi {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.kpi-box.clickable-kpi:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.kpi-box.clickable-kpi:active {
    transform: translateY(0);
}

.banner-highlight-pulse {
    animation: banner-pulse-glow 0.8s 3 ease-in-out alternate;
}

@keyframes banner-pulse-glow {
    0% {
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
        border-color: rgba(245, 158, 11, 0.6);
    }
    100% {
        box-shadow: 0 0 25px rgba(245, 158, 11, 0.9), 0 0 40px rgba(245, 158, 11, 0.5);
        border-color: #f59e0b;
    }
}

.kpi-label {
    font-size: 0.80rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
}

.kpi-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-value.danger {
    color: var(--gauge-moderate);
    text-shadow: 0 0 14px var(--gauge-moderate-glow);
}

.kpi-value.warning {
    color: var(--gauge-action);
    text-shadow: 0 0 14px var(--gauge-action-glow);
}

.kpi-value.alert {
    color: var(--accent-primary);
    text-shadow: 0 0 14px var(--accent-primary-glow);
}

/* Weather Conditions Card */
.conditions-card .weather-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.temp-display {
    display: flex;
    flex-direction: column;
}

.temp-val {
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
}

.weather-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 5px;
    font-weight: 600;
}

.weather-stats {
    font-size: 0.90rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: right;
}

.weather-stats strong {
    color: #ffffff;
}

/* Filter Pills */
.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.pill:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.pill.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

/* Gage Scroll List */
.gage-items-scroll {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition-fast);
}

.gage-item:hover {
    background: rgba(56, 189, 248, 0.08);
    border-color: var(--glass-border-glow);
    transform: translateY(-2px);
}

.gage-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 65%;
}

.gage-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gage-item-bayou {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.gage-item-reading {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.gage-item-stage {
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--text-primary);
}

.gage-item-delta {
    font-size: 0.80rem;
    font-weight: 700;
}

.delta-up { color: var(--gauge-minor); }
.delta-down { color: var(--gauge-normal); }
.delta-neutral { color: var(--text-muted); }

/* ==========================================================================
   Mode 2: Historical Storm Time-Machine Panel
   ========================================================================== */
.event-summary-card .card-header {
    align-items: flex-start;
}

.badge-disaster {
    font-size: 0.84rem;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(217, 70, 239, 0.25);
    color: var(--accent-magenta);
    border: 1px solid rgba(217, 70, 239, 0.5);
    font-weight: 800;
    font-family: var(--font-mono);
}

.event-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 16px;
}

.event-impact-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.impact-stat {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-val.danger {
    color: var(--gauge-moderate);
}

.zip-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
}

.zip-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.92rem;
}

.zip-badge {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.96rem;
    color: var(--accent-primary);
}

/* ==========================================================================
   Mode 3: Property Flood Risk Intelligence Panel (Redesigned Bento-Box UX)
   ========================================================================== */
.property-header-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.property-address-box {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.pin-icon-wrap {
    font-size: 1.6rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.property-pin-pulse {
    display: inline-block;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.7));
    animation: radar-pulse 3s infinite ease-out;
}

.property-address-info {
    flex: 1;
    min-width: 0;
}

.address-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.address-header-row h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.prop-coords {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
    font-weight: 500;
}

.prop-quick-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.preset-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.preset-pill {
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.preset-pill:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: var(--border-accent);
    color: #ffffff;
    transform: translateY(-1px);
}

.preset-pill.active {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

/* Hero Risk Score Bento Card */
.risk-score-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: linear-gradient(135deg, rgba(13, 19, 31, 0.88) 0%, rgba(20, 30, 52, 0.75) 100%);
    border: 1px solid rgba(56, 189, 248, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.risk-score-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.risk-gauge-wrap {
    position: relative;
    width: 124px;
    height: 124px;
    flex-shrink: 0;
}

.risk-gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 10;
}

.gauge-fill {
    fill: none;
    stroke: var(--gauge-normal);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out, stroke 0.5s ease;
}

.gauge-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-score {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.gauge-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    font-weight: 700;
    margin-top: 3px;
}

.risk-summary-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.risk-category-badge-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.risk-category-pill {
    display: inline-block;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.risk-scale-tag {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.risk-summary-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 4-Factor Breakdown Bars */
.risk-factor-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--glass-border);
}

.factor-bar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.factor-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.factor-header strong {
    color: var(--text-primary);
    font-weight: 700;
}

.progress-track {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-primary));
    transition: width 0.8s ease-out;
}

/* Section Dividers */
.prop-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 4px;
}

.section-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-badge {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
}

.current-badge {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.history-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gauge-action);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.advice-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--gauge-normal);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.prop-section-header h4 {
    font-size: 0.98rem;
    font-weight: 800;
    color: #ffffff;
}

.section-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Bento Subcards & Grids */
.prop-current-grid, .prop-history-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sub-card {
    padding: 14px 16px;
    background: rgba(13, 19, 31, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-card);
    transition: var(--transition-fast);
}

.sub-card:hover {
    background: rgba(20, 30, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.12);
}

.sub-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sub-card-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.sub-card-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
    display: block;
}

.sub-card-primary {
    font-size: 1.12rem;
    font-weight: 800;
    color: #ffffff;
}

.sub-card-desc {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 8px;
}

.sub-card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sub-card-meta-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
}

.sub-card-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 5px;
}

.highlight-val {
    font-size: 1.05rem;
    color: var(--accent-primary);
    font-weight: 800;
}

.channel-status-tag {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 700;
}

.channel-status-tag.safe {
    background: rgba(16, 185, 129, 0.15);
    color: var(--gauge-normal);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.channel-status-tag.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gauge-action);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.channel-status-tag.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--gauge-moderate);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Stream Gauge Mini Card & Hydrograph Action */
.gauge-card-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.gauge-reading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.gage-stage-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.gage-stage-val {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.gage-status-badge {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    border: 1px solid transparent;
}

.span-2 {
    grid-column: span 2;
    width: 100%;
}

.gauge-card-left {
    flex: 1;
    min-width: 0;
}

.gauge-card-right {
    flex-shrink: 0;
}

.action-btn-sm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(14, 165, 233, 0.28) 100%);
    border: 1px solid var(--border-accent);
    color: var(--accent-primary);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.action-btn-sm:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.35) 0%, rgba(14, 165, 233, 0.45) 100%);
    color: #ffffff;
    box-shadow: 0 0 12px var(--accent-primary-glow);
}

.action-btn-sm:disabled,
.action-btn-sm[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.6);
    box-shadow: none !important;
}

/* Historical Claims & Storm Breakdown */
.card-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hist-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.hist-kpi-box {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hist-kpi-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.hist-kpi-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.storm-history-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.storm-row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.storm-row-name {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.harvey-dot { background: var(--gauge-major); box-shadow: 0 0 6px var(--gauge-major-glow); }
.taxday-dot { background: var(--gauge-minor); box-shadow: 0 0 6px var(--gauge-minor-glow); }
.ike-dot { background: var(--gauge-action); box-shadow: 0 0 6px var(--gauge-action-glow); }

.storm-row-metrics {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.storm-row-metrics strong {
    color: var(--accent-primary);
}

/* High-Water Mark Card */
.hwm-card {
    background: rgba(13, 19, 31, 0.75);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.hwm-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.hwm-stat-box {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hwm-stat-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.hwm-highlight {
    color: #f87171;
    font-size: 1.15rem;
    font-weight: 800;
}

.hwm-sub-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

/* Actionable Recommendations List */
.guidance-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guidance-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.90rem;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent-primary);
    transition: var(--transition-fast);
}

.guidance-item:hover {
    background: rgba(255, 255, 255, 0.045);
    border-left-color: var(--accent-cyan);
}

.guidance-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1.2;
}

.guidance-text {
    flex: 1;
}

/* ==========================================================================
   Dual-Axis Hydrograph Modal / Card
   ========================================================================== */
.hydrograph-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hydrograph-card.collapsed {
    display: none !important;
}

.chart-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 3px;
    font-weight: 500;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeframe-buttons {
    display: flex;
    gap: 6px;
}

.tf-btn {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tf-btn.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

.chart-status-banner {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.4;
    transition: var(--transition-fast);
}

.chart-status-banner.banner-normal {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.chart-status-banner.banner-action {
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
}

.chart-status-banner.banner-minor {
    background: rgba(249, 115, 22, 0.18);
    border: 1px solid rgba(249, 115, 22, 0.45);
    color: #f97316;
}

.chart-status-banner.banner-major {
    background: rgba(217, 70, 239, 0.22);
    border: 1px solid rgba(217, 70, 239, 0.5);
    color: #d946ef;
    box-shadow: 0 0 14px rgba(217, 70, 239, 0.2);
}

.chart-wrapper {
    position: relative;
    width: 100%;
    height: 260px;
}

.chart-footer-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--glass-border);
}

.cstat {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    font-weight: 600;
}

.cstat strong {
    display: block;
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 800;
    margin-top: 3px;
}

/* ==========================================================================
   Time-Machine Bottom Dock (Mode 2)
   ========================================================================== */
.time-machine-dock {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    border-top: 1px solid var(--glass-border);
    padding: 12px 24px 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(8, 12, 20, 0.96);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.7);
}

.tm-playback-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tm-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tm-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-fast);
}

.tm-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

.tm-play-btn {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    border: none;
    box-shadow: 0 0 18px var(--accent-primary-glow);
    font-size: 1.18rem;
    color: #ffffff;
}

.tm-speed-selector {
    display: flex;
    gap: 6px;
    margin-left: 6px;
}

.speed-pill {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.speed-pill.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--border-accent);
    color: var(--accent-primary);
}

.tm-scrubber-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tm-date-display {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 6px;
}

.tm-center-milestone-capsule {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(13, 19, 31, 0.95);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.45);
    border-radius: var(--radius-pill);
    padding: 5px 18px 5px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.18);
    transition: all 0.25s ease;
}

.tm-center-milestone-capsule:hover {
    border-color: rgba(56, 189, 248, 0.7);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 22px rgba(56, 189, 248, 0.3);
}

.tm-storm-tag {
    font-size: 0.92rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(217, 70, 239, 0.4) 0%, rgba(147, 51, 234, 0.4) 100%);
    border: 1px solid rgba(217, 70, 239, 0.6);
    padding: 4px 14px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
    box-shadow: 0 0 10px rgba(217, 70, 239, 0.3);
    white-space: nowrap;
}

.tm-capsule-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.tm-milestone-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
}

.tm-active-event-name {
    font-size: 0.98rem;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
    white-space: nowrap;
}

.tm-timeline-track-wrap {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.tm-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    height: 6px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.tm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 14px var(--accent-primary);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.tm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

/* Master Timeline Event Ticks along the slider track */
.tm-event-ticks-row {
    position: relative;
    width: 100%;
    height: 32px;
    margin-top: 6px;
}

.tm-event-tick-btn {
    position: absolute;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 4px;
    transition: all 0.2s ease;
    opacity: 0.65;
    border-radius: 4px;
}

.tm-event-tick-btn[data-event="allison_2001"] {
    transform: translateX(0);
}

.tm-event-tick-btn[data-event="imelda_2019"] {
    transform: translateX(-100%);
}

.tm-event-tick-btn .tick-line {
    width: 2px;
    height: 7px;
    background: #64748b;
    border-radius: 1px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.tm-event-tick-btn .tick-text {
    font-size: 0.74rem;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.tm-event-tick-btn:hover {
    opacity: 1;
}

.tm-event-tick-btn:hover .tick-line {
    background: #38bdf8;
    height: 10px;
    box-shadow: 0 0 6px #38bdf8;
}

.tm-event-tick-btn:hover .tick-text {
    color: #38bdf8;
}

.tm-event-tick-btn.active {
    opacity: 1;
}

.tm-event-tick-btn.active .tick-line {
    background: #d946ef;
    height: 11px;
    box-shadow: 0 0 10px #d946ef;
}

.tm-event-tick-btn.active .tick-text {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 0 12px rgba(217, 70, 239, 0.75);
}

/* ==========================================================================
   Custom Scrollbars & Utilities
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.hidden {
    display: none !important;
}

@media (max-width: 1280px) {
    .sidebar-bento {
        width: 440px;
    }
}

@media (max-width: 1024px) {
    .sidebar-bento {
        width: 380px;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 8px 16px;
        height: auto;
        flex-wrap: wrap;
        gap: 10px;
    }

    .brand-sub {
        display: none;
    }

    .search-box {
        width: 100%;
    }

    .app-body {
        flex-direction: column;
        height: calc(100vh - 120px);
    }

    .sidebar-bento {
        width: 100%;
        height: 45vh;
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }

    .map-viewport {
        height: 55vh;
    }

    .time-machine-dock {
        padding: 8px 16px;
        height: 120px;
        flex-direction: column;
        gap: 8px;
    }
}

/* ==========================================================================
   Mobile Responsive Layout — Houston Bayou Watch
   Designed for field use during active flood events
   Breakpoints: 768px (tablet/mobile)
   ========================================================================== */

@media (max-width: 768px) {
    /* Stack layout: sidebar above map on mobile */
    html, body {
        overflow: auto;
    }

    .app-shell {
        flex-direction: column !important;
        height: auto !important;
        min-height: 100vh;
    }

    /* Sidebar becomes a top drawer */
    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 55vh;
        overflow-y: auto;
        border-right: none !important;
        border-bottom: 1px solid var(--glass-border);
        border-radius: 0 !important;
    }

    /* Map fills remaining viewport */
    #map {
        height: 45vh !important;
        min-height: 280px;
        border-radius: 0 !important;
    }

    /* Time machine dock stays at bottom */
    #time-machine-dock {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        border-radius: 0 !important;
        max-height: 40vh;
        overflow-y: auto;
    }

    /* Mode nav tabs: compact, full-width */
    .mode-nav {
        flex-direction: row;
        gap: 4px;
    }

    .mode-btn {
        font-size: 0.7rem !important;
        padding: 6px 8px !important;
        flex: 1;
    }

    .mode-btn span {
        display: none; /* Hide label text on mobile, keep icon */
    }

    /* HUD controls: larger tap targets */
    .map-hud-bottom-left,
    .map-hud-top-right {
        bottom: auto !important;
        top: 8px !important;
    }

    .map-hud-bottom-left {
        left: 8px;
    }

    .map-hud-top-right {
        right: 8px;
    }

    /* Property risk gauge: smaller on mobile */
    .risk-gauge-svg {
        width: 100px !important;
        height: 100px !important;
    }

    /* Bento grid: single column on mobile */
    .bento-grid,
    .property-grid,
    .risk-factor-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* Charts panel: full-width overlay on mobile */
    #hydrograph-panel {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        z-index: 9999;
        border-radius: 0 !important;
        max-height: 100vh;
        overflow-y: auto;
    }

    /* Larger touch targets for buttons */
    .preset-pill,
    .mode-btn,
    button {
        min-height: 44px;
    }

    /* Search input: full width */
    .search-bar-wrapper,
    #global-search-input {
        width: 100% !important;
    }

    /* Legend: compact on mobile */
    .map-legend {
        max-width: 140px !important;
    }

    /* Gauge list items: slightly larger for touch */
    .gauge-list-item {
        padding: 10px 12px !important;
        min-height: 52px;
    }
}

/* Extra small screens (phones < 480px) */
@media (max-width: 480px) {
    .sidebar {
        max-height: 60vh;
    }

    #map {
        height: 40vh !important;
        min-height: 240px;
    }

    .mode-btn {
        font-size: 0.65rem !important;
        padding: 5px 6px !important;
    }
}

/* Landscape phone orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .app-shell {
        flex-direction: row !important;
    }

    .sidebar {
        width: 320px !important;
        height: 100vh !important;
        max-height: 100vh;
        border-right: 1px solid var(--glass-border) !important;
        border-bottom: none !important;
    }

    #map {
        height: 100vh !important;
    }
}
