/* Вариант «Воздух»: светлый серо-зелёный фон, белые группы, одна крупная цифра, синий акцент. */

@font-face {
  font-family: "Onest";
  src: url("fonts/onest-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  src: url("fonts/onest-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  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+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --fg: #17201c;
  --muted: #6e7a74;
  --line: #e2e7e4;
  --accent: #1f5f8b;
  --accent-soft: #e4eef6;
  --on-accent: #ffffff;
  --good: #2e8b57;
  --warn: #c7861a;
  --over: #c2473b;
  --shadow: 0 8px 24px rgba(23, 32, 28, .08);
  --radius: 20px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101413;
    --surface: #1a201e;
    --fg: #e7ecea;
    --muted: #93a09a;
    --line: #29312e;
    --accent: #6fa6d6;
    --accent-soft: #1d2c38;
    --on-accent: #0d1a24;
    --good: #57b07f;
    --warn: #e0a83a;
    --over: #e36b5f;
    --shadow: 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 var(--font);
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main { max-width: 560px; margin: 0 auto; padding: 4px 16px 16px; }
.view, .stack { display: flex; flex-direction: column; gap: 14px; }
h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.group { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; }
.group-head h3 { margin-bottom: 8px; }
.link { background: none; border: none; color: var(--accent); font-size: 14px; font-weight: 500; padding: 0; cursor: pointer; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  max-width: 560px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
}
.month-label {
  font-weight: 600; font-size: 17px; min-width: 128px; text-align: center;
  border: none; background: none; padding: 6px 10px; border-radius: 10px; cursor: pointer;
}
.month-label:hover, .month-label[aria-expanded="true"] { background: var(--surface); }
.month-picker {
  position: absolute; top: calc(100% - 4px); left: 16px; z-index: 20; width: 292px;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 12px;
}
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mp-head .icon-btn { background: var(--bg); }
.mp-head b { font-size: 17px; }
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mp-grid button { border: none; background: var(--bg); border-radius: 12px; padding: 11px 0; font-size: 15px; cursor: pointer; }
.mp-grid button.now { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); font-weight: 600; }
.mp-grid button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.mp-today { display: block; margin: 12px auto 2px; }
.spacer { flex: 1; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.avatars { display: flex; border: none; background: none; padding: 0; cursor: pointer; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 600; border: 2px solid var(--bg); background: var(--line); color: var(--muted); }
.avatar.on { background: var(--accent); color: var(--on-accent); }
.avatar + .avatar { margin-left: -8px; }

/* ---------- главная ---------- */
.today { background: var(--surface); border-radius: 24px; padding: 18px 18px 16px; }
.today .lbl { font-size: 14px; color: var(--muted); }
.today .big { font-size: 44px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; margin: 4px 0 6px; }
.today .big.neg { color: var(--over); }
.today .sub { font-size: 14px; color: var(--muted); }
.today .btn { margin-top: 12px; }

.month-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); position: relative; margin: 10px 0 8px; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); max-width: 100%; }
.bar > i.over { background: var(--over); }
.bar > em { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; background: var(--fg); opacity: .45; }
.split { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }

.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cat-row:first-of-type { border-top: none; padding-top: 2px; }
.cat-row .name { font-weight: 500; min-width: 0; }
.cat-row .st { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.mini { height: 5px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.mini > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--good); }
.warning .mini > i { background: var(--warn); } .warning .tag { color: var(--warn); }
.over .mini > i { background: var(--over); } .over .tag { color: var(--over); }
.tag { white-space: nowrap; }

.tx { display: flex; align-items: center; gap: 12px; padding: 9px 0; width: 100%; background: none; border: none; text-align: left; cursor: pointer; }
.tx + .tx { border-top: 1px solid var(--line); }
.cat-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; color: #fff; background: var(--c, var(--accent)); flex: none; }
.tx .t { flex: 1; min-width: 0; }
.tx .t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tx .t small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .num { font-weight: 500; }
.empty { color: var(--muted); font-size: 15px; text-align: center; padding: 18px 8px; }

/* ---------- траты ---------- */
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 4px 4px 6px; }
.day-head:first-letter { text-transform: uppercase; }
.list-day { display: flex; flex-direction: column; }
.list-day .group { padding-block: 4px; }

