/* Token dari portal_iuran_rt_griya_tiga_putri_design_system.md */
:root {
  --primary: #1B4332;
  --primary-hover: #143326;
  --primary-tint: #ECFDF5;
  --accent: #D4A017;
  --accent-hover: #B8860B;
  --accent-tint: #FEF9C3;
  --bg: #F9FAFB;
  --surface: #FFFFFF;
  --teks: #111827;
  --teks-muted: #4B5563;
  --outline: #E5E7EB;
  --input-border: #D1D5DB;
  --row-hover: #F8FAFC;
  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --paid-bg: #DCFCE7; --paid-text: #166534;
  --pending-bg: #FEF9C3; --pending-text: #854D0E;
  --unpaid-bg: #FEE2E2; --unpaid-text: #991B1B;
  --info-bg: #DBEAFE; --info-text: #1D4ED8;
  --draft-bg: #F1F5F9; --draft-text: #475569;
  --r-sm: 4px; --r: 8px; --r-md: 12px; --r-full: 9999px;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
  --shadow-up: 0 4px 16px rgba(0,0,0,.10);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--teks); background: var(--bg);
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  -webkit-tap-highlight-color: transparent;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico-fill { fill: currentColor; stroke: none; }

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--primary); color: #fff;
}
.merek { display: flex; align-items: center; gap: 10px; min-width: 0; }
.merek img { width: 36px; height: 36px; border-radius: 50%; background: #fff; object-fit: cover; border: 2px solid var(--accent); }
.merek-judul { font-weight: 700; font-size: 15px; line-height: 1.2; }
.merek-sub { font-size: 12px; opacity: .85; line-height: 1.2; }

/* Layout */
.app { max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.hint {
  max-width: 560px; margin: 10px auto 0; padding: 10px 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--outline); font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.hint.pasang { background: var(--accent-tint); border-color: #F5E08A; }

.kartu {
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-md);
  padding: 16px; box-shadow: var(--shadow);
}
.kartu-aksi { padding: 20px; box-shadow: 0 4px 12px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 14px; }
.kartu-tautan { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
.kartu-tautan:hover { box-shadow: var(--shadow-up); transform: translateY(-2px); }
.judul { font-size: 18px; font-weight: 600; line-height: 26px; }
.sub { font-size: 14px; color: var(--teks-muted); }
.label { font-size: 13px; color: var(--teks-muted); font-weight: 500; }
.angka { font-variant-numeric: tabular-nums; }
.baris { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.salam { font-size: 20px; font-weight: 600; line-height: 28px; }
.salam-sub { font-size: 14px; color: var(--teks-muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.bagian-judul { display: flex; align-items: center; justify-content: space-between; }
.bagian-judul h2 { font-size: 18px; font-weight: 600; }
.tautan-kecil { color: var(--primary); font-size: 14px; font-weight: 600; text-decoration: none; }

/* Chip & badge status */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--r-full); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip-paid { background: var(--paid-bg); color: var(--paid-text); }
.chip-unpaid { background: var(--unpaid-bg); color: var(--unpaid-text); }
.chip-pending { background: var(--pending-bg); color: var(--pending-text); }
.chip-info { background: var(--info-bg); color: var(--info-text); }
.chip-draft { background: var(--draft-bg); color: var(--draft-text); }
.chip-ok { background: var(--paid-bg); color: var(--paid-text); }

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: var(--r); border: 1px solid transparent;
  font-weight: 600; font-size: 16px; text-decoration: none; text-align: center;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-utama { background: var(--primary); color: #fff; width: 100%; }
.btn-utama:hover:not(:disabled) { background: var(--primary-hover); }
.btn-emas { background: var(--accent); color: #111827; width: 100%; }
.btn-emas:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }
.btn-garis { background: var(--surface); border-color: var(--primary); color: var(--primary); width: 100%; }
.btn-garis:hover:not(:disabled) { background: var(--primary-tint); }
.btn-bahaya { background: var(--danger); color: #fff; width: 100%; }
.btn-bahaya:hover:not(:disabled) { background: var(--danger-hover); }
.btn-tautan { background: none; border: none; color: var(--primary); min-height: 44px; padding: 8px; font-weight: 600; width: 100%; }
.btn-kecil { min-height: 40px; padding: 6px 14px; font-size: 14px; background: var(--primary); color: #fff; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: 14px; }

/* Form */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; }
.input {
  min-height: 48px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--input-border); background: var(--surface); color: var(--teks);
  font: inherit; font-size: 16px; width: 100%;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,67,50,.18); }
.input.angka-input { font-variant-numeric: tabular-nums; }
.kode-kotak { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.kode-kotak .input { text-align: center; font-size: 22px; font-weight: 700; padding: 0; min-height: 52px; }
.pesan { min-height: 1.4em; font-size: 14px; color: var(--teks-muted); }
.pesan.galat { color: var(--danger); }
.pesan.ok { color: var(--paid-text); }
.catatan-kecil { font-size: 13px; color: var(--teks-muted); }

/* Daftar */
.daftar { list-style: none; }
.daftar li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--outline); }
.daftar li:last-child { border-bottom: none; }
.daftar .kiri { display: flex; flex-direction: column; min-width: 0; }
.daftar .judul-baris { font-weight: 600; }
.daftar .sub-baris { font-size: 13px; color: var(--teks-muted); }
.daftar .nilai { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Pilihan bulan (checkbox besar) */
.opsi-bulan { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--input-border); background: var(--surface); gap: 12px; cursor: pointer; }
.opsi-bulan.dipilih { border-color: var(--primary); background: var(--primary-tint); }
.opsi-bulan.nonaktif { opacity: .6; background: var(--bg); cursor: default; }
.opsi-bulan input { width: 22px; height: 22px; accent-color: var(--primary); flex-shrink: 0; }
.opsi-kiri { display: flex; align-items: center; gap: 12px; font-weight: 600; }

/* Unggah */
.unggah {
  border: 2px dashed var(--input-border); border-radius: var(--r-md); padding: 18px; text-align: center;
  background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
}
.unggah:hover { border-color: var(--primary); }
.pratinjau { position: relative; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--outline); background: var(--surface); }
.pratinjau img { width: 100%; max-height: 260px; object-fit: contain; background: var(--draft-bg); }
.pratinjau-bawah { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--outline); font-size: 14px; }
.ai-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--info-bg); color: var(--info-text); font-size: 14px; font-weight: 600; }
.total { display: flex; align-items: baseline; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--outline); }
.total strong { font-size: 22px; color: var(--primary); font-variant-numeric: tabular-nums; }

