:root{
  --accent:#1D6FE8; --accent-soft:#4D95F7; --accent-tint:#E7F0FD; --on-accent:#FFFFFF;
  --ground:#F4F6FB; --surface:#FFFFFF; --surface-2:#F9FBFE;
  --ink:#1C2433; --ink-2:#5E6B82; --ink-3:#98A4BA;
  --line:#E4EAF4; --income:#0E9F6E; --income-tint:#E3F5EE;
  --warn:#B45309; --warn-tint:#FBEEDC; --danger:#D64545;
  --shadow:0 18px 50px rgba(23,60,130,.14);
}
@media (prefers-color-scheme: dark){
  :root{
    --accent:#5AA2F8; --accent-soft:#2F7BE8; --accent-tint:#1A3050; --on-accent:#FFFFFF;
    --ground:#0E1420; --surface:#171F2E; --surface-2:#1D2738;
    --ink:#E8EEF9; --ink-2:#9FADC6; --ink-3:#66738C;
    --line:#2A3650; --income:#3ECF9A; --income-tint:#14352A;
    --warn:#E9A23B; --warn-tint:#3A2C14; --danger:#F07575;
    --shadow:0 18px 50px rgba(0,0,0,.5);
  }
}
*{box-sizing:border-box; margin:0; padding:0;}
html{height:100%;}
body{
  height:100%; background:var(--ground); overscroll-behavior:none;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","SF Pro Text","Helvetica Neue","Microsoft YaHei",sans-serif;
  color:var(--ink); -webkit-font-smoothing:antialiased; -webkit-tap-highlight-color:transparent;
}
.hidden{display:none !important;}
.app{
  height:100dvh; max-width:480px; margin:0 auto; background:var(--surface);
  position:relative; overflow:hidden; display:flex; flex-direction:column;
}
@media (min-width:520px){
  .app{height:min(860px,96vh); margin-top:2vh; border-radius:32px; border:1px solid var(--line); box-shadow:var(--shadow);}
}
.content{flex:1; overflow-y:auto; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; padding:calc(18px + env(safe-area-inset-top)) 20px 12px; scrollbar-width:none;}
.content::-webkit-scrollbar{display:none;}

.setup{display:flex; align-items:center; justify-content:center;}
.setup-box{width:100%; max-width:300px; text-align:center; display:flex; flex-direction:column; gap:12px; padding-bottom:15vh;}
.setup-icon{width:76px; height:76px; border-radius:20px; margin:0 auto;}
.setup-box h1{font-size:24px; font-weight:700;}
.setup-sub{font-size:14px; color:var(--ink-2);}
.setup-box input{
  border:1px solid var(--line); background:var(--surface-2); color:var(--ink);
  border-radius:14px; padding:13px 14px; font-size:16px; text-align:center; outline:none;
}
.setup-box input:focus{border-color:var(--accent);}
.person-row{display:flex; gap:8px; justify-content:center;}
.person-row .f-chip{font-size:15px; padding:10px 22px;}
.setup-err{font-size:13px; color:var(--danger); min-height:18px;}

.pg-head{display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:6px;}
.pg-title{font-size:26px; font-weight:700; letter-spacing:.5px;}
.pg-sub{font-size:13px; color:var(--ink-2); margin-top:4px;}
.btn-shot{
  display:flex; align-items:center; gap:6px; font-size:13px; font-weight:500; color:var(--accent);
  background:var(--accent-tint); border:none; border-radius:999px; padding:9px 14px; cursor:pointer;
}
.btn-shot svg{width:15px; height:15px;}

.stats{display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:14px;}
.stat{border-radius:16px; padding:12px 14px; border:1px solid var(--line); background:var(--surface-2);}
.stat .lb{font-size:12px; color:var(--ink-2);}
.stat b{display:block; font-size:21px; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.3px; margin-top:3px;}
.stat.income{background:var(--income-tint); border-color:transparent;}
.stat.income .lb, .stat.income b{color:var(--income);}
.stat.expense{background:var(--accent-tint); border-color:transparent;}
.stat.expense .lb, .stat.expense b{color:var(--accent);}
.stat.sub{padding:9px 14px;}
.stat.sub b{font-size:15px; margin-top:2px;}
.stat .split{display:block; font-size:11px; color:var(--ink-3); margin-top:3px;}

