/* Tema: broken white + hijau pastel (terang saja). */
:root {
  color-scheme: light;
  --bg: #f7f5ee;          /* broken white */
  --card: #fffdf7;
  --text: #2f3b33;
  --muted: #76807a;
  --line: #e6e3d8;
  --primary: #3f7d5c;     /* hijau tua untuk teks/aksen di atas broken white */
  --brand: #b9dfc6;       /* hijau pastel untuk permukaan besar */
  --brand-strong: #9fd1b0;
  --on-brand: #12352a;    /* teks di atas hijau pastel */
  --in: #2f7a4d;
  --out: #b4534b;
  --move: #4a6f9c;
  --warn-bg: #f8edd2;
  --warn: #7a5a1e;
  --radius: 12px;
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--card); color: var(--on-brand);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 1.2rem; line-height: 0; }
.topbar .logo { height: 40px; width: auto; }
.topbar-total { font-weight: 600; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
h2:first-child { margin-top: 0; }

.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.hero { background: var(--brand); color: var(--on-brand); }
.hero .label { opacity: .85; font-size: .9rem; }
.hero .big { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.acc .name { font-size: .9rem; color: var(--muted); }
.acc .bal { font-weight: 700; margin-top: 4px; }
.acc .type { font-size: .75rem; color: var(--muted); }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.summary .label { font-size: .8rem; color: var(--muted); }
.summary .val { font-weight: 700; margin-top: 2px; font-size: .95rem; }

.neg, .out { color: var(--out); }
.pos, .in { color: var(--in); }
.move { color: var(--move); }
.muted { color: var(--muted); font-size: .85rem; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .main { min-width: 0; flex: 1; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .amt { font-weight: 700; white-space: nowrap; text-align: right; }
.row.clickable { cursor: pointer; }
.date-head { font-size: .85rem; color: var(--muted); font-weight: 600; margin: 14px 0 4px; }

.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: #e3b3ad; }
.bar.in > span { background: var(--brand-strong); }

.banner { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filters > * { flex: 1 1 140px; }

.btn { border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: var(--line); }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--out); border: 1px solid var(--out); }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--line); padding: 4px; border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 8px 4px; border-radius: 8px; cursor: pointer; font-size: .85rem; }
.seg button.active { background: var(--brand); color: var(--on-brand); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.fab {
  position: fixed; right: 20px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; z-index: 6;
  background: var(--brand); color: var(--on-brand); cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  /* reset gaya tombol bawaan iOS agar lingkaran & ikon benar-benar di tengah */
  -webkit-appearance: none; appearance: none; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
}
.fab svg { display: block; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.bottomnav button { border: 0; background: transparent; font-size: .75rem; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.bottomnav button .ico { font-size: 1.3rem; }
.bottomnav button.active { color: var(--primary); font-weight: 700; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(480px, 94vw); background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 18px; max-height: 90vh; overflow-y: auto; }
dialog h2 { margin: 0 0 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dialog-actions .spacer { flex: 1; }
.error { color: var(--out); min-height: 1em; margin: 8px 0 0; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }
