/* halaman peta sebaran izin */
.tone-green { --tone: #198754; --tone-soft: rgba(25, 135, 84, .12); }
.tone-amber { --tone: #d39200; --tone-soft: rgba(255, 193, 7, .22); }
.tone-red { --tone: #dc3545; --tone-soft: rgba(220, 53, 69, .12); }
.tone-blue { --tone: #0b5ed7; --tone-soft: rgba(11, 94, 215, .1); }

.map-page {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  height: calc(100vh - var(--header-h, 72px));
  height: calc(100dvh - var(--header-h, 72px));
  min-height: 560px;
  border-bottom: 1px solid var(--sp-border);
}

/* panel */
.map-panel { display: flex; flex-direction: column; min-height: 0; background: #fff; border-right: 1px solid var(--sp-border); z-index: 2; }
.mp-head { padding: 1.25rem 1.25rem .9rem; border-bottom: 1px solid var(--sp-border); }
.mp-title { font-size: 1.3rem; margin: 0 0 .2rem; }
.mp-sub { font-size: .82rem; color: var(--sp-muted); margin: 0 0 1rem; }

.mp-status { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .85rem; }
.mp-chip {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; user-select: none;
  padding: .3rem .55rem .3rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid var(--sp-border); background: #fff; color: var(--sp-muted);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.mp-chip input { position: absolute; opacity: 0; pointer-events: none; }
.mp-chip-dot { width: 9px; height: 9px; border-radius: 50%; background: #cfd8e3; transition: background .15s ease; }
.mp-chip-count { background: #eef2f7; border-radius: 999px; padding: 0 .4rem; font-size: .72rem; color: var(--sp-ink); }
.mp-chip:has(input:checked) { background: var(--tone-soft); border-color: transparent; color: var(--sp-ink); }
.mp-chip:has(input:checked) .mp-chip-dot { background: var(--tone); }
.mp-chip:has(input:checked) .mp-chip-count { background: #fff; }
.mp-chip:has(input:focus-visible) { outline: 3px solid rgba(11, 94, 215, .3); outline-offset: 1px; }

.mp-search { position: relative; margin-bottom: .75rem; }
.mp-search > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--sp-muted); pointer-events: none; }
.mp-search input { padding-left: 2.5rem; background: var(--sp-surface); border-color: transparent; }
.mp-search input:focus { background: #fff; }

.mp-layers { border: 1px solid var(--sp-border); border-radius: .75rem; }
.mp-layers > summary { display: flex; align-items: center; padding: .55rem .8rem; font-size: .85rem; font-weight: 600; color: var(--sp-ink); cursor: pointer; list-style: none; }
.mp-layers > summary::-webkit-details-marker { display: none; }
.mp-layers > summary .bi-chevron-down { transition: transform .2s ease; color: var(--sp-muted); }
.mp-layers[open] > summary .bi-chevron-down { transform: rotate(180deg); }
.mp-layers-body { padding: .2rem .8rem .8rem; display: grid; gap: .85rem; }
.mp-layer-title { display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--sp-muted); margin-bottom: .4rem; }
.mp-layers .form-check-label { font-size: .85rem; }
.ly-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--c); vertical-align: middle; margin-right: .45rem; }

.mp-list-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1.25rem; font-size: .8rem; color: var(--sp-muted); background: var(--sp-surface); border-bottom: 1px solid var(--sp-border); }
.mp-list-head strong { color: var(--sp-ink); }
.mp-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.mp-loading, .mp-empty { padding: 2rem 1.25rem; text-align: center; color: var(--sp-muted); font-size: .9rem; }
.mp-empty i { display: block; font-size: 1.75rem; opacity: .5; margin-bottom: .35rem; }
.mp-item {
  display: flex; gap: .75rem; align-items: flex-start; width: 100%; text-align: left;
  padding: .8rem 1.25rem; border: 0; border-bottom: 1px solid var(--sp-border); background: #fff;
  transition: background .12s ease;
}
.mp-item:hover { background: #f6f9fe; }
.mp-item.is-active { background: #eef4ff; box-shadow: inset 3px 0 0 var(--sp-primary); }
.mp-item.is-unmapped { opacity: .7; }
.mp-item .pin-dot { margin-top: .35rem; }
.mp-item-body { display: flex; flex-direction: column; min-width: 0; }
.mp-item-name { font-weight: 700; color: var(--sp-ink); font-size: .9rem; line-height: 1.3; }
.mp-item-meta { font-size: .78rem; color: var(--sp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-item-sub { font-size: .76rem; font-weight: 600; color: var(--tone); margin-top: .1rem; }
.mp-foot { padding: .65rem 1.25rem; border-top: 1px solid var(--sp-border); background: #fffbea; color: #6b5300 !important; }

.pin-dot { flex: 0 0 auto; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px var(--tone-soft); }

/* peta */
.map-stage { position: relative; min-width: 0; }
#permit-map { position: absolute; inset: 0; background: #e8eef6; }
.map-tools { position: absolute; top: 88px; right: 10px; z-index: 500; display: grid; gap: .4rem; }
.map-tool {
  width: 34px; height: 34px; border-radius: 4px; border: 2px solid rgba(0, 0, 0, .2); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: var(--sp-ink); background-clip: padding-box;
}
.map-tool:hover { background: #f4f4f4; }
.map-legend-box {
  position: absolute; left: 12px; bottom: 24px; z-index: 500;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px);
  border-radius: .75rem; padding: .65rem .85rem; box-shadow: 0 4px 16px rgba(15, 31, 61, .12);
  font-size: .78rem; display: grid; gap: .3rem; color: var(--sp-ink);
}
.map-legend-box .pin-dot { margin-right: .5rem; vertical-align: -1px; }
.map-panel-toggle { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 600; border-radius: 999px; box-shadow: 0 8px 22px rgba(11, 94, 215, .35); }

/* marker */
.pin-wrap { background: transparent; border: 0; }
.pin {
  display: block; width: 26px; height: 26px; margin: 1px;
  background: var(--tone); border: 3px solid #fff; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); box-shadow: 0 3px 8px rgba(15, 31, 61, .35);
}
.pin > span { display: block; width: 8px; height: 8px; margin: 6px; border-radius: 50%; background: #fff; }
.pin-cluster {
  display: flex !important; align-items: center; justify-content: center;
  background: rgba(11, 94, 215, .2); border-radius: 50%;
}
.pin-cluster span {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--sp-primary); color: #fff; font-weight: 800; font-size: .8rem; box-shadow: 0 2px 6px rgba(11, 94, 215, .45);
}

/* popup */
.leaflet-popup-content-wrapper { border-radius: .9rem; box-shadow: 0 10px 30px rgba(15, 31, 61, .2); }
.leaflet-popup-content { margin: .9rem 1rem; }
.map-popup { font-family: var(--bs-body-font-family); }
.map-popup .status-pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: var(--tone-soft); color: var(--tone);
}
.map-popup .status-pill i { font-size: .4rem; }
.map-popup .title { font-weight: 700; color: var(--sp-ink); font-size: .95rem; line-height: 1.3; }
.map-popup .sub { color: var(--sp-muted); font-size: .78rem; margin-bottom: .55rem; }
.map-popup table { width: 100%; font-size: .78rem; border-top: 1px solid var(--sp-border); }
.map-popup th { color: var(--sp-muted); font-weight: 600; padding: .3rem .6rem .3rem 0; vertical-align: top; white-space: nowrap; }
.map-popup td { padding: .3rem 0; color: var(--sp-ink); }
.map-popup .popup-link { display: inline-block; margin-top: .55rem; font-size: .8rem; font-weight: 600; text-decoration: none; }
.area-tip { font-size: .78rem; font-weight: 600; }

/* footer situs tidak perlu jarak atas di halaman peta */
.map-page + * { margin-top: 0; }
main:has(.map-page) + .site-footer { margin-top: 0 !important; }

@media (max-width: 991.98px) {
  .map-page { grid-template-columns: 1fr; position: relative; }
  .map-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: 78%;
    border-radius: 1.1rem 1.1rem 0 0; border-right: 0; box-shadow: 0 -10px 30px rgba(15, 31, 61, .2);
    transform: translateY(105%); transition: transform .25s ease; z-index: 1000;
  }
  .map-panel.is-open { transform: translateY(0); }
  .map-stage { grid-row: 1; grid-column: 1; }
  .map-legend-box { bottom: 80px; }
  .mp-head { padding: 1rem; }
}
