/* =========================================================
   SITANI — sistem pendataan pertanian & perkebunan
   Palet diambil dari lanskap kebun: tanah basah, daun muda,
   dan warna gabah kering. Dibuat untuk layar HP dulu.
   ========================================================= */

:root {
  --hutan-950: #082A1E;
  --hutan-900: #0C3B2B;
  --hutan-700: #14543C;
  --daun: #2FA36B;
  --daun-100: #E2F3E9;
  --gabah: #E0A32E;
  --gabah-100: #FBF0D8;
  --tanah: #8A5A2B;
  --bahaya: #C0392B;
  --bahaya-100: #FBE9E7;

  --kertas: #EFF4EF;
  --putih: #FFFFFF;
  --ink: #12201A;
  --abu: #647468;
  --garis: #DAE5DD;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --bayang: 0 10px 30px rgba(12, 59, 43, .09);
  --bayang-kuat: 0 18px 44px rgba(12, 59, 43, .18);

  --display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --teks: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;

  /* garis kontur — motif peta topografi kebun, dipakai di header */
  --kontur: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.4'%3E%3Cpath d='M-20 60c40-30 90-30 130 0s90 30 130 0'/%3E%3Cpath d='M-20 96c40-30 90-30 130 0s90 30 130 0'/%3E%3Cpath d='M-20 132c40-30 90-30 130 0s90 30 130 0'/%3E%3Cpath d='M-20 168c40-30 90-30 130 0s90 30 130 0'/%3E%3Cpath d='M-20 204c40-30 90-30 130 0s90 30 130 0'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--kertas);
  color: var(--ink);
  font-family: var(--teks);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; margin: 0; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; }
a { color: var(--hutan-700); }
img { max-width: 100%; }
input, select, textarea, button { font: inherit; color: inherit; }
button { cursor: pointer; }

