:root{
  --bg:#EEF2F6; --surface:#FFFFFF; --sunk:#E3E9F0; --fg:#14202E; --muted:#5B6878; --line:#D3DCE6;
  --accent:#1F5FD6; --accent-soft:#DCE7FB; --paid:#16855B; --paid-soft:#D8F0E5; --wait:#B4690E; --wait-soft:#FBEBD3; --bad:#C0392B;
  --f-ui:"Manrope",system-ui,-apple-system,"Segoe UI",sans-serif; --f-num:"Unbounded","Manrope",system-ui,sans-serif;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#0E141C; --surface:#18212D; --sunk:#111922; --fg:#E7EDF4; --muted:#97A4B4; --line:#2A3646;
  --accent:#6C9EF8; --accent-soft:#1D2E4C; --paid:#4CC38A; --paid-soft:#173527; --wait:#F0A54A; --wait-soft:#3A2A14; --bad:#F07A6A; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#0E141C; --surface:#18212D; --sunk:#111922; --fg:#E7EDF4; --muted:#97A4B4; --line:#2A3646;
  --accent:#6C9EF8; --accent-soft:#1D2E4C; --paid:#4CC38A; --paid-soft:#173527; --wait:#F0A54A; --wait-soft:#3A2A14; --bad:#F07A6A; color-scheme:dark}
:root[data-theme="light"]{color-scheme:light}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0}
body{background:var(--bg);color:var(--fg);font-family:var(--f-ui);font-size:15px;line-height:1.45}
button{font-family:inherit}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
#busy{position:fixed;top:0;left:0;right:0;height:3px;z-index:20;background:linear-gradient(90deg,transparent,var(--accent),transparent);background-size:50% 100%;opacity:0;transition:opacity .2s}
#busy.on{opacity:1;animation:busy 1s linear infinite}
@keyframes busy{from{background-position:-50% 0}to{background-position:150% 0}}

/* каркас: телефон */
.shell{max-width:560px;margin:0 auto;min-height:100vh}
.scroll{padding:18px 16px 110px;display:flex;flex-direction:column;gap:14px}
.tabbar{position:fixed;left:0;right:0;bottom:0;display:flex;justify-content:space-around;background:var(--surface);border-top:1px solid var(--line);padding:8px 6px calc(10px + env(safe-area-inset-bottom,0px));z-index:4}
.tabbar button{background:none;border:0;color:var(--muted);font:600 11px var(--f-ui);display:flex;flex-direction:column;align-items:center;gap:3px;cursor:pointer;padding:4px 10px;border-radius:10px}
.tabbar button[aria-current="true"]{color:var(--accent)}
.tabbar svg{width:22px;height:22px}
.side,.aside{display:none}

/* каркас: компʼютер */
@media (min-width:1000px){
  .shell{max-width:1320px;display:grid;grid-template-columns:210px minmax(0,1fr) 300px;gap:0}
  .tabbar{display:none}
  .side{display:flex;flex-direction:column;gap:4px;padding:20px 12px;position:sticky;top:0;height:100vh;overflow-y:auto;background:var(--surface);border-right:1px solid var(--line)}
  .side button{border:0;background:none;text-align:left;padding:10px;border-radius:10px;font:600 14px var(--f-ui);color:var(--fg);cursor:pointer;display:flex;justify-content:space-between;gap:6px}
  .side button[aria-current="true"]{background:var(--accent-soft);color:var(--accent)}
  .scroll{padding:24px 24px 60px}
  .aside{display:flex;flex-direction:column;gap:14px;padding:24px 20px 24px 0;position:sticky;top:0;height:100vh;overflow-y:auto}
  .phone-only{display:none!important}
}
@media (max-width:999px){.desk-only{display:none!important}}

