/* Peringatan Dini Kualitas Udara (/publik/ews).
   Layout kiosk layar penuh mengikuti pola dashboard kualitas udara:
   topbar gelap / toolbar / [rel parameter | peta penuh] / footer tipis.
   Warna memakai variabel app.css sehingga tema terang/gelap ikut otomatis. */

.ews-shell {
    height: 100vh;
    height: 100dvh;
    display: grid;
     grid-template-columns: 360px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
        "topbar  topbar"
        "toolbar toolbar"
        "rail    map"
        "foot    foot";
    overflow: hidden;
    max-width: 100%;
    background: var(--bg-color);
    color: var(--text-color);
}

.ews-shell.ews-rail-collapsed { grid-template-columns: 0 minmax(0, 1fr); }

/* ============================================================
   TOPBAR
   ============================================================ */
.ews-topbar {
    grid-area: topbar;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    padding: 0.55rem 1.25rem;
    background: linear-gradient(120deg, #0b1220 0%, #0f172a 55%, #13233d 100%);
    color: #fff;
    border-bottom: 3px solid var(--primary-color);
}

.ews-brand { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }

.ews-logo-link { flex-shrink: 0; border-radius: 12px; transition: transform 0.12s ease; }
.ews-logo-link:hover { transform: scale(1.05); }

.ews-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    padding: 3px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    flex-shrink: 0;
}

