:root {
  --canvas:#f4f5f2; --panel:#fff; --ink:#152c29; --muted:#556661; --line:#d9e0da;
  --wash:#ecf1ec; --accent:#006752; --mint:#c9f3df; --amber:#83551a; --pale:#fff1cf;
  --nav:#fff; --shadow:0 8px 30px #193a2c0c;
  font:16px/1.45 "Inter","Segoe UI",system-ui,sans-serif; color-scheme:light;
}
:root[data-theme="dark"] {
  --canvas:#111918; --panel:#192321; --ink:#e5eee9; --muted:#a5b7af; --line:#35433e;
  --wash:#24332d; --accent:#96e7c6; --mint:#234e3d; --amber:#f4d086; --pale:#473a23;
  --nav:#17221e; --shadow:none; color-scheme:dark;
}
* { box-sizing:border-box; }
body { margin:0; background:var(--canvas); color:var(--ink); }
button,input,select { font:inherit; color:inherit; }
button,a,input,select { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { opacity:.5; cursor:default; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
  outline:3px solid #159d77; outline-offset:2px;
}
[hidden] { display:none!important; }
.mast { background:var(--panel); border-bottom:1px solid var(--line); padding-top:max(env(safe-area-inset-top), var(--tg-content-safe-area-inset-top,0px)); }
.mast-inner { max-width:1216px; padding:0 32px; margin:auto; min-height:72px; display:flex; align-items:center; gap:16px; }
.brand { display:flex; align-items:center; gap:9px; font-weight:750; font-size:23px; letter-spacing:-1.25px; }
.brand-mark { display:grid; place-items:center; width:35px; height:35px; border-radius:11px; background:#0c443c; color:#a4ffd6; font:italic 900 25px/1 "Arial",sans-serif; padding-right:3px; }
.mast-caption { border-left:1px solid var(--line); padding-left:16px; font-size:13px; color:var(--muted); }
.refresh,.close { display:grid; place-items:center; width:42px; height:42px; border:1px solid var(--line); background:var(--panel); border-radius:50%; }
.refresh { margin-left:auto; font:26px/1 "Arial",sans-serif; }
.refresh:hover,.close:hover { background:var(--wash); }
.frame { max-width:1216px; margin:0 auto; padding:34px 32px 60px; display:flex; align-items:flex-start; gap:clamp(20px,4vw,68px); }
nav { display:grid; gap:5px; width:175px; flex:none; position:sticky; top:24px; }
nav button { border:0; background:transparent; border-radius:11px; padding:14px 16px; color:var(--muted); font-weight:600; font-size:14px; line-height:18px; display:flex; align-items:center; gap:13px; text-align:left; }
nav button[aria-current="page"] { color:var(--accent); background:var(--mint); }
nav button:hover { color:var(--accent); }
.ico { display:inline-block; position:relative; width:18px; height:18px; flex-shrink:0; }
.ico:before,.ico:after { content:""; position:absolute; }
.grid:before { width:7px; height:7px; background:currentColor; border-radius:2px; left:1px; top:1px; box-shadow:9px 0,0 9px,9px 9px; }
.receipt:before { inset:0 2px; border:1.6px solid currentColor; border-radius:3px; }
.receipt:after { left:6px; top:6px; height:1.5px; width:6px; background:currentColor; box-shadow:0 4px; }
.person:before { width:6px; height:6px; border:1.6px solid currentColor; border-radius:50%; left:5px; top:0; }
.person:after { border:1.6px solid currentColor; border-radius:8px 8px 3px 3px; width:13px; height:6px; bottom:0; left:1px; }
.box:before { inset:2px 1px 0; border:1.6px solid currentColor; border-radius:3px; }
.box:after { left:2px; right:2px; top:7px; border-top:1.6px solid currentColor; }
main { min-width:0; flex:1; outline:none; }
.page-head,.section-head,.dialog-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.page-head { margin:0 0 22px; }
h1,h2,h3,p { margin:0; }
h1 { font-weight:670; line-height:1.12; font-size:clamp(29px,4vw,48px); letter-spacing:-.059em; }
h2 { font-size:22px; font-weight:650; letter-spacing:-.045em; line-height:1.25; }
h3 { font-size:18px; font-weight:640; letter-spacing:-.025em; }
.period,.number-label { color:var(--muted); font-size:13px; }
.period { flex:none; border:1px solid var(--line); border-radius:40px; padding:6px 11px; }
.hero { position:relative; overflow:hidden; isolation:isolate; color:#f2fff7; background:#103e36; border:1px solid #2e584d; border-radius:20px; padding:27px 30px 31px; }
.hero:before { content:""; position:absolute; z-index:-1; width:60%; height:240%; right:-7%; top:-64%; opacity:.9; transform:rotate(-17deg); background:repeating-radial-gradient(ellipse at 100% 100%, transparent 0 12px,#76d4a947 13px 14px,transparent 15px 21px); }
.hero:after { content:""; z-index:-1; position:absolute; inset:0; background:linear-gradient(100deg,#103e36 15%,#103e36c9 48%,transparent 80%); }
.hero-label { color:#cbebdc; font-weight:530; font-size:14px; }
.hero-total { margin:12px 0 2px; font-size:clamp(35px,6vw,61px); font-weight:620; line-height:1.07; letter-spacing:-.065em; overflow-wrap:anywhere; }
.hero-total small { font-size:.62em; color:#a9ddc3; }
.hero-note { color:#cbebdc; font-size:13px; }
.metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin:12px 0 31px; }
.metric { text-align:left; border:1px solid var(--line); background:var(--panel); border-radius:14px; padding:16px; box-shadow:var(--shadow); }
.metric:hover,.row.action:hover { background:var(--wash); }
.metric span { color:var(--muted); display:block; font-size:13px; }
.metric strong { display:block; margin-top:8px; font-size:clamp(21px,3.5vw,33px); line-height:1.15; letter-spacing:-.055em; font-weight:630; overflow-wrap:anywhere; }
.section-head { margin:0 0 12px; }
.text-btn { background:none; border:0; color:var(--accent); font-weight:620; font-size:14px; padding:9px 0 9px 8px; white-space:nowrap; }
.card { border:1px solid var(--line); border-radius:15px; background:var(--panel); box-shadow:var(--shadow); overflow:hidden; }
.row { padding:15px 17px; display:grid; gap:11px; grid-template-columns:minmax(0,1fr) auto; align-items:center; border:0; width:100%; color:inherit; background:transparent; text-align:left; }
.row+.row { border-top:1px solid var(--line); }
.row-primary,.row-end { display:grid; gap:3px; min-width:0; }
.row-end { justify-items:end; text-align:right; }
.row-title { font-size:15px; line-height:1.35; font-weight:620; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow-wrap:anywhere; }
.row-sub,.row-kicker { font-size:12px; line-height:1.4; color:var(--muted); overflow-wrap:anywhere; }
.row-kicker { letter-spacing:.025em; }
.money { font-weight:650; font-size:16px; font-variant-numeric:tabular-nums; }
.status { display:inline-flex; align-items:center; gap:5px; max-width:100%; padding:3px 7px; border-radius:7px; font-size:11px; line-height:1.4; font-weight:650; color:var(--muted); background:var(--wash); overflow-wrap:anywhere; }
.status:before { content:""; background:currentColor; width:5px; height:5px; border-radius:50%; flex:none; }
.status.good { color:var(--accent); background:var(--mint); }
.status.open { color:var(--amber); background:var(--pale); }
.empty { color:var(--muted); padding:28px 18px; font-size:14px; }
.notice { margin:0 auto; padding:24px; }
.notice p { margin:7px 0 4px; color:var(--muted); }
.tools { display:flex; flex-wrap:wrap; gap:9px; margin-bottom:15px; }
.search { position:relative; flex:1; min-width:min(100%,165px); }
.search:before { content:""; position:absolute; left:15px; top:14px; width:11px; height:11px; border:1.5px solid var(--muted); border-radius:50%; pointer-events:none; }
.search:after { content:""; position:absolute; left:26px; top:26px; width:6px; border-top:1.5px solid var(--muted); transform:rotate(45deg); pointer-events:none; }
.tools input,.tools select,.field input { border:1px solid var(--line); background:var(--panel); border-radius:10px; min-height:44px; padding:9px 11px; font-size:16px; width:100%; }
.tools input { padding-left:39px; }
.tools select { width:auto; max-width:100%; font-size:14px; }
.pager { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:14px; color:var(--muted); font-size:13px; }
.pager-buttons { display:flex; gap:6px; }
.pager button { width:44px; height:42px; border:1px solid var(--line); border-radius:9px; background:var(--panel); font-size:18px; }
dialog { width:min(470px,calc(100% - 24px)); max-height:86vh; max-height:86dvh; color:var(--ink); background:var(--panel); padding:22px; border:1px solid var(--line); border-radius:20px; box-shadow:0 16px 80px #0003; }
dialog::backdrop { background:#0c211dbc; }
body.modal { overflow:hidden; }
.dialog-head { margin-bottom:18px; }
.close { font-size:25px; flex:none; }
.detail-title { margin:13px 0; font-size:22px; letter-spacing:-.025em; line-height:1.3; overflow-wrap:anywhere; }
dl { margin:16px 0 0; }
dl div { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr); gap:10px; padding:12px 0; border-top:1px solid var(--line); font-size:14px; }
dt,.field,.switch-label small { color:var(--muted); }
dd { text-align:right; margin:0; overflow-wrap:anywhere; }
.primary,.secondary { display:block; width:100%; min-height:46px; margin-top:14px; padding:12px 14px; border:0; border-radius:11px; font-weight:630; text-align:center; text-decoration:none; }
.primary { background:#0c5b49; color:#f0fff6; }
.secondary { margin-top:8px; background:var(--wash); color:var(--ink); }
.fields { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.field { display:grid; gap:6px; font-size:13px; }
.field input { color:var(--ink); min-width:0; }
.switch-label { display:flex; align-items:center; gap:12px; padding:15px 0 3px; font-size:14px; }
.switch-label input { accent-color:#007356; width:20px; height:20px; }
.form-error { margin-top:12px; font-size:14px; color:var(--amber); }
.toast { position:fixed; z-index:3; bottom:28px; left:50%; transform:translateX(-50%); max-width:90vw; width:max-content; background:#102f27; color:#f4fffa; border-radius:12px; padding:12px 18px; font-size:14px; }
.toast:empty { display:none; }
@media(max-width:740px) {
  .mast-inner { min-height:62px; padding:0 17px; gap:11px; }
  .mast-caption { padding-left:11px; font-size:12px; }
  .brand { font-size:21px; }
  .brand-mark { width:32px; height:32px; }
  .frame { padding:24px 16px calc(95px + env(safe-area-inset-bottom)); display:block; }
  nav { position:fixed; z-index:2; top:auto; bottom:0; left:0; right:0; width:auto; border-top:1px solid var(--line); background:var(--nav); grid-template-columns:repeat(4,1fr); padding:5px 8px max(6px,env(safe-area-inset-bottom),var(--tg-content-safe-area-inset-bottom,0px)); gap:3px; }
  nav button { min-height:51px; padding:6px 3px; display:grid; justify-items:center; gap:4px; font-size:11px; line-height:1.2; }
  .page-head { margin-bottom:17px; }
  .hero { border-radius:16px; padding:21px; }
  .metrics { gap:6px; margin:8px 0 22px; }
  .metric { padding:11px 9px; border-radius:11px; }
  .metric span { font-size:12px; }
  .metric strong { margin-top:5px; }
  .row { padding:13px 12px; gap:8px; }
  h2 { font-size:20px; }
  .toast { bottom:calc(76px + env(safe-area-inset-bottom)); }
}
@media(max-width:380px) {
  .mast-caption { display:none; }
  .tools select { width:100%; }
  .metric span { font-size:11px; }
  .frame { padding-left:12px; padding-right:12px; }
}
