/* Nest Egg. Colors are tokens so the three looks (Normal / Dark / Vibrant) swap in one place. */
:root, :root[data-theme="normal"] { --bg:#F6F8F5; --card:#fff; --text:#1D3557; --text2:#33475F; --muted:#6B7A89; --line:#EEF2F0; --field-line:#DDE4EA; --tint:#E9EFF5; --soft:#E7ECF1; --inset:#F6F8F5;
  --band:#E6EEF7; --band-text:#1D3557; --band-sub:#6B7A89; --band-gold:#FFF3C4; --band-gold-text:#1D3557; --band-green:#DDF1EC; --band-green-text:#1D3557;
  --accent:#1D3557; --on-accent:#fff; --ring:#1D3557; --status:#1D3557; --green:#2E8B57; --red:#E63946;
  --note-bg:#FFF3C4; --note-line:#F4C430; --note-text:#5A4300; --bad-bg:#FDECEE; --bad-line:#F3B6BC; --bad-text:#7A1F27; --ok-bg:#E3F4EA; --ok-line:#9ED3B4; --ok-text:#1E5C3A; }
:root[data-theme="dark"] { --bg:#0E1826; --card:#172436; --text:#E8EEF5; --text2:#C9D4E0; --muted:#93A3B5; --line:#24354B; --field-line:#33475F; --tint:#22344D; --soft:#2A3D56; --inset:#0E1826;
  --band:#22344D; --band-text:#E8EEF5; --band-sub:#93A3B5; --band-gold:#3B3216; --band-gold-text:#F6E3A1; --band-green:#163A33; --band-green-text:#A9E3D3;
  --accent:#3E6FB0; --on-accent:#fff; --ring:#E8EEF5; --status:#08111C; --green:#4CC38A; --red:#FF6B75;
  --note-bg:#3B3216; --note-line:#8A6D12; --note-text:#F6E3A1; --bad-bg:#3A1A21; --bad-line:#7A2A34; --bad-text:#FFC2C7; --ok-bg:#163A2A; --ok-line:#2E6B4C; --ok-text:#A9E3C3; }
:root[data-theme="vibrant"] { --bg:#F1FAEE; --card:#fff; --text:#1D3557; --text2:#1D3557; --muted:#5B6B7B; --line:#E4ECF0; --field-line:#C9D6E0; --tint:#DCE8F6; --soft:#DCE6EE; --inset:#F1FAEE;
  --band:#1D3557; --band-text:#fff; --band-sub:#BFD0E6; --band-gold:#F4C430; --band-gold-text:#1D2B3A; --band-green:#2A9D8F; --band-green-text:#fff;
  --accent:#E63946; --on-accent:#fff; --ring:#E63946; --status:#E63946; --green:#1F8A4C; --red:#E63946;
  --note-bg:#F4C430; --note-line:#D9A800; --note-text:#1D2B3A; --bad-bg:#E63946; --bad-line:#B8232F; --bad-text:#fff; --ok-bg:#2A9D8F; --ok-line:#1F7A6F; --ok-text:#fff; }

* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; height:100%; background:var(--bg); }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; color:var(--text); overscroll-behavior:none; }
button { font-family:inherit; }
#app { display:flex; flex-direction:column; height:100vh; height:100dvh; }

/* Status bar strip: the phone's notch area on a real iPhone; a fake 9:41 bar in preview.html. */
.status { flex:none; height:env(safe-area-inset-top); background:var(--status); }
.status span { display:none; }
.framed .status { height:50px; color:#fff; display:flex; justify-content:space-between; align-items:flex-end; padding:0 30px 8px; font-size:15px; font-weight:600; }
.framed .status span { display:inline; }

header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px 6px; flex:none; min-height:42px; }
header h1 { margin:0; font-size:15px; font-weight:600; color:var(--text); }
header .asof { font-size:15px; color:var(--text); display:flex; align-items:center; gap:2px; }
header .asof button { border:none; background:none; color:var(--text); font-size:19px; padding:0 6px; cursor:pointer; }
header .asof button:disabled { opacity:.25; cursor:default; }
main { flex:1; overflow-y:auto; padding:4px 12px 14px; -webkit-overflow-scrolling:touch; }
main::-webkit-scrollbar { display:none; }

/* Home */
.hero { text-align:center; padding:10px 0 4px; }
.hero .k { font-size:13px; color:var(--muted); }
.hero .v { font-size:36px; font-weight:700; color:var(--text); letter-spacing:-0.01em; margin:2px 0; }
.hero .n { font-size:13px; color:var(--green); }
.hero .n.bad { color:var(--red); }
.spark { display:block; margin:8px auto 2px; color:var(--text); max-width:100%; }
.spark-l { display:flex; justify-content:space-between; font-size:11px; color:var(--muted); margin:0 18px 10px; }
.tile-row { display:flex; gap:8px; margin-bottom:10px; }
.tile { flex:1; min-width:0; background:var(--card); border-radius:14px; padding:10px 6px 9px; text-align:center; }
.tile .tv { font-size:17px; font-weight:600; color:var(--text); white-space:nowrap; }
.tile .tv.bad { color:var(--red); }
.tile .tl { font-size:12px; color:var(--muted); margin-top:2px; }

/* Cards: every header folds open/closed with the ⌄ / › arrow. */
.card { background:var(--card); border-radius:16px; padding:0 14px 8px; margin-bottom:10px; overflow:hidden; }
.card > summary { margin:0 -14px; padding:10px 14px; background:var(--band); color:var(--band-text); font-weight:600; font-size:15px; display:flex; justify-content:space-between; align-items:center; gap:8px; list-style:none; cursor:pointer; }
.card[open] > summary { margin-bottom:4px; }
.card > summary::-webkit-details-marker { display:none; }
.card > summary .t::after { content:" ⌄"; color:var(--band-sub); font-weight:400; }
.card:not([open]) > summary .t::after { content:" ›"; }
.card:not([open]) { padding-bottom:0; }
.card > summary .rt { font-weight:400; color:var(--band-sub); font-size:12px; }
.card.gold > summary { background:var(--band-gold); color:var(--band-gold-text); }
.card.green > summary { background:var(--band-green); color:var(--band-green-text); }
.card.gold > summary .t::after, .card.gold > summary .rt { color:var(--band-gold-text); opacity:.7; }
.card.green > summary .t::after, .card.green > summary .rt { color:var(--band-green-text); opacity:.75; }

.row { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--line); }
.row:last-child { border-bottom:none; }
.nm { font-size:14px; color:var(--text); }
.mt { font-size:12px; color:var(--muted); margin-top:1px; }
.amt { font-size:15px; font-weight:600; color:var(--text); white-space:nowrap; }
.row.out .nm, .row.out .amt { color:var(--muted); font-weight:400; }
.tag { display:inline-block; font-size:11px; background:var(--tint); color:var(--muted); border-radius:6px; padding:0 5px; margin-left:4px; font-weight:400; }
.notice { background:var(--note-bg); border:1px solid var(--note-line); border-radius:14px; padding:10px 12px; font-size:14px; margin-bottom:10px; color:var(--note-text); }
.notice b { color:inherit; }
.notice .act { display:flex; justify-content:flex-end; gap:14px; margin-top:6px; }
.notice .act button { border:none; background:none; padding:2px 0; font-weight:600; color:inherit; font-size:14px; cursor:pointer; }
.notice.red { background:var(--bad-bg); border-color:var(--bad-line); color:var(--bad-text); }
.notice.green { background:var(--ok-bg); border-color:var(--ok-line); color:var(--ok-text); }
.welcome { text-align:center; padding:40px 18px; }
.welcome .egg { font-size:54px; }
.welcome h2 { font-size:22px; margin:8px 0 6px; }
.welcome p { font-size:15px; color:var(--muted); line-height:1.45; margin:0 0 18px; }
.help { text-align:left; font-size:14px; line-height:1.45; color:var(--text2); }
.help ol { padding-left:20px; margin:6px 0 10px; }
.help li { margin-bottom:4px; }
.btn { display:block; width:100%; border:none; border-radius:12px; background:var(--accent); color:var(--on-accent); font:600 16px -apple-system,sans-serif; padding:13px; cursor:pointer; }
.btn.sec { background:var(--tint); color:var(--text); margin-top:8px; }
.btn.small { display:inline-block; width:auto; padding:8px 14px; font-size:14px; flex:none; }
.btn:disabled { opacity:.5; }
.foot { text-align:center; font-size:12px; color:var(--muted); margin:6px 0 4px; }

