/* Keuanganku Mobile: palet sama dengan desktop (pink pastel hangat), tata letak khusus layar ponsel. */
:root {
  --bg: #fdf6f8;
  --surface: #ffffff;
  --surface-2: #fbeef3;
  --surface-3: #f6e3eb;
  --ink: #2a2730;
  --muted: #6d6676;
  --line: #f0dbe4;
  --primary: #c8457a;
  --primary-ink: #ffffff;
  --primary-soft: #fadbe6;
  --primary-softer: #fdeef3;
  --lavender: #ebe8fd;
  --lavender-ink: #5a52b5;
  --mint: #ddf3ea;
  --mint-ink: #22795a;
  --peach: #fde9da;
  --peach-ink: #a4561f;
  --danger: #c2414b;
  --danger-soft: #fbe3e5;
  --positive: #22795a;
  --shadow: 0 1px 2px rgba(120, 60, 90, 0.06), 0 6px 20px rgba(120, 60, 90, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b191f;
    --surface: #24212a;
    --surface-2: #2c2832;
    --surface-3: #35303d;
    --ink: #f2eef4;
    --muted: #aaa2b3;
    --line: #3a3442;
    --primary: #f19bbb;
    --primary-ink: #2a1520;
    --primary-soft: #4a2b3a;
    --primary-softer: #33242d;
    --lavender: #34304e;
    --lavender-ink: #c5c0ff;
    --mint: #1f3a31;
    --mint-ink: #8fdcbd;
    --peach: #3f2e22;
    --peach-ink: #f3b98d;
    --danger: #ff8f97;
    --danger-soft: #45262a;
    --positive: #8fdcbd;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

[x-cloak] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
}
body.lock { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; font-weight: 800; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: 0.95rem; font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }

/* ---------- util ---------- */
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.tiny { font-size: 0.78rem; }
.strong { font-weight: 700; }
.pos { color: var(--positive); }
.neg { color: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 8px; }
.mb { margin-bottom: 8px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.center { text-align: center; padding: 48px 16px; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- app bar & halaman ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.app-bar .title { flex: 1; min-width: 0; }
.app-bar .title strong { display: block; font-size: 1.05rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-bar .title span { display: block; font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary-soft), var(--lavender));
  color: var(--primary); font-weight: 800;
}
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink); font-size: 1.25rem; cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.page { padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 14px; }
.page.no-nav { padding-bottom: calc(var(--safe-b) + 28px); }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 560px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 6px var(--safe-b);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--nav-h); border: 0; background: none; font: inherit; cursor: pointer;
  color: var(--muted); font-size: 0.7rem; font-weight: 600; position: relative;
}
.nav-item .ico { font-size: 1.3rem; line-height: 1; filter: grayscale(0.6); opacity: 0.8; }
.nav-item.active { color: var(--primary); }
.nav-item.active .ico { filter: none; opacity: 1; }
.nav-item .dot { position: absolute; top: 8px; right: calc(50% - 18px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--peach-ink); color: #fff; font-size: 0.62rem; display: grid; place-items: center; }
.fab {
  justify-self: center; align-self: center;
  width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); font-size: 1.8rem; font-weight: 400; line-height: 1;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent);
  transform: translateY(-10px);
}
.fab:disabled { opacity: 0.4; box-shadow: none; }
.fab:active { transform: translateY(-8px) scale(0.97); }

/* ---------- kartu ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.card.soft { background: var(--primary-softer); box-shadow: none; }
.card.flat { box-shadow: none; }
.card.pad0 { padding: 4px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card.pad0 .card-head { padding: 10px 14px 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 6px; flex-wrap: wrap; }
.section-label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 6px 2px -4px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .label { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.hero { grid-column: 1 / -1; background: linear-gradient(135deg, var(--primary-soft), var(--lavender)); border: 0; }
.stat.hero .value { font-size: 1.6rem; }
.stat-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.stat-grid.three .stat .value { font-size: 0.92rem; }

/* ---------- daftar ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-top: 1px solid var(--line); min-height: 52px;
  color: var(--ink); background: none; width: 100%; text-align: left; font: inherit;
}
.list > .item:first-child, .list > template:first-child + .item { border-top: 0; }
.item.tap { cursor: pointer; }
.item.tap:active { background: var(--surface-2); }
.item.sub-line { padding-top: 6px; padding-bottom: 6px; min-height: 0; border-top: 0; }
.item.selected { background: var(--primary-softer); }
.item .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .t.wrap { white-space: normal; }
.item .s { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s.wrap { white-space: normal; }
.item .end { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.item .chev { color: var(--muted); flex: none; }
.item input[type="checkbox"] { width: 20px; height: 20px; flex: none; accent-color: var(--primary); }
.item.total { font-weight: 800; background: var(--surface-2); }
.list.inset .item { padding-left: 0; padding-right: 0; }

/* Kartu jurnal: keterangan dan catatan tampil utuh (boleh turun baris), nominal di baris tanggal */
.jcard { padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.jcard:first-child { border-top: 0; }
.jcard:active { background: var(--surface-2); }
.jcard.void { opacity: 0.55; }
.jcard .jdesc { white-space: pre-line; overflow-wrap: anywhere; }
.jcard .jmeta { margin-top: 2px; }
.jcard .jlines { margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.jcard .jl { display: flex; align-items: flex-start; gap: 8px; font-size: 0.8rem; }
.jcard .jl .acc { flex: 1; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.jcard .jl .memo { display: block; font-size: 0.76rem; font-weight: 400; white-space: pre-line; }
.jcard .jl.hit .acc { color: var(--ink); font-weight: 700; }

/* ---------- badge, chip, seg ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 700;
  background: var(--surface-3); color: var(--muted); white-space: nowrap; vertical-align: middle;
}
.badge.pink { background: var(--primary-soft); color: var(--primary); }
.badge.lavender { background: var(--lavender); color: var(--lavender-ink); }
.badge.mint { background: var(--mint); color: var(--mint-ink); }
.badge.peach { background: var(--peach); color: var(--peach-ink); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.seg {
  display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2);
  overflow-x: auto; scrollbar-width: none; flex: none; max-width: 100%;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; border: 0; background: none; font: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); padding: 8px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap;
}
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.8rem; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-weight: 700; }

/* ---------- bar ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.bar.over > span { background: var(--danger); }
.bar.ok > span { background: var(--positive); }
.bar.stacked > span { border-radius: 0; }
.bar.thin { height: 5px; }

.pill-note { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.86rem; }
.pill-note.diff-ok { background: var(--mint); color: var(--mint-ink); font-weight: 600; }
.pill-note.diff-bad { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 0.92rem; }
