:root {
    --navy: #0F2A43;
    --muted: #667085;
    --stroke: rgba(2, 6, 23, .10);
    --bg: #F6F8FC;
    --card: rgba(255, 255, 255, .92);
}

body {
    background: var(--bg);
    padding-bottom: 64px;
}

/* ===== TAG ===== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(2, 6, 23, .10);
    background: #fff;
    font-weight: 950;
    font-size: 12px;
    color: #475467;
    white-space: nowrap;
}

/* ===== CONTROLBAR ===== */
.controlbar {
    position: sticky;
    top: 62px;
    z-index: 2900;
    background: rgba(255, 255, 255, .90);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(2, 6, 23, .08);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid var(--stroke);
    background: #fff;
    font-weight: 950;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    height: 38px;
}

.chip input {
    width: 16px;
    height: 16px;
}

.tb-search {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--stroke);
    background: #fff;
    border-radius: 14px;
    padding: 6px;
    width: min(720px, 100%);
    min-width: 240px;
    height: 44px;
    flex: 1 1 340px;
}

.tb-search input {
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    padding: 8px 10px !important;
    width: 100%;
    font-weight: 850;
}

/* ===== LAYOUT ===== */
.shell {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 12px;
    padding: 12px;
    max-width: 1600px;
    margin: 0 auto;
}

@media (max-width: 1100px) {
    .shell {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card);
    border: 1px solid rgba(2, 6, 23, .10);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(2, 6, 23, .08);
}

.sidebar {
    padding: 12px;
}

.map-wrap {
    padding: 0;
    overflow: hidden;
    position: relative;
}

#map {
    width: 100%;
    height: calc(100vh - 160px);
    min-height: 560px;
    background: #f5f7fb;
}

@media (max-width: 1100px) {
    #map {
        height: 520px;
        min-height: 520px;
    }
}

.section-title {
    font-size: 11px;
    letter-spacing: .14em;
    font-weight: 950;
    text-transform: uppercase;
    color: #475467;
    margin-bottom: 10px;
}

.field {
    margin-bottom: 10px;
}

label {
    font-size: 12px;
    font-weight: 900;
    color: #0B1220;
    display: block;
    margin-bottom: 6px;
}

input,
select {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(2, 6, 23, .12);
    font-weight: 850;
    background: #fff;
    box-sizing: border-box;
}

.inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 520px) {
    .inline {
        grid-template-columns: 1fr;
    }
}

.hint {
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    line-height: 1.35;
}

.btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.btn2 {
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(2, 6, 23, .12);
    background: #fff;
    font-weight: 950;
    cursor: pointer;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn2.primary {
    background: var(--navy);
    color: #fff;
    border-color: rgba(15, 42, 67, .10);
}

.btn2.ghost {
    background: #fff;
    color: var(--navy);
}

/* ===== KPI ===== */
.kpi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.kbox {
    border: 1px solid rgba(2, 6, 23, .10);
    background: #fff;
    border-radius: 14px;
    padding: 10px;
}

.kbox .v {
    font-weight: 950;
    font-size: 18px;
    color: #0B1220;
}

.kbox .l {
    font-weight: 800;
    font-size: 11px;
    color: var(--muted);
    margin-top: 3px;
}

/* ===== MAP TOOLS ===== */
.map-tools {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 1200;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    max-width: calc(100% - 24px);
}

.map-tools .btn2 {
    height: 40px;
}

/* ===== HEATBAR ===== */
.heatbar {
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(2, 6, 23, .12);
    background: #fff;
}

.heatbar .grad {
    height: 10px;
    background: linear-gradient(
        90deg,
        rgba(16, 185, 129, .20) 0%,
        rgba(245, 158, 11, .55) 55%,
        rgba(239, 68, 68, .95) 100%
    );
}

.heatbar .lbl {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 900;
    color: #0B1220;
}

/* ===== Heat Strength ===== */
.slider-wrap {
    margin-top: 10px;
    border: 1px solid rgba(2, 6, 23, .10);
    background: #fff;
    border-radius: 14px;
    padding: 10px;
}

.slider-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.slider-top .t {
    font-weight: 950;
    font-size: 12px;
    color: #0B1220;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.slider-top .v {
    font-weight: 950;
    font-size: 12px;
    color: #475467;
}

input[type="range"] {
    width: 100%;
    height: 36px;
}

/* ===== FOOTER ===== */
.footerbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2500;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(2, 6, 23, .10);
}

.footer-meta {
    font-weight: 850;
    font-size: 10px;
    color: #667085;
    white-space: nowrap;
}

.footer-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(2, 6, 23, .10);
    background: #fff;
    font-weight: 950;
    font-size: 12px;
    color: #475467;
}

/* ===== Leaflet control spacing ===== */
.leaflet-top.leaflet-right {
    margin-top: 8px;
    margin-right: 8px;
}

/* ===== layers control compact ===== */
.leaflet-control-layers {
    background: rgba(255, 255, 255, .72) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(2, 6, 23, .25) !important;
    border-radius: 10px !important;
    box-shadow: 0 10px 24px rgba(2, 6, 23, .12) !important;
    padding: 6px 8px !important;
}

.leaflet-control-layers.leaflet-control-layers-expanded {
    padding: 6px 8px !important;
}

.leaflet-control-layers-base,
.leaflet-control-layers-overlays {
    padding: 0 !important;
    margin: 0 !important;
}

.leaflet-control-layers label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 2px 0 !important;
    margin: 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    line-height: 1.2 !important;
}

