/* Палитры: Paper (светлая) и Graphite (тёмная). Тема — авто по системе или выбранная в настройках */
:root {
  --bg: #E8E7E2;
  --card: #F6F5F0;
  --card-2: #ECEBE5;
  --text: #151616;
  --muted: #6E706C;
  --faint: #B3B4AF;
  --line: rgba(21, 22, 22, 0.12);
  --accent: #151616;
  --accent-soft: rgba(21, 22, 22, 0.07);
  --on-accent: #F6F5F0;
  --income: #2F9E6B;
  --income-soft: rgba(47, 158, 107, 0.12);
  --expense: #151616;
  --expense-soft: rgba(21, 22, 22, 0.06);
  --debt: #151616;
  --debt-soft: rgba(21, 22, 22, 0.1);
  --shadow: none;
  --radius: 20px;
  --tabbar-h: 60px;
  /* плитки приборной панели */
  --tile: #161717;
  --tile-2: #202222;
  --ink: #F1EFE8;
  --ink-2: #9A9C98;
  --ink-3: #5E615E;
  --dim: #2B2D2C;
  --mint: #9FE2BF;
  --bar-bg: rgba(22, 23, 23, 0.92);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="paper"]) {
    --bg: #0C0D0D; --card: #1D1F1E; --card-2: #262827; --text: #ECEAE3; --muted: #7F827E; --faint: #4A4C4A;
    --line: rgba(255, 255, 255, 0.08); --accent: #ECEAE3; --accent-soft: rgba(236, 234, 227, 0.1); --on-accent: #151616;
    --income: #9FE2BF; --income-soft: rgba(159, 226, 191, 0.14); --expense: #ECEAE3; --expense-soft: rgba(255, 255, 255, 0.06);
    --debt: #ECEAE3; --debt-soft: rgba(255, 255, 255, 0.1);
    --tile: #171818; --tile-2: #212323; --ink-2: #8F928E; --ink-3: #595C59; --dim: #2A2C2B; --bar-bg: rgba(30, 32, 31, 0.94);
    color-scheme: dark;
  }
}
:root[data-theme="graphite"] {
  --bg: #0C0D0D; --card: #1D1F1E; --card-2: #262827; --text: #ECEAE3; --muted: #7F827E; --faint: #4A4C4A;
  --line: rgba(255, 255, 255, 0.08); --accent: #ECEAE3; --accent-soft: rgba(236, 234, 227, 0.1); --on-accent: #151616;
  --income: #9FE2BF; --income-soft: rgba(159, 226, 191, 0.14); --expense: #ECEAE3; --expense-soft: rgba(255, 255, 255, 0.06);
  --debt: #ECEAE3; --debt-soft: rgba(255, 255, 255, 0.1);
  --tile: #171818; --tile-2: #212323; --ink-2: #8F928E; --ink-3: #595C59; --dim: #2A2C2B; --bar-bg: rgba(30, 32, 31, 0.94);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 "Inter Tight", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; overscroll-behavior-y: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}
.topbar h1 { font-size: 30px; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--muted);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 22px 4px 8px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.section-title button { color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 15px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.pad { padding: 16px; }

/* ---------- Hero ---------- */

.hero { padding: 18px 18px 16px; }
.hero .label { color: var(--muted); font-size: 14px; }
.hero .big { font-size: 36px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 2px; }
.hero .sub { color: var(--muted); font-size: 14px; }
.hero-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.hero-grid .k { font-size: 12px; color: var(--muted); }
.hero-grid .v { font-size: 16px; font-weight: 600; margin-top: 2px; }

.pos { color: var(--income); }
.neg { color: var(--expense); }
.dbt { color: var(--debt); }

.streak {
  margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted);
}
.streak b { color: var(--text); }
.dots { display: flex; gap: 4px; margin-left: auto; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: block; }
.dots i.on { background: var(--income); }

/* ---------- Rows ---------- */

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  min-height: 56px;
  width: 100%;
  text-align: left;
  position: relative;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 64px;
  border-top: 1px solid var(--line);
}
.row.plain + .row.plain::before { left: 16px; }
.row .ico {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--card-2);
  font-size: 18px;
}
.row .ico.inc { background: var(--income-soft); color: var(--income); }
.row .ico.exp { background: var(--expense-soft); color: var(--expense); }
.row .ico.trf { background: var(--accent-soft); color: var(--accent); }
.row .ico.dbt { background: var(--debt-soft); color: var(--debt); }
.row .ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { font-weight: 600; text-align: right; white-space: nowrap; }
.row .amt small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.row .chev { color: var(--faint); font-size: 20px; }

.day-head {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--muted);
  margin: 18px 4px 6px;
}

.empty {
  text-align: center; color: var(--muted);
  padding: 32px 16px;
}
.empty .e-ico { font-size: 34px; margin-bottom: 6px; }

/* ---------- Month switcher ---------- */

.month-switch {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 4px;
}
.month-switch button { width: 40px; height: 36px; border-radius: 9px; color: var(--accent); font-size: 20px; }
.month-switch button:active { background: var(--card-2); }
.month-switch span { font-weight: 600; }

/* ---------- Bars ---------- */

.bar-row { padding: 10px 16px; }
.bar-row + .bar-row { border-top: 1px solid var(--line); }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.bar-top .pct { color: var(--muted); font-size: 13px; margin-left: 6px; }
.bar {
  height: 6px; border-radius: 3px; background: var(--card-2); margin-top: 7px; overflow: hidden;
}
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--expense); }
.bar.inc i { background: var(--income); }
.bar.dbt i { background: var(--debt); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { padding: 14px 16px; }
.kpi .k { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -0.01em; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.wide { grid-column: 1 / -1; }

.mini-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 16px 16px 0; }
.mini-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
.mini-chart .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.mini-chart .pair i { width: 40%; max-width: 14px; border-radius: 4px 4px 0 0; display: block; min-height: 2px; }
.mini-chart .pair i.a { background: var(--income); }
.mini-chart .pair i.b { background: linear-gradient(to top, var(--muted) var(--d, 0%), var(--expense) var(--d, 0%)); }
.mini-chart-labels { display: flex; gap: 8px; padding: 6px 16px 12px; }
.mini-chart-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); padding: 0 16px 12px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ---------- Нижняя панель-«таблетка» ---------- */

/* Кнопка «Домой»: точечная матрица, видна на всех экранах; при появлении
   домик собирается из точек волной */
.tabbar {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 20;
  transform: translate(-50%, 150%) scale(.6); opacity: 0; pointer-events: none;
  transition: transform .26s cubic-bezier(.4, 0, 1, 1), opacity .2s;
}
.tabbar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; transition: transform .5s cubic-bezier(.2, 1.5, .4, 1), opacity .15s; }
.home-btn {
  width: 64px; height: 50px; border-radius: 999px; display: grid; place-items: center;
  background: var(--bar-bg); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.home-btn:active { transform: scale(0.92); transition: transform .1s; }
.home-btn .m { display: grid; grid-template-columns: repeat(7, 3px); gap: 1.6px; }
.home-btn .m i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink); opacity: .08; }
.home-btn .m i.on { opacity: 1; }
.tabbar.play .m i.on { animation: hb-dot .25s calc(.18s + var(--d) * 28ms) both; }
.tabbar.tap .m i.on { animation: hb-blink .4s calc(var(--d) * 12ms) both; }
@keyframes hb-dot { from { opacity: 0; transform: scale(2.4); } to { opacity: 1; transform: none; } }
@keyframes hb-blink { 0% { opacity: 1; } 35% { opacity: .15; transform: translateY(-2px); } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tabbar, .tabbar.show { transition: opacity .15s; } .tabbar .m i.on { animation: none !important; } }

/* ---------- Sheet ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0; transition: opacity .2s ease;
}
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 560px; margin: 0 auto;
  max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet.show { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
}
.sheet-head h2 { font-size: 17px; margin: 0; }
.sheet-head button { color: var(--accent); font-size: 16px; min-width: 64px; }
.sheet-head button:last-child { text-align: right; font-weight: 600; }
.sheet-head button:first-child { text-align: left; }
.sheet-body {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(env(safe-area-inset-bottom) + 20px);
}

/* ---------- Form ---------- */

