/* «Деньги» — design tokens and components from reference/ui-reference.html, app shell for phone first. */

/* ---------- fonts (local, cyrillic + latin) ---------- */
@font-face { font-family: "Golos Text"; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url(../fonts/golos-text-cyrillic-wght.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url(../fonts/golos-text-latin-wght.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(../fonts/unbounded-cyrillic-wght.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url(../fonts/unbounded-latin-wght.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(../fonts/ibm-plex-mono-cyrillic-400.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 400;
  src: url(../fonts/ibm-plex-mono-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(../fonts/ibm-plex-mono-cyrillic-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 500;
  src: url(../fonts/ibm-plex-mono-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(../fonts/ibm-plex-mono-cyrillic-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 600;
  src: url(../fonts/ibm-plex-mono-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+20BD, U+2122, U+2212; }

/* ---------- tokens ---------- */
:root {
  --bg: #EDF0EC; --surface: #FFFFFF; --surface-2: #F5F7F4; --ink: #15201A; --muted: #5B6962; --faint: #8C9992;
  --line: #D4DBD5; --accent: #2446A3; --accent-soft: #E2E8F8; --ok: #1F7546; --ok-soft: #DFF1E6;
  --warn: #935700; --warn-soft: #FAEDD6; --bad: #B0261B; --bad-soft: #FAE3E0; --taxi: #D99A00;
  --job: #8A9892; --sleep: #33476B; --free: #C7DFCF; --plate-bg: #FFFFFF; --plate-ink: #111111;
  --f-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111613; --surface: #192019; --surface-2: #1E2620; --ink: #E5ECE7; --muted: #A0ADA6; --faint: #74817A;
    --line: #2C3630; --accent: #93AAFF; --accent-soft: #23305A; --ok: #6FD39A; --ok-soft: #173826;
    --warn: #F1B657; --warn-soft: #3D2C10; --bad: #FF8E83; --bad-soft: #42201C; --taxi: #F0B429;
    --job: #66756E; --sleep: #4D67A0; --free: #2F4A39; --plate-bg: #F2F2F2; --plate-ink: #111111;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111613; --surface: #192019; --surface-2: #1E2620; --ink: #E5ECE7; --muted: #A0ADA6; --faint: #74817A;
  --line: #2C3630; --accent: #93AAFF; --accent-soft: #23305A; --ok: #6FD39A; --ok-soft: #173826;
  --warn: #F1B657; --warn-soft: #3D2C10; --bad: #FF8E83; --bad-soft: #42201C; --taxi: #F0B429;
  --job: #66756E; --sleep: #4D67A0; --free: #2F4A39; --plate-bg: #F2F2F2; --plate-ink: #111111;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(22px, 5vw, 32px); line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-family: var(--f-display); font-weight: 500; font-size: clamp(17px, 3vw, 21px); line-height: 1.2; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.note { font-size: 13px; color: var(--muted); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
#app { min-height: 100vh; }
.view { max-width: 760px; margin: 0 auto; padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 14px; }
.view.wide { max-width: 1100px; }
.vhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: max(4px, env(safe-area-inset-top, 0px)); }
.vhead .sub { font-size: 13px; color: var(--muted); }
.vhead .tools { display: flex; gap: 8px; flex-wrap: wrap; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar nav { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: 11.5px; font-weight: 600; min-height: 44px; }
.tabbar a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a.big .ic { width: 50px; height: 50px; border-radius: 16px; background: var(--accent); color: var(--surface);
  display: flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.tabbar a.big.live .ic { background: var(--taxi); color: #111; }
.tabbar a.big svg { width: 26px; height: 26px; }

@media (min-width: 1024px) {
  .tabbar { top: 0; right: auto; width: 220px; border-top: 0; border-right: 1px solid var(--line); padding: 20px 10px; }
  .tabbar nav { display: flex; flex-direction: column; height: auto; gap: 4px; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14.5px; padding: 8px 12px; border-radius: 10px; }
  .tabbar a[aria-current="page"] { background: var(--accent-soft); }
  .tabbar a.big .ic { width: 32px; height: 32px; margin: 0; border-radius: 10px; box-shadow: none; }
  .tabbar a.big svg { width: 20px; height: 20px; }
  .tabbar .side-more { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
  body { padding-left: 220px; }
  .view { max-width: 900px; padding: 24px 28px 40px; }
  .toasts { bottom: 20px; }
}
.tabbar .side-more { display: none; }
@media (min-width: 1024px) { .tabbar .side-more { display: flex; } }

/* ---------- cards, stats ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card > header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card.flat { padding: 0; overflow: hidden; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.stat.bad .v { color: var(--bad); } .stat.good .v { color: var(--ok); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.kv > :nth-child(even) { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- alerts ---------- */
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.alert::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--faint); }
.alert.danger { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.alert.danger::before { background: var(--bad); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.alert.warn::before { background: var(--warn); }
.alert.info::before { background: var(--accent); }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 10px; padding: 8px 14px; min-height: 40px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.btn.primary:hover { filter: brightness(1.08); color: var(--surface); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; min-height: 50px; font-size: 16px; }
.btn.huge { width: 100%; min-height: 88px; font-size: 20px; font-family: var(--f-display); font-weight: 600; border-radius: 18px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.pay { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: var(--ok-soft); min-height: 36px; }
.iconbtn { border: 0; background: transparent; cursor: pointer; min-width: 44px; min-height: 44px; border-radius: 10px; color: var(--muted); font-size: 20px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea, input.inp, select.inp {
  font-size: 16px; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); width: 100%; }
.field textarea { min-height: 70px; resize: vertical; }
.money-in { position: relative; }
.money-in input { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; padding-right: 34px; }
.money-in::after { content: "₽"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.money-in.big input { font-size: 24px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.field { overflow-wrap: anywhere; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: 7px 12px; min-height: 36px; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; min-height: 36px; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.live-calc { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.live-calc b { font-family: var(--f-mono); font-size: 17px; }
.err { color: var(--bad); font-size: 13.5px; }

/* ---------- chips / labels from the reference ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.chip.t1 { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.chip.t2 { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); background: var(--ok-soft); }
.chip.t4 { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); background: var(--bad-soft); }
.chip.t5 { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); background: var(--warn-soft); }
.pm { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
.pm::before { content: ""; width: 12px; height: 8px; border-radius: 2px; display: inline-block; }
.pm.pm-card_tbank { color: var(--accent); background: var(--accent-soft); }
.pm.pm-card_tbank::before { background: linear-gradient(var(--accent) 0 30%, transparent 30%); border: 1px solid var(--accent); }
.pm.pm-card_sber { color: var(--ok); background: var(--ok-soft); }
.pm.pm-card_sber::before { background: linear-gradient(var(--ok) 0 30%, transparent 30%); border: 1px solid var(--ok); }
.pm.pm-debit { color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); }
.pm.pm-debit::before { background: var(--ink); }
.pm.pm-split, .pm.pm-roll { color: var(--warn); background: var(--warn-soft); }
.pm.pm-split::before, .pm.pm-roll::before { border: 1px dashed var(--warn); }
.late { font-family: var(--f-mono); font-size: 12px; font-weight: 600; padding: 0 6px; border-radius: 4px; white-space: nowrap; }
.late.mid { color: var(--warn); background: var(--warn-soft); }
.late.hi { color: var(--bad); background: var(--bad-soft); }
.late.ok { color: var(--ok); background: var(--ok-soft); }
.plate { display: inline-flex; align-items: stretch; border: 1.5px solid var(--plate-ink); border-radius: 4px; background: var(--plate-bg); color: var(--plate-ink); font-family: var(--f-mono); font-size: 11.5px; font-weight: 600; line-height: 1; overflow: hidden; vertical-align: 1px; white-space: nowrap; }
.plate b { padding: 3px 6px 2px; font-weight: 600; }
.plate i { font-style: normal; font-size: 7px; letter-spacing: 0.04em; border-left: 1.5px solid var(--plate-ink); padding: 2px 3px 1px; display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 1px; }
.plate i::after { content: ""; width: 10px; height: 4px; background: linear-gradient(#fff 0 33%, #1c55c7 33% 66%, #d52b1e 66%); border: 0.5px solid #999; }
.st { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.st.yes { color: var(--ok); background: var(--ok-soft); }
.st.part { color: var(--warn); background: var(--warn-soft); }
.st.no { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }
.st.bad { color: var(--bad); background: var(--bad-soft); }

/* ---------- payment rows ---------- */
.pays { display: flex; flex-direction: column; }
.pay { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 11px 2px; border-top: 1px solid var(--line); }
.pay:first-child { border-top: 0; }
.p-date { font-family: var(--f-mono); font-variant-numeric: tabular-nums; display: flex; flex-direction: column; line-height: 1.2; }
.p-date b { font-weight: 600; font-size: 15px; }
.p-date span { font-size: 12px; color: var(--muted); }
.p-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.p-name { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.p-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.p-tip { font-size: 13px; color: var(--muted); max-width: 72ch; }
.p-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.p-amt { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.p-amt small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.pay.is-paid .p-name, .pay.is-paid .p-amt { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.pay.is-paid .p-tip { display: none; }
.pay.is-info .p-amt { color: var(--muted); font-weight: 500; }
.pay.is-today { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); border-radius: 8px; }
.pay.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
@media (max-width: 480px) { .pay { grid-template-columns: 46px minmax(0, 1fr); } .p-right { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; } }
details.month { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
details.month > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 14px; }
details.month > summary::-webkit-details-marker { display: none; }
details.month > summary h3 { font-family: var(--f-display); font-weight: 500; font-size: 16px; }
details.month > summary h3::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
details.month[open] > summary h3::before { transform: rotate(90deg); }
.m-sum { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); }
.m-sum b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.m-body { padding: 0 12px 8px; }

/* allocation */
.al { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.al:first-child { border-top: 0; }
.al .nm { font-weight: 500; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.al .mt { font-size: 12.5px; color: var(--muted); grid-column: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.al .rt { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.al .am { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.rest-line { font-size: 13.5px; color: var(--muted); padding-top: 8px; border-top: 1px dashed var(--line); }

/* progress bars */
.prog { display: flex; flex-direction: column; gap: 4px; }
.prog .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.prog .lbl b { font-family: var(--f-mono); color: var(--ink); }
.prog .track { height: 10px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; position: relative; }
.prog .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 6px; }
.prog .fill.taxi { background: var(--taxi); }
.prog .fill.ok { background: var(--ok); }
.prog .fill.bad { background: var(--bad); }
.prog .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }

/* tasks */
.todo { display: flex; flex-direction: column; }
.todo label { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; }
.todo label:first-child { border-top: 0; }
.todo input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ok); }
.todo .tt { font-weight: 500; }
.todo .td { font-size: 13px; color: var(--muted); }
.todo label.done .tt { text-decoration: line-through; color: var(--faint); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-width: 100%; min-width: 0; }
td input.inp { min-width: 52px; min-height: 40px; padding: 6px; font-size: 15px; text-align: right; font-family: var(--f-mono); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); white-space: nowrap; }
td.n, th.n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.cur td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
tr.sum td { font-weight: 600; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- calendar ---------- */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav h3 { font-family: var(--f-display); font-weight: 500; font-size: 17px; min-width: 10ch; text-align: center; }
.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.grid7 .wd { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: 0.05em; }
.day { position: relative; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 4px 5px; min-height: 64px; display: flex; flex-direction: column; gap: 1px; cursor: pointer; text-align: left; min-width: 0; color: var(--ink); }
.day.empty { background: transparent; border-color: transparent; cursor: default; }
.day .dn { display: flex; justify-content: space-between; align-items: baseline; gap: 2px; }
.day .dn b { font-family: var(--f-mono); font-size: 13.5px; }
.day .dj { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .dh { font-family: var(--f-mono); font-weight: 600; font-size: 13px; }
.day .df { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.day .dp { margin-top: auto; font-size: 10.5px; font-weight: 600; color: var(--accent); }
.day.l1 { background: color-mix(in srgb, var(--taxi) 10%, var(--surface)); }
.day.l2 { background: color-mix(in srgb, var(--taxi) 22%, var(--surface)); }
.day.l3 { background: color-mix(in srgb, var(--taxi) 36%, var(--surface)); }
.day.rest { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.day.rest .dh { color: var(--ok); }
.day.under { border: 2px solid var(--warn); }
.day.met { border: 2px solid var(--ok); }
.day.today { box-shadow: 0 0 0 2px var(--accent); }
.day.sel { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (min-width: 700px) { .day { min-height: 90px; padding: 6px 7px; } .day .dh { font-size: 15px; } .day .dj { font-size: 10.5px; } }
@media (max-width: 420px) { .day .dj { display: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid var(--line); }
.legend i.c-rest { background: var(--ok-soft); }
.legend i.c-l1 { background: color-mix(in srgb, var(--taxi) 10%, var(--surface)); }
.legend i.c-l2 { background: color-mix(in srgb, var(--taxi) 22%, var(--surface)); }
.legend i.c-l3 { background: color-mix(in srgb, var(--taxi) 36%, var(--surface)); }
.legend i.c-under { border: 2px solid var(--warn); }
.legend i.c-met { border: 2px solid var(--ok); }

/* schedule timeline */
.tl { display: flex; flex-direction: column; gap: 10px; }
.tl-scale, .tl-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.tl-scale .ticks { position: relative; height: 16px; font-family: var(--f-mono); font-size: 10.5px; color: var(--faint); }
.tl-scale .ticks span { position: absolute; transform: translateX(-50%); }
.tl-day { font-weight: 600; font-size: 14px; line-height: 1.2; }
.bar { position: relative; height: 22px; border-radius: 5px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar span { position: absolute; top: 0; bottom: 0; }
.b-taxi { background: var(--taxi); }
.b-win { background: repeating-linear-gradient(135deg, var(--taxi) 0 5px, color-mix(in srgb, var(--taxi) 45%, var(--job)) 5px 10px); }
.b-job { background: var(--job); }
.b-nap { background: color-mix(in srgb, var(--sleep) 45%, var(--surface-2)); }
.b-sleep { background: var(--sleep); }
.b-free { background: var(--free); }
.legend i.b-taxi, .legend i.b-win, .legend i.b-job, .legend i.b-nap, .legend i.b-sleep, .legend i.b-free { border: 0; }
.tl-h { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; font-size: 12.5px; white-space: nowrap; }
.tl-note { font-size: 12.5px; color: var(--muted); grid-column: 1 / span 3; margin-top: -4px; }
@media (min-width: 600px) { .tl-scale, .tl-row { grid-template-columns: 60px minmax(0, 1fr) 54px; gap: 10px; } .tl-note { grid-column: 2 / span 2; } .tl-h { font-size: 14px; } }

/* rent grid */
.rent-grid { display: grid; grid-template-columns: 62px repeat(7, minmax(0, 1fr)); gap: 3px; align-items: center; }
@media (min-width: 600px) { .rent-grid { grid-template-columns: 110px repeat(7, minmax(0, 1fr)); gap: 5px; } }
.rent-grid .hd { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; }
.rent-grid .car { font-size: 12.5px; line-height: 1.2; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcell { min-height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0; }
.rcell.paid { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.rcell.unpaid { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.rcell.idle { background: var(--surface-2); color: var(--faint); text-decoration: line-through; }
.rcell.today { box-shadow: 0 0 0 2px var(--accent); }

/* charts */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--f-mono); font-size: 11px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .l-plan { stroke: var(--faint); stroke-width: 2; fill: none; stroke-dasharray: 5 4; }
.chart .l-fact { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.chart .l-cash { stroke: var(--ok); stroke-width: 2; fill: none; }
.chart .dot-fact { fill: var(--accent); }
.chart .bar-plan { fill: var(--line); }
.chart .bar-fact { fill: var(--accent); }
.chart .bar-ok { fill: var(--ok); }
.chart .bar-bad { fill: var(--bad); }
.chart .ref { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 3 3; }

/* timer */
.timer { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 54px; font-weight: 600; text-align: center; line-height: 1; letter-spacing: -0.02em; }
.timer-sub { text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- sheets, toasts ---------- */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 15, 12, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(16px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 0; }
.sheet .sh-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet .sh-head h2 { font-size: 18px; }
.sheet .sh-foot { position: sticky; bottom: calc(-16px - var(--safe-b)); background: var(--surface); padding-top: 8px; padding-bottom: 4px; display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 18px; padding-bottom: 16px; } .sheet .grab { display: none; } }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--ink); color: var(--surface); border-radius: 12px; padding: 10px 14px; font-size: 14px; display: flex; align-items: center; gap: 14px; max-width: 520px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: up .2s; }
.toast.bad { background: var(--bad); }
.toast button { border: 0; background: transparent; color: var(--taxi); font-weight: 700; cursor: pointer; min-height: 32px; padding: 0 4px; }
.netbar { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: var(--bad); color: #fff; text-align: center; font-size: 14px; padding: 8px 12px calc(8px); display: flex; justify-content: center; gap: 12px; align-items: center; }
.netbar button { border: 1px solid #fff; background: transparent; color: #fff; border-radius: 8px; padding: 2px 10px; cursor: pointer; }
.empty-state { text-align: center; color: var(--muted); padding: 18px 8px; font-size: 14px; }
.loading { color: var(--faint); padding: 24px; text-align: center; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; gap: 16px; padding: 22px; }
.login h1 { font-size: 26px; }

/* menu */
.menu { display: flex; flex-direction: column; }
.menu a, .menu button { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 4px; min-height: 52px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 500; cursor: pointer; text-align: left; width: 100%; }
.menu > :first-child { border-top: 0; }
.menu .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.menu .arr { color: var(--faint); }

/* help */
.help ol, .help ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.help ol li::marker { font-family: var(--f-mono); font-weight: 600; color: var(--accent); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.qr svg { width: 200px; height: auto; display: block; background: #fff; padding: 8px; border-radius: 8px; }
