/* ═══════════════════════════════════════
   Design Tokens
   ═══════════════════════════════════════ */
:root {
    /* Base Light Theme */
    --bg-color: #F0F4F8;
    --primary: #0F3D2E;
    --emerald: #10B981;
    --emerald-dark: #059669;
    --emerald-glow: 0 4px 12px rgba(16, 185, 129, .2);
    --blue-ispu: #3B82F6;
    --amber: #F59E0B;
    --amber-glow: 0 4px 12px rgba(245, 158, 11, .2);
    --red: #EF4444;
    --red-glow: 0 4px 12px rgba(239, 68, 68, .2);
    --purple: #7E22CE;

    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --glass-bg: rgba(255, 255, 255, .85);
    --glass-border: rgba(15, 61, 46, .1);
    --card-hover-border: rgba(16, 185, 129, .4);
    --card-bg-gradient: linear-gradient(145deg, rgba(255, 255, 255, .95), rgba(248, 250, 252, .8));

    --panel-gap: 12px;
    --left-w: 320px;
    --right-w: 330px;
    --header-h: 56px;
    --footer-h: 28px;
}

/* Base Dark Theme Overrides */
body.dark-theme {
    --bg-color: #0F172A;
    --primary: #10B981;
    /* Emerald acts as primary bright in dark mode */
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --glass-bg: rgba(15, 23, 42, .75);
    --glass-border: rgba(148, 163, 184, .15);
    --card-hover-border: rgba(16, 185, 129, .5);
    --card-bg-gradient: linear-gradient(145deg, rgba(30, 41, 59, .85), rgba(15, 23, 42, .7));
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    background-image: linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
    background-size: 40px 40px;
    width: 100vw;
    height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* ═══════════════════════════════════════
   Layout Grid — 100vw × 100vh
   ═══════════════════════════════════════ */
.app-container {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: var(--header-h) 1fr var(--footer-h);
    grid-template-columns: var(--left-w) 1fr var(--right-w);
    grid-template-areas: "header header header" "left map right" "footer footer footer";
    gap: var(--panel-gap);
    padding: var(--panel-gap);
}

.app-container.map-expanded {
    grid-template-columns: 0 1fr 0;
}

.app-container.map-expanded .left-panel,
.app-container.map-expanded .right-panel {
    display: none;
}

/* ═══════════════════════════════════════
   Typography
   ═══════════════════════════════════════ */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: .5px;
}

h1 {
    font-size: 16px;
    line-height: 1.2;
}

h2 {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0;
    letter-spacing: 1px;
}

/* ═══════════════════════════════════════
   Glass Panels & Cards
   ═══════════════════════════════════════ */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
    transition: background 0.3s, border-color 0.3s;
}

.glass-card {
    background: var(--card-bg-gradient);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 14px 16px;
    transition: all .3s;
}

.glass-card:hover {
    border-color: var(--card-hover-border);
    box-shadow: 0 2px 12px rgba(16, 185, 129, .1);
}

/* ═══════════════════════════════════════
   Expandable Cards
   ═══════════════════════════════════════ */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 6px;
}

.expand-icon {
    transition: transform .3s;
    color: var(--text-muted);
    width: 16px;
    height: 16px;
}

.card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease, opacity .3s;
    opacity: 0;
}

.expandable.expanded .card-details {
    max-height: 400px;
    opacity: 1;
    margin-top: 8px;
}

.expandable.expanded .expand-icon {
    transform: rotate(180deg);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(148, 163, 184, .1);
    font-size: 11px;
}

.detail-row span {
    color: var(--text-secondary);
}

.detail-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    max-width: 55%;
}