.seg {
  display: flex; background: var(--card-2); border-radius: 10px; padding: 2px;
  gap: 2px;
}
.seg button {
  flex: 1; padding: 7px 4px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted);
}
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.amount-box {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  padding: 18px 0 10px;
}
.amount-box input {
  width: 1.6ch; max-width: calc(100% - 70px); min-width: 1.6ch;
  border: 0; outline: 0; background: none; padding: 0;
  font-size: 44px; font-weight: 700; text-align: center; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.amount-box input::placeholder { color: var(--faint); }
.amount-box .cur { font-size: 24px; font-weight: 600; color: var(--muted); }
.amount-box.exp input { color: var(--expense); }
.amount-box.inc input { color: var(--income); }

.field-label { font-size: 13px; color: var(--muted); margin: 14px 4px 6px; display: flex; justify-content: space-between; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 12px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 14px; white-space: nowrap;
  border: 1.5px solid transparent;
}
.chip small { color: var(--muted); margin-left: 4px; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
.chip.add { color: var(--accent); }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 2px 8px; border-radius: 12px;
  background: var(--card); box-shadow: var(--shadow);
  border: 1.5px solid transparent;
  font-size: 11.5px; line-height: 1.15; text-align: center;
  min-height: 72px;
}
.cat .em { font-size: 22px; }
.cat.on { border-color: var(--accent); background: var(--accent-soft); }

.input, .select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 0; outline: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.input:focus { box-shadow: 0 0 0 2px var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 4px 0; }
.hint.warn { color: var(--debt); }

.btn {
  display: block; width: 100%;
  padding: 14px; border-radius: 14px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 17px;
  margin-top: 20px;
}
.btn:active { opacity: .85; }
.btn.secondary { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.btn.danger { background: var(--card); color: var(--expense); box-shadow: var(--shadow); }
.btn.small { padding: 10px; font-size: 15px; margin-top: 10px; }
.btn[disabled] { opacity: .45; }

.list-btn { color: var(--accent); }
.list-btn.danger { color: var(--expense); }

.progress { height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--income); border-radius: 4px; }

.debt-card { padding: 14px 16px; }
.debt-card + .debt-card { border-top: 1px solid var(--line); }
.debt-card .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.debt-card .name { font-weight: 600; }
.debt-card .rest { font-weight: 700; font-size: 18px; }
.debt-card .foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; }
.debt-card .actions { display: flex; gap: 8px; margin-top: 10px; }
.debt-card .actions button {
  flex: 1; padding: 8px; border-radius: 10px; background: var(--card-2); font-size: 14px; font-weight: 500; color: var(--accent);
}

.sync-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--faint); }
.sync-dot.ok { background: var(--income); }
.sync-dot.err { background: var(--expense); }
.sync-dot.wait { background: var(--debt); }

.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  transform: translate(-50%, 20px);
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .22s ease;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.install-tip {
  margin-top: 14px; padding: 12px 14px; font-size: 14px; color: var(--muted);
  display: flex; gap: 10px; align-items: flex-start;
}
.install-tip b { color: var(--text); }
.install-tip button { margin-left: auto; color: var(--muted); font-size: 18px; line-height: 1; }

/* ---------- v1.1 ---------- */

.hero-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hero .big { display: block; text-align: left; cursor: pointer; }
.masked {
  filter: blur(9px);
  -webkit-user-select: none; user-select: none;
  transition: filter .25s ease;
}
.hero .big, .hero .sub, .row .amt, .row .meta span { transition: filter .25s ease; }
.hero-grid.cols-2 { grid-template-columns: 1fr 1fr; }

.seg.types button { flex: 1 1 auto; padding: 7px 8px; font-size: 13.5px; white-space: nowrap; }

.cat .em { display: grid; place-items: center; height: 26px; color: var(--text); }
.cat.on .em { color: var(--accent); }
.cat .em svg, .bar-ico svg, .icon-opt svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.row .ico { color: var(--text); }

.bar-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.bar-ico { display: inline-grid; color: var(--muted); }
.bar-ico svg { width: 18px; height: 18px; stroke-width: 1.9; }

.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-opt {
  aspect-ratio: 1; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow);
  border: 1.5px solid transparent; color: var(--text);
}
.icon-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---------- v1.2: копилка ---------- */

:root { --sav: var(--income); --sav-soft: var(--income-soft); }
.row .ico.sav { background: var(--sav-soft); color: var(--sav); }
.seg.types { overflow-x: auto; scrollbar-width: none; }
.seg.types::-webkit-scrollbar { display: none; }
.seg.types button { padding: 7px 4px; font-size: 13px; }
.save-part { display: flex; gap: 8px; align-items: center; }
.save-part .input { flex: 1; min-width: 0; }
.save-part .chip { padding: 10px 12px; }

/* ---------- v1.3: кредиты, иконки-надписи ---------- */

.loan-info { margin-top: 8px; font-size: 13px; color: var(--muted); display: grid; gap: 3px; }
.loan-info:empty { display: none; }
.loan-info b { color: var(--text); font-weight: 600; }
.progress.used i { background: var(--debt); }
.tag { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--card-2); border-radius: 6px; padding: 2px 6px; vertical-align: 2px; }
.link-btn { color: var(--accent); font-size: 14px; margin: 10px 4px 0; text-align: left; }
.cat-preview { display: inline-grid; color: var(--text); }
.cat-preview svg { width: 26px; height: 26px; }
.icon-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
.debt-card .name { text-align: left; }
.debt-card .actions button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-card .foot span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debt-card .foot span:last-child { white-space: nowrap; }

/* ---------- v1.6: напоминания ---------- */

.notice { margin-top: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--debt-soft); }
.notice-text { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.notice-text b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.notice button { flex: none; padding: 8px 14px; border-radius: 10px; background: var(--debt); color: var(--on-accent); font-weight: 600; font-size: 14px; }
a.list-btn { text-decoration: none; color: var(--accent); }
.notice .notice-btn { flex: none; padding: 8px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 14px; text-decoration: none; }

/* ---------- v2.1.1: иконка-надпись — широкий бейдж ---------- */
svg.txt-icon { width: auto !important; aspect-ratio: 40 / 24; }
.cat .em { min-width: 40px; }

/* ---------- v2.2: перетаскивание ---------- */
.drag-handle {
  flex: none; width: 36px; height: 36px; margin-right: -8px;
  display: grid; place-items: center; color: var(--faint);
  touch-action: none; cursor: grab;
}
.drag-handle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sortable > [data-sort-id] { background: var(--card); }
.sortable > .dragging { position: relative; z-index: 2; box-shadow: 0 6px 20px rgba(0,0,0,.18); border-radius: 12px; transition: none !important; }
.sortable > .dragging .drag-handle { cursor: grabbing; color: var(--accent); }
.sortable > .dragging::before, .sortable > .dragging + .row::before { opacity: 0; }

/* ---------- v2.3: удаление категории ---------- */
.del-summary { display: flex; gap: 12px; align-items: center; font-size: 15px; }
.del-summary .ico { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--card-2); display: grid; place-items: center; }
.del-summary .ico svg { width: 22px; height: 22px; }
.choice { align-items: flex-start; }
.choice .radio { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--faint); position: relative; }
.choice.on .radio { border-color: var(--accent); }
.choice.on .radio::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.meta.wrap { white-space: normal; }
.btn.danger-fill { background: var(--expense); }

/* ================= v2.4: приборная панель ================= */

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
/* Матричные цифры с квадратными пикселями (ось ROND = 0) */
.dot { font-family: "Doto", "IBM Plex Mono", monospace; font-weight: 900; font-variation-settings: "ROND" 0; letter-spacing: .02em; }
.label { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; }

.home-top { display: flex; align-items: center; justify-content: space-between; margin: -4px 2px 10px; height: 30px; }
.brand { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.brand b { font-weight: 500; }
.brand span { color: var(--muted); }
.sync-btn { font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; height: 30px; }
.sync-btn i { width: 7px; height: 7px; margin: 0; border-radius: 1.5px; background: var(--faint); display: block; }
.sync-btn i.ok { background: var(--income); }
.sync-btn i.wait { background: var(--muted); animation: blink 1s steps(2) infinite; }
.sync-btn i.err { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text); }
@keyframes blink { 50% { opacity: .2; } }

.hgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  --bar-zone: calc(50px + 10px + env(safe-area-inset-bottom) + 10px);
  height: max(600px, calc(100svh - env(safe-area-inset-top) - 12px - 36px - var(--bar-zone)));
  grid-template-rows: 1.45fr 1fr 1fr .95fr 1fr 1fr; }