/* ---------- сегменты, кнопки, поля ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--line); border-radius: 14px; padding: 3px; }
.seg button { border: none; background: none; padding: 9px 8px; border-radius: 11px; color: var(--muted); cursor: pointer; font-size: 15px; }
.seg button.on { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: transparent; color: var(--over); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .6; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); font-size: 16px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* ---------- форма траты ---------- */
.edit-head { display: flex; align-items: center; gap: 6px; padding-top: calc(8px + env(safe-area-inset-top)); }
.edit-head h2 { margin: 0; font-size: 19px; }
.back { border: none; background: none; padding: 6px; margin-left: -6px; cursor: pointer; display: grid; place-items: center; }
.warning-box { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.amount-box { background: var(--surface); border-radius: 24px; padding: 16px 18px; }
.amount-box .merchant { font-weight: 600; font-size: 17px; }
.amount-wrap { display: flex; align-items: baseline; gap: 6px; }
.amount-wrap input {
  border: none; background: none; padding: 0; min-height: 0; font-size: 44px; font-weight: 600;
  letter-spacing: -0.025em; width: 100%;
}
.amount-wrap span { font-size: 30px; font-weight: 600; color: var(--muted); }
@supports (field-sizing: content) { .amount-wrap input { field-sizing: content; width: auto; min-width: 1.2ch; max-width: 100%; } }
.src-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 8px 14px; font-size: 15px; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.more { color: var(--accent); }

.details summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 15px; }
.details summary::-webkit-details-marker { display: none; }
.details summary svg { width: 18px; height: 18px; transition: transform .15s; }
.details[open] summary svg { transform: rotate(180deg); }
.details[open] summary { margin-bottom: 12px; }
.details .fields { display: flex; flex-direction: column; gap: 10px; }