/* Card Explainer/Timestamp */
.card-explainer {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-timestamp {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
    border-top: 1px dashed rgba(148, 163, 184, .2);
    padding-top: 5px;
}

.card-timestamp .ts-time {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.top-bar {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 20;
}

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

.logo-img {
    height: 32px;
    object-fit: contain;
}

/* MUSA Green Logo */
.brand-text h1 {
    font-size: 17px;
}

.brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 1px;
    margin-top: 1px;
    text-transform: uppercase;
}

/* ── Site Selector ── */
.site-selector-wrap {
    margin-left: 4px;
}

.site-selector {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: all .2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

.site-selector:hover {
    border-color: var(--emerald);
    color: var(--emerald);
}

.site-selector:focus {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}

.site-selector option {
    background: var(--bg-color);
    color: var(--text-primary);
    font-weight: 500;
}

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

.glass-btn {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    outline: none;
}

.glass-btn i {
    width: 14px;
    height: 14px;
}

.glass-btn:hover {
    border-color: var(--emerald);
    color: var(--emerald);
}

.map-style-control select {
    background: transparent;
    border: none;
    color: inherit;
    font-weight: inherit;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    cursor: pointer;
}

.map-style-control select option {
    background: var(--bg-color);
    color: var(--text-primary);
}

/* LIVE Badge — prominent glowing indicator */
.live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, .12);
    border: 1px solid rgba(16, 185, 129, .35);
    padding: 4px 14px 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    color: var(--emerald);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.live-ring {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: liveRing 2s ease-in-out infinite;
}

.live-core {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald), 0 0 16px rgba(16, 185, 129, .4);
    animation: liveCore 2s ease-in-out infinite;
}

@keyframes liveRing {

    0%,
    100% {
        border-color: var(--emerald);
        transform: scale(1);
    }

    50% {
        border-color: rgba(16, 185, 129, .4);
        transform: scale(1.15);
    }
}

@keyframes liveCore {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px var(--emerald), 0 0 16px rgba(16, 185, 129, .4);
    }

    50% {
        opacity: .6;
        box-shadow: 0 0 4px var(--emerald);
    }
}

/* Small pulsing dot on card timestamps */
.live-dot-sm {
    display: inline-block;
    color: var(--emerald);
    font-size: 8px;
    animation: liveDotPulse 1.5s ease-in-out infinite;
    vertical-align: middle;
    margin-right: 2px;
}

@keyframes liveDotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .3;
        transform: scale(.7);
    }
}

.timestamp {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════
   Micro-Interactions & Animations
   ═══════════════════════════════════════ */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1
    }

    50% {
        transform: scale(1.4);
        opacity: .7
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px)
    }

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-8px)
    }

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

@keyframes breathe {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, .15)
    }

    50% {
        box-shadow: 0 0 0 5px rgba(16, 185, 129, 0)
    }
}

.fade-in {
    animation: fadeIn .5s ease both;
}

.fade-in:nth-child(1) {
    animation-delay: .1s;
}

.fade-in:nth-child(2) {
    animation-delay: .25s;
}

.fade-in:nth-child(3) {
    animation-delay: .4s;
}

.pulse-dot {
    animation: pulse 2s infinite;
    color: var(--emerald);
    font-size: 10px;
}

.status-card {
    animation: breathe 3s infinite;
}

/* Value update flash */
.val-update {
    animation: valFlash .5s ease;
}

@keyframes valFlash {
    0% {
        background: rgba(16, 185, 129, .3);
        color: #fff
    }

    100% {
        background: transparent;
    }
}

/* ═══════════════════════════════════════
   LEFT PANEL
   ═══════════════════════════════════════ */