.t { background: var(--tile); color: var(--ink); border-radius: 24px; position: relative; overflow: hidden; text-align: left; }
.anim .t { opacity: 0; transform: translateY(10px) scale(.985); animation: rise .5s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
.t:is(button):active { filter: brightness(1.15); }

.total { grid-column: 1 / 5; grid-row: 1; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; }
.total .value { font-size: 42px; line-height: 1; white-space: nowrap; display: flex; align-items: baseline; }
.total .value .cur { font-family: "Inter Tight", -apple-system, system-ui, sans-serif; font-weight: 500; font-size: 24px; color: var(--ink-2); margin-left: 8px; }
.lcd-off { color: var(--dim); }
.lit { color: var(--ink); }
.split { display: flex; gap: 3px; height: 5px; }
.split i { display: block; border-radius: 3px; background: var(--ink); min-width: 3px; }
.split i.u { background: var(--ink-3); }
.split-legend { display: flex; justify-content: space-between; margin-top: 6px; }

.px-host { position: relative; display: inline-block; }
.px-host canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
.px-host.animating > .px-text { visibility: hidden; }

.month-cell { grid-column: 1 / 3; grid-row: 2 / 4; display: grid; place-items: center; container-type: size; }
.month { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); display: grid; place-items: center; text-align: center; border-radius: 50%; }
.month svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.month .day { font-size: 34px; line-height: 1; color: var(--ink); }
.month .name { font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 500; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); margin-top: 4px; }
.month .rate { margin-top: 9px; display: flex; align-items: baseline; justify-content: center; gap: 5px; }
.month .rate .dot { font-size: 13px; color: var(--ink); }
.month .yest { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 9.5px; letter-spacing: .06em; color: var(--ink-3); margin-top: 2px; text-transform: uppercase; }

.flow { grid-column: 3 / 5; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; }
.flow.inc { grid-row: 2; } .flow.exp { grid-row: 3; }
.flow .f-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.flow .sum { font-size: 21px; line-height: 1; color: var(--ink); white-space: nowrap; }
.flow .sum.long { font-size: 17px; }
.flow .sum.pos { color: var(--mint); }
.flow .f-hint { font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.meter { flex: 1; height: 4px; border-radius: 2px; background: var(--dim); overflow: hidden; max-width: 70px; }
.meter i { display: block; height: 100%; background: var(--ink-2); border-radius: 2px; }
.meter.mint i { background: var(--mint); }

.accounts { grid-column: 1 / 5; grid-row: 4; padding: 14px 0 12px; display: flex; flex-direction: column; justify-content: space-between; }
.channels { display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scrollbar-width: none; padding: 0 16px; gap: 4px; }
.channels::-webkit-scrollbar { display: none; }
.channels::after { content: ''; flex: 0 0 14px; }
.ch { flex: 0 0 calc((100% - 8px) / 3); scroll-snap-align: start; text-align: left; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ch .label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.ch .v { font-size: 21px; line-height: 1.05; margin-top: 4px; white-space: nowrap; display: flex; align-items: baseline; }
.ch .v.long { font-size: 16px; }
.ch .v small { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.ch.pressing { transform: scale(.95); transition: transform .45s ease; }
.rail { position: relative; height: 10px; margin: 0 16px; background-image: radial-gradient(var(--dim) 1.4px, transparent 1.6px); background-size: 8px 10px; }
.rail b { position: absolute; top: 50%; left: 0; height: 2px; border-radius: 1px; background: var(--ink-3); transform: translateY(-50%); }
.rail i { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transform: translate(-50%,-50%); box-shadow: 0 0 0 3px var(--tile); }
.rail.solo { visibility: hidden; }

[data-pi] { display: block; }
[data-pi] svg, .pi svg { display: block; width: 100%; height: 100%; }
.duo { grid-column: 1; grid-row: 5 / 7; overflow: visible; border-radius: 999px; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; padding: 7px; container-type: size; }
.duo.right { grid-column: 2; }
.duo > button { width: min(100cqw, calc(50cqh - 6px)); aspect-ratio: 1; flex: none; border-radius: 50%; background: var(--tile-2); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; transition: transform .15s, background .15s; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.duo > button:active { transform: scale(.95); background: var(--dim); }
.duo .pi { width: 22px; height: 22px; }
.duo .label { font-size: 9.5px; color: var(--ink); }
.duo .piggy { gap: 4px; }
.duo .piggy .pi { color: var(--mint); }
.duo .piggy .n { font-size: 15px; line-height: 1; }
.duo .piggy.pressing { transform: scale(.93); transition: transform .45s ease; }

.record { grid-column: 3 / 5; grid-row: 5 / 7; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 12px; }
.scr { background: var(--tile-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; text-align: left; min-width: 0; }
.scr.today .dot { line-height: 1; }
.scr.today .label { font-size: 9.5px; letter-spacing: .05em; white-space: nowrap; }
.scr.today .dot { font-size: 18px; color: var(--ink); white-space: nowrap; }
.scr.today small { font-family: 'Inter Tight', -apple-system, system-ui, sans-serif; font-weight: 500; font-size: 12px; color: var(--ink-2); margin-left: 3px; }
.scr.today .mark { line-height: 18px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--mint); }
.scr .last { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; }
.scr .last span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr .last .mono { white-space: nowrap; flex: none; }
.scr .last .pos { color: var(--mint); }
.record .bottom { display: flex; align-items: flex-end; justify-content: space-between; }
.hist-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--tile-2); color: var(--ink); display: grid; place-items: center; transition: transform .15s; touch-action: manipulation; }
.hist-btn:active { transform: scale(.92); }
.hist-btn .pi { width: 20px; height: 20px; }
.rec-btn { width: 64px; height: 64px; border-radius: 50%; background: var(--ink); color: var(--tile); display: grid; place-items: center; box-shadow: 0 0 0 5px var(--tile-2); transition: transform .15s; touch-action: manipulation; }
.rec-btn:active { transform: scale(.9); }
.rec-btn svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }

/* Журнал — бухгалтерская книга */
.ledger { background: var(--card); color: var(--text); padding: 16px 18px 4px; border-radius: 24px; margin-top: 10px; }
.ledger .label { color: var(--muted); }
.ledger .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ledger .head button { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--text); }
.ln { display: flex; align-items: baseline; gap: 8px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 15px; width: 100%; text-align: left; }
.ledger .head + .ln, .ln:first-child { border-top: 0; }
.ln .date { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; color: var(--muted); width: 38px; flex: none; }
.ln .what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ln .fill { flex: 1; border-bottom: 1.5px dotted var(--line); transform: translateY(-4px); min-width: 12px; }
.ln .amt { font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 500; font-size: 14px; white-space: nowrap; }
.ln .amt.pos, .pos-ink { color: var(--income); }
.ln .acc { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: block; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.ledger .empty { padding: 18px 0 22px; text-align: left; font-size: 14px; }
.home .notice, .home .install-tip { border-radius: 20px; margin-top: 10px; border: 0; }

/* Поповер по долгому нажатию */
.pop-scrim { position: fixed; inset: 0; z-index: 30; }
.pop { position: fixed; z-index: 31; background: var(--ink); color: var(--tile); border-radius: 14px; padding: 4px; box-shadow: 0 12px 30px rgba(0,0,0,.25); display: flex; flex-direction: column; animation: popin .18s ease-out; min-width: 190px; }
.pop button { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; font-size: 14px; font-weight: 500; border-radius: 10px; text-align: left; }
.pop button:active { background: rgba(0,0,0,.08); }
.pop button + button { border-top: 1px solid rgba(0,0,0,.08); }
.pop svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
@keyframes popin { from { opacity: 0; transform: scale(.9) translateY(6px); } }

/* Экран «План» */
.page-back { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; height: 30px; display: flex; align-items: center; gap: 6px; margin: -4px 2px 6px; }
.page-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.big-tile { background: var(--tile); color: var(--ink); border-radius: 24px; padding: 16px 18px; margin-top: 10px; }
.big-tile .dot { font-size: 40px; line-height: 1.1; margin-top: 6px; white-space: nowrap; }
.big-tile .dot .of { font-family: 'Inter Tight', -apple-system, system-ui, sans-serif; font-weight: 500; font-size: 20px; color: var(--ink-2); margin-left: 8px; }
.big-tile .foot { display: flex; justify-content: space-between; margin-top: 8px; }
.plan-bar { height: 6px; border-radius: 3px; background: var(--dim); margin-top: 14px; overflow: hidden; }
.plan-bar i { display: block; height: 100%; background: var(--mint); border-radius: 3px; }
.pc { padding: 12px 0; border-top: 1px solid var(--line); }
.ledger .head + .pc { border-top: 0; }
.pc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.pc-top .mono { font-size: 13px; font-weight: 500; white-space: nowrap; }
.pc-top em { font-style: normal; color: var(--muted); font-weight: 400; }
.pc-bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.pc-bar i { display: block; height: 100%; border-radius: 2px; background: var(--income); }
.pc-note { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10.5px; color: var(--income); margin-top: 6px; text-transform: uppercase; letter-spacing: .05em; }
.plan-in { width: 130px; flex: none; border: 0; background: transparent; text-align: right; font: 500 15px "IBM Plex Mono", monospace; color: var(--text); outline: none; padding: 0; }
.plan-in::placeholder { color: var(--faint); font-weight: 400; }
.ln.plan-row { align-items: center; }
.page-note { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 14px 4px 0; }
.mswitch { display: flex; align-items: center; gap: 2px; }
.mswitch button { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--text); }
.mswitch button:active { background: var(--accent-soft); }
.mswitch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.theme-switch { display: flex; background: var(--card-2); border-radius: 999px; padding: 3px; gap: 2px; }
.theme-switch button { flex: 1; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-radius: 999px; transition: all .2s; }
.theme-switch button.on { background: var(--accent); color: var(--on-accent); }

