:root{font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#1b2b3c;background:#f5f7fa}*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button{cursor:pointer}h1{font-size:clamp(2rem,4vw,2.9rem);line-height:1.08;letter-spacing:-.05em;margin:12px 0}h2{font-size:1.2rem;letter-spacing:-.025em;margin:0 0 15px}p{line-height:1.55}header{background:#15283a;color:white;padding:15px max(20px,calc((100vw - 1060px)/2));display:flex;justify-content:space-between;align-items:center;min-height:75px}.brand{font-size:1.5rem;font-weight:850;display:flex;gap:8px;align-items:center;letter-spacing:-.04em}.logo{background:#c9ee8c;color:#15283a;border-radius:12px;width:38px;height:38px;display:grid;place-items:center}.accent{color:#c9ee8c}main{max-width:1060px;margin:auto;padding:35px 20px 100px}.hero{background:#1b3448;color:#fff;padding:42px;border-radius:25px;margin-bottom:28px}.hero p{color:#c8d3dd;max-width:540px}.tag{color:#bfe589;letter-spacing:.13em;text-transform:uppercase;font-size:.75rem;font-weight:800}.btn{border:0;border-radius:12px;background:#c9ee8c;color:#162638;padding:12px 18px;font-weight:760;display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.btn.dark{background:#1d3448;color:white}.light,.btn.light{background:white;border:1px solid #dfe6ec;color:#33495e;border-radius:12px;padding:10px 14px;font-weight:720}.danger{color:#af3e33;background:#fff2ef;border:0;border-radius:10px;padding:9px}.row{display:flex;justify-content:space-between;align-items:center;gap:12px}.wrap{display:flex;flex-wrap:wrap;gap:9px}.panel{background:#fff;border:1px solid #e8edf0;border-radius:19px;padding:23px;margin-bottom:18px;box-shadow:0 6px 25px #13263a06}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.stat{padding:21px;border-radius:18px;background:white;border:1px solid #e5ecf2}.stat small,.muted{color:#7d8b98}.stat strong{font-size:1.8rem;letter-spacing:-.04em;display:block;margin:7px 0}.group{color:inherit;text-decoration:none}.group:hover{border-color:#b9da91}.group strong{display:block;font-size:1.1rem;margin:10px 0}.pill{display:inline-flex;border-radius:100px;padding:5px 10px;background:#edf7de;color:#4f7137;font-size:.78rem;font-weight:750}.chips{display:flex;gap:7px;flex-wrap:wrap;margin-top:12px}.chip{padding:7px 10px;border-radius:20px;background:#e8eef3;color:#52697d;font-size:.82rem}.tabs{display:flex;gap:8px;overflow-x:auto;margin:25px 0}.tab{border:1px solid #e2e8ee;border-radius:11px;padding:11px 16px;background:#fff;color:#5a6e7c;font-weight:750;white-space:nowrap}.tab.active{background:#1b3448;color:white;border-color:#1b3448}.item{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid #edf1f4}.item:last-child{border-bottom:0}.avatar{flex:0 0 42px;height:42px;border-radius:13px;background:#e9f4d8;color:#4d7136;display:grid;place-items:center;font-weight:850;text-transform:uppercase}.itemtext{flex:1;min-width:0}.itemtext strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.itemtext small{color:#8897a4;display:block;margin-top:4px}.amount{text-align:right;font-weight:800;white-space:nowrap}.plus{color:#31805a}.minus{color:#bc5449}.link{border:0;background:transparent;color:#4c7456;font-weight:750;padding:5px}.empty{text-align:center;color:#8b9aa6;padding:32px}.empty strong{display:block;color:#273d50;margin-bottom:8px}.info{background:#f1f8e9;color:#416136;padding:15px;border-radius:13px}.formgrid{display:grid;grid-template-columns:1fr 1fr;gap:15px}.field{display:flex;flex-direction:column;gap:7px}.field label{font-size:.85rem;font-weight:760;color:#4d5e6f}.field input,.field select,.field textarea{min-width:0;width:100%;border:1px solid #d8e1e9;border-radius:11px;padding:12px;background:white;outline:none;color:#243b50}.field input:focus,.field select:focus,.field textarea:focus{border-color:#8fb96c;box-shadow:0 0 0 3px #98cb7930}.wide{grid-column:span 2}.checks{display:flex;gap:7px;flex-wrap:wrap}.check{padding:9px 10px;background:#f1f5f7;border-radius:10px;border:1px solid #dce5eb;cursor:pointer}.check:has(input:checked){background:#e8f7d8;border-color:#b5df8b}.check input{accent-color:#588643}.hint{font-size:.85rem;color:#80919e;margin:6px 0}.allocation{display:grid;grid-template-columns:1fr 130px;gap:10px;align-items:center;margin:8px 0}.small{font-size:.86rem}dialog{border:0;border-radius:20px;padding:25px;width:min(540px,calc(100vw - 28px));max-height:88vh;overflow:auto;box-shadow:0 22px 90px #0e233f50}dialog::backdrop{background:#132438a6}.modalhead{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.modalhead h2{margin:0}.modalfoot{display:flex;justify-content:flex-end;gap:9px;margin-top:22px}#toast{position:fixed;bottom:25px;left:50%;transform:translate(-50%,30px);opacity:0;pointer-events:none;background:#142d40;color:white;border-radius:12px;padding:13px 20px;box-shadow:0 10px 30px #0003;transition:.2s;z-index:10}#toast.show{opacity:1;transform:translate(-50%,0)}.spaced{margin-bottom:26px}@media(max-width:700px){header{padding:14px 18px}main{padding:22px 14px 100px}.hero{padding:27px 24px}.grid{grid-template-columns:1fr}.stat{padding:17px}.panel{padding:18px}.formgrid{grid-template-columns:1fr}.wide{grid-column:auto}.titlebar{align-items:flex-start;flex-direction:column}.titlebar>.wrap{width:100%}.titlebar>.wrap>*{flex:1}.allocation{grid-template-columns:1fr 110px}.amount{font-size:.9rem}.item{gap:9px}}
/* Touch-first expense entry */
dialog{padding:0;overflow:hidden}
dialog .modalhead{padding:18px 22px;margin:0;border-bottom:1px solid #e5ecf2}
dialog form{display:flex;flex-direction:column;min-height:0;max-height:calc(88vh - 75px)}
.modalbody{overflow:auto;overscroll-behavior:contain;padding:22px;min-height:0}
.modalfoot{margin:0;padding:14px 22px;border-top:1px solid #e5ecf2;background:#fff;flex-shrink:0}
.form-error{color:#a42d26;background:#fff1ef;padding:12px;border-radius:10px}
.expense-amount{order:-1}
.expense-amount input{font-size:2rem;font-weight:750;font-variant-numeric:tabular-nums;padding:14px}
.expense-details{border:1px solid #dce5eb;border-radius:12px;padding:0 12px}
.expense-details summary{cursor:pointer;padding:14px 0;font-weight:650;color:#40566a}
.expense-details .formgrid{padding-bottom:14px}
.expense-preview{margin:0;color:#365b3d;background:#edf7de;padding:12px;border-radius:10px;font-weight:650}
.allocation input{width:100%;min-width:0;border:1px solid #d8e1e9;border-radius:10px;padding:12px;font:inherit}
button:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid #608c45;outline-offset:3px}
button:disabled{opacity:.55;cursor:wait}
@media(max-width:700px){
header{padding-top:max(14px,env(safe-area-inset-top))}
main{padding-bottom:calc(150px + env(safe-area-inset-bottom))}
.titlebar{gap:14px;margin-bottom:16px}
.titlebar h1{font-size:1.9rem;overflow-wrap:anywhere}
.titlebar>.wrap{width:auto}
.titlebar>.wrap>#addExpense{position:fixed;bottom:calc(76px + env(safe-area-inset-bottom));right:16px;z-index:4;min-height:52px;padding:0 22px;box-shadow:0 5px 18px #15283a30}
.titlebar+.grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:8px}
.titlebar+.grid .stat:first-child{grid-column:span 2}
.titlebar+.grid .stat{padding:12px 14px}
.titlebar+.grid .stat strong{font-size:1.35rem}
.tabs{position:fixed;bottom:0;left:0;right:0;z-index:5;margin:0;padding:7px 8px calc(7px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #dce5eb;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;overflow:visible}
.tab{font-size:.72rem;white-space:normal;line-height:1.2;padding:6px 3px;min-height:48px;border:0;border-radius:9px}
button,.btn,.light,.link,.check{min-height:44px}
.field input,.field select,.field textarea,.allocation input{font-size:16px;min-height:48px}
.expense-amount input{font-size:32px}
.check{display:flex;align-items:center;gap:8px;overflow-wrap:anywhere;min-width:0}
.check input{width:19px;height:19px;flex-shrink:0}
.checks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
dialog{width:100%;max-width:none;max-height:92dvh;margin:auto 0 0;border-radius:20px 20px 0 0}
dialog form{max-height:calc(92dvh - 76px)}
dialog .modalhead{padding:12px 16px}
.modalbody{padding:16px}
.modalfoot{padding:12px 16px max(12px,env(safe-area-inset-bottom))}
.modalfoot .btn{flex:1;min-height:50px}
.expense-dialog{height:100dvh;max-height:100dvh;margin:0;border-radius:0}
.expense-dialog .modalhead{padding-top:max(12px,env(safe-area-inset-top))}
.expense-dialog form{height:calc(100dvh - 70px - env(safe-area-inset-top));max-height:none}
.expense-dialog .modalbody{flex:1}
.expense-dialog .formgrid{gap:16px}
.expense-dialog .expense-details .formgrid{grid-template-columns:1fr}
#toast{bottom:calc(145px + env(safe-area-inset-bottom));max-width:calc(100vw - 32px);width:max-content}
}
@media(max-width:360px){.checks{grid-template-columns:1fr}.tab{font-size:.68rem}}
