/* SIPERMAP-SPAM — tema modern (Bootstrap 5.3 + kustom) */
:root {
  --sp-primary: #0369a1;
  --sp-primary-2: #0ea5e9;
  --sp-accent: #14b8a6;
  --sp-bg: #f1f5f9;
  --sp-card: #ffffff;
  --sp-border: #e2e8f0;
  --sp-text: #0f172a;
  --sp-muted: #64748b;
  --sp-sidebar: #0b1e33;
  --sp-sidebar-2: #0f2a47;
  --sp-radius: 16px;
  --sp-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-bs-theme="dark"] {
  --sp-bg: #0b1220;
  --sp-card: #111a2b;
  --sp-border: #1e293b;
  --sp-text: #e2e8f0;
  --sp-muted: #94a3b8;
  --sp-sidebar: #060d18;
  --sp-sidebar-2: #0a1628;
  --sp-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
  --bs-body-bg: #0b1220;
}

body { background: var(--sp-bg); color: var(--sp-text); font-size: .925rem; }

/* ---------- Layout ---------- */
.sp-shell { display: flex; min-height: 100vh; }
.sp-sidebar {
  width: 260px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--sp-sidebar) 0%, var(--sp-sidebar-2) 100%);
  color: #cbd5e1; padding: 1.25rem .9rem; z-index: 1040;
}
.sp-brand { display: flex; align-items: center; gap: .7rem; padding: .25rem .5rem 1.25rem; color: #fff; text-decoration: none; }
.sp-brand-logo {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem;
  background: linear-gradient(135deg, var(--sp-primary-2), var(--sp-accent)); color: #fff;
  box-shadow: 0 6px 18px -6px rgba(14, 165, 233, .7);
}
.sp-brand b { display: block; font-size: 1.05rem; letter-spacing: .3px; }
.sp-brand small { color: #7dd3fc; font-size: .7rem; letter-spacing: .4px; }
.sp-nav-title { font-size: .68rem; text-transform: uppercase; letter-spacing: 1.2px; color: #64748b; margin: 1rem .75rem .4rem; }
.sp-nav a {
  display: flex; align-items: center; gap: .7rem; padding: .58rem .75rem; border-radius: 10px;
  color: #cbd5e1; text-decoration: none; font-weight: 500; transition: all .15s;
}
.sp-nav a i { font-size: 1.05rem; opacity: .85; }
.sp-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sp-nav a.active { background: linear-gradient(90deg, rgba(14, 165, 233, .25), rgba(20, 184, 166, .08)); color: #fff; box-shadow: inset 3px 0 0 var(--sp-primary-2); }
.sp-nav .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sp-sidebar-foot { margin-top: 1.5rem; padding: .85rem; border-radius: 12px; background: rgba(255, 255, 255, .04); font-size: .75rem; color: #94a3b8; }

.sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-topbar {
  position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 1rem;
  padding: .85rem 1.75rem; background: color-mix(in srgb, var(--sp-bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--sp-border);
}
.sp-topbar h1 { font-size: 1.2rem; font-weight: 700; margin: 0; }
.sp-topbar .crumb { color: var(--sp-muted); font-size: .78rem; }
.sp-content { padding: 1.5rem 1.75rem 3rem; }

/* ---------- Komponen ---------- */
.sp-card { background: var(--sp-card); border: 1px solid var(--sp-border); border-radius: var(--sp-radius); box-shadow: var(--sp-shadow); }
.sp-card-h { padding: 1rem 1.25rem; border-bottom: 1px solid var(--sp-border); display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sp-card-h h2, .sp-card-h h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.sp-card-b { padding: 1.25rem; }

.sp-hero {
  border-radius: 20px; padding: 1.6rem 1.75rem; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(20, 184, 166, .55), transparent 60%),
              linear-gradient(120deg, #075985 0%, #0369a1 45%, #0e7490 100%);
}
.sp-hero::after {
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%);
}
.sp-hero h2 { font-weight: 800; font-size: 1.55rem; margin-bottom: .25rem; }
.sp-hero p { opacity: .85; margin: 0; max-width: 680px; }

.stat { padding: 1.1rem 1.2rem; display: flex; gap: 1rem; align-items: center; height: 100%; }
.stat-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-v { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat-l { color: var(--sp-muted); font-size: .8rem; font-weight: 500; }

.spam-card { position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; text-decoration: none; color: inherit; display: block; height: 100%; }
.spam-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -16px rgba(2, 132, 199, .45); color: inherit; }
.spam-card .band { height: 5px; }
.spam-card .total { font-size: 2rem; font-weight: 800; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--bs-tertiary-bg); }
.chip i { font-size: .85rem; }

.jenis-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 8px; font-size: .75rem; font-weight: 600; color: #fff; }

.kondisi-Baik { background: #dcfce7; color: #166534; }
.kondisi-Rusak-Ringan { background: #fef3c7; color: #92400e; }
.kondisi-Rusak-Berat { background: #fee2e2; color: #991b1b; }
[data-bs-theme="dark"] .kondisi-Baik { background: rgba(34, 197, 94, .15); color: #86efac; }
[data-bs-theme="dark"] .kondisi-Rusak-Ringan { background: rgba(245, 158, 11, .15); color: #fcd34d; }
[data-bs-theme="dark"] .kondisi-Rusak-Berat { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.pill { display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }

.tbl { margin: 0; }
.tbl thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .6px; color: var(--sp-muted); font-weight: 700; background: var(--bs-tertiary-bg); border-bottom: 1px solid var(--sp-border); white-space: nowrap; }
.tbl td { vertical-align: middle; border-color: var(--sp-border); }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--sp-primary-2) 6%, transparent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.matrix td.num { font-weight: 700; font-size: 1rem; }
.matrix tfoot td { font-weight: 800; background: var(--bs-tertiary-bg); }

.warn-dot { width: 8px; height: 8px; border-radius: 50%; background: #f97316; display: inline-block; box-shadow: 0 0 0 3px rgba(249, 115, 22, .2); }

.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: linear-gradient(135deg, var(--sp-primary), var(--sp-primary-2)); border: 0; }
.btn-primary:hover { filter: brightness(1.08); }
.form-control, .form-select { border-radius: 10px; }
.form-label { font-weight: 600; font-size: .82rem; color: var(--sp-muted); }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--sp-border); }
.timeline li { position: relative; padding: 0 0 1.1rem 44px; }
.timeline .tl-dot { position: absolute; left: 6px; top: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .65rem; color: #fff; background: var(--sp-primary-2); box-shadow: 0 0 0 4px var(--sp-card); }

.dummy-tag { font-size: .62rem; font-weight: 800; letter-spacing: .5px; padding: .1rem .4rem; border-radius: 5px; background: #fde68a; color: #78350f; vertical-align: middle; }

.alert-placeholder { border-radius: 12px; border: 1px dashed #f59e0b; background: rgba(245, 158, 11, .08); color: inherit; }

/* ---------- Peta ---------- */
.map-wrap { position: relative; height: calc(100vh - 140px); min-height: 520px; border-radius: var(--sp-radius); overflow: hidden; border: 1px solid var(--sp-border); box-shadow: var(--sp-shadow); }
.map-wrap #map { position: absolute; inset: 0; }
.map-panel {
  position: absolute; top: 14px; left: 14px; z-index: 600; width: 300px; max-height: calc(100% - 28px); overflow-y: auto;
  background: color-mix(in srgb, var(--sp-card) 92%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--sp-border); border-radius: 14px; padding: 1rem; box-shadow: var(--sp-shadow);
}
.map-panel h6 { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--sp-muted); font-weight: 700; margin: .9rem 0 .5rem; }
.map-panel h6:first-child { margin-top: 0; }
.layer-row { display: flex; align-items: center; gap: .55rem; padding: .28rem .2rem; cursor: pointer; border-radius: 8px; font-size: .85rem; }
.layer-row:hover { background: var(--bs-tertiary-bg); }
.layer-row .cnt { margin-left: auto; font-size: .72rem; color: var(--sp-muted); font-weight: 700; }
.mk { position: relative;
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  border: 2px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
}
.mk i { transform: rotate(45deg); color: #fff; font-size: .85rem; }
.mk.warn::after { content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: #f97316; border: 2px solid #fff; }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 14px 16px; font-family: var(--bs-body-font-family); }
.pp-title { font-weight: 700; font-size: .95rem; margin-bottom: .35rem; }
.pp-table td { padding: .1rem .5rem .1rem 0; font-size: .8rem; }
.pp-table td:first-child { color: #64748b; }
.kec-label { background: transparent; border: 0; box-shadow: none; font-weight: 800; font-size: .72rem; color: #0f172a; text-shadow: 0 0 3px #fff, 0 0 3px #fff; text-transform: uppercase; letter-spacing: .5px; }
.kec-label::before { display: none; }
.legend-box { background: var(--sp-card); padding: .6rem .8rem; border-radius: 10px; box-shadow: var(--sp-shadow); font-size: .78rem; color: var(--sp-text); }

/* ---------- Responsif ---------- */
.sp-burger { display: none; }
@media (max-width: 991.98px) {
  .sp-sidebar { position: fixed; left: -280px; transition: left .2s; }
  .sp-sidebar.open { left: 0; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .sp-burger { display: inline-flex; }
  .sp-content, .sp-topbar { padding-left: 1rem; padding-right: 1rem; }
  .map-panel { width: calc(100% - 28px); max-height: 45%; }
}

/* ---------- Login / instalasi ---------- */
.auth-body { min-height: 100vh; }
.auth-wrap { display: flex; min-height: 100vh; }
.auth-side {
  flex: 1.1; color: #fff; padding: 4rem; align-items: center;
  background: radial-gradient(900px 400px at 100% 100%, rgba(20, 184, 166, .45), transparent 60%),
              linear-gradient(140deg, #0b1e33 0%, #075985 60%, #0e7490 100%);
}
.auth-side h1 { max-width: 560px; }
.auth-main { flex: 1; display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card-wide { max-width: 640px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--sp-primary), var(--sp-accent)); }

/* Peran tamu: sembunyikan tombol/form ubah data */
.peran-tamu form[method="post"]:not(.keep), .peran-tamu .wr { display: none !important; }

/* ---------- Google Maps ---------- */
.kec-label-g { font-weight: 800; font-size: .7rem; color: #0f172a; text-transform: uppercase; letter-spacing: .5px; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; pointer-events: none; white-space: nowrap; }
.dot-mk { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transform: translateY(50%); }
.gmap-error { padding: 1.5rem; margin: 1rem; border-radius: 12px; background: #fef2f2; color: #991b1b; font-size: .85rem; }
.gm-style .gm-style-iw-c { border-radius: 14px; }
.gm-style .gm-style-iw-d { font-family: var(--bs-body-font-family); }
