/* ============ Токены ============ */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --card-2: #f7f7fa;
  --text: #1c1c1e;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --sep: rgba(60, 60, 67, 0.12);
  --accent: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --fill: rgba(118, 118, 128, 0.12);
  --glass: rgba(249, 249, 249, 0.82);
  /* Как в iOS: сгруппированные белые блоки на сером фоне, без теней */
  --shadow: none;
  --radius: 14px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --hero-a: #0a84ff;
  --hero-b: #5e5ce6;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --card-2: #2c2c2e;
    --text: #f5f5f7;
    --text-2: #98989d;
    --text-3: #636366;
    --sep: rgba(84, 84, 88, 0.45);
    --accent: #0a84ff;
    --green: #30d158;
    --red: #ff453a;
    --orange: #ff9f0a;
    --fill: rgba(118, 118, 128, 0.24);
    --glass: rgba(22, 22, 24, 0.72);
    --shadow: none;
    --hero-a: #0a84ff;
    --hero-b: #5e5ce6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --text: #f5f5f7;
  --text-2: #98989d;
  --text-3: #636366;
  --sep: rgba(84, 84, 88, 0.45);
  --accent: #0a84ff;
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --fill: rgba(118, 118, 128, 0.24);
  --glass: rgba(22, 22, 24, 0.72);
  --shadow: none;
  color-scheme: dark;
}

/* ============ База ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  transition: background 0.3s;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }
.icon-btn svg, .tab svg, .fab svg, .tile-icon svg, .search svg {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.muted { color: var(--text-2); font-size: 14px; }
.tnum { font-variant-numeric: tabular-nums; }

.app { min-height: 100dvh; }

/* ============ Шапка ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--sep); }
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.title { font-size: 34px; font-weight: 700; letter-spacing: 0.005em; margin: 0; line-height: 1.15; }
.month-switch {
  display: flex; align-items: center; gap: 2px;
  background: var(--fill); border-radius: 999px; padding: 3px;
}
.month-label {
  font-size: 15px; font-weight: 600; padding: 6px 8px; min-width: 104px; text-align: center;
  border-radius: 999px; text-transform: capitalize;
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent);
  transition: background 0.2s, transform 0.15s;
}
.icon-btn:active { transform: scale(0.9); background: var(--fill); }
.icon-btn svg { width: 18px; height: 18px; }
.net-status {
  max-width: 1100px; margin: 8px auto 0; font-size: 13px; color: var(--orange);
  display: flex; align-items: center; gap: 6px;
}
.net-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ============ Контент ============ */
/* Ширина контента = ширине шапки плюс её боковые отступы, чтобы левые края заголовка и карточек совпадали */
.content {
  max-width: calc(1100px + 32px); margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 150px);
}
.view { display: none; }
/* Смена экрана — короткое растворение, без «выезжания» */
.view.active { display: block; animation: viewIn 0.2s ease-out; }
@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.card-head h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.link { color: var(--accent); font-size: 16px; }
.link.strong { font-weight: 600; }
.link:active { opacity: 0.5; }

.dash-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@keyframes rise { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 900px) {
  .dash-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
  .hero { grid-column: 1 / -1; }
  .tiles { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); }
  .recent { grid-column: 1 / -1; }
}