.left-panel {
    grid-area: left;
    display: flex;
    flex-direction: column;
    gap: var(--panel-gap);
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Status ISPU ── */
.status-card {
    border-left: 4px solid var(--emerald);
}

.ispu-baik {
    color: var(--emerald);
}

.ispu-sedang {
    color: var(--blue-ispu);
}

.ispu-tidak-sehat {
    color: var(--amber);
}

.ispu-sangat-tidak-sehat {
    color: var(--red);
}

.ispu-berbahaya {
    color: var(--purple);
}

.ispu-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.ispu-category {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1.5px;
    line-height: 1;
}

.ispu-num {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: all .3s;
}

.ispu-text-context {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
    padding: 4px;
    border-radius: 4px;
    background: rgba(148, 163, 184, .05);
}

.ispu-text-context strong {
    color: var(--emerald);
}

.ispu-bar-wrap {
    margin-bottom: 2px;
}

.ispu-bar {
    height: 6px;
    background: linear-gradient(to right, #10B981, #3B82F6, #F59E0B, #EF4444, #7E22CE);
    border-radius: 3px;
    position: relative;
    overflow: visible;
    margin-bottom: 3px;
}

.ispu-bar-fill {
    position: absolute;
    top: -3px;
    width: 12px;
    height: 12px;
    background: var(--bg-color);
    border-radius: 50%;
    border: 3px solid var(--text-primary);
    box-shadow: 0 0 6px rgba(0, 0, 0, .3);
    transform: translateX(-50%);
    transition: left .6s ease;
}

.ispu-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    font-weight: 600;
}

/* ── Kualitas Udara (user-friendly ISPU params) ── */
.air-quality-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.aq-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 5px;
    transition: background .2s;
    animation: slideIn .4s ease both;
}

.aq-row:nth-child(1) {
    animation-delay: .05s;
}

.aq-row:nth-child(2) {
    animation-delay: .1s;
}

.aq-row:nth-child(3) {
    animation-delay: .15s;
}

.aq-row:nth-child(4) {
    animation-delay: .2s;
}

.aq-row:nth-child(5) {
    animation-delay: .25s;
}

.aq-row:nth-child(6) {
    animation-delay: .3s;
}

.aq-row:hover {
    background: rgba(148, 163, 184, .05);
}

.aq-name {
    width: 36px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.aq-bar-wrap {
    flex: 1;
}

.aq-bar-track {
    height: 6px;
    background: rgba(148, 163, 184, .15);
    border-radius: 3px;
    overflow: hidden;
}

.aq-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .8s ease, background .5s;
}

.aq-val {
    width: 36px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
    padding: 0 2px;
    border-radius: 3px;
}

.aq-status {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    width: 16px;
    justify-content: flex-end;
}

.aq-status i {
    width: 14px;
    height: 14px;
}

.aq-aman i {
    color: var(--emerald);
}

.aq-perhatian i {
    color: var(--amber);
}

.aq-bahaya i {
    color: var(--red);
}

/* ── Contributor List ── */
.contributor-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 4px;
}

.contributor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 6px;
    background: rgba(148, 163, 184, .05);
    border: 1px solid var(--glass-border);
    font-size: 12px;
    transition: all .2s;
    cursor: default;
}

.contributor-row:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.contributor-row.rank-1 {
    border-color: rgba(16, 185, 129, .35);
    background: rgba(16, 185, 129, .08);
}

.contributor-row.rank-2 {
    border-color: rgba(59, 130, 246, .25);
    background: rgba(59, 130, 246, .05);
}

.contributor-row.rank-3 {
    border-color: rgba(245, 158, 11, .22);
    background: rgba(245, 158, 11, .05);
}

.c-rank {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
    text-align: center;
}

.contributor-row.rank-1 .c-rank {
    color: var(--emerald);
}

.contributor-row.rank-2 .c-rank {
    color: var(--blue-ispu);
}

.contributor-row.rank-3 .c-rank {
    color: var(--amber);
}

.c-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.c-tenant {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.c-stack {
    font-size: 10px;
    color: var(--text-muted);
}

.c-pct {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* ── AQMS ── */
.receptor-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.aqms-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(16, 185, 129, .15);
    border: 1px solid rgba(16, 185, 129, .3);
    color: var(--emerald);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    margin-bottom: 4px;
}

.receptor-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.concentration {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.concentration .unit {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.tag-online {
    color: var(--emerald);
    font-weight: 600;
}

/* ═══════════════════════════════════════
   CENTER — MAP
   ═══════════════════════════════════════ */
.center-map {
    grid-area: map;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
}

#map-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.maplibregl-ctrl-bottom-left {
    display: none !important;
}

.maplibregl-ctrl-bottom-right {
    display: block !important;
    z-index: 5;
}

.maplibregl-ctrl-group {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1) !important;
}

.maplibregl-ctrl-group button {
    width: 32px !important;
    height: 32px !important;
}

.map-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    padding: 12px;
}

