/* Sisih — layout & komponen. Mobile-first (uji 375×812).
   Border solid > bayangan (aturan matahari). Target sentuh 48dp. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal-deep); text-decoration: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

/* ---- app shell ---- */
#app { min-height: 100%; max-width: 480px; margin: 0 auto; position: relative; }
.screen { display: none; padding: 0 20px calc(96px + var(--safe-b)); animation: fade .18s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* screens tanpa bottom-nav (onboarding, keypad) */
.screen--full { padding-bottom: calc(24px + var(--safe-b)); min-height: 100dvh; display: none; flex-direction: column; }
.screen--full.active { display: flex; }

/* ---- header ---- */
.appbar {
  position: sticky; top: 0; z-index: 20; background: var(--ground);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 10px; margin-bottom: 4px;
}
.appbar h1 { font-size: 1.375rem; font-weight: 700; letter-spacing: -.01em; }
.appbar .spacer { flex: 1; }
.iconbtn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: 999px; font-size: 1.25rem; color: var(--ink-2);
}
.iconbtn:active { background: var(--teal-soft); }

/* ---- card ---- */
.card {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
}
.card + .card { margin-top: 14px; }
.eyebrow {
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3);
}

/* ---- Aman Hari Ini (kartu utama) ---- */
.aman {
  background: var(--teal); color: #fff; border: none;
  border-radius: var(--r-lg); padding: 22px 20px; position: relative; overflow: hidden;
}
.aman .eyebrow { color: rgba(255,255,255,.82); }
.aman .big {
  font-variant-numeric: tabular-nums lining-nums; font-weight: 800;
  font-size: 2.5rem; letter-spacing: -.03em; line-height: 1.1; margin: 6px 0 2px;
}
.aman .big .rp { opacity: .8; font-weight: 600; font-size: .55em; margin-right: .12em; vertical-align: .06em; }
.aman .sub { font-size: .9rem; color: rgba(255,255,255,.86); }
.aman.aman--defisit { background: var(--alert); }
:root[data-theme="dark"] .aman, :root:not([data-theme="light"]) .aman { color: #06120F; }
:root[data-theme="dark"] .aman .eyebrow, :root:not([data-theme="light"]) .aman .eyebrow { color: rgba(6,18,15,.7); }
:root[data-theme="dark"] .aman .sub, :root:not([data-theme="light"]) .aman .sub { color: rgba(6,18,15,.78); }

/* progress hari */
.periodbar { height: 6px; background: rgba(255,255,255,.28); border-radius: 999px; margin-top: 14px; overflow: hidden; }
.periodbar > i { display: block; height: 100%; background: #fff; border-radius: 999px; }

/* ---- daftar dompet ---- */
.wallet-row, .list-row {
  display: flex; align-items: center; gap: 12px; min-height: 56px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.wallet-row:last-child, .list-row:last-child { border-bottom: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--teal-soft); font-size: 1.15rem; flex: none;
}
.rowmain { flex: 1; min-width: 0; }
.rowmain .t { font-weight: 600; font-size: .975rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rowmain .s { font-size: .8125rem; color: var(--ink-3); }
.rowend { text-align: right; white-space: nowrap; }

/* ---- section title ---- */
.section-head { display: flex; align-items: center; margin: 24px 2px 10px; }
.section-head h2 { font-size: .95rem; font-weight: 700; }
.section-head .spacer { flex: 1; }
.link { color: var(--teal-deep); font-weight: 600; font-size: .875rem; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px; border-radius: 14px;
  font-weight: 700; font-size: 1rem; width: 100%;
  background: var(--teal); color: #fff; border: 1.5px solid var(--teal);
  transition: transform .06s ease;
}
:root[data-theme="dark"] .btn, :root:not([data-theme="light"]) .btn { color: #06120F; }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; }
.btn--ghost { background: transparent; color: var(--teal-deep); border-color: var(--line-strong); }
.btn--ghost { color: var(--teal-deep) !important; }
.btn--soft { background: var(--teal-soft); color: var(--teal-deep); border-color: transparent; }
.btn--danger { background: transparent; color: var(--alert); border-color: var(--line-strong); }
.btn--sm { min-height: 40px; width: auto; padding: 0 16px; font-size: .9rem; border-radius: 12px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* login with Google */
.btn--google {
  background: var(--surface); color: var(--ink) !important; border: 1.5px solid var(--line-strong);
}
.btn--google .g { width: 20px; height: 20px; flex: none; }

/* ---- FAB + bottom nav ---- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 30;
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1.5px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar.hidden { display: none; }
.tab {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); font-size: .6875rem; font-weight: 600;
}
.tab .ic { font-size: 1.25rem; line-height: 1; }
.tab[aria-current="page"] { color: var(--teal-deep); }
.fab {
  position: fixed; right: max(20px, calc(50% - 240px + 20px)); bottom: calc(76px + var(--safe-b)); z-index: 31;
  width: 60px; height: 60px; border-radius: 20px; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-size: 2rem; font-weight: 300;
  border: 1.5px solid var(--teal-deep);
}
:root[data-theme="dark"] .fab, :root:not([data-theme="light"]) .fab { color: #06120F; }
.fab.hidden { display: none; }

/* ---- keypad ---- */
.pad-wrap { display: flex; flex-direction: column; min-height: 100dvh; }
.pad-top { padding: 8px 4px 0; }
.pad-amount {
  text-align: center; padding: 22px 8px 8px; font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: clamp(2.4rem, 12vw, 3.4rem); letter-spacing: -.03em; color: var(--ink);
  min-height: 84px; word-break: break-all;
}
.pad-amount .rp { font-size: .42em; font-weight: 600; opacity: .5; margin-right: .1em; vertical-align: .18em; }
.pad-amount.zero { color: var(--ink-3); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 4px 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  font-size: .9rem; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-deep); }
.chip .ic { font-size: 1.05rem; }
.pad-bottom { margin-top: auto; padding-bottom: calc(12px + var(--safe-b)); }
.pad-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 10px 4px 12px;
}
.pad-bottom .btn { margin: 2px 4px 0; width: calc(100% - 8px); }
.key {
  min-height: 62px; border-radius: 16px; background: var(--surface);
  border: 1.5px solid var(--line); font-size: 1.5rem; font-weight: 600;
  display: grid; place-items: center;
}
.key:active { background: var(--teal-soft); }
.key--wide { grid-column: span 1; }
.key--ok { background: var(--teal); color: #fff; border-color: var(--teal-deep); }
:root[data-theme="dark"] .key--ok, :root:not([data-theme="light"]) .key--ok { color: #06120F; }
.key--del { font-size: 1.35rem; color: var(--ink-2); }

/* ---- onboarding ---- */
.ob { flex: 1; display: flex; flex-direction: column; padding-top: 8px; }
.ob-progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0 22px; }
.ob-progress > i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .3s ease; }
.ob h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.ob .lead { color: var(--ink-2); margin-top: 8px; font-size: 1rem; }
.ob .step-label { font-size: .8125rem; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.ob-foot { margin-top: auto; padding-top: 18px; }
/* onboarding — daftar pengeluaran wajib */
.ob-wlist { margin-top: 18px; }
.ob-wrow { display: flex; align-items: center; flex-wrap: nowrap; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ob-wrow:last-child { border-bottom: none; }
.ob-wic { width: 42px; height: 42px; border-radius: 12px; background: var(--teal-soft); display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.ob-wlab { flex: 1 1 auto; min-width: 0; }
.ob-wlab .t { font-weight: 600; font-size: .95rem; }
.ob-wlab .s { font-size: .78rem; color: var(--ink-3); }
.ob-wrow .ob-wname { width: 100%; margin-top: 8px; min-height: 40px; font-size: .9rem; }
.ob-wrow .ob-wamt { width: 116px; flex: 0 0 116px; min-height: 46px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; padding: 0 12px; }

.pillgrid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.pill {
  min-height: var(--tap); padding: 0 18px; border-radius: 14px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  font-weight: 600; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px;
}
.pill[aria-pressed="true"], .pill.sel { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-deep); }

/* landing */
.landing { flex: 1; display: flex; flex-direction: column; padding-top: 6vh; }
.brandmark { display: flex; align-items: center; gap: 10px; }
.brandmark .logo { width: 40px; height: 40px; }
.brandmark .name { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.landing h2 { font-size: 2rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.14; margin-top: 8vh; }
.landing .tag { color: var(--ink-2); margin-top: 12px; font-size: 1.0625rem; }
.checks { margin: 26px 0 0; display: grid; gap: 12px; }
.checks li { list-style: none; display: flex; gap: 10px; align-items: flex-start; font-size: 1rem; }
.checks .ck { color: var(--teal); font-weight: 800; }
.landing .fine { text-align: center; color: var(--ink-3); font-size: .8125rem; margin-top: 14px; }

/* ---- sheet / modal ---- */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,19,15,.44);
  display: none; align-items: flex-end; justify-content: center;
}
.scrim.open { display: flex; animation: fade .15s ease; }
.sheet {
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 8px 20px calc(20px + var(--safe-b));
  max-height: 92dvh; overflow-y: auto; animation: rise .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.grab { width: 40px; height: 4px; background: var(--line-strong); border-radius: 999px; margin: 6px auto 14px; }
.sheet h3 { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.sheet .muted { color: var(--ink-2); font-size: .925rem; margin-top: 4px; }

/* ---- form ---- */
.field { margin-top: 16px; }
.field label { display: block; font-size: .8125rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%; min-height: var(--tap); padding: 0 14px; border-radius: 12px;
  background: var(--ground); border: 1.5px solid var(--line-strong); font-size: 1rem;
}
.input:focus { border-color: var(--teal); background: var(--surface); }
textarea.input { padding: 12px 14px; min-height: 76px; resize: vertical; line-height: 1.5; }
.input-amount { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25rem; }

/* segmented */
.seg { display: flex; gap: 6px; background: var(--ground); border: 1.5px solid var(--line); border-radius: 14px; padding: 4px; }
.seg button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--teal-deep); border: 1px solid var(--line-strong); }

/* ---- empty state ---- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .em { font-size: 2.4rem; }
.empty .t { font-weight: 700; color: var(--ink-2); margin-top: 8px; font-size: 1.05rem; }
.empty .s { margin-top: 4px; font-size: .925rem; }

/* ---- misc ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge--rapuh { background: color-mix(in srgb, var(--alert) 14%, transparent); color: var(--alert); }
.badge--tipis, .badge--caution { background: color-mix(in srgb, var(--caution) 18%, transparent); color: var(--caution); }
.badge--cukup { background: var(--teal-soft); color: var(--teal-deep); }
.badge--kokoh { background: color-mix(in srgb, var(--income) 16%, transparent); color: var(--income); }
.stale { opacity: .5; }
.hint { font-size: .8125rem; color: var(--ink-3); margin-top: 6px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.datehdr { font-size: .8125rem; font-weight: 700; color: var(--ink-3); margin: 20px 2px 4px; }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); z-index: 80;
  background: var(--ink); color: var(--ground); padding: 12px 18px; border-radius: 999px;
  font-size: .9rem; font-weight: 600; max-width: 90%; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* offline pill */
.offline {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--caution); color: #fff; font-size: .75rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; display: none;
}
.offline.show { display: block; }

.two-num { display: flex; gap: 12px; }
.two-num > div { flex: 1; }
.mini-label { font-size: .75rem; color: var(--ink-3); font-weight: 600; }
.dim { color: var(--ink-3); }
.wa { color: #128C7E; }
:root[data-theme="dark"] .wa, :root:not([data-theme="light"]) .wa { color: #4FD1BC; }
