/* Irigasi Loteng — gaya mengikuti mockup MOCKUP_APLIKASI_PENYULUH */
:root {
  --latar: #F4F5F0;
  --utama: #1D5C3B;
  --utama-muda: #E6F0E9;
  --teks: #16211A;
  --redup: #4B5A50;
  --garis: #DCE2DA;
  --kartu: #fff;
  --kuning-muda: #FFF6DC;
  --kuning-teks: #8A6500;
  --merah: #A32116;
  --radius: 16px;
  --nav-tinggi: 68px;
  --aman-bawah: env(safe-area-inset-bottom, 0px);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--teks);
  background: var(--latar);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { padding-bottom: calc(var(--nav-tinggi) + var(--aman-bawah)); font-size: 15px; line-height: 1.45; }
h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
h2 { margin: 0; }
p { margin: 0; }
a { color: var(--utama); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #7FB89A; outline-offset: 2px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; }

input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--garis); border-radius: 12px; background: #fff;
  font-size: 16px; /* cegah zoom otomatis iOS */
}
input:focus, select:focus, textarea:focus { border-color: var(--utama); outline: none; }

/* ---------- Kerangka ---------- */
#utama { max-width: 640px; margin: 0 auto; outline: none; }
.halaman { padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.halaman-form { padding-bottom: 130px; }
.memuat-halaman { display: grid; place-items: center; min-height: 60vh; }
.memuat { width: 28px; height: 28px; border: 3px solid var(--garis); border-top-color: var(--utama); border-radius: 50%; animation: putar .8s linear infinite; margin: 12px auto; }
@keyframes putar { to { transform: rotate(360deg); } }

.kepala-beranda { display: flex; justify-content: space-between; align-items: center; }
.merek { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--utama); }
.merek.besar { font-size: 24px; justify-content: center; margin-top: 24px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--utama); display: grid; place-items: center; }
.merek.besar .logo { width: 48px; height: 48px; border-radius: 14px; }
.sub { color: var(--redup); font-weight: 500; }
.kepala-sub { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.kepala-sub h1 { font-size: 20px; flex: 1; }

.tombol-ikon {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--garis); background: #fff;
  display: inline-grid; place-items: center; color: var(--teks); flex: none; text-decoration: none;
}
.tombol-ikon.bayang { border: 0; box-shadow: 0 2px 10px rgba(0,0,0,.18); }