/* Pollutant chips */
.pollutant-toggles {
    position: absolute;
    top: 12px;
    left: 12px;
    pointer-events: auto;
    display: flex;
    gap: 4px;
    padding: 4px 6px;
}

.pollutant-chip {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 4px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
    outline: none;
}

.pollutant-chip.active {
    background: var(--primary);
    color: var(--bg-color);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(15, 61, 46, .3);
}

body.dark-theme .pollutant-chip.active {
    background: var(--emerald);
    color: #000;
    border-color: var(--emerald);
    box-shadow: 0 4px 12px rgba(16, 185, 129, .3);
}

.pollutant-chip:hover:not(.active) {
    border-color: var(--emerald);
    color: var(--emerald);
    transform: translateY(-1px);
}

/* Map actions */
.map-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 6px;
    pointer-events: auto;
}

.map-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    background: var(--glass-bg);
    transition: all .2s;
    outline: none;
}

.map-action-btn:hover,
.map-action-btn.active {
    border-color: var(--emerald);
    color: var(--emerald);
    box-shadow: var(--emerald-glow);
}

.map-action-btn.active span {
    color: var(--emerald);
}

.map-action-btn i {
    width: 16px;
    height: 16px;
    color: var(--text-primary);
}

.map-action-btn:hover i {
    color: var(--emerald);
}

/* Map bottom-left: Wind Rose + Meteo */
.map-bottom-left {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    pointer-events: auto;
    z-index: 5;
}

.wind-rose-container {
    padding: 2px;
    border-radius: 8px;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.map-meteo {
    pointer-events: auto;
    padding: 6px 10px;
    border-radius: 6px;
}

.meteo-mini-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.meteo-mini-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s;
}

.meteo-mini-icon {
    width: 12px;
    height: 12px;
    color: var(--emerald);
}

/* Animations for updates */
.meteo-value-update {
    animation: meteo-highlight 1.5s ease-out;
}

@keyframes meteo-highlight {
    0% {
        color: var(--emerald);
        transform: scale(1.1);
    }

    100% {
        color: var(--text-primary);
        transform: scale(1);
    }
}

#wind-arrow-group {
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: 60px 60px;
    /* Center of SVG */
}

/* ── CEMS Popup ── */
.cems-popup .maplibregl-popup-content {
    background: var(--glass-bg) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 10px !important;
    padding: 0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15) !important;
    overflow: hidden;
}

.cems-popup .maplibregl-popup-close-button {
    font-size: 16px;
    color: var(--text-secondary);
    right: 6px;
    top: 4px;
}

.cems-popup-content {
    padding: 12px 14px;
}