/* Budget */
.cat { padding:9px 0; border-bottom:1px solid var(--line); }
.cat.tap { cursor:pointer; }
.cat:last-child { border-bottom:none; }
.cat .top { display:flex; justify-content:space-between; gap:8px; font-size:14px; }
.cat .top b { font-weight:600; }
.bar { height:7px; border-radius:4px; background:var(--soft); margin:6px 0 3px; overflow:hidden; }
.bar > div { height:7px; border-radius:4px; background:var(--green); }
.bar > div.over { background:var(--red); }
.bar > div.none { background:transparent; }
.cat .sub { display:flex; justify-content:space-between; font-size:12px; color:var(--muted); }
.cat .sub .over { color:var(--red); font-weight:600; }
.subs { background:var(--inset); border-radius:10px; padding:4px 10px; margin-top:8px; }
.subs .r { display:flex; justify-content:space-between; gap:8px; font-size:13px; padding:5px 0; border-bottom:1px solid var(--line); }
.subs .r:last-child { border-bottom:none; }
.subs .r .over { color:var(--red); font-weight:600; }
.subs .r .of { color:var(--muted); font-weight:400; }
.q { font-size:12px; color:var(--muted); text-align:center; margin:-2px 0 10px; }
.ytd { display:flex; justify-content:space-between; font-size:14px; padding:8px 0; }

