* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #0d1117;
    color: #e6edf3;
    overflow: hidden;
}

/* ==================== WIDGET & TAB SYSTEM ==================== */
.main-view-container {
    display: none;
    width: 100vw;
    height: 100vh;
    position: relative;
}

.main-view-container.active {
    display: block;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
}

.wind-particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    display: none;
}

.map-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.72);
    backdrop-filter: blur(4px);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease;
}

.map-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.map-loading-spinner {
    background: rgba(22, 27, 34, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #e6edf3;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.map-loading-spinner i {
    color: #38bdf8;
    font-size: 16px;
}

/* 1. Sidebar Info Panel Kiri */
.left-info-panel {
    position: absolute;
    top: 80px;
    left: 20px;
    width: 320px;
    max-height: calc(100vh - 220px); 
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px;
    z-index: 10;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    color: #f0f6fc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
}

.panel-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30363d;
    padding-bottom: 10px;
    font-weight: 700;
    font-size: 13px;
    color: #58a6ff;
    flex-shrink: 0;
}

.btn-close-panel {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-close-panel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.panel-info-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

/* CUSTOM ELEGANT SCROLLBAR */
.panel-info-body::-webkit-scrollbar,
.right-panel::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar,
#dashboardViewContainer::-webkit-scrollbar,
.pdf-settings-col::-webkit-scrollbar,
.pdf-attr-checklist::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.panel-info-body::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track,
#dashboardViewContainer::-webkit-scrollbar-track,
.pdf-settings-col::-webkit-scrollbar-track,
.pdf-attr-checklist::-webkit-scrollbar-track {
    background: rgba(13, 17, 23, 0.5);
    border-radius: 10px;
}

.panel-info-body::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb,
#dashboardViewContainer::-webkit-scrollbar-thumb,
.pdf-settings-col::-webkit-scrollbar-thumb,
.pdf-attr-checklist::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.3);
    border-radius: 10px;
}

.info-attr-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #0d1117;
    border: 1px solid #21262d;
    padding: 8px 10px;
    border-radius: 8px;
}

.info-attr-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8b949e;
    font-weight: 600;
}

.info-attr-value {
    font-size: 13px;
    color: #f0f6fc;
    font-weight: 600;
    word-break: break-word;
}

/* Widget Cuaca */
.panel-weather-card {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
}

.panel-weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #8b949e;
    border-bottom: 1px solid #21262d;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.panel-temp {
    color: #38bdf8;
    font-weight: 700;
    font-size: 13px;
}

.panel-weather-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 10px;
    color: #c9d1d9;
}

.panel-weather-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 6px;
    border-radius: 6px;
}

.panel-weather-item i {
    color: #38bdf8;
}

.panel-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8b949e;
    margin: 6px 0 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Styling Custom Popup MapLibre */
.maplibregl-popup-content {
    background: rgba(22, 27, 34, 0.95) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
    padding: 10px !important;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: rgba(22, 27, 34, 0.95) !important; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: rgba(22, 27, 34, 0.95) !important; }

/* 2. Floating Top Navbar */
.top-navbar {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 100;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    max-width: calc(100vw - 24px);
    white-space: nowrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-title {
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
    letter-spacing: 0.3px;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 10px;
    color: #8b949e;
    font-weight: 500;
    line-height: 1.1;
    margin-top: 1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-item {
    color: #8b949e;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nav-item:hover, .nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-arrow {
    font-size: 10px;
    margin-left: 2px;
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    display: none;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    min-width: 190px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 1000;
    flex-direction: column;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.nav-dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    display: flex;
}

.dropdown-menu button {
    background: none;
    border: none;
    color: #c9d1d9;
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
    font-family: inherit;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #58a6ff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e6edf3;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.btn-theme-toggle:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

.nav-portal-back {
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.28);
    background: rgba(56, 189, 248, 0.08);
}

.nav-portal-back:hover {
    background: rgba(56, 189, 248, 0.18) !important;
}

.badge-status {
    font-size: 11px;
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.badge-status i {
    font-size: 8px;
    margin-right: 4px;
}

/* 3. Floating Left Controls */
.left-controls {
    position: absolute;
    bottom: 30px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

.left-controls button {
    width: 36px;
    height: 36px;
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #c9d1d9;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.left-controls button:hover {
    background: #21262d;
    color: #ffffff;
}

.left-controls button.active {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
    color: #38bdf8;
    font-weight: 700;
}

#btnToggle3D {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* 4. Floating Right Panel */
.right-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 100px);
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px;
    z-index: 10;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto !important;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #21262d;
    padding-bottom: 8px;
}

.panel-header h3 {
    font-size: 14px;
    color: #f0f6fc;
}

.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-collapse-panel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #8b949e;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.2s;
}

.btn-collapse-panel:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.btn-reopen-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 15;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #58a6ff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.right-panel.collapsed {
    display: none !important;
}

.btn-text {
    background: none;
    border: none;
    color: #58a6ff;
    font-size: 11px;
    cursor: pointer;
}

.btn-text:hover { text-decoration: underline; }

/* ==========================================
   STYLING KOTAK PENCARIAN & DROPDOWN AUTOCOMPLETE
   ========================================== */
.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 8px 30px 8px 34px;
    color: #f0f6fc;
    font-size: 12px;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-box input:focus { 
    border-color: #38bdf8; 
}

/* Hanya menargetkan ikon Kaca Pembesar di KIRI */
.search-box > i.fa-magnifying-glass {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #8b949e;
    font-size: 12px;
    pointer-events: none;
}

/* Tombol Silang (X) KANAN */
.search-clear-btn {
    position: absolute !important;
    right: 10px !important;
    left: auto !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #8b949e;
    font-size: 12px;
    cursor: pointer;
    display: none;
    padding: 4px;
    transition: color 0.2s ease;
    z-index: 10;
}