@media (prefers-reduced-motion: reduce) { .anim .t { animation: none; opacity: 1; transform: none; } }

/* Экран настроек */
.set-row { align-items: center; color: inherit; text-decoration: none; }
.set-row .what { display: inline-flex; align-items: center; gap: 8px; }
.ln .amt.muted { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.set-row .theme-switch { flex: none; }
.set-row .theme-switch button { flex: none; padding: 6px 9px; font-size: 10px; }
.set-note { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 11px; line-height: 1.5; color: var(--muted); margin: 2px 0 12px; }
.sync-sq { width: 7px; height: 7px; border-radius: 1.5px; background: var(--faint); display: block; flex: none; }
.sync-sq.ok { background: var(--income); }
.sync-sq.wait { background: var(--muted); animation: blink 1s steps(2) infinite; }
.sync-sq.err { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text); }
.code-in { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font: 500 15px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; color: var(--text); padding: 0; }
.code-in::placeholder { color: var(--faint); letter-spacing: 0; font-weight: 400; }
.set-row.off .what { color: var(--muted); }
.set-row .what .acc { margin-left: 0; }
.set-row .what:has(.acc) { display: block; }

/* v2.6.2: поля ввода в строках книги растут по содержимому — пунктир доходит до числа */
.plan-in { width: auto; max-width: 160px; }
.set-note, .page-note, .hint, .loan-info, .notice-text, .install-tip { text-wrap: pretty; }
.accounts:has(.rail.solo) { justify-content: center; }
.accounts .rail.solo { display: none; }
/* v2.6.3: в строках с выравниванием по центру пунктир стоит посередине высоты текста */
.set-row .fill, .plan-row .fill { transform: none; align-self: center; }
.set-row:has(.acc) { align-items: baseline; }
.set-row:has(.acc) .fill { align-self: auto; transform: translateY(-4px); }
/* v2.6.4: подпись под заголовком не влияет на ширину — пунктир идёт от конца заголовка */
.set-row:has(.acc) .what { overflow: visible; }
.set-row .what .acc { width: 0; white-space: nowrap; overflow: visible; }
/* v2.6.5: экран плана */
.mswipe { touch-action: pan-y; will-change: transform; }
.bt-head { display: flex; justify-content: space-between; align-items: center; min-height: 30px; margin: -6px -8px -6px 0; }
.big-tile .mswitch { color: var(--ink); }
.big-tile .mswitch button { color: inherit; }
.big-tile .mswitch button:active { background: var(--tile-2); }
.mswitch .to-now { width: auto; height: 26px; padding: 0 10px; margin-right: 4px; border-radius: 999px; background: var(--tile-2); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--mint) !important; }
.pc-note.muted { color: var(--muted); }
.page-note { text-align: left; }

/* ================= v2.8: форма операции «Пульт» ================= */
.pop-scrim { z-index: 70; }
.pop { z-index: 71; max-height: 60vh; overflow-y: auto; }
.sheet.tx-sheet { top: 0; max-width: 480px; max-height: none; height: 100dvh; border-radius: 0; background: var(--bg); }
.tx-sheet .sheet-body { height: 100%; padding: 0; overflow-y: auto; }
.tx { min-height: 100%; display: flex; flex-direction: column; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 14px); }
.tx svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tx .label { color: var(--ink-2); }
.tx-head { display: flex; align-items: center; gap: 10px; }
.tx .x { width: 36px; height: 36px; border-radius: 50%; background: var(--tile); color: var(--ink); display: grid; place-items: center; flex: none; }
.tx .x.big { width: 56px; height: 56px; }
.tx .types { flex: 1; display: flex; background: var(--tile); border-radius: 999px; padding: 3px; gap: 2px; }
.tx .types button { flex: 1; font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 9px 0; border-radius: 999px; transition: background .2s, color .2s; }
.tx .types button.on { background: var(--ink); color: var(--tile); }

.tx-amount { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.tx-amount .top { display: flex; justify-content: space-between; }
.tx .amount { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; white-space: nowrap; min-width: 0; }
.tx .amount .cur { font: 500 24px "Inter Tight", -apple-system, system-ui, sans-serif; color: var(--ink-2); }
.kf { display: inline-flex; align-items: center; color: var(--ink); min-width: 0; }
.kf .dot { line-height: 1; }
.kf .dot.zero { color: var(--dim); }
.kf.big .dot { font-size: 46px; }
.kf.mid .dot { font-size: 26px; }
.kf.small .dot { font-size: 18px; }
.kf .caret { display: none; width: 3px; align-self: stretch; margin-left: 4px; background: var(--mint); border-radius: 1px; animation: blink 1s steps(2) infinite; }
.kf.active .caret { display: block; }
.kf.big .caret { height: 38px; align-self: center; }
.tx-amount .to { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--dim); padding-top: 10px; }
.tx-amount .to .cur { font-size: 16px; }
.hint-dark { font: 10.5px/1.45 "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-2); letter-spacing: .02em; text-wrap: pretty; }
.tx-amount .hint-dark { text-align: right; margin-top: -4px; }
.tx .meta { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.tx .meta::-webkit-scrollbar { display: none; }
.tx .pill { flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--tile-2); color: var(--ink); font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.tx .pill svg { width: 14px; height: 14px; }
.tx .pill.ghost { color: var(--ink-2); }
.tx .pill.date input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; padding: 0; -webkit-appearance: none; appearance: none; }
.note-in { width: 100%; border: 0; outline: none; background: var(--tile-2); color: var(--ink); border-radius: 12px; padding: 10px 12px; font: 15px "Inter Tight", -apple-system, system-ui, sans-serif; }
.note-in::placeholder { color: var(--ink-3); }

.tx-cats .cats { display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); grid-auto-columns: calc((100% - 18px) / 4); gap: 10px 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-inline: 12px; padding: 12px; }
.tx-cats .cats::-webkit-scrollbar { display: none; }
.tx .cat, .tx .cat.on { display: flex; flex-direction: column; align-items: center; gap: 6px; scroll-snap-align: start; min-width: 0; background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; border-radius: 0; }
.tx .cat .c { width: 52px; height: 52px; border-radius: 50%; background: var(--tile-2); color: var(--ink); display: grid; place-items: center; transition: background .15s, color .15s, transform .12s; }
.tx .cat .c svg { width: 22px; height: 22px; }
.tx .cat .c svg.txt-icon { height: 18px; }
.tx .cat .c.add { color: var(--ink-2); }
.tx .cat:active .c { transform: scale(.93); }
.tx .cat .n { font-size: 11px; line-height: 1.15; color: var(--ink-2); text-align: center; max-width: 100%; height: 2.3em; overflow: hidden; overflow-wrap: anywhere; }
.tx .cat.on .c { background: var(--ink); color: var(--tile); }
.tx .cat.on .n { color: var(--ink); }

.tx-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.tx-row .kf { margin-left: auto; }
.tx-row.col { flex-direction: column; align-items: flex-start; }
.chips-mini { display: flex; gap: 4px; }
.chips-mini button { font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; padding: 6px 8px; border-radius: 999px; background: var(--tile-2); color: var(--ink); }