/* Add */
.amount-box { text-align:center; padding:14px 0 6px; }
.amount-box .lbl { font-size:13px; color:var(--muted); }
.amount-box .bigwrap { display:flex; justify-content:center; align-items:baseline; font-size:42px; font-weight:700; color:var(--text); }
.amount-box .big { font:inherit; color:inherit; border:none; background:none; text-align:left; width:5.2ch; padding:0; outline:none; }
.amount-box .big::placeholder { color:var(--muted); opacity:.5; }
.field { margin-bottom:12px; }
.field label { display:block; font-size:13px; color:var(--muted); margin:0 0 5px 2px; }
.inp, .selwrap select { width:100%; display:block; appearance:none; -webkit-appearance:none; font:inherit; font-size:16px; color:var(--text); background:var(--card); border:1px solid var(--field-line); border-radius:10px; padding:11px 12px; min-height:46px; }
input[type="date"].inp { text-align:left; }
input[type="date"].inp::-webkit-date-and-time-value { text-align:left; }
.selwrap { position:relative; }
.selwrap select { padding-right:34px; }
.selwrap span { position:absolute; right:13px; top:50%; transform:translateY(-50%); color:var(--muted); pointer-events:none; }
.inp:focus, .selwrap select:focus { outline:2px solid var(--ring); outline-offset:-1px; }
.recent .row { cursor:pointer; }

/* Settings */
.seg { display:flex; background:var(--tint); border-radius:12px; padding:3px; margin-top:6px; }
.seg button { flex:1; text-align:center; padding:7px; font-size:14px; font-weight:600; color:var(--muted); border-radius:10px; cursor:pointer; border:none; background:none; }
.seg button.on { background:var(--card); color:var(--text); }
.set-row { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--line); font-size:14px; }
.set-row:last-child { border-bottom:none; }
.set-row .mt { max-width:220px; }
.switch { width:46px; height:28px; border-radius:14px; background:var(--soft); position:relative; flex:none; cursor:pointer; border:none; padding:0; }
.switch::after { content:""; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:var(--card); box-shadow:0 1px 2px rgba(0,0,0,.2); transition:left .15s; }
.switch.on { background:var(--green); }
.switch.on::after { left:21px; }
.contact, .fold { border-bottom:1px solid var(--line); }
.contact:last-child, .fold:last-child { border-bottom:none; }
.contact > summary, .fold > summary { list-style:none; cursor:pointer; display:flex; justify-content:space-between; align-items:center; gap:10px; padding:10px 0; }
.contact > summary::-webkit-details-marker, .fold > summary::-webkit-details-marker { display:none; }
.contact > summary .arrow::after, .fold > summary .arrow::after { content:"›"; color:var(--muted); font-size:18px; }
.contact[open] > summary .arrow::after, .fold[open] > summary .arrow::after { content:"⌄"; }
.cbody { padding:0 0 10px; }
.cbody .acct { font-size:13px; padding:3px 0; display:flex; justify-content:space-between; }
.cbody .acct span:last-child { color:var(--muted); }
.cbody .note { font-size:13px; color:var(--muted); font-style:italic; margin:6px 0 8px; }
.cacts { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.cacts a { flex:1; text-align:center; text-decoration:none; background:var(--tint); color:var(--text); border-radius:10px; padding:9px 4px; font-size:13px; font-weight:600; white-space:nowrap; }
.grp { font-size:12px; font-weight:700; letter-spacing:0.06em; color:var(--muted); text-transform:uppercase; margin:10px 0 0; }
.start { font-size:13px; color:var(--text2); background:var(--inset); border-radius:10px; padding:8px 10px; margin:6px 0 4px; line-height:1.4; }

/* Tab bar */
.tabbar { flex:none; display:flex; justify-content:space-around; align-items:flex-end; background:var(--card); border-top:1px solid var(--line); padding:6px 10px max(10px, env(safe-area-inset-bottom)); }
.framed .tabbar { padding-bottom:26px; }
.tb { display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10.5px; color:var(--muted); width:70px; cursor:pointer; border:none; background:none; padding:0; }
.tb.on { color:var(--text); font-weight:700; }
.ico { width:32px; height:32px; display:flex; align-items:center; justify-content:center; font-size:22px; border-radius:10px; }
.tb.on .ico { box-shadow:0 0 0 2px var(--card), 0 0 0 3.5px var(--ring); background:var(--card); }
.addico { width:26px; height:26px; border-radius:50%; background:#E63946; color:#fff; font-size:21px; font-weight:400; line-height:1; display:flex; align-items:center; justify-content:center; padding-bottom:1px; }

.toast { position:fixed; left:50%; bottom:110px; transform:translateX(-50%); max-width:86%; background:#1D2B3A; color:#fff; font-size:14px; padding:10px 14px; border-radius:12px; opacity:0; pointer-events:none; transition:opacity .2s; text-align:center; z-index:10; }
.toast.show { opacity:.95; }
/* This phone: sync status and the folded Backup / Help rows. */
.sync-ok { color:var(--green); font-weight:600; }
.fold .inner { padding:0 0 10px; }
.fold .inner .btn { margin-top:6px; }