.search-clear-btn:hover {
    color: #f85149;
}

/* Scrollbar Elegan untuk Dropdown Hasil Pencarian */
.search-results-dropdown::-webkit-scrollbar {
    width: 5px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: rgba(13, 17, 23, 0.6);
    border-radius: 8px;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.35);
    border-radius: 8px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(88, 166, 255, 0.6);
}

/* Container Dropdown Hasil Pencarian */
.search-results-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: rgba(22, 27, 34, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    max-height: 230px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7);
}

/* Item Baris Hasil Pencarian */
.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.search-item-icon {
    font-size: 13px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.search-item-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    gap: 2px;
}

.search-item-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    word-break: break-word;
}

.search-item-sub {
    font-size: 10px;
    color: #8b949e;
    line-height: 1.35;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-item-info {
    padding: 10px 12px;
    font-size: 11px;
    color: #8b949e;
    text-align: center;
}

.tool-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.btn-tool {
    width: 100%;
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.btn-tool:hover { background: #30363d; }

.basemap-switcher {
    display: flex;
    background: #0d1117;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #30363d;
}

.bm-btn {
    flex: 1;
    background: none;
    border: none;
    color: #8b949e;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.bm-btn.active {
    background: #21262d;
    color: #58a6ff;
}

/* Layer Checklist & Sub-Layer Accordion */
.layer-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-section-heading {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #38bdf8;
    margin-top: 6px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.layer-section-heading:first-child {
    margin-top: 0;
}

.layer-wrapper {
    background: rgba(13, 17, 23, 0.5);
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 8px 10px;
}

.layer-main-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.layer-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.layer-left input[type="checkbox"] {
    accent-color: #2f81f7;
    cursor: pointer;
}

.layer-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.layer-title {
    font-size: 12px;
    color: #f0f6fc;
    display: block;
    font-weight: 600;
}

.layer-sub {
    font-size: 10px;
    color: #8b949e;
    margin-top: 2px;
}

.btn-arrow {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8b949e;
    cursor: pointer;
    font-size: 12px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-arrow:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.sub-layer-box {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #21262d;
    padding-left: 18px;
}

.sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 11px;
    color: #c9d1d9;
}

.sub-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

/* Modals Umum */
.modal-overlay {
    display: none;
    position: fixed; 
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 200;
    justify-content: center; 
    align-items: center;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    width: 90%; 
    max-width: 480px; 
    padding: 20px;
    color: #f0f6fc;
}

.modal-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 14px; 
    border-bottom: 1px solid #21262d; 
    padding-bottom: 10px;
}

.modal-header h3 { font-size: 16px; color: #58a6ff; display: flex; gap: 8px; }

.btn-close { background: none; border: none; color: #8b949e; font-size: 20px; cursor: pointer; }

.download-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.btn-download {
    display: inline-flex; 
    align-items: center; 
    gap: 8px;
    background: #238636; 
    color: #ffffff; 
    text-decoration: none;
    padding: 10px 16px; 
    border-radius: 8px; 
    font-size: 13px; 
    font-weight: 600; 
    margin-top: 8px;
}

/* ==========================================
   STYLING LEGENDA INTERAKTIF (DRAGGABLE & COLLAPSIBLE)
   ========================================== */
.map-legend {
    position: absolute;
    bottom: 30px;
    right: 350px;
    background: rgba(22, 27, 34, 0.94);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 0;
    z-index: 50;
    color: #f0f6fc;
    width: 230px;
    max-height: 320px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, height 0.2s ease, max-height 0.2s ease;
}

.legend-header {
    font-weight: 700;
    color: #58a6ff;
    background: rgba(13, 17, 23, 0.8);
    border-bottom: 1px solid #30363d;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move; /* Indikator bahwa header bisa di-drag */
    user-select: none;
    flex-shrink: 0;
}

.legend-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
}

.drag-handle-icon {
    color: #8b949e;
    font-size: 10px;
    cursor: grab;
}

.legend-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-legend-action {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 11px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-legend-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.legend-body {
    padding: 10px 12px;
    overflow-y: auto;
    flex: 1;
    max-height: 270px;
}

/* Custom Scrollbar Legenda */
.legend-body::-webkit-scrollbar {
    width: 4px;
}
.legend-body::-webkit-scrollbar-track {
    background: rgba(13, 17, 23, 0.3);
}
.legend-body::-webkit-scrollbar-thumb {
    background: rgba(88, 166, 255, 0.4);
    border-radius: 4px;
}

/* Tampilan Saat Di-Minimize */
.map-legend.minimized {
    width: 110px !important;
    height: auto !important;
    max-height: 38px !important;
    overflow: hidden;
}

.map-legend.minimized .legend-body {
    display: none !important;
}

.map-legend.minimized .legend-header {
    border-bottom: none;
    padding: 6px 10px;
}

.map-legend.minimized .drag-handle-icon {
    display: none;
}

/* Judul Kelompok / Section Header */
.legend-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #38bdf8; /* Warna cyan cerah sebagai pembeda judul */
    margin-top: 10px;
    margin-bottom: 6px;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.legend-section-title:first-child {
    margin-top: 0;
}

/* Baris Item Legenda */
.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    padding-left: 4px; /* Indentasi agar menjorok ke dalam dari judul */
    font-size: 11px;
    color: #c9d1d9;
}

/* Ikon Kotak Warna (Wilayah Sungai) */
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Ikon Garis Warna (Sungai & Saluran / Infrastruktur) */
.legend-line {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

.maplibregl-canvas { transition: filter 0.3s ease; }

/* ==================== TAMPILAN DATA DASHBOARD ==================== */
#dashboardViewContainer {
    overflow-y: auto;
    background: #0d1117;
    padding: 85px 24px 30px 24px;
}

.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* BARIS 1: KPI Summary Cards (Full Width) */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
}

.kpi-card {
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.kpi-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-label {
    font-size: 11px;
    color: #8b949e;
    font-weight: 600;
    text-transform: uppercase;
}

.kpi-value {
    font-size: 18px;
    color: #f0f6fc;
    font-weight: 700;
}

/* BARIS 2: Middle Row (Chart Left + Mini Map Right) */
.dash-middle-row {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: stretch;
}

.dash-chart-box {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dash-map-box {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* BARIS 3: Table Box (Full Width) */
.dash-table-box {
    width: 100%;
}

/* General Dashboard Cards */
.dash-card {
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.dash-card-header {
    border-bottom: 1px solid #21262d;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.dash-card-header h4 {
    font-size: 13px;
    color: #58a6ff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.dash-table-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.dash-select, .dash-search-input {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #f0f6fc;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    outline: none;
    font-family: inherit;
}

.dash-search-input:focus, .dash-select:focus {
    border-color: #38bdf8;
}

.btn-export-csv {
    background: #238636;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-export-csv:hover {
    background: #2ea043;
}

/* Chart Styles */
.chart-bars-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
}

.chart-label {
    width: 150px;
    color: #c9d1d9;
    flex-shrink: 0;
}

.chart-bar-bg {
    flex: 1;
    background: #0d1117;
    border-radius: 6px;
    height: 12px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.chart-count {
    width: 45px;
    text-align: right;
    color: #8b949e;
    font-weight: 600;
}

/* Table Styles */
.table-responsive {
    max-height: 480px;
    overflow-y: auto;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.dash-table th {
    background: #0d1117;
    color: #8b949e;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 1px solid #21262d;
}

.dash-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #21262d;
    color: #c9d1d9;
}

.dash-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.btn-action-map {
    background: #238636;
    color: #ffffff;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
    text-decoration: none;
}

.btn-action-map:hover {
    background: #2ea043;
}

.btn-action-preview {
    background: #21262d;
    color: #58a6ff;
    border: 1px solid #30363d;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
    margin-right: 4px;
}

.btn-action-preview:hover {
    background: #30363d;
}

.doc-link-btn {
    color: #58a6ff;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.doc-link-btn:hover {
    text-decoration: underline;
}

/* Mini Map */
.mini-map-body {
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

#miniMap {
    width: 100%;
    height: 260px;
    border-radius: 8px;
}

.mini-map-summary {
    margin-top: 12px;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 10px;
    font-size: 11px;
}

/* Sortable Table Header */
.th-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.th-sortable:hover {
    background: #161b22 !important;
    color: #38bdf8 !important;
}

.th-sortable i {
    font-size: 10px;
    margin-left: 4px;
    color: #58a6ff;
}

/* ==========================================
   STYLING MODAL CETAK NEAR-FULLSCREEN & PREVIEW WYSIWYG
   ========================================== */
.pdf-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 99999 !important;
    align-items: center; justify-content: center;
}

.pdf-modal-overlay.active {
    display: flex !important;
}

.pdf-modal-card {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    width: 95vw !important;
    max-width: 1600px !important;
    height: 92vh !important;
    max-height: 950px !important;
    display: flex; flex-direction: column;
    box-shadow: 0 16px 40px rgba(0,0,0,0.8);
    color: #c9d1d9; font-family: 'Plus Jakarta Sans', sans-serif;
    overflow: hidden;
}

.pdf-modal-header {
    padding: 12px 18px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 14px; font-weight: 700; color: #58a6ff;
    flex-shrink: 0;
}

.pdf-modal-close {
    background: none; border: none; color: #8b949e; font-size: 20px; cursor: pointer;
}
.pdf-modal-close:hover { color: #f85149; }

.pdf-modal-body {
    display: flex; flex: 1; overflow: hidden; padding: 14px; gap: 14px;
}

/* Panel Pengaturan Kiri Modal */
.pdf-settings-col {
    width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px;
    background: #161b22; padding: 14px; border-radius: 8px; border: 1px solid #21262d;
    overflow-y: auto;
}

.pdf-form-group { display: flex; flex-direction: column; gap: 6px; }
.pdf-form-group label { font-size: 11px; font-weight: 600; color: #8b949e; }
.pdf-form-group input {
    background: #0d1117; border: 1px solid #30363d; color: #f0f6fc;
    padding: 8px 10px; border-radius: 6px; font-size: 12px; outline: none;
}
.pdf-form-group input:focus { border-color: #58a6ff; }

.pdf-info-box {
    background: #0d1117; border: 1px solid #1f6feb; border-radius: 6px;
    padding: 10px; font-size: 10px; color: #8b949e; line-height: 1.4;
}

.pdf-btn-group { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.btn-pdf-confirm {
    background: #238636; color: #fff; border: none; padding: 10px;
    border-radius: 6px; font-weight: 600; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: background 0.2s;
}
.btn-pdf-confirm:hover { background: #2ea043; }
.btn-pdf-cancel {
    background: #21262d; color: #c9d1d9; border: 1px solid #30363d; padding: 8px;
    border-radius: 6px; font-size: 11px; cursor: pointer; text-align: center;
}
.btn-pdf-cancel:hover { background: #30363d; }

/* Container Paper Landscape Preview (Near-Fullscreen & No-Scroll) */
.pdf-preview-col {
    flex: 1; background: #000000; border: 1px solid #21262d; border-radius: 8px;
    padding: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}

.pdf-paper-wrapper {
    width: 100%; height: 100%;
    background: #0d1117; color: #e6edf3; border: 1px solid #30363d;
    padding: 0; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    box-sizing: border-box; overflow: hidden;
}

#pdfPaperPreview {
    width: 100%;
    height: 100%;
    background: #161b22;
    border-radius: 6px;
    box-sizing: border-box;
    overflow: hidden !important;
}

/* Container Checklist Pilih Atribut di Modal */
.pdf-attr-checklist {
    max-height: 200px;
    overflow-y: auto;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdf-attr-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #c9d1d9;
    cursor: pointer;
    user-select: none;
}

.pdf-attr-item input[type="checkbox"] {
    accent-color: #38bdf8;
    cursor: pointer;
}

/* Styling Sakelar Toggle Label Nama Sungai di Panel Kanan */
.river-label-toggle-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(13, 17, 23, 0.6);
    border: 1px dashed rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    padding: 6px 10px;
    margin-top: -4px;
    margin-bottom: 4px;
    margin-left: 18px; /* Indentasi menjorok di bawah layer sungai */
}

.river-label-text {
    font-size: 10.5px;
    color: #38bdf8;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Custom Mini Switch Slider */
.switch-sm {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    flex-shrink: 0;
}

.switch-sm input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-sm {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #30363d;
    transition: .2s;
    border-radius: 16px;
}

.slider-sm:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: .2s;
    border-radius: 50%;
}

input:checked + .slider-sm {
    background-color: #38bdf8;
}

input:checked + .slider-sm:before {
    transform: translateX(12px);
}

/* ==========================================
   STYLING PANEL UKUR JARAK (MEASURE TOOL)
   ========================================== */
.measure-tool-container {
    width: 100%;
}

.measure-panel {
    background: #0d1117;
    border: 1px solid #38bdf8;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
    animation: fadeInMeasure 0.2s ease;
}

@keyframes fadeInMeasure {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.measure-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    border-bottom: 1px solid #21262d;
    padding-bottom: 6px;
}

.measure-close-btn {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.measure-close-btn:hover {
    color: #f85149;
}

.measure-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}

.measure-total-box {
    display: flex;
    flex-direction: column;
}

.measure-label {
    font-size: 10px;
    color: #8b949e;
    text-transform: uppercase;
    font-weight: 600;
}

.measure-value {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.measure-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.measure-points-count {
    font-size: 10px;
    color: #8b949e;
    margin-right: 2px;
}

.btn-measure-sub {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.btn-measure-sub:hover {
    background: #30363d;
    color: #ffffff;
}

.btn-measure-sub.btn-danger:hover {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border-color: #f85149;
}

.measure-instruction {
    font-size: 10px;
    color: #8b949e;
    line-height: 1.35;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px dashed #30363d;
}

/* Custom Marker Label Angka Jarak di Atas Garis Peta */
.measure-distance-tag {
    background: rgba(13, 17, 23, 0.92);
    border: 1px solid #38bdf8;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transform: translate(-50%, -120%);
}

.measure-live-tag {
    background: rgba(14, 165, 233, 0.95);
    border-color: #ffffff;
    color: #090d16;
    padding: 3px 8px;
    font-size: 10.5px;
    transform: translate(12px, -24px);
}

/* Styling Tombol Hapus Layer Unggahan (Tempat Sampah) */
.btn-delete-layer {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: #f85149;
    cursor: pointer;
    font-size: 11px;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-delete-layer:hover {
    background: #f85149;
    color: #ffffff;
    border-color: #f85149;
    box-shadow: 0 2px 8px rgba(248, 81, 73, 0.4);
}

/* Styling Khusus Preview Canvas PNG */
.png-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.png-preview-header-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.png-preview-title {
    font-size: 14px;
    font-weight: 700;
    color: #58a6ff;
}

.png-preview-subtitle {
    font-size: 11px;
    color: #8b949e;
}

.png-preview-map-wrapper {
    flex: 1;
    position: relative;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.png-preview-map-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.png-preview-legend-overlay {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 10px;
    max-width: 200px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 10px;
    color: #f0f6fc;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* ==========================================
   PAGINATION TABEL DASHBOARD
   ========================================== */
.dash-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px solid #21262d;
    font-size: 11px;
    color: #8b949e;
}

.dash-page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-page {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    border-color: #38bdf8;
    color: #38bdf8;
}

.btn-page.active {
    background: #1f6feb;
    border-color: #1f6feb;
    color: #ffffff;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==========================================
   LIGHT MODE THEME (body.light-theme)
   ========================================== */
body.light-theme {
    background-color: #f4f6f8;
    color: #1f2328;
}

body.light-theme .top-navbar,
body.light-theme .right-panel,
body.light-theme .left-info-panel,
body.light-theme .map-legend,
body.light-theme .btn-reopen-panel,
body.light-theme .left-controls button,
body.light-theme .dropdown-menu {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1f2328;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

body.light-theme .brand-title,
body.light-theme .panel-header h3,
body.light-theme .layer-title,
body.light-theme .kpi-value,
body.light-theme .info-attr-value {
    color: #0f172a;
}

body.light-theme .nav-item,
body.light-theme .brand-subtitle,
body.light-theme .layer-sub,
body.light-theme .kpi-label,
body.light-theme .info-attr-label {
    color: #475569;
}

body.light-theme .nav-item:hover,
body.light-theme .nav-item.active {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.08);
}

body.light-theme #dashboardViewContainer {
    background: #f4f6f8;
}

body.light-theme .kpi-card,
body.light-theme .dash-card,
body.light-theme .modal-content {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
    color: #1f2328;
}

body.light-theme .layer-wrapper,
body.light-theme .info-attr-row,
body.light-theme .panel-weather-card,
body.light-theme .search-box input,
body.light-theme .basemap-switcher,
body.light-theme .dash-select,
body.light-theme .dash-search-input,
body.light-theme .dash-table th,
body.light-theme .btn-page,
body.light-theme .mini-map-summary {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.light-theme .btn-tool,
body.light-theme .bm-btn.active {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.light-theme .dash-table td,
body.light-theme .legend-item,
body.light-theme .sub-item label,
body.light-theme .dropdown-menu button {
    color: #334155;
    border-color: #e2e8f0;
}

body.light-theme .btn-theme-toggle {
    background: rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.14);
    color: #0f172a;
}

/* ==========================================
   RESPONSIVITAS LAYAR KECIL & MOBILE
   ========================================== */
@media (max-width: 1200px) {
    .top-navbar {
        top: 10px;
        gap: 10px;
        padding: 6px 12px;
    }
    .brand-subtitle {
        display: none;
    }
    .nav-item {
        padding: 5px 10px;
        font-size: 12px;
    }
    .right-panel,
    .left-info-panel {
        width: 280px;
        top: 68px;
    }
    .map-legend {
        right: 310px;
        width: 200px;
    }
    .dash-middle-row {
        flex-direction: column;
    }
    .dash-map-box {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .top-navbar {
        top: 8px;
        left: 8px;
        right: 8px;
        transform: none;
        max-width: none;
        justify-content: space-between;
        border-radius: 14px;
        padding: 6px 10px;
        overflow-x: auto;
    }
    .badge-status {
        display: none;
    }
    .right-panel {
        width: calc(100vw - 24px);
        right: 12px;
        top: 64px;
        max-height: 55vh;
    }
    .left-info-panel {
        width: calc(100vw - 24px);
        left: 12px;
        top: auto;
        bottom: 12px;
        max-height: 45vh;
    }
    .map-legend {
        display: none;
    }
    .dash-kpi-grid {
        grid-template-columns: 1fr;
    }
    .pdf-modal-body {
        flex-direction: column;
        overflow-y: auto;
    }
    .pdf-settings-col {
        width: 100%;
        flex-shrink: 0;
    }
    .weather-hud-dock {
        left: 12px;
        bottom: 12px;
        max-width: calc(100vw - 24px);
        overflow-x: auto;
    }
    .weather-timeline-bar {
        width: calc(100vw - 24px);
        bottom: 62px;
        padding: 8px 10px;
    }
    .weather-scale-legend {
        display: none;
    }
}

/* ==========================================
   WINDY-STYLE WEATHER HUD & TIMELINE PLAYER
   ========================================== */
.weather-hud-dock {
    position: absolute;
    bottom: 30px;
    left: 70px;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(22, 27, 34, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 5px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.weather-mode-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #8b949e;
    padding: 6px 11px;
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.weather-mode-btn:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.08);
}

.weather-mode-btn.active {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

.weather-mode-btn.weather-soon {
    opacity: 0.65;
}

.weather-timeline-bar {
    position: absolute;
    bottom: 82px;
    left: 70px;
    z-index: 25;
    width: 470px;
    max-width: calc(100vw - 90px);
    background: rgba(22, 27, 34, 0.94);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

.btn-timeline-play {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #38bdf8;
    color: #0d1117;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.2s;
}

.btn-timeline-play:hover {
    background: #7dd3fc;
    transform: scale(1.05);
}

.btn-weather-now {
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 10.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-weather-now:hover {
    background: rgba(56, 189, 248, 0.28);
    color: #ffffff;
}

body.light-theme .btn-weather-now {
    background: rgba(2, 132, 199, 0.12);
    border-color: rgba(2, 132, 199, 0.35);
    color: #0284c7;
}

.drought-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-slider-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.timeline-title {
    color: #e6edf3;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.timeline-title i {
    color: #38bdf8;
}

.timeline-time {
    color: #38bdf8;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

#weatherTimelineSlider {
    width: 100%;
    accent-color: #38bdf8;
    cursor: pointer;
    height: 4px;
}

.weather-scale-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-left: 8px;
    border-left: 1px solid #30363d;
}

.scale-label {
    font-size: 9.5px;
    color: #8b949e;
    font-weight: 600;
}

.scale-bar-rain {
    width: 58px;
    height: 7px;
    border-radius: 4px;
    background: linear-gradient(90deg, #38bdf8 0%, #22c55e 40%, #eab308 70%, #ef4444 100%);
}

.scale-bar-wind {
    width: 58px;
    height: 7px;
    border-radius: 4px;
    background: linear-gradient(90deg, #7dd3fc 0%, #34d399 40%, #fde047 75%, #f97316 100%);
}

body.light-theme .weather-hud-dock,
body.light-theme .weather-timeline-bar {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
}

body.light-theme .weather-mode-btn,
body.light-theme .scale-label {
    color: #475569;
}

body.light-theme .weather-mode-btn:hover,
body.light-theme .timeline-title {
    color: #0f172a;
}

body.light-theme .weather-mode-btn.active {
    background: rgba(2, 132, 199, 0.12);
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.35);
}

/* ==========================================
   DROUGHT & NASA GIBS CONTROLS BAR (TAHAP 3)
   ========================================== */
.drought-controls-bar {
    position: absolute;
    bottom: 82px;
    left: 70px;
    z-index: 25;
    width: 430px;
    max-width: calc(100vw - 90px);
    background: rgba(22, 27, 34, 0.94);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
}

.drought-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.drought-gibs-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #c9d1d9;
    cursor: pointer;
}

.drought-gibs-toggle input {
    accent-color: #f59e0b;
    cursor: pointer;
}

.drought-date-strip-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-date-nav {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    width: 24px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-date-nav:hover:not(:disabled) {
    border-color: #f59e0b;
    color: #f59e0b;
}

.btn-date-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.drought-date-pills {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.drought-date-pill {
    flex: 1;
    min-width: 0;
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    border-radius: 7px;
    padding: 4px 5px;
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.drought-date-pill:hover:not(:disabled) {
    border-color: #f59e0b;
    color: #ffffff;
}

.drought-date-pill.active {
    background: rgba(245, 158, 11, 0.18);
    border-color: #f59e0b;
    color: #fbbf24;
    font-weight: 700;
}

.drought-date-pill.unavailable {
    opacity: 0.45;
    cursor: not-allowed;
}

.sat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    background: #6e7681;
}

.sat-dot.ready {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}

.sat-dot.missing {
    background: #6e7681;
}

.sat-dot.checking {
    background: #f59e0b;
}

body.light-theme .btn-date-nav,
body.light-theme .drought-date-pill {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

body.light-theme .drought-date-pill.active {
    background: rgba(245, 158, 11, 0.16);
    border-color: #d97706;
    color: #b45309;
}

/* =========================================================================
   BENTO GLASSMORPHIC ULTRA-COMPACT DESIGN SYSTEM (PERMANENT)
   Memaksimalkan area kanvas peta dengan panel ramping 268px, kartu bento
   membulat 14px, border tipis 1px, dan efek kaca translusen (Light & Dark).
   ========================================================================= */

body {
    --bento-surface: rgba(15, 23, 42, 0.72);
    --bento-tile: rgba(30, 41, 59, 0.58);
    --bento-tile-hover: rgba(30, 41, 59, 0.8);
    --bento-border: rgba(255, 255, 255, 0.13);
    --bento-border-strong: rgba(56, 189, 248, 0.45);
    --bento-accent: #38bdf8;
    --bento-accent-soft: rgba(56, 189, 248, 0.18);
    --bento-shadow: 0 12px 32px rgba(2, 6, 23, 0.42);
    font-variant-numeric: tabular-nums;
}

body.light-theme {
    --bento-surface: rgba(255, 255, 255, 0.44);
    --bento-tile: rgba(255, 255, 255, 0.52);
    --bento-tile-hover: rgba(255, 255, 255, 0.78);
    --bento-border: rgba(15, 23, 42, 0.14);
    --bento-border-strong: rgba(2, 132, 199, 0.55);
    --bento-accent: #0284c7;
    --bento-accent-soft: rgba(2, 132, 199, 0.16);
    --bento-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

/* Navbar Ultra-Compact Glass */
.top-navbar {
    height: 50px;
    padding: 0 14px;
    background: var(--bento-surface);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    border-bottom: 1px solid var(--bento-border);
}

.nav-item,
.nav-portal-back,
.btn-theme-toggle,
.badge-status {
    border-radius: 10px;
}

.nav-item.active,
.bm-btn.active,
.weather-mode-btn.active {
    background: var(--bento-accent-soft);
    border-color: var(--bento-accent);
    color: #e0f2fe;
}

body.light-theme .nav-item.active,
body.light-theme .bm-btn.active,
body.light-theme .weather-mode-btn.active {
    background: var(--bento-accent-soft);
    border-color: var(--bento-accent);
    color: #0369a1;
}

.dropdown-menu {
    background: var(--bento-surface);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    border: 1px solid var(--bento-border);
    border-radius: 14px;
    box-shadow: var(--bento-shadow);
}

/* Panel Kanan & Info Panel Kiri (268px Ultra-Compact) */
.right-panel {
    width: 268px;
    top: 62px;
    right: 12px;
    max-height: calc(100vh - 74px);
    padding: 12px;
    gap: 8px;
    background: var(--bento-surface);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    border: 1px solid var(--bento-border);
    border-radius: 14px;
    box-shadow: var(--bento-shadow);
}

.left-info-panel {
    width: 268px;
    top: 62px;
    left: 12px;
    max-height: calc(100vh - 138px);
    background: var(--bento-surface);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    border: 1px solid var(--bento-border);
    border-radius: 14px;
    box-shadow: var(--bento-shadow);
}

.panel-header h3 {
    font-size: 14px;
    letter-spacing: -0.01em;
}

.btn-reopen-panel {
    top: 62px;
    right: 12px;
    background: var(--bento-surface);
    backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--bento-border);
    border-radius: 12px;
    box-shadow: var(--bento-shadow);
}

/* Inner Bento Tiles inside Panels */
.search-box input,
.btn-tool,
.basemap-switcher,
.layer-wrapper,
.measure-panel,
.info-attr-row,
.panel-weather-card {
    background: var(--bento-tile);
    border: 1px solid var(--bento-border);
    border-radius: 12px;
}

.btn-tool {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 10px;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.btn-tool:hover {
    background: var(--bento-tile-hover);
    border-color: var(--bento-border-strong);
}

.bm-btn {
    border-radius: 8px;
}

/* Floating Controls, Weather HUD, Timeline, Drought & Legend */
.left-controls {
    left: 12px;
    bottom: 16px;
}

.left-controls button {
    background: var(--bento-surface);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--bento-border);
    border-radius: 10px;
    box-shadow: var(--bento-shadow);
}

.left-controls button:hover {
    border-color: var(--bento-border-strong);
}

.weather-hud-dock,
.weather-timeline-bar,
.drought-controls-bar,
.map-legend {
    background: var(--bento-surface);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    border: 1px solid var(--bento-border);
    border-radius: 14px;
    box-shadow: var(--bento-shadow);
}

.weather-mode-btn {
    border-radius: 10px;
}

.legend-header {
    background: rgba(15, 23, 42, 0.55);
    border-bottom: 1px solid var(--bento-border);
    border-radius: 14px 14px 0 0;
}

body.light-theme .legend-header {
    background: rgba(255, 255, 255, 0.56);
    border-bottom-color: var(--bento-border);
    color: #0f172a;
}

body.light-theme .legend-header-title {
    color: #0f172a;
}

body.light-theme .btn-legend-action {
    color: #334155;
}

body.light-theme .ws-label-toggle,
body.light-theme .label-toggle-row,
body.light-theme .sub-item,
body.light-theme .river-label-toggle-box {
    background: rgba(255, 255, 255, 0.56);
    border-color: var(--bento-border);
    color: #0f172a;
}

body.light-theme .river-label-text {
    color: #0369a1 !important;
}

body.light-theme .top-navbar,
body.light-theme .right-panel,
body.light-theme .left-info-panel,
body.light-theme .map-legend,
body.light-theme .weather-hud-dock,
body.light-theme .weather-timeline-bar,
body.light-theme .drought-controls-bar,
body.light-theme .btn-reopen-panel,
body.light-theme .left-controls button,
body.light-theme .dropdown-menu {
    background: rgba(255, 255, 255, 0.44);
    backdrop-filter: blur(24px) saturate(165%);
    -webkit-backdrop-filter: blur(24px) saturate(165%);
    border-color: rgba(15, 23, 42, 0.14);
    color: #0f172a;
}

body.light-theme .weather-mode-btn,
body.light-theme .bm-btn,
body.light-theme .btn-tool,
body.light-theme .btn-theme-toggle {
    color: #1e293b;
}

body.light-theme .btn-tool {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(15, 23, 42, 0.14);
    color: #0f172a;
}

body.light-theme .btn-tool:hover,
body.light-theme .weather-mode-btn:hover,
body.light-theme .bm-btn:hover {
    background: rgba(255, 255, 255, 0.82);
    color: #0284c7;
}

body.light-theme .nav-portal-back {
    background: rgba(2, 132, 199, 0.12);
    border-color: rgba(2, 132, 199, 0.35);
    color: #0369a1;
}

body.light-theme .nav-portal-back:hover {
    background: rgba(2, 132, 199, 0.22);
    color: #075985;
}

body.light-theme .badge-status {
    background: rgba(22, 163, 74, 0.14);
    border-color: rgba(22, 163, 74, 0.35);
    color: #15803d;
}

body.light-theme .layer-sub,
body.light-theme .search-box input::placeholder,
body.light-theme .timeline-title,
body.light-theme .scale-label {
    color: #475569;
}

body.light-theme .chart-bar-bg {
    background: rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-theme .btn-action-preview {
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(2, 132, 199, 0.32);
    color: #0369a1;
}

body.light-theme .btn-action-preview:hover {
    background: #0284c7;
    color: #ffffff;
}

body.light-theme .kpi-card,
body.light-theme .dash-card,
body.light-theme .modal-content {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border-color: rgba(15, 23, 42, 0.12);
    color: #0f172a;
}

/* Data Dashboard Bento Grid & Modals */
#dashboardViewContainer {
    padding: 68px 18px 26px 18px;
    background:
        radial-gradient(circle at 12% 8%, rgba(56, 189, 248, 0.09), transparent 40%),
        radial-gradient(circle at 88% 18%, rgba(14, 165, 233, 0.06), transparent 36%),
        #0b0f17;
}

body.light-theme #dashboardViewContainer {
    background:
        radial-gradient(circle at 14% 8%, rgba(2, 132, 199, 0.09), transparent 42%),
        radial-gradient(circle at 88% 20%, rgba(56, 189, 248, 0.07), transparent 38%),
        #eef2f7;
    color: #0f172a;
}

body.light-theme .kpi-card,
body.light-theme .dash-card {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.light-theme .kpi-label {
    color: #475569;
}

body.light-theme .kpi-value {
    color: #0f172a;
}

body.light-theme .dash-card-header {
    border-bottom-color: rgba(15, 23, 42, 0.1);
}

body.light-theme .dash-card-header h4 {
    color: #0369a1;
}

body.light-theme .chart-label {
    color: #1e293b;
    font-weight: 600;
}

body.light-theme .chart-count {
    color: #0f172a;
    font-weight: 700;
}

body.light-theme .chart-bar-bg {
    background: rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-theme .mini-map-summary {
    background: rgba(248, 250, 252, 0.92);
    border-color: rgba(15, 23, 42, 0.12);
    color: #1e293b;
}

body.light-theme .mini-map-summary p {
    color: #475569 !important;
}

body.light-theme .dash-select,
body.light-theme .dash-search-input {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

body.light-theme .dash-search-input::placeholder {
    color: #64748b;
}

body.light-theme .dash-table th {
    background: rgba(241, 245, 249, 0.97);
    color: #334155;
    border-bottom: 1px solid rgba(15, 23, 42, 0.14);
}

body.light-theme .dash-table td {
    color: #0f172a;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-theme .dash-table tbody tr:hover {
    background: rgba(2, 132, 199, 0.08);
}

body.light-theme .doc-link-btn {
    color: #0284c7;
}

body.light-theme .dash-pagination {
    border-top-color: rgba(15, 23, 42, 0.12);
    color: #475569;
}

body.light-theme .btn-page {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

body.light-theme .btn-page.active {
    background: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

.dashboard-wrapper {
    gap: 14px;
    max-width: 1560px;
}

.dash-kpi-grid {
    gap: 12px;
}

.kpi-card {
    padding: 14px 16px;
    gap: 12px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.kpi-card:hover {
    transform: translateY(-1px);
    border-color: var(--bento-border-strong);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 17px;
}

.kpi-label {
    font-size: 10.5px;
    letter-spacing: 0.04em;
}

.kpi-value {
    font-size: 20px;
    letter-spacing: -0.02em;
}

.dash-middle-row {
    gap: 14px;
}

.dash-map-box {
    width: 390px;
}

.kpi-card,
.dash-card,
.modal-content {
    background: var(--bento-surface);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    border: 1px solid var(--bento-border);
    border-radius: 14px;
    box-shadow: var(--bento-shadow);
}

.dash-card {
    padding: 14px 16px;
}

.dash-card-header {
    border-bottom: 1px solid var(--bento-border);
    padding-bottom: 9px;
    margin-bottom: 12px;
}

.dash-card-header h4 {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--bento-accent);
}

.chart-bars-container {
    gap: 7px;
}

.chart-row {
    gap: 10px;
}

.chart-bar-bg {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
}

#miniMap {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--bento-border);
}

.mini-map-summary {
    background: var(--bento-tile);
    border: 1px solid var(--bento-border);
    border-radius: 10px;
    margin-top: 10px;
}

.dash-select,
.dash-search-input {
    background: var(--bento-tile);
    border: 1px solid var(--bento-border);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11.5px;
}

.btn-export-csv {
    border-radius: 8px;
    padding: 6px 12px;
}

.dash-table th {
    background: var(--bento-tile);
    border-bottom: 1px solid var(--bento-border);
    font-size: 10.5px;
    letter-spacing: 0.04em;
    padding: 9px 10px;
}

.dash-table td {
    padding: 8px 10px;
    font-size: 11.5px;
    border-bottom: 1px solid var(--bento-border);
}

.dash-table tbody tr:hover {
    background: var(--bento-accent-soft);
}

.btn-page {
    border-radius: 8px;
    border-color: var(--bento-border);
}

.btn-action-preview {
    border-radius: 8px;
    padding: 4px 10px;
}

@media (max-width: 1100px) {
    .dash-middle-row {
        flex-direction: column;
    }
    .dash-map-box {
        width: 100%;
    }
}

/* =========================================================================
   MAPLIBRE POPUP BENTO GLASSMORPHIC (DARK & LIGHT MODE)
   ========================================================================= */
.maplibregl-popup-content {
    background: var(--bento-surface) !important;
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border: 1px solid var(--bento-border) !important;
    border-radius: 14px !important;
    box-shadow: var(--bento-shadow) !important;
    padding: 10px 12px !important;
    color: #e6edf3;
}

.maplibregl-popup-close-button {
    color: #94a3b8 !important;
    font-size: 16px !important;
    padding: 4px 8px !important;
    border-radius: 8px;
    right: 4px !important;
    top: 4px !important;
}

.maplibregl-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: rgba(15, 23, 42, 0.8) !important; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: rgba(15, 23, 42, 0.8) !important; }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: rgba(15, 23, 42, 0.8) !important; }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: rgba(15, 23, 42, 0.8) !important; }

body.light-theme .maplibregl-popup-content {
    background: rgba(255, 255, 255, 0.56) !important;
    backdrop-filter: blur(24px) saturate(165%);
    -webkit-backdrop-filter: blur(24px) saturate(165%);
    border-color: rgba(15, 23, 42, 0.14) !important;
    color: #0f172a;
}

body.light-theme .maplibregl-popup-close-button {
    color: #475569 !important;
}

body.light-theme .maplibregl-popup-close-button:hover {
    background: rgba(15, 23, 42, 0.08) !important;
    color: #0f172a !important;
}

body.light-theme .maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: rgba(255, 255, 255, 0.72) !important; }
body.light-theme .maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: rgba(255, 255, 255, 0.72) !important; }
body.light-theme .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: rgba(255, 255, 255, 0.72) !important; }
body.light-theme .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: rgba(255, 255, 255, 0.72) !important; }

.weather-popup-wrap {
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding: 2px;
    min-width: 184px;
    max-width: 215px;
}

.weather-popup-title {
    font-size: 12px;
    color: #38bdf8;
    display: block;
    margin-bottom: 6px;
    padding-right: 16px;
}

.weather-popup-card {
    background: var(--bento-tile);
    border: 1px solid var(--bento-border);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 11px;
    color: #e6edf3;
}

.weather-popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--bento-border);
    padding-bottom: 5px;
}

.weather-popup-label {
    color: #94a3b8;
}

.weather-popup-temp {
    color: #38bdf8;
    font-size: 12.5px;
}

.weather-popup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 8px;
    font-size: 10px;
    color: #94a3b8;
}

.weather-popup-val {
    color: #f1f5f9;
    font-weight: 600;
}

body.light-theme .weather-popup-title {
    color: #0369a1;
}

body.light-theme .weather-popup-card {
    background: rgba(255, 255, 255, 0.62);
    border-color: rgba(15, 23, 42, 0.12);
    color: #0f172a;
}

body.light-theme .weather-popup-label,
body.light-theme .weather-popup-grid {
    color: #475569;
}

body.light-theme .weather-popup-temp {
    color: #0284c7;
}

body.light-theme .weather-popup-val {
    color: #0f172a;
}

@media (max-width: 768px) {
    .right-panel,
    .left-info-panel {
        width: calc(100vw - 24px);
    }
    .dash-kpi-grid {
        grid-template-columns: 1fr;
    }
}


.drought-bar-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.drought-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.drought-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    cursor: pointer;
    border: 1px solid transparent;
    user-select: none;
}

.drought-chip input {
    cursor: pointer;
    width: 11px;
    height: 11px;
}

.chip-high {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

.chip-mid {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}

.chip-low {
    background: rgba(34, 197, 94, 0.16);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.35);
}

.drought-status-text {
    font-size: 10px;
    color: #8b949e;
    font-weight: 600;
}

body.light-theme .drought-controls-bar {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(217, 119, 6, 0.35);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
}

body.light-theme .drought-gibs-toggle,
body.light-theme .drought-status-text {
    color: #475569;
}

body.light-theme .drought-date-input {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

@media (max-width: 768px) {
    .drought-controls-bar {
        left: 12px;
        bottom: 62px;
        width: calc(100vw - 24px);
        max-width: none;
    }
}