/* ===== Nyatat — gaya & tema ===== */
:root {
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 20, 40, .04), 0 4px 16px rgba(16, 20, 40, .05);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 68px;
}

/* Tema: setiap tema punya varian terang & gelap */
[data-theme="klasik"]  { --p: #3340d6; --p2: #5b67ea; --pt: #e9ebff; --acc: #f5b301; }
[data-theme="navy"]    { --p: #16213e; --p2: #f5b301; --pt: #fff4cf; --acc: #f5b301; }
[data-theme="hutan"]   { --p: #1f6f5c; --p2: #f0785a; --pt: #e2f1ec; --acc: #f0785a; }
[data-theme="ungu"]    { --p: #6d3df5; --p2: #9bd11a; --pt: #efe9ff; --acc: #9bd11a; }
[data-theme="pastel"]  { --p: #c9694f; --p2: #7cc4a8; --pt: #fbe9e1; --acc: #7cc4a8; }
[data-theme="senja"]   { --p: #e8590c; --p2: #ffa94d; --pt: #fff0e3; --acc: #c2255c; }
[data-theme="laut"]    { --p: #0e7490; --p2: #22b8cf; --pt: #e0f6fa; --acc: #f59f00; }
[data-theme="sakura"]  { --p: #c2255c; --p2: #f783ac; --pt: #ffe8f0; --acc: #5c7cfa; }
[data-theme="grafit"]  { --p: #212529; --p2: #868e96; --pt: #eceef1; --acc: #12b886; }

:root, [data-mode="light"] {
  --bg: #f3f4f8; --surface: #ffffff; --surface2: #f7f8fb; --text: #15172a; --muted: #6b6f80;
  --border: #e4e6ef; --ok: #12945a; --bad: #d93636; --warn: #b57900; --on-p: #fff;
  --overlay: rgba(10, 12, 25, .45);
}
[data-theme="pastel"][data-mode="light"] { --bg: #fbf7f0; --surface2: #fdfaf5; --border: #eee5d8; }
[data-theme="hutan"][data-mode="light"]  { --bg: #f1f5f2; }
[data-theme="navy"][data-mode="light"]   { --bg: #f2f3f7; }

[data-mode="dark"] {
  --bg: #0f1117; --surface: #181b24; --surface2: #1f2330; --text: #e8eaf2; --muted: #9aa0b4;
  --border: #2a2e3b; --ok: #3ccf8e; --bad: #ff6b6b; --warn: #f5c04a; --on-p: #fff;
  --overlay: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
[data-mode="dark"][data-theme="klasik"] { --p: #6f7bff; --pt: #23285a; }
[data-mode="dark"][data-theme="navy"]   { --p: #f5b301; --pt: #3a3112; --on-p: #16213e; }
[data-mode="dark"][data-theme="hutan"]  { --p: #3fb495; --pt: #173a31; --on-p: #08241c; }
[data-mode="dark"][data-theme="ungu"]   { --p: #9b7bff; --pt: #2d2452; }
[data-mode="dark"][data-theme="pastel"] { --p: #f0a58c; --pt: #3d2a24; --on-p: #3b1d12; --bg: #16130f; --surface: #1f1b16; --surface2: #27221c; --border: #362f27; }
[data-mode="dark"][data-theme="senja"]  { --p: #ff8a3d; --pt: #3d2414; --on-p: #2b1203; }
[data-mode="dark"][data-theme="laut"]   { --p: #3bc9db; --pt: #113640; --on-p: #05262d; }
[data-mode="dark"][data-theme="sakura"] { --p: #f06595; --pt: #42182a; }
[data-mode="dark"][data-theme="grafit"] { --p: #dee2e6; --pt: #2b2f36; --on-p: #111; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--p); }
.hidden { display: none !important; }

/* ===== Layout ===== */
#app { min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }
.side {
  display: none; width: 250px; flex: 0 0 250px; padding: 22px 14px; background: var(--surface);
  border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; overflow: auto;
}
.main { flex: 1; min-width: 0; }
.page { max-width: 640px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 110px); }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); z-index: 20;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav button, .side .navbtn {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; flex: 1;
}
.bottomnav button.on, .side .navbtn.on { color: var(--p); font-weight: 600; }
.bottomnav svg, .side svg { width: 24px; height: 24px; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px); z-index: 21;
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--p); color: var(--on-p);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22); display: grid; place-items: center;
}
.fab svg { width: 28px; height: 28px; }

@media (min-width: 900px) {
  .side { display: block; }
  .bottomnav { display: none; }
  .page { padding-bottom: 120px; padding-top: 28px; }
  .fab { bottom: 28px; right: 28px; }
  .side .navbtn { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: 15px; width: 100%; }
  .side .navbtn.on { background: var(--p); color: var(--on-p); }
}
.brand { display: flex; align-items: center; gap: 10px; margin: 0 6px 18px; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; background: var(--p); display: grid; place-items: center; color: var(--on-p); font-weight: 800; }
.brand b { font-size: 18px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }

/* ===== Elemen umum ===== */
.topbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; min-height: 44px; }
.topbar h1 { font-size: 21px; margin: 0; flex: 1; min-width: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; position: relative; flex: 0 0 auto; color: var(--text);
}
.iconbtn.plain { border: 0; background: transparent; }
.iconbtn svg { width: 22px; height: 22px; }
.badge {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; display: grid; place-items: center; font-weight: 700;
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card.tight { padding: 6px 0; }
.card h2, .section-title { font-size: 17px; margin: 0 0 10px; }
.section-title { margin: 22px 2px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title a, .linkbtn { font-size: 14px; color: var(--p); background: none; border: 0; padding: 4px 0; font-weight: 600; text-decoration: none; }
.label { color: var(--muted); font-size: 13px; }
.big { font-size: 32px; font-weight: 800; letter-spacing: -.5px; margin: 2px 0; word-break: break-word; }
.mid { font-size: 18px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack > * + * { margin-top: 10px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--surface2); border: 1px solid var(--border); }
.pill.p { background: var(--pt); color: var(--p); border-color: transparent; font-weight: 600; }
.pill.bad { background: rgba(217, 54, 54, .1); border-color: transparent; }
.pill.warn { background: rgba(245, 179, 1, .15); border-color: transparent; }
.pill.ok { background: rgba(18, 148, 90, .12); border-color: transparent; }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; }
.empty .ill { font-size: 42px; margin-bottom: 6px; }

/* List item: label kiri bisa membungkus per kata, nilai kanan tidak menjepit label */
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; width: 100%;
  background: none; border: 0; text-align: left; color: inherit;
}
button.item:hover { background: var(--surface2); }
.item + .item { border-top: 1px solid var(--border); }
.item .txt { flex: 1 1 auto; min-width: 0; }
.item .txt b, .item .txt .t { display: block; font-weight: 600; overflow-wrap: anywhere; }
.item .txt small { display: block; color: var(--muted); font-size: 12.5px; }
.item .val { flex: 0 0 auto; max-width: 60%; text-align: right; font-weight: 600; white-space: nowrap; }
.item .val small { white-space: normal; }
.item .val small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.item .chev { color: var(--muted); flex: 0 0 auto; }
.ava {
  width: 42px; height: 42px; border-radius: 13px; flex: 0 0 42px; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; letter-spacing: -.3px;
}
.ava.emo { font-size: 20px; }
.ava.sm { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; font-size: 11px; }

/* Tombol */
.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 11px 16px; border-radius: 12px;
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
}
.btn.primary { background: var(--p); color: var(--on-p); border-color: var(--p); }
.btn.dark { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; }

/* Chip pilihan */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-size: 14px; min-height: 42px; text-align: left;
}
.chip.on { border-color: var(--p); background: var(--pt); color: var(--p); font-weight: 600; box-shadow: inset 0 0 0 1px var(--p); }
.chip .ava { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; font-size: 9.5px; }
.chip .e { font-size: 17px; }

/* Segmented */
.seg { display: flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 10px 8px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--p); color: var(--on-p); }

/* Form */
.field { margin-bottom: 14px; }
.field > label, .flabel { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px;
  min-height: 48px; outline: none;
}
.input:focus { border-color: var(--p); box-shadow: 0 0 0 3px var(--pt); }
.amount-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; font-size: 34px; font-weight: 800;
  padding: 6px 0 10px; outline: none; letter-spacing: -.5px;
}
.amount-input:focus { border-bottom-color: var(--p); }
.amount-wrap { display: flex; align-items: baseline; gap: 6px; margin-bottom: 14px; }
.amount-wrap .rp { font-size: 22px; font-weight: 700; color: var(--muted); }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.err { color: var(--bad); font-size: 13px; margin-top: 6px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--p); flex: 0 0 auto; }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 50px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 30px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--p); }
.switch input:checked + span::before { transform: translateX(20px); }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }

/* Sheet / modal */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet {
  background: var(--surface); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); animation: up .2s ease-out;
}
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 22px; max-height: 88vh; } }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 6px; font-size: 19px; }
.sheet .sticky-actions { position: sticky; bottom: calc(-24px - env(safe-area-inset-bottom)); background: var(--surface); padding: 12px 0 4px; margin-top: 10px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 92px); transform: translateX(-50%); z-index: 80;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-size: 14px; max-width: 90vw;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: fade .15s;
}

/* Progress */
.bar { height: 9px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--p); border-radius: 6px; }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

/* Akun horizontal */
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; }
.acct-mini { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--border); }
.acct-mini b { display: block; font-size: 13px; }
.acct-mini span { font-size: 13px; font-weight: 700; }

