@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --navy-950: #0B1E33;
  --navy-800: #12314F;
  --paper: #F2F4F1;
  --alert: #E15A2B;
  --alert-soft: #FBE3D8;
  --signal: #1E9E85;
  --signal-soft: #DCF2EC;
  --amber: #E3A62F;
  --amber-soft: #FBEDD3;
  --ink: #16232E;
  --ink-soft: #55666F;
  --line: #DCE1DE;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--paper); color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; margin: 0; color: var(--navy-950); }
.mono { font-family: 'JetBrains Mono', monospace; }
button, input, select, textarea { font-family: inherit; font-size: 15px; }

.app-frame { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }

.topbar-offline {
  background: var(--navy-950); color: #fff; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.topbar-offline .title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; }
.status-jaringan { display: flex; align-items: center; gap: 6px; font-size: 11px; padding: 4px 9px; border-radius: 20px; }
.status-jaringan.online { background: rgba(30,158,133,0.2); color: #7FE6CC; }
.status-jaringan.offline { background: rgba(225,90,43,0.25); color: #F3A488; }
.status-jaringan .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.content { flex: 1; padding: 16px 16px 90px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 10;
}
.bottom-nav button {
  flex: 1; background: none; border: none; padding: 10px 4px 8px; display: flex;
  flex-direction: column; align-items: center; gap: 3px; color: var(--ink-soft); cursor: pointer; font-size: 11px; font-weight: 600;
}
.bottom-nav button svg { width: 21px; height: 21px; fill: currentColor; }
.bottom-nav button.active { color: var(--alert); }

.card { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 9px; border: 1px solid var(--line); background: #FAFBFA;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy-800); background: #fff; }

.btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; padding: 13px; border-radius: 10px; font-weight: 700; font-size: 14.5px; border: none; cursor: pointer; }
.btn-primary { background: var(--alert); color: #fff; }
.btn-primary:disabled { opacity: 0.5; }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }

.foto-preview { width: 100%; border-radius: 10px; margin-top: 8px; border: 1px solid var(--line); max-height: 220px; object-fit: cover; }
.lokasi-box { background: var(--signal-soft); color: #10614F; padding: 10px 12px; border-radius: 9px; font-size: 12.5px; margin-top: 6px; display: none; }
.lokasi-box.show { display: block; }

.riwayat-item { border-bottom: 1px solid var(--line); padding: 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.riwayat-item:last-child { border-bottom: none; }
.riwayat-item .ri-jenis { font-weight: 700; font-size: 13.5px; }
.riwayat-item .ri-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.chip { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.chip.pending { background: var(--amber-soft); color: #9A6B0C; }
.chip.terkirim { background: var(--signal-soft); color: var(--signal); }
.chip.gagal { background: var(--alert-soft); color: var(--alert); }

.stat-mini { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 14px; }
.stat-mini .box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.stat-mini .box .v { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; color: var(--navy-950); }
.stat-mini .box .l { font-size: 10.5px; color: var(--ink-soft); }

.empty-state { text-align: center; padding: 30px 10px; color: var(--ink-soft); font-size: 13px; }
.toast {
  position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%);
  background: var(--navy-950); color: #fff; padding: 11px 18px; border-radius: 30px;
  font-size: 12.5px; z-index: 30; opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- Login ---------- */
.app-frame.belum-login .bottom-nav { display: none; }
.app-frame.belum-login .content { padding-bottom: 24px; }
.login-card-mini { margin-top: 12px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.siren-mini {
  width: 40px; height: 40px; border-radius: 10px; background: var(--alert);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.siren-mini svg { width: 20px; height: 20px; }

/* ---------- Tab switch (Pelaporan: Laporan Baru / Update Kondisi) ---------- */
.tab-switch { display: flex; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.tab-btn {
  flex: 1; border: none; background: none; padding: 9px 6px; border-radius: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer;
}
.tab-btn.active { background: var(--navy-950); color: #fff; }

/* ---------- Field pairs side-by-side (mis. Desa & Kecamatan) ---------- */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 14px; }

/* ---------- Profil read-only ---------- */
.profil-baris { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.profil-baris:last-of-type { border-bottom: none; }
.profil-baris .k { color: var(--ink-soft); font-weight: 600; }
.profil-baris .v { font-weight: 600; text-align: right; }

/* ---------- Chip tambahan: tipe laporan (Baru / Update) ---------- */
.chip.tipe-baru { background: #DDE6F5; color: var(--navy-800); margin-left: 6px; }
.chip.tipe-update { background: var(--amber-soft); color: #9A6B0C; margin-left: 6px; }