/* ---------- Kartu & teks ---------- */
.kartu { background: var(--kartu); border: 1px solid var(--garis); border-radius: var(--radius); padding: 16px; display: block; color: inherit; text-decoration: none; text-align: left; width: 100%; }
.tumpuk { display: flex; flex-direction: column; gap: 12px; }
.tumpuk-kecil { display: flex; flex-direction: column; gap: 8px; }
.kartu.tumpuk, .kartu.tumpuk-kecil { display: flex; }
.judul-bagian { font-size: 16px; font-weight: 800; }
.kecil { font-size: 13px; color: var(--redup); }
.kecil.tebal, .tebal { font-weight: 700; }
.abu { color: #7A877E; }
.tengah { text-align: center; }
.sedang { font-size: 18px; }
.kosong-teks { color: var(--redup); font-size: 14px; padding: 8px 0; }
.baris-antara { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-top: 12px; }
.angka-besar { font-size: 22px; font-weight: 800; line-height: 1.1; }

.kartu-di, .baris-ikon { display: flex; align-items: center; gap: 12px; }
.kartu-di { cursor: pointer; }
.isi { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.isi strong { overflow: hidden; text-overflow: ellipsis; }
.ikon-bulat { width: 40px; height: 40px; border-radius: 50%; background: var(--utama-muda); display: grid; place-items: center; flex: none; }
.ikon-bulat.besar { width: 56px; height: 56px; }
.tautan { color: var(--utama); font-weight: 700; font-size: 14px; background: none; border: 0; padding: 0; }

.bar { display: flex; border-radius: 999px; overflow: hidden; margin-top: 12px; background: #EEF1EC; gap: 2px; }
.bar.kosong { background: #EEF1EC; }
.bar-tipis { height: 8px; background: #EEF1EC; border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar-tipis div { height: 100%; background: var(--utama); border-radius: 999px; }

.peringatan {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px;
  padding: 12px 14px; border-radius: 12px; background: #FCEBE6; color: var(--merah); font-weight: 600; font-size: 14px; text-decoration: none;
}
.info-antrian {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--kuning-muda); color: var(--kuning-teks); font-size: 14px; font-weight: 600;
}
.info-antrian span { flex: 1; }
.info-antrian .tautan { color: var(--kuning-teks); text-decoration: underline; }

.baris-laporan { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.titik { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.lencana { display: inline-block; padding: 3px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700; background: var(--utama); white-space: nowrap; }
.lencana.abu-bg { background: #EEF1EC; color: var(--redup); }

/* ---------- Tombol ---------- */
.tombol {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 16px;
  border-radius: 14px; border: 1.5px solid var(--garis); background: #fff; color: var(--utama); font-weight: 700; font-size: 15px; text-decoration: none;
}
.tombol.utama { background: var(--utama); border-color: var(--utama); color: #fff; }
.tombol.besar { min-height: 58px; font-size: 17px; border-radius: 16px; }
.tombol.bahaya { color: var(--merah); border-color: #EBC9C4; }
.tombol:disabled { opacity: .6; cursor: default; }
.kecil-t { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }

.chip-baris { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chip-bungkus { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--garis); background: #fff;
  font-weight: 600; font-size: 14px; color: var(--teks); min-height: 38px;
}
.chip.on { background: var(--utama-muda); border-color: var(--utama); color: var(--utama); }
.chip.besar { min-height: 46px; padding: 10px 16px; font-size: 15px; }
.chip.on.gelap { background: var(--utama); color: #fff; }

.segmen { display: grid; grid-template-columns: 1fr 1fr; background: #E9ECE6; border-radius: 14px; padding: 4px; gap: 4px; }
.segmen button { border: 0; background: none; padding: 10px; border-radius: 10px; font-weight: 700; color: var(--redup); min-height: 42px; }
.segmen button.on { background: #fff; color: var(--utama); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- Navigasi bawah ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-tinggi) + var(--aman-bawah)); padding-bottom: var(--aman-bawah);
  background: #fff; border-top: 1px solid var(--garis);
}
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: #7A877E; text-decoration: none; }
.nav a.aktif { color: var(--utama); }
.nav-lapor span {
  width: 56px; height: 56px; border-radius: 50%; background: var(--utama); display: grid; place-items: center;
  margin-top: -26px; box-shadow: 0 4px 14px rgba(29,92,59,.4); border: 4px solid var(--latar);
}
.nav a.nav-lapor { color: var(--utama); }
body[data-rute="lapor"] .nav, body[data-rute="akun"] .nav { display: none; }
body[data-rute="lapor"], body[data-rute="akun"] { padding-bottom: 0; }

/* ---------- Lembar bawah (pemilih DI) ---------- */
.lembar-latar { position: fixed; inset: 0; z-index: 2000; background: rgba(10,18,12,.45); display: flex; align-items: flex-end; justify-content: center; }
.lembar {
  background: #fff; width: 100%; max-width: 640px; max-height: 85vh; border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column; padding: 16px 16px calc(16px + var(--aman-bawah)); gap: 12px; animation: naik .2s ease-out;
}
@keyframes naik { from { transform: translateY(40px); opacity: 0; } }
.lembar-kepala { display: flex; justify-content: space-between; align-items: center; }
.lembar-kepala h2 { font-size: 18px; font-weight: 800; }
.cari { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--garis); border-radius: 12px; padding: 0 12px; }
.cari input { border: 0; padding: 12px 0; }
.daftar-di { overflow-y: auto; display: flex; flex-direction: column; }
.grup-kec { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--redup); padding: 12px 4px 6px; }
.baris-di { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px; border: 0; background: none; border-radius: 10px; text-align: left; min-height: 48px; }
.baris-di:hover { background: #F4F5F0; }
.baris-di.aktif { background: var(--utama-muda); }
.baris-di-nama { font-weight: 700; }

/* ---------- Peta ---------- */
body[data-rute="peta"] #utama { max-width: none; }
.peta-wadah { position: relative; height: calc(100dvh - var(--nav-tinggi) - var(--aman-bawah)); }
#peta { position: absolute; inset: 0; background: #DDE3DA; }
.peta-atas { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.peta-atas > * { pointer-events: auto; }
.pil-di {
  align-self: flex-start; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; border: 0;
  background: #fff; font-weight: 800; box-shadow: 0 2px 10px rgba(0,0,0,.18); max-width: 100%;
}
.pil-di span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peta-atas .chip { box-shadow: 0 1px 6px rgba(0,0,0,.15); border-color: transparent; }
.peta-atas .chip.on { border-color: var(--utama); }
.peta-kanan { position: absolute; right: 12px; top: 120px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.legenda {
  position: absolute; left: 12px; bottom: 16px; z-index: 500; background: #fff; border-radius: 14px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px; box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.legenda-item { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; text-align: left; }
.legenda-item b { margin-left: auto; padding-left: 8px; }
.legenda-item.mati { opacity: .4; }
.legenda-item.mati .titik { background: #bbb !important; }
.leaflet-bottom.leaflet-right { margin-bottom: 8px; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 40px !important; }
.leaflet-popup-content { margin: 12px; font-family: inherit; font-size: 14px; }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.popup-lap { display: flex; flex-direction: column; gap: 6px; width: 230px; }
.popup-lap img { width: 100%; height: 160px; object-fit: cover; border-radius: 10px; background: #EEF1EC; }

/* ---------- Lapor ---------- */
.lencana-gps { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--utama-muda); color: var(--utama); white-space: nowrap; }
.lencana-gps.lemah { background: var(--kuning-muda); color: var(--kuning-teks); }
.foto-wadah { position: relative; border-radius: var(--radius); overflow: hidden; background: #E3E8E1; min-height: 220px; display: grid; }
.foto-wadah img { width: 100%; display: block; }
.foto-kosong { display: flex; flex-direction: column; gap: 10px; padding: 24px; justify-content: center; text-align: center; }
.foto-ulang { position: absolute; top: 10px; right: 10px; }
.pita { width: 8px; align-self: stretch; border-radius: 999px; }
.kartu-waspada { background: var(--kuning-muda); border-color: #EBD9A0; }
.kartu-waspada .baris-ikon strong { color: var(--kuning-teks); }
.peringatan.kecil-p { margin-top: 0; font-size: 13px; font-weight: 600; }
.judul-lembar { font-size: 18px; font-weight: 800; }
.lembar-peta { max-height: 92vh; }
.peta-pilih { position: relative; height: 58vh; border-radius: 14px; overflow: hidden; }
#peta-pilih { position: absolute; inset: 0; }
.bidik { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; z-index: 500; pointer-events: none;
  border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #A32116, 0 2px 8px rgba(0,0,0,.4); }
.bidik::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; background: #A32116; border-radius: 50%; }
.aksi-bawah {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; background: #fff; border-top: 1px solid var(--garis);
  padding: 12px 16px calc(12px + var(--aman-bawah)); display: flex; flex-direction: column; gap: 6px;
}
.aksi-bawah > * { width: 100%; max-width: 608px; margin: 0 auto; }

/* ---------- Ringkasan ---------- */
.baris-peringkat { display: flex; flex-direction: column; gap: 0; border: 0; background: none; padding: 10px 0; border-bottom: 1px solid #EEF1EC; text-align: left; width: 100%; }
.baris-peringkat .bar { margin-top: 6px; }

/* ---------- Masuk ---------- */
.halaman-masuk { gap: 14px; text-align: left; }
.halaman-masuk > .sub { text-align: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-tinggi) + 16px + var(--aman-bawah)); transform: translate(-50%, 20px);
  z-index: 3000; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 12px; background: #16211A; color: #fff;
  font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.tampil { opacity: 1; transform: translate(-50%, 0); }
.toast.galat { background: var(--merah); }
.toast.sukses { background: var(--utama); }
.toast.peringatan { background: #6B4E00; }

@media (min-width: 900px) {
  .halaman { padding-top: 28px; }
}
