:root{
  --green:#1F8A5B; --green-dark:#17704A; --green-soft:#E7F5EE; --green-line:#CDEBDB;
  --navy:#13294B; --text:#1B2433; --muted:#5E6A7A; --line:#E7EBF0;
  --bg:#F5F8FA; --card:#FFFFFF; --red:#D93A3F; --red-soft:#FDECEC; --amber:#E8961E; --blue:#2F6FED;
  --radius:18px; --shell:460px;
  --safe-top:env(safe-area-inset-top,0px); --safe-bottom:env(safe-area-inset-bottom,0px);
  --tabbar:64px;
}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Inter,Helvetica,Arial,sans-serif;
  color:var(--text);background:#DCE6EC;-webkit-font-smoothing:antialiased;overscroll-behavior:none}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none}
:focus-visible{outline:3px solid rgba(47,111,237,.55);outline-offset:2px}
.noscript{padding:24px;text-align:center}

/* ---------- shell ---------- */
.shell{position:relative;height:100%;height:100dvh;max-width:var(--shell);margin:0 auto;background:var(--bg);overflow:hidden;display:flex;flex-direction:column}
@media (min-width:600px){
  body{display:flex;align-items:center;justify-content:center;background:radial-gradient(1200px 700px at 20% 10%,#E6F4EC 0%,#DCE6EC 55%,#CDD8E3 100%)}
  .shell{height:min(900px,calc(100dvh - 48px));border-radius:36px;box-shadow:0 30px 70px rgba(19,41,75,.25),0 0 0 1px rgba(19,41,75,.06)}
}
.topbar{flex:none;padding:calc(14px + var(--safe-top)) 20px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--bg);z-index:5}
.topbar.hidden{display:none}
.content{flex:1;overflow-y:auto;overflow-x:hidden;padding:4px 20px calc(var(--tabbar) + var(--safe-bottom) + 28px);scrollbar-width:none;-webkit-overflow-scrolling:touch}
.content::-webkit-scrollbar{display:none}
.content.no-tabs{padding-bottom:calc(28px + var(--safe-bottom))}

/* ---------- tab bar ---------- */
.tabbar{position:absolute;left:0;right:0;bottom:0;height:calc(var(--tabbar) + var(--safe-bottom));padding-bottom:var(--safe-bottom);
  background:rgba(255,255,255,.96);backdrop-filter:blur(10px);border-top:1px solid var(--line);display:flex;justify-content:space-around;align-items:center;z-index:20}
.tabbar[hidden]{display:none}
.tab{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:11px;font-weight:600;color:#7A8594;min-width:72px;min-height:48px;justify-content:center;border-radius:12px}
.tab svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tab[aria-current="page"]{color:var(--green)}

/* ---------- type & common ---------- */
.brand{font-size:28px;font-weight:800;color:var(--green-dark);letter-spacing:-.5px}
.title{font-size:26px;font-weight:800;color:var(--navy);letter-spacing:-.4px;line-height:1.15}
.sub{color:var(--muted);font-size:13px;margin-top:2px}
.iconbtn{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;color:var(--navy);background:#fff;border:1px solid var(--line);flex:none}
.iconbtn svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.card{background:var(--card);border-radius:var(--radius);padding:16px;border:1px solid var(--line);box-shadow:0 1px 2px rgba(19,41,75,.04)}
.section{display:flex;justify-content:space-between;align-items:baseline;margin:22px 0 10px}
.section h2{font-size:17px;color:var(--navy)}
.link{color:var(--blue);font-size:14px;font-weight:600;padding:6px 0}
.bar{height:8px;border-radius:6px;background:#E6EBF0;overflow:hidden}
.bar>i{display:block;height:100%;border-radius:6px;transition:width .5s ease}
.btn{border-radius:14px;padding:14px 16px;font-size:16px;font-weight:700;width:100%;min-height:50px}
.btn.primary{background:var(--green);color:#fff}
.btn.primary:active{background:var(--green-dark)}
.btn.ghost{background:var(--green-soft);color:var(--green-dark)}
.btn.danger{background:var(--red-soft);color:var(--red)}
.btn.plain{background:#EEF1F5;color:var(--muted)}
.btn.sm{padding:9px 14px;font-size:14px;width:auto;min-height:40px;border-radius:12px}
.btn:disabled{opacity:.5;cursor:default}
.row{display:flex;align-items:center;gap:12px}
.grow{flex:1;min-width:0}
.muted{color:var(--muted)}
.ellip{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.small{font-size:13px;color:var(--muted)}
.name{font-weight:700;font-size:15px}
.empty{text-align:center;color:var(--muted);padding:26px 8px;font-size:14px;line-height:1.5}
.fade{animation:fade .25s ease}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

/* ---------- hero ---------- */
.hero{display:block;width:100%;text-align:left;background:linear-gradient(135deg,#2BA36D,#1A7A50);color:#fff;border-radius:22px;padding:18px;box-shadow:0 10px 24px rgba(31,138,91,.25)}
.hero.warn{background:linear-gradient(135deg,#E8961E,#B86E06)}
.hero.over{background:linear-gradient(135deg,#E0484D,#B3262B)}
.hero .top{display:flex;justify-content:space-between;align-items:center;font-size:15px}
.hero .top svg{width:26px;height:26px;fill:none;stroke:#fff;stroke-width:2;stroke-linejoin:round}
.hero .amt{font-size:36px;font-weight:800;margin:6px 0 2px;letter-spacing:-.5px}
.hero .amt small{font-size:16px;font-weight:600;opacity:.9}
.hero .bar{background:rgba(255,255,255,.3);margin:12px 0 10px}
.hero .bar>i{background:#fff}
.hero .foot{display:flex;justify-content:space-between;gap:8px;font-size:13px}
.quick{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:18px;text-align:center}
.quick button{font-size:12px;font-weight:600;color:var(--navy);display:flex;flex-direction:column;align-items:center;gap:6px;padding:2px 0}
.quick .qi{width:56px;height:56px;border-radius:50%;display:grid;place-items:center;background:#E8F0FD;color:var(--blue)}
.quick .qi svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.quick button:first-child .qi{background:var(--green);color:#fff}
.stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px}
.stat{text-align:left;width:100%}
.stat .lbl{font-size:12px;color:var(--muted);font-weight:600}
.stat .val{font-size:22px;font-weight:800;color:var(--navy);margin-top:2px}

/* ---------- lists ---------- */
.list{padding:4px 16px}
.item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--line);width:100%;text-align:left}
.item:last-child{border-bottom:0}
.logo{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:800;font-size:16px;flex:none}
.emoji{width:42px;height:42px;border-radius:12px;display:grid;place-items:center;font-size:20px;flex:none}
.amt-neg{font-weight:700;white-space:nowrap}
.chev{color:#A3ABB7;flex:none}
.chev svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;display:block}
.daylabel{font-size:12px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.6px;margin:14px 0 2px}

/* ---------- budget ---------- */
.weeknav{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
.weeknav .wk{font-weight:700;color:var(--navy);font-size:15px;text-align:center}
.summary{display:flex;justify-content:space-between;text-align:center}
.summary .big{font-size:20px;font-weight:800}
.catrow{padding:12px 0;border-bottom:1px solid var(--line)}
.catrow:last-child{border-bottom:0}
.catrow .top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;font-size:15px;gap:8px}
.over{color:var(--red);font-weight:700}
.fab{position:absolute;right:20px;bottom:calc(var(--tabbar) + var(--safe-bottom) + 18px);width:58px;height:58px;border-radius:50%;background:var(--green);color:#fff;
  display:grid;place-items:center;box-shadow:0 8px 20px rgba(31,138,91,.4);z-index:15}
.fab svg{width:28px;height:28px;fill:none;stroke:#fff;stroke-width:2.6;stroke-linecap:round}
.fab[hidden]{display:none}

/* ---------- deals ---------- */
.search{display:flex;align-items:center;gap:8px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:0 14px;color:var(--muted);min-height:48px}
.search svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;flex:none}
.search input{border:0;outline:0;font-size:16px;flex:1;background:transparent;min-width:0;padding:12px 0}
.chips{display:flex;gap:8px;overflow-x:auto;margin:12px -20px 4px;padding:0 20px 2px;scrollbar-width:none}
.chips::-webkit-scrollbar{display:none}
.chip{padding:8px 14px;border-radius:20px;background:#fff;border:1px solid var(--line);font-size:14px;font-weight:600;white-space:nowrap;color:var(--navy);min-height:38px}
.chip[aria-pressed="true"]{background:var(--navy);color:#fff;border-color:var(--navy)}
.deal{display:flex;gap:12px;align-items:center;margin-bottom:10px;width:100%;text-align:left}
.tag{display:inline-block;font-size:11px;font-weight:700;padding:3px 8px;border-radius:8px;background:var(--green-soft);color:var(--green-dark)}
.tag.gray{background:#EEF1F5;color:var(--muted)}
.meta{margin-top:6px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.pin{display:inline-flex;gap:3px;align-items:center;font-size:12px;color:var(--muted)}
.pin svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2.4}
.code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:26px;font-weight:800;letter-spacing:2px;text-align:center;padding:16px;border:2px dashed var(--green);border-radius:14px;color:var(--green-dark);background:var(--green-soft);margin:14px 0;user-select:all}
.banner{background:var(--green-soft);border:1px solid var(--green-line);display:flex;justify-content:space-between;align-items:center}
.pilot{font-size:12px;color:var(--muted);margin-top:10px;line-height:1.4}

/* ---------- goals ---------- */
.goal{margin-bottom:12px}
.goal .pct{font-size:13px;font-weight:700;color:var(--green-dark)}
.done-badge{font-size:11px;font-weight:800;color:#fff;background:var(--green);padding:3px 8px;border-radius:8px}

/* ---------- sheet ---------- */
.backdrop{position:absolute;inset:0;background:rgba(10,20,35,.4);opacity:0;transition:opacity .25s;z-index:70}
.backdrop.show{opacity:1}
.sheet{position:absolute;left:0;right:0;bottom:0;background:#fff;border-radius:26px 26px 0 0;padding:10px 20px calc(24px + var(--safe-bottom));z-index:80;
  transform:translateY(105%);transition:transform .3s cubic-bezier(.2,.9,.3,1);max-height:90%;overflow-y:auto}
.sheet.show{transform:none}
.grab{width:40px;height:5px;border-radius:3px;background:#D6DBE1;margin:0 auto 14px}
.sheet h2{font-size:21px;color:var(--navy);margin-bottom:4px}
.field{margin-top:14px}
.field label,.field .lbl{display:block;font-size:13px;font-weight:700;color:var(--muted);margin-bottom:6px}
.field input,.field select{width:100%;border:1px solid #D5DBE2;border-radius:12px;padding:12px 14px;font-size:16px;outline:0;background:#fff;min-height:48px}
.field input:focus,.field select:focus{border-color:var(--green);box-shadow:0 0 0 3px rgba(31,138,91,.15)}
.bigamt{display:flex;align-items:center;justify-content:center;font-size:44px;font-weight:800;color:var(--navy);margin:8px 0}
.bigamt input{border:0;outline:0;font-size:44px;font-weight:800;color:var(--navy);width:200px;text-align:left;background:transparent}
.catpick{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}
.cp{border:1.5px solid var(--line);border-radius:14px;padding:10px 0;text-align:center;font-size:11px;font-weight:700;color:var(--navy);background:#fff}
.cp span{display:block;font-size:22px;margin-bottom:3px}
.cp[aria-pressed="true"]{border-color:var(--green);background:var(--green-soft)}
.planrow{display:flex;align-items:center;gap:10px;padding:6px 0}
.planrow input{width:100px;border:1px solid #D5DBE2;border-radius:10px;padding:10px;font-size:16px;text-align:right;outline:0;min-height:44px}
.planrow input:focus{border-color:var(--green)}
.amtchips{display:flex;gap:8px;margin-top:10px}
.amtchips .chip{flex:1;text-align:center}
.btnrow{display:flex;gap:10px;margin-top:18px}
.btnrow .btn{flex:1}
.err{color:var(--red);font-size:13px;font-weight:600;margin-top:8px;min-height:1px}

/* ---------- toast ---------- */
.toast{position:absolute;top:calc(12px + var(--safe-top));left:16px;right:16px;background:var(--navy);color:#fff;border-radius:16px;padding:12px 14px;font-size:14px;font-weight:600;
  z-index:90;transform:translateY(-160%);opacity:0;visibility:hidden;transition:transform .35s cubic-bezier(.2,.9,.3,1),opacity .25s,visibility 0s .35s;box-shadow:0 12px 28px rgba(0,0,0,.25);display:flex;gap:10px;align-items:center}
.toast.show{transform:none;opacity:1;visibility:visible;transition:transform .35s cubic-bezier(.2,.9,.3,1),opacity .25s,visibility 0s}
.toast.warn{background:#9A5B00}.toast.bad{background:var(--red)}.toast.good{background:var(--green-dark)}
.toast .msg{flex:1}
.toast button{color:#fff;font-weight:800;text-decoration:underline;padding:6px 4px}

/* ---------- onboarding ---------- */
.onb{min-height:100%;display:flex;flex-direction:column;padding-top:calc(24px + var(--safe-top))}
.onb .logo-big{width:76px;height:76px;border-radius:22px;background:linear-gradient(135deg,#2BA36D,#17704A);display:grid;place-items:center;box-shadow:0 10px 24px rgba(31,138,91,.3)}
.onb .logo-big svg{width:40px;height:40px;fill:none;stroke:#fff;stroke-width:2;stroke-linejoin:round}
.onb h1{font-size:34px;font-weight:800;color:var(--navy);letter-spacing:-.6px;margin-top:22px;line-height:1.1}
.onb p.lead{font-size:17px;color:var(--muted);margin-top:10px;line-height:1.45}
.features{margin-top:26px;display:grid;gap:12px}
.feature{display:flex;gap:14px;align-items:flex-start}
.feature .num{width:34px;height:34px;border-radius:50%;background:var(--green-soft);color:var(--green-dark);font-weight:800;display:grid;place-items:center;flex:none}
.feature b{display:block;color:var(--navy)}
.feature span{font-size:14px;color:var(--muted)}
.steps{display:flex;gap:6px;margin-bottom:22px}
.steps i{height:6px;flex:1;border-radius:4px;background:#DCE3EA}
.steps i.on{background:var(--green)}
.spacer{flex:1;min-height:24px}