.tx-route { display: flex; align-items: center; gap: 8px; padding: 10px; }
.tx .route { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 12px; border-radius: 16px; background: var(--tile-2); color: var(--ink); text-align: left; }
.tx .route .nm { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tx .route .cur { font-size: 9.5px; color: var(--ink-3); }
.tx-route .swap { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); transform: rotate(90deg); }
.tx-debt { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tx-debt .route { flex: none; }
.seg-dark { display: flex; background: var(--tile-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-dark button { flex: 1; font-size: 13px; padding: 8px 4px; border-radius: 999px; color: var(--ink-2); white-space: nowrap; }
.seg-dark button.on { background: var(--ink); color: var(--tile); }
.tx-debt .sub { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 0; }
.tx-debt .hint-dark { padding: 0 6px 4px; }

.tx .grow { flex: 1; min-height: 0; }
.tx .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tx .keys button { height: 52px; border-radius: 16px; background: var(--tile); color: var(--ink); font: 400 24px "Inter Tight", -apple-system, system-ui, sans-serif; display: grid; place-items: center; transition: transform .08s, background .08s; -webkit-user-select: none; user-select: none; }
.tx .keys button:active { transform: scale(.96); background: var(--tile-2); }
.tx .keys svg { width: 24px; height: 24px; }
.tx-save { display: flex; gap: 10px; }
.tx .save { flex: 1; height: 56px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 16px "Inter Tight", -apple-system, system-ui, sans-serif; }
.tx .save:active { transform: scale(.98); }
@media (max-height: 700px) { .tx .keys button { height: 44px; } .kf.big .dot { font-size: 38px; } .tx .cat .c { width: 44px; height: 44px; } }
/* v2.8.1: категории занимают всё свободное место над клавиатурой, ряды распределяются равномерно */
.tx-cats { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.tx-cats .cats { flex: 1; align-content: space-evenly; }
/* v2.8.2: в доходах две строки категорий (ниже — строка «В копилку»), клавиатура остаётся на месте */
.tx-cats.rows-2 .cats { grid-template-rows: repeat(2, auto); }
.tx { height: 100%; }
.tx .keys, .tx-save, .tx-head, .tx-amount { flex: none; }

/* v2.8.4: разделы формы листаются как страницы, подсветка типа скользит */
.tx .types { position: relative; }
.tx .types .ind { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 4); border-radius: 999px; background: var(--ink); transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.tx .types.no-anim .ind { transition: none; }
.tx .types button { position: relative; z-index: 1; }
.tx .types button.on { background: none; color: var(--tile); }
.tx-pane { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; will-change: transform; }
.tx-sheet .sheet-body { overflow-x: hidden; }

/* ================= v2.9: история ================= */
.hist { will-change: transform; touch-action: pan-y; }
.hist .sync-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hist .sync-btn { color: var(--text); width: 36px; justify-content: center; }
.hist-search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 16px; padding: 4px 4px 4px 14px; margin-bottom: 10px; }
.hist-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: 15px "Inter Tight", -apple-system, system-ui, sans-serif; color: var(--text); padding: 8px 0; }
.hist-search input::placeholder { color: var(--muted); }
.hist-search button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.hist-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hist-tile { margin-top: 0; }
.hist-sums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.hist-sums > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hist-sums .dot { font-size: 19px; line-height: 1.1; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: clip; }
.hist-sums .dot.pos { color: var(--mint); }
.hist-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 10px -16px 0; padding: 0 16px; }
.hist-chips::-webkit-scrollbar { display: none; }
.hist-chips button { flex: none; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--card); color: var(--text); font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.hist-chips button.on { background: var(--accent); color: var(--on-accent); }
.hist-chips .acc-chip { text-transform: none; letter-spacing: .02em; font-size: 12px; }
.ledger.day { padding-bottom: 2px; }
.ledger.day .head { margin-bottom: 0; }
.ln.hl { align-items: center; }
.ln.hl .what { align-self: center; }
.ln.hl .fill { align-self: center; transform: none; }
.ln .hi { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--card-2); color: var(--text); display: grid; place-items: center; margin-right: 2px; }
.ln .hi svg { width: 16px; height: 16px; }
.ln .hi svg.txt-icon { width: auto; height: 12px; }
/* Подпись счёта и значок не влияют на пунктир: он идёт от конца названия к сумме */
.ln.hl { position: relative; align-items: baseline; padding: 11px 0 28px 40px; }
.ln.hl .what { align-self: auto; }
.ln.hl .fill { align-self: auto; transform: translateY(-4px); }
.ln.hl .hi { position: absolute; left: 0; top: 50%; transform: translateY(-50%); margin: 0; }
.ln.hl .acc { position: absolute; left: 40px; right: 0; bottom: 11px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* v2.9.1: главная — один экран без прокрутки (место под панелью уже учтено в высоте сетки) */
body[data-tab="home"] .view { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
body[data-tab="home"] { overscroll-behavior-y: none; }
/* v2.9.3: главная не пружинит при потягивании */
html:has(body[data-tab="home"]), body[data-tab="home"] { overscroll-behavior: none; }
.flow .sum .px-host { display: inline-block; }

/* ================= v3.0: долги — приборная панель ================= */
.debts { display: flex; flex-direction: column; gap: 10px; }
.debts .home-top { margin-bottom: 0; }
.sync-btn.plus { width: 36px; height: 36px; border-radius: 50%; background: var(--tile); color: var(--ink); justify-content: center; }
.sync-btn.plus svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.debts .t { padding: 14px 16px; }
.dt-total { display: flex; flex-direction: column; gap: 12px; }
.dt-rest { font-size: 32px; line-height: 1; color: var(--ink); white-space: nowrap; display: flex; align-items: baseline; }
.dt-rest.big { font-size: 42px; }
.dt-rest.mint { color: var(--mint); }
.dt-rest .cur { font: 500 20px "Inter Tight", -apple-system, system-ui, sans-serif; color: var(--ink-2); margin-left: 8px; }
.dt-rest.big .cur { font-size: 24px; }
.dt-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dt-strip .t { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 20px; min-width: 0; }
.dt-strip .dot { font-size: 18px; line-height: 1; color: var(--ink); white-space: nowrap; overflow: hidden; }
.dt-strip .dot.mint { color: var(--mint); }
.dt-strip .label.sm { font-size: 9.5px; color: var(--ink-3); margin-top: -2px; }
.dt { display: flex; flex-direction: column; gap: 12px; }
.dt-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dt-name { font-size: 17px; font-weight: 500; margin-top: 3px; color: var(--ink); }
.dt-sub { display: flex; justify-content: space-between; gap: 8px; margin-top: -4px; }
.dt-sub .label { font-size: 9.5px; color: var(--ink-3); }
.pxring { position: relative; width: 64px; height: 64px; flex: none; display: grid; place-items: center; }
.pxring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pxring b { font-size: 15px; color: var(--ink); }
.pxring b small { font-size: 9px; margin-left: 1px; color: var(--ink-2); }
.pxbar { display: flex; gap: 3px; height: 8px; }
.pxbar i { flex: 1; border-radius: 2px; background: var(--dim); }
.pxbar i.on { background: var(--ink); }
.pxbar.mint i.on { background: var(--mint); }
.pxbar.over i.on { background: var(--ink-2); }
.dt-meter { display: flex; flex-direction: column; gap: 10px; }
.ros { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--dim); border-radius: 14px; overflow: hidden; }
.ro { background: var(--tile-2); padding: 9px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ro .v { font: 500 15px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ro .v small { font-size: 11px; color: var(--ink-2); font-weight: 400; }
.ro.warn .v { color: var(--ink-2); }
.dt-next { gap: 8px; }
.split-n { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.split-n .dot { font-size: 20px; color: var(--ink); white-space: nowrap; }
.split-n .parts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font: 11px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-2); white-space: nowrap; }
.sw { display: inline-block; width: 7px; height: 7px; border-radius: 1.5px; margin-right: 5px; }
.sw.ink3 { background: var(--ink-3); }
.sw.mint { background: var(--mint); }
.dt-next .split { height: 5px; }
.dt-next .split i.u { background: var(--ink-3); }
.dt-next .split i.m { background: var(--mint); }
.hint-dark.warn { color: var(--ink); }
.dt .hint-dark { margin-top: -4px; }
.dt-alert { flex-direction: row; justify-content: space-between; align-items: center; color: var(--ink); font-size: 13px; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.dt-act { display: flex; gap: 8px; }
.dt-act .act { flex: 1; height: 44px; border-radius: 999px; background: var(--ink); color: var(--tile); font: 600 14px "Inter Tight", -apple-system, system-ui, sans-serif; white-space: nowrap; }
.dt-act .act.ghost { background: var(--tile-2); color: var(--ink); }
.dt-act .act:active, .dt .more:active { transform: scale(.97); }
.dt .more { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--tile-2); color: var(--ink); display: grid; place-items: center; }
.dt .more svg { width: 20px; height: 20px; fill: currentColor; }
.dt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dt.small { gap: 10px; padding: 14px; }
.dt.small .dt-rest { font-size: 22px; }
.dt.small .dt-rest .cur { font-size: 14px; margin-left: 5px; }
.dt.small .dt-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt.small .dt-top > div { min-width: 0; }
.dt.small .more { width: 32px; height: 32px; }
.dt.small .more svg { width: 16px; height: 16px; }
.dt.small .dt-sub { margin-top: -2px; }
.dt-act.col { flex-direction: column; gap: 6px; }
.dt-act.col .act { height: 36px; font-size: 13px; }
.dt-act.col .act { flex: none; }
.dt-grid > :only-child { grid-column: 1 / -1; }

/* ================= v3.1: листы (долг, счёт, категория, напоминание) в стиле панели ================= */
.sheet:not(.tx-sheet) { border-radius: 26px 26px 0 0; background: var(--bg); }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 16px 16px 10px; }
.sheet-head h2 { font: 500 11px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--text); text-align: center; white-space: nowrap; }
.sheet-head button { min-width: 0; font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); height: 34px; }
.sheet-head button:first-child { justify-self: start; text-align: left; }
.sheet-head button:last-child { justify-self: end; padding: 0 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 500; }
.sheet-head button:last-child:empty { visibility: hidden; }
.sheet:not(.tx-sheet) .sheet-body { padding-top: 2px; }

