:root {
  color-scheme: light;
  --bg:#f8f7f5; --surface:#fff; --ink:#1b1d27; --muted:#56635d;
  --forest:#204b40; --sage:#9cc9b4; --accent:#ef3340; --red:#b52031;
  --soft:#e6f0ea; --line:#dde5de; --amber:#82500e; --amber-bg:#faeed8;
  --lav:#65458a; --lav-bg:#eee7f6; --shadow:0 5px 25px #203b3010;
}
:root.dark {
  color-scheme:dark;
  --bg:#151a19; --surface:#202826; --ink:#f2f4f2; --muted:#bdc9c3;
  --forest:#a8d8c3; --red:#ff9aa0; --soft:#283e35; --line:#3a4d45;
  --amber:#f5ce8f; --amber-bg:#3c3020; --lav:#ddc8fb; --lav-bg:#362a49; --shadow:none;
}
* { box-sizing:border-box }
[hidden] { display:none!important }
body { margin:0; background:var(--bg); color:var(--ink); font:1rem/1.52 system-ui,"Leelawadee UI",Tahoma,sans-serif }
button,input,select,textarea { font:inherit; color:inherit; min-width:0 }
button { cursor:pointer; background:none; border:0; min-height:44px; border-radius:12px; padding:8px 12px }
button:disabled { cursor:wait; opacity:.62 }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,a:focus-visible { outline:3px solid #487e68; outline-offset:2px }
img { max-width:100%; height:auto }
h1,h2,h3,p { margin:0; overflow-wrap:anywhere }
h1 { font-size:clamp(1.55rem,4vw,2rem); line-height:1.25 }
h2 { font-size:1.15rem; line-height:1.4 }
h3 { font-size:1rem }
small,.small { font-size:.81rem }
small,.muted { color:var(--muted) }
a { color:var(--forest) }
input,select,textarea { border:1px solid var(--line); background:var(--surface); border-radius:11px; padding:10px; min-height:46px; width:100%; max-width:100% }
textarea { resize:vertical }
[type=checkbox] { width:22px; height:22px; min-height:0; accent-color:#306951 }
.skip { position:fixed; top:8px; left:12px; z-index:10; background:var(--surface); padding:12px; transform:translateY(-150%) }
.skip:focus { transform:none }
.sidebar { display:none }
main { padding:max(16px,env(safe-area-inset-top)) max(15px,env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(15px,env(safe-area-inset-left)); max-width:680px; margin:auto }
.top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px }
.brand { display:block; width:192px; border-radius:9px }
.mobile-brand { width:145px; margin-bottom:7px }
#subtitle { margin-top:4px; color:var(--muted); font-size:.82rem }
.profile { flex:0 0 44px; border-radius:50%; background:var(--surface); border:1px solid var(--line); color:var(--forest); font-weight:750; font-size:.82rem }
.notice { border:1px solid #deb87d70; border-radius:13px; padding:8px 12px; margin-bottom:14px; color:var(--amber); background:var(--amber-bg); font-size:.84rem }
.stack { display:grid; gap:14px }
.stack > *, .grid > *, .duo > * { min-width:0 }
.grid,.duo { display:grid; grid-template-columns:minmax(0,1fr); gap:14px }
.duo { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px }
.card { background:var(--surface); border:1px solid var(--line); border-radius:22px; padding:16px; box-shadow:var(--shadow); min-width:0; overflow-wrap:anywhere }
.hero { background:linear-gradient(125deg,#204b40,#2d6453); color:#fff; border-color:transparent; position:relative; overflow:hidden }
.hero:after { content:""; position:absolute; width:245px; height:245px; top:-120px; right:-96px; border-radius:50%; border:1px solid #ffffff26; pointer-events:none }
.hero small,.hero .muted { color:#d2e8dd }
.hero .rule { border-color:#ffffff3d }
.hero .link { color:#fff }
.amount { font-size:clamp(1.65rem,7vw,2.55rem); font-weight:780; letter-spacing:-.04em; line-height:1.18; font-variant-numeric:tabular-nums; margin:8px 0 }
.metric { font-size:clamp(1.15rem,5.5vw,1.6rem); font-weight:750; letter-spacing:-.035em; line-height:1.25 }
.green { color:var(--forest) }
.red { color:var(--red) }
.amber { color:var(--amber) }
.lav { color:var(--lav) }
.tinted-amber { background:var(--amber-bg); color:var(--amber); border-color:#deb87d55; box-shadow:none }
.tinted-lav { background:var(--lav-bg); color:var(--lav); border-color:#bcacd255; box-shadow:none }
.rule { border-top:1px solid var(--line); margin:12px 0 }
.row { display:flex; align-items:center; gap:10px; min-width:0 }
.between { justify-content:space-between }
.wrap { flex-wrap:wrap }
.row > * { min-width:0 }
.controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px }
.controls > * { flex:0 1 auto }
.quick-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px }
.primary { background:#204b40; color:#fff; font-weight:740 }
.dark .primary { background:#a8d8c3; color:#172b23 }
.secondary,.chip,.active { background:var(--soft); color:var(--forest); font-weight:690 }
.link { color:var(--forest); font-weight:740 }
.icon { width:44px; padding:4px; flex-shrink:0 }
.fill { width:100% }
.badge { display:inline-block; border-radius:20px; padding:4px 9px; font-size:.77rem; background:var(--soft); color:var(--forest) }
.badge.amber { background:var(--amber-bg); color:var(--amber) }
.money-row { display:flex; text-align:left; align-items:center; width:100%; gap:10px; border-bottom:1px solid var(--line); padding:11px 0; border-radius:0 }
.money-row:last-child { border-bottom:0 }
.money-row:hover { background:var(--soft) }
.row-symbol { display:grid; place-items:center; width:42px; height:42px; flex:0 0 42px; border-radius:13px; background:var(--soft); color:var(--forest) }
.row-text { flex:1; min-width:0; overflow-wrap:anywhere }
.row-text strong,.row-text small { display:block }
.row-money { text-align:right; overflow-wrap:anywhere; flex:0 1 auto; max-width:42% }
.progress { height:9px; background:var(--line); border-radius:10px; overflow:hidden; margin:9px 0 }
.progress i { display:block; height:100%; background:#75a990; border-radius:inherit }
.month { width:auto; max-width:100% }
.chart { display:flex; flex-wrap:wrap; align-items:center; gap:12px }
.donut { width:112px; aspect-ratio:1; flex:0 0 112px; border-radius:50%; display:grid; place-items:center }
.donut span { display:grid; place-content:center; text-align:center; width:73%; aspect-ratio:1; border-radius:50%; background:var(--surface); line-height:1.3; overflow-wrap:anywhere; font-size:.85rem }
.legend { flex:1; min-width:140px }
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px }
.bottom { position:fixed; z-index:3; bottom:0; left:0; right:0; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); background:var(--surface); border-top:1px solid var(--line); padding:2px env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) }
.bottom button { min-height:62px; display:grid; align-content:center; justify-items:center; padding:3px 1px; gap:2px; color:var(--muted); line-height:1.3; font-size:.74rem; overflow-wrap:anywhere }
.bottom .active { color:var(--forest) }
.nav-icon { font-size:1.16rem; line-height:1 }
.bottom .add .nav-icon { display:grid; place-items:center; width:44px; height:44px; margin-top:-11px; border-radius:50%; background:#204b40; color:#fff; font-size:1.35rem }
dialog { max-height:calc(100dvh - 24px); max-width:calc(100% - 24px); width:550px; background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:22px; padding:16px; box-shadow:0 16px 65px #0c201e50 }
dialog::backdrop { background:#111a19a0 }
.dialog-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:10px }
label.field { display:grid; gap:4px; font-size:.9rem; min-width:0 }
.check { display:flex; align-items:center; gap:10px; min-height:44px }
.error { color:var(--red); font-weight:650 }
#toast { position:fixed; z-index:5; bottom:calc(72px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100% - 28px); background:#204b40; color:#fff; padding:10px 14px; border-radius:12px; pointer-events:none }
#toast:empty { display:none }
.mascots { display:flex; gap:8px; max-height:135px; justify-content:center; overflow:hidden }
.mascots img { max-height:135px; width:auto; min-width:0; object-fit:contain; border-radius:12px }
.receipt { display:block; max-height:240px; object-fit:contain; margin:auto }
@media (min-width:800px) {
  .shell { display:grid; grid-template-columns:228px minmax(0,1fr) }
  .sidebar { position:sticky; top:0; height:100vh; display:flex; flex-direction:column; gap:12px; background:var(--surface); border-right:1px solid var(--line); padding:26px 18px; overflow:auto }
  .sidebar nav { display:grid; gap:4px }
  .sidebar nav button { text-align:left; display:flex; align-items:center; gap:12px; }
  .side-footer { margin-top:auto }
  .version { color:var(--muted); font-size:.76rem }
  .mobile-brand,.bottom { display:none }
  main { width:100%; max-width:1320px; padding:32px clamp(22px,3vw,44px) 46px }
  .grid { grid-template-columns:repeat(2,minmax(0,1fr)) }
  .quick-actions { grid-template-columns:repeat(3,minmax(0,1fr)) }
  .duo { gap:14px }
  .card { padding:19px }
  .donut { width:138px; flex-basis:138px }
  #toast { bottom:20px }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation:none!important; transition:none!important } }

/* Alpha V0.2 dashboard, artwork and evidence tools */
.lucide { display:inline-block; vertical-align:middle; width:1.15em; height:1.15em; flex:none }
.has-icon { display:inline-flex; align-items:center; justify-content:center; gap:.45em }
p.has-icon { justify-content:flex-start }
.top-controls { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px }
.profile { border-radius:12px; font-size:.83rem }
.privacy-toggle { border:1px solid var(--line); background:var(--surface); color:var(--forest) }
#subtitle:empty { display:none }
.overview .card h2 { font-size:1rem }
.safe-due { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; font-size:.85rem; gap:0 8px }
.safe-due .link { padding-inline:2px }
.card h2 + .duo { margin-top:6px }
.period-picker { display:flex; align-items:center; flex-wrap:wrap; gap:4px 8px; font-size:.83rem; color:var(--muted) }
.period-picker input { font-size:max(16px,.83rem); min-height:44px }
.donut { padding:0 }
.chart-category { width:100%; padding-inline:6px; text-align:left; gap:8px; overflow-wrap:anywhere }
.chart-category:hover { background:var(--soft) }
dialog { max-height:calc(100dvh - max(12px,env(safe-area-inset-top)) - max(12px,env(safe-area-inset-bottom))); overscroll-behavior:contain }
dialog[open] { animation:dialog-appear 150ms ease-out }
@keyframes dialog-appear { from { opacity:0; transform:translateY(4px) } }
button { transition:background-color 130ms ease,color 130ms ease }
.welcome-dialog { width:520px; padding:clamp(14px,4vw,24px) }
.welcome-dialog .dialog-head { margin-bottom:2px }
.welcome-dialog form { gap:10px }
.welcome-dialog .form-error:empty { display:none }
.welcome-copy { color:var(--muted) }
.welcome-art { margin:0; padding:7px 10px 4px; border-radius:14px; background:linear-gradient(135deg,var(--soft),var(--bg)); text-align:center }
.welcome-art img { display:block; margin:auto; width:auto; height:auto; max-height:min(30dvh,246px); object-fit:contain }
.evidence-editor,.transfer-options { min-width:0; margin:0; padding:8px 10px; border:1px solid var(--line); border-radius:12px }
.evidence-editor legend,.transfer-options legend { font-size:.89rem; font-weight:650; padding:0 4px }
.evidence-editor { display:grid; gap:6px }
.evidence-editor small { display:block }
.evidence-staged { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(128px,100%),1fr)); gap:8px }
.evidence-thumb { display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px; border:1px solid var(--line); border-radius:10px; min-width:0 }
.evidence-thumb span { max-width:100%; overflow-wrap:anywhere; font-size:.8rem }
.evidence-thumb img { max-height:86px; max-width:100%; object-fit:contain }
.evidence-thumb .link { padding:6px; font-size:.8rem }
.camera-button { position:relative; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; min-height:44px; gap:5px; padding:6px 8px; border-radius:9px }
.camera-button:focus-within { outline:2px solid var(--forest) }
.camera-button [type=file] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer }
.receipt-full { max-height:65dvh; object-fit:contain; justify-self:center }
.refund-row { border-bottom:1px solid var(--line); padding-bottom:8px }
@media (max-width:799px) {
  main { padding-top:max(9px,env(safe-area-inset-top)); padding-inline:max(12px,env(safe-area-inset-right),env(safe-area-inset-left)) }
  .top { margin-bottom:7px }
  h1 { font-size:1.22rem }
  .mobile-brand { width:108px; margin-bottom:3px }
  #subtitle { margin-top:1px }
  .notice { margin-bottom:8px; padding:5px 9px }
  .stack,.grid { gap:9px }
  .card { padding:11px; border-radius:16px }
  .amount { margin:4px 0 }
  .quick-actions { gap:6px }
  .quick-actions button { padding-inline:5px }
  .money-row { padding:7px 0 }
  .row-symbol { width:34px; height:34px; flex-basis:34px }
  .dialog-head { margin-bottom:4px }
  dialog input:not([type=checkbox]),dialog select,dialog textarea { font-size:max(16px,1em) }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important } }
main { margin:0 auto }
.profile { flex:0 0 auto; padding-inline:10px; white-space:nowrap; height:44px }
@media (max-width:799px) {
  .quick-actions { grid-template-columns:repeat(3,minmax(0,1fr)) }
  .quick-actions .has-icon { flex-wrap:wrap; gap:3px; font-size:.85rem; overflow-wrap:anywhere }
}

.evidence-status { color:var(--forest); font-size:.87rem; font-weight:700 }
.evidence-status:empty,.evidence-error:empty { display:none }
.evidence-keep { display:flex; align-items:center; text-align:left; gap:8px; min-height:44px; font-size:.82rem }
.evidence-keep input { flex:none }
.file-sizes,.readability-note { width:100%; text-align:center }
.readability-note { color:var(--amber) }
.evidence-thumb .error { font-size:.8rem; text-align:center }

.cloud-strip { margin:0 0 14px }
.cloud-strip button { display:inline-flex; gap:12px; align-items:center; background:var(--soft); padding-inline:14px; flex-wrap:wrap }
.cloud-strip small { color:var(--forest); font-weight:600 }
.cloud-strip small:empty { display:none }
.account-identity { display:grid; gap:3px; margin:12px 0; overflow-wrap:anywhere }
.account-identity span,.sync-state + p { color:var(--muted) }
.setup-account,.conflict-card { margin:0; border:1px solid var(--line); border-radius:12px; padding:10px; min-width:0 }
.setup-account { display:grid; gap:8px; grid-template-columns:minmax(0,1fr) minmax(0,1fr) }
.conflict-card { display:grid; gap:10px }
.compare-pair { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px }
.compare-pair > div { display:grid; gap:5px; padding:10px; border-radius:10px; background:var(--soft); overflow-wrap:anywhere }
.queue-row { display:flex; justify-content:space-between; gap:8px; align-items:center; flex-wrap:wrap; padding:8px 0; border-bottom:1px solid var(--line) }
.storage-meter { display:grid; grid-template-columns:1fr auto; gap:6px 10px }
.storage-meter progress { grid-column:1/-1; width:100%; accent-color:var(--forest) }
.backup-preview:not(:empty) { padding:10px 12px; border-radius:10px; background:var(--soft); overflow-wrap:anywhere }
.install-steps { padding-inline-start:23px }
.install-steps li+li { margin-top:8px }
@media(max-width:380px) { .setup-account { grid-template-columns:1fr } }