.mono { font-family: var(--mono); letter-spacing: -.02em; }
.muted { color: var(--abu); }
.kecil { font-size: 13px; }
.mini { font-size: 12px; }
.tengah { text-align: center; }
.kanan { text-align: right; }
.tebal { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mt { margin-top: 14px; }
.mt-lg { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }

:focus-visible { outline: 3px solid var(--gabah); outline-offset: 2px; border-radius: 6px; }

/* ---------------- Kerangka aplikasi ---------------- */
.layar { min-height: 100vh; display: flex; flex-direction: column; }

.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(160deg, var(--hutan-900), var(--hutan-700));
  background-image: var(--kontur), linear-gradient(160deg, var(--hutan-900), var(--hutan-700));
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 6px 20px rgba(8, 42, 30, .22);
}
.topbar .judul { flex: 1; min-width: 0; }
.topbar .judul strong { display: block; font-family: var(--display); font-size: 16px; line-height: 1.2; }
.topbar .judul span { font-size: 12px; color: #B9D4C6; }
.lencana-akun {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  padding: 6px 10px 6px 6px; border-radius: 999px; color: #fff; text-decoration: none;
}
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--gabah), #F3D28A);
  color: var(--hutan-950); font-weight: 800; font-size: 13px;
}
.lencana-akun .nm { font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.isi { flex: 1; padding: 16px 16px 96px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ---------------- Navigasi bawah (HP) ---------------- */
.nav-bawah {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; background: var(--putih);
  border-top: 1px solid var(--garis);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(12, 59, 43, .08);
}
.nav-bawah a {
  flex: 1; text-align: center; text-decoration: none; color: var(--abu);
  font-size: 10.5px; font-weight: 600; padding: 6px 2px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.nav-bawah a svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-bawah a.aktif { color: var(--hutan-900); background: var(--daun-100); }

/* ---------------- Kartu ---------------- */
.kartu {
  background: var(--putih); border: 1px solid var(--garis);
  border-radius: var(--r); box-shadow: var(--bayang);
}
.kartu-kepala {
  padding: 14px 16px; border-bottom: 1px solid var(--garis);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.kartu-kepala h3 { font-size: 15px; }
.kartu-isi { padding: 16px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------------- Panel sambutan ---------------- */
.panel-hijau {
  border-radius: var(--r-lg); padding: 20px; color: #fff;
  background-image: var(--kontur), linear-gradient(145deg, var(--hutan-900) 10%, var(--hutan-700));
  box-shadow: var(--bayang-kuat);
}
.panel-hijau h2 { font-size: 21px; margin-bottom: 6px; }
.panel-hijau p { color: #C4DCCF; font-size: 13.5px; margin: 0; }
.panel-hijau .kode-diri {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
  padding: 7px 12px; border-radius: 999px; font-family: var(--mono); font-size: 12.5px;
}

/* ---------------- Statistik ---------------- */
.statistik { padding: 15px; display: block; }
.statistik .label { color: var(--abu); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.statistik .nilai { font-family: var(--mono); font-size: 24px; font-weight: 600; line-height: 1.15; margin-top: 6px; letter-spacing: -.03em; }
.statistik .satuan { font-size: 13px; color: var(--abu); font-family: var(--teks); font-weight: 600; }
.statistik .ikon {
  width: 34px; height: 34px; border-radius: 11px; background: var(--daun-100);
  display: grid; place-items: center; margin-bottom: 10px; font-size: 17px;
}
.statistik.emas .ikon { background: var(--gabah-100); }

/* ---------------- Tombol ---------------- */
.tombol {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; text-decoration: none; transition: .15s ease;
  min-height: 46px;
}
.tombol:active { transform: translateY(1px); }
.tombol-utama { background: var(--hutan-900); color: #fff; }
.tombol-utama:hover { background: var(--hutan-700); }
.tombol-emas { background: var(--gabah); color: #3A2A06; }
.tombol-emas:hover { filter: brightness(1.05); }
.tombol-garis { background: var(--putih); border-color: var(--garis); color: var(--hutan-900); }
.tombol-garis:hover { border-color: var(--daun); background: var(--daun-100); }
.tombol-lembut { background: var(--daun-100); color: var(--hutan-900); }
.tombol-bahaya { background: var(--bahaya-100); color: var(--bahaya); border-color: #F0C8C4; }
.tombol-kecil { padding: 8px 13px; min-height: 38px; font-size: 13px; }
.tombol-penuh { width: 100%; }
.tombol[disabled] { opacity: .5; pointer-events: none; }

.aksi-baris { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Formulir ---------------- */
.form-baris { margin-bottom: 14px; }
.form-baris label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.form-baris label .wajib { color: var(--bahaya); }
.form-baris .bantuan { font-size: 12px; color: var(--abu); margin-top: 5px; }
.kolom-isian, select.kolom-isian, textarea.kolom-isian {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--garis);
  border-radius: 12px; background: var(--putih); min-height: 48px;
}
.kolom-isian:focus { border-color: var(--daun); outline: none; box-shadow: 0 0 0 3px var(--daun-100); }
textarea.kolom-isian { min-height: 92px; resize: vertical; }
select.kolom-isian { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23647468' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.dua-kolom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

fieldset.blok { border: 0; padding: 0; margin: 0 0 22px; }
fieldset.blok legend { padding: 0; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; width: 100%; }
.no-blok {
  width: 28px; height: 28px; border-radius: 9px; background: var(--hutan-900); color: #fff;
  display: grid; place-items: center; font-family: var(--mono); font-size: 13px; flex: none;
}
fieldset.blok legend b { font-family: var(--display); font-size: 16px; }

/* ---------------- Pesan ---------------- */
.pesan {
  border-radius: var(--r); padding: 13px 15px; margin-bottom: 16px;
  font-size: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start;
}
.pesan-sukses { background: var(--daun-100); border-color: #B6DFC6; color: #14543C; }
.pesan-gagal { background: var(--bahaya-100); border-color: #F0C8C4; color: #8E2A1E; }
.pesan-peringatan { background: var(--gabah-100); border-color: #EFD6A0; color: #6E4E06; }
.pesan ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------- Tabel ---------------- */
.tabel-bungkus { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tabel { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 560px; }
table.tabel th {
  text-align: left; padding: 11px 14px; background: #F6F9F6; color: var(--abu);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
  border-bottom: 1px solid var(--garis);
}
table.tabel td { padding: 12px 14px; border-bottom: 1px solid var(--garis); vertical-align: middle; }
table.tabel tr:last-child td { border-bottom: 0; }
table.tabel tbody tr:hover { background: #FAFCFA; }

/* ---------------- Daftar kartu (tampilan HP) ---------------- */
.daftar-item {
  padding: 14px 16px; border-bottom: 1px solid var(--garis);
  display: flex; gap: 12px; align-items: flex-start;
}
.daftar-item:last-child { border-bottom: 0; }
.daftar-item .kiri { flex: 1; min-width: 0; }
.daftar-item .judul-item { font-weight: 700; font-size: 14.5px; }
.daftar-item .meta { font-size: 12.5px; color: var(--abu); margin-top: 2px; }
.daftar-item .angka { font-family: var(--mono); font-weight: 600; white-space: nowrap; }

.label-kecil {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; background: var(--daun-100); color: var(--hutan-700);
}
.label-kecil.emas { background: var(--gabah-100); color: #7A5606; }
.label-kecil.abu { background: #EEF1EE; color: var(--abu); }
.label-kecil.bahaya { background: var(--bahaya-100); color: var(--bahaya); }

/* ---------------- Grafik batang buatan sendiri ---------------- */
.grafik { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.grafik .bt { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.grafik .btg {
  width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; min-height: 4px;
  background: linear-gradient(180deg, var(--daun), var(--hutan-700));
  transition: height .5s cubic-bezier(.2, .8, .3, 1);
}
.grafik .bt.puncak .btg { background: linear-gradient(180deg, var(--gabah), #C98A18); }
.grafik .bt span { font-size: 10.5px; color: var(--abu); font-weight: 600; }
.grafik .bt b { font-family: var(--mono); font-size: 10px; color: var(--hutan-700); }

.baris-progres { margin-bottom: 13px; }
.baris-progres .atas { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.baris-progres .atas b { font-family: var(--mono); }
.jalur { height: 9px; border-radius: 999px; background: #E9EFE9; overflow: hidden; }
.jalur .isi-jalur { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--daun), var(--hutan-700)); }
.jalur.emas .isi-jalur { background: linear-gradient(90deg, var(--gabah), var(--tanah)); }

/* ---------------- Halaman masuk / daftar ---------------- */
.halaman-tamu {
  min-height: 100vh; display: flex; flex-direction: column;
  background-image: var(--kontur), linear-gradient(170deg, var(--hutan-950), var(--hutan-700) 55%, #1B6B4A);
  padding: 26px 16px 40px;
}
.tamu-merek { text-align: center; color: #fff; margin-bottom: 20px; }
.tamu-merek .lambang {
  width: 54px; height: 54px; border-radius: 17px; margin: 0 auto 12px;
  background: linear-gradient(150deg, var(--gabah), #F6DFA4); color: var(--hutan-950);
  display: grid; place-items: center; font-size: 26px; box-shadow: 0 12px 26px rgba(0, 0, 0, .25);
}
.tamu-merek h1 { font-size: 23px; letter-spacing: -.03em; }
.tamu-merek p { color: #B9D4C6; font-size: 13px; margin: 4px 0 0; }
.kotak-tamu {
  background: var(--putih); border-radius: var(--r-lg); padding: 22px;
  width: 100%; max-width: 520px; margin: 0 auto; box-shadow: var(--bayang-kuat);
}
.kotak-tamu h2 { margin-bottom: 4px; }
.kotak-tamu .sub { color: var(--abu); font-size: 13.5px; margin-bottom: 18px; }
.tautan-bawah { text-align: center; margin-top: 18px; color: #C4DCCF; font-size: 13.5px; }
.tautan-bawah a { color: #fff; font-weight: 700; }

/* ---------------- Kartu identitas petani (elemen khas) ---------------- */
.kartu-tani {
  border-radius: var(--r-lg); padding: 20px; color: #fff; position: relative; overflow: hidden;
  background-image: var(--kontur), linear-gradient(135deg, var(--hutan-950), var(--hutan-700) 60%, #1E7550);
  box-shadow: var(--bayang-kuat);
}
.kartu-tani::after {
  content: ''; position: absolute; right: -46px; top: -46px; width: 150px; height: 150px;
  border-radius: 50%; background: radial-gradient(circle, rgba(224, 163, 46, .34), transparent 68%);
}
.kartu-tani .cap {
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gabah);
  font-weight: 700; font-family: var(--mono);
}
.kartu-tani .nama-pemilik { font-family: var(--display); font-size: 21px; margin: 6px 0 16px; }
.baris-kredensial {
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 13px; padding: 12px 14px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.baris-kredensial .ket { font-size: 11.5px; color: #B9D4C6; text-transform: uppercase; letter-spacing: .08em; }
.baris-kredensial .isi-nilai { font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: .02em; word-break: break-all; }
.tombol-salin {
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22); color: #fff;
  border-radius: 10px; padding: 8px 12px; font-size: 12px; font-weight: 700; flex: none;
}

/* ---------------- Peta ---------------- */
#peta, .peta-mini { width: 100%; border-radius: var(--r); z-index: 1; }
#peta { height: 68vh; min-height: 380px; }
.peta-mini { height: 240px; border: 1px solid var(--garis); }
.leaflet-popup-content { font-family: var(--teks); font-size: 13px; }
.leaflet-popup-content b { font-family: var(--display); }

/* ---------------- Kosong / bantuan ---------------- */
.kosong { text-align: center; padding: 34px 20px; color: var(--abu); }
.kosong .gambar { font-size: 34px; margin-bottom: 10px; }
.kosong h3 { color: var(--ink); margin-bottom: 6px; }

.saring { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.saring .kolom-isian { flex: 1; min-width: 140px; }

.halaman-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--garis); font-size: 13px; }

/* ---------------- Layar lebar ---------------- */
@media (min-width: 900px) {
  body { font-size: 15.5px; }
  .layar { display: grid; grid-template-columns: 252px 1fr; grid-template-rows: auto 1fr; }
  .sidebar {
    display: block; grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; overflow: auto;
    padding: 22px 16px; color: #fff;
    background-image: var(--kontur), linear-gradient(180deg, var(--hutan-950), var(--hutan-900));
  }
  .sidebar .merek { display: flex; gap: 11px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
  .sidebar .merek .lambang { width: 42px; height: 42px; border-radius: 13px; background: linear-gradient(150deg, var(--gabah), #F6DFA4); color: var(--hutan-950); display: grid; place-items: center; font-size: 21px; }
  .sidebar .merek strong { font-family: var(--display); font-size: 15px; display: block; }
  .sidebar .merek span { font-size: 11.5px; color: #B9D4C6; }
  .sidebar nav { display: grid; gap: 4px; margin-top: 18px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px;
    color: #D3E4DA; text-decoration: none; font-size: 14px; font-weight: 600;
  }
  .sidebar nav a svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .sidebar nav a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
  .sidebar nav a.aktif { background: rgba(255, 255, 255, .14); color: #fff; }
  .sidebar .catatan { margin-top: 22px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .08); color: #C4DCCF; font-size: 12px; }
  .topbar { grid-column: 2; }
  .isi { grid-column: 2; padding: 24px 26px 40px; }
  .nav-bawah { display: none; }
  .grid-2 { grid-template-columns: 1.5fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  h1 { font-size: 30px; }
  .panel-hijau { padding: 28px; }
  .panel-hijau h2 { font-size: 26px; }
  .statistik .nilai { font-size: 28px; }
  .grafik { height: 210px; gap: 10px; }
  .sembunyi-besar { display: none; }
}

@media (max-width: 899px) {
  .sembunyi-kecil { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, .nav-bawah, .sidebar, .tanpa-cetak { display: none !important; }
  body { background: #fff; }
  .isi { padding: 0; }
}

/* Kabupaten yang sudah tetap — ditampilkan, bukan dipilih */
.wilayah-tetap {
  padding: 12px 14px; border: 1.5px dashed var(--garis); border-radius: 12px;
  background: #F6F9F6; color: var(--abu); font-weight: 600; min-height: 48px;
  display: flex; align-items: center; gap: 8px;
}
.wilayah-tetap::before { content: '📍'; }
