/* WargaPE3 — gaya tampilan. Satu kolom, ramah HP; tab navigasi di atas konten. */
:root {
  --bg: #f2f5f4; --surface: #ffffff; --surface-2: #f7faf9; --ink: #15211e; --muted: #5a6b66; --line: #d9e2df;
  --accent: #0e6b5b; --accent-ink: #ffffff; --accent-soft: #dcefe9;
  --ok: #1b7a45; --ok-soft: #e1f3e8; --warn: #a5540b; --warn-soft: #fbeedc; --bad: #b0271f; --bad-soft: #fbe5e3;
  --f-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1413; --surface: #162120; --surface-2: #1b2826; --ink: #e4ede9; --muted: #91a39e; --line: #273632;
    --accent: #4ec3a9; --accent-ink: #06201a; --accent-soft: #15352e;
    --ok: #62d190; --ok-soft: #15301f; --warn: #f0a65c; --warn-soft: #382813; --bad: #f28b82; --bad-soft: #3a1c1a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Kerangka ---------- */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px 0; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.brand-name b { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
nav.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-top: 6px; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
nav.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.badge { background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px calc(48px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-head h1 { font-size: 22px; font-weight: 800; flex: 1; min-width: 180px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Tombol & form ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 14px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; text-decoration: none; color: var(--ink); min-height: 40px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.iconbtn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; line-height: 1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea, .input { border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 10px 12px; width: 100%; min-height: 42px; }
.field textarea { min-height: 80px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.search { flex: 1; min-width: 180px; }
.chips { display: inline-flex; gap: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.chips button { border: 0; background: none; border-radius: 7px; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chips button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }

/* ---------- Kartu & ringkasan ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card h2 { font-size: 17px; font-weight: 700; }
.card.tone-ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.card.tone-bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.card.tone-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); background: var(--warn-soft); }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.big { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.stats { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; font-family: var(--f-body); }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } .stats .main { grid-column: 1 / -1; } }
.bar { height: 8px; border-radius: 99px; background: var(--line); margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.copyline { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }
.copyline .num { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.monthchips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Pill status ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.mute { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }

/* ---------- Daftar ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .no { font-family: var(--f-num); font-weight: 600; font-size: 14px; }
.item .who { min-width: 0; }
.item .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .who span { font-size: 13px; color: var(--muted); }
.item .st { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 640px) {
  .item { grid-template-columns: 70px minmax(0, 1fr); grid-template-areas: "n w" "s s" "a a"; row-gap: 8px; }
  .item .no { grid-area: n; } .item .who { grid-area: w; } .item .st { grid-area: s; justify-content: flex-start; } .item .acts { grid-area: a; justify-content: flex-start; }
}
.empty { padding: 32px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h3 { color: var(--ink); font-size: 16px; }
.pay { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pay:first-child { border-top: 0; }
.pay-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.pay-top b { font-size: 16px; }
.pay .meta { font-size: 13px; color: var(--muted); }
.verif { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 16px; border-top: 1px solid var(--line); }
.verif:first-child { border-top: 0; }
.thumb { width: 100%; aspect-ratio: 3/4; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 13px; cursor: zoom-in; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 560px) { .verif { grid-template-columns: 1fr; } .thumb { aspect-ratio: 4/3; } }

/* ---------- Tabel rekap / mutasi ---------- */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; white-space: nowrap; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.c, .tbl th.c { text-align: center; }
.tbl .sticky { position: sticky; left: 0; background: var(--surface); }
.tbl tfoot td { font-weight: 700; border-bottom: 0; }
.cell { width: 28px; height: 26px; border-radius: 6px; border: 0; font-weight: 700; font-size: 12px; display: inline-grid; place-items: center; }
.cell.ok { background: var(--ok-soft); color: var(--ok); }
.cell.wait { background: var(--warn-soft); color: var(--warn); }
.cell.bad { background: var(--bad-soft); color: var(--bad); }
.cell.na, .cell.fut { background: transparent; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.yeargrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.yeargrid div { border-radius: 10px; padding: 8px 6px; text-align: center; font-size: 12px; font-weight: 700; border: 1px solid var(--line); }
.yeargrid div span { display: block; font-size: 11px; font-weight: 600; opacity: .85; }
.yeargrid .ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.yeargrid .wait { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.yeargrid .bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.yeargrid .na, .yeargrid .fut { color: var(--muted); }
@media (max-width: 420px) { .yeargrid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Dialog, toast, login ---------- */
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(8, 16, 14, .5); }
dialog .dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
dialog .dlg h3 { font-size: 18px; }
.sub { font-size: 13px; color: var(--muted); }
.dfoot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.dfoot .spacer { flex: 1; }
dialog.viewer { width: min(900px, calc(100vw - 24px)); }
dialog.viewer img, dialog.viewer iframe { width: 100%; max-height: 75dvh; object-fit: contain; border: 0; background: var(--surface-2); border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; max-width: calc(100vw - 32px); z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); color: #fff; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: min(400px, 100%); padding: 24px; gap: 16px; }
.auth .logo { display: flex; align-items: center; gap: 12px; }
.auth .logo img { width: 44px; height: 44px; border-radius: 12px; }
.auth h1 { font-size: 22px; font-weight: 800; }
.banner { border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.kuitansi { border: 1px dashed var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.kuitansi .stamp { align-self: flex-start; border: 2px solid var(--ok); color: var(--ok); font-weight: 800; letter-spacing: .1em; padding: 2px 10px; border-radius: 6px; transform: rotate(-4deg); }
@media print {
  body > *:not(dialog[open]) { display: none !important; }
  dialog[open] { position: static; border: 0; width: 100%; max-height: none; }
  dialog .dfoot { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