/* ============ Hero ============ */
/* Главная цифра — просто крупный шрифт на белом, как в «Здоровье» и Wallet */
.hero { padding: 18px 16px 16px; }
.hero-label { font-size: 15px; color: var(--text-2); }
.hero-amount {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  font-size: clamp(38px, 11vw, 52px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1;
  margin: 4px 0 14px; font-variant-numeric: tabular-nums;
}
.hero.negative .hero-amount { color: var(--red); }
.hero-bar { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.hero-bar span {
  display: block; height: 100%; width: 0; border-radius: inherit; background: var(--green);
  transition: width 0.5s ease-out;
}
.hero.negative .hero-bar span { background: var(--red); }
.hero-sub { margin-top: 10px; font-size: 13px; color: var(--text-2); line-height: 1.4; }

/* ============ Плитки ============ */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { padding: 16px; }
.tile-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px; }
.tile-icon svg { width: 18px; height: 18px; stroke-width: 2.4; }
.tile-icon.income { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.tile-icon.expense { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.tile-label { color: var(--text-2); font-size: 14px; }
.tile-amount { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-delta { font-size: 13px; color: var(--text-2); margin-top: 4px; min-height: 17px; }
.tile-delta .up { color: var(--green); }
.tile-delta .down { color: var(--red); }

/* ============ Бюджет ============ */
.budget-body { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.ring-wrap { position: relative; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: var(--fill); }
.ring-fill {
  stroke: var(--green); stroke-linecap: round;
  stroke-dasharray: 314.16; stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1.1s var(--ease), stroke 0.4s;
}
.budget-ring-label {
  position: absolute; left: 0; top: 0; width: 120px; height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.budget-ring-label b { font-size: 22px; font-variant-numeric: tabular-nums; }
.budget-ring-label span { font-size: 12px; color: var(--text-2); }
.budget-info { display: grid; gap: 10px; }
.budget-info .k { font-size: 13px; color: var(--text-2); }
.budget-info .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.budget-empty { color: var(--text-2); font-size: 15px; }

/* ============ Донат ============ */
.donut-wrap { position: relative; width: 200px; height: 200px; margin: 4px auto 18px; }
.donut { width: 200px; height: 200px; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 22; transition: stroke-dasharray 1s var(--ease), stroke-dashoffset 1s var(--ease), opacity 0.2s; }
.donut circle.dim { opacity: 0.25; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.donut-center span { font-size: 13px; color: var(--text-2); }
.donut-center b { font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.legend li {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: 12px; cursor: pointer; transition: background 0.2s;
}
.legend li:hover, .legend li.on { background: var(--card-2); }
.legend .em { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; }
.legend .nm { font-size: 15px; }
.legend .meter { height: 4px; border-radius: 99px; background: var(--fill); margin-top: 5px; overflow: hidden; }
.legend .meter i { display: block; height: 100%; border-radius: inherit; width: 0; transition: width 1s var(--ease); }
.legend .am { text-align: right; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend .am small { display: block; font-weight: 400; color: var(--text-2); font-size: 12px; }

/* ============ Столбцы ============ */
.bars {
  height: 150px; display: flex; align-items: flex-end; gap: 3px;
  padding-bottom: 20px; position: relative;
}
.bar {
  flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; cursor: default;
}
.bar i {
  display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: var(--fill);
  height: 0; transition: height 0.9s var(--ease), background 0.2s;
}
.bar.has i { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.bar.today i { background: var(--accent); }
.bar:hover i { background: var(--accent); }
.bar span {
  position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.bar.today span { color: var(--accent); font-weight: 600; }
.bar .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px);
  background: var(--text); color: var(--bg); font-size: 12px; padding: 4px 8px; border-radius: 8px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: 0.15s; z-index: 2;
}
.bar:hover .tip, .bar.show .tip { opacity: 1; transform: translate(-50%, 0); }
/* у крайних столбиков подсказка прижимается к краю графика */
.bar.edge-l .tip { left: 0; transform: translate(0, 4px); }
.bar.edge-r .tip { left: auto; right: 0; transform: translate(0, 4px); }
.bar.edge-l:hover .tip, .bar.edge-l.show .tip, .bar.edge-r:hover .tip, .bar.edge-r.show .tip { transform: none; }
html, body { overflow-x: clip; }

/* ============ Список операций ============ */
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 2px; cursor: pointer; border-radius: 10px; position: relative;
  transition: background 0.15s;
}
.tx:active { background: var(--fill); }
.tx + .tx::before {
  content: ""; position: absolute; top: 0; left: 50px; right: 0; height: 0.5px; background: var(--sep);
}
.tx .nm { font-size: 16px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .note { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .am { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx .am.income { color: var(--green); }
.empty {
  text-align: center; color: var(--text-2); padding: 28px 12px; font-size: 15px;
}
.empty .big { font-size: 40px; margin-bottom: 8px; }
.empty button { margin-top: 12px; }

.history-tools {
  display: grid; gap: 10px; margin-bottom: 16px;
  position: sticky; top: var(--topbar-h, 60px); z-index: 5;
  background: var(--bg); margin: -16px -16px 16px; padding: 16px 16px 10px;
}
.search {
  display: flex; align-items: center; gap: 8px; background: var(--fill); border-radius: 12px; padding: 0 10px;
}
.search svg { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.search input { flex: 1; border: 0; background: none; outline: none; padding: 10px 0; font-size: 16px; }
.day-group { margin-bottom: 18px; }
.day-head {
  display: flex; justify-content: space-between; padding: 0 6px 8px;
  font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.02em;
}
.day-group .card { padding: 6px 12px; }

/* ============ Сегменты ============ */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--fill); border-radius: 10px; padding: 2px; position: relative;
}
.segmented button {
  padding: 7px 10px; font-size: 14px; font-weight: 500; border-radius: 8px;
  transition: background 0.25s var(--ease), box-shadow 0.25s, color 0.2s;
}
.segmented button.active { background: var(--card); box-shadow: 0 2px 6px rgba(0,0,0,0.12); font-weight: 600; }
:root[data-theme="dark"] .segmented button.active { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button.active { background: #636366; } }
.segmented.big button { padding: 9px; font-size: 15px; }
.segmented.small button { padding: 5px 9px; font-size: 13px; }

/* ============ Настройки ============ */
.settings { max-width: 640px; }
.group-title { font-size: 13px; font-weight: 400; color: var(--text-2); text-transform: uppercase; margin: 22px 16px 8px; letter-spacing: 0.02em; }
.group { padding: 0 16px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 8px 0; font-size: 16px; width: 100%; text-align: left;
}
.group .row + .row { border-top: 0.5px solid var(--sep); }
/* Поле в строке списка, как в «Настройках» iOS: без рамки, значение справа */
.row input:not([type="checkbox"]):not([type="file"]), .row select {
  -webkit-appearance: none; appearance: none;
  border: 0; border-radius: 0; background: none; box-shadow: none; padding: 0;
  text-align: right; color: var(--text); outline: none;
  font-size: 16px; min-width: 0; max-width: 60%; flex: 1;
}
.row input::placeholder { color: var(--text-3); }
.row input:disabled { color: var(--text-2); -webkit-text-fill-color: var(--text-2); opacity: 1; }
.row select { color: var(--text-2); cursor: pointer; }
.row select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.row.action { color: var(--accent); cursor: pointer; }
.row.action:active { opacity: 0.5; }
.row.danger { color: var(--red); }
.foot { color: var(--text-2); font-size: 13px; margin: 12px 16px; }

.switch {
  appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 99px;
  background: var(--fill); position: relative; cursor: pointer; transition: background 0.25s; flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: transform 0.3s var(--spring);
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

/* ============ Таббар ============ */
/* Нижняя панель как в iOS: во всю ширину, полупрозрачная, с тонкой линией сверху */
.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  padding: 6px max(8px, calc((100% - 560px) / 2)) calc(env(safe-area-inset-bottom) + 6px);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 0; padding: 2px 0; color: #8e8e93;
  font-size: 10px; font-weight: 500; letter-spacing: 0.01em; transition: color 0.15s;
}
.tab svg { width: 25px; height: 25px; stroke-width: 1.8; }
.tab.active { color: var(--accent); }
.tab:active { opacity: 0.6; }
.fab {
  justify-self: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  transition: transform 0.15s ease-out;
}
.fab svg { width: 24px; height: 24px; stroke-width: 2.4; }
.fab:active { transform: scale(0.92); }

/* ============ Шторка ============ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.35s var(--ease);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  max-height: calc(100dvh - env(safe-area-inset-top) - 24px); overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 0 16px calc(env(safe-area-inset-bottom) + 20px);
  transform: translateY(105%); transition: transform 0.5s var(--ease);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
@media (min-width: 700px) {
  .sheet { bottom: 50%; border-radius: 22px; transform: translateY(calc(50% + 60px)) scale(0.96); opacity: 0;
    transition: transform 0.45s var(--ease), opacity 0.3s; pointer-events: none; }
  .sheet.open { transform: translateY(50%); opacity: 1; pointer-events: auto; }
  .sheet-grabber { visibility: hidden; }
}
.sheet-grabber { width: 36px; height: 5px; border-radius: 99px; background: var(--text-3); opacity: 0.6; margin: 8px auto 4px; }
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 0 14px;
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.sheet-head h2 { font-size: 17px; margin: 0; font-weight: 600; }
.sheet-head .link:first-child { justify-self: start; }
.sheet-head .link:last-child { justify-self: end; }
.sheet-body { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.amount-field { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 8px 0; }
.amount-field input {
  border: 0; background: none; outline: none; text-align: right;
  font-size: 52px; font-weight: 700; letter-spacing: -0.03em; width: 6ch; min-width: 1ch; max-width: 100%;
  font-variant-numeric: tabular-nums; caret-color: var(--accent);
}
.amount-field input::placeholder { color: var(--text-3); }
.amount-field.income input { color: var(--green); }
.amount-field.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.amount-cur { font-size: 32px; font-weight: 600; color: var(--text-2); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px;
  border-radius: 12px; background: var(--card); font-size: 12px; color: var(--text-2);
  transition: box-shadow 0.15s, color 0.15s; text-align: center; line-height: 1.15;
}
.cat.active { color: var(--text); box-shadow: inset 0 0 0 2px var(--accent); }
.cat:active { opacity: 0.6; }
.delete-btn { justify-content: center; background: var(--card); border-radius: 14px; }

/* ============ Свои категории ============ */
.cat-new { color: var(--accent); }
.cat-type { width: 100%; }
.cat-row { cursor: pointer; justify-content: flex-start; }
.cat-row:active { opacity: 0.6; }
.cat-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cat-row-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-row-text small { font-size: 13px; color: var(--text-2); }
.chev { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#catList .row { border-top: 0.5px solid var(--sep); }

.sheet-backdrop.top { z-index: 55; }
.sheet.top { z-index: 56; max-height: calc(100dvh - env(safe-area-inset-top) - 44px); }
.cat-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 0 0; }
.cat-preview span { font-size: 20px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pop { from { transform: scale(0.85); } to { transform: none; } }
.cat-type-label { text-align: center; color: var(--text-2); font-size: 13px; margin-top: -10px; }
.card.shake { animation: shake 0.4s; }
.picker-title { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.02em; margin: 0 4px 8px; }
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px;
  background: var(--card); border-radius: 16px; padding: 10px;
}
.emoji-grid button {
  aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.emoji-grid button .gl { width: 24px; height: 24px; }
.emoji-grid button:active { opacity: 0.6; }
.emoji-grid button.active { background: var(--accent); color: #fff; }
.color-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; justify-items: center;
  background: var(--card); border-radius: 16px; padding: 14px 10px;
}
.color-grid button {
  width: 36px; height: 36px; border-radius: 50%; background: var(--c);
  transition: transform 0.25s var(--spring), box-shadow 0.2s;
}
.color-grid button.active { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--c); transform: scale(0.92); }
.color-grid button:active { transform: scale(0.8); }

/* ============ Проверка операций из банка ============ */
.review-banner {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  transition: opacity 0.15s;
}
.review-banner:active { opacity: 0.6; }
.review-banner > span:nth-child(2) { flex: 1; font-size: 15px; }
.review-banner small { color: var(--text-2); font-size: 13px; }
@media (min-width: 900px) { .review-banner { grid-column: 1 / -1; } }
.review-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; cursor: pointer;
  background: var(--card); font-size: 15px;
}
.review-chip.active { box-shadow: inset 0 0 0 2px var(--accent); }
.badge {
  display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
  background: var(--fill); color: var(--text-2);
}
.badge.warn { background: none; color: var(--orange); padding: 0; }
.badge.warn::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 4px; vertical-align: 1px; }
.badge-ic { display: inline-block; margin-left: 6px; vertical-align: -2px; color: var(--text-3); }
.badge-ic .gl { width: 13px; height: 13px; }
.tx .am.saving { color: var(--accent); }
.tx.paused { opacity: 0.5; }
.paste-sms {
  justify-self: center; font-size: 14px; color: var(--accent); padding: 6px 14px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 10%, transparent); margin-top: -8px;
}
.paste-sms:active { transform: scale(0.96); }
.form-hint { font-size: 13px; color: var(--text-2); margin: -4px 6px 0; text-align: center; }

/* ============ Накопления на обзоре ============ */
.goals-mini { cursor: pointer; }
.goals-total { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: -6px 0 12px; font-variant-numeric: tabular-nums; }
.gm { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.gm-body { flex: 1; min-width: 0; }
.gm-top { display: flex; justify-content: space-between; font-size: 14px; }
.gm-top small { color: var(--text-2); font-variant-numeric: tabular-nums; }
.gm .meter, .goals-mini .meter { height: 6px; border-radius: 99px; background: var(--fill); margin-top: 5px; overflow: hidden; }
.gm .meter i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 1s var(--ease); }

/* ============ Планы ============ */
.plans { display: grid; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 8px; padding: 0 4px; }
.section-head h2 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.section-head .muted, .rec-summary { font-size: 14px; color: var(--text-2); display: flex; gap: 10px; }
.rec-summary .expense { color: var(--red); }
.rec-summary .income { color: var(--green); }
.goals-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .goals-grid { grid-template-columns: repeat(2, 1fr); } }
.goal { cursor: pointer; transition: opacity 0.15s; }
.goal:active { opacity: 0.7; }
.goal-head { display: flex; align-items: center; gap: 12px; }
.goal-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.goal-title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-title small { font-size: 13px; color: var(--text-2); }
.goal-pct { font-size: 20px; font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; }
.goal-bar { height: 10px; border-radius: 99px; background: var(--fill); overflow: hidden; margin: 14px 0 12px; }
.goal-bar i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--c);
  transition: width 1.1s var(--ease);
}
.goal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); flex-wrap: wrap; }
.goal-foot b { color: var(--text); font-size: 16px; }
.goal-actions { display: flex; gap: 6px; }
.pill {
  padding: 6px 14px; border-radius: 99px; font-size: 14px; font-weight: 600;
  background: var(--fill); color: var(--accent); transition: transform 0.15s;
}
.pill.primary { background: var(--accent); color: #fff; }
.pill:active { transform: scale(0.94); }

/* ============ Семья и автоимпорт ============ */
.info-row span { font-size: 14px; color: var(--text-2); line-height: 1.4; }
.info-row code, .guide code { font-size: 12px; background: var(--fill); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.info-row code { white-space: nowrap; }
.muted-action { color: var(--text-2) !important; }
.member { justify-content: flex-start; }
.member .grow { flex: 1; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(180deg, #a5a5aa, #8e8e93); color: #fff; font-weight: 600; font-size: 14px;
}
.sync-status { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sync-status[data-s="ok"]::before { background: var(--green); }
.sync-status[data-s="syncing"]::before { background: var(--accent); animation: pulse 1s infinite; }
.sync-status[data-s="offline"]::before { background: var(--orange); }
.sync-status[data-s="error"]::before { background: var(--red); }
@keyframes pulse { 50% { opacity: 0.3; } }
.guide { background: var(--card); border-radius: 16px; padding: 4px 16px; font-size: 14px; line-height: 1.45; }
.guide ol { padding-left: 18px; margin: 10px 0; }
.guide li { margin-bottom: 8px; }
.guide .form-hint { text-align: left; margin: 0 0 12px; }
.copy-card { padding: 4px 16px; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 0; }
.copy-row + .copy-row { border-top: 0.5px solid var(--sep); }
.copy-k { font-size: 12px; color: var(--text-2); grid-column: 1; }
.copy-v { font-size: 13px; font-family: ui-monospace, Menlo, monospace; word-break: break-all; grid-column: 1; }
.copy-row .pill { grid-column: 2; grid-row: 1 / span 2; }

/* ============ Кэшбэк ============ */
.plans-tabs { margin-bottom: 14px; }
.plans[hidden] { display: none; }
.card-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 99px;
  background: var(--fill); font-size: 13px; font-weight: 500; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.card-chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--bc); flex: none; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.2); }

.cb-hero .hero-label { color: var(--text-2); font-size: 15px; }
.cb-hero .hero-sub { color: var(--text-2); font-size: 13px; }
.cb-hero-amount { font-size: clamp(34px, 10vw, 44px); font-weight: 700; letter-spacing: -0.025em; margin: 4px 0 4px; font-variant-numeric: tabular-nums; color: var(--orange); }
.cb-bars { display: grid; gap: 8px; margin-top: 14px; }
.plans { grid-template-columns: minmax(0, 1fr); }
.cb-bar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.cb-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.95; }
.cb-bar > i { display: block; height: 8px; width: 0; border-radius: 99px; background: var(--orange); transition: width 0.5s ease-out; }
.cb-bar b { font-variant-numeric: tabular-nums; }
.cb-nocard { margin-top: 12px; font-size: 13px; color: var(--text-2); }

.cb-remind {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; text-align: left;
  padding: 12px 14px; margin-top: 12px; border-radius: 14px; font-size: 14px;
  background: var(--fill); color: var(--text);
}
.cb-remind b { color: var(--accent); font-weight: 600; margin-left: auto; }
.cb-remind.big { margin-top: 0; padding: 14px 16px; font-size: 15px; background: var(--card); }
.cb-remind.big > span:not(.ic-tile) { flex: 1; min-width: 180px; }
.cb-remind small { color: var(--text-2); }
.cb-pending { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; font-size: 15px; }
.cb-pending-actions { display: flex; gap: 8px; align-items: center; }
.cb-pending-actions select { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 0; background: var(--fill); }


.cb-mini { cursor: pointer; }
.cb-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: -6px 0 4px; }
.cb-total span { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--orange); font-variant-numeric: tabular-nums; }
.cb-total small { color: var(--text-2); font-size: 14px; }
.cb-tips { margin-top: 8px; margin-right: -16px; }
.cb-tips .list-row { min-height: 48px; }


/* Подсказка в окне операции */
.cb-hint { display: grid; gap: 6px; margin-top: -6px; }
.cb-cur, .cb-pick {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px;
  padding: 9px 12px; border-radius: 12px; background: var(--card); text-align: left;
}
.cb-cur b, .cb-pick b { color: var(--orange); }
.cb-cur small, .cb-pick small { color: var(--text-2); }
.cb-pick { border: 0; }
.cb-pick:active { transform: scale(0.98); }

/* Формы карты и категорий кэшбэка */
.card-preview { display: grid; place-items: center; padding: 4px 0 2px; }
.card-art {
  width: 100%; max-width: 300px; aspect-ratio: 1.586; border-radius: 16px; padding: 16px 18px;
  display: grid; grid-template-rows: auto 1fr auto; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--bc) 92%, #fff), color-mix(in srgb, var(--bc) 82%, #000));
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 6px 16px rgba(0,0,0,0.10);
  transition: background 0.3s;
}
.card-art.dark { color: #1c1c1e; background: linear-gradient(160deg, color-mix(in srgb, var(--bc) 92%, #fff), color-mix(in srgb, var(--bc) 88%, #000)); }
.ca-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ca-bank { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.ca-base { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,0.22); white-space: nowrap; }
.card-art.dark .ca-base { background: rgba(0,0,0,0.1); }
.ca-chip { width: 38px; height: 28px; border-radius: 6px; align-self: center; background: linear-gradient(135deg, #f5d98b, #c9a24a); opacity: 0.9; }
.ca-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; min-width: 0; }
.ca-name { font-size: 14px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ca-num { font-size: 17px; font-weight: 600; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; white-space: nowrap; }

.bank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .bank-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.bank-pick {
  height: 76px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 6px; border-radius: 14px; background: var(--card); transition: transform 0.2s var(--spring), box-shadow 0.2s;
}
.bank-pick.active { box-shadow: inset 0 0 0 2px var(--accent); }
.bank-pick:active { transform: scale(0.94); }
.bank-badge {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--bc); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -0.02em;
}
.bank-badge.dark { color: #1c1c1e; }
.bank-name { max-width: 100%; font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank-pick.active .bank-name { color: var(--text); font-weight: 600; }
.card-thumb {
  width: 46px; height: 30px; border-radius: 6px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--bc), color-mix(in srgb, var(--bc) 65%, #000));
  color: #fff; font-size: 11px; font-weight: 800; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.3);
}
.card-thumb.dark { color: #1c1c1e; background: linear-gradient(135deg, var(--bc), color-mix(in srgb, var(--bc) 85%, #000)); }

/* Карта и кэшбэк в списке операций */
.am-col { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.tx-cb { font-size: 13px; color: var(--orange); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dot-warn { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-right: 6px; vertical-align: 2px; }
.footnote { font-size: 13px; color: var(--text-2); margin: -8px 16px 0; line-height: 1.4; }
/* обычный inline (не inline-flex), чтобы длинная строка красиво обрезалась многоточием */
.tx-card { display: inline; white-space: nowrap; }
.tx-card i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--bc); margin-right: 4px; vertical-align: 1px; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-cb {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-bottom: 14px; padding: 10px 14px;
  border-radius: 12px; background: var(--card); font-size: 15px; text-align: left;
}
.history-cb span { flex: 1; }
.history-cb b { color: var(--orange); font-variant-numeric: tabular-nums; }
.history-cb small { color: var(--text-2); }
.history-cb:active { transform: scale(0.99); }

/* Шапка: шестерёнка и строка месяца */
.gear-btn { width: 38px; height: 38px; color: var(--accent); }
.gear-btn svg { width: 23px; height: 23px; stroke-width: 1.8; }
/* Доходы/расходы: без декоративных кружков — подпись и крупная сумма */
.tile-icon { display: none; }
.tile-label { font-size: 13px; }
.month-row { margin-top: 8px; }
.month-row[hidden] { display: none; }
.empty.small { padding: 14px; font-size: 14px; background: var(--card); border-radius: 12px; }
#ofCustom input { border: 0; background: var(--fill); border-radius: 8px; padding: 6px; }

/* ============ Значки ============ */
.gl { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
/* Плашка со значком, как в «Настройках» iPhone: сплошной цвет, белый значок */
.ic-tile {
  width: 36px; height: 36px; border-radius: 9px; flex: none;
  display: grid; place-items: center; background: var(--c); color: #fff;
}
.ic-tile .gl { width: 21px; height: 21px; stroke-width: 2; }
.ic-tile.sm { width: 30px; height: 30px; border-radius: 7px; }
.ic-tile.sm .gl { width: 18px; height: 18px; }
.ic-tile.lg { width: 44px; height: 44px; border-radius: 11px; }
.ic-tile.lg .gl { width: 25px; height: 25px; }
.ic-tile.xl { width: 72px; height: 72px; border-radius: 18px; }
.ic-tile.xl .gl { width: 40px; height: 40px; stroke-width: 1.8; }
.ic-tile-em { font-size: 20px; line-height: 1; }
.ic-tile.sm .ic-tile-em { font-size: 16px; }
.ic-tile.xl .ic-tile-em { font-size: 36px; }
.tile-add { background: var(--fill); color: var(--accent); }
.cat .ic-tile { width: 40px; height: 40px; border-radius: 10px; }
.legend li { grid-template-columns: 30px 1fr auto; }
.legend .ic-tile { width: 30px; height: 30px; border-radius: 7px; }
.legend .ic-tile .gl { width: 18px; height: 18px; }
.chip-ic { display: inline-grid; vertical-align: -3px; margin-right: 2px; }
.chip-ic .gl { width: 14px; height: 14px; }
/* Пустые состояния: крупный серый значок, как в приложениях Apple */
.empty-ic { display: grid; place-items: center; color: var(--text-3); margin-bottom: 10px; }
.empty-ic .gl { width: 44px; height: 44px; stroke-width: 1.5; }
.empty .big { display: none; }

/* ============ Списки в стиле iOS ============ */
.card.list { padding: 0 0 0 16px; overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px;
  padding: 8px 16px 8px 0; text-align: left; position: relative; font-size: 16px; color: var(--text);
}
.list-row + .list-row::before, .of-row + .list-row::before, .of-row + .of-row::before {
  content: ""; position: absolute; top: 0; left: 42px; right: 0; height: 0.5px; background: var(--sep);
}
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lr-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-value { font-size: 16px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lr-value.cb { color: var(--orange); font-weight: 600; font-size: 17px; }
.action-row { color: var(--accent); cursor: pointer; }
.action-row .lr-title { color: var(--accent); }
.action-row:active { background: var(--fill); }
.list-empty { padding: 16px 16px 16px 0; color: var(--text-2); font-size: 15px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bc); margin-right: 5px; vertical-align: 1px; }
.chev.down { width: 13px; height: 13px; }
.group-title + .card { margin-top: 0; }
#cashbackPanel .group-title { margin: 10px 16px 8px; }
.cb-missed { margin-top: 12px; font-size: 13px; color: var(--text-2); }

/* ============ Мои карты — как в Wallet ============ */
.wallet { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .wallet { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wallet-item { display: grid; gap: 10px; }
.wallet-art { display: block; width: 100%; padding: 0; transition: transform 0.15s ease-out; }
.wallet-art:active { transform: scale(0.98); }
.card-art.compact { max-width: none; aspect-ratio: auto; height: 132px; padding: 14px 16px; }
.ca-sum { font-size: 15px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,0.22); font-variant-numeric: tabular-nums; }
.card-art.dark .ca-sum { background: rgba(0,0,0,0.1); }

/* ============ Форма категорий кэшбэка ============ */
.of-row {
  display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px;
  align-items: center; padding: 10px 16px 10px 0; position: relative;
}
.of-del {
  width: 22px; height: 22px; border-radius: 50%; background: var(--red); position: relative; flex: none;
}
.of-del::after { content: ""; position: absolute; left: 6px; right: 6px; top: 10px; height: 2px; border-radius: 1px; background: #fff; }
.of-name { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 16px; cursor: pointer; }
.of-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.of-name .chev { stroke: var(--text-3); }
/* Невидимый системный список поверх названия: выглядит как текст, открывается родной выбор */
.of-name select { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.of-pct-wrap { display: flex; align-items: baseline; gap: 1px; color: var(--orange); font-weight: 600; font-size: 17px; }
.of-pct-wrap input {
  width: 3.2ch; border: 0; background: none; outline: none; text-align: right; padding: 0;
  font: inherit; color: inherit; font-variant-numeric: tabular-nums;
}
.of-limit-wrap {
  grid-column: 3 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.of-limit-wrap input {
  border: 0; background: none; outline: none; text-align: right; font: inherit; color: var(--text-2);
  min-width: 0; width: 50%; padding: 2px 0;
}
.of-rows .action-row::before { left: 42px; }
#ofCustom input { border: 0; background: var(--fill); border-radius: 8px; padding: 6px; }

/* Версия текста для другого языка (например, русская инструкция при английском интерфейсе) */
[data-skip] { display: none !important; }

/* ============ Экран входа ============ */
/* До входа никакие части приложения не доступны — даже закрытые шторки */
body.gated .sheet, body.gated .sheet-backdrop, body.gated .ai-fab { display: none !important; }
.auth {
  min-height: 100dvh; display: grid; justify-items: center; align-content: start;
  padding: calc(env(safe-area-inset-top) + 12vh) 16px calc(env(safe-area-inset-bottom) + 24px);
  animation: viewIn 0.25s ease-out;
}
.auth-inner { width: min(100%, 400px); display: grid; gap: 6px; justify-items: center; text-align: center; }
.auth-logo { width: 72px; height: 72px; border-radius: 16px; margin-bottom: 10px; }
.auth-title { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: 0.005em; }
.auth-sub { margin: 0 0 22px; color: var(--text-2); font-size: 16px; }
.auth-body { width: 100%; display: grid; gap: 14px; text-align: left; grid-template-columns: minmax(0, 1fr); }
.auth-body .card.group { padding: 0 16px; }
.auth-note { margin: 0; text-align: center; color: var(--text-2); font-size: 15px; line-height: 1.4; }
.auth-note b { color: var(--text); font-weight: 600; word-break: break-all; }
.auth-error { margin: -4px 4px 0; color: var(--red); font-size: 14px; text-align: center; }
.btn-primary {
  width: 100%; min-height: 50px; border-radius: 12px; background: var(--accent); color: #fff;
  font-size: 17px; font-weight: 600; transition: opacity 0.15s;
}
.btn-primary:active { opacity: 0.7; }
.btn-primary:disabled { opacity: 0.5; }
.code-input {
  width: 100%; border: 0; border-radius: 12px; background: var(--card); padding: 14px;
  text-align: center; font: inherit; font-size: 30px; font-weight: 600; letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums; color: var(--text); outline: none;
}
.code-input::placeholder { color: var(--text-3); letter-spacing: 0.35em; }
.code-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 4px; }
.auth-links .link { font-size: 15px; }
.auth-links .link:disabled { color: var(--text-3); }
.footnote.center { text-align: center; margin: -4px 8px 0; }
.center-link { justify-self: center; font-size: 15px; padding: 8px; margin-top: 4px; }

/* ============ ИИ: сканирование и советы ============ */
.quick-fill { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: -8px; }
.quick-fill .paste-sms { margin-top: 0; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; flex: none;
}
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-wait { display: grid; justify-items: center; gap: 14px; padding: 48px 16px; color: var(--text-2); text-align: center; }
.scan-wait p { margin: 0; }
.scan-item, .scan-tx {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 16px 10px 0; position: relative;
}
.scan-tx { grid-template-columns: 24px minmax(0, 1fr) auto; cursor: pointer; }
.scan-item + .scan-item::before, .scan-tx + .scan-tx::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 0.5px; background: var(--sep); }
.scan-cat {
  border: 0; border-radius: 8px; background: var(--fill); padding: 5px 8px; font-size: 13px; color: var(--text);
  max-width: 150px; -webkit-appearance: none; appearance: none;
}
.scan-tx .scan-cat { margin-top: 4px; justify-self: start; }
.scan-tx .lr-main { gap: 2px; }
/* Флажок как в iOS: круг, при выборе — синий с галочкой */
.check {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text-3); background: transparent;
  display: grid; place-items: center; transition: background 0.15s, border-color 0.15s;
}
.check::after { content: ''; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { opacity: 1; }
.lr-value.strong { color: var(--text); font-weight: 600; }
.lr-value.income { color: var(--green); }
.footnote.warn { color: var(--orange); }
.receipt-items { display: grid; gap: 8px; }

.insight-facts { margin-right: -16px; }
.insight-facts .lr-sub .up { color: var(--green); }
.insight-facts .lr-sub .down { color: var(--red); }
.ai-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px;
  padding: 12px; border-radius: 12px; background: var(--fill); color: var(--accent); font-weight: 600; font-size: 15px;
}
.ai-btn .gl { width: 20px; height: 20px; }
.ai-btn:active { opacity: 0.6; }
.ai-btn:disabled { color: var(--text-2); }
.tips { display: grid; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--sep); }
.tips-summary { margin: 0; color: var(--text-2); font-size: 15px; }
.tip-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.tip-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.tip-ic .gl { width: 17px; height: 17px; }
.tip-row b { font-size: 15px; }
.tip-row p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.4; }
.tip-row small { display: block; margin-top: 4px; color: var(--green); font-size: 13px; font-weight: 500; }
.tips .link { justify-self: start; font-size: 15px; }
@media (min-width: 900px) { .insights { grid-column: 1 / -1; } }

/* ============ Окно ввода текста ============ */
.ask {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(0,0,0,0); transition: background 0.25s;
}
.ask.open { background: rgba(0,0,0,0.35); }
.ask-box {
  width: min(100%, 420px); background: var(--card); border-radius: 18px; padding: 18px; display: grid; gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25); transform: scale(0.94); opacity: 0;
  transition: transform 0.3s var(--spring), opacity 0.2s;
}
.ask.open .ask-box { transform: none; opacity: 1; }
.ask-box h3 { margin: 0; font-size: 17px; text-align: center; }
.ask-box textarea, .ask-box input {
  width: 100%; border: 0; border-radius: 12px; background: var(--fill); padding: 10px 12px;
  font: inherit; font-size: 16px; outline: none; resize: vertical;
}
.ask-actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.ask-actions button { padding: 11px; border-radius: 12px; font-weight: 600; background: var(--fill); color: var(--accent); }
.ask-actions .ask-ok { background: var(--accent); color: #fff; }

/* ============ Тост ============ */
.toast {
  position: fixed; z-index: 60; left: 50%; top: calc(env(safe-area-inset-top) + 12px);
  /* Спрятано целиком: на iPhone сверху есть отступ под вырез, поэтому уводим за экран с запасом и делаем невидимым */
  transform: translate(-50%, calc(-100% - env(safe-area-inset-top) - 40px)); opacity: 0; visibility: hidden;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  transition: transform 0.45s var(--spring), opacity 0.2s, visibility 0s 0.45s; white-space: nowrap; max-width: calc(100vw - 32px);
  overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform 0.45s var(--spring), opacity 0.15s, visibility 0s; }
.toast button { color: var(--accent); font-weight: 600; margin-left: 10px; }

@media (max-width: 380px) {
  .title { font-size: 28px; }
  .tab { font-size: 10px; }
  .budget-body { grid-template-columns: 100px 1fr; }
  .ring, .budget-ring-label { width: 100px; height: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Нераспознанные сообщения банка */
.up-row { align-items: flex-start; }
.up-text { font-size: 14px; line-height: 1.35; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.up-row .icon-btn { width: 30px; height: 30px; flex: none; }
.guide h4 { font-size: 15px; font-weight: 600; margin: 14px 0 0; }
.guide p { margin: 6px 0 12px; }
.guide-btn { margin: 14px 0 4px; }
.test-result { font-size: 14px; text-align: center; color: var(--red); margin: 0 8px 12px; }
.test-result[data-ok="1"] { color: var(--green); }

/* ============ Кнопка AI-помощника над меню ============
   При открытии приложения на пару секунд раскрывается в «таблетку» с подписью, потом сворачивается в круг */
.ai-fab {
  position: fixed; z-index: 29;
  right: max(16px, calc((100% - 1132px) / 2 + 16px));
  bottom: calc(env(safe-area-inset-bottom) + 74px);
  height: 54px; min-width: 54px; padding: 0 12px; border-radius: 27px;
  display: flex; align-items: center; justify-content: center; gap: 0;
  background: var(--glass); color: var(--accent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid var(--sep);
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease-out, opacity 0.2s, gap 0.45s var(--ease), padding 0.45s var(--ease);
}
.ai-fab-logo { position: relative; width: 30px; height: 30px; flex: none; display: block; }
.ai-fab-logo .logo { width: 30px; height: 30px; display: block; }
.ai-fab-spark { position: absolute; right: -5px; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.ai-fab-spark svg { width: 11px; height: 11px; fill: #fff; }
.ai-fab-label {
  max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0;
  font-size: 15px; font-weight: 600; color: var(--text);
  transition: max-width 0.45s var(--ease), opacity 0.3s;
}
.ai-fab.expanded { gap: 9px; padding: 0 18px 0 12px; }
.ai-fab.expanded .ai-fab-label { max-width: 160px; opacity: 1; }
.ai-fab:active { transform: scale(0.94); }
.ai-fab[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .ai-fab, .ai-fab-label { transition: none; } }

/* ============ Окно AI-помощника ============ */
.asst-hint { font-size: 15px; color: var(--text-2); margin: 0 4px 14px; line-height: 1.4; }
.asst-box { background: var(--card); border-radius: 18px; padding: 10px 10px 8px; }
.asst-box textarea {
  display: block; width: 100%; min-height: 84px; max-height: 40vh; resize: none;
  border: 0; outline: none; background: none; padding: 4px 6px;
  font: inherit; font-size: 17px; line-height: 1.4; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.asst-box textarea::placeholder { color: var(--text-3); }
.asst-files { display: flex; gap: 8px; padding: 2px 2px 8px; overflow-x: auto; }
.asst-thumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 12px; background: var(--fill) center / cover no-repeat; }
.asst-thumb button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--text); color: var(--card); font-size: 15px; line-height: 22px; text-align: center; }
.asst-bar { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.asst-tool { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); }
.asst-tool:active { background: var(--fill); }
.asst-tool svg, .asst-tool .gl { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.asst-tool.live { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); animation: pulse 1.2s infinite; }
.asst-status { flex: 1; font-size: 13px; color: var(--red); padding-left: 4px; }
.asst-send { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.asst-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.asst-send:active { transform: scale(0.92); }
.asst-box.shake { animation: shake 0.4s; }
.asst-examples { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.asst-examples button { padding: 7px 12px; border-radius: 99px; background: var(--card); color: var(--text-2); font-size: 14px; text-align: left; }
.asst-examples button:active { opacity: 0.6; }
.asst-pro { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); font-size: 14px; color: var(--text-2); }
.pro-tag.gray { color: var(--text-2); background: var(--fill); }

/* ============ Тариф Pro ============ */
.pro-head { display: grid; justify-items: center; gap: 6px; padding: 8px 0 18px; }
.pro-price { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.pro-status { text-align: center; font-size: 15px; margin: 6px 0 4px; color: var(--green); }
.pro-status.muted { color: var(--text-2); }
a.btn-primary { display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; padding: 0 16px; }
.pro-tag { display: inline-block; vertical-align: 1px; margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); border-radius: 6px; padding: 1px 6px; }
.plan-row { display: flex; align-items: center; gap: 8px; }
.plan-row > span:first-child { flex: 1; color: var(--text); text-align: left; }
.pro-list .lr-sub { white-space: normal; overflow: visible; text-overflow: clip; }
.pro-title { font-size: 22px; font-weight: 700; margin-top: 6px; }
.pro-state { font-size: 15px; color: var(--text-2); text-align: center; }
.pro-state.ok { color: var(--green); }
.pro-state.warn { color: var(--orange); }
.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-2); margin: 22px 16px 6px; }
.offer-row { text-decoration: none; color: inherit; }
.offer-row .lr-value { color: var(--text); font-weight: 600; margin-right: 6px; }
.pro-tag.green { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }

/* ============ Общий счёт: кто сколько потратил ============ */
.person-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 0; text-align: left; }
.person-row .meter { display: block; height: 6px; border-radius: 99px; background: var(--fill); margin-top: 5px; overflow: hidden; }
.person-row .meter i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 1s var(--ease); }
.person-row .gm-top b { font-weight: 600; font-variant-numeric: tabular-nums; }
.person-row:active { opacity: 0.6; }
.person-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; }
.person-chips::-webkit-scrollbar { display: none; }
.person-chips button { flex: none; padding: 6px 14px; border-radius: 99px; background: var(--card); color: var(--text); font-size: 14px; }
.person-chips button.active { background: var(--accent); color: #fff; }

/* Поле даты: наш текст в «таблетке», системный календарь — по нажатию */
.date-field { position: relative; display: inline-flex; align-items: center; min-width: 0; padding: 6px 11px; border-radius: 8px; background: var(--fill); color: var(--text); font-size: 16px; cursor: pointer; white-space: nowrap; }
.date-field input[type="date"] { position: absolute; inset: 0; width: 100% !important; height: 100%; opacity: 0; cursor: pointer; padding: 0; margin: 0; border: 0; }
.date-field input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-field:active { opacity: 0.6; }

/* ============ Мотивация ============ */
.motivation { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) { .motivation { grid-column: 1 / -1; } }
.mv { display: inline-flex; align-items: baseline; gap: 5px; padding: 8px 14px; border-radius: 99px; background: var(--card); font-size: 14px; color: var(--text-2); }
.mv b { color: var(--orange); font-size: 16px; font-variant-numeric: tabular-nums; }
.mv.good { color: var(--green); }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }
.asst-upsell { margin-top: 14px; padding: 16px; border-radius: 18px; background: var(--card); display: grid; gap: 12px; }
.asst-upsell-text { display: grid; gap: 4px; font-size: 14px; color: var(--text-2); }
.asst-upsell-text b { font-size: 16px; color: var(--text); }
.asst-upsell .btn-primary { margin: 0; }

/* ============ Объявления, поддержка, рефералы ============ */
.news-banner { cursor: pointer; }
.news-banner .news-text { flex: 1; font-size: 15px; }
.news-banner small { color: var(--text-2); font-size: 13px; }
.news-close { width: 28px; height: 28px; border-radius: 50%; flex: none; color: var(--text-3); font-size: 20px; line-height: 28px; }
.news-close:active { background: var(--fill); }
.badge-dot { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 13px; font-weight: 600; line-height: 20px; text-align: center; }
#settingsBtn { position: relative; }
#settingsBtn.has-badge::after { content: ''; position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }
.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.topic-chips button { padding: 7px 13px; border-radius: 99px; background: var(--card); color: var(--text); font-size: 14px; }
.topic-chips button.active { background: var(--accent); color: #fff; }
.ticket { padding: 14px 16px; margin-bottom: 12px; display: grid; gap: 6px; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; }
.ticket-status { font-size: 12px; padding: 2px 9px; border-radius: 10px; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.ticket-status.answered { color: var(--green); }
.ticket-status.open { color: var(--orange); }
.ticket-msg { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-date { font-size: 12px; color: var(--text-3); }
.ticket-reply { margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: var(--fill); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-reply small { display: block; color: var(--accent); font-size: 12px; font-weight: 600; margin-bottom: 2px; }

/* Логотип со звёздочкой ИИ (экран подписки) */
.brand-mark { position: relative; display: inline-block; width: var(--bm); height: var(--bm); flex: none; }
.brand-mark .logo { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 14px rgba(226, 91, 45, 0.25)); }
.brand-spark { position: absolute; right: -4%; top: -4%; width: 38%; height: 38%; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg); }
.brand-spark svg { width: 64%; height: 64%; fill: #fff; }
.buy-btn { margin-top: 12px; }
.footnote.center { text-align: center; }

/* Банки: длинные метки мельче, «Банки других стран», свой банк */
.bank-badge.long { font-size: 9.5px; letter-spacing: -0.03em; }
.bank-more { grid-column: 1 / -1; padding: 10px; border-radius: 12px; color: var(--accent); font-size: 15px; font-weight: 500; }
.bank-more:active { opacity: 0.6; }
.bank-colors > div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.bank-colors button { width: 24px; height: 24px; border-radius: 50%; background: var(--bc); transition: transform 0.2s var(--spring), box-shadow 0.2s; }
.bank-colors button.active { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--bc); }
.bank-colors button:active { transform: scale(0.88); }

/* Логотипы банков: full — со своим фоном, tile — на белой плитке, mono — знак цвета текста на фирменном цвете */
.bank-logo { width: 68%; height: 68%; fill: currentColor; display: block; }
.bank-logo.m-full { border-radius: 22%; }
.bank-logo.m-tile { background: #fff; border-radius: 22%; padding: 3px; box-sizing: border-box; }
.bank-badge.lg-full, .bank-badge.lg-tile { background: none; overflow: hidden; }
.bank-badge.lg-full .bank-logo, .bank-badge.lg-tile .bank-logo { width: 100%; height: 100%; border-radius: 0; }
.bank-badge.lg-full, .bank-badge.lg-tile { box-shadow: 0 0 0 0.5px color-mix(in srgb, var(--text) 16%, transparent); }
.card-thumb .bank-logo { width: 18px; height: 18px; }
.ca-bank { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ca-bank .bank-logo { width: 24px; height: 24px; flex: none; }
.ca-bank .bank-logo.m-full, .ca-bank .bank-logo.m-tile, .card-thumb .bank-logo.m-full, .card-thumb .bank-logo.m-tile { box-shadow: 0 0 0 1px rgba(255,255,255,0.35); }

/* ===== Инструкция «Подключить телефон»: шаги со схематичными экранами ===== */
.phone-guide { display: flex; flex-direction: column; gap: 12px; }
.pg-lead { margin: 0; font-size: 15px; line-height: 1.45; color: var(--text-2); }
.pg-status { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--card); font-size: 15px; font-weight: 500; }
.pg-status i { width: 10px; height: 10px; border-radius: 50%; background: #FF9500; flex: none; margin-top: 6px; }
.pg-status.ok i { background: #34C759; box-shadow: 0 0 0 4px color-mix(in srgb, #34C759 22%, transparent); }
.pg-status small { display: block; font-weight: 400; font-size: 13px; color: var(--text-2); margin-top: 2px; line-height: 1.35; }
.pg-list { display: flex; flex-direction: column; gap: 12px; }
.pg-list[hidden] { display: none; }
.pg-step { background: var(--card); border-radius: 18px; padding: 14px 16px 16px; font-size: 15px; line-height: 1.45; }
.pg-step p { margin: 10px 0 0; }
.pg-step h4 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.pg-step code { font-size: 13px; background: var(--fill); padding: 1px 6px; border-radius: 6px; }
.pg-soft { background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
.pg-soft p { color: var(--text-2); font-size: 14px; }
.pg-note { color: var(--text-2); font-size: 14px; }
.pg-head { display: flex; gap: 12px; align-items: center; }
.pg-head small { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.pg-num { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.pg-link { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.pg-link code { background: none; padding: 0; font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; display: block; }
.pg-copy { margin-top: 10px; width: 100%; transition: background 0.2s; }
.pg-copy.done { background: #34C759; }

/* Схематичный экран телефона */
.mk { margin-top: 12px; border-radius: 16px; padding: 10px; background: #F2F2F7; color: #1C1C1E; font-size: 13px; line-height: 1.25;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.mk-android { background: #F4F6FA; }
.mk svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mk-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 26px; }
.mk-nav b { font-size: 14px; text-align: center; }
.mk-nav > span:last-child { justify-self: end; }
.mk-link { color: #007AFF; font-weight: 600; display: inline-flex; align-items: center; padding: 3px 6px; border-radius: 8px; }
.mk-link svg { width: 18px; height: 18px; }
.mk-group { background: #fff; border-radius: 11px; overflow: hidden; }
.mk-row { display: flex; align-items: center; gap: 9px; padding: 8px 10px; position: relative; }
.mk-row + .mk-row { box-shadow: inset 0 0.5px 0 rgba(60,60,67,0.18); }
.mk-l { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-v { color: #8E8E93; white-space: nowrap; }
.mk-chev { color: #C7C7CC; display: inline-flex; }
.mk-chev svg { width: 13px; height: 13px; }
.mk-ic { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: #fff; flex: none; }
.mk-ic svg { width: 15px; height: 15px; }
.mk-radio { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #C7C7CC; display: grid; place-items: center; flex: none; }
.mk-radio.on { background: #007AFF; box-shadow: none; color: #fff; }
.mk-radio svg { width: 12px; height: 12px; stroke-width: 3; }
.mk-blue { color: #007AFF; }
.mk-typed { color: #1C1C1E; font-weight: 600; }
.mk-typed::after { content: ''; display: inline-block; width: 1.5px; height: 13px; background: #007AFF; margin-left: 1px; vertical-align: -2px; animation: mk-caret 1s steps(1) infinite; }
@keyframes mk-caret { 50% { opacity: 0; } }
.mk-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0 8px; color: #8E8E93; }
.mk-empty svg { width: 28px; height: 28px; }
.mk-tabs { display: flex; justify-content: space-around; background: rgba(255,255,255,0.9); border-radius: 12px; padding: 6px 4px; }
.mk-tabs span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: #8E8E93; padding: 2px 8px; border-radius: 8px; }
.mk-tabs span.on { color: #007AFF; }
.mk-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mk-card { height: 54px; border-radius: 12px; background: #fff; }
.mk-card-blank { grid-column: 1 / -1; height: auto; background: #007AFF; color: #fff; display: flex; align-items: center; gap: 8px; padding: 12px; font-weight: 600; }
.mk-search { display: flex; align-items: center; gap: 6px; background: rgba(118,118,128,0.12); border-radius: 10px; padding: 7px 10px; color: #8E8E93; }
.mk-action { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 12px; padding: 10px; }
.mk-action > span:nth-child(2) { flex: 1; min-width: 0; }
.mk-chip { display: inline-block; padding: 1px 7px; border-radius: 6px; background: rgba(0,122,255,0.12); color: #007AFF; font-weight: 600; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.mk-chip.var { background: #5856D6; color: #fff; }
.mk-more { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #8E8E93; background: rgba(118,118,128,0.12); }
.mk-kv { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 11px; padding: 8px 10px; }
.mk-key { font-family: ui-monospace, Menlo, monospace; color: #1C1C1E; padding: 2px 8px; border-radius: 6px; background: rgba(118,118,128,0.12); }
.mk-abar { display: flex; align-items: center; justify-content: space-between; background: #1E88E5; color: #fff; border-radius: 11px; padding: 9px 12px; }
.mk-abar b { font-size: 14px; }
.mk-fab { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,0.22); }
.mk-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mk-tile { background: var(--c); color: #fff; border-radius: 12px; padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; font-weight: 600; min-height: 58px; }
.mk-tile svg { width: 20px; height: 20px; }

/* Подсветка: куда нажать */
.mk .hl { position: relative; z-index: 1; box-shadow: 0 0 0 2px #FF9500; border-radius: 9px; animation: mk-pulse 1.6s ease-in-out infinite; }
.mk .mk-row.hl { border-radius: 0; box-shadow: inset 0 0 0 2px #FF9500; background: rgba(255,149,0,0.08); }
.mk .mk-group .mk-row.hl:first-child { border-radius: 11px 11px 0 0; }
.mk .mk-group .mk-row.hl:last-child { border-radius: 0 0 11px 11px; }
.mk .mk-group .mk-row.hl:only-child { border-radius: 11px; }
.mk .mk-fab.hl, .mk .mk-more.hl { border-radius: 50%; }
.mk .mk-card-blank.hl, .mk .mk-tile.hl { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #FF9500; border-radius: 12px; }
@keyframes mk-pulse { 50% { box-shadow: 0 0 0 4px rgba(255,149,0,0.45); } }
.mk .mk-row.hl { animation: none; }
@media (prefers-reduced-motion: reduce) { .mk .hl, .mk-typed::after { animation: none; } }
/* Пояснение первым элементом шторки не залезает под заголовок */
.sheet-body > .footnote:first-child { margin-top: 0; }
/* Подписи категорий: не вылезают за плитку, не больше двух строк */
.cat { min-width: 0; }
.cat-label { max-width: 100%; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; }
.cat-label.sm { font-size: 11px; letter-spacing: -0.01em; }
.cat-label.xs { font-size: 10px; letter-spacing: -0.02em; }
.ask-paste { width: 100%; padding: 10px; margin: -2px 0 10px; border-radius: 12px; background: var(--fill); color: var(--accent); font-weight: 600; }
.ask-paste:active { opacity: 0.6; }
/* Длинные названия банков — в две строки, без многоточия */
.bank-pick { height: auto; min-height: 80px; padding: 8px 4px; }
.bank-name { white-space: normal; text-align: center; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 11.5px; }
/* Длинное уведомление переносится, а не обрезается многоточием */
.toast { white-space: normal; width: max-content; text-align: center; line-height: 1.3; border-radius: 18px; overflow: visible; text-overflow: clip; }

/* Схемы «Быстрых команд» iOS 26 */
.mk-big { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; padding: 2px 2px 0; }
.mk-h { font-size: 14px; font-weight: 700; padding: 2px 2px 0; }
.mk-fabc { display: flex; justify-content: center; padding-top: 2px; }
.mk-round { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; box-shadow: 0 0 0 0.5px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08); color: #1C1C1E; flex: none; }
.mk-round.big { width: 40px; height: 40px; }
.mk-round.big svg { width: 20px; height: 20px; }
.mk .mk-round.hl { border-radius: 50%; }
.mk-ed { display: flex; align-items: center; gap: 8px; }
.mk-edt { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; margin-right: 30px; }
.mk-edt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-edt .mk-ic { width: 20px; height: 20px; border-radius: 6px; }
.mk-edt .mk-ic svg { width: 13px; height: 13px; }
.mk-sheet { margin-top: 30px; background: rgba(255,255,255,0.75); border-radius: 18px 18px 12px 12px; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -2px 10px rgba(0,0,0,0.06); }
.mk-grab { display: block; width: 36px; height: 4px; border-radius: 4px; background: rgba(60,60,67,0.25); margin: 0 auto; }
.mk-pills { display: flex; gap: 6px; overflow: hidden; }
.mk-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 99px; background: #fff; color: #007AFF; font-weight: 500; white-space: nowrap; box-shadow: 0 0 0 0.5px rgba(0,0,0,0.08); }
.mk .mk-pill.hl { border-radius: 99px; }
.mk-block { background: #fff; border-radius: 14px; overflow: hidden; }
.mk-bh { display: flex; align-items: center; gap: 8px; padding: 9px 10px; font-size: 13.5px; line-height: 1.35; }
.mk-bh > span:last-child { flex: 1; min-width: 0; }
.mk-bh .mk-ic { width: 22px; height: 22px; }
.mk-dot { width: 14px; height: 12px; border-radius: 50%; background: #34C759; flex: none; }
.mk-bf { padding: 7px 10px 9px; box-shadow: inset 0 0.5px 0 rgba(60,60,67,0.18); display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.mk-chip.faded { color: rgba(0,122,255,0.45); background: rgba(0,122,255,0.07); }
.mk-chip.plus { padding: 1px 5px; }
.mk-chip.plus svg { width: 12px; height: 12px; vertical-align: -2px; }
.mk-arrow { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #007AFF; box-shadow: inset 0 0 0 1.5px #007AFF; vertical-align: middle; }
.mk-arrow svg { width: 12px; height: 12px; stroke-width: 2.6; }
.mk .mk-arrow.hl { border-radius: 50%; }
.mk-kbbar { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.8); border-radius: 99px; padding: 5px 6px 5px 12px; font-weight: 500; }
.mk-kbbar > span:first-child { flex: 1; }
.mk-kbbar .mk-pill { color: #1C1C1E; }
.mk-addc, .mk-delc { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.mk-addc { background: #34C759; } .mk-delc { background: #FF3B30; }
.mk-addc svg, .mk-delc svg { width: 12px; height: 12px; stroke-width: 3; }
.mk-muted { color: #8E8E93; }
.mk-key-t { font-weight: 500; flex: 0 0 auto; margin-right: 6px; }
.mk-var { display: flex; justify-content: center; margin: -2px 0; }
.mk-chip.var-msg { display: inline-flex; align-items: center; gap: 4px; background: rgba(0,122,255,0.12); color: #007AFF; }
.mk-chip.var-msg svg { width: 13px; height: 13px; }
.mk .mk-chip.hl { border-radius: 6px; }
.pg-warn { background: color-mix(in srgb, #FF9500 14%, transparent); border-radius: 12px; padding: 9px 12px; font-size: 14px; }
.pg-status.warn i { background: #FF3B30; }

/* Советы: цвет по виду, первый шаг, кнопка действия и «Не подходит» */
.tip-ic { background: color-mix(in srgb, var(--tc, var(--accent)) 14%, transparent); color: var(--tc, var(--accent)); }
.tip-row { transition: opacity 0.25s, transform 0.25s; }
.tip-row.tip-gone { opacity: 0; transform: translateX(16px); }
.tip-row p.tip-action { color: var(--text); font-weight: 500; margin-top: 6px; }
.tip-row p.tip-action::before { content: '→ '; color: var(--text-3); }
.tip-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.tip-btn { padding: 6px 12px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 14px; font-weight: 600; }
.tip-mini { font-size: 13px; color: var(--text-3); padding: 6px 0; }
.tip-btn:active, .tip-mini:active { opacity: 0.6; }

/* Строка «Кэшбэк» в окне операции: сумма сразу видна и её можно поправить */
.cb-row { align-items: center; }
.cb-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cb-label small { font-size: 12px; color: var(--text-2); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-label small .link { font-size: 12px; padding: 0; }
.cb-field { display: inline-flex; align-items: baseline; gap: 3px; margin-left: auto; color: var(--orange); font-weight: 600; }
.row .cb-field input { width: 90px; text-align: right; color: var(--orange); font-weight: 600; padding: 0; }
.cb-field em { font-style: normal; }
.row .cb-field input#cbInput { color: var(--orange); font-weight: 600; font-size: 17px; }
.row .cb-field input#cbInput::placeholder { color: var(--text-3); font-weight: 400; }
.cb-label small { white-space: normal; overflow: visible; }

/* ===== Шапка обзора: «Сейчас», «Месяц / Год», люди, сжатие при прокрутке ===== */
.month-row { gap: 8px; }
.month-row .month-switch { margin-right: auto; }
.month-label small { display: block; font-size: 11px; font-weight: 500; color: var(--text-2); margin-top: -1px; letter-spacing: 0; text-transform: none; }
.now-btn { padding: 7px 12px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 14px; font-weight: 600; white-space: nowrap; }
.now-btn:active { opacity: 0.6; }
.period-seg { flex: none; }
.period-seg[hidden] { display: none; }
.period-seg button { padding: 6px 12px; }
.person-row { justify-content: flex-start; gap: 8px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.person-row::-webkit-scrollbar { display: none; }
.person-row[hidden] { display: none; }
.person-row button { padding: 6px 14px; border-radius: 99px; background: var(--card); font-size: 14px; font-weight: 500; white-space: nowrap; box-shadow: inset 0 0 0 0.5px var(--sep); }
.person-row button.active { background: var(--accent); color: #fff; box-shadow: none; }
.topbar .title { transition: font-size 0.25s var(--ease); }
.topbar.compact { padding-top: calc(env(safe-area-inset-top) + 6px); padding-bottom: 8px; }
.topbar.compact .title { font-size: 22px; }
.topbar.compact .month-row, .topbar.compact .person-row { margin-top: 6px; }
@media (max-width: 380px) { .period-seg button { padding: 6px 9px; } .now-btn { padding: 7px 10px; } }

/* Выбор месяца из списка */
.month-pick .list-row { width: 100%; text-align: left; }
.month-pick .list-row.on .lr-title { color: var(--accent); font-weight: 600; }
.mp-check { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; margin-left: 8px; flex: none; }

/* Год */
.year-grid[hidden] { display: none; }
.year-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.year-stats span { display: block; font-size: 12px; color: var(--text-2); }
.year-stats b { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.year-stats b.income { color: var(--green); } .year-stats b.neg { color: var(--red); }
.year-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; height: 170px; align-items: end; margin-top: 6px; }
.ybar { height: 100%; display: grid; grid-template-rows: 14px minmax(0, 1fr) 16px; justify-items: center; gap: 3px; min-width: 0; }
.ybar-area { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.ybar i { width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--accent) 55%, transparent); transition: height 0.5s var(--ease); }
.ybar.now i { background: var(--accent); }
.ybar.nodata i { background: var(--fill); }
.ybar-v { font-size: 10px; overflow: hidden; max-width: 100%; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ybar-m { font-size: 11px; color: var(--text-2); }
.ybar.now .ybar-m { color: var(--accent); font-weight: 600; }
.ybar:active i { opacity: 0.6; }
.topbar-inner .period-seg { margin-left: auto; }
.ybar { display: flex; flex-direction: column; align-items: center; gap: 3px; height: 170px; }
.ybar-v { height: 14px; flex: none; }
.ybar-area { flex: 1 1 0; min-height: 0; height: auto; }
.ybar-m { height: 16px; flex: none; }
.year-grid .lr-sub { white-space: normal; }

/* Кнопка периода в заголовке: месяц/год и фильтры спрятаны в окно */
.period-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px 0 14px; border-radius: 99px;
  background: var(--fill); color: var(--text); font-size: 15px; font-weight: 600; max-width: 55vw; transition: background 0.2s, color 0.2s; }
.period-pill[hidden] { display: none; }
.period-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.period-pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: 0.6; }
.period-pill.filtered { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.period-pill:active { transform: scale(0.96); }
.topbar.compact .period-pill { height: 30px; font-size: 14px; }
.ps-people { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.ps-people::-webkit-scrollbar { display: none; }
.ps-people button { padding: 7px 14px; border-radius: 99px; background: var(--card); font-size: 15px; font-weight: 500; white-space: nowrap; }
.ps-people button.active { background: var(--accent); color: #fff; }
.mp-now { font-size: 12px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 7px; border-radius: 99px; margin-left: 4px; vertical-align: 1px; }

/* Карточка «Доходы» открывает сводку */
.tile-link { position: relative; cursor: pointer; transition: transform 0.15s; }
.tile-link:active { transform: scale(0.98); }
.tile-chev { position: absolute; top: 14px; right: 12px; width: 14px; height: 14px; }
/* Сводка доходов */
.inc-hero { display: grid; gap: 4px; }
.hero-amount.income { color: var(--green); }
.inc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.inc-split span { display: block; font-size: 12px; color: var(--text-2); }
.inc-split b { font-size: 17px; font-weight: 600; }
.inc-split b small { font-size: 13px; color: var(--text-2); font-weight: 500; }
.inc-split b.neg { color: var(--red); }
.inc-row .meter { margin: 5px 0 3px; height: 5px; }
.inc-row .meter i { display: block; height: 100%; border-radius: 3px; }
.lr-value.income { color: var(--green); }
.inc-bars .ybar i { background: color-mix(in srgb, var(--green) 55%, transparent); }
.inc-bars .ybar.now i { background: var(--green); }
.inc-bars .ybar.now .ybar-m { color: var(--green); }
#formBody .lr-sub { white-space: normal; }
/* Заголовки разделов в шторке — ближе к своему блоку */
.sheet-body > .group-title { margin: 8px 16px -8px; }
.inc-donut { margin: 16px auto 6px; width: 180px; height: 180px; }
.inc-donut .donut { width: 180px; height: 180px; }
.donut-center b.income { color: var(--green); }

/* Источники дохода: нажатие выделяет сегмент и строку */
.inc-donut circle[data-inc-cat] { cursor: pointer; }
.inc-row { cursor: pointer; transition: background 0.2s; }
.inc-row.on { background: color-mix(in srgb, var(--green) 9%, transparent); }
.inc-row:active { opacity: 0.7; }