.lbl{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:700}
.hint{font-size:13px;color:var(--muted);background:var(--surface);border:1px dashed var(--line);border-radius:12px;padding:10px 12px}
.card{background:var(--surface);border-radius:20px;padding:16px;display:flex;flex-direction:column;gap:12px;min-width:0}
.row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.num{font-family:var(--f-num);font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.muted{color:var(--muted)} .small{font-size:13px}
.seg{display:flex;background:var(--sunk);border-radius:12px;padding:3px}
.seg button{flex:1;border:0;background:none;padding:8px 6px;border-radius:9px;font:600 13px var(--f-ui);color:var(--muted);cursor:pointer;white-space:nowrap}
.seg button[aria-pressed="true"]{background:var(--surface);color:var(--fg);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.stepper{display:flex;align-items:center;justify-content:space-between}
.stepper button{width:56px;height:56px;border-radius:18px;border:0;background:var(--sunk);color:var(--fg);font:700 26px var(--f-ui);cursor:pointer}
.stepper .val{font-size:44px;font-weight:700;text-align:center}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{border:1px solid var(--line);background:var(--surface);color:var(--fg);border-radius:999px;padding:6px 12px;font:600 13px var(--f-ui);cursor:pointer}
.chip[aria-pressed="true"]{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.chip:disabled{opacity:.3;cursor:default}
.chip.danger{color:var(--bad);border-color:var(--bad)}
.btn{border:0;border-radius:16px;padding:14px;font:700 15px var(--f-ui);background:var(--accent);color:#fff;cursor:pointer;width:100%}
.btn.ghost{background:var(--sunk);color:var(--fg)}
.btn.green{background:var(--paid)} .btn.amber{background:var(--wait)} .btn.sm{padding:10px;font-size:14px;border-radius:12px}
.btn:disabled{opacity:.5}
.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.stat{display:flex;flex-direction:column;gap:2px;min-width:0}
.stat b{font-family:var(--f-num);font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap}
.pill{font-size:11px;font-weight:700;border-radius:99px;padding:3px 8px;white-space:nowrap}
.pill.paid{background:var(--paid-soft);color:var(--paid)} .pill.wait{background:var(--wait-soft);color:var(--wait)}
.list{display:flex;flex-direction:column}
.li{display:flex;align-items:center;gap:12px;padding:11px 0;border-bottom:1px solid var(--line)}
.li:last-child{border-bottom:0}
.li.click{cursor:pointer}
.li .d{width:44px;flex:none;text-align:center;line-height:1.1}
.li .d b{display:block;font-family:var(--f-num);font-size:17px}
.li .mid{flex:1;min-width:0}
.li .end{display:flex;flex-direction:column;align-items:flex-end;gap:3px}
.amt{font-family:var(--f-num);font-size:14px;text-align:right;white-space:nowrap}
.eur{color:var(--muted);font-size:12px;font-weight:600;white-space:nowrap}
.ic{width:34px;height:34px;border-radius:11px;flex:none;display:grid;place-items:center;font-weight:800}
.ic.w{background:var(--accent-soft);color:var(--accent)} .ic.p{background:var(--paid-soft);color:var(--paid)}

.sheet-bg{position:fixed;inset:0;background:rgba(10,15,22,.45);display:flex;align-items:flex-end;justify-content:center;z-index:10}
.sheet{background:var(--surface);width:100%;max-width:560px;border-radius:24px 24px 0 0;padding:10px 16px calc(22px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:14px;max-height:92vh;overflow-y:auto}
@media (min-width:700px){.sheet-bg{align-items:center}.sheet{border-radius:24px;max-width:460px;padding:20px}.grab{display:none}}
.grab{width:40px;height:5px;border-radius:9px;background:var(--line);align-self:center}
@media (prefers-reduced-motion:no-preference){.sheet{animation:up .22s ease-out}@keyframes up{from{transform:translateY(30px);opacity:.6}}}
.field{display:flex;flex-direction:column;gap:6px}
.field input,.inp{border:1px solid var(--line);background:var(--sunk);color:var(--fg);border-radius:12px;padding:12px;font:600 16px var(--f-ui);width:100%;min-width:0}
.inp.sm{padding:7px 8px;font-size:14px;border-radius:10px;width:auto;max-width:130px}
.toast{position:fixed;left:16px;right:16px;bottom:calc(86px + env(safe-area-inset-bottom,0px));max-width:420px;margin:0 auto;background:var(--fg);color:var(--bg);border-radius:14px;padding:11px 14px;font-weight:600;font-size:13px;z-index:30;display:flex;justify-content:space-between;align-items:center;gap:10px}
.toast button{border:0;background:var(--bg);color:var(--fg);border-radius:9px;padding:6px 10px;font:700 12px var(--f-ui);cursor:pointer}
@media (min-width:1000px){.toast{left:auto;right:24px;bottom:24px;width:340px}}

.cal{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}
.cal .wd{font-size:11px;text-align:center;color:var(--muted);font-weight:700}
.cell{aspect-ratio:1/1.15;border-radius:12px;background:var(--surface);border:0;padding:5px 4px;display:flex;flex-direction:column;justify-content:space-between;align-items:center;font:600 11px var(--f-ui);color:var(--muted);cursor:pointer;min-width:0}
.cell:disabled{cursor:default}
.cell .h{font-family:var(--f-num);font-size:14px;color:var(--fg)}
.cell.paid{background:var(--paid-soft)} .cell.paid .h{color:var(--paid)}
.cell.wait{background:var(--wait-soft)} .cell.wait .h{color:var(--wait)}
.cell.vac{background:var(--accent-soft)} .cell.vac .h{color:var(--accent);font-size:10px;font-family:var(--f-ui);font-weight:800}
.cell.today{outline:2px solid var(--accent)}
.cell.blank{visibility:hidden}
.cell .acc{font-size:9px;color:var(--accent);font-weight:800}
.legend{display:flex;gap:12px;font-size:12px;color:var(--muted);flex-wrap:wrap}
.legend span::before{content:"";display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:-1px;background:var(--c)}
@media (min-width:1000px){.cell{aspect-ratio:auto;height:74px}.cell .h{font-size:17px}}

.hero{background:var(--fg);color:var(--bg);border-radius:24px;padding:20px;display:flex;flex-direction:column;gap:10px}
.hero .btn{background:var(--bg);color:var(--fg)}
.hero .eur{color:inherit;opacity:.7}
.later{background:rgba(255,255,255,.12);border-radius:12px;padding:8px 10px;font-size:13px;display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.timer{font-size:40px;font-weight:700;text-align:center;font-variant-numeric:tabular-nums}
.tbtns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.viewer{background:var(--accent-soft);color:var(--accent);border-radius:14px;padding:10px 12px;font-size:13px;font-weight:700}
.planbar{position:relative;height:14px;border-radius:99px;background:var(--sunk);overflow:hidden}
.planbar i{position:absolute;top:0;bottom:0;left:0;background:var(--accent);border-radius:99px}
.planbar .extra{position:absolute;top:0;bottom:0;right:0;background:repeating-linear-gradient(135deg,transparent 0 4px,var(--line) 4px 6px)}
.kv{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;font-size:13px}
.kv b{text-align:right;font-variant-numeric:tabular-nums}
.sec h3{margin:0;font-size:13px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.set{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line);font-size:14px;flex-wrap:wrap}
.set:last-child{border-bottom:0}
.set input[type=time],.set input[type=number],.set input[type=date]{border:1px solid var(--line);background:var(--sunk);color:var(--fg);border-radius:10px;padding:7px 8px;font:600 14px var(--f-ui);max-width:130px}
.sw{width:44px;height:26px;border-radius:99px;border:0;background:var(--line);position:relative;cursor:pointer;flex:none}
.sw::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:left .15s}
.sw[aria-pressed="true"]{background:var(--paid)} .sw[aria-pressed="true"]::after{left:21px}
.times{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.times .field input{padding:10px 8px;font-size:15px}
.lock{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;color:var(--muted);background:var(--sunk);border-radius:99px;padding:4px 10px}
.split{display:flex;gap:6px;flex-wrap:wrap;margin-top:4px}
.split span{font-size:12px;font-weight:700;border-radius:8px;padding:4px 8px;background:var(--sunk)}
.split span.nx{background:var(--accent-soft);color:var(--accent)}
.ro-box{background:var(--sunk);border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:6px;font-size:14px}
.tag{display:inline-block;font-size:10px;font-weight:800;color:var(--accent);background:var(--accent-soft);border-radius:6px;padding:1px 6px;margin-left:6px;vertical-align:2px}
.tbl{background:var(--surface);border-radius:14px;padding:6px 10px;overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:13px;font-variant-numeric:tabular-nums}
th{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);text-align:right;padding:8px;border-bottom:1px solid var(--line);white-space:nowrap}
td{text-align:right;padding:7px 8px;border-bottom:1px solid var(--line);white-space:nowrap}
th.l,td.l{text-align:left}
tbody tr.click{cursor:pointer} tbody tr.click:hover{background:var(--sunk)}
tfoot td{font-weight:800;border-bottom:0}
.addrow{display:flex;gap:8px;flex-wrap:wrap;align-items:end;background:var(--surface);border-radius:14px;padding:12px}
.addrow label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--muted);font-weight:700}
.bars{display:flex;align-items:flex-end;gap:10px;height:150px;padding-top:10px}
.bars div{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;height:100%;justify-content:flex-end;font-size:11px;color:var(--muted)}
.bars i{display:block;width:100%;background:var(--accent);border-radius:6px 6px 2px 2px;min-height:2px}
.bars div.cur i{background:var(--fg)}
.linkbox{display:flex;gap:6px;width:100%}
.linkbox input{flex:1;min-width:0;border:1px solid var(--line);background:var(--sunk);color:var(--muted);border-radius:10px;padding:7px 8px;font:500 12px var(--f-ui)}
h1.title{font-family:var(--f-num);font-weight:700;font-size:22px;margin:0}

/* вкладка «Гроші»: конверти й розподіл (money.js) */
.mbar{height:6px;border-radius:99px;background:var(--sunk);overflow:hidden;margin-top:6px}
.mbar i{display:block;height:100%;background:var(--accent);border-radius:99px}
.malloc{display:grid;grid-template-columns:minmax(0,1fr) 110px;gap:4px 10px;align-items:center;font-size:14px;font-weight:600}
.malloc input{border:1px solid var(--line);background:var(--sunk);color:var(--fg);border-radius:10px;padding:8px;font:700 15px var(--f-ui);text-align:right;width:100%}
.malloc .small{grid-column:1/-1;font-weight:500;margin-top:-2px}
.mleft{border-radius:12px;padding:10px 12px;font-weight:700;font-size:14px;display:flex;justify-content:space-between}
.mleft.ok{background:var(--paid-soft);color:var(--paid)} .mleft.more{background:var(--accent-soft);color:var(--accent)} .mleft.bad{background:var(--wait-soft);color:var(--bad)}