.cems-popup-header {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.cems-popup-tenant {
    font-size: 11px;
    font-weight: 600;
    color: var(--emerald);
}

.cems-popup-unit {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.cems-popup-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.cems-popup-param {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(148, 163, 184, .06);
    border-radius: 6px;
    padding: 6px 4px;
}

.cems-popup-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.cems-popup-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
}

.cems-popup-unit2 {
    font-size: 8px;
    color: var(--text-muted);
}

.cems-popup-status {
    text-align: center;
    font-size: 11px;
    padding-top: 4px;
    border-top: 1px solid var(--glass-border);
}

/* Legend — gradient style */
.map-legend {
    position: absolute;
    top: 56px;
    right: 12px;
    pointer-events: auto;
    padding: 10px 12px;
    width: 140px;
}

.map-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.map-title span {
    color: var(--emerald);
}

.legend-gradient {
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(to right, rgba(16, 185, 129, .4), rgba(245, 200, 0, .6), rgba(239, 100, 68, .9));
    margin-bottom: 3px;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ═══════════════════════════════════════
   RIGHT PANEL
   ═══════════════════════════════════════ */
.right-panel {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: var(--panel-gap);
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Kapasitas Card ── */
.kapasitas-summary {
    text-align: center;
    margin-bottom: 8px;
}

.kap-big-num {
    font-size: 56px;
    font-weight: 800;
    color: var(--emerald);
    line-height: 1;
    transition: all .4s;
    text-shadow: var(--emerald-glow);
}

.kap-pct {
    font-size: 24px;
    color: var(--text-secondary);
    font-weight: 400;
}

.kap-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.headroom-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hr-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.hr-label {
    width: 34px;
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
    font-size: 10px;
}

.hr-track {
    flex: 1;
    height: 6px;
    background: rgba(148, 163, 184, .15);
    border-radius: 3px;
    overflow: hidden;
}

.hr-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .8s ease;
}

.hr-fill.emerald {
    background: var(--emerald);
    box-shadow: 0 0 6px rgba(16, 185, 129, .4);
}

.hr-fill.amber {
    background: var(--amber);
}

.hr-fill.red {
    background: var(--red);
}

.hr-val {
    width: 30px;
    text-align: right;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* ── Chart Card ── */
.chart-card {
    flex: 0 0 auto;
}

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

.chart-tabs {
    display: flex;
    gap: 2px;
    background: rgba(148, 163, 184, .1);
    border-radius: 4px;
    padding: 2px;
}

.chart-tab {
    font-family: inherit;
    font-size: 9px;
    font-weight: 600;
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 3px;
    cursor: pointer;
    transition: all .2s;
    outline: none;
}

.chart-tab.active {
    background: var(--primary);
    color: #fff;
}

body.dark-theme .chart-tab.active {
    background: var(--text-primary);
    color: var(--bg-color);
}

.chart-container {
    width: 100%;
    height: 110px;
    position: relative;
    border-bottom: 1px solid rgba(148, 163, 184, .2);
    border-left: 1px solid rgba(148, 163, 184, .2);
    margin-top: 5px;
}

.chart-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.chart-legend-dot.emerald {
    background: var(--emerald);
}

.chart-legend-dot.amber {
    background: var(--amber);
}

.chart-legend-dot.blue {
    background: var(--blue-ispu);
}

/* ── Warning Panel ── */
.warning-panel {
    border-left: 4px solid var(--text-muted);
}

.warning-panel h2 {
    color: var(--text-secondary);
}

.alert-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.alert-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 10px;
    border-left: 3px solid var(--text-muted);
    border-radius: 0 4px 4px 0;
}

.alert-item i {
    flex-shrink: 0;
    margin-top: 2px;
    width: 16px;
    height: 16px;
}

.alert-text {
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-primary);
    font-weight: 400;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
.bottom-footer {
    grid-area: footer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.bottom-footer .footer-note strong {
    color: var(--emerald);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════ */
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
    width: 4px;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .3);
    border-radius: 2px;
}

/* ═══════════════════════════════════════
   Dispersion Popup
   ═══════════════════════════════════════ */
.disperse-popup .maplibregl-popup-content {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}

.disperse-popup .maplibregl-popup-tip {
    border-top-color: var(--glass-bg);
}

.popup-content {
    font-size: 12px;
    line-height: 1.5;
}

.popup-content strong {
    color: var(--emerald);
    font-weight: 700;
}

/* ── CEMS Card ── */
.cems-stack-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cems-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(148, 163, 184, .04);
    border: 1px solid var(--glass-border);
    font-size: 11px;
    transition: all .2s;
}

.cems-row:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.cems-compliant {
    border-left: 3px solid var(--emerald);
}

.cems-attention {
    border-left: 3px solid var(--amber);
    background: rgba(245, 158, 11, .04);
}

.cems-stack-id {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    color: var(--text-primary);
    width: 56px;
    flex-shrink: 0;
}

.cems-params {
    flex: 1;
    display: flex;
    gap: 8px;
    font-size: 10px;
    color: var(--text-secondary);
}

.cems-params b {
    color: var(--text-primary);
    font-weight: 700;
    margin-left: 2px;
}

.cems-badge-ok {
    color: var(--emerald);
    flex-shrink: 0;
}

.cems-badge-warn {
    color: var(--amber);
    flex-shrink: 0;
}

/* AQMS Marker */
.aqms-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.aqms-marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--emerald);
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 8px rgba(16, 185, 129, .6);
    animation: pulse 2s infinite;
}

