/* 一个手机宽的直栏。大按钮、头像和数字来表达意思，字越少越好。 */
:root{
  --bg:#eef2e6; --surface:#ffffff; --sunk:#e2e8d6; --fg:#1b2413; --muted:#5d6a50; --line:#cfd8c0;
  --husk:#3d5a1c; --husk-fg:#ffffff; --flesh:#f4c531; --flesh-fg:#2a2203;
  --good:#1f7a3d; --good-bg:#dcf1e0; --owe:#b3341f; --owe-bg:#fbe2dc; --warn:#8a5a00; --wa:#128c4b;
  --c1:#2f6fb5; --c2:#b5552f; --c3:#6b4fa8; --c4:#1f8a7a; --c5:#a8457a;
  --txt:system-ui,-apple-system,"Noto Sans SC","PingFang SC","Microsoft YaHei",sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){ :root{
  --bg:#12170d; --surface:#1d2516; --sunk:#283220; --fg:#e9efdc; --muted:#a3b091; --line:#36422b;
  --husk:#86b14a; --husk-fg:#10160a;
  --good:#7fd69a; --good-bg:#173622; --owe:#ff9c88; --owe-bg:#44201a; --warn:#f0c060; --wa:#35c47a;
  --c1:#4a8ad0; --c2:#cf6f47; --c3:#8a6fc8; --c4:#35a595; --c5:#c45f95; color-scheme:dark } }
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--txt);font-size:16px;line-height:1.5;
  padding:env(safe-area-inset-top,0) 0 env(safe-area-inset-bottom,0);-webkit-tap-highlight-color:transparent}
