:root {--bg:#f5f6f3;--white:#fff;--ink:#19382f;--muted:#71847a;--line:#e3eae3;--green:#167d5c;--green2:#dff4e8;--yellow:#fff2cd;--red:#b64248;--shadow:0 12px 44px rgba(19,49,38,.07);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Arial,sans-serif}
    *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);-webkit-font-smoothing:antialiased}button,input,select{font:inherit}button{cursor:pointer}input,select{outline-color:#6ebd91}button:disabled{opacity:.45;cursor:not-allowed}a{color:var(--green)}
    .site-header{max-width:1180px;margin:auto;padding:25px 24px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px}.brand{display:flex;align-items:center;gap:10px;font-size:20px;font-weight:850;letter-spacing:-.8px}.brand-icon{background:#1b6d53;color:white;width:39px;height:39px;border-radius:13px;display:grid;place-items:center;font-size:20px}.top-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.status{border-radius:100px;background:#e7ece6;color:#577165;font-size:12px;font-weight:750;padding:9px 12px;white-space:nowrap}.status.online{background:#def4e7;color:#24724b}.status.saving{background:#fff1cc;color:#86661b}
    .btn{background:var(--green);border:1px solid var(--green);color:#fff;padding:12px 16px;border-radius:13px;font-weight:750;display:inline-flex;align-items:center;justify-content:center;gap:8px;line-height:1.2;transition:transform .12s ease,background .12s ease;text-decoration:none;white-space:nowrap}.btn:hover:not(:disabled){transform:translateY(-1px);background:#126d50}.btn.secondary{background:#fff;color:var(--ink);border-color:#dae5dc}.btn.secondary:hover:not(:disabled){background:#f7faf6}.btn.danger{background:#fff;color:var(--red);border-color:#f1dadb}.btn.tiny{padding:8px 11px;border-radius:10px;font-size:12px}.btn.muted{background:#edf4ed;border:1px solid #edf4ed;color:#2f6750}.icon-btn{background:transparent;border:none;color:#658076;font-size:19px;padding:5px 8px;border-radius:7px}.icon-btn:hover{background:#edf3ec}
    .container{max-width:1180px;margin:0 auto;padding:0 24px 60px}.hero{position:relative;overflow:hidden;background:linear-gradient(112deg,#174c3d,#244638);border-radius:25px;padding:35px 36px 30px;color:white;box-shadow:var(--shadow)}.hero:before,.hero:after{content:"";position:absolute;border-radius:50%;border:1px solid rgba(255,255,255,.11);pointer-events:none}.hero:before{width:370px;height:370px;right:-65px;top:-180px}.hero:after{width:280px;height:280px;right:80px;bottom:-220px}.eyebrow{color:#badaca;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:2px}.title-input{position:relative;z-index:1;max-width:100%;width:630px;background:transparent;border:1px solid transparent;border-radius:10px;color:#fff;font-size:clamp(30px,4.2vw,46px);font-weight:850;letter-spacing:-1.6px;margin:10px 0 1px;padding:1px 7px 1px 0}.title-input:hover,.title-input:focus{border-color:#749b86;padding-left:7px}.hero-subtitle{color:#c4dcd0;margin:4px 0 25px;font-size:14px}.hero-tools{position:relative;z-index:1;display:flex;gap:9px;flex-wrap:wrap}.hero-tools .btn{background:#fff;color:#185b43;border-color:#fff}.hero-tools .btn.secondary{background:#2c604e;color:#f5fff8;border-color:#477562}.hero-tools .btn:hover{background:#ecf7ef}
    .stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-top:19px}.stat{background:var(--white);border-radius:17px;padding:21px 23px;box-shadow:var(--shadow)}.stat-label{font-size:13px;color:var(--muted);font-weight:650}.stat-num{font-size:29px;letter-spacing:-1px;font-weight:850;margin-top:5px}.stat-foot{font-size:12px;color:#84978c;margin-top:3px}.layout{display:grid;grid-template-columns:305px minmax(0,1fr);gap:20px;margin-top:20px}.panel{background:var(--white);border:1px solid #ebefea;border-radius:20px;box-shadow:var(--shadow);overflow:hidden}.sidebar{align-self:start}.panel-head{display:flex;justify-content:space-between;align-items:center;padding:23px 23px 15px;gap:12px}.panel-head h2{margin:0;font-size:17px;letter-spacing:-.4px}.panel-body{padding:0 21px 22px}.small{color:var(--muted);font-size:13px;line-height:1.55}.person{display:flex;gap:10px;align-items:center;padding:12px 0;border-top:1px solid #eff2ed}.person:first-child{border-top:none}.avatar{background:#e5efe7;color:#2c7753;border-radius:12px;width:38px;height:38px;display:grid;place-items:center;font-weight:850;flex:none}.person-main{flex:1;min-width:0}.person-name{font-weight:750;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.person-sub{font-size:12px;color:var(--muted)}.side-note{margin:3px 20px 20px;background:#f0f7f1;border-radius:13px;padding:12px 13px;color:#5c7d69;font-size:12px;line-height:1.5}
    .tabs{display:flex;gap:4px;padding:16px 19px 0;border-bottom:1px solid #ecf0eb}.tab{background:transparent;border:0;padding:13px 15px 15px;font-weight:750;font-size:14px;color:#7b9184;border-bottom:3px solid transparent}.tab.active{color:var(--green);border-color:var(--green)}.content{padding:24px 26px 30px;min-height:390px}.section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:15px}.section-head h3{font-size:18px;margin:0;letter-spacing:-.4px}.expense{display:flex;gap:15px;align-items:center;padding:18px 0;border-bottom:1px solid #edf1eb;width:100%;background:none;text-align:left;border-left:0;border-right:0;border-top:0;color:inherit}.expense:last-child{border-bottom:0}.expense:hover .exp-title{color:var(--green)}.exp-emoji{width:46px;height:46px;border-radius:14px;display:grid;place-items:center;background:#eef5ef;font-size:23px;flex:none}.exp-main{flex:1;min-width:0}.exp-title{font-weight:800;line-height:1.3;overflow-wrap:anywhere}.exp-sub{font-size:12px;color:var(--muted);margin-top:5px;line-height:1.5}.exp-amount{font-size:18px;font-weight:850;white-space:nowrap}.muted-cap{color:#91a096;font-size:11px;text-align:right;margin-top:4px}.balance-item{display:flex;gap:13px;align-items:center;padding:14px 0;border-bottom:1px solid #edf1eb}.balance-item:last-child{border:none}.balance-value{font-weight:850;white-space:nowrap;margin-left:auto}.positive{color:#16805a}.negative{color:#c05b51}.neutral{color:#788d7b}.settle{display:flex;align-items:center;gap:12px;background:#f8fbf8;border:1px solid #ebf0ea;padding:15px;border-radius:13px;margin:9px 0;flex-wrap:wrap}.settle-text{flex:1;min-width:160px;font-size:14px}.settle-amount{font-weight:850}.mini-head{margin:29px 0 11px;font-weight:850;letter-spacing:-.2px}.empty{text-align:center;padding:55px 15px}.empty-art{font-size:45px;margin-bottom:12px}.empty h3{font-size:20px;margin:0 0 9px}.empty p{max-width:340px;margin:0 auto 19px;color:var(--muted);font-size:14px;line-height:1.6}.pill{font-size:11px;padding:5px 9px;border-radius:8px;background:#e5f2e8;color:#287553;font-weight:800}.hint{border-left:3px solid #7bb998;background:#f1f8f1;padding:11px 14px;border-radius:0 9px 9px 0;color:#637e6c;font-size:13px;line-height:1.55;margin-top:20px}
    dialog{border:0;border-radius:23px;max-width:min(96vw,580px);width:100%;padding:0;box-shadow:0 28px 100px rgba(0,0,0,.25);color:var(--ink)}dialog::backdrop{background:rgba(8,27,19,.57);backdrop-filter:blur(3px)}.modal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid #eff2ed;padding:23px 25px 18px}.modal-header h2{margin:0;font-size:21px}.modal-description{font-size:13px;color:var(--muted);margin:5px 0 0;line-height:1.5}.modal-body{padding:22px 25px;max-height:64vh;overflow:auto}.modal-footer{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;padding:16px 25px 24px;border-top:1px solid #eff2ed}.form-row{display:grid;grid-template-columns:1fr 1fr;gap:13px}.field{display:flex;flex-direction:column;gap:7px;margin-bottom:14px}.field label,.field-label{font-size:13px;font-weight:780;color:#3d5646}.field input,.field select,.input{border:1px solid #dce7db;background:#fff;color:var(--ink);border-radius:11px;padding:12px 13px;width:100%;min-width:0}.field input:focus,.field select:focus{border-color:#379d74}.choices{display:flex;flex-wrap:wrap;gap:8px;margin:9px 0 18px}.choice{display:flex;align-items:center;gap:7px;background:#f4f7f3;border:1px solid #e5ece3;border-radius:10px;padding:9px 11px;font-size:13px;font-weight:650;cursor:pointer}.choice input{accent-color:var(--green)}.split-option{display:flex;gap:7px;align-items:center;background:#f7faf7;border:1px solid #e5ebe4;border-radius:11px;padding:5px;margin-bottom:15px}.split-option label{flex:1;text-align:center;font-size:13px;font-weight:700;padding:10px 6px;border-radius:8px;cursor:pointer}.split-option label:has(input:checked){background:#e1f1e5;color:#1c7b57}.split-option input{position:absolute;opacity:0;width:1px;height:1px}.split-line{display:flex;align-items:center;gap:12px;margin:9px 0}.split-line span{flex:1;font-size:13px}.split-line input{width:115px;text-align:right}.error{color:#b33340;font-size:13px;min-height:19px;margin:6px 0 0}.setup-steps{counter-reset:steps}.setup-step{margin:0 0 16px 0;line-height:1.65;font-size:14px}.setup-step strong{color:#235b45}.code{display:inline-block;font-size:12px;background:#ebf1eb;padding:2px 6px;border-radius:4px;overflow-wrap:anywhere}.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%) translateY(20px);opacity:0;pointer-events:none;transition:.2s;z-index:2000;background:#193e30;color:#fff;box-shadow:0 9px 34px #1e443350;padding:13px 19px;border-radius:12px;font-size:13px;max-width:90vw;text-align:center}.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}.footer{max-width:1180px;margin:auto;padding:4px 24px 28px;color:#879a8b;font-size:12px;text-align:center}
    @media(max-width:850px){.layout{grid-template-columns:1fr}.sidebar{order:2}.main-panel{order:1}.hero{padding:28px 24px}.stats{gap:9px}.stat{padding:16px 15px}.stat-num{font-size:24px}}@media(max-width:560px){.site-header{padding:14px 14px}.brand{font-size:17px}.brand-icon{width:35px;height:35px}.top-actions{gap:5px}.top-actions .btn{font-size:12px;padding:9px 10px}.container{padding:0 11px 40px}.hero{border-radius:19px;padding:23px 20px}.title-input{font-size:32px}.stats{grid-template-columns:repeat(3,1fr)}.stat{padding:15px 12px;border-radius:13px}.stat-num{font-size:18px}.stat-label{font-size:11px}.stat-foot{font-size:10px}.layout{gap:13px;margin-top:13px}.panel{border-radius:17px}.content{padding:18px 16px 25px}.tabs{padding:10px 8px 0}.tab{padding:10px 12px;font-size:13px}.expense{gap:10px}.exp-emoji{width:39px;height:39px;font-size:20px}.exp-amount{font-size:15px}.exp-title{font-size:14px}.modal-header{padding:19px 18px}.modal-body{padding:18px}.modal-footer{padding:15px 18px}.form-row{grid-template-columns:1fr}.btn{font-size:13px}}
/* Mobile, keyboard and accessibility improvements */
[hidden]{display:none!important}
button,.btn,.btn.tiny,.icon-btn,.tab{min-width:44px;min-height:44px}
fieldset{border:0;padding:0;margin:0}legend{font-size:13px;font-weight:780}
:focus-visible{outline:3px solid #167d5c;outline-offset:3px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.stack{display:grid;gap:14px}
.footer-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-end}
.hero-title-edit{margin:10px 0 20px}
#tripTitle{cursor:default}
#loginCover{position:fixed;inset:0;width:100%;max-width:none;height:100%;max-height:none;margin:0;border:0;border-radius:0;background:#edf2ef;padding:20px;overflow-y:auto}
#loginCover[open]{display:grid;place-items:center}
#loginCover form{margin:auto;max-width:440px}
#loginCover::backdrop{background:#edf2ef}
#dialog{padding:0;max-height:calc(100dvh - 24px);max-width:min(96vw,640px)}
#dialogContent{display:flex;flex-direction:column;max-height:calc(100dvh - 24px)}
.modal-header,.modal-footer{flex-shrink:0}
.modal-body{max-height:none;overflow-y:auto;overscroll-behavior:contain;min-height:0}
.modal-footer{padding-bottom:max(16px,env(safe-area-inset-bottom))}
.error{line-height:1.6;white-space:pre-wrap}
#conflictPanel:empty{display:none}
#conflictPanel{margin-top:18px;border:2px solid #d4a74c;border-radius:12px;padding:14px;background:#fff9e9}
#conflictPanel pre{font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere;max-height:220px;overflow:auto}
#conflictPanel summary{cursor:pointer;font-weight:750;min-height:44px}
#conflictPanel button{white-space:normal;text-align:left}
.split-option input{position:static;opacity:1;width:18px;height:18px;margin-right:4px;accent-color:var(--green)}
.choice{min-height:44px}.choice input{width:20px;height:20px;flex:none}
.field input,.field select,.input,#groupPassword{font-size:16px;min-height:48px}
.site-header{flex-wrap:wrap;padding-top:max(16px,env(safe-area-inset-top))}
.site-header,.container,.footer{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
.container{padding-bottom:max(40px,env(safe-area-inset-bottom))}
.top-actions{justify-content:flex-start}
.stat-num{overflow-wrap:anywhere}
.toast{bottom:max(20px,env(safe-area-inset-bottom))}
@media(max-width:560px){
  .top-actions{width:100%}.top-actions .btn{min-height:44px;font-size:13px}
  .status{flex-basis:100%;white-space:normal}
  #dialog{max-width:100%;width:100%;max-height:100dvh;margin:auto 0 0;border-radius:18px 18px 0 0}
  #dialogContent{max-height:100dvh}
  .modal-header{padding-top:max(18px,env(safe-area-inset-top))}
  .modal-footer{gap:12px}.footer-actions{flex:1}.footer-actions .btn{flex:1;white-space:normal}
  .split-line{gap:8px}.split-line span{overflow-wrap:anywhere}
  .split-line input{width:110px}
  .tabs{justify-content:space-between}.tab{padding:12px 8px;flex:1}
  .balance-item{flex-wrap:wrap}.balance-value{font-size:16px}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important;scroll-behavior:auto!important}}