.aqms-marker-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 3px;
    white-space: nowrap;
    border: 1px solid var(--glass-border);
}

/* Kap Estimate */
.kap-estimate {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    line-height: 1.4;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════
   AQMS DOT MARKERS
   ═══════════════════════════════════════ */
.aqms-dot-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s;
}

.aqms-dot-marker:hover {
    transform: scale(1.15);
    z-index: 20;
}

.aqms-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10B981, #059669);
    border: 2px solid var(--bg-color, #fff);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.aqms-dot-label {
    font-size: 9px;
    font-weight: 800;
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(6px);
    padding: 1px 5px;
    border-radius: 4px;
    margin-top: 3px;
    white-space: nowrap;
    border: 1px solid var(--glass-border);
    letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════
   LAYER CONTROL POPUP
   ═══════════════════════════════════════ */
.layer-control-popup {
    position: absolute;
    top: 50px;
    right: 10px;
    z-index: 50;
    display: none;
}

.layer-control-popup.open {
    display: block;
    animation: popupSlideIn 0.25s ease;
}

.layer-popup-inner {
    padding: 12px 14px;
    border-radius: 12px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.layer-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.layer-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-popup-close:hover {
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.15);
}

.layer-popup-close svg {
    width: 14px;
    height: 14px;
}

.layer-panel-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin: 0;
}

.layer-toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.layer-toggle {
    width: 16px;
    height: 16px;
    accent-color: var(--emerald);
    cursor: pointer;
}

.layer-toggle-label {
    font-weight: 500;
}

/* ═══════════════════════════════════════
   CHART PARAM CHIPS & EXPAND
   ═══════════════════════════════════════ */
.chart-param-chips {
    display: flex;
    gap: 4px;
    padding: 4px 0 6px;
    flex-wrap: wrap;
}

.chart-param-chip {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1.5px solid var(--glass-border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.chart-param-chip:hover {
    border-color: var(--chip-color, var(--text-secondary));
    color: var(--text-primary);
}

.chart-param-chip.active {
    background: var(--chip-color, var(--emerald));
    border-color: var(--chip-color, var(--emerald));
    color: #fff;
}

.chart-expand-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.chart-expand-btn:hover {
    color: var(--emerald);
}

.chart-expand-btn svg {
    width: 14px;
    height: 14px;
}

/* ═══════════════════════════════════════
   CHART POPUP OVERLAY
   ═══════════════════════════════════════ */
.chart-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.chart-popup-overlay.open {
    display: flex;
}

.chart-popup-content {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    border-radius: 16px;
    animation: popupSlideIn 0.3s ease;
}

.chart-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chart-popup-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
}

.chart-popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.chart-popup-close:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.chart-popup-close svg {
    width: 18px;
    height: 18px;
}

.chart-popup-download {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--emerald);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.chart-popup-download:hover {
    background: var(--emerald-dark, #059669);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.chart-popup-download svg {
    width: 14px;
    height: 14px;
}

.chart-popup-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.popup-tabs {
    flex-shrink: 0;
}

.popup-chips {
    flex: 1;
}

@keyframes popupSlideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

/* ═══════════════════════════════════════
   ENHANCED AQMS MARKERS
   ═══════════════════════════════════════ */
.aqms-marker-enhanced {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: stackLabelFloat 4s ease-in-out infinite;
}

.aqms-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #10B981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.aqms-label-float {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 3px 8px;
    display: flex;
    flex-direction: column;
}

.aqms-label-name {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-primary);
}

.aqms-label-ispu {
    font-size: 8px;
    font-weight: 700;
}