.item-row { display: grid; grid-template-columns: 1fr 96px; gap: 6px 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.item-row:first-of-type { border-top: none; padding-top: 0; }
.item-row input, .item-row select { min-height: 40px; font-size: 15px; padding: 8px 10px; }
.item-row .item-cat { display: flex; gap: 8px; grid-column: 1 / -1; }
.item-row .item-cat select { flex: 1; min-width: 0; }
.item-row .item-note { flex: 1; align-self: center; font-size: 14px; color: var(--muted); }
.item-row .remove { border: none; background: none; color: var(--muted); cursor: pointer; padding: 0 6px; }
.items-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.receipt-file img { display: block; max-width: 100%; max-height: 240px; border-radius: 14px; margin: 0 auto; }

.save-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.save-bar .inner { max-width: 528px; margin: 0 auto; display: flex; gap: 8px; }
.save-bar .primary { flex: 1; min-height: 54px; font-size: 17px; border-radius: 16px; }

/* ---------- аналитика ---------- */
.summary { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.summary .big { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.people { display: flex; flex-direction: column; gap: 2px; font-size: 14px; text-align: right; }
.cat-row details summary { list-style: none; cursor: pointer; }
.cat-toggle { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; width: 100%;
  padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.cat-toggle .name::after { content: "›"; display: inline-block; margin-left: 6px; color: var(--muted); transition: transform .15s; }
.cat-row.open .cat-toggle .name::after { transform: rotate(90deg); }
.cat-lines { grid-column: 1 / -1; display: flex; flex-direction: column; margin-top: 6px; }
.cat-line { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 0 8px 12px; border: none;
  border-top: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.cat-line .t { flex: 1; min-width: 0; font-size: 14px; }
.cat-line .t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-line small { color: var(--muted); font-size: 12px; }
.cat-line .num { font-size: 14px; white-space: nowrap; }
.subs { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; padding: 4px 0 0 14px; font-size: 14px; color: var(--muted); }
.subs div { display: flex; justify-content: space-between; gap: 8px; }
.cat-row .who { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 4px; text-align: right; border-top: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; border-top: none; }
th:first-child, td:first-child { text-align: left; }
tr.is-today td { color: var(--accent); font-weight: 600; }
.neg { color: var(--over); }

/* ---------- ещё ---------- */
.plan-entry { display: grid; grid-template-columns: 1fr 110px 32px; gap: 6px; margin-bottom: 8px; }
.plan-entry select { grid-column: 1 / 3; margin-bottom: 4px; }
.plan-entry input, .plan-entry select { min-height: 42px; font-size: 15px; padding: 8px 10px; }
.plan-entry .remove { grid-row: 1; grid-column: 3; border: none; background: none; color: var(--muted); cursor: pointer; }
.plan-total { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 4px 0 12px; }
.plan-title { margin: 0 0 14px; font-size: 19px; }
.flow > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 15px; }
.flow .flow-free { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 17px; font-weight: 600; }
.flow .muted { font-size: 14px; }
.alloc-head {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 2;
  background: var(--surface); margin: -14px -16px 12px; padding: 14px 16px 10px;
  border-radius: var(--radius) var(--radius) 0 0; border-bottom: 1px solid var(--line);
}
.alloc-head > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.alloc-head b { font-size: 22px; }
.alloc-head .hint { margin: 0; font-size: 13px; }
.alloc-head.over b, .alloc-head.over #alloc-label { color: var(--over); }
.alloc-head.over .bar > i { background: var(--over); }
.alloc-row { display: grid; grid-template-columns: 1fr 130px; gap: 10px; align-items: center; padding: 5px 0; font-size: 15px; }
.alloc-row input { min-height: 40px; padding: 6px 10px; font-size: 15px; text-align: right; }
.plan-save { width: 100%; min-height: 52px; }
.limit-row { display: grid; grid-template-columns: 1fr 104px auto; gap: 8px; align-items: center; padding: 6px 0; font-size: 15px; }
.limit-row input { min-height: 38px; padding: 6px 10px; font-size: 15px; }
.limit-row label { display: flex; gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.limit-row input[type=checkbox] { width: 18px; min-height: 0; }
.ok-line { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.ok-line svg { color: var(--good); }

/* ---------- нижняя панель ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
@media (min-width: 560px) { .tabbar { border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: none; } }
.tabbar button { border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.tabbar button.on { color: var(--accent); font-weight: 600; }
.fab-slot { padding: 0 !important; }
.fab { width: 58px; height: 58px; border-radius: 20px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; margin-top: -26px; box-shadow: var(--shadow); }
.fab svg { width: 26px; height: 26px; }

/* ---------- шторка «добавить» ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 16, 14, .4); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 6px; }
.sheet-option {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--surface); border: none; border-radius: 18px; padding: 16px; cursor: pointer;
}
.sheet-option svg { width: 26px; height: 26px; color: var(--accent); }
.sheet-option b { display: block; font-size: 16px; }
.sheet-option small { color: var(--muted); font-size: 13px; }
.sheet-option.primary { background: var(--accent); color: var(--on-accent); }
.sheet-option.primary svg, .sheet-option.primary small { color: var(--on-accent); opacity: .9; }
.sheet-status { text-align: center; color: var(--muted); margin: 4px 0 0; }

/* ---------- сканер QR ---------- */
.scanner { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute; left: 50%; top: 45%; width: min(72vw, 72vh, 340px); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 26px;
  border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
}
.scan-top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 0;
}
.scan-btn { width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; cursor: pointer; }
.scan-btn.on { background: #fff; color: #000; }
.scan-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  padding: 0 24px calc(28px + env(safe-area-inset-bottom));
}
.scan-bottom p { margin: 0 0 16px; font-size: 17px; font-weight: 500; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.scan-alt { display: inline-block; padding: 12px 18px; border-radius: 14px; background: rgba(255, 255, 255, .16); cursor: pointer; font-size: 15px; }

/* ---------- план ---------- */
.plan-intro h2 { margin: 4px 0 2px; font-size: 22px; }
.plan-intro .hint { margin: 0; }
.step-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.step-head h3 { margin: 4px 0 2px; font-size: 16px; color: var(--fg); text-transform: none; letter-spacing: 0; }
.step-head .hint { margin: 0; font-size: 13px; }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.entry-row { display: grid; grid-template-columns: 1fr 112px 28px; gap: 8px; align-items: center; padding: 4px 0; }
.entry-row input { min-height: 42px; padding: 8px 10px; font-size: 15px; }
.entry-row input.num { text-align: right; }
.entry-row .entry-name { font-size: 15px; }
.entry-row .remove { border: none; background: none; color: var(--muted); cursor: pointer; padding: 0; display: grid; place-items: center; }
.entry-row .remove svg { width: 18px; height: 18px; }
.chip-input { display: inline-flex; align-items: center; gap: 4px; }
.chip-input input { width: 46px; min-height: 0; padding: 2px 4px; border: none; background: transparent; text-align: center; font-size: 15px; color: inherit; }
.chip-input.on input { color: var(--on-accent); }
.plan-result { background: var(--accent); color: var(--on-accent); border-radius: 24px; padding: 18px; }
.plan-result .lbl { font-size: 14px; opacity: .85; }
.plan-result .big { font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.plan-result .sub { font-size: 14px; opacity: .85; }
.alloc-line { background: var(--accent-soft); color: var(--fg); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.alloc-line.over { background: color-mix(in srgb, var(--over) 16%, var(--surface)); color: var(--over); }
.add-limit { margin-top: 10px; }
.save-state { text-align: center; color: var(--muted); font-size: 13px; margin: 0; min-height: 18px; }
.save-state.error { color: var(--over); }
.details summary small { font-size: 13px; }

/* ---------- управление категориями ---------- */
.cat-manage-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 0;
  background: none; border: none; border-top: 1px solid var(--line); text-align: left; cursor: pointer; font-size: 15px;
}
.cat-manage-row:first-of-type { border-top: none; }
.cat-manage-row .cat-ic { width: 32px; height: 32px; font-size: 13px; }
.cat-manage-name { flex: 1; min-width: 0; }
.cat-manage-row .chev { width: 16px; height: 16px; color: var(--muted); }
.cat-manage-edit {
  display: flex; flex-direction: column; gap: 10px; margin: 6px -8px; padding: 12px;
  background: var(--bg); border-radius: 14px;
}
.cat-manage-edit .hint { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; flex-wrap: wrap; }
.check input { width: 20px; min-height: 0; height: 20px; }
.check .hint { font-size: 13px; }
.btn.danger-fill { background: var(--over); color: #fff; }
.cat-archived { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }

/* ---------- без категории ---------- */
.uncat-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.uncat-row:first-of-type { border-top: none; }
.uncat-row .t { min-width: 0; }
.uncat-row .t div { font-weight: 500; overflow-wrap: anywhere; }
.uncat-row .t small { color: var(--muted); font-size: 13px; }
.uncat-row select { grid-column: 1 / -1; min-height: 40px; font-size: 15px; padding: 8px 10px; }

/* ---------- уведомление ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--fg); color: var(--bg); padding: 11px 16px; border-radius: 14px;
  font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px; width: max-content;
}
.toast button { border: none; background: none; color: var(--accent-soft); font-weight: 600; font-size: 14px; padding: 4px 0; cursor: pointer; white-space: nowrap; }

@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) .sheet-panel { animation: rise .2s ease-out; }
  .toast:not([hidden]) { animation: fade .2s ease-out; }
  @keyframes rise { from { transform: translateY(30px); opacity: 0; } }
  @keyframes fade { from { opacity: 0; } }
}

/* ---------- вход и аккаунты ---------- */
.auth { padding-top: calc(48px + env(safe-area-inset-top)); max-width: 420px; margin: 0 auto; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-head img { border-radius: 14px; }
.auth-head h1 { margin: 0; font-size: 24px; }
.auth-lead { margin: 0; font-size: 15px; }
.auth .btn.primary { margin-top: 4px; }
.auth .link { align-self: center; }
.members { display: flex; flex-direction: column; margin-bottom: 12px; }
.members > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.members > div:first-child { border-top: none; padding-top: 0; }
.members small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-box { display: flex; flex-direction: column; gap: 8px; }
.invite-box input { font-size: 13px; }
.admin-acc { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.admin-acc > div { min-width: 0; }
.admin-acc .link { white-space: nowrap; }
.admin-acc .ok-line { margin: 6px 0 0; }

/* ---------- обучающие карточки ---------- */
body.no-scroll { overflow: hidden; }
.onboarding {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(20px + env(safe-area-inset-bottom));
}
.onb-skip { align-self: flex-end; margin-right: 16px; background: none; border: none; color: var(--muted); font-size: 15px; padding: 8px; cursor: pointer; }
.onb-track {
  flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.onb-track::-webkit-scrollbar { display: none; }
.onb-card {
  flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 0 32px; box-sizing: border-box;
}
.onb-card > * { max-width: 420px; }
.onb-icon {
  width: 104px; height: 104px; border-radius: 32px; display: grid; place-items: center; margin-bottom: 28px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent);
}
.onb-icon svg { width: 52px; height: 52px; stroke-width: 1.6; }
.onb-card h2 { margin: 0 0 12px; font-size: 24px; }
.onb-card p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }
.onb-dots { display: flex; justify-content: center; gap: 8px; margin: 12px 0 20px; }
.onb-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: width .2s, background .2s; }
.onb-dots i.on { width: 22px; border-radius: 4px; background: var(--accent); }
.onb-actions { display: flex; flex-direction: column; gap: 10px; padding: 0 24px; max-width: 420px; width: 100%; margin: 0 auto; box-sizing: border-box; }

/* ---------- широкий экран (компьютер): боковое меню и две колонки ---------- */
/* .cols/.col на телефоне «прозрачны» — блоки идут одной лентой, как раньше. */
.cols, .col { display: contents; }

@media (min-width: 1000px) {
  :root { --side: 232px; }
  body { padding-left: var(--side); padding-bottom: 32px; }
  main { max-width: 1120px; padding: 4px 32px 32px; }
  .topbar { max-width: 1120px; padding-left: 32px; padding-right: 32px; }
  .month-picker { left: 32px; }

  .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .cols-wide-right { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .col { display: flex; flex-direction: column; gap: 14px; }

  /* списки и формы — одной колонкой по центру: так их удобнее читать, а блоки не перепрыгивают при раскрытии */
  #view-list, #view-edit, #view-settings { width: 100%; max-width: 760px; margin: 0 auto; }
  #view-auth { width: 100%; max-width: 420px; margin: 0 auto; }

  /* нижняя панель → боковое меню */
  .tabbar {
    top: 0; right: auto; width: var(--side); max-width: none; margin: 0;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    border: none; border-right: 1px solid var(--line); border-radius: 0;
    padding: calc(22px + env(safe-area-inset-top)) 14px 22px;
  }
  .tabbar::before { content: "Бюджет"; order: -2; font-weight: 700; font-size: 20px; padding: 4px 12px 16px; }
  .tabbar button { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 12px; border-radius: 12px; }
  .tabbar button:hover { background: var(--bg); }
  .tabbar button.on { background: var(--accent-soft); }
  .tabbar .fab-slot { order: -1; margin-bottom: 14px; }
  .tabbar .fab-slot:hover { background: none; }
  .fab { width: 100%; height: 48px; margin-top: 0; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: none; font-size: 15px; font-weight: 600; }
  .fab::after { content: "Добавить трату"; }
  .fab svg { width: 20px; height: 20px; }

  /* шторка «добавить» — окно посередине */
  .sheet-panel { inset: 0; margin: auto; width: 460px; height: fit-content; border-radius: 24px; padding: 18px; }
  .sheet-grip { display: none; }
}

/* ---------- план: остаток с прошлого месяца и категории ---------- */
.carry-row .entry-name { color: var(--muted); font-size: 14px; }
.carry-row input { font-weight: 600; }
.cats-in-plan { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.cats-in-plan > summary { font-size: 15px; color: var(--accent); font-weight: 500; }

/* ---------- окно-вопрос ---------- */
.confirm { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; }
.confirm[hidden] { display: none; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(10, 16, 14, .45); }
.confirm-box {
  position: relative; width: 100%; max-width: 360px; background: var(--surface); border-radius: 24px;
  padding: 22px 20px 18px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.confirm-box h2 { margin: 0 0 8px; font-size: 19px; }
.confirm-box p { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
@media (prefers-reduced-motion: no-preference) {
  .confirm:not([hidden]) .confirm-box { animation: pop .16s ease-out; }
  @keyframes pop { from { transform: scale(.94); opacity: 0; } }
}
