:root{
  --green:#0B6B4F;--green-d:#08523C;--green-l:#E2F1EA;--mint:#9FE3C8;
  --ink:#15201B;--muted:#56645D;--line:#DCE3DE;--soft:#EEF1EE;
  --bg:#F4F6F3;--card:#FFFFFF;--orange:#C25E14;--orange-l:#FBEADB;--red:#B4233C;
  --r:18px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:#E7ECE8;color:var(--ink);font-family:Manrope,system-ui,-apple-system,"Segoe UI",sans-serif}
button,input,select{font-family:inherit;color:inherit}
a{color:var(--green)}
#app{max-width:480px;margin:0 auto;min-height:100vh;min-height:100dvh;background:var(--bg);position:relative;display:flex;flex-direction:column}
#view{flex:1;padding:20px 18px calc(110px + env(safe-area-inset-bottom));outline:none}
#view.full{padding:0}
h1{margin:0;font-size:24px;font-weight:800;letter-spacing:-.3px}
h2{margin:0;font-size:15px;font-weight:800}
.row{display:flex;align-items:center;gap:12px}
.between{display:flex;align-items:center;justify-content:space-between;gap:12px}
.stack{display:flex;flex-direction:column;gap:14px}
.muted{color:var(--muted)}
.small{font-size:12px}
.card{background:var(--card);border-radius:var(--r);padding:16px}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.link{font-size:13px;font-weight:700;text-decoration:none;background:none;border:0;color:var(--green);cursor:pointer;padding:6px 0}

/* nav */
#nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:480px;height:calc(72px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);background:#fff;border-top:1px solid #E3E8E4;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:center;z-index:10}
#nav a{display:flex;flex-direction:column;align-items:center;gap:3px;font-size:11px;font-weight:600;color:var(--muted);text-decoration:none;min-height:48px;justify-content:center}
#nav a.on{color:var(--green);font-weight:800}
#nav svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#nav .fab{justify-self:center;width:56px;height:56px;border-radius:18px;background:var(--green);color:#fff;margin-top:-26px;box-shadow:0 8px 20px rgba(11,107,79,.35)}
#nav .fab svg{width:26px;height:26px;stroke-width:2.4}
body.no-nav #nav{display:none}

/* sync chip */
.chip{display:inline-flex;align-items:center;gap:6px;padding:7px 11px;border-radius:999px;font-size:12px;font-weight:700;border:0;cursor:pointer;background:var(--green-l);color:var(--green);white-space:nowrap}
.chip svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.chip.warn{background:var(--orange-l);color:#8A420C}
.chip.off{background:#E6EBE7;color:var(--muted)}
.chip.busy svg{animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* hero */
.hero{background:var(--green);color:#fff;border-radius:22px;padding:20px;display:flex;flex-direction:column;gap:14px}
.hero .big{font-size:34px;font-weight:800;letter-spacing:-.8px}
.hero .lbl{font-size:13px;color:#CBE6DB}
.hero .tag{font-size:12px;font-weight:700;padding:5px 9px;border-radius:8px;background:rgba(255,255,255,.16)}
.track{height:8px;border-radius:99px;background:rgba(255,255,255,.2);overflow:hidden}
.track>i{display:block;height:100%;border-radius:99px;background:var(--mint)}
.track.over>i{background:#FFB27A}
.stat .lbl{font-size:12px;color:var(--muted)}
.stat .val{font-size:20px;font-weight:800;margin-top:4px}
.bar{height:6px;border-radius:99px;background:var(--soft);overflow:hidden;margin-top:6px}
.bar>i{display:block;height:100%;border-radius:99px}

/* entry rows */
.list{background:#fff;border-radius:16px;overflow:hidden}
.entry{display:flex;align-items:center;gap:12px;padding:12px 14px;border:0;border-bottom:1px solid var(--soft);background:#fff;width:100%;text-align:left;cursor:pointer;min-height:64px}
.entry:last-child{border-bottom:0}
.entry .ic{width:40px;height:40px;border-radius:12px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:800}
.entry .t{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.entry .t b{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry .t span{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.entry .a{font-size:15px;font-weight:800;white-space:nowrap}
.entry .a.in{color:var(--green)}
.clip{width:13px;height:13px;vertical-align:-2px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.day{display:flex;justify-content:space-between;font-size:12px;font-weight:700;color:var(--muted);margin:4px 2px 8px}
.empty{text-align:center;padding:36px 16px;color:var(--muted);font-size:14px;line-height:1.5}

/* add */
.addtop{display:flex;align-items:center;justify-content:space-between;padding:14px 10px 0}
.iconbtn{width:44px;height:44px;border:0;background:none;border-radius:12px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--ink)}
.iconbtn svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.seg{display:flex;background:#EEF2EF;border-radius:12px;padding:4px}
.seg button{border:0;background:none;padding:9px 18px;border-radius:9px;font-size:13px;font-weight:700;color:var(--muted);cursor:pointer;min-height:36px}
.seg button.on{background:#fff;color:var(--ink);font-weight:800;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.seg.wide{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));background:#E6EBE7}
.amount{text-align:center;padding:12px 18px 6px}
.amount .lbl{font-size:13px;color:var(--muted)}
.amount .v{font-size:44px;font-weight:800;letter-spacing:-1px;word-break:break-all}
.amount .v.in{color:var(--green)}
.addbody{padding:0 18px;display:flex;flex-direction:column;gap:14px}
.fl{font-size:13px;font-weight:700;color:#3E4B45;margin-bottom:8px}
.pills{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.pill{min-height:44px;border-radius:12px;border:1px solid var(--line);background:#fff;font-size:12px;font-weight:700;color:#3E4B45;cursor:pointer;padding:4px;line-height:1.2}
.pill.on{border:2px solid var(--green);background:var(--green-l);color:var(--green)}
.fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.input{height:46px;border-radius:12px;border:1px solid var(--line);background:#fff;padding:0 12px;font-size:14px;font-weight:600;width:100%;outline:none}
.input:focus{border-color:var(--green);box-shadow:0 0 0 3px rgba(11,107,79,.15)}
.photo{display:flex;align-items:center;gap:10px}
.photo img{width:56px;height:56px;object-fit:cover;border-radius:10px;border:1px solid var(--line);cursor:pointer}
.btn{min-height:46px;border-radius:13px;border:1px solid var(--line);background:#fff;font-size:14px;font-weight:700;cursor:pointer;padding:0 14px;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;color:var(--ink)}
.btn svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.btn.primary{background:var(--green);color:#fff;border:0;font-weight:800}
.btn.primary:active{background:var(--green-d)}
.btn.danger{color:var(--red);border-color:#F0CDD3}
.btn.block{width:100%}
.btn:disabled{opacity:.55;cursor:default}
.keypad{background:var(--bg);padding:12px 12px calc(16px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:10px;margin-top:16px}
.keys{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.keys button{height:52px;border:0;border-radius:12px;background:#fff;font-size:22px;font-weight:700;cursor:pointer}
.keys button:active{background:var(--soft)}

/* history */
.search{display:flex;align-items:center;gap:10px;height:48px;padding:0 14px;border-radius:14px;background:#fff;border:1px solid var(--line)}
.search input{border:0;outline:0;flex:1;font-size:14px;background:transparent;min-width:0}
.search svg{width:18px;height:18px;fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round}
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
.chips button{flex-shrink:0;min-height:36px;padding:0 16px;border-radius:999px;font-size:13px;font-weight:700;border:1px solid var(--line);background:#fff;color:#3E4B45;cursor:pointer}
.chips button.on{border-color:var(--ink);background:var(--ink);color:#fff}
.monthnav{display:flex;align-items:center;gap:4px}
.monthnav b{font-size:13px;min-width:78px;text-align:center}
.sum3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;text-align:center}
.sum3 .card{padding:10px 6px}
.sum3 .lbl{font-size:11px;color:var(--muted)}
.sum3 .val{font-size:15px;font-weight:800;margin-top:2px}

/* reports */
.chart{height:160px;display:grid;gap:8px;align-items:end}
.col{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px;height:160px}
.col i{display:block;width:100%;border-radius:8px 8px 4px 4px;background:#B9DCCD;min-height:3px}
.col.cur i{background:var(--green)}
.col span{font-size:11px;font-weight:600;color:var(--muted);white-space:nowrap}
.stackbar{display:flex;height:14px;border-radius:99px;overflow:hidden;gap:2px;background:var(--soft)}
.legend{display:flex;align-items:center;gap:10px;font-size:13px}
.legend .dot{width:10px;height:10px;border-radius:3px;flex-shrink:0}
.legend .n{flex:1;font-weight:600}
.legend .p{color:var(--muted);width:42px;text-align:right}
.legend .m{font-weight:800;min-width:76px;text-align:right}

/* settings */
.set{background:#fff;border-radius:var(--r);overflow:hidden}
.set .it{display:flex;align-items:center;gap:12px;padding:13px 16px;border-bottom:1px solid var(--soft);min-height:56px}
.set .it:last-child{border-bottom:0}
.set .it .t{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
.set .it .t b{font-size:14px}
.set .it .t span{font-size:12px;color:var(--muted)}
.switch{width:50px;height:30px;flex-shrink:0;border:0;border-radius:99px;padding:3px;cursor:pointer;background:#C9D2CC;display:flex;justify-content:flex-start;transition:background .15s}
.switch::after{content:"";width:24px;height:24px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2)}
.switch[aria-checked="true"]{background:var(--green);justify-content:flex-end}
.status{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:12px;font-size:13px;font-weight:700;background:var(--green-l);color:var(--green)}
.status.warn{background:var(--orange-l);color:#8A420C}
.status.off{background:#EEF1EE;color:var(--muted)}
.drivei{width:44px;height:44px;border-radius:13px;background:#E8F0FE;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.catrow{display:flex;align-items:center;gap:10px;padding:10px 16px;border-bottom:1px solid var(--soft)}
.catrow .dot{flex:0 0 12px;width:12px;height:12px;border-radius:4px}
.catrow .cn{flex:1;font-size:14px;font-weight:600}
.catrow .use{flex:0 0 auto;font-size:12px;color:var(--muted);padding:0 12px}

/* welcome */
.welcome{min-height:100vh;min-height:100dvh;background:var(--green);color:#fff;display:flex;flex-direction:column;padding:48px 26px calc(32px + env(safe-area-inset-bottom));position:relative;overflow:hidden}
.welcome .ring{position:absolute;border-radius:50%;border:1px solid rgba(255,255,255,.14)}
.welcome .logo{width:40px;height:40px;border-radius:12px;background:#fff;display:flex;align-items:center;justify-content:center}
.welcome h1{font-size:36px;line-height:1.12;letter-spacing:-.8px}
.welcome p{font-size:16px;line-height:1.55;color:#D6EDE4;margin:0}
.welcome li{display:flex;gap:12px;align-items:center;font-size:14px;color:#EAF6F1}
.welcome ul{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:12px}
.gbtn{height:56px;border-radius:16px;background:#fff;color:#1F2A26;font-size:16px;font-weight:700;border:0;display:flex;align-items:center;justify-content:center;gap:12px;cursor:pointer;width:100%}
.ghost{height:48px;border-radius:14px;background:transparent;color:#fff;border:1px solid rgba(255,255,255,.4);font-size:15px;font-weight:700;cursor:pointer;width:100%}

/* toast + sheet */
#toast{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom));transform:translateX(-50%) translateY(20px);background:var(--ink);color:#fff;padding:12px 16px;border-radius:12px;font-size:14px;font-weight:600;opacity:0;pointer-events:none;transition:.2s;max-width:min(440px,90vw);z-index:50;text-align:center}
#toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
#sheet{position:fixed;inset:0;background:rgba(10,20,15,.55);z-index:40;display:flex;align-items:flex-end;justify-content:center}
#sheet[hidden]{display:none}
#sheet .panel{background:#fff;width:100%;max-width:480px;border-radius:22px 22px 0 0;padding:18px 18px calc(22px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:14px;max-height:90vh;overflow:auto}
#sheet img{max-width:100%;border-radius:12px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@media (min-width:520px){#app{box-shadow:0 0 0 1px #DDE3DF}}

/* accounts */
.acctscroll{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;margin:0 -4px;padding:0 4px 2px}
.acard{flex:0 0 auto;min-width:120px;display:flex;flex-direction:column;gap:4px;padding:10px 12px;border-radius:12px;background:#F7F9F7;text-decoration:none;color:var(--ink)}
.acard b{font-size:15px;white-space:nowrap}
.pill:disabled{opacity:.35;cursor:default}
select.input{appearance:none;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2356645D' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;padding-right:34px}
.seg button{padding:9px 14px}