/* ═══════════════════════════════════════
   DARK MODE MAP BUTTONS FIX
   ═══════════════════════════════════════ */
.dark-theme .map-action-btn {
    background: rgba(30, 41, 59, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #e2e8f0 !important;
}

.dark-theme .map-action-btn:hover {
    background: rgba(51, 65, 85, 0.95) !important;
    color: #f8fafc !important;
}

.dark-theme .layer-popup-inner {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* ═══════════════════════════════════════
   LOADING SCREEN
   ═══════════════════════════════════════ */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0F3D2E 0%, #0F172A 50%, #1E293B 100%);
    transition: opacity 0.5s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    animation: fadeIn 0.6s ease;
}

.loading-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(16, 185, 129, 0.4));
    animation: pulse 2s ease-in-out infinite;
}

.loading-title {
    font-size: 24px;
    font-weight: 800;
    color: #F8FAFC;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.loading-sub {
    font-size: 12px;
    color: #94A3B8;
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}

.loading-bar {
    width: 200px;
    height: 3px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-bar-fill {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #10B981, #3B82F6, #10B981);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: loadingSlide 1.5s ease-in-out infinite;
}

@keyframes loadingSlide {
    0% {
        transform: translateX(-100%);
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 0%;
    }

    100% {
        transform: translateX(350%);
        background-position: 0% 0%;
    }
}

/* ═══════════════════════════════════════
   MOBILE MENU BUTTON (hidden on desktop)
   ═══════════════════════════════════════ */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mobile-menu-btn i {
    width: 20px;
    height: 20px;
}

.mobile-menu-btn.active {
    background: var(--emerald);
    color: #fff;
    border-color: var(--emerald);
}

/* ═══════════════════════════════════════
   MOBILE OVERLAY
   ═══════════════════════════════════════ */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-overlay.open {
    opacity: 1;
}

/* ═══════════════════════════════════════
   MOBILE PANEL DRAWER
   ═══════════════════════════════════════ */
.mobile-panel-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 70vh;
    overflow: hidden;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.mobile-panel-drawer.open {
    transform: translateY(0);
}

.mobile-drawer-header {
    padding: 12px 16px 0;
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    background: var(--glass-bg);
    z-index: 2;
}

.mobile-drawer-header::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto 12px;
    opacity: 0.4;
}

.mobile-tabs {
    display: flex;
    gap: 4px;
}

.mobile-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    border-radius: 0;
}

.mobile-tab i {
    width: 14px;
    height: 14px;
}

.mobile-tab.active {
    color: var(--emerald);
    border-bottom-color: var(--emerald);
}

.mobile-drawer-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 24px;
    max-height: calc(70vh - 80px);
}

.mobile-panel-section {
    display: none;
}

.mobile-panel-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.mobile-ispu-quick {
    padding: 12px;
    margin-bottom: 12px;
}

.mobile-card-group {
    margin-bottom: 16px;
}

.mobile-section-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════
   RESPONSIVE — TABLET (768px – 1024px)
   ═══════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 769px) {
    :root {
        --left-w: 260px;
        --right-w: 280px;
        --panel-gap: 8px;
        --header-h: 50px;
    }

    .brand-text h1 {
        font-size: 14px;
    }

    .brand-sub {
        font-size: 9px;
    }

    .logo-img {
        height: 28px;
    }

    .controls {
        gap: 8px;
    }

    .glass-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .live-badge {
        padding: 3px 10px 3px 8px;
        font-size: 10px;
    }

    .timestamp {
        font-size: 10px;
    }

    .ispu-num {
        font-size: 38px;
    }

    .ispu-category {
        font-size: 20px;
    }

    .kap-big-num {
        font-size: 44px;
    }

    .pollutant-chip {
        padding: 4px 9px;
        font-size: 10px;
    }

    .wind-rose-container {
        width: 80px;
        height: 80px;
    }

    .map-meteo {
        padding: 5px 8px;
    }

    .meteo-mini-row {
        gap: 8px;
    }

    .meteo-mini-item {
        font-size: 9px;
    }
}