.leaflet-control-layers input {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.leaflet-control-layers-separator {
    border-top: 1px solid rgba(2, 6, 23, .18) !important;
    margin: 6px 0 !important;
}

.leaflet-control-layers-toggle {
    border-radius: 10px !important;
    border: 1px solid rgba(2, 6, 23, .25) !important;
    box-shadow: none !important;
}

@media (max-width: 520px) {
    .leaflet-control-layers label {
        font-size: 13px !important;
        font-weight: 700 !important;
    }
}

/* ===== Zoom indicator ===== */
.zoom-indicator {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 950;
    font-size: 12px;
    color: #0B1220;
    background: rgba(255, 255, 255, .70);
    border: 1px solid rgba(2, 6, 23, .10);
    box-shadow: 0 10px 24px rgba(2, 6, 23, .12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ===== Toast ===== */
#toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 14px;
    border-radius: 14px;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: .2px;
    color: #0B1220;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(2, 6, 23, .10);
    box-shadow: 0 12px 30px rgba(2, 6, 23, .14);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* ===== Leaflet controls general ===== */
.leaflet-control-container .leaflet-control {
    box-shadow: 0 10px 24px rgba(2, 6, 23, .12);
    border-radius: 14px;
    border: 1px solid rgba(2, 6, 23, .08);
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, .75) !important;
    border: 0 !important;
    color: #0B1220 !important;
    font-weight: 950;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, .92) !important;
}

/* ===== Popup styling ===== */
.leaflet-popup-content-wrapper {
    border-radius: 16px !important;
    border: 1px solid rgba(2, 6, 23, .08);
    box-shadow: 0 18px 40px rgba(2, 6, 23, .16);
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.leaflet-popup-tip {
    box-shadow: 0 10px 18px rgba(2, 6, 23, .14);
}

.leaflet-container a {
    color: #0F2A43;
}

/* =========================================================
   MARKER SVG (muip-pin) — sesuai utk semua marker tanpa cluster
   ========================================================= */
.muip-pin {
    background: transparent !important;
    border: none !important;
}

.muip-pin-wrap {
    width: 28px;
    height: 38px;
    display: block;
    position: relative;
    transform: translateY(-2px);
    transition: transform .15s ease;
    pointer-events: auto;
}

.muip-pin-svg {
    width: 28px;
    height: 38px;
    display: block;
    filter: drop-shadow(0 8px 10px rgba(2, 6, 23, .20));
}

/* ===== Halo potensi ===== */
.muip-pin-wrap::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 6px;
    width: 22px;
    height: 22px;
    transform: translateX(-50%);
    border-radius: 999px;
    box-sizing: border-box;
    border: 0 solid transparent;
    opacity: 0;
    transition: opacity .15s ease, transform .15s ease;
}

.muip-pin-wrap.p-high::after {
    opacity: 1;
    border-width: 3px;
    border-color: rgba(22, 163, 74, .90);
    box-shadow: 0 0 0 6px rgba(22, 163, 74, .18);
}

.muip-pin-wrap.p-med::after {
    opacity: 1;
    border-width: 3px;
    border-color: rgba(245, 158, 11, .92);
    box-shadow: 0 0 0 6px rgba(245, 158, 11, .18);
}

.muip-pin-wrap.p-low::after {
    opacity: 1;
    border-width: 3px;
    border-color: rgba(239, 68, 68, .92);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, .18);
}

.muip-pin-wrap:hover {
    transform: translateY(-4px);
}

.muip-pin-wrap:hover::after {
    transform: translateX(-50%) scale(1.05);
}

/* ===== LEGEND ===== */
.map-legend {
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(2, 6, 23, .10);
    box-shadow: 0 18px 40px rgba(2, 6, 23, .14);
    border-radius: 16px;
    padding: 10px 12px;
    min-width: 220px;
    color: #0B1220;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.map-legend .ttl {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-weight: 900;
}

.map-legend .muted {
    color: #667085;
    font-weight: 800;
    font-size: 11px;
}

.map-legend .row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 850;
}

.map-legend .dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .95);
    box-shadow: 0 6px 14px rgba(2, 6, 23, .12);
    flex: 0 0 12px;
}

.map-legend .count {
    margin-left: auto;
    color: #667085;
    font-weight: 900;
    font-size: 11px;
}

.leaflet-bottom.leaflet-right .map-legend {
    margin-right: 12px;
    margin-bottom: 70px;
}

/* ===== Mobile ===== */
@media (max-width: 680px) {
    #map {
        min-height: 460px;
    }

    .map-legend {
        min-width: 180px;
        margin-bottom: 64px;
    }

    .leaflet-popup-content {
        margin: 10px 12px !important;
    }

    .muip-pin-wrap {
        width: 26px;
        height: 36px;
    }

    .muip-pin-svg {
        width: 26px;
        height: 36px;
    }

    .muip-pin-wrap::after {
        width: 20px;
        height: 20px;
        top: 5px;
    }
}

@media (max-width: 520px) {
    .brand-sub {
        display: none;
    }

    .legend {
        width: 220px;
    }
}


.map-legend .row[data-jenis]{
    cursor: pointer;
    border-radius: 10px;
    transition: background .15s ease, transform .12s ease;
}

.map-legend .row[data-jenis]:hover{
    background: rgba(15, 42, 67, .08);
}

.map-legend .row[data-jenis].is-active{
    background: rgba(15, 42, 67, .14);
    box-shadow: inset 0 0 0 1px rgba(15, 42, 67, .16);
}