/* ═══ Climate Monitor — Glassmorphism Theme ═══ */
/* Deep navy glass aesthetic with green/cyan/orange accents */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Source+Code+Pro:wght@400;500&display=swap');

:root {
    /* ── Backgrounds (Deep Navy Glass) ── */
    --bg-void: #0B1120;
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1B2336;
    --bg-card-hover: #243047;
    --bg-sidebar: #0D1424;
    --bg-input: #1A2540;
    --bg-elevated: #243047;

    /* ── Body Gradient Stops ── */
    --bg-gradient-top: #0B1120;
    --bg-gradient-mid: #0F172A;
    --bg-gradient-lower: #141E33;
    --bg-gradient-bottom: #1E293B;

    /* ── Accent (Green Primary) ── */
    --accent: #22C55E;
    --accent-light: #4ADE80;
    --accent-dark: #16A34A;
    --accent-glow: rgba(34, 197, 94, 0.12);
    --accent-gold: #F97316;
    --accent-cyan: #38BDF8;
    --accent-emerald: #22C55E;
    --accent-rose: #EF4444;
    --accent-violet: #8B5CF6;
    --accent-orange: #F97316;

    /* ── Text ── */
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: #22C55E;

    /* ── Borders (Glass Scale) ── */
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.05);
    --border-accent: rgba(255, 255, 255, 0.12);
    --border-green: rgba(34, 197, 94, 0.3);

    /* ── Semantic ── */
    --danger: #EF4444;
    --warning: #F97316;
    --yellow: #EAB308;
    --success: #22C55E;
    --info: #38BDF8;
    --purple: #A855F7;
    --orange: #F97316;

    /* ── Shadows (Glass Glow) ── */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.45);
    --shadow-glow: 0 0 20px rgba(34, 197, 94, 0.1);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.25);

    /* ── Radius ── */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 20px;
    --r-pill: 9999px;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

html { scroll-behavior: smooth; }

body {
    background: linear-gradient(rgba(11, 17, 32, 0.5), rgba(11, 17, 32, 0.65)), url('/static/img/mountain-bg.jpg') center center / cover no-repeat fixed;
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

a { color: var(--accent-cyan); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — Glass Panel
   ═══════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 280px;
    height: 100vh;
    background: rgba(13, 20, 36, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.06);
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    z-index: 100;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 10px;
    display: block !important;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.18);
}

/* Force scrollbar visibility on all browsers */
.sidebar {
    scrollbar-width: auto;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.sidebar-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0;
    background: rgba(11, 17, 32, 0.9);
    backdrop-filter: blur(16px);
    z-index: 1;
}
.sidebar-header .logo {
    font-size: 28px;
    filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--accent);
}
.sidebar-header .logo svg { width: 24px; height: 24px; }
.sidebar-header .brand {
    font-weight: 600; font-size: 13.5px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.sidebar-header .subtitle {
    font-size: 10.5px; color: var(--text-muted);
    margin-top: 1px;
    letter-spacing: 0.02em;
}

/* ═══ Digital Clock (Every Page) ════════════════════════════════ */
.digital-clock {
    position: fixed;
    top: 12px;
    right: 20px;
    left: auto;
    z-index: 50;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.08),
                0 0 40px rgba(34, 197, 94, 0.04),
                inset 0 1px 0 rgba(255,255,255,0.05);
}
.dc-time {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #38BDF8;
    letter-spacing: 2px;
    line-height: 1;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4),
                 0 0 20px rgba(56, 189, 248, 0.15);
    animation: dcPulse 2s ease-in-out infinite;
}

.nav-items { padding: 10px 12px 60px; min-height: 0; }

.nav-section-label {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.2px;
    padding: 14px 12px 5px;
    font-weight: 500;
}