/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE (<769px)
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --header-h: 48px;
        --footer-h: 0px;
        --panel-gap: 0px;
    }

    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
        /* Safe area for notched devices */
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }

    .app-container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        padding: 0;
        gap: 0;
    }

    /* Hide desktop panels on mobile */
    .left-panel,
    .right-panel {
        display: none !important;
    }

    .bottom-footer {
        display: none;
    }

    /* Show mobile elements */
    .mobile-menu-btn {
        display: flex;
    }

    .mobile-panel-drawer,
    .mobile-overlay {
        display: block;
    }

    /* ── Header Mobile ── */
    .top-bar {
        border-radius: 0;
        padding: 0 12px;
        min-height: 48px;
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .brand {
        gap: 8px;
    }

    .logo-img {
        height: 24px;
    }

    .brand-text h1 {
        font-size: 13px;
    }

    .brand-sub {
        display: none;
    }

    .controls {
        gap: 6px;
    }

    .map-style-control {
        padding: 4px 6px;
        font-size: 10px;
    }

    .map-style-control select {
        font-size: 10px;
        max-width: 60px;
    }

    .map-style-control i {
        display: none;
    }

    .glass-btn {
        padding: 6px 8px;
    }

    .glass-btn i {
        width: 16px;
        height: 16px;
    }

    .live-badge {
        display: none;
    }

    .timestamp {
        font-size: 10px;
    }

    /* ── Map Mobile ── */
    .center-map {
        border-radius: 0;
        flex: 1;
        min-height: 55vh;
        min-height: 55dvh;
    }

    /* Pollutant toggles — horizontal scroll on mobile */
    .pollutant-toggles {
        top: 8px;
        left: 8px;
        right: 8px;
        padding: 3px 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
    }

    .pollutant-toggles::-webkit-scrollbar {
        display: none;
    }

    .pollutant-chip {
        padding: 6px 10px;
        font-size: 11px;
        flex-shrink: 0;
        min-height: 32px;
    }

    /* Map actions */
    .map-actions {
        top: 8px;
        right: 8px;
    }

    .map-action-btn {
        width: 36px;
        height: 36px;
    }

    /* Legend — compact mobile */
    .map-legend {
        top: 48px;
        right: 8px;
        width: 110px;
        padding: 6px 8px;
    }

    .map-title {
        font-size: 9px;
    }

    /* Wind rose + Meteo — stack vertically on small screens */
    .map-bottom-left {
        bottom: 8px;
        left: 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .wind-rose-container {
        width: 72px;
        height: 72px;
    }

    .map-meteo {
        padding: 5px 8px;
    }

    .meteo-mini-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .meteo-mini-item {
        font-size: 9px;
    }

    /* Expanded map on mobile */
    .app-container.map-expanded .center-map {
        min-height: 100vh;
        min-height: 100dvh;
    }
}

/* ═══════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (<400px)
   ═══════════════════════════════════════ */
@media (max-width: 400px) {
    .brand-text h1 {
        font-size: 12px;
    }

    .timestamp {
        display: none;
    }

    .pollutant-chip {
        padding: 5px 8px;
        font-size: 10px;
    }

    .mobile-tab {
        font-size: 10px;
        padding: 8px 4px;
    }

    .mobile-tab i {
        display: none;
    }

    .wind-rose-container {
        width: 60px;
        height: 60px;
    }
}

/* ═══════════════════════════════════════
   LANDSCAPE MOBILE
   ═══════════════════════════════════════ */
@media (max-height: 500px) and (max-width: 900px) {
    .center-map {
        min-height: 80vh;
    }

    .mobile-panel-drawer {
        max-height: 50vh;
    }

    .map-bottom-left {
        flex-direction: row;
    }
}

/* ═══════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════ */
@media print {

    .loading-screen,
    .mobile-panel-drawer,
    .mobile-overlay,
    .mobile-menu-btn {
        display: none !important;
    }

    body {
        overflow: visible;
        height: auto;
    }
}