:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #eef0ff;
    --secondary: #6c757d;
    --success: #06d6a0;
    --success-dark: #05b88a;
    --warning: #ffd166;
    --warning-dark: #f0c050;
    --danger: #ef476f;
    --danger-dark: #d63d62;
    --info: #118ab2;
    --info-dark: #0e7a9e;
    --dark: #073b4c;
    --gray-50: #f8f9fb;
    --gray-100: #f1f3f8;
    --gray-200: #e2e6ef;
    --gray-300: #c8cedb;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --sidebar-width: 250px;
    --card-radius: 16px;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--gray-100);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
    color: var(--gray-800);
    overflow-x: hidden;
    min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }

.footer {
    border-top: 1px solid var(--gray-200);
    background: white !important;
    font-size: 0.85rem;
}

/* ===== Cards ===== */
.card {
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    border: none;
    margin-bottom: 1.25rem;
    transition: var(--transition);
    background: white;
}
.card:hover {
    box-shadow: var(--card-shadow-hover);
}
.card-header {
    background: white;
    border-bottom: 1px solid var(--gray-100);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
    letter-spacing: 0.3px;
}
.card-body { padding: 1.25rem; }

/* ===== Stat Cards ===== */
.stat-card {
    position: relative;
    overflow: hidden;
    cursor: default;
    border-radius: var(--card-radius);
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
}
.stat-card .stat-icon-bg {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.1;
    line-height: 1;
    pointer-events: none;
}
.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    margin-bottom: 0.25rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
}
.stat-card .stat-trend {
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.stat-gradient-1 { background: linear-gradient(135deg, var(--primary) 0%, var(--theme-gradient, #7209b7) 100%); color: white; }
.stat-gradient-2 { background: linear-gradient(135deg, #06d6a0 0%, #118ab2 100%); color: white; }
.stat-gradient-3 { background: linear-gradient(135deg, #ffd166 0%, #ef476f 100%); color: white; }
.stat-gradient-4 { background: linear-gradient(135deg, #ef476f 0%, var(--theme-gradient, #7209b7) 100%); color: white; }
.stat-gradient-5 { background: linear-gradient(135deg, #118ab2 0%, var(--primary) 100%); color: white; }
.stat-gradient-6 { background: linear-gradient(135deg, var(--theme-gradient, #7209b7) 0%, #ffd166 100%); color: white; }
.stat-gradient-7 { background: linear-gradient(135deg, #4158D0 0%, #C850C0 46%, #FFCC70 100%); color: white; }
.stat-gradient-8 { background: linear-gradient(135deg, #0093E9 0%, #80D0C7 50%, #FADB6A 100%); color: white; }
.stat-gradient-9 { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); color: white; }
.stat-gradient-10 { background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%); color: white; }
.stat-gradient-11 { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); color: white; }
.stat-gradient-12 { background: linear-gradient(135deg, #e67e22 0%, #d35400 100%); color: white; }

.stat-card-mini {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    transition: var(--transition);
}
.stat-card-mini:hover { transform: translateY(-2px); }

/* ===== Map ===== */
/* Tinggi peta diatur lewat kelas map-h-*, bukan inline style.
   Alasannya: inline style selalu menang atas stylesheet, sehingga aturan
   responsive di bawah tidak pernah bisa berlaku pada peta. */
.map-container {
    border-radius: 0 0 var(--card-radius) var(--card-radius);
    z-index: 1;
}
.map-container-full {
    height: calc(100vh - 100px);
    border-radius: var(--card-radius);
}
/* Pembungkus-generik: membulatkan tepi dan memberi warna latar dasar
   supaya peta tidak tampak seperti kotak kosong selepas tile dimuat. */
.map-box {
    border-radius: 12px;
    overflow: hidden;
    background: #e9eef2;
    touch-action: pan-y;
}
.map-h-sm { height: 300px; } /* peta hp */
.map-h-md { height: 520px; }  /* peta daftar modul + halaman public */
.map-h-lg { height: 560px; }  /* peta monitoring */
.map-h-xl { height: 760px; }  /* dashboard + peta publik */
.map-h-responsive { height: 520px; }

.map-coordinate-picker {
    height: 400px;
    border-radius: 12px;
    border: 2px dashed var(--gray-300);
    cursor: crosshair;
}
.sidebar-map { height: 100vh; position: sticky; top: 0; }

/* ===== Marker Jalan Rusak =====
   Skala marker mengikuti level zoom, diatur lewat variabel --jr-marker-scale
   yang di-set dari jalan-map.js.

   Leaflet memposisikan .leaflet-marker-icon lewat transform DAN mengunci
   ukuran ikon lewat inline style. Karena itu:
   - <img> yang suffered skala lewat width/height (butuh !important untuk
     mengalahkan inline style), lalu margin dikompensasi supaya titik
     jangkarnya tetap tepat di koordinat.
   - Elemen yang TIDAK diposisikan Leaflet (path SVG, .pin-wrap) aman
     diskalakan langsung dengan transform. */
img.leaflet-marker-icon.jr-marker,
.leaflet-marker-icon.jr-marker > img[data-jr-base="32"] {
    width: calc(32px * var(--jr-marker-scale, 1)) !important;
    height: calc(32px * var(--jr-marker-scale, 1)) !important;
    margin: calc(16px * (1 - var(--jr-marker-scale, 1))) 0 0
           calc(16px * (1 - var(--jr-marker-scale, 1)));
}
.leaflet-marker-icon.jr-marker > img[data-jr-base="40"] {
    width: calc(40px * var(--jr-marker-scale, 1)) !important;
    height: calc(52px * var(--jr-marker-scale, 1)) !important;
    margin: calc(50px * (1 - var(--jr-marker-scale, 1))) 0 0
           calc(9px * (1 - var(--jr-marker-scale, 1)));
}
.leaflet-marker-icon.jr-marker > .pin-wrap,
path.jr-marker {
    transform: scale(var(--jr-marker-scale, 1));
    transition: transform .2s ease;
}
.leaflet-marker-icon.jr-marker > .pin-wrap { transform-origin: 50% 100%; }
path.jr-marker {
    transform-box: fill-box;
    transform-origin: 50% 50%;
}
/* Saat peta dikecilkan, penanda ujung disembunyikan supaya tidak memenuhi
   peta. Yang tersisa hanya pin pgsql dan garis merah. */
.jr-tanpa-ujung .leaflet-marker-icon.jr-end { display: none; }

.map-legend:not(.open) { width: auto; padding: 0; background: none; box-shadow: none; border-radius: 0; display: inline-block; }
.map-legend:not(.open) .legend-body { display: none; }
.map-legend:not(.open) .legend-toggle { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: white; border: none; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.15); font-size: 0.85rem; font-weight: 500; color: #333; cursor: pointer; }
.map-legend:not(.open) .legend-toggle:hover { background: #f5f5f5; }
.map-legend:not(.open) .legend-toggle .toggle-label { display: inline; }
.map-legend:not(.open) .legend-toggle .bi-chevron-down { display: none; }
.map-legend.open { width: 210px; padding: 10px 14px; background: white; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.15); transition: width 0.25s ease, padding 0.25s ease; }
.map-legend.open .legend-toggle { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; background: none; border: none; padding: 0; font-size: 0.85rem; font-weight: 600; color: #333; cursor: pointer; width: 100%; }
.map-legend.open .legend-toggle .bi-chevron-down { display: inline; float: right; margin-left: auto; transition: transform 0.3s; }
.map-legend.open .legend-body { display: block; }
.map-legend i { width: 18px; height: 18px; display: inline-block; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.map-legend span { cursor: pointer; display: inline-block; padding: 1px 4px; border-radius: 4px; transition: background 0.15s; }
.map-legend span:hover { background: #eef0ff; }
.map-legend span.active { font-weight: 600; }
.map-legend span.active i { box-shadow: 0 0 0 2px white, 0 0 0 4px currentColor; }
.map-legend .legend-body { font-size: 0.8rem; line-height: 1.8; }

/* ===== Map Search Inline ===== */
.map-search-inline { position: relative; }
.map-search-inline .form-select, .map-search-inline .form-control { border-radius: 8px; font-size: 0.8rem; }
.search-results-inline { position: absolute; top: 100%; left: 0; right: 0; min-width: 200px; max-height: 250px; overflow-y: auto; background: white; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); z-index: 1000; margin-top: 4px; }
.search-result-item-inline { padding: 6px 10px; font-size: 0.8rem; cursor: pointer; border-bottom: 1px solid #eee; transition: background 0.15s; }
.search-result-item-inline:hover { background: #eef0ff; }
.search-result-item-inline:last-child { border-bottom: none; }

/* ===== Data Tables ===== */
.data-table { font-size: 0.875rem; }
.data-table img {
    width: 45px; height: 45px; object-fit: cover;
    border-radius: 8px;
}
.data-table thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.75rem 0.5rem;
    color: var(--gray-600);
}
.data-table tbody td { padding: 0.65rem 0.5rem; vertical-align: middle; }

/* ===== Badges ===== */
.status-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}
.status-selesai, .badge-selesai { background: #d4edda; color: #155724; }
.status-berjalan, .badge-berjalan { background: #fff3cd; color: #856404; }
.status-belum_dimulai, .badge-belum_dimulai { background: #f8d7da; color: #721c24; }
.status-ringan { background: #ffeb3b; color: #333; }
.status-sedang { background: #ffe0b2; color: #e65100; }
.status-berat { background: #f8d7da; color: #721c24; }

/* ===== Filter Section ===== */
.filter-section {
    background: white;
    padding: 1.25rem;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.25rem;
}

/* ===== Popups ===== */
.leaflet-popup { max-width: 300px; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.18); padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0; font-size: 0.8rem; line-height: 1.4; max-height: 450px; overflow-y: auto; }
.leaflet-popup-content::-webkit-scrollbar { width: 4px; }
.leaflet-popup-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.leaflet-popup-tip { box-shadow: none; }
.popup-custom { width: 210px; }
.popup-img { width: 100%; background: linear-gradient(135deg, #1a237e 0%, #283593 100%); padding: 4px; text-align: center; }
.popup-img img { width: 100%; height: 110px; object-fit: contain; object-position: center; display: block; }
.popup-body { padding: 8px 10px 10px; text-align: center; }
.popup-body h5 {
    margin: 0 0 2px; font-size: 0.8rem; font-weight: 600; line-height: 1.3; color: #1a1a1a;
}
.popup-body .popup-subtitle {
    margin: 0 0 4px; font-size: 0.7rem; color: #555; font-weight: 500;
}
.popup-body p { margin: 0 0 2px; font-size: 0.68rem; color: #555; line-height: 1.4; }
.popup-body p:last-child { margin-bottom: 0; }
.popup-body a { color: #25D366; text-decoration: none; font-weight: 500; }
.popup-body a:hover { text-decoration: underline; }
.popup-body .status-badge { padding: 1px 6px; border-radius: 8px; font-size: 0.6rem; font-weight: 500; display: inline-block; }
.popup-btn {
    display: block; width: 100%; margin-top: 6px; padding: 4px 0; text-align: center;
    background: var(--primary); color: #fff !important; border-radius: 5px; font-size: 0.68rem; font-weight: 500;
    transition: background 0.2s;
}
.popup-btn:hover { background: #3651d4; text-decoration: none !important; }
@media (max-width: 992px) { .leaflet-popup { max-width: 210px; } .popup-custom { width: 210px; } .popup-img img { height: 100px; } }
@media (max-width: 576px) { .leaflet-popup { max-width: 170px; } .popup-custom { width: 170px; } .popup-img img { height: 80px; } }
@media (max-width: 420px) { .leaflet-popup { max-width: 160px; } .popup-custom { width: 160px; } .popup-img img { height: 70px; } .popup-body { padding: 6px 8px 8px; } .popup-body h5 { font-size: 0.7rem; } .popup-body p { font-size: 0.62rem; } .popup-btn { font-size: 0.62rem; padding: 3px 0; } }

/* ===== Navbar ===== */
.navbar {
    background: var(--header-bg) !important;
    padding: 0.6rem 1rem;
    box-shadow: 0 2px 12px rgba(var(--theme-color-rgb), 0.3);
}
.navbar.sticky-top {
    z-index: 1030 !important;
}
.navbar-brand { font-weight: 700; letter-spacing: 0.3px; font-size: 1.1rem; }
.navbar .nav-link { padding: 0.5rem 0.8rem; border-radius: 8px; font-weight: 500; font-size: 0.85rem; transition: var(--transition); }
.navbar .nav-link:hover, .navbar .nav-link.active { background: rgba(255,255,255,0.15); }
.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-radius: 12px;
    margin-top: 6px;
    z-index: 1050 !important;
    position: absolute !important;
}
.navbar .dropdown-item { padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; }
.navbar .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }

/* ===== Login ===== */
.login-page {
    background: var(--hero-bg);
    min-height: 100vh;
    display: flex; align-items: center;
}
.login-card {
    border-radius: 20px; border: none;
    overflow: hidden;
}
.login-card .card-header {
    background: var(--hero-bg);
    color: white; text-align: center;
    padding: 2rem 1.5rem;
    border-bottom: none;
}
.login-card .card-header h4 { margin: 0; font-weight: 700; }
.login-card .card-header p { margin: 0.5rem 0 0; opacity: 0.8; font-size: 0.9rem; }
.login-card .card-body { padding: 2rem; }

/* ===== Buttons ===== */
.btn {
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(var(--theme-color-rgb), 0.3); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: var(--success-dark); border-color: var(--success-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-info { background: var(--info); border-color: var(--info); color: white; }
.btn-info:hover { background: var(--info-dark); border-color: var(--info-dark); color: white; }
.btn-sm { border-radius: 8px; padding: 0.35rem 0.9rem; }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* ===== ===== */
.ranking-card {
    border-left: 4px solid var(--primary);
    border-radius: 12px;
}
.ranking-card:nth-child(1) { border-left-color: #ffc107; }
.ranking-card:nth-child(2) { border-left-color: #adb5bd; }
.ranking-card:nth-child(3) { border-left-color: #cd7f32; }

.progress { height: 24px; border-radius: 12px; background: var(--gray-200); }
.progress-bar { font-size: 0.75rem; font-weight: 600; border-radius: 12px; }

/* ===== Quick Action ===== */
.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    color: var(--gray-800);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
}
.quick-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--theme-color-rgb), 0.15);
}
.quick-action-btn .quick-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    font-size: 1rem;
}

/* ===== Welcome Section ===== */
.welcome-section {
    background: var(--hero-bg);
    border-radius: var(--card-radius);
    padding: 1.5rem 2rem;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.welcome-section::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}
.welcome-section::before {
    content: '';
    position: absolute;
    right: 60px;
    bottom: -60px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}
.welcome-section h4 { font-weight: 700; margin-bottom: 0.25rem; }
.welcome-section p { opacity: 0.85; font-size: 0.9rem; margin-bottom: 0; }

/* ===== Charts ===== */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { max-height: 250px; }

/* ===== Recent Activity ===== */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.activity-text { font-size: 0.85rem; line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 0.75rem; color: var(--gray-600); }

/* ===== Section Title ===== */
.section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

/* ===== Mini List ===== */
.mini-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--gray-100);
    text-decoration: none;
    color: var(--gray-800);
    transition: var(--transition);
}
.mini-list-item:last-child { border-bottom: none; }
.mini-list-item:hover { padding-left: 4px; color: var(--primary); }
.mini-list-photo { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; border: 1px solid #ddd; }
.mini-list-badge {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.carousel-viewport { overflow: hidden; height: 168px; }
.carousel-slider { transition: margin-top 0.5s ease; }

/* ===== Leaflet Overrides ===== */
.leaflet-control-zoom a { background: white; color: var(--gray-800); border: none; box-shadow: 0 2px 6px rgba(0,0,0,0.1); border-radius: 8px !important; margin: 2px; width: 32px; height: 32px; line-height: 32px; }
.leaflet-control-layers { border-radius: 10px !important; border: none !important; box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important; }

/* ===== Public Hero ===== */
.hero-section {
    background: var(--hero-bg);
    padding: 5rem 0 4rem;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: -1rem -1.5rem 1.5rem;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}
.hero-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}
.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.75rem;
}
.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.85;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}
.hero-cta .btn {
    padding: 0.7rem 2rem;
    font-weight: 600;
    border-radius: 50px;
    margin: 0.25rem;
}
.hero-cta .btn-outline-light:hover {
    background: white;
    color: var(--primary);
}
.hero-wave {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    line-height: 0;
}

@media (max-width: 767.98px) {
    .hero-section { padding: 3rem 1rem 2.5rem; margin: -1rem -0.75rem 1rem; }
    .hero-title { font-size: 1.6rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .hero-icon { font-size: 2.5rem; }
}

/* ===== Public Features ===== */
.feature-card {
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: var(--card-radius);
    background: white;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    border: none;
    height: 100%;
}
.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
}
.feature-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    margin: 0 auto 1.25rem;
    font-size: 1.5rem;
}
.feature-card h5 { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 0; }

/* ===== Public Map Section ===== */
.map-section {
    border-radius: var(--card-radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background: white;
}
.map-section .map-header {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-100);
}
.map-section .map-header h5 { margin: 0; font-weight: 600; font-size: 0.95rem; }

/* ===== Photo Pin Marker ===== */
.custom-pin-marker {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
    transition: transform .2s ease;
}
.custom-pin-marker:hover {
    transform: scale(1.08);
    transform-origin: center bottom;
}
.pin-wrap {
    position: relative;
    width: 24px;
    height: 30px;
}
.pin-body {
    position: absolute;
    left: 2px;
    top: 0;
    width: 20px;
    height: 30px;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2092%22%3E%3Cpath%20d%3D%22M32%200%20A32%2032%200%200%200%200%2032%20C0%2048%2028%2086%2032%2092%20C36%2086%2064%2048%2064%2032%20A32%2032%200%200%200%2032%200%20Z%22%20fill%3D%22%23fdf6e3%22%2F%3E%3C%2Fsvg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 3px 10px rgba(0,0,0,.4));
    z-index: 1;
}
.avatar {
    position: absolute;
    left: 4px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    background: #f0f0f0;
    z-index: 2;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pin-badge {
    position: absolute;
    top: -2px;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,.2);
    z-index: 2;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .map-h-sm, .map-h-md, .map-h-lg, .map-h-xl, .map-h-responsive { height: 440px; }
    .welcome-section { padding: 1.25rem; }
    .welcome-section h4 { font-size: 1.1rem; }
    .stat-card .stat-value { font-size: 1.4rem; }
}
@media (max-width: 767.98px) {
    .map-h-sm, .map-h-md, .map-h-lg, .map-h-xl, .map-h-responsive { height: 340px; }
    .map-coordinate-picker { height: 300px; }
    .navbar .navbar-nav .nav-link { padding: 0.4rem 0.8rem; }
    .chart-container canvas { max-height: 180px; }

    /* Map card header */
    .card-header.bg-white > span {
        font-size: 0.9rem;
    }
    .card-header.bg-white > .d-flex {
        gap: 6px !important;
    }

    /* Search: full width, select narrower */
    .map-search-inline {
        width: 100% !important;
    }
    .map-search-inline .form-select {
        max-width: none !important;
        flex: 0 0 35% !important;
    }
    .map-search-inline .form-control {
        width: 0 !important;
        min-width: 0 !important;
        flex: 1 !important;
    }
    .search-results-inline {
        min-width: 100% !important;
    }

    /* Buttons: compact */
    .card-header.bg-white > .d-flex > .btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
        white-space: nowrap;
    }
}

/* ===== Jalan Rusak Index Mobile Improvements ===== */
@media (max-width: 767.98px) {
    /* Header actions: smaller buttons */
    .d-flex.gap-1 .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    .d-flex.gap-1 .btn-sm i {
        font-size: 1rem;
    }
    
    /* Filter form: compact inputs */
    .card-body .form-control-sm,
    .card-body .form-select-sm {
        font-size: 0.85rem;
        padding: 0.35rem 0.6rem;
        min-height: 40px;
    }
    
    /* Table: smaller font, better touch targets */
    .data-table {
        font-size: 0.8rem;
    }
    .data-table thead th {
        font-size: 0.7rem;
        padding: 0.5rem 0.35rem;
    }
    .data-table tbody td {
        padding: 0.5rem 0.35rem;
    }
    .data-table .badge {
        font-size: 0.65rem;
        padding: 0.3em 0.6em;
    }
    
    /* Action buttons in table */
    .data-table .btn-sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Map container: prevent horizontal scroll */
    .map-box {
        border-radius: 8px;
    }
    
    /* Card padding */
    .card-body {
        padding: 0.9rem;
    }
    .card-header {
        padding: 0.75rem 0.9rem;
    }
}

/* ===== Form Jalan Rusak di HP =====
  Prinsipnya: target sentuh minimal 44px (rekomendasi Android/iOS),
   keyboard angka untuk koordinat, dan peta dibuka layar penuh seperti
   aplikasi native — karena di bawah 768px kolom peta jatuh ke bawah form,
   sehingga peta tidak terlihat saat mengisi koordinat.

   Aturan ini sengaja di dalam media query: tampilan desktop tidak berubah. */
@media (max-width: 767.98px) {
    /* min-height 46px + font 1rem (16px). Font di bawah 16px membuat
       Safari auto-zoom halaman saat input difokuskan. */
    .jr-form .form-control,
    .jr-form .form-select,
    .jr-form .btn { min-height: 46px; font-size: 1rem; }

    .jr-form .form-label { margin-bottom: .25rem; font-size: .9rem; }

    /* Latitude/longitude tetap berdampingan: angkanya pendek, menumpuknya
       hanya memperpanjang halaman tanpa menambah informasi. */
    .jr-form .jr-pair > [class*="col-"] { margin-bottom: .5rem; }

    /* Koordinat: keypad angka + enter untuk pindah field. */
    .jr-form .jr-koordinat {
        font-variant-numeric: tabular-nums;
        letter-spacing: .01em;
    }

    /* Tombol GPS jadi satu baris penuh, bukan lagi btn-sm mungil. */
    .jr-form .btn-gps { width: 100%; }
    .jr-form .jr-petunjuk { display: block; margin-left: 0 !important; margin-top: .35rem; }

    /* Petunjuk panjang disembunyikan di HP, detailnya ada di tooltip/di atas. */
    .jr-form .jr-petunjuk-panjang { display: none; }

    /* Foto: area lebar yang bisa diketuk, bukan input file kecil. */
    .jr-form .jr-foto-label {
        display: flex;
        align-items: center;
        gap: .6rem;
        padding: .7rem .8rem;
        border: 1px dashed var(--gray-400, #ced4da);
        border-radius: 10px;
        background: #f8f9fa;
    }
    .jr-form .jr-foto-label .form-control { min-height: 0; padding: 0; border: 0; background: transparent; }
    .jr-form .jr-foto-thumbnail { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }

    /* Aksi Simpan/Batal menempel di bawah layar seperti tombol native. */
    .jr-aksi-seluler {
        position: sticky;
        bottom: 0;
        z-index: 1020;
        display: flex;
        gap: .5rem;
        margin: 0 -0.25rem;
        padding: .6rem .25rem calc(.6rem + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 35%);
    }
    .jr-aksi-seluler .btn { flex: 1; }
    /* Bar aksi ada di dalam form, jadi jarak bawah form tetap dijaga agar
       field terakhir tidak menempel ke bar. */
    .jr-form { padding-bottom: .5rem; }
    /* Keterangan lebih tinggi di HP supaya comfortable diketik. */
    .jr-form textarea.form-control { min-height: 104px; }
}

/* Desktop: batasi ukuran thumbnail foto agar tidak terlalu besar */
@media (min-width: 768px) {
    .jr-form .jr-foto-thumbnail { 
        width: 120px; 
        height: 90px; 
        object-fit: cover; 
        border-radius: 8px; 
        flex-shrink: 0; 
    }
}

/* Peta sebagai layar penuh (hanya di HP). Dipicu lewat kelas .jr-peta penuh
   yang ditambahkan JS, supaya tidak ada perilaku tak terduga tanpa JS. */
@media (max-width: 767.98px) {
    .jr-peta.jr-peta penuh {
        position: fixed;
        inset: 0;
        z-index: 1090;
        border: 0;
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        box-shadow: none;
    }
    .jr-peta.jr-peta penuh .card-header { padding-top: calc(.5rem + env(safe-area-inset-top, 0px)); }
    .jr-peta.jr-peta penuh .card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .jr-peta.jr-peta penuh .jr-peta-map { flex: 1; height: auto; min-height: 0; }
    /* Sheet bawah: readout koordinat + tombol, seperti bottom sheet native. */
    .jr-peta.jr-peta penuh .jr-peta-sheet {
        display: flex;
        flex-direction: column;
        gap: .5rem;
        padding-top: .6rem;
        padding-bottom: calc(.6rem + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid var(--gray-200, #e9ecef);
        background: #fff;
    }
}
/* Di desktop sheet bawah disembunyikan, readout cukup di card koordinat. */
.jr-peta-sheet { display: none; }
.jr-readout { font-variant-numeric: tabular-nums; }
@media (max-width: 767.98px) {
    body.jr-peta-terbuka { overflow: hidden; }
    /* Kontrol zoom Leaflet kecil; perbesar agar tidak salah tap. */
    .jr-peta.jr-peta penuh .leaflet-control-zoom a {
        width: 44px;
        height: 44px;
        line-height: 44px;
        font-size: 1.25rem;
    }
}
