/* Jalur Peta Air Bersih — gaya aplikasi (mobile-first) */
:root {
  --navy: #166534; --blue: #15803D; --sky: #DCFCE7; --white: #ffffff;
  --green: #15803D; --green-soft: #DCFCE7; --amber: #CA8A04; --amber-soft: #FEF3C7;
  --orange: #EA580C; --red: #B91C1C; --red-soft: #FEE2E2;
  --ink: #0F172A; --ink-2: #334155; --muted: #64748B; --line: #E2E8F0; --bg: #F5F8FB; --card: #ffffff;
  --radius: 12px; --shadow: 0 2px 10px rgba(15, 23, 42, .10);
  --top-h: 56px; --bottom-h: 64px; --side-w: 230px;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 1.4em 0 .5em; color: var(--navy); }
h3 { font-size: 1rem; margin: 1em 0 .4em; }
code { background: var(--sky); padding: 0 4px; border-radius: 4px; font-size: .9em; }
.ic { width: 22px; height: 22px; fill: currentColor; flex: none; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 999; background: #fff; padding: 8px; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
.na { color: #8A94A3; font-style: italic; }
.center { text-align: center; justify-content: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }

/* ---------- Bilah atas ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top-h); background: var(--navy); color: #fff; display: flex; align-items: center; gap: 10px; padding: 0 12px; z-index: 50; padding-top: env(safe-area-inset-top); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; flex: 1; }
.brand img { border-radius: 9px; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand b { font-size: 1rem; white-space: nowrap; }
.brand small { font-size: .78rem; opacity: .85; white-space: nowrap; }
.net { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; background: rgba(255,255,255,.12); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.net i { width: 9px; height: 9px; border-radius: 50%; background: #4ADE80; display: inline-block; }
.net.off i { background: #F87171; }
.net small { opacity: .8; margin-left: 4px; }
.net { cursor: pointer; border: 0; }
.net.wait i { background: #FBBF24; }
.sync-box { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 12px; }
.sync-box .actions { margin: 0; }
@media (max-width: 420px) { .net small { display: none; } }

#banners { position: fixed; top: var(--top-h); left: 0; right: 0; z-index: 45; }
.banner { padding: 4px 12px; font-size: .8rem; line-height: 1.3; }
.banner a { color: inherit; font-weight: 600; }
.banner-red { background: #B91C1C; color: #fff; }
.banner-amber { background: var(--amber-soft); color: #78350F; border-bottom: 1px solid #FCD34D; }
.banner-blue { background: var(--sky); color: var(--navy); }

/* ---------- Navigasi ---------- */
.sidenav { display: none; }
.bottomnav { position: fixed; inset: auto 0 0 0; height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 50; }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 600; }
.bottomnav a.active { color: var(--navy); }
.bottomnav a.active .ic { background: var(--sky); border-radius: 999px; padding: 2px 14px; width: 52px; }
.bottomnav .nav-report { color: var(--orange); }

main { position: fixed; top: calc(var(--top-h) + var(--banner-h, 0px)); bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); left: 0; right: 0; }
.view { position: absolute; inset: 0; }
.view.page { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page-body { max-width: 980px; margin: 0 auto; padding: 16px 16px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- Peta ---------- */
.map { position: absolute; inset: 0; background: #DCE7F0; isolation: isolate; z-index: 0; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: .68rem; max-width: 70vw; }
.leaflet-bottom.leaflet-right { margin-bottom: 4px; }
.mk-wrap { background: none; border: 0; }
.vtx { width: 22px; height: 22px; border-radius: 50%; background: #F59E0B; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.5); }
.top-logos { display: none; align-items: center; gap: 6px; background: #fff; padding: 3px 8px; border-radius: 10px; }
.top-logos img { height: 34px; width: auto; }
.credit { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.credit img { height: 56px; width: auto; }
.credit p { flex: 1 1 220px; margin: 0; font-size: .9rem; color: var(--ink-2); }
.map-msg { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%); max-width: 460px; margin: 0 auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; z-index: 6; text-align: center; }
.map-msg h3 { margin-top: 0; color: var(--navy); }
.map-top { position: absolute; top: 10px; left: 10px; right: 64px; z-index: 5; max-width: 560px; }
.searchbox { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; box-shadow: var(--shadow); padding: 0 14px; height: 48px; color: var(--muted); }
.searchbox input { border: 0; outline: 0; flex: 1; font-size: 1rem; background: transparent; min-width: 0; height: 100%; }
.search-results { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 6px; max-height: 50vh; overflow-y: auto; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; border-bottom: 1px solid var(--line); font: inherit; cursor: pointer; }
.search-results button small { display: block; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: rgba(255,255,255,.95); border-radius: 999px; padding: 4px 11px; font-size: .8rem; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.15); color: var(--ink-2); text-decoration: none; }
.chip-att { color: #fff; }
.chip-tidak_mengalir { background: var(--red); } .chip-perlu_perbaikan { background: var(--orange); } .chip-debit_mengecil { background: var(--amber); }
.fabs { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.fab { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; color: var(--navy); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.fab-accent { background: var(--navy); color: #fff; }
.legend-toggle { position: absolute; left: 10px; bottom: 74px; z-index: 5; border: 0; background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; box-shadow: var(--shadow); color: var(--navy); }
.legend-toggle.on { background: var(--navy); color: #fff; }
.legend { position: absolute; left: 10px; bottom: 116px; z-index: 6; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 14px; max-height: 55vh; overflow-y: auto; width: min(320px, calc(100% - 20px)); font-size: .85rem; }
.legend h4 { margin: 8px 0 4px; font-size: .8rem; color: var(--navy); text-transform: uppercase; letter-spacing: .03em; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.mk { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: grid; place-items: center; cursor: pointer; }
.mk svg { width: 17px; height: 17px; }
.mk-sm { width: 24px; height: 24px; } .mk-sm svg { width: 13px; height: 13px; }
.mk-att { animation: pulse 1.6s infinite; }
.mk-wrap .mk { cursor: pointer; }
.mk-tidak_mengalir { box-shadow: 0 0 0 4px rgba(185,28,28,.5); } .mk-perlu_perbaikan { box-shadow: 0 0 0 4px rgba(234,88,12,.5); } .mk-debit_mengecil { box-shadow: 0 0 0 4px rgba(202,138,4,.55); }
@keyframes pulse { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .mk-att { animation: none; } }
.mk-legend { width: 22px; height: 22px; border-width: 2px; cursor: default; } .mk-legend svg { width: 12px; height: 12px; }
.my-loc { width: 18px; height: 18px; border-radius: 50%; background: #2563EB; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37,99,235,.25); }
.draw-bar { position: absolute; left: 10px; right: 10px; bottom: 12px; z-index: 8; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; border: 2px solid #F59E0B; }
.draw-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
body.drawing .fabs, body.drawing .map-top, body.drawing .legend-toggle { display: none; }

/* ---------- Panel filter ---------- */
.layers { position: fixed; z-index: 60; background: #fff; box-shadow: 0 -4px 20px rgba(0,0,0,.2); left: 0; right: 0; bottom: 0; max-height: 80vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.layers-head { display: flex; justify-content: space-between; align-items: center; }
.layers-head h3 { margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0; padding: 8px 12px; }
legend { font-weight: 700; font-size: .9rem; color: var(--navy); padding: 0 4px; }
.switch { display: flex; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.switch small { color: var(--muted); }
.switch.big { background: var(--sky); border-radius: var(--radius); padding: 10px 12px; margin-top: 10px; font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; }
.seg input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg input:focus-visible + span { outline: 3px solid #93C5FD; }
.seg-block { flex-direction: column; } .seg-block span { display: block; border-radius: var(--radius); }

/* ---------- Sheet detail ---------- */
.sheet { position: fixed; z-index: 55; left: 0; right: 0; bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); max-height: 56vh; background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.22); display: flex; flex-direction: column; transition: max-height .2s; }
.sheet.collapsed { max-height: 120px; }
.sheet-grip { width: 100%; height: 22px; cursor: pointer; flex: none; position: relative; }
.sheet-grip::after { content: ""; position: absolute; left: 50%; top: 8px; width: 44px; height: 5px; margin-left: -22px; background: #CBD5E1; border-radius: 9px; }
.sheet-close { position: absolute; right: 8px; top: 8px; border: 0; background: var(--bg); border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.sheet-body { overflow-y: auto; padding: 0 16px 20px; }
.d-head small { color: var(--muted); font-weight: 600; }
.d-head h2 { margin: 2px 40px 6px 0; color: var(--ink); font-size: 1.2rem; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #EEF2F6; color: var(--ink-2); }
.badge-ok { background: var(--green-soft); color: #166534; }
.badge-warn { background: var(--amber-soft); color: #854D0E; }
.badge-muted { background: #EEF2F6; color: #475569; }
.badge-att-tidak_mengalir { background: var(--red); color: #fff; } .badge-att-perlu_perbaikan { background: var(--orange); color: #fff; } .badge-att-debit_mengecil { background: var(--amber); color: #fff; }
.kv { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 6px 12px; margin: 10px 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.photos { display: flex; gap: 6px; flex-wrap: wrap; }
.photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
.note { background: var(--sky); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0; font-size: .92rem; }
.note-red { background: var(--red-soft); color: #7F1D1D; }
.note-amber { background: var(--amber-soft); color: #713F12; }
.note-green { background: var(--green-soft); color: #14532D; }
.note-att-tidak_mengalir { background: var(--red-soft); color: #7F1D1D; border-left: 4px solid var(--red); }
.note-att-perlu_perbaikan { background: #FFEDD5; color: #7C2D12; border-left: 4px solid var(--orange); }
.note-att-debit_mengecil { background: var(--amber-soft); color: #713F12; border-left: 4px solid var(--amber); }
.flow-box { background: var(--sky); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.flow-main { font-size: 1.05rem; }

/* ---------- Tombol & formulir ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid #CBD5E1; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-warn { background: #FFEDD5; border-color: #FDBA74; color: #9A3412; }
.btn-light { background: var(--sky); border-color: var(--sky); color: var(--navy); }
.btn-wa { background: #128C4B; border-color: #128C4B; color: #fff; }
.btn-wa-light { background: #E7F7EE; border-color: #A7E3C1; color: #0B5D33; justify-content: flex-start; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.btn-xs { min-height: 32px; padding: 4px 9px; font-size: .82rem; margin: 1px; }
.btn-lg { min-height: 54px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }
.btn .ic { width: 19px; height: 19px; }
.topbar .btn-light { background: #fff; }
.icon-btn { border: 0; background: var(--bg); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.link { border: 0; background: none; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; padding: 0 4px; }
.actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.actions.sticky { position: sticky; bottom: -16px; background: #fff; padding: 10px 0; margin-bottom: -6px; border-top: 1px solid var(--line); }
.recipients { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
label { display: block; margin: 10px 0; font-weight: 600; font-size: .92rem; }
label small { font-weight: 400; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; font-size: 1rem; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 10px; background: #fff; color: var(--ink); min-height: 46px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #93C5FD; outline-offset: 1px; }
input[readonly] { background: #F1F5F9; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 label { margin: 6px 0; }
.errors { color: var(--red); font-weight: 600; font-size: .92rem; }
.errors ul { margin: 6px 0; padding-left: 20px; }
.narrow { max-width: 420px; }
.file-btn { display: inline-block; cursor: pointer; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-btn span { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px dashed #94A3B8; border-radius: 10px; background: #fff; color: var(--navy); font-weight: 600; }
.file-btn input:focus-visible + span { outline: 3px solid #93C5FD; }
.photo-prev img { max-width: 100%; max-height: 240px; border-radius: 10px; display: block; }
details { margin: 10px 0; } summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 6px 0; }
.step { font-size: 1rem; color: var(--ink); margin-top: 1.4em; }
.issue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.issue { margin: 0; cursor: pointer; }
.issue input { position: absolute; opacity: 0; }
.issue span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 86px; text-align: center; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; padding: 8px; font-weight: 600; }
.issue i { font-style: normal; font-size: 1.6rem; }
.issue input:checked + span { border-color: var(--blue); background: var(--sky); color: var(--navy); }
.issue input:focus-visible + span { outline: 3px solid #93C5FD; }
.gps-ok { background: var(--green-soft); border-radius: 10px; padding: 8px 12px; margin-top: 8px; font-weight: 600; color: #14532D; }
pre.msg { white-space: pre-wrap; background: #F1F5F9; border-radius: 10px; padding: 10px 12px; font-size: .85rem; max-height: 260px; overflow-y: auto; }
.snap-preview { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 8px; }
.rep-photo { max-width: 100%; max-height: 220px; border-radius: 10px; margin: 6px 0; }

/* ---------- Halaman daftar ---------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); padding: 0 8px; position: sticky; top: 0; z-index: 4; scrollbar-width: none; }
.tabs a, .tabs button { flex: none; padding: 13px 12px; text-decoration: none; color: var(--muted); font-weight: 600; border: 0; background: none; border-bottom: 3px solid transparent; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs .active { color: var(--navy); border-bottom-color: var(--blue); }
.tabs.inline { position: static; background: none; padding: 0; margin: 8px 0 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 2 1 220px; margin: 0 !important; }
.toolbar select { flex: 1 1 150px; width: auto !important; margin: 0 !important; }
.cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-align: left; font: inherit; color: inherit; }
.card-btn { cursor: pointer; display: block; width: 100%; }
.card-btn:hover { border-color: #93C5FD; }
.card small { color: var(--muted); font-weight: 600; font-size: .78rem; }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-title { display: block; font-size: 1.02rem; margin: 2px 0; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; color: var(--ink-2); margin-top: 4px; }
.card-att { border-left-width: 5px; }
.card-att-tidak_mengalir { border-left-color: var(--red); } .card-att-perlu_perbaikan { border-left-color: var(--orange); } .card-att-debit_mengecil { border-left-color: var(--amber); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 8px 0; font-weight: 700; }
.stat-grid small { display: block; font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat small { display: block; color: var(--muted); font-weight: 600; }
.stat b { font-size: 1.3rem; display: block; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat-big { background: var(--sky); border-color: #BBF7D0; }
.stat-att-tidak_mengalir b { color: var(--red); } .stat-att-perlu_perbaikan b { color: var(--orange); } .stat-att-debit_mengecil b { color: var(--amber); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: #F8FAFC; color: var(--ink-2); font-size: .8rem; }
.empty { color: var(--muted); padding: 10px 0; }
.empty-state { text-align: center; background: #fff; border: 1px dashed #CBD5E1; border-radius: var(--radius); padding: 24px 16px; color: var(--ink-2); }
.es-ic { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--sky); color: var(--blue); }
.es-ic .ic { width: 30px; height: 30px; }
.season { margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 1fr 80px 44px; align-items: center; gap: 8px; font-size: .82rem; margin: 3px 0; }
.bar-row em { color: var(--muted); font-style: normal; }
.bar { height: 10px; background: #E2E8F0; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.menu-list .ic { color: var(--blue); width: 26px; height: 26px; }
.menu-list span { display: flex; flex-direction: column; }
.menu-list small { color: var(--muted); }
.explain li { margin: 4px 0; font-size: .92rem; }
.contact .actions { margin-bottom: 0; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.5); display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: #fff; width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; color: var(--ink); }
.modal-body { overflow-y: auto; padding: 4px 16px 16px; }
body.modal-open { overflow: hidden; }

.toast { position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 18px); transform: translateX(-50%) translateY(20px); background: #0F172A; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 200; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); font-size: .92rem; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: var(--red); }

/* ---------- Mode sematan (landing page) ---------- */
body.embed .topbar, body.embed .bottomnav, body.embed #banners .banner-amber, body.embed .sidenav { display: none !important; }
body.embed main { top: 0; bottom: 0; left: 0 !important; }
body.embed .sheet { bottom: 0; }
body.embed .fab-accent, body.embed .legend-toggle { display: none; }

/* ---------- Desktop ---------- */
@media (min-width: 640px) { .top-logos { display: inline-flex; } }
@media (min-width: 900px) {
  .bottomnav { display: none; }
  .sidenav { display: flex; flex-direction: column; position: fixed; top: calc(var(--top-h) + var(--banner-h, 0px)); bottom: 0; left: 0; width: var(--side-w); background: #fff; border-right: 1px solid var(--line); padding: 12px 8px; gap: 2px; z-index: 40; }
  .sidenav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
  .sidenav a:hover { background: var(--bg); }
  .sidenav a.active { background: var(--sky); color: var(--navy); }
  .sidenav .ic { color: var(--blue); }
  main { left: var(--side-w); bottom: 0; }
  #banners { left: var(--side-w); }
  .sheet { left: auto; right: 12px; top: calc(var(--top-h) + var(--banner-h, 0px) + 12px); bottom: 12px; width: 420px; max-height: none; border-radius: var(--radius); }
  .sheet.collapsed { max-height: none; }
  .sheet-grip { display: none; }
  .sheet-body { padding-top: 14px; }
  body.sheet-open .fabs { right: 444px; }
  .layers { left: auto; right: 12px; top: calc(var(--top-h) + var(--banner-h, 0px) + 12px); bottom: auto; width: 360px; max-height: calc(100vh - var(--top-h) - 24px); border-radius: var(--radius); }
  .legend-toggle { bottom: 24px; }
  .legend { bottom: 66px; }
  .draw-bar { left: 50%; transform: translateX(-50%); width: 560px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .modal { align-items: center; }
  .modal-card { width: 520px; border-radius: 16px; max-height: 86vh; }
  .modal.wide .modal-card { width: 720px; }
  .toast { bottom: 24px; }
  .issue-grid { grid-template-columns: repeat(3, 1fr); }
}