.sheet .seg { background: var(--tile); border-radius: 999px; padding: 3px; gap: 2px; }
.sheet .seg button { border-radius: 999px; color: var(--ink-3); font: 500 13px "Inter Tight", -apple-system, system-ui, sans-serif; padding: 9px 6px; white-space: nowrap; }
.sheet .seg button.on { background: var(--ink); color: var(--tile); box-shadow: none; }
.sheet .field-label { font: 500 10px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 4px 7px; }
.sheet .field-label span:last-child:not(:first-child) { text-transform: none; letter-spacing: .02em; }
.sheet .input, .sheet .select { background: var(--card); border-radius: 14px; box-shadow: none; padding: 13px 14px; font-size: 16px; color: var(--text); }
.sheet .input.num { font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 500; }
.sheet .input:focus { box-shadow: inset 0 0 0 1.5px var(--text); }
.sheet .input::placeholder { color: var(--faint); }
.sheet input[type="date"].input { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 15px; }
.sheet .hint { font: 11px/1.5 "IBM Plex Mono", ui-monospace, monospace; color: var(--muted); margin: 7px 4px 0; text-wrap: pretty; }
.sheet .hint.warn { color: var(--text); }
.sheet .btn { border-radius: 999px; height: 54px; padding: 0; font: 600 16px "Inter Tight", -apple-system, system-ui, sans-serif; background: var(--accent); color: var(--on-accent); }
.sheet .btn.secondary, .sheet .btn.danger { background: var(--card); color: var(--text); box-shadow: none; }
.sheet .btn.danger { color: var(--muted); }
.sheet .btn.small { height: 46px; font-size: 15px; }
.sheet .btn.danger-fill { background: var(--accent); color: var(--on-accent); }
.sheet .chip { background: var(--card); box-shadow: none; border: 0; border-radius: 999px; padding: 9px 14px; font-size: 14px; }
.sheet .chip.on { background: var(--accent); color: var(--on-accent); border: 0; }
.sheet .chip.on small { color: inherit; opacity: .7; }
.sheet .link-btn { font: 500 11px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .04em; color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.sheet .card { border-radius: 20px; box-shadow: none; }
.sheet .section-title { font: 500 10px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .1em; color: var(--muted); }
.sheet .section-title button { font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.sheet .icon-opt { background: var(--card); box-shadow: none; border-radius: 14px; }
.sheet .icon-opt.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.sheet .row .ico { border-radius: 50%; background: var(--card-2); }
.sheet .choice .radio { border-color: var(--faint); }
.sheet .choice.on .radio { border-color: var(--text); }
.sheet .choice.on .radio::after { background: var(--text); }

/* ================= v3.2: адаптация под размер iPhone ================= */
/* Невысокие экраны (SE, 8, mini в браузере): панель ужимается, лишнее в блоке записи прячется */
@media (max-height: 740px) {
  .hgrid { gap: 8px; }
  .total { padding: 12px 14px; }
  .total .value { font-size: 36px; }
  .record { padding: 10px; gap: 6px; }
  .rec-btn { width: 54px; height: 54px; box-shadow: 0 0 0 4px var(--tile-2); }
  .hist-btn { width: 40px; height: 40px; }
  .flow { padding: 12px 14px; }
  .accounts { padding: 12px 0 10px; }
}
/* Узкие экраны (375 точек): чуть меньше цифры, чтобы суммы не упирались в край */
@media (max-width: 380px) {
  .flow .sum { font-size: 19px; }
  .ch .v { font-size: 19px; }
  .dt-strip .dot { font-size: 16px; }
  .hist-sums .dot { font-size: 17px; }
  .tx .types button { font-size: 9.5px; letter-spacing: .06em; }
}
/* Большие экраны (Pro Max): крупнее цифры и кнопки, панель не растягивается пустотой */
@media (min-width: 420px) and (min-height: 900px) {
  .total .value { font-size: 48px; }
  .flow .sum { font-size: 24px; }
  .ch .v { font-size: 23px; }
  .month .day { font-size: 40px; }
  .month .name { font-size: 14px; }
  .label { font-size: 11px; }
  .tx .keys button { height: 58px; }
  .tx .cat .c { width: 56px; height: 56px; }
}

/* v3.2.1: ничего не обрезается — содержимое плиток подстраивается под их реальную высоту
   (на iPhone сверху и снизу место занимают вырез камеры и полоска «домой») */
.record { container-type: size; gap: 8px; }
/* Плитка записи пониже — компактнее отступы, а «Последнее» прячется только если совсем не влезает */
@container (max-height: 236px) {
  .record > * + * { margin-top: -2px; }
  .record .scr { padding: 7px 10px; gap: 3px; border-radius: 10px; }
  .record .scr.today .dot { font-size: 16px; }
  .record .rec-btn { width: 54px; height: 54px; box-shadow: 0 0 0 4px var(--tile-2); }
  .record .hist-btn { width: 40px; height: 40px; }
}
@container (max-height: 156px) { .record .scr:not(.today) { display: none; } }
@container (max-height: 150px) { .record .scr.today { display: none; } }
.tx-cats { container-type: size; overflow: hidden; }
/* Три строки категорий, пока влезают: сначала кружки становятся компактнее, и только потом строк меньше */
@container (max-height: 292px) {
  .tx-cats .cats { gap: 4px 6px; padding: 8px 12px; }
  .tx .cat { gap: 4px; }
  .tx .cat .c { width: 44px; height: 44px; }
  .tx .cat .c svg { width: 20px; height: 20px; }
}
@container (max-height: 232px) { .tx-cats .cats { grid-template-rows: repeat(2, auto); } }
@container (max-height: 156px) { .tx-cats .cats { grid-template-rows: auto; } }
.tx-cats .cats { overflow-y: hidden; }

/* ================= v3.3: отчёт ================= */
.report { display: flex; flex-direction: column; gap: 10px; will-change: transform; touch-action: pan-y; }
.report .home-top { margin-bottom: 0; }
.sync-btn.plus.light svg { stroke-width: 1.8; }
.report .t { padding: 14px 16px; }
.rep-hero { display: flex; flex-direction: column; gap: 8px; }
.rep-hero .bt-head { margin-bottom: 2px; }
.rep-net { font-size: 44px; line-height: 1; color: var(--ink); display: flex; align-items: baseline; white-space: nowrap; }
.rep-net.pos { color: var(--mint); }
.rep-net .cur { font: 500 24px "Inter Tight", -apple-system, system-ui, sans-serif; color: var(--ink-2); margin-left: 8px; }
.vs { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--dim); }
.vs-row { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 10px; }
.vs-row .dot { font-size: 16px; color: var(--ink); text-align: right; min-width: 72px; white-space: nowrap; }
.vs-row .dot.pos { color: var(--mint); }
.vs-bar { position: relative; height: 10px; background: repeating-linear-gradient(90deg, var(--dim) 0 6px, transparent 6px 9px); border-radius: 2px; overflow: hidden; }
.vs-bar i { position: absolute; left: 0; top: 0; bottom: 0; -webkit-mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 9px); mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 9px); }
.vs-bar i.in { background: var(--mint); }
.vs-bar i.ex { background: var(--ink); }
.vs-bar i.db { background: var(--ink-3); }
.vs-note { font: 10.5px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-2); display: flex; justify-content: flex-end; }
.sw.in { background: var(--mint); }
.sw.ex { background: var(--ink); }
.sw.db { background: var(--ink-3); }
.rep-ros { grid-template-columns: repeat(3, 1fr); background: var(--tile); border-radius: 20px; padding: 0; gap: 1px; }
.rep-ros .ro { background: var(--tile); padding: 12px 12px; }
.rep-ros .ro:nth-child(n+4) { border-top: 1px solid var(--dim); }
.rep-ros .ro + .ro:not(:nth-child(4)) { border-left: 1px solid var(--dim); }
.rep-ros { gap: 0; }
.rep-ros .ro .v { font-size: 14px; }
.rc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.rc-legend { display: flex; gap: 10px; font: 10px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.pxchart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pc-col { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 4px; border-radius: 12px; transition: background .2s; }
.pc-col.cur { background: var(--tile-2); }
.pc-col .bars { display: flex; gap: 3px; }
.pc-col .b { display: grid; grid-template-rows: repeat(14, 1fr); gap: 2px; width: 13px; height: 112px; }
.pc-col .b i { border-radius: 1.5px; background: var(--dim); opacity: .55; }
.pc-col .b i.in { background: var(--mint); opacity: 1; }
.pc-col .b i.ex { background: var(--ink); opacity: 1; }
.pc-col .b i.db { background: var(--ink-3); opacity: 1; }
.pc-col .label { font-size: 9.5px; }
.pc-col.cur .label { color: var(--ink); }
.rep-comp .comp { display: flex; gap: 3px; height: 14px; }
.rep-comp .comp i { border-radius: 3px; min-width: 4px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.comp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.comp-legend b { font: 500 11px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink); }
.comp-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.s-1 { background: var(--ink); } .s-2 { background: var(--ink-2); } .s-3 { background: var(--ink-3); } .s-4 { background: color-mix(in srgb, var(--ink-3) 60%, var(--dim)); }
.s-m1 { background: var(--mint); } .s-m2 { background: color-mix(in srgb, var(--mint) 65%, var(--tile)); } .s-m3 { background: color-mix(in srgb, var(--mint) 40%, var(--tile)); } .s-m4 { background: color-mix(in srgb, var(--mint) 22%, var(--tile)); }
.s-rest { background: var(--dim); }
.rep-list { margin-top: 0; }
.ln.rl .acc { display: flex; align-items: center; gap: 8px; }
.rbar { flex: 0 0 72px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.rbar i { display: block; height: 100%; border-radius: 2px; background: var(--text); }
.rbar.inc i { background: var(--income); }
@media (max-width: 380px) { .rep-net { font-size: 38px; } .pc-col .b { width: 11px; } .rep-ros .ro .v { font-size: 13px; } }
/* v3.3.1: плитка категорий забирает всё свободное место (распорка ниже не делит его пополам) */
.tx-pane:has(.tx-cats) .grow { display: none; }
/* v3.4: история — фильтры в графитовой плитке, периоды под ней */
.hist-filter { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-radius: 22px; }
.hf-types button { font: 500 9.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; padding: 10px 2px; }
.hf-acc { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--tile-2); color: var(--ink); text-align: left; }
.hf-acc .nm { flex: 1; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-acc .chev { color: var(--ink-2); font-size: 11px; }
.hist .hist-chips { margin-top: 10px; }
.hist .hist-chips button { text-transform: none; letter-spacing: .02em; font: 500 12.5px "Inter Tight", -apple-system, system-ui, sans-serif; }
/* v3.5: счета — лента в плитке, период — шаг и листание */
.hf-accs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 8px 2px; overscroll-behavior-x: contain; }
.hf-accs::-webkit-scrollbar { display: none; }
.hf-accs button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--tile-2); color: var(--ink-2); font: 500 13px "Inter Tight", -apple-system, system-ui, sans-serif; white-space: nowrap; transition: background .15s, color .15s; }
.hf-accs button.on { background: var(--ink); color: var(--tile); }
.hist-period { margin-top: 10px; background: var(--card); border-radius: 22px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.hp-gran { display: flex; background: var(--card-2); border-radius: 999px; padding: 3px; gap: 2px; }
.hp-gran button { flex: 1; padding: 8px 2px; border-radius: 999px; font: 500 10px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.hp-gran button.on { background: var(--accent); color: var(--on-accent); }
.hp-nav { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 2px; }
.hp-nav > button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text); flex: none; }
.hp-nav > button:active { background: var(--accent-soft); }
.hp-nav svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hp-label { flex: 1; text-align: center; font: 500 13px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.hp-ph { width: 36px; flex: none; }
.hp-nav .to-now { width: auto; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 500 9.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
/* v3.6: календарь выбора периода */
.cal { padding: 12px 12px 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head .label { color: var(--ink); font-size: 12px; letter-spacing: .14em; }
.cal-head button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.cal-head button:active { background: var(--tile-2); }
.cal-head svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-wd { margin-bottom: 4px; }
.cal-wd .label { text-align: center; font-size: 9.5px; color: var(--ink-3); }
.cal-grid { row-gap: 4px; }
.cd { position: relative; height: 40px; display: grid; place-items: center; color: var(--ink); }
.cd span { position: relative; z-index: 1; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font: 500 14px "IBM Plex Mono", ui-monospace, monospace; }
.cd.has::after { content: ''; position: absolute; bottom: 3px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 1px; background: var(--ink-3); z-index: 1; }
.cd.future span { color: var(--ink-3); }
.cd.today span { box-shadow: inset 0 0 0 1.5px var(--mint); }
.cd.in::before, .cd.start::before, .cd.end::before { content: ''; position: absolute; top: 2px; bottom: 2px; left: 0; right: 0; background: var(--tile-2); }
.cd.start::before { left: 50%; }
.cd.end::before { right: 50%; }
.cd.edge span { background: var(--ink); color: var(--tile); box-shadow: none; }
.cd.edge.has::after { background: var(--tile); }
.cal-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--dim); }
.cal-ends { display: flex; gap: 6px; }
.cal-ends button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px 12px; border-radius: 12px; background: var(--tile-2); color: var(--ink); text-align: left; min-width: 96px; }
.cal-ends button.on { box-shadow: inset 0 0 0 1.5px var(--mint); }
.cal-ends .v { font: 500 13px "IBM Plex Mono", ui-monospace, monospace; white-space: nowrap; }
.cal-foot > .label { color: var(--ink-2); font-size: 9.5px; text-align: right; }
.cal-presets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 10px -16px 0; padding: 0 16px; }
.cal-presets::-webkit-scrollbar { display: none; }
.cal-presets button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--card); color: var(--text); font: 500 13px "Inter Tight", -apple-system, system-ui, sans-serif; white-space: nowrap; }
.hp-custom { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; height: 36px; border-radius: 12px; }
.hp-custom .hp-label { flex: none; }
.hp-custom .label { font-size: 9.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.hp-gran button { padding: 8px 1px; letter-spacing: .05em; }
.hp-nav > .hp-custom { width: auto; height: 36px; flex: 1; display: flex; border-radius: 12px; place-items: initial; }
.hp-custom .hp-label { white-space: nowrap; }
/* v3.7: календарь — кружок выше, квадратик-отметка под ним не наезжает */
.cd { height: 46px; align-items: start; padding-top: 2px; }
.cd span { width: 34px; height: 34px; }
.cd.has::after { bottom: 3px; }
.cd.in::before, .cd.start::before, .cd.end::before { top: 2px; bottom: auto; height: 34px; }
.cal-grid { row-gap: 0; touch-action: pan-y; will-change: transform; }
/* кнопка статистики за период */
.hist-tools { display: flex; justify-content: flex-end; margin: 10px 0 -2px; }
.pstat-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--tile); color: var(--ink); display: grid; place-items: center; }
.pstat-btn:active { transform: scale(.94); }
.pstat-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hist-tools + #hist-list > .ledger:first-child { margin-top: 8px; }
.pstat-acc { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 14px; font-size: 14px; }
.report .page-back { margin-bottom: 0; }