[hidden]{display:none!important}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;touch-action:manipulation}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--flesh);outline-offset:2px}
.app{max-width:480px;margin:0 auto;padding-inline:16px;padding-block:0 24px}
#main{display:flex;flex-direction:column;gap:16px}
.tabs{position:sticky;top:env(safe-area-inset-top,0px);z-index:5;background:var(--bg);padding-block:12px 12px;display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.tab{position:relative;display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 4px;border-radius:14px;background:var(--sunk);color:var(--muted);font-weight:700}
.tab svg{width:28px;height:28px}
.tab[aria-current="true"]{background:var(--husk);color:var(--husk-fg)}
.dot{position:absolute;top:8px;right:14px;width:10px;height:10px;border-radius:50%;background:var(--owe)}
h1{font-size:22px;margin:0;font-weight:900}
h2{font-size:17px;margin:0;font-weight:700}
h3{font-size:14px;margin:6px 0 0;font-weight:700;color:var(--muted)}
.hint{color:var(--muted);font-size:13px;margin:0}
.chip-line{font-size:13px;margin:0;color:var(--muted)}
.chip-line.good{color:var(--good)} .chip-line.owe{color:var(--owe)} .chip-line.warn{color:var(--warn)}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.tile{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:16px 8px;display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0}
.tile b{font-size:19px;overflow-wrap:anywhere;text-align:center}
.av{width:84px;height:84px;border-radius:50%;display:grid;place-items:center;font-size:40px;font-weight:900;color:#fff;object-fit:cover;flex:none}
.av.sm{width:52px;height:52px;font-size:24px}
.av.ico{background:var(--sunk);font-weight:400;font-size:50px;line-height:1}
.av.sm.ico{font-size:30px}
.pill{font-weight:700;font-size:15px;padding:2px 10px;border-radius:99px;background:var(--sunk);color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}
.pill.good{background:var(--good-bg);color:var(--good)} .pill.owe{background:var(--owe-bg);color:var(--owe)}
.head{display:flex;align-items:center;gap:12px}
.head .who{flex:1;min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:2px}
.head .who b{font-size:22px;overflow-wrap:anywhere}
.back{width:48px;height:48px;border-radius:50%;background:var(--sunk);font-size:24px;flex:none;display:grid;place-items:center}
.row{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:14px;display:flex;flex-direction:column;gap:10px}
.row-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.row-top b{font-size:21px} .row-top span{color:var(--muted);font-size:16px;margin-left:8px;white-space:nowrap}
.amt{font-weight:700;font-size:22px;font-variant-numeric:tabular-nums;white-space:nowrap}
.ctl{display:flex;gap:8px;align-items:stretch}
.step{width:60px;border-radius:14px;background:var(--sunk);font-size:30px;font-weight:700}
.qty{flex:1;min-width:0;height:72px;border-radius:14px;border:2px solid var(--husk);background:var(--bg);font-weight:800;font-size:42px;font-variant-numeric:tabular-nums}
.qty.zero{border-color:var(--line);color:var(--muted)}
.treebtn{align-self:flex-start;padding:6px 12px;border-radius:99px;background:var(--sunk);font-size:14px;font-weight:500;display:flex;gap:6px;align-items:center}
.treebtn svg{width:18px;height:18px}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{font-weight:700;font-size:16px;padding:2px 10px;border-radius:8px;background:var(--sunk);font-variant-numeric:tabular-nums}
.photos{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.ph{position:relative;display:flex;flex-direction:column;gap:4px;min-width:0}
.ph img{width:100%;aspect-ratio:3/4;object-fit:cover;border-radius:10px;display:block}
.ph input{width:100%;padding:6px;border-radius:8px;border:1px solid var(--line);background:var(--surface);font-size:16px;text-align:center}
.ph .x{position:absolute;top:4px;right:4px;width:30px;height:30px;border-radius:50%;background:var(--owe-bg);color:var(--owe);font-weight:700}
.ph .tag{position:absolute;left:4px;top:4px;background:var(--surface);border-radius:6px;padding:0 6px;font-size:13px;font-weight:700}
.cam{display:flex;align-items:center;justify-content:center;gap:10px;padding:14px;border-radius:16px;border:2px dashed var(--line);background:var(--surface);font-weight:700;font-size:18px;cursor:pointer}
.cam svg{width:30px;height:30px}
.bar{position:sticky;bottom:0;background:var(--bg);padding-block:12px calc(12px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:10px;border-top:1px solid var(--line)}
.total{display:flex;align-items:center;justify-content:space-between;gap:12px}
.total .n{font-weight:800;font-size:42px;line-height:1;font-variant-numeric:tabular-nums}
.icon{width:56px;height:56px;border-radius:50%;background:var(--sunk);display:grid;place-items:center;flex:none}
.icon svg{width:28px;height:28px}
.btn{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:64px;border-radius:16px;font-weight:900;font-size:22px;background:var(--flesh);color:var(--flesh-fg);text-align:center}
.btn svg{width:28px;height:28px}
.btn:disabled{background:var(--sunk);color:var(--muted);cursor:not-allowed}
.btn.wa{background:var(--wa);color:#fff}
.btn.ghost{background:var(--sunk);color:var(--fg);font-size:18px;min-height:52px;font-weight:700}
.btn.danger,.link.danger{color:var(--owe)}
.btn.settle{font-variant-numeric:tabular-nums}
.btn.settle.sure{background:var(--husk);color:var(--husk-fg)}
.settled{display:flex;align-items:center;justify-content:center;gap:10px;min-height:52px;border-radius:16px;background:var(--good-bg);color:var(--good);font-weight:700;font-size:18px}
.settled svg{width:24px;height:24px}
.btns{display:flex;flex-direction:column;gap:10px}
.billimg{width:100%;border-radius:8px;border:1px solid var(--line);display:block;background:#fff}
.note{background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--flesh);padding:12px 14px;border-radius:8px;font-size:14px;margin:0}
/* 数字键盘 */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.5);z-index:20;display:flex;align-items:flex-end;justify-content:center}
.sheet{width:100%;max-width:480px;background:var(--surface);border-radius:22px 22px 0 0;padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:12px}
.sheet-h{display:flex;justify-content:space-between;align-items:center;gap:8px}
.disp{font-weight:800;font-size:54px;line-height:1.1;text-align:center;min-height:62px;font-variant-numeric:tabular-nums;border-bottom:3px solid var(--husk)}
.keys{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.key{height:64px;border-radius:14px;background:var(--sunk);font-weight:700;font-size:30px}
.key.next{background:var(--husk);color:var(--husk-fg);font-size:18px}
/* 管理 */
.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px;display:flex;flex-direction:column;gap:10px}
.fl{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--muted);font-weight:500}
.fl input,.fl select,.item input{width:100%;padding:11px;border-radius:10px;border:1px solid var(--line);background:var(--bg);color:var(--fg);font-size:16px}
.ck{display:flex;gap:10px;align-items:flex-start;font-size:15px}
.ck input{width:22px;height:22px;flex:none;margin-top:1px;accent-color:var(--husk)}
.item{display:flex;flex-direction:column;gap:6px;padding:10px;border-radius:12px;background:var(--sunk)}
.f{display:flex;gap:8px;align-items:center}
.f .price{flex:1;min-width:0;font-size:18px;font-weight:700}
.f .del{width:44px;height:44px;border-radius:10px;background:var(--owe-bg);color:var(--owe);font-weight:700;flex:none;font-size:20px}
.icons{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px}
.icons button{height:46px;padding:0;border-radius:12px;background:var(--sunk);font-size:26px;line-height:1;font-weight:700}
.icons button[aria-pressed="true"]{background:var(--surface);box-shadow:inset 0 0 0 3px var(--husk)}
.link{color:var(--husk);font-weight:700;padding:8px 0;text-align:left;cursor:pointer}
.chead{display:flex;align-items:center;gap:10px;width:100%;text-align:left}
.chead b{flex:1;min-width:0;font-size:18px;overflow-wrap:anywhere}
.chev{color:var(--muted)}
.list{display:flex;flex-direction:column}
.li{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}
.li:last-child{border-bottom:0}
.li.gone{opacity:.5;text-decoration:line-through}
.li .no{font-weight:700;color:var(--owe);font-variant-numeric:tabular-nums}
.li .m{font-weight:700;font-size:17px;font-variant-numeric:tabular-nums}
.li .m.good{color:var(--good)}
.li small{color:var(--muted);display:block}
.toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);background:var(--fg);color:var(--bg);padding:12px 18px;border-radius:99px;font-weight:700;z-index:30;max-width:90%;text-align:center}
.login{display:flex;flex-direction:column;gap:16px;padding-block:48px 0;align-items:stretch}
.login img{align-self:center;border-radius:20px}
.login h1{text-align:center}
.chead b small{display:block;font-weight:400;font-size:13px;color:var(--muted)}