.nav-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 8px 12px;
    border: none; background: none;
    color: var(--text-secondary);
    font-size: 13px; font-family: inherit; font-weight: 400;
    cursor: pointer; border-radius: var(--r-sm);
    text-align: left; transition: all .15s ease;
    position: relative;
}
.nav-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}
.nav-btn.active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent);
    font-weight: 500;
}
.nav-btn.active::before {
    content: '';
    position: absolute; left: 0; top: 50%;
    transform: translateY(-50%);
    width: 2px; height: 18px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.nav-btn .nav-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.nav-btn .nav-icon svg { width: 16px; height: 16px; }
.nav-btn .alert-dot {
    margin-left: auto;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════ */
.main-content {
    margin-left: 280px;
    padding: 28px 32px;
    min-height: 100vh;
    background: transparent;
    position: relative;
    max-width: 1400px;
}
.main-content::before {
    content: '';
    position: fixed; top: 0; right: 0;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(34,197,94,0.02) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.section {
    display: none;
    animation: fadeSlide .3s ease;
    position: relative; z-index: 1;
}
.section.active { display: block; }
@keyframes fadeSlide { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

/* ═══════════════════════════════════════════════════════════
   CARDS — Glassmorphism
   ═══════════════════════════════════════════════════════════ */
.card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3),
                inset 0 1px 0 rgba(255,255,255,0.04);
    transition: border-color .25s, transform .25s, box-shadow .25s;
}
.card:hover {
    border-color: rgba(34, 197, 94, 0.2);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3),
                0 0 20px rgba(34, 197, 94, 0.06),
                inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-2px);
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.card-header h3 {
    font-size: 16px; font-weight: 500;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 6px;
}

.card-grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
.g6 { grid-template-columns: repeat(6, 1fr); }

/* ═══ Ranking Horizontal Bars ═══════════════════════════════ */
.ranking-list { display: flex; flex-direction: column; gap: 8px; }
.ranking-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}
.rank-num {
    min-width: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #64748B;
    text-align: center;
}
.rank-name {
    min-width: 70px;
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rank-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    overflow: hidden;
}
.rank-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}
.rank-val {
    min-width: 50px;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
    font-family: 'Source Code Pro', monospace;
}

/* ═══════════════════════════════════════════════════════════
   STAT CARDS — Glassmorphism
   ═══════════════════════════════════════════════════════════ */
.stat-card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all .25s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25),
                inset 0 1px 0 rgba(255,255,255,0.04);
}
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    opacity: 0.9;
}
.stat-card:hover {
    border-color: rgba(255,255,255,0.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.25),
                0 0 16px rgba(34, 197, 94, 0.06),
                inset 0 1px 0 rgba(255,255,255,0.04);
}

.stat-card.s-red::before { background: linear-gradient(90deg, var(--danger), transparent); }
.stat-card.s-orange::before { background: linear-gradient(90deg, var(--orange), transparent); }
.stat-card.s-yellow::before { background: linear-gradient(90deg, var(--yellow), transparent); }
.stat-card.s-green::before { background: linear-gradient(90deg, var(--success), transparent); }
.stat-card.s-blue::before { background: linear-gradient(90deg, var(--info), transparent); }
.stat-card.s-purple::before { background: linear-gradient(90deg, var(--purple), transparent); }
.stat-card.s-cyan::before { background: linear-gradient(90deg, var(--accent-cyan), transparent); }

.stat-icon { font-size: 20px; margin-bottom: 8px; opacity: 0.9; }
.stat-value {
    font-size: 28px; font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.stat-label {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    margin-top: 4px; font-weight: 500;
}
.stat-sub {
    font-size: 11px; color: var(--text-muted);
    margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   BADGES — Pill-shaped
   ═══════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 8px;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.b-danger { background: rgba(239,68,68,0.12); color: var(--danger); }
.b-warning { background: rgba(249,115,22,0.12); color: var(--warning); }
.b-yellow { background: rgba(234,179,8,0.12); color: var(--yellow); }
.b-success { background: rgba(34,197,94,0.12); color: var(--accent); }
.b-info { background: rgba(56,189,248,0.12); color: var(--info); }
.b-purple { background: rgba(168,85,247,0.12); color: var(--purple); }
.b-orange { background: rgba(249,115,22,0.12); color: var(--orange); }
.b-cyan { background: rgba(56,189,248,0.12); color: var(--accent-cyan); }

/* ═══════════════════════════════════════════════════════════
   MAPS
   ═══════════════════════════════════════════════════════════ */
.map-container {
    width: 100%; height: 480px;
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    background: #080D18;
}
.map-container.map-sm { height: 320px }

/* ═══════════════════════════════════════════════════════════
   TABLES — Glass Rows
   ═══════════════════════════════════════════════════════════ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
    padding: 12px 16px; text-align: left;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    color: var(--text-muted); font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 1px;
    position: sticky; top: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    z-index: 1;
}
.tbl td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background .1s;
}
.tbl tr:hover td { background: rgba(255,255,255,0.02); }
.tbl-scroll {
    max-height: 400px; overflow-y: auto;
    border-radius: var(--r-md);
    border: 1px solid rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════════════════════════
   FILTER TABS — Pill-shaped
   ═══════════════════════════════════════════════════════════ */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-pill);
    background: none; color: var(--text-secondary);
    font-size: 11.5px; font-family: inherit;
    cursor: pointer; transition: all .15s ease;
    font-weight: 500;
}
.tab:hover {
    border-color: rgba(255,255,255,0.15);
    color: var(--text-primary);
}
.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0B1120;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */
.alert-banner {
    padding: 12px 16px; border-radius: var(--r-md);
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px; font-size: 12.5px;
}
.alert-danger { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.15); }
.alert-warning { background: rgba(249,115,22,0.08); border: 1px solid rgba(249,115,22,0.15); }
.alert-success { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.15); }
.alert-info { background: rgba(56,189,248,0.08); border: 1px solid rgba(56,189,248,0.15); }