.feed-label{font-size:13px; color:var(--ink-3); margin:20px 0 10px; display:flex; justify-content:space-between;}
.entry{
  display:flex; align-items:center; gap:12px; background:var(--surface-2); border:1px solid var(--line);
  border-radius:16px; padding:12px 14px; margin-bottom:9px; cursor:pointer;
}
.entry:active{transform:scale(.985);}
#feed .entry{padding:9px 12px; margin-bottom:7px; border-radius:14px;}
.e-dot{width:38px; height:38px; border-radius:12px; flex:none; display:flex; align-items:center; justify-content:center; font-size:15px; font-weight:600;}
#feed .e-dot{width:30px; height:30px; border-radius:10px; font-size:13px;}
.e-dot.biz{background:var(--accent-tint); color:var(--accent);}
.e-dot.per{background:var(--income-tint); color:var(--income);}
.e-dot.inc{background:var(--income-tint); color:var(--income);}
.e-dot.pend{background:var(--warn-tint); color:var(--warn);}
.e-dot.working{background:var(--accent-tint); color:var(--accent);}
.e-main{flex:1; min-width:0;}
.e-item{font-size:15px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
#feed .e-item{font-size:13px;}
.e-meta{font-size:12px; color:var(--ink-2); margin-top:3px; display:flex; align-items:center; gap:6px; flex-wrap:wrap;}
#feed .e-meta{font-size:11px; margin-top:2px;}
.chip{font-size:11px; padding:2px 8px; border-radius:999px; background:var(--accent-tint); color:var(--accent); font-weight:500;}
.chip.per{background:var(--income-tint); color:var(--income);}
.chip.warn{background:var(--warn-tint); color:var(--warn);}
.chip.who{background:var(--line); color:var(--ink-2);}
.e-amt{font-size:16px; font-weight:600; font-variant-numeric:tabular-nums; letter-spacing:-.2px;}
#feed .e-amt{font-size:14px;}
.e-amt.in{color:var(--income);}
.e-amt.dim{color:var(--ink-3); font-weight:400;}
@keyframes spin{to{transform:rotate(360deg);}}
.working svg{width:14px; height:14px; animation:spin 1.1s linear infinite;}
.empty-tip{text-align:center; font-size:13px; color:var(--ink-3); padding:26px 0;}

.dock{flex:none; border-top:1px solid var(--line); background:var(--surface);}
.mic-zone{padding:12px 20px 4px; text-align:center;}
.mic-hint{font-size:13px; color:var(--ink-3); height:20px;}
.talk-wrap{position:relative; display:inline-block; margin:10px 0 6px;}
.ring{position:absolute; inset:0; border-radius:50%; border:2px solid var(--accent-soft); opacity:0; pointer-events:none;}
@keyframes ripple{0%{transform:scale(1); opacity:.45;} 100%{transform:scale(1.75); opacity:0;}}
.holding .ring1{animation:ripple 1.4s ease-out infinite;}
.holding .ring2{animation:ripple 1.4s .45s ease-out infinite;}
.holding .ring3{animation:ripple 1.4s .9s ease-out infinite;}
.talk-btn{
  width:112px; height:112px; border-radius:50%; border:none; cursor:pointer; position:relative;
  background:radial-gradient(circle at 32% 26%, var(--accent-soft), var(--accent) 72%);
  box-shadow:0 12px 30px rgba(29,111,232,.35), inset 0 1px 0 rgba(255,255,255,.28);
  color:var(--on-accent); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px;
  -webkit-touch-callout:none; user-select:none; -webkit-user-select:none; touch-action:none;
  transition:transform .18s cubic-bezier(.3,1.5,.5,1);
}
.holding .talk-btn{transform:scale(1.16);}
.talk-btn svg{width:32px; height:32px;}
.talk-btn span{font-size:13px; font-weight:600; letter-spacing:1px;}
.talk-caption{font-size:13px; font-weight:500; color:var(--ink-2); margin-bottom:2px; height:20px;}
.holding-ui{display:none; align-items:center; justify-content:center; gap:10px; height:20px;}
.holding .holding-ui{display:flex;}
.holding .mic-hint{display:none;}
.rec-timer{font-size:13px; color:var(--accent); font-weight:600; font-variant-numeric:tabular-nums; min-width:38px; text-align:left;}
.bars{display:flex; align-items:center; gap:3px; height:18px;}
.bars i{width:3px; border-radius:2px; background:var(--accent); height:6px;}
@keyframes bump{0%,100%{height:5px;} 50%{height:17px;}}
.holding .bars i{animation:bump .8s ease-in-out infinite;}
.holding .bars i:nth-child(2){animation-delay:.12s;} .holding .bars i:nth-child(3){animation-delay:.24s;}
.holding .bars i:nth-child(4){animation-delay:.36s;} .holding .bars i:nth-child(5){animation-delay:.48s;}
.rec-dot{width:8px; height:8px; border-radius:50%; background:var(--danger);}
@keyframes blink{50%{opacity:.25;}}
.holding .rec-dot{animation:blink 1s ease-in-out infinite;}

.tabbar{display:flex; border-top:1px solid var(--line); padding:8px 0 max(10px, env(safe-area-inset-bottom));}
.tab{flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; font-size:12px; color:var(--ink-3); background:none; border:none; cursor:pointer; font-weight:500;}
.tab svg{width:23px; height:23px;}
.tab.on{color:var(--accent);}

.mo-nav{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px;}
.mo-nav b{font-size:19px; font-weight:700;}
.mo-btn{width:34px; height:34px; border-radius:12px; border:1px solid var(--line); background:var(--surface-2); color:var(--ink-2); cursor:pointer; display:flex; align-items:center; justify-content:center;}
.mo-btn svg{width:16px; height:16px;}
.hero{
  border-radius:20px; padding:18px; color:#fff; margin-bottom:12px;
  background:linear-gradient(135deg, var(--accent-soft), var(--accent));
}
.hero .lbl{font-size:12px; opacity:.85;}
.hero .big{font-size:32px; font-weight:700; font-variant-numeric:tabular-nums; letter-spacing:-.5px; margin:2px 0 12px;}
.hero .big{margin:2px 0 0;}
.hero-div{border-top:1.5px dashed rgba(255,255,255,.4); margin:14px 0 12px;}
.hero-row{display:flex; gap:14px; align-items:stretch;}
.hero-col{flex:1;}
.hero-vsep{width:1px; background:rgba(255,255,255,.3);}
.hval{font-size:19px; font-weight:700; font-variant-numeric:tabular-nums; margin-top:3px;}
.hero-col .lbl2{font-size:11px; opacity:.75; margin-top:3px;}
.plat{background:var(--surface-2); border:1px solid var(--line); border-radius:16px; padding:14px; margin-bottom:12px;}
.plat h4{font-size:13px; color:var(--ink-2); font-weight:500; margin-bottom:10px; display:flex; justify-content:space-between; align-items:center;}
.link{color:var(--accent); font-size:12px; font-weight:500; cursor:pointer; text-decoration:none;}
.p-item{margin-bottom:11px;}
.p-item:last-child{margin-bottom:2px;}
.p-line{display:flex; justify-content:space-between; align-items:baseline; gap:10px; font-size:13px; margin-bottom:5px;}
.p-line span:first-child{color:var(--ink-2); min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.p-amt{font-variant-numeric:tabular-nums; font-weight:600; flex:none;}
.p-track{height:6px; border-radius:3px; background:var(--line); overflow:hidden;}
.p-fill{height:100%; border-radius:3px; background:linear-gradient(90deg, var(--accent-soft), var(--accent));}
.rs{border-top:1px solid var(--line); padding:10px 0 8px;}
.rs:first-of-type{border-top:none; padding-top:2px;}
.rs-head{display:flex; justify-content:space-between; align-items:center; cursor:pointer; gap:8px;}
.rs-name{font-size:14px; font-weight:600; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.rs-name i{font-style:normal; font-size:11px; font-weight:400; color:var(--ink-3); margin-left:6px;}
.rs-right{display:flex; align-items:center; gap:6px; flex:none;}
.r-net{font-weight:600; font-variant-numeric:tabular-nums; white-space:nowrap;}
.rs-right svg{width:14px; height:14px; color:var(--ink-3); transition:transform .2s;}
.rs.open .rs-right svg{transform:rotate(180deg);}
.rs-sub{font-size:11px; color:var(--ink-2); margin-top:3px; font-variant-numeric:tabular-nums;}
.rs-days{margin-top:8px; display:none;}
.rs.open .rs-days{display:block;}
.rt{width:100%; border-collapse:collapse; font-size:12px; font-variant-numeric:tabular-nums;}
.rt th{font-weight:400; color:var(--ink-3); font-size:11px; text-align:right; padding:2px 0 4px;}
.rt th:first-child, .rt td:first-child{text-align:left; color:var(--ink-2); font-variant-numeric:normal;}
.rt td{text-align:right; padding:4px 0; border-top:1px solid var(--line); color:var(--ink-2);}
.rt td.net{font-weight:600; color:var(--ink);}
.blk-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin:4px 0 6px;}
.blk{background:var(--ground); border-radius:10px; padding:8px 9px;}
.blk .lb{display:block; font-size:11px; color:var(--ink-2);}
.blk b{display:block; font-size:14px; font-weight:600; font-variant-numeric:tabular-nums; margin-top:2px;}
.rs-more{font-size:12px; color:var(--accent); font-weight:500; cursor:pointer; margin:4px 0 2px;}
.filters{display:flex; gap:7px; margin:14px 0 4px; flex-wrap:wrap;}
.f-chip{font-size:13px; padding:6px 14px; border-radius:999px; border:1px solid var(--line); background:var(--surface-2); color:var(--ink-2); cursor:pointer; font-weight:500;}
.f-chip.on{background:var(--accent); border-color:var(--accent); color:var(--on-accent);}
.pend-bar{
  display:flex; align-items:center; gap:9px; background:var(--warn-tint); color:var(--warn);
  border-radius:14px; padding:11px 13px; font-size:13px; font-weight:500; margin:12px 0 4px; cursor:pointer;
}
.pend-bar svg{width:17px; height:17px; flex:none;}
.day-head{display:flex; justify-content:space-between; font-size:12px; color:var(--ink-3); margin:16px 2px 8px;}

.toast{
  position:absolute; top:calc(14px + env(safe-area-inset-top)); left:50%; transform:translate(-50%,-90px); z-index:30;
  display:flex; align-items:center; gap:8px; background:var(--ink); color:var(--ground);
  font-size:14px; font-weight:500; padding:11px 18px; border-radius:999px; box-shadow:var(--shadow);
  transition:transform .3s cubic-bezier(.2,.9,.3,1.2); pointer-events:none; max-width:88%; white-space:nowrap; overflow:hidden;
}
.toast.show{transform:translate(-50%,0);}
.toast svg{width:16px; height:16px; flex:none; color:var(--income);}
.toast em{font-style:normal; overflow:hidden; text-overflow:ellipsis;}

.scrim{position:absolute; inset:0; background:rgba(15,12,40,.45); opacity:0; pointer-events:none; transition:opacity .25s; z-index:20;}
.scrim.show{opacity:1; pointer-events:auto;}
.sheet{
  position:absolute; left:0; right:0; bottom:0; z-index:25; background:var(--surface);
  border-radius:26px 26px 0 0; padding:14px 20px calc(18px + env(safe-area-inset-bottom));
  transform:translateY(105%); transition:transform .3s cubic-bezier(.3,.9,.3,1);
  box-shadow:0 -10px 40px rgba(20,15,60,.18); max-height:86%; overflow-y:auto;
}
.sheet.show{transform:translateY(0);}
.grab{width:38px; height:4px; border-radius:2px; background:var(--line); margin:0 auto 14px;}
.s-row{display:flex; gap:10px; align-items:center; margin-bottom:4px;}
.s-item-input{flex:1; border:none; background:transparent; font-size:18px; font-weight:700; color:var(--ink); outline:none; min-width:0;}
.s-amt-row{display:flex; align-items:baseline; gap:4px; margin:2px 0;}
.s-amt-sign{font-size:22px; font-weight:700;}
.s-amt-input{border:none; background:transparent; font-size:30px; font-weight:700; color:var(--ink); outline:none; width:100%; font-variant-numeric:tabular-nums;}
.s-amt-input.in, .s-amt-sign.in{color:var(--income);}
.s-src{font-size:12px; color:var(--ink-3); margin-bottom:12px; display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.s-date{border:1px solid var(--line); background:var(--surface-2); color:var(--ink-2); border-radius:8px; padding:2px 6px; font-size:12px;}
.s-note{background:var(--warn-tint); color:var(--warn); font-size:13px; border-radius:12px; padding:10px 12px; margin-bottom:12px; line-height:1.5;}
.play{
  display:flex; align-items:center; gap:10px; border:1px solid var(--line); background:var(--surface-2);
  border-radius:14px; padding:10px 13px; margin-bottom:14px; cursor:pointer; width:100%; color:var(--ink);
}
.play svg{width:18px; height:18px; color:var(--accent); flex:none;}
.play .ptrack{flex:1; height:5px; border-radius:3px; background:var(--line); overflow:hidden;}
.play .pfill{height:100%; width:0; background:var(--accent); border-radius:3px; transition:width .2s linear;}
.play span{font-size:12px; color:var(--ink-2); font-variant-numeric:tabular-nums;}
.s-lbl{font-size:12px; color:var(--ink-3); margin:10px 0 8px;}
.seg{display:flex; border:1px solid var(--line); border-radius:12px; overflow:hidden;}
.seg button{flex:1; padding:9px 0; font-size:14px; font-weight:500; border:none; background:var(--surface-2); color:var(--ink-2); cursor:pointer;}
.seg button.on{background:var(--accent); color:var(--on-accent);}
.cat-row{display:flex; gap:7px; overflow-x:auto; padding-bottom:4px; -webkit-overflow-scrolling:touch; scrollbar-width:none;}
.cat-row::-webkit-scrollbar{display:none;}
.s-actions{display:flex; gap:10px; margin-top:16px;}
.btn{flex:1; padding:13px 0; border-radius:14px; border:none; font-size:15px; font-weight:600; cursor:pointer;}
.btn.pri{background:var(--accent); color:var(--on-accent);}
.btn.ghost{background:var(--surface-2); color:var(--danger); border:1px solid var(--line);}
@media (prefers-reduced-motion: reduce){
  .ring,.bars i,.rec-dot,.working svg{animation:none !important;}
  .toast,.sheet,.scrim,.talk-btn{transition:none !important;}
}
