/* MoneyMe — tema putih dengan aksen (lis) gold */
:root {
  --bg: #FFFFFF; --surface: #FFFFFF; --soft: #FBF7EA; --soft2: #F6EED3;
  --gold: #C9A227; --gold-d: #9A7A0E; --gold-l: #EBD98A; --line: #EFE4BF;
  --text: #2A2418; --muted: #8B8266; --inc: #1F8F5A; --exp: #CC4237; --warn: #D98E1B;
  --btn: linear-gradient(135deg, #C29A1F, #9A7A0E);
  --hero: linear-gradient(135deg, #C9A227 0%, #A9830F 60%, #8C6B08 100%);
  --shadow: 0 2px 12px rgba(154, 122, 14, .09);
  --r: 16px; color-scheme: light;
}
:root[data-theme=dark] {
  --bg: #15120B; --surface: #1E1A11; --soft: #282214; --soft2: #332B18;
  --gold: #DDB93F; --gold-d: #E6C760; --gold-l: #5C4C17; --line: #3A3220;
  --text: #F3EBD2; --muted: #A89E80; --inc: #4CC38A; --exp: #F07A6F; --warn: #F0AE48;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--soft); }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; color: var(--text); background: var(--soft); -webkit-font-smoothing: antialiased; }
body.noscroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
.in { color: var(--inc); } .out { color: var(--exp); } .over { color: var(--exp); } .warn { color: var(--warn); } .ok { color: var(--inc); }
.center { text-align: center; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--bg); border-top: 4px solid var(--gold);
  padding-bottom: calc(156px + env(safe-area-inset-bottom)); box-shadow: 0 0 0 1px var(--line); }
#view { padding: 4px 16px 16px; }

/* header */
#top { position: sticky; top: 0; z-index: 10; background: var(--bg); padding-top: env(safe-area-inset-top); }
.bar { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 20px; font-weight: 700; }
.bar .icon-btn { margin-left: -8px; }
.brand { gap: 12px; }
.brand h1 { font-size: 21px; letter-spacing: -.2px; }
.brand h1 span { color: var(--gold); }
.brand small { display: block; color: var(--muted); font-size: 12.5px; margin-top: -2px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--gold-d); }
.icon-btn:active { background: var(--soft); }

/* nav bawah */
#nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(480px, 100%); z-index: 15; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bg); border-top: 2px solid var(--gold); padding-bottom: env(safe-area-inset-bottom); }
#nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 11.5px; color: var(--muted); position: relative; }
#nav a.on { color: var(--gold-d); font-weight: 600; }
#nav a.on::before { content: ""; position: absolute; top: -2px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold-d); }
.fab-wrap { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(480px, 100%);
  display: flex; justify-content: flex-end; padding: 0 18px; pointer-events: none; z-index: 14; }
.fab { pointer-events: auto; width: 60px; height: 60px; border-radius: 50%; background: var(--btn); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(154, 122, 14, .38), 0 0 0 4px var(--bg); }
.fab .ic { width: 28px; height: 28px; stroke-width: 2.6; }
.fab:active { transform: scale(.94); }
body.onboard #app { padding-bottom: 24px; }

/* hero saldo */
.hero { margin-top: 12px; padding: 20px; border-radius: 20px; background: var(--hero); color: #fff; position: relative; overflow: hidden; box-shadow: 0 8px 24px rgba(154, 122, 14, .25); }
.hero::after { content: ""; position: absolute; right: -40px; top: -50px; width: 170px; height: 170px; border-radius: 50%; border: 22px solid rgba(255, 255, 255, .1); }
.hero-l { font-size: 13.5px; opacity: .9; }
.hero-amt { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 2px 0 16px; word-break: break-all; }
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-row div { background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 9px 11px; min-width: 0; }
.hero-row small { display: block; font-size: 11.5px; opacity: .92; }
.hero-row b { font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* section & card */
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 9px; }
.sec h2 { font-size: 16.5px; font-weight: 700; padding-left: 10px; border-left: 3px solid var(--gold); line-height: 1.15; }
.sec a { color: var(--gold-d); font-size: 14px; font-weight: 600; padding: 4px 0 4px 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.card.pad { padding: 16px; }
.card.faded { opacity: .65; }
.card + .btn, .card + .hint { margin-top: 14px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 12px 4px; }
.count { color: var(--muted); font-size: 13px; margin: 2px 4px 0; }

/* notice */
.notice { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 13px 14px; border-radius: var(--r); border: 1px solid var(--gold-l); background: var(--soft); color: var(--text); }
.notice > span:first-child { font-size: 26px; }
.notice > span:nth-child(2) { flex: 1; }
.notice b { display: block; font-size: 15px; }
.notice small { color: var(--muted); font-size: 13px; }
.notice .ic { color: var(--gold-d); }
.notice.soft { margin-top: 0; }

/* dompet horizontal */
.wallets { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.wallets::-webkit-scrollbar { display: none; }
.wcard { flex: none; width: 140px; padding: 13px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); scroll-snap-align: start; }
.wcard span { font-size: 24px; display: block; }
.wcard small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard.add { border: 1.5px dashed var(--gold-l); background: var(--soft); box-shadow: none; color: var(--gold-d); width: 110px; }
.wcard.add b { color: var(--gold-d); }

/* baris transaksi */
.tx { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-bottom: 1px solid var(--line); min-height: 64px; }
.tx:last-child, .row:last-child, .bud:last-child { border-bottom: 0; }
.tx:active, .row:active, .bud:active { background: var(--soft); }
.tx-ic, .row-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 13px; background: var(--soft); border: 1px solid var(--line); font-size: 21px; }
.tx-b { flex: 1; min-width: 0; }
.tx-b b { display: block; font-size: 15.5px; font-weight: 600; }
.tx-b small, .row-t small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-a { font-weight: 700; font-size: 15px; white-space: nowrap; }
.tx-a.in { color: var(--inc); } .tx-a.out { color: var(--exp); } .tx-a.tr { color: var(--gold-d); }
.day { display: flex; justify-content: space-between; margin: 18px 4px 8px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.day b { font-weight: 600; }

/* baris menu */
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; min-height: 62px; border-bottom: 1px solid var(--line); }
.row-t { flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; }
.row-t small { font-weight: 400; }
.row > .ic { color: var(--muted); width: 18px; height: 18px; }
.row-r { font-size: 15px; white-space: nowrap; }
.group { margin-top: 18px; }
.group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--gold-d); margin: 0 4px 8px; }
.about { display: flex; align-items: center; gap: 12px; margin: 26px 4px 8px; color: var(--muted); font-size: 13px; }
.sw { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.sw i { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.sw.on { background: var(--gold); } .sw.on i { left: 21px; }
.radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.radio.on { border: 7px solid var(--gold); }
.total { text-align: center; margin: 16px 0; }
.total small { color: var(--muted); } .total b { display: block; font-size: 26px; color: var(--gold-d); }

/* budget */
.bud { display: block; width: 100%; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.bud-t { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; margin-bottom: 7px; }
.bud small { color: var(--muted); font-size: 13px; display: block; margin-top: 6px; }
.prog { height: 9px; border-radius: 6px; background: var(--soft2); overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 6px; background: var(--inc); transition: width .3s; }
.prog.warn i { background: var(--warn); } .prog.over i { background: var(--exp); }

/* riwayat */
.mnav { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 8px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 2px; }
.mnav b { font-size: 16px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; height: 100%; min-width: 0; font-size: 15.5px; }
.search:focus-within { border-color: var(--gold); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 10px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.chip { flex: none; padding: 8px 15px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted); }
.chip.on { background: var(--gold-d); border-color: var(--gold-d); color: #fff; font-weight: 600; }
:root[data-theme=dark] .chip.on { color: #15120B; }

/* laporan */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.stat small { color: var(--muted); font-size: 13px; display: block; }
.stat b { font-size: 16.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat.wide { grid-column: 1 / -1; border-color: var(--gold-l); background: var(--soft); }
.stat.wide b { font-size: 22px; }
.stat.wide span { font-size: 13px; }
.donut { position: relative; width: 190px; height: 190px; margin: 4px auto 14px; }
.donut svg { width: 100%; height: 100%; transform: none; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-c small { color: var(--muted); font-size: 12.5px; } .donut-c b { font-size: 20px; }
.legend { display: grid; gap: 2px; }
.lg { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.lg i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.lg span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg small { color: var(--muted); width: 38px; text-align: right; }
.lg b { font-size: 14.5px; white-space: nowrap; }
.bars { width: 100%; height: auto; display: block; }
.bar-l { font-size: 11.5px; fill: var(--muted); } .bar-l.on { fill: var(--gold-d); font-weight: 700; }
.keys { display: flex; justify-content: center; gap: 18px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.keys i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.k-in { background: var(--inc); } .k-out { background: var(--exp); }

/* empty */
.empty { text-align: center; padding: 30px 20px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--r); margin-top: 6px; }
.empty span { font-size: 36px; display: block; margin-bottom: 6px; }
.empty p { font-size: 14.5px; }

/* tombol & input */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 15.5px; text-align: center; }
.btn.full { width: 100%; margin-top: 10px; }
.btn.big { min-height: 54px; font-size: 16.5px; }
.btn.primary { background: var(--btn); color: #fff; box-shadow: 0 4px 12px rgba(154, 122, 14, .25); }
.btn.ghost { background: var(--surface); border: 1.5px solid var(--gold-l); color: var(--gold-d); }
.btn.danger { background: var(--exp); color: #fff; }
.btn.danger-t { color: var(--exp); border-color: var(--line); }
.btn:active { transform: scale(.98); }
.link { display: block; text-align: center; color: var(--gold-d); font-weight: 600; font-size: 14.5px; padding: 14px; cursor: pointer; width: 100%; }
.lbl { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin: 14px 2px 6px; }
.inp { width: 100%; height: 48px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); outline: 0; font-size: 16px; min-width: 0; }
.inp:focus { border-color: var(--gold); }
select.inp { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A7A0E' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
input[type=date].inp { -webkit-appearance: none; appearance: none; display: flex; align-items: center; }
.amt { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); }
.amt:focus-within { border-color: var(--gold); }
.amt span { color: var(--muted); font-weight: 700; font-size: 18px; }
.amt input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 22px; font-weight: 700; height: 100%; }
.amt.big { height: 70px; margin-top: 14px; border-color: var(--gold-l); background: var(--soft); }
.amt.big input { font-size: 30px; }
.amt.expense input { color: var(--exp); } .amt.income input { color: var(--inc); } .amt.transfer input { color: var(--gold-d); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > div { min-width: 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); margin: 10px 0 4px; }
.seg3 { grid-template-columns: repeat(3, 1fr); }
.seg button { min-height: 40px; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--gold-d); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.seg button.on.expense { color: var(--exp); } .seg button.on.income { color: var(--inc); }
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface); min-width: 0; }
.cat span { font-size: 23px; }
.cat small { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.cat.on { border-color: var(--gold); background: var(--soft); box-shadow: 0 0 0 2px var(--gold-l); }
.cat.on small { color: var(--text); font-weight: 600; }
.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.emo { height: 46px; border-radius: 12px; border: 1.5px solid var(--line); font-size: 22px; text-align: center; }
.emo.on { border-color: var(--gold); background: var(--soft); box-shadow: 0 0 0 2px var(--gold-l); }
.info { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; border-color: var(--gold-l); background: var(--soft); }
.info span { font-size: 28px; } .info p { font-size: 14.5px; }

/* onboarding */
.onb { padding: 48px 8px 20px; text-align: center; }
.onb h1 { font-size: 26px; margin: 18px 0 10px; line-height: 1.25; }
.onb h1 span { color: var(--gold); }
.onb > p { color: var(--muted); margin-bottom: 26px; }
.onb .card { text-align: left; margin-bottom: 8px; }
.onb .lbl { margin-top: 0; }

/* sheet */
#overlay .sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(20, 15, 5, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
#overlay .sheet-back.show { opacity: 1; }
.sheet { width: min(480px, 100%); max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-radius: 22px 22px 0 0;
  border-top: 3px solid var(--gold); padding: 0 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(30px); transition: transform .22s ease-out; }
.show .sheet { transform: none; }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg); z-index: 1; padding: 4px 0; }
.sheet-head h3 { font-size: 18px; }
.sheet-head .icon-btn { margin-right: -8px; color: var(--muted); }
.sheet > .card { margin-top: 6px; }

/* dialog */
#dialog .dlg-back { position: fixed; inset: 0; z-index: 60; background: rgba(20, 15, 5, .5); display: grid; place-items: center; padding: 24px; }
.dlg { width: min(360px, 100%); background: var(--bg); border-radius: 20px; padding: 22px 20px 16px; border-top: 3px solid var(--gold); }
.dlg h3 { font-size: 18px; margin-bottom: 8px; }
.dlg p { color: var(--muted); font-size: 15px; }
.dlg-btns { display: flex; gap: 10px; margin-top: 20px; }
.dlg-btns .btn { flex: 1; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 70; max-width: min(90vw, 420px);
  background: #2A2418; color: #FBF2D5; padding: 11px 18px; border-radius: 22px; font-size: 14.5px; text-align: center; border: 1px solid var(--gold);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* PIN */
#lock { display: none; }
#lock.on { display: flex; position: fixed; inset: 0; z-index: 50; background: var(--bg); align-items: center; justify-content: center; border-top: 4px solid var(--gold); }
.lock-in { width: min(340px, 100%); text-align: center; padding: 20px; }
.pin { text-align: center; padding: 6px 0 4px; }
.pin h2 { font-size: 19px; margin-top: 14px; }
.pin p { color: var(--muted); font-size: 14px; min-height: 21px; margin-top: 4px; }
.pin p.err { color: var(--exp); }
.dots { display: flex; justify-content: center; gap: 16px; margin: 18px 0 22px; }
.dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--gold); transition: background .1s; }
.dots i.on { background: var(--gold); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 22px; justify-content: center; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font-size: 26px; font-weight: 600; display: grid; place-items: center; }
.keypad button:active { background: var(--soft2); border-color: var(--gold); }
.keypad button[data-act=pin-del] { border: 0; background: none; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 520px) { #app { margin-top: 0; } }