/* ═══════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════ */
.progress { height: 5px; border-radius: 10px; background: rgba(255,255,255,0.06); overflow: hidden; }
.progress .fill { height: 100%; border-radius: 10px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ═══════════════════════════════════════════════════════════
   GAUGE DOT
   ═══════════════════════════════════════════════════════════ */
.gauge {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SECTION HEADER
   ═══════════════════════════════════════════════════════════ */
.sec-hdr { margin-bottom: 20px; }
.sec-hdr h2 {
    font-size: 22px; font-weight: 600;
    display: flex; align-items: center; gap: 8px;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}
.sec-hdr p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.sec-hdr .hdr-meta {
    display: flex; gap: 14px; margin-top: 8px;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════════════ */
.loading {
    display: flex; align-items: center; justify-content: center;
    padding: 60px; color: var(--text-secondary);
    font-size: 13px;
}
.loading::after {
    content: ''; width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-left: 10px;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* ═══════════════════════════════════════════════════════════
   CHART WRAPPER
   ═══════════════════════════════════════════════════════════ */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap canvas { width: 100%!important; height: 100%!important; }

/* ═══════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════ */
.hero {
    text-align: center; padding: 36px 20px 28px;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(34,197,94,0.03) 0%, transparent 70%);
    pointer-events: none;
}
.hero h1 {
    font-size: 30px; font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    position: relative;
}
.hero p {
    color: var(--text-secondary); font-size: 14px;
    max-width: 680px; margin: 8px auto 0;
    line-height: 1.6;
}
.hero .hero-stats {
    display: flex; justify-content: center;
    gap: 32px; margin-top: 28px;
    flex-wrap: wrap;
}
.hero .hero-stat { text-align: center; }
.hero .hero-stat .val {
    font-size: 34px; font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-primary);
}
.hero .hero-stat .lbl {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 10px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1px;
    margin-top: 2px; font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   PIPELINE
   ═══════════════════════════════════════════════════════════ */
.pipeline {
    display: flex; gap: 0; margin: 32px 0;
    justify-content: center; flex-wrap: wrap;
}
.pipeline-step {
    flex: 1; min-width: 160px; max-width: 220px;
    text-align: center; padding: 24px 16px;
    position: relative;
}
.pipeline-step .step-num {
    width: 42px; height: 42px;
    border-radius: 9999px;
    background: var(--accent);
    color: #0B1120; font-weight: 700; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 12px;
}
.pipeline-step .step-title {
    font-weight: 600; font-size: 13px;
    margin-bottom: 4px; color: var(--text-primary);
}
.pipeline-step .step-desc {
    font-size: 11.5px; color: var(--text-secondary);
    line-height: 1.5;
}
.pipeline-step::after {
    content: '→';
    position: absolute; right: -8px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 18px;
}
.pipeline-step:last-child::after { display: none; }

/* ═══════════════════════════════════════════════════════════
   SKIP LINK — Accessibility
   ═══════════════════════════════════════════════════════════ */
.skip-link {
    position: fixed; top: -100%; left: 16px;
    z-index: 10000;
    padding: 8px 16px;
    background: var(--accent);
    color: #0B1120;
    border-radius: var(--r-sm);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: top .2s ease;
}
.skip-link:focus {
    top: 16px;
}

/* ═══════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.flex { display:flex; } .items-center { align-items:center; }
.gap-2 { gap:8px; } .gap-3 { gap:12px; } .justify-between { justify-content:space-between; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mono { font-family: 'Source Code Pro', ui-monospace, monospace; }
.btn {
    padding: 10px 20px;
    background: var(--accent); color: #0B1120;
    border: none; border-radius: var(--r-pill);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover {
    background: var(--accent-light);
}
.ts-btn {
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    transition: all .15s ease;
}
.ts-btn:hover {
    border-color: rgba(255,255,255,0.15);
    color: var(--text-primary);
}
.ts-btn.active {
    background: rgba(56,189,248,0.12);
    border-color: rgba(56,189,248,0.3);
    color: var(--accent-cyan);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════════════ */
.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: all .2s ease;
    flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: rgba(255,255,255,0.15); }
.theme-icon-light { display: none; }
html.light .theme-icon-dark { display: none; }
html.light .theme-icon-light { display: inline; }

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════ */
html.light {
    --bg-void: #F8FAFC;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --bg-sidebar: #F8FAFC;
    --bg-input: #F1F5F9;
    --bg-elevated: #FFFFFF;

    --accent: #16A34A;
    --accent-light: #22C55E;
    --accent-dark: #15803D;
    --accent-glow: rgba(22, 163, 74, 0.06);

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-accent: #16A34A;

    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);
    --border-accent: rgba(0, 0, 0, 0.12);
    --border-green: rgba(22, 163, 74, 0.2);

    --danger: #DC2626;
    --warning: #EA580C;
    --yellow: #CA8A04;
    --success: #16A34A;
    --info: #2563EB;
    --purple: #7C3AED;
    --orange: #EA580C;

    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-glow: none;
    --shadow-card: none;
}

html.light body { background: var(--bg-void); color: var(--text-primary); }
html.light .sidebar { background: rgba(248,250,252,0.95); border-right-color: var(--border); }
html.light .sidebar-header { background: rgba(248,250,252,0.95); border-bottom-color: var(--border); }
html.light .sidebar-header .brand { color: var(--text-primary); }
html.light .sidebar-header .logo { filter: none; }
html.light .nav-btn { color: var(--text-secondary); }
html.light .nav-btn:hover { background: rgba(22,163,74,0.04); color: var(--text-primary); }
html.light .nav-btn.active { background: rgba(22,163,74,0.06); color: var(--accent); }
html.light .nav-btn.active::before { background: var(--accent); }
html.light .nav-section-label { color: var(--text-muted); }
html.light .main-content { background: var(--bg-void); }
html.light .main-content::before { background: radial-gradient(circle, rgba(22,163,74,0.015) 0%, transparent 70%); }
html.light .card { background: var(--bg-card); border-color: var(--border); backdrop-filter: none; -webkit-backdrop-filter: none; }
html.light .card:hover { border-color: var(--border-accent); }
html.light .stat-card { background: var(--bg-card); border-color: var(--border); backdrop-filter: none; -webkit-backdrop-filter: none; }
html.light .stat-card:hover { border-color: var(--border-accent); }
html.light .stat-value { color: var(--text-primary); }
html.light .stat-label { color: var(--text-muted); }
html.light .tbl th { background: var(--bg-card); color: var(--text-muted); border-bottom-color: var(--border); backdrop-filter: none; }
html.light .tbl td { border-bottom-color: var(--border-light); }
html.light .tbl tr:hover td { background: rgba(22,163,74,0.02); }
html.light .tbl-scroll { border-color: var(--border); }
html.light .tab { border-color: var(--border); color: var(--text-secondary); }
html.light .tab:hover { border-color: var(--border-accent); color: var(--text-primary); }
html.light .tab.active { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
html.light .alert-banner { }
html.light .alert-danger { background: rgba(220,38,38,0.04); border-color: rgba(220,38,38,0.12); }
html.light .alert-warning { background: rgba(234,88,12,0.04); border-color: rgba(234,88,12,0.12); }
html.light .alert-success { background: rgba(22,163,74,0.04); border-color: rgba(22,163,74,0.12); }
html.light .alert-info { background: rgba(37,99,235,0.04); border-color: rgba(37,99,235,0.12); }
html.light .hero::before { background: radial-gradient(circle, rgba(22,163,74,0.02) 0%, transparent 70%); }
html.light .hero h1 { color: var(--text-primary); }
html.light .hero p { color: var(--text-secondary); }
html.light .hero .hero-stat .val { color: var(--text-primary); }
html.light .hero .hero-stat .lbl { color: var(--text-muted); }
html.light .pipeline-step .step-num { color: #FFFFFF; }
html.light .pipeline-step .step-title { color: var(--text-primary); }
html.light .pipeline-step .step-desc { color: var(--text-secondary); }
html.light .pipeline-step::after { color: var(--text-muted); }
html.light .sec-hdr h2 { color: var(--text-primary); }
html.light .sec-hdr p { color: var(--text-secondary); }
html.light .sec-hdr .hdr-meta { color: var(--text-muted); }
html.light .card-header h3 { color: var(--text-primary); }
html.light .loading { color: var(--text-secondary); }
html.light .loading::after { border-color: #E2E8F0; border-top-color: var(--accent); }
html.light .map-container { background: #F1F5F9; border-color: var(--border); }
html.light .theme-toggle { background: var(--bg-card); border-color: var(--border); color: var(--text-secondary); }
html.light .theme-toggle:hover { background: var(--bg-elevated); color: var(--text-primary); }
html.light ::-webkit-scrollbar-thumb { background: #CBD5E1; }
html.light ::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
html.light .progress { background: #E2E8F0; }
html.light .main-content .sec-hdr { background: rgba(248,250,252,0.9); }
html.light .basemap-btn { background: rgba(255,255,255,0.9); color: var(--text-primary); border-color: var(--border); }
html.light .basemap-btn:hover { background: rgba(22,163,74,0.06); border-color: var(--border-green); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media(max-width:1100px) { .g4,.g5,.g6 { grid-template-columns: repeat(3,1fr); } }
@media(max-width:900px) {
    .sidebar { transform: translateX(-100%); height: 100vh; overflow-y: scroll; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; padding-top: 56px; }
    .g3,.g4,.g5,.g6 { grid-template-columns: repeat(2,1fr); }
    .pipeline-step::after { display: none; }
    .mobile-menu-btn { display: flex !important; align-items: center; justify-content: center; }
    .lang-toggle { display: none; }
}
@media(max-width:600px) {
    .g2,.g3,.g4,.g5,.g6 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 22px; }
    .hero .hero-stats { gap: 18px; }
    .hero .hero-stat .val { font-size: 26px; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 100%; z-index: 200; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .card-grid.g4 { grid-template-columns: 1fr 1fr; }
    .card-grid.g3 { grid-template-columns: 1fr; }
    .card-grid.g2 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 22px; }
    .hero { grid-template-columns: 1fr; gap: 12px; }
    .hero-stats { grid-template-columns: repeat(3, 1fr); }
    .pipeline { grid-template-columns: 1fr 1fr; }
    .map-container { height: 300px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 22px; }
    .tbl { font-size: 12px; }
    .nav-btn { padding: 8px 12px; font-size: 12px; }
    .mobile-menu-btn { display: block !important; }
}
@media (max-width: 480px) {
    .card-grid.g4 { grid-template-columns: 1fr; }
    .hero-stats { grid-template-columns: 1fr 1fr; }
    .pipeline { grid-template-columns: 1fr; }
}

.mobile-menu-btn {
    display: none;
    position: fixed; top: 12px; left: 12px; z-index: 300;
    width: 44px; height: 44px; border-radius: 9999px;
    background: rgba(15, 23, 42, 0.9); color: var(--accent);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 22px; cursor: pointer;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.mobile-menu-btn:active {
    background: rgba(34,197,94,0.15); transform: scale(0.95);
}

/* ═══ Multi-language ═══════════════════════════════════════ */
.lang-toggle {
    position: fixed; bottom: 16px; right: 16px; z-index: 300;
    padding: 8px 14px; border-radius: 9999px;
    background: rgba(15, 23, 42, 0.85); border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary); font-size: 12px; cursor: pointer;
}

/* ═══ District Search ═══════════════════════════════════════ */
.district-search-wrap {
    position: relative;
    padding: 8px 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 8px;
}
.district-search-input {
    width: 100%;
    padding: 8px 10px 8px 30px;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.district-search-input::before {
    content: '🔍';
    position: absolute;
    left: 24px;
    font-size: 12px;
    pointer-events: none;
}
.district-search-input:focus {
    border-color: var(--accent);
}
.district-search-input::placeholder {
    color: var(--text-muted);
}
.district-search-dropdown {
    display: none;
    position: absolute;
    left: 8px;
    right: 8px;
    top: 100%;
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-sm);
    z-index: 200;
    margin-top: 4px;
}
.district-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background .1s;
    font-size: 12.5px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.district-search-item:last-child {
    border-bottom: none;
}
.district-search-item:hover {
    background: rgba(255,255,255,0.06);
}
.district-search-name {
    color: var(--text-primary);
    font-weight: 500;
}
.district-search-meta {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
    margin-left: 8px;
}
.district-search-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ═══ Basemap Switcher ═══════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar.open ~ .sidebar-overlay { display: block; }
.basemap-switcher {
    margin: 0;
}
.basemap-btn {
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.basemap-btn:hover {
    background: rgba(34,197,94,0.1);
    border-color: var(--border-green);
    color: var(--accent);
}
html[dir="rtl"] { direction: rtl; }
html[dir="rtl"] .sidebar { left: auto; right: 0; border-right: none; border-left: 1px solid rgba(255,255,255,0.06); }
html[dir="rtl"] .main-content { margin-left: 0; margin-right: 280px; }
@media (max-width: 768px) {
    html[dir="rtl"] .main-content { margin-right: 0; }
}

/* ═══════════════════════════════════════════════════════════
   MAP POPUPS & MARKERS
   ═══════════════════════════════════════════════════════════ */
.dark-popup .leaflet-popup-content-wrapper {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    color: var(--text-primary);
    border-radius: var(--r-md);
    border: 1px solid rgba(255,255,255,0.08);
}
.dark-popup .leaflet-popup-tip { background: rgba(15, 23, 42, 0.95); }
.dark-popup .leaflet-popup-content { margin: 12px 14px; font-size: 12.5px; line-height: 1.5; }
.dark-popup hr { border-color: rgba(255,255,255,0.08); }
html.light .dark-popup .leaflet-popup-content-wrapper {
    background: rgba(255,255,255,0.95);
    color: #0F172A;
    border: 1px solid var(--border);
}
html.light .dark-popup .leaflet-popup-tip { background: rgba(255,255,255,0.95); }

.climate-marker {
    transition: fill-opacity 0.2s ease, stroke-width 0.2s ease;
}
.climate-marker:hover { transform: none; fill-opacity: 1; stroke-width: 2.5; transition: all 0.3s ease; }
.river-glow-marker { filter: drop-shadow(0 0 6px currentColor); }

/* ═══════════════════════════════════════════════════════════
   NOTIFICATION BELL & DROPDOWN
   ═══════════════════════════════════════════════════════════ */
.bell-btn {
    position: fixed; bottom: 60px; right: 16px; z-index: 300;
    padding: 8px 14px; border-radius: 9999px;
    background: rgba(15, 23, 42, 0.85); border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary); font-size: 16px; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: all 0.2s ease;
}
.bell-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--border-green);
}
.bell-badge {
    position: absolute; top: -6px; right: -6px;
    min-width: 18px; height: 18px;
    background: var(--danger); color: #fff;
    border-radius: 9999px; font-size: 10px; font-weight: 700;
    display: none; align-items: center; justify-content: center;
    padding: 0 5px;
    line-height: 1;
}
.bell-dropdown {
    position: fixed; bottom: 60px; right: 16px; z-index: 300;
    width: 340px; max-height: 420px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-lg);
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: bellSlideUp 0.2s ease;
}
.bell-dropdown.open {
    display: flex;
}
@keyframes bellSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.bell-dropdown-header {
    padding: 12px 16px;
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; justify-content: space-between; align-items: center;
}
.bell-count {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px; font-weight: 400;
    color: var(--text-muted);
}
.bell-dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.bell-dropdown-item {
    padding: 12px 16px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: all 0.2s;
    border-radius: var(--r-sm);
    margin: 4px 8px;
    background: transparent;
    cursor: pointer;
}
.bell-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    transform: translateX(4px);
}
.bell-dropdown-item:hover .bell-severity-dot {
    transform: scale(1.3);
}
.bell-dropdown-item:hover .bell-item-type {
    color: var(--text-primary);
}
.bell-dropdown-item:active {
    transform: translateX(2px);
}
.bell-dropdown-item:last-child {
    border-bottom: none;
}
.bell-item-type {
    font-size: 12px; font-weight: 500;
    color: var(--text-primary);
    text-transform: capitalize;
}
.bell-item-detail {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bell-item-value {
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}
.bell-severity-dot {
    width: 8px; height: 8px;
    border-radius: 50%; flex-shrink: 0;
    transition: transform 0.2s;
}
.bell-item-info {
    flex: 1; min-width: 0;
}
.bell-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
}
.bell-dropdown-footer a {
    color: var(--accent); font-size: 12px; font-weight: 500;
    text-decoration: none;
}
.bell-dropdown-footer a:hover {
    text-decoration: underline;
}

@media(max-width:900px) {
    .bell-btn { left: auto; right: 16px; bottom: auto; top: 10px; }
    .bell-dropdown { left: auto; right: 16px; bottom: auto; top: 52px; }
}

/* ═══════════════════════════════════════════════════════════
   THRESHOLD TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */
.threshold-toast {
    padding: 12px 16px; border-radius: var(--r-md);
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 12.5px; line-height: 1.5;
    animation: toastSlideIn 0.3s ease;
    max-width: 360px;
}
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
.threshold-toast-danger {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: #FCA5A5;
}
.threshold-toast-warning {
    background: rgba(249,115,22,0.08);
    border: 1px solid rgba(249,115,22,0.2);
    color: #FDE68A;
}
.threshold-toast-icon {
    font-size: 16px; flex-shrink: 0; line-height: 1;
}
.threshold-toast-msg {
    flex: 1;
}
.threshold-toast-close {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    font-size: 14px; padding: 0 2px; line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.threshold-toast-close:hover {
    color: var(--text-primary);
}
html.light .threshold-toast-danger {
    background: rgba(220,38,38,0.04);
    border-color: rgba(220,38,38,0.12);
    color: #991B1B;
}
html.light .threshold-toast-warning {
    background: rgba(234,88,12,0.04);
    border-color: rgba(234,88,12,0.12);
    color: #92400E;
}

/* ═══════════════════════════════════════════════════════════
   ALERT SETTINGS FORM
   ═══════════════════════════════════════════════════════════ */
.threshold-form-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media(max-width:600px) {
    .threshold-form-grid { grid-template-columns: 1fr; }
}
.threshold-field {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-md);
    padding: 16px;
    transition: border-color 0.2s;
}
.threshold-field:focus-within {
    border-color: var(--accent);
}
.threshold-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.threshold-icon {
    font-size: 18px;
}
.threshold-input-wrap {
    display: flex; align-items: center; gap: 8px;
}
.threshold-input {
    flex: 1;
    background: var(--bg-input); border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-sm); padding: 10px 12px;
    color: var(--text-primary); font-size: 16px;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-weight: 500;
    transition: border-color 0.2s;
    outline: none;
}
.threshold-input:focus {
    border-color: var(--accent);
}
.threshold-unit {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12px; color: var(--text-muted);
    font-weight: 500; white-space: nowrap;
}
.threshold-hint {
    font-size: 11px; color: var(--text-muted);
    margin-top: 8px; line-height: 1.4;
}
.threshold-save-btn {
    padding: 10px 20px;
    background: var(--accent); color: #0B1120;
    border: none; border-radius: 9999px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.threshold-save-btn:hover {
    background: var(--accent-light);
}
.threshold-reset-btn {
    padding: 10px 20px;
    background: rgba(255,255,255,0.04); color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 9999px;
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.threshold-reset-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}
.threshold-status {
    font-size: 12px; color: var(--accent);
    opacity: 0; transition: opacity 0.3s;
}
.threshold-status.show {
    opacity: 1;
}

/* ═══ Transparent Floating Alert Toast — Bottom Right ═══ */
.alert-toast-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    pointer-events: none;
}
.alert-toast-float > * {
    pointer-events: auto;
}
.alert-toast-item {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #E2E8F0;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: alertSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s, transform 0.3s;
    cursor: pointer;
}
.alert-toast-item:hover {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
}
.alert-toast-item.dismissing {
    opacity: 0;
    transform: translateX(40px);
}
@keyframes alertSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.alert-toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.alert-toast-icon.severe {
    background: rgba(239, 68, 68, 0.15);
}
.alert-toast-icon.high {
    background: rgba(251, 146, 60, 0.15);
}
.alert-toast-icon.moderate {
    background: rgba(234, 179, 8, 0.15);
}
.alert-toast-body {
    flex: 1;
    min-width: 0;
}
.alert-toast-title {
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.alert-toast-title.severe { color: #F87171; }
.alert-toast-title.high { color: #FB923C; }
.alert-toast-title.moderate { color: #FACC15; }
.alert-toast-msg {
    color: #94A3B8;
    font-size: 12px;
}
.alert-toast-time {
    color: #64748B;
    font-size: 10px;
    flex-shrink: 0;
    margin-top: 2px;
}
.alert-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #64748B;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
}
.alert-toast-close:hover {
    color: #94A3B8;
}

/* Light theme */
html.light .alert-toast-item {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    color: #0F172A;
}
html.light .alert-toast-item:hover {
    background: rgba(255, 255, 255, 0.85);
}
html.light .alert-toast-msg { color: #475569; }
html.light .alert-toast-time { color: #94A3B8; }
html.light .alert-toast-close { color: #94A3B8; }
html.light .alert-toast-close:hover { color: #475569; }

/* Hide scrollbar on toast container */
.alert-toast-float::-webkit-scrollbar { display: none; }
.alert-toast-float { -ms-overflow-style: none; scrollbar-width: none; }

/* ═══════════════════════════════════════════════════════════
   GLASSMORPHISM — Main content header
   ═══════════════════════════════════════════════════════════ */
.main-content .sec-hdr {
    padding: 16px 20px;
    margin: -28px -32px 20px;
    background: rgba(11, 17, 32, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ═══════════════════════════════════════════════════════════
   FOCUS STATES — WCAG 2.2 AA
   ═══════════════════════════════════════════════════════════ */
.nav-btn:focus-visible,
.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.nav-btn:focus:not(:focus-visible) { outline: none; }

/* ═══ Screen-reader only (visually hidden) ═══════════════ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ═══ Minimum font sizes — WCAG AA ══════════════════════ */
.nav-section-label { font-size: 11px; }
.stat-label { font-size: 11px; }
.stat-sub { font-size: 12px; }
.rank-num { font-size: 12px; }
.rank-name { font-size: 12px; }
.rank-val { font-size: 13px; }
.badge { font-size: 12px; }
.tab { font-size: 12px; min-height: 36px; }
.ts-btn { font-size: 12px; min-height: 36px; min-width: 44px; }
.alert-banner { font-size: 13px; }
.district-search-input { font-size: 13px; }
.district-search-item { font-size: 13px; }
.bell-item-type { font-size: 13px; }
.bell-item-detail { font-size: 12px; }
.bell-item-value { font-size: 13px; }
.tbl td { font-size: 13px; }

/* ═══ Minimum tap targets — 44×44px WCAG 2.5.5 ══════════ */
.nav-btn { min-height: 44px; padding: 10px 12px; }
.tab { padding: 8px 16px; min-height: 40px; }
.ts-btn { padding: 8px 14px; min-height: 40px; }
.theme-toggle { width: 44px; height: 44px; }
.mobile-menu-btn { width: 48px; height: 48px; }
.bell-btn { padding: 10px 16px; min-height: 44px; min-width: 44px; }
.lang-toggle { padding: 10px 16px; min-height: 44px; }
.district-search-input { padding: 10px 12px 10px 30px; min-height: 40px; }
.district-search-item { padding: 10px 12px; min-height: 40px; }
.btn { padding: 12px 24px; min-height: 44px; }
.auth-btn { padding: 12px; min-height: 44px; }
.threshold-save-btn { padding: 12px 24px; min-height: 44px; }
.threshold-reset-btn { padding: 12px 24px; min-height: 44px; }
.threshold-input { padding: 12px; min-height: 44px; }

/* ═══ Auth Modal ════════════════════════════════════════════ */
.auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
}
.auth-card {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-lg);
    padding: 24px;
    width: 320px;
    box-shadow: var(--shadow-lg);
}
.auth-card h3 {
    margin-bottom: 16px;
    text-align: center;
}
.auth-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 8px;
    background: var(--bg-input);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}
.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.auth-input + .auth-input {
    margin-bottom: 12px;
}
.auth-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #0B1120;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 14px;
    transition: background 0.2s;
}
.auth-btn:hover {
    background: var(--accent-light);
}
.auth-error {
    text-align: center;
    margin-top: 8px;
    font-size: 11px;
    color: #EF4444;
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   PREFERS-REDUCED-MOTION — Accessibility
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