.ews-brand-text { min-width: 0; }
.ews-org {
    font-size: 0.62rem;
    letter-spacing: 0.09em;
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ews-title {
    font-size: 1.16rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ews-experimental-pill {
    display: inline-flex;
    vertical-align: middle;
    margin-left: 0.35rem;
    padding: 0.16rem 0.42rem;
    border: 1px solid rgba(125, 211, 252, 0.5);
    border-radius: 999px;
    color: #bae6fd;
    background: rgba(14, 116, 144, 0.35);
    font-size: 0.5rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
}
.ews-sub {
    font-size: 0.7rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ews-topnav { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.ews-topnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ews-topnav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.42);
    color: #fff;
}
.ews-topnav-link svg { width: 15px; height: 15px; }

.ews-topbar-right { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }

.ews-clock { text-align: right; line-height: 1.15; }
.ews-clock-time { font-size: 1.32rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.ews-clock-date { font-size: 0.72rem; color: rgba(255, 255, 255, 0.72); }

.ews-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--input-border, #d1d5db);
    border-radius: 10px;
    background: var(--card-bg, #ffffff);
    color: var(--text-color, #ffffff);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.ews-icon-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.ews-icon-btn:active { transform: scale(0.94); }
.ews-icon-btn:disabled { opacity: 0.45; cursor: default; }
.ews-icon-btn svg { width: 18px; height: 18px; }
.ews-icon-btn.is-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* Topbar button tinggal di bar gelap → gaya gelap. */
.ews-topbar .ews-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff !important;
}
.ews-topbar .ews-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff !important;
}
.ews-topbar .ews-icon-btn svg { stroke: currentColor; }

/* ============================================================
   TOOLBAR — dua zona eksplisit:
   1. primary  : status chip + metrik + provenance
   2. actions  : kontrol lapisan peta + legenda/muat ulang
   Pemisahan ini mencegah provenance membungkus liar dan menjaga tombol
   muat ulang tetap di kanan (sebelumnya terdampar di baris sendiri).
   ============================================================ */
.ews-toolbar {
    grid-area: toolbar;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.45rem 1.25rem;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    min-width: 0;
}

.ews-toolbar-zone { display: flex; align-items: center; min-width: 0; }
.ews-toolbar-primary { gap: 0.4rem 1rem; flex-wrap: wrap; flex: 1 1 auto; }
.ews-toolbar-actions { gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.ews-toolbar-tools { display: flex; align-items: center; gap: 0.3rem; }

/* Segmented control untuk toggle lapisan peta. */
.ews-seg {
    display: inline-flex;
    align-items: stretch;
    gap: 2px;
    padding: 2px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.ews-seg::-webkit-scrollbar { display: none; }

.ews-seg-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.6rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.ews-seg-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.ews-seg-btn:hover { background: var(--header-bg); color: var(--text-color); }
.ews-seg-btn:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.ews-seg-btn:disabled { opacity: 0.5; cursor: progress; }
.ews-seg-btn.is-active {
    background: var(--primary-color);
    color: #fff;
}
.ews-seg-btn.is-active:hover { background: var(--primary-color); color: #fff; }

.ews-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    color: #14532d;
    background: #dcfce7;
    border: 1px solid #86efac;
}
.ews-status-chip.ews-status-warning { color: #7f1d1d; background: #fee2e2; border-color: #fca5a5; }
.ews-status-chip.ews-status-degraded { color: #78350f; background: #fef3c7; border-color: #fcd34d; }
.ews-status-chip.ews-status-insufficient_data { color: #334155; background: #e2e8f0; border-color: #cbd5e1; }

.ews-pulse {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    animation: ews-pulse 2.2s ease-in-out infinite;
}
@keyframes ews-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.82); }
}
@media (prefers-reduced-motion: reduce) {
    .ews-pulse { animation: none; }
}

.ews-toolbar-facts { display: flex; align-items: center; gap: 0.4rem 1rem; flex-wrap: wrap; }
.ews-fact { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; }
.ews-fact strong { color: var(--text-color); font-variant-numeric: tabular-nums; }

.ews-toolbar-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 0;
}
.ews-toolbar-sep { width: 1px; height: 14px; background: var(--border-color); flex-shrink: 0; }
.ews-toolbar-refresh { width: 32px; height: 32px; }
.ews-toolbar-refresh.is-loading svg { animation: ews-spin 0.9s linear infinite; }
@keyframes ews-spin { to { transform: rotate(360deg); } }

/* ============================================================
   RAIL PARAMETER
   ============================================================ */
.ews-rail {
    grid-area: rail;
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: var(--header-bg);
    border-right: 1px solid var(--border-color);
    transition: opacity 0.2s ease;
}
.ews-shell.ews-rail-collapsed .ews-rail { opacity: 0; pointer-events: none; }

.ews-rail-scroll {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Tombol ciutkan rel hidup di KOLOM SENDIRI (railtog), bukan di dalam
   area rel. Dengan begitu tombol tetap terlihat dan dapat diklik pada
   keadaan ciut maupun bentang — memperbaiki bug tombol yang hilang. */
.ews-rail-toggle {
    position: absolute;
    left: 0.6rem;
    top: 0.6rem;
    z-index: 1;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ews-map-controls {
    position: absolute;
    inset: 0;
    z-index: 700;
    overflow: hidden;
    pointer-events: none;
}
.ews-map-controls > .ews-rail-toggle { display: inline-flex; pointer-events: auto; }
.ews-rail-toggle:hover { color: var(--primary-color); border-color: var(--primary-color); }
.ews-rail-toggle svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.ews-shell.ews-rail-collapsed .ews-rail-toggle svg { transform: rotate(180deg); }

/* Kartu rail */
.ews-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
}

.ews-card-hero {
    background: linear-gradient(140deg, var(--card-bg) 0%, var(--card-bg-alt, #f8fafc) 100%);
    border-left: 4px solid #16a34a;
}
.ews-card-hero.ews-status-warning { border-left-color: #dc2626; }
.ews-card-hero.ews-status-degraded { border-left-color: #d97706; }
.ews-card-hero.ews-status-insufficient_data { border-left-color: #64748b; }

.ews-alert-summary {
    position: relative;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
    transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.ews-alert-summary:hover, .ews-alert-summary:focus-visible {
    transform: translateY(-2px);
    background: var(--card-bg-alt, #f8fafc);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
    outline: 2px solid color-mix(in srgb, var(--primary-color) 55%, transparent);
    outline-offset: 2px;
}
.ews-param-hint {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.28rem;
    color: var(--primary-color);
    font-size: 0.58rem;
    font-weight: 700;
}
.ews-param-hint svg { width: 11px; height: 11px; }

.ews-alert-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.12), rgba(245, 158, 11, 0.08));
}
.ews-alert-hero h3 { margin: 0.18rem 0 0.25rem; font-size: 1.1rem; }
.ews-alert-hero p { margin: 0; color: var(--text-muted); font-size: 0.76rem; line-height: 1.5; }
.ews-alert-orb {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 50%;
    color: #fff;
    background: #dc2626;
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.12);
    font-size: 1.35rem;
    font-weight: 900;
}
.ews-alert-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.45rem; margin: 0.8rem 0; }
.ews-alert-detail-grid .ews-proof-item { min-height: 3.3rem; }
.ews-alert-section { margin-top: 0.9rem; }
.ews-alert-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; }
.ews-alert-tag { padding: 0.32rem 0.5rem; border-radius: 999px; color: #991b1b; background: rgba(220, 38, 38, 0.1); font-size: 0.66rem; font-weight: 700; }
.ews-recommendation-list { display: grid; gap: 0.5rem; margin: 0.45rem 0 0; padding: 0; list-style: none; }
.ews-recommendation-list li { position: relative; padding: 0.55rem 0.65rem 0.55rem 1.8rem; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-color); font-size: 0.76rem; line-height: 1.45; }
.ews-recommendation-list li::before { content: "✓"; position: absolute; left: 0.65rem; color: #dc2626; font-weight: 900; }
.ews-modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; margin-left: auto; flex: 0 0 auto; }
.ews-modal-actions .ews-icon-btn,
.ews-modal-actions .btn-close { flex: 0 0 32px; width: 32px; height: 32px; }
.ews-modal-actions .btn-close { box-sizing: border-box; margin: 0; padding: 0.5rem; }
.ews-alert-action-feedback { min-height: 0; padding: 0 1rem; color: var(--primary-color); font-size: 0.68rem; font-weight: 700; }
.ews-trigger-signal-list { display: grid; gap: 0.45rem; margin-top: 0.45rem; }
.ews-trigger-signal { padding: 0.6rem 0.7rem; border: 1px solid var(--border-color); border-left: 3px solid #94a3b8; border-radius: 8px; background: var(--card-bg-alt, #f8fafc); }
.ews-trigger-signal-on { border-left-color: #dc2626; background: rgba(220, 38, 38, 0.06); }
.ews-trigger-signal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ews-trigger-signal-head strong { font-size: 0.72rem; }
.ews-trigger-signal-rule, .ews-trigger-signal-proof { margin: 0.28rem 0 0; color: var(--text-muted); font-size: 0.68rem; line-height: 1.4; }
.ews-recommendation-tabs { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.45rem 0 0.55rem; scrollbar-width: thin; }
.ews-recommendation-tab { flex: 0 0 auto; padding: 0.38rem 0.58rem; border: 1px solid var(--border-color); border-radius: 999px; color: var(--text-muted); background: transparent; font: inherit; font-size: 0.66rem; font-weight: 800; cursor: pointer; }
.ews-recommendation-tab:hover, .ews-recommendation-tab:focus-visible { color: var(--primary-color); border-color: var(--primary-color); outline: none; }
.ews-recommendation-tab.is-active { color: #fff; border-color: var(--primary-color); background: var(--primary-color); }
.ews-recommendation-panel { padding-top: 0.55rem; }
.ews-recommendation-panel h4 { margin: 0; font-size: 0.82rem; }
.ews-recommendation-panel[hidden] { display: none; }

.ews-card-label {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ews-hero-value {
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0.3rem 0 0.2rem;
}
.ews-hero-copy { font-size: 0.76rem; color: var(--text-muted); margin: 0 0 0.7rem; }

.ews-param-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}
.ews-param {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}
.ews-param-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ews-param-value {
    font-size: 1.12rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ews-param-unit { font-size: 0.62rem; color: var(--text-muted); }
.ews-param-source {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted-color);
    font-size: 0.62rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.ews-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}
.ews-card-title { font-size: 0.85rem; font-weight: 800; margin: 0; }

.ews-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: var(--card-bg-alt, #f1f5f9);
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ews-badge-run { font-variant-numeric: tabular-nums; }

/* Kondisi pemicu */
.ews-trigger-list, .ews-alert-list, .ews-history, .ews-threshold-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ews-trigger {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    background: var(--card-bg-alt, #f8fafc);
    min-width: 0;
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: inherit;
    font: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.ews-trigger:hover, .ews-trigger:focus-visible { border-color: var(--primary-color); background: var(--card-bg); transform: translateY(-1px); outline: none; }
.ews-trigger-title { font-size: 0.75rem; font-weight: 700; line-height: 1.3; }
.ews-trigger-detail { font-size: 0.66rem; color: var(--text-muted); }

.ews-pill {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}
.ews-pill-on { color: #7f1d1d; background: #fee2e2; }
.ews-pill-off { color: #14532d; background: #dcfce7; }
.ews-pill-muted { color: #475569; background: #e2e8f0; }

.ews-trigger-modal .modal-header { border-bottom: 1px solid var(--border-color); }
.ews-trigger-modal .modal-title { font-size: 1rem; font-weight: 800; margin-top: 0.2rem; }
.ews-kicker { color: var(--primary-color); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.ews-proof-status { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--card-bg-alt, #f8fafc); }
.ews-proof-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin-top: 0.75rem; }
.ews-proof-item { padding: 0.65rem; border: 1px solid var(--border-color); border-radius: 8px; }
.ews-proof-label { display: block; color: var(--text-muted); font-size: 0.65rem; }
.ews-proof-value { display: block; font-size: 0.78rem; font-weight: 700; margin-top: 0.2rem; }
.ews-proof-list { margin: 0.75rem 0 0; padding-left: 1.1rem; font-size: 0.75rem; line-height: 1.55; }
.ews-proof-note { color: var(--text-muted); font-size: 0.7rem; margin: 0.75rem 0 0; }
.ews-forecast-hourly-list { display: grid; gap: 0.35rem; margin-top: 0.75rem; }
.ews-forecast-hourly-row { display: grid; grid-template-columns: 3.8rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--border-color); font-size: 0.75rem; }
.ews-forecast-hourly-row span { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ews-forecast-hourly-row strong { font-variant-numeric: tabular-nums; }
.ews-forecast-hourly-row small { color: var(--text-muted); text-align: right; }

/* Peringatan aktif */
.ews-alert {
    display: block;
    width: 100%;
    border: 1px solid #fca5a5;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    background: #fef2f2;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ews-alert:hover, .ews-alert:focus-visible { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(127, 29, 29, 0.14); outline: 2px solid rgba(220, 38, 38, 0.35); outline-offset: 2px; }
[data-theme="dark"] .ews-alert { background: rgba(220, 38, 38, 0.12); border-color: rgba(248, 113, 113, 0.4); }
.ews-alert-level {
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b91c1c;
}
[data-theme="dark"] .ews-alert-level { color: #fca5a5; }
.ews-alert p { font-size: 0.74rem; margin: 0.35rem 0 0; line-height: 1.45; }
.ews-alert time { font-size: 0.66rem; color: var(--text-muted); }

/* Grafik & prakiraan */
.ews-chart-wrap { position: relative; height: 132px; }
.ews-forecast-days {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.55rem;
}
.ews-forecast-day {
    background: var(--card-bg-alt, #f8fafc);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.42rem 0.48rem;
    font-size: 0.6rem;
    color: var(--text-muted);
    min-width: 0;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.ews-forecast-day:hover, .ews-forecast-day:focus-visible { border-color: var(--primary-color); transform: translateY(-1px); outline: none; }
.ews-forecast-day-top { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; color: var(--text-muted); }
.ews-forecast-day-top b { color: var(--primary-color); font-size: 0.7rem; letter-spacing: 0.04em; }
.ews-forecast-day-top em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ews-forecast-day strong {
    display: block;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-color);
    margin-top: 0.1rem;
}
.ews-forecast-day strong small { font-size: 0.6rem; font-weight: 600; color: var(--text-muted); }
.ews-forecast-day-action { display: block; color: var(--text-muted); font-size: 0.55rem; margin-top: 0.12rem; }
.ews-forecast-detail-chart-wrap { height: 220px; margin-top: 0.75rem; }
.ews-forecast-day.is-exceedance { border-color: #fca5a5; background: #fef2f2; }
[data-theme="dark"] .ews-forecast-day.is-exceedance { background: rgba(220, 38, 38, 0.12); }

/* Ambang batas */
.ews-threshold {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border-color);
}
.ews-threshold:last-child { border-bottom: 0; }
.ews-threshold-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(15, 23, 42, 0.18);
}
.ews-threshold-label { font-weight: 700; }
.ews-threshold-range { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Riwayat */
.ews-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.32rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.64rem;
    width: 100%;
    border-top: 0;
    border-left: 0;
    border-right: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, padding 0.15s ease;
}
.ews-history-row:hover, .ews-history-row:focus-visible { background: var(--card-bg-alt, #f8fafc); outline: none; padding-left: 0.25rem; padding-right: 0.25rem; }
.ews-history { max-height: 9.7rem; overflow-y: auto; scrollbar-width: thin; }
.ews-history-row:last-child { border-bottom: 0; }
.ews-history-main, .ews-history-side { min-width: 0; display: flex; flex-direction: column; gap: 0.12rem; }
.ews-history-side { align-items: flex-end; text-align: right; }
.ews-history-time {
    color: var(--text-muted);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ews-history-detail, .ews-history-sources { color: var(--text-muted); font-size: 0.56rem; line-height: 1.3; }
.ews-history-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 0.16rem 0.38rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.55rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}
.ews-history-status.ews-status-warning { color: #b91c1c; background: rgba(220, 38, 38, 0.12); }
.ews-history-status.ews-status-degraded { color: #b45309; background: rgba(245, 158, 11, 0.13); }
.ews-history-status.ews-status-normal { color: #15803d; background: rgba(22, 163, 74, 0.12); }
.ews-history-status.ews-status-insufficient_data { color: #475569; background: rgba(100, 116, 139, 0.12); }
.ews-history-row { border-radius: 8px; }
.ews-history-row:hover .ews-history-time, .ews-history-row:focus-visible .ews-history-time { color: var(--primary-color); }

.ews-card-note { font-size: 0.68rem; color: var(--text-muted); margin: 0.5rem 0 0; line-height: 1.5; }
.ews-card-source .ews-card-label { display: block; margin-bottom: 0.25rem; }

/* ============================================================
   RISIKO KEBAKARAN
   ============================================================ */
.ews-fire-headline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}
.ews-fire-level {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}
.ews-fire-score {
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.ews-fire-facts {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.ews-fire-subtitle {
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0.35rem 0 0.25rem;
}
.ews-fire-list { display: flex; flex-direction: column; gap: 0.2rem; }
.ews-fire-row {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    padding: 0.22rem 0;
    border-bottom: 1px solid var(--border-color);
}
.ews-fire-row:last-child { border-bottom: 0; }
.ews-fire-dot { width: 10px; height: 10px; border-radius: 3px; }
.ews-fire-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ews-fire-score-sm { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ============================================================
   PEMUTAR PRAKIRAAN (rel)
   ============================================================ */
.ews-fc-playback {
    margin-top: 0.65rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-color);
}
.ews-fc-playback-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.ews-fc-playback-row .ews-icon-btn { width: 30px; height: 30px; }
.ews-fc-time {
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-color);
}
.ews-fc-slider { width: 100%; accent-color: var(--primary-color); }

/* Stub wajib map-forecast.js — harus ada di DOM agar modul tidak keluar
   diam-diam, tetapi tidak boleh tampil (kontrol nyata ada di toolbar). */
.ews-fc-stubs { display: none !important; }

.ews-legend-foot {
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.62rem;
    color: var(--text-muted);
}

.ews-empty { font-size: 0.72rem; color: var(--text-muted); padding: 0.35rem 0; }

/* ============================================================
   PETA
   ============================================================ */
.ews-map-stage {
    grid-area: map;
    position: relative;
    min-width: 0;
    overflow: hidden;
}
.ews-map { position: absolute; inset: 0; background: #dfe8eb; }
.ews-map-overlay-layer {
    position: absolute;
    inset: 0;
    z-index: 600;
    overflow: hidden;
    pointer-events: none;
}
.ews-map-overlay-layer > * { pointer-events: none; }
.ews-map-banner,
.ews-map-tools,
.ews-legend,
.ews-map-note { pointer-events: auto; }

.ews-map-banner {
    position: absolute;
    top: 0.85rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #14532d;
    border: 1px solid #86efac;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
    max-width: min(90%, 460px);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ews-map-banner:hover:not(:disabled), .ews-map-banner:focus-visible:not(:disabled) { transform: translateX(-50%) translateY(-2px); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24); outline: 2px solid rgba(220, 38, 38, 0.35); outline-offset: 2px; }
.ews-map-banner:disabled { cursor: default; }
.ews-map-banner strong { display: block; font-size: 0.82rem; line-height: 1.2; }
.ews-map-banner small { font-size: 0.66rem; color: #475569; }
.ews-map-banner.ews-status-warning { color: #7f1d1d; border-color: #fca5a5; background: rgba(254, 242, 242, 0.97); }
.ews-map-banner.ews-status-degraded { color: #78350f; border-color: #fcd34d; background: rgba(255, 251, 235, 0.97); }
.ews-map-banner.ews-status-insufficient_data { color: #334155; border-color: #cbd5e1; background: rgba(248, 250, 252, 0.97); }

.ews-map-tools {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.ews-map-tools .ews-icon-btn {
    background: var(--card-bg, #fff);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
}

.ews-legend {
    position: absolute;
    left: 0.85rem;
    bottom: 2.4rem;
    z-index: 500;
    width: 200px;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
}
.ews-legend[hidden] { display: none; }
.ews-legend-title {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}
.ews-legend-title span { font-weight: 600; text-transform: none; }
.ews-legend-items { display: flex; flex-direction: column; gap: 0.25rem; }
.ews-legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.7rem;
}
.ews-legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.25);
    flex-shrink: 0;
}
.ews-legend-range { margin-left: auto; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.ews-map-note {
    position: absolute;
    left: 0.85rem;
    bottom: 0.6rem;
    z-index: 500;
    margin: 0;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    font-size: 0.64rem;
}
[data-theme="dark"] .ews-map-note { background: rgba(15, 23, 42, 0.82); color: #cbd5e1; }

/* Popup/tooltip wilayah dan risiko memakai kerangka kartu popup yang sama
   dengan dashboard-ku (map.css). Aturan ini hanya mengatur detail EWS. */
.ews-area-tooltip {
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 7px;
    background: var(--card-bg, #fff);
    color: var(--text-color, #0f172a);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
    font-size: 0.72rem;
    font-weight: 700;
}
.ews-area-tooltip::before { border-top-color: var(--card-bg, #fff); }
[data-theme="dark"] .ews-area-tooltip {
    border-color: #475569;
    background: #1e293b;
    color: #f1f5f9;
}
[data-theme="dark"] .ews-area-tooltip::before { border-top-color: #1e293b; }

.ews-area-popup-container .leaflet-popup-content,
.ews-fire-popup-container .leaflet-popup-content { min-width: 210px; }
.ews-area-popup .aq-hero-area { background: var(--card-bg-alt, #f1f5f9); }
.ews-area-popup .aq-hero-value { font-size: 1rem; letter-spacing: 0; }
.ews-area-popup .aq-hero-label,
.ews-fire-popup .aq-hero-label { font-size: 0.68rem; }
.ews-fire-popup .hotspot-details > div,
.ews-area-popup .hotspot-details > div { margin-bottom: 0.2rem; }
.ews-fire-popup .aq-hero { border-radius: 10px; }

/* Marker kategori — cincin putih agar terbaca di atas citra peta. */
.ews-marker { background: transparent; border: 0; }
.ews-marker span {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
}

/* ============================================================
   FOOTER
   ============================================================ */
.ews-foot {
    grid-area: foot;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.35rem 1.25rem;
    background: var(--header-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ============================================================
   RESPONSIF
   ============================================================ */
@media (max-width: 1200px) {
    .ews-shell { grid-template-columns: 320px minmax(0, 1fr); }
    .ews-shell.ews-rail-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
    .ews-toolbar { flex-wrap: wrap; }
    .ews-toolbar-primary { flex: 1 1 100%; }
    .ews-toolbar-actions { flex: 1 1 100%; justify-content: space-between; }
}

@media (max-width: 992px) {
    .ews-topnav { display: none; }

    /* Tablet & ponsel: rel tidak lagi berdampingan dengan peta. Disusun
       bertumpuk di atas peta agar tidak perlu positioning absolut dan
       parameter tetap terbaca tanpa menutupi peta. */
    .ews-shell,
    .ews-shell.ews-rail-collapsed {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto minmax(320px, 1fr) auto;
        grid-template-areas:
            "topbar"
            "toolbar"
            "rail"
            "map"
            "foot";
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    /* Rel selalu tampil di layar kecil; state collapse tidak berlaku. */
    .ews-rail,
    .ews-shell.ews-rail-collapsed .ews-rail {
        max-height: 46vh;
        opacity: 1;
        pointer-events: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }
    .ews-rail-scroll { height: auto; max-height: 46vh; }

    .ews-map-stage { position: relative; min-height: 58vh; }

    /* Rel selalu terlihat pada layar kecil; tombol ciutkan hanya milik peta. */
    .ews-map-controls > .ews-rail-toggle { display: none; }
    .ews-seg-label { display: none; }
    .ews-seg-btn { padding: 0.35rem 0.5rem; }
}

@media (max-width: 576px) {
    .ews-org, .ews-sub { display: none; }
    .ews-title { font-size: 1rem; }
    .ews-clock-date { display: none; }
    .ews-toolbar-facts { display: none; }
    .ews-toolbar-meta { display: none; }
    .ews-legend { width: 165px; }
    .ews-forecast-days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ews-param-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ews-foot-right { display: none; }
}