/* ================= v3.7.1: верх истории — одна плитка, одна сетка =================
   Все элементы управления: высота 34, шрифт IBM Plex Mono 10px заглавными,
   левый край — по внутреннему полю плитки (8px). Группы «что» и «когда» разделены линией. */
.hf { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-radius: 22px; --hf-h: 34px; }
.hf button { font: 500 10px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.hf-seg { display: flex; height: var(--hf-h); padding: 3px; gap: 2px; border-radius: 999px; background: var(--tile-2); }
.hf-seg button { flex: 1; min-width: 0; border-radius: 999px; color: var(--ink-3); padding: 0 2px; transition: background .15s, color .15s; }
.hf-seg button.on { background: var(--ink); color: var(--tile); }
.hf-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; margin: 0 -8px; padding: 0 8px; scroll-padding-inline: 8px; }
.hf-chips::-webkit-scrollbar { display: none; }
.hf-chips button { flex: none; height: var(--hf-h); padding: 0 14px; border-radius: 999px; background: var(--tile-2); color: var(--ink-2); transition: background .15s, color .15s; }
.hf-chips button.on { background: var(--ink); color: var(--tile); }
.hf-div { display: block; height: 1px; background: var(--dim); margin: 3px 4px; }
.hf-nav { display: flex; align-items: center; gap: 6px; height: var(--hf-h); }
.hf-circle { width: var(--hf-h); height: var(--hf-h); flex: none; border-radius: 50%; background: var(--tile-2); color: var(--ink); display: grid; place-items: center; }
.hf-circle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hf-ph { width: var(--hf-h); flex: none; }
.hf-label { flex: 1; text-align: center; font: 500 11px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-nav .hf-label:first-child { text-align: left; padding-left: 12px; }
.hf-pill { height: var(--hf-h); padding: 0 14px; flex: none; border-radius: 999px; background: var(--tile-2); color: var(--ink); }
.hf-pill.mint { color: var(--mint); }
.hf-stat { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 14px; margin-top: 2px; border-radius: 999px; background: var(--tile-2); color: var(--ink); text-align: left; }
.hf-stat svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hf-stat span:not(.chev) { flex: 1; }
.hf-stat .chev { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.hf-stat .chev svg { width: 14px; height: 14px; }
.hf button:active { transform: scale(.97); }
.hist .sync-btn.plus svg { width: 17px; height: 17px; stroke-width: 2; }
.hist #hist-list > .ledger:first-child { margin-top: 10px; }

/* ================= v3.8: копилки — сейф ================= */
.safe { display: flex; flex-direction: column; gap: 10px; }
.safe .home-top, .safe .page-back { margin-bottom: 0; }
.safe-head { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.row-sb { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.label.mint { color: var(--mint); }
.heat-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; margin: 2px -16px 0; padding: 0 16px; -webkit-overflow-scrolling: touch; }
.heat-scroll::-webkit-scrollbar { display: none; }
.heat-grid, .heat-lab { display: grid; grid-template-columns: repeat(var(--w), 10px); gap: 3px; width: max-content; }
.hw { display: grid; grid-template-rows: repeat(7, 10px); gap: 3px; }
.hw i { border-radius: 2px; background: var(--dim); }
.hw i.l1 { background: color-mix(in srgb, var(--mint) 35%, var(--tile)); }
.hw i.l2 { background: color-mix(in srgb, var(--mint) 65%, var(--tile)); }
.hw i.l3 { background: var(--mint); }
.hw i.fut { background: transparent; box-shadow: inset 0 0 0 1px var(--dim); }
.hw i.now { box-shadow: 0 0 0 1.5px var(--ink); }
.heat-lab { margin-top: 6px; height: 12px; }
.hl-m { font: 9px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; overflow: visible; width: 10px; }
.cellboxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cellbox { aspect-ratio: 1; position: relative; overflow: hidden; border-radius: 22px; background: var(--tile); color: var(--ink); padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; }
.cellbox:active { transform: scale(.98); }
.cellbox .lvl { position: absolute; left: 0; right: 0; bottom: 0; max-height: 50%; overflow: hidden; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 6px; align-content: end; direction: rtl; }
.cellbox .lvl i { aspect-ratio: 1; border-radius: 2px; background: var(--mint); }
.cb-top { position: relative; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cb-no { font: 500 9.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .12em; color: var(--ink-3); white-space: nowrap; }
.cellbox .code { width: 34px; height: 14px; fill: var(--ink-3); flex: none; }
.cb-val { position: relative; font-size: 22px; line-height: 1; white-space: nowrap; display: flex; align-items: baseline; margin-top: 4px; }
.cb-val small { font: 500 12px "Inter Tight", -apple-system, system-ui, sans-serif; color: var(--ink-2); margin-left: 4px; }
.cb-nm { position: relative; font-size: 13px; color: var(--ink-2); margin-top: -4px; }
.cellbox.add { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); align-items: center; justify-content: center; font: 500 10.5px "IBM Plex Mono", ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.safe-act .act.ghost { background: var(--card); color: var(--text); }
.safe-act .act { background: var(--tile); color: var(--ink); height: 52px; font-size: 15px; }
/* пиксели наполняют ячейку снизу: полные ряды внизу, неполный — сверху */
.cellbox .lvl { display: flex; flex-wrap: wrap-reverse; direction: ltr; align-content: flex-start; }
.cellbox .lvl i { width: calc((100% - 18px) / 10); }
/* v3.9: карта вкладов во всю ширину плитки — ровно 26 недель на экране */
.safe-head, .cell-hero { container-type: inline-size; }
.heat-scroll { --cw: calc((100cqw - 75px) / 26); }
.heat-grid { grid-template-columns: repeat(var(--w), var(--cw)); }
.hw { grid-template-rows: repeat(7, var(--cw)); }
.heat-ends { display: flex; justify-content: space-between; margin-top: -2px; }
.heat-ends .label { font-size: 9.5px; color: var(--ink-3); }
.cellbox .code { width: 16px; height: 16px; fill: var(--ink-3); }
.cellbox.locked .code { fill: var(--mint); }
.cell-hero { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.cell-hero .code { width: 18px; height: 18px; fill: var(--ink-3); }
.cell-hero .pxbar { height: 10px; }
.cell-fc { gap: 4px; }
.cell-fc > span:not(.label) { font-size: 14px; color: var(--ink); }
.cell-fc .sub { font: 11px "IBM Plex Mono", ui-monospace, monospace !important; color: var(--ink-2) !important; }
/* v3.10: штрихкод крупнее и ярче, номер крупнее, перетаскивание ячеек */
.cellbox .code { width: 52px; height: 18px; fill: var(--ink-2); }
.cellbox.locked .code { fill: var(--mint); }
.cell-hero .code { width: 56px; height: 18px; fill: var(--ink-2); }
.cb-no { font-size: 12px; letter-spacing: .1em; color: var(--ink-2); }
.cellbox { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform .18s; }
.cellbox.dragging { z-index: 5; transition: none; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.cellboxes.sorting .cellbox:not(.dragging) { opacity: .7; }
/* v3.11: настройки — маленькой шестерёнкой в углу плитки «На счетах» */
.total { cursor: pointer; }
.total-top { display: flex; justify-content: space-between; align-items: center; margin: -6px -8px 0 0; }
.gear-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--tile-2); color: var(--ink-2); display: grid; place-items: center; transition: transform .15s, color .15s; }
.gear-btn:active { transform: scale(.92); color: var(--ink); }
.gear-btn .pi { width: 18px; height: 18px; }
/* v3.11: настройки — маленькой шестерёнкой в углу плитки «На счетах» */
.total { cursor: pointer; }
.total-top { display: flex; justify-content: space-between; align-items: center; margin: -6px -8px 0 0; }
.gear-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--tile-2); color: var(--ink-2); display: grid; place-items: center; transition: transform .15s, color .15s; }
.gear-btn:active { transform: scale(.92); color: var(--ink); }
.gear-btn .pi { width: 18px; height: 18px; }
/* v3.11.1: шестерёнка без подложки; все линейные иконки главной одного размера (22px),
   чтобы толщина линий была одинаковой (Fluent regular и свинка Tabler — линия 1,5 в сетке 24) */
.gear-btn { width: 40px; height: 40px; background: none; color: var(--ink); margin: -3px -6px -3px 0; }
.gear-btn .pi, .hist-btn .pi, .duo .pi { width: 22px; height: 22px; }
.gear-btn:active { background: var(--tile-2); }