/* Tema picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-card { border: 1px solid var(--border); border-radius: 16px; padding: 10px; background: var(--surface); text-align: left; }
.theme-card.on { border: 2px solid var(--text); padding: 9px; }
.theme-card .prev { height: 64px; border-radius: 10px; display: flex; overflow: hidden; margin-bottom: 8px; border: 1px solid rgba(0,0,0,.06); }
.theme-card .prev i { display: block; }
.theme-card b { display: block; font-size: 14px; }
.theme-card small { color: var(--muted); font-size: 12px; }
.dots { display: flex; gap: 8px; flex-wrap: wrap; }
.dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.dot.on { box-shadow: 0 0 0 2px var(--text); }

/* Kode sinkron */
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 17px; letter-spacing: 1px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; font-weight: 700; word-break: break-all; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.status-dot.ok { background: var(--ok); } .status-dot.bad { background: var(--bad); } .status-dot.warn { background: var(--warn); }

/* Grafik */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* Kalender bulan pada laporan */
.monthnav { display: flex; align-items: center; gap: 6px; }
.monthnav b { min-width: 98px; text-align: center; }

/* PIN */
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; justify-content: center; margin-top: 20px; }
.pinpad button { height: 72px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); font-size: 24px; font-weight: 600; }
.pindots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pindots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--p); }
.pindots i.f { background: var(--p); }

.center-screen { max-width: 480px; margin: 0 auto; padding: 30px 20px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.progress-top { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; flex: 1; }
.progress-top i { display: block; height: 100%; background: var(--p); }
.onb h1 { font-size: 26px; margin: 18px 0 6px; letter-spacing: -.4px; }
.onb .foot { margin-top: auto; padding-top: 20px; }
.kpr-out { background: var(--surface2); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--border); }
.txdate { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 12px 18px 4px; }