/* Navigasi bawah */
.navbawah {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--outline);
}
.navbawah a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--teks-muted); font-size: 13px; font-weight: 500; min-height: 44px;
}
.navbawah a.aktif { color: var(--primary); font-weight: 700; }
.navbawah a.aktif::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 3px; background: var(--accent); border-radius: 0 0 3px 3px; }
.navbawah a:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }

/* Kartu saldo & kas */
.saldo-besar { font-size: 28px; font-weight: 700; line-height: 36px; font-variant-numeric: tabular-nums; color: var(--primary); }
.kas-dua { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kas-dua div { display: flex; flex-direction: column; gap: 2px; }
.kas-dua dt { font-size: 13px; color: var(--teks-muted); }
.kas-dua dd { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Kartu bukti (antrean) */
.bukti-kartu { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.bukti-kartu img { width: 96px; height: 120px; object-fit: cover; border-radius: var(--r); border: 1px solid var(--outline); background: var(--draft-bg); }
.bukti-kartu .isi { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.aksi-dua { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }

.skeleton { background: linear-gradient(90deg, var(--draft-bg) 25%, var(--outline) 50%, var(--draft-bg) 75%); background-size: 200% 100%; animation: kilau 1.2s linear infinite; border-radius: var(--r); height: 96px; }
@keyframes kilau { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (min-width: 900px) {
  .app { max-width: 720px; padding: 24px; }
  .navbawah { left: 50%; transform: translateX(-50%); width: 100%; max-width: 720px; border-radius: 12px 12px 0 0; }
  .hint { max-width: 720px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F172A; --surface: #1E293B; --teks: #F1F5F9; --teks-muted: #CBD5E1;
    --outline: #334155; --input-border: #475569; --primary: #2F7A5E; --primary-hover: #367F65;
    --primary-tint: #14302A; --draft-bg: #273449; --draft-text: #CBD5E1;
    color-scheme: dark;
  }
}

/* Kwitansi */
.kwitansi { background: #fff; color: #111827; border: 2px solid var(--primary); border-radius: var(--r-md); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.kwitansi .judul { color: var(--primary); }
.kwitansi .daftar li { border-bottom-color: #E5E7EB; }
.kwitansi .sub { color: #4B5563; }
@media print {
  body * { visibility: hidden; }
  .kwitansi, .kwitansi * { visibility: visible; }
  .kwitansi { position: absolute; left: 0; top: 0; width: 100%; border: 1px solid #000; box-shadow: none; }
  .topbar, .navbawah, .hint, .noprint { display: none !important; }
  body { padding: 0; background: #fff; }
}

/* Panel pengurus */
.tab-panel { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  flex-shrink: 0; min-height: 44px; display: inline-flex; align-items: center; padding: 8px 14px;
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--input-border);
  color: var(--teks-muted); font-weight: 600; font-size: 14px; text-decoration: none;
}
.tab.aktif { background: var(--primary); border-color: var(--primary); color: #fff; }
.daftar li .btn { width: auto; flex-shrink: 0; min-height: 40px; padding: 6px 14px; font-size: 14px; }
