:root {
  --bg: #f7f6fc;
  --surface: #ffffff;
  --text: #15131f;
  --muted: #646079;
  --line: #e7e4f3;
  --accent: #5b3fe0;
  --accent2: #c24fd3;
  --soft: #efeaff;
  --good: #1f8a5b;
  --bad: #c23b4a;
  --shadow: 0 18px 50px rgba(40, 20, 120, 0.10);
  --radius: 22px;
}

:root[data-theme="dark"] {
    --bg: #0d0c14;
    --surface: #17151f;
    --text: #f3f1fb;
    --muted: #a39fbb;
    --line: #272434;
    --accent: #9d8bff;
    --accent2: #e07ff0;
    --soft: #1f1b33;
    --good: #4fd39a;
    --bad: #ff7b8a;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  }

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { background: var(--soft); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.positive { color: var(--good); }
.negative { color: var(--bad); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 44px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  font-size: 17px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.brand-sub {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 999px;
}

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
}

.save-state { font-size: 12px; color: var(--muted); }

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.icon-button:hover { border-color: var(--accent); transform: translateY(-1px); }

main { padding: clamp(18px, 4vw, 34px) clamp(14px, 4vw, 44px) 120px; }

.screen { max-width: 1540px; margin: 0 auto; }
.screen.narrow { max-width: 640px; }

/* Нижние вкладки — как «таблетка» в Mac-приложении */
.tabs {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 2px;
  padding: 6px;
  max-width: calc(100vw - 20px);
  overflow-x: auto;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 18px 50px rgba(30, 15, 90, 0.22);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: color .12s ease, background .12s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.tab-icon { display: grid; place-items: center; }
.tab-icon svg { width: 18px; height: 18px; display: block; }

.page { display: grid; gap: 18px; }
.page-header { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.035em; line-height: 1.05; }
.page-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.capital-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-radius: 26px;
  padding: clamp(20px, 3vw, 28px);
  background: linear-gradient(140deg, #21168f, #5b3fe0 55%, #b04fd6);
  box-shadow: 0 24px 60px rgba(60, 30, 160, .28);
}
.capital-hero::after {
  content: "₽";
  position: absolute;
  right: -10px;
  bottom: -60px;
  font-size: 240px;
  font-weight: 900;
  color: rgba(0, 0, 0, .10);
  pointer-events: none;
}
.hero-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.hero-top .hero-label { font-size: 13px; font-weight: 700; opacity: .85; }
.hero-open { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 15px; }
.hero-value { position: relative; z-index: 1; margin: 12px 0 18px; font-size: clamp(34px, 6vw, 52px); font-weight: 800; letter-spacing: -.04em; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-figures { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 22px 34px; }
.hero-figure span { display: block; font-size: 12px; font-weight: 700; opacity: .72; }
.hero-figure strong { display: block; margin-top: 2px; font-size: 16px; font-weight: 800; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat-tile .stat-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--soft); font-size: 15px; margin-bottom: 10px; }
.stat-tile .stat-label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.stat-tile .stat-value { display: block; margin-top: 2px; font-size: clamp(17px, 2.3vw, 22px); font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.overview-top { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.overview-left, .overview-right { display: grid; gap: 14px; min-width: 0; }

.daily-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 6px; }
.daily-bar { flex: 1; min-width: 3px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--accent), var(--accent2)); opacity: .85; }
.daily-bar.zero { background: var(--line); opacity: .5; }
.daily-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.recent-list { display: grid; }
.recent-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit; }
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover { background: color-mix(in srgb, var(--soft) 45%, transparent); }
.recent-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); font-size: 15px; }
.recent-title { display: block; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-sub { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-amount { font-weight: 800; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.balance-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.balance-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.balance-value { display: block; margin: 3px 0 2px; font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.04em; white-space: nowrap; }
.balance-note { color: var(--muted); font-size: 12px; }
.balance-figures { display: flex; gap: 24px; flex-wrap: wrap; }
.balance-figures .hero-figure span { color: var(--muted); opacity: 1; }
.balance-figures .hero-figure strong { color: var(--text); }

.account-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.account-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  white-space: nowrap;
}
.account-pill.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.account-pill-icon { font-size: 15px; }
.account-pill-name { font-weight: 700; }
.account-pill-sum { color: var(--muted); font-variant-numeric: tabular-nums; }
.account-pill.active .account-pill-sum { color: rgba(255,255,255,.82); }

.entries-layout { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1.5fr); gap: 16px; align-items: start; }

.category-breakdown { display: grid; gap: 0; }
.category-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 8px 0;
  font: inherit;
}
.category-row:last-child { border-bottom: 0; }
.category-row:hover { background: color-mix(in srgb, var(--soft) 45%, transparent); }
.category-bar { grid-column: 1 / -1; display: block; height: 4px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.category-bar > span { display: block; height: 100%; border-radius: inherit; }
.category-list li { display: block; padding: 0; }

.period-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.period-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}
.period-button.active { background: var(--soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.month-report { display: grid; }
.month-report-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
}
.month-report-row:last-child { border-bottom: 0; }
.month-report-label { font-weight: 700; font-size: 14px; }
.month-report-metrics { display: grid; gap: 5px; min-width: 0; }
.month-metric { display: grid; grid-template-columns: 58px minmax(0, 1fr) 92px; gap: 8px; align-items: center; font-size: 12px; }
.month-metric-label { color: var(--muted); white-space: nowrap; }
.month-metric-bar { height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.month-metric-bar > span { display: block; height: 100%; border-radius: inherit; }
.month-metric-bar .income { background: var(--good); }
.month-metric-bar .expense { background: var(--bad); }
.month-metric-value { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.month-report-balance { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }

.portfolio { display: grid; gap: 16px; }
.positions-table td, .positions-table th { white-space: nowrap; }
.positions-table .note { max-width: 220px; }

.tinvest-form { display: grid; gap: 8px; margin: 8px 0 10px; max-width: 560px; }
.tinvest-form input[type="password"], .tinvest-form input[type="text"] { min-height: 44px; }
.tinvest-mode { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-row { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.radio-row.disabled { opacity: .45; }
.tinvest-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.tinvest-toolbar select { max-width: 280px; min-height: 38px; }
.tinvest-secondary { margin-top: 2px; }

.moex-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 6px; }
.moex-form input { max-width: 280px; }
.moex-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; margin-top: 10px; }
.moex-grid .empty-state { grid-column: 1 / -1; padding: 20px 10px; }
.moex-card { border: 1px solid var(--line); border-radius: 15px; padding: 12px 14px; background: var(--bg); min-width: 0; }
.moex-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.moex-head strong { letter-spacing: .01em; }
.moex-remove { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 4px; }
.moex-remove:hover { color: var(--bad); }
.moex-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.moex-price { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; }
.moex-change { font-size: 13px; font-weight: 700; margin-top: 2px; }
.moex-note { font-size: 11px; color: var(--muted); margin-top: 3px; }
.moex-loading { font-size: 12px; color: var(--muted); margin-top: 8px; min-height: 40px; }

.entries .account { color: var(--muted); white-space: nowrap; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.account-card { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 14px 16px; box-shadow: var(--shadow); }
.account-card .account-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.account-card .account-balance { margin-top: 8px; font-size: 21px; font-weight: 800; letter-spacing: -.03em; white-space: nowrap; }
.account-card .account-note { color: var(--muted); font-size: 12px; margin-top: 2px; }

.asset-list { display: grid; }
.asset-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.asset-row:last-child { border-bottom: 0; }
.asset-name { font-weight: 700; font-size: 14px; }
.asset-kind { color: var(--muted); font-size: 12px; }
.asset-value { font-weight: 800; white-space: nowrap; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.project-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.project-head { display: flex; align-items: center; gap: 10px; }
.project-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); font-size: 18px; }
.project-name { font-weight: 800; letter-spacing: -.01em; }
.project-note { color: var(--muted); font-size: 13px; }
.project-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.progress { height: 7px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.progress.over > span { background: var(--bad); }

.budget-list { display: grid; gap: 4px; }
.budget-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.budget-row:last-child { border-bottom: 0; }
.budget-name { font-weight: 700; font-size: 14px; }
.budget-numbers { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.budget-numbers strong { color: var(--text); }
.budget-row .progress { grid-column: 1 / -1; }

.reminder-list { display: grid; }
.reminder-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.reminder-row:last-child { border-bottom: 0; }
.reminder-title { font-weight: 700; }
.reminder-sub { color: var(--muted); font-size: 12px; }
.reminder-date { text-align: right; font-size: 13px; white-space: nowrap; }

.report-bars { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding-top: 8px; }
.report-month { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.report-pair { display: flex; align-items: flex-end; gap: 3px; height: 150px; width: 100%; justify-content: center; }
.report-pair .bar { width: 42%; max-width: 22px; border-radius: 5px 5px 2px 2px; min-height: 2px; }
.bar.income { background: var(--good); }
.bar.expense { background: var(--bad); }
.report-caption { font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; }
.report-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

.empty-state { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty-state strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

.section-link { border: 0; background: transparent; color: var(--accent); font-weight: 700; font-size: 13px; padding: 0; }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(24px, 5vw, 44px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.lead { margin: 0 0 26px; color: var(--muted); font-size: 17px; max-width: 52ch; }

.connect-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: 0.55; cursor: default; transform: none; }
.button.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }
.button.ghost { background: transparent; }
.button.small { min-height: 38px; padding: 0 13px; font-size: 14px; border-radius: 11px; }
.button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

.client-box { border-top: 1px solid var(--line); padding-top: 16px; margin: 6px 0 18px; }
.client-box summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }

.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row input { flex: 1; min-width: 0; }

input[type="text"], input[type="password"], input[type="date"], input[type="search"], select {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.stack { display: grid; gap: 10px; }

.error {
  margin: 12px 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bad) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line));
  color: var(--bad);
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.month-nav { display: flex; align-items: center; gap: 6px; }
.month-label {
  border: 0;
  background: transparent;
  font-size: clamp(19px, 3vw, 25px);
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 4px 8px;
  text-transform: none;
  white-space: nowrap;
}
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.summary-card.accent {
  background: linear-gradient(140deg, #21168f, #5b3fe0 55%, #b04fd6);
  border-color: transparent;
  color: #fff;
}

.summary-label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; opacity: 0.7; margin-bottom: 6px; }
.summary-value { font-size: clamp(20px, 3vw, 28px); letter-spacing: -0.03em; white-space: nowrap; }

.accounts-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}
.accounts-strip:empty { display: none; }
.account-chip {
  flex: 0 0 auto;
  min-width: 148px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.account-chip .account-name { display: block; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.account-chip .account-sum { display: block; margin-top: 3px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }

.content-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel h2 { margin: 0 0 14px; font-size: 17px; letter-spacing: -0.01em; }
.panel-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }

.chart-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.donut {
  --segments: conic-gradient(var(--line) 0 100%);
  width: 164px;
  height: 164px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--segments);
  position: relative;
  display: grid;
  place-items: center;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.donut-label {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1.15;
}
.donut-label small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.donut-label strong { font-size: 16px; letter-spacing: -0.02em; }

.category-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 150px; }
.category-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 14px; }
.category-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--dot, var(--accent)); }
.category-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-amount { font-variant-numeric: tabular-nums; font-weight: 700; }

.table-wrap { overflow-x: auto; margin: 0 -6px; }
.entries { width: 100%; border-collapse: collapse; font-size: 14px; }
.entries th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.entries td { padding: 10px 8px; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); vertical-align: middle; }
.entries tr:last-child td { border-bottom: 0; }
.entries tbody tr { cursor: pointer; transition: background 0.1s ease; }
.entries tbody tr:hover { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.entries .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 700; }
.entries .date { color: var(--muted); white-space: nowrap; }
.entries .note { color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entries .cat { white-space: nowrap; }
.entries .income { color: var(--good); }
.entries .expense { color: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 26px 0; }
.footer-note { text-align: center; margin: 26px 0 0; }

.dialog {
  width: min(540px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.35);
}
.dialog::backdrop { background: rgba(10, 8, 25, 0.55); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.dialog-head h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.dialog-body { padding: 6px 20px 20px; display: grid; gap: 12px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.dialog-actions .danger { margin-right: auto; }

.field { display: grid; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select { min-height: 44px; }

.kind-switch { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; gap: 6px; background: var(--bg); padding: 4px; border-radius: 13px; border: 1px solid var(--line); }
.kind-button { border: 0; background: transparent; border-radius: 10px; min-height: 38px; font-weight: 700; color: var(--muted); }
.kind-button.active { background: var(--surface); color: var(--text); box-shadow: 0 3px 12px rgba(20, 10, 60, 0.10); }

.settings-block { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.settings-block:first-child { border-top: 0; padding-top: 0; }
.settings-block h3 { margin: 0; font-size: 15px; }
.settings-block p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
  z-index: 50;
  max-width: calc(100vw - 30px);
}

@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .overview-top { grid-template-columns: 1fr; }
  .entries-layout { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .tab-label { display: none; }
  .tab { padding: 11px 12px; }
  .tab-icon svg { width: 20px; height: 20px; }
}

@media (max-width: 640px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-value { font-size: 20px; }
  .toolbar { align-items: flex-start; }
  .toolbar-actions { width: 100%; margin-left: 0; }
  .toolbar-actions .button { flex: 1; }
  .entries .note { max-width: 120px; }
  .chart-row { justify-content: center; }
  .brand-sub { display: none; }
  .hero-value { font-size: 32px; }
  .hero-figures { gap: 16px 22px; }
  .balance-card { align-items: flex-start; }
  .balance-figures { gap: 16px; }
  .month-report-row { grid-template-columns: 1fr; gap: 6px; }
  .month-report-balance { text-align: left; }
  .month-metric { grid-template-columns: 54px minmax(0, 1fr) 80px; }
}

/* ---- Формы редактирования ---- */
#form-body { grid-template-columns: 1fr 1fr; }
#form-body > * { grid-column: 1 / -1; }
#form-body > .field.half { grid-column: auto; }
.field input, .field select, .field textarea { width: 100%; font: inherit; font-weight: 500; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.field textarea { padding: 10px 12px; resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.field small { font-weight: 500; font-size: 12px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; padding: 6px 2px; cursor: pointer; }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); transition: transform .15s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(18px); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: var(--swatch); cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px var(--surface); }
.swatch.active { border-color: var(--text); }
.swatches input[type=color] { width: 34px; height: 28px; min-height: 0; padding: 0; border-radius: 8px; cursor: pointer; }
.dialog-actions { flex-wrap: wrap; align-items: center; }
.dialog-actions .spacer { flex: 1; }
.dialog-actions .danger { margin-right: 0; }

.list { display: grid; }
.list-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto 14px; gap: 12px; align-items: center; padding: 10px 4px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; border-radius: 10px; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: color-mix(in srgb, var(--soft) 50%, transparent); }
.list-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tint) 18%, var(--surface)); font-size: 16px; }
.list-title { font-weight: 650; }
.list-value { font-size: 13px; }
.chevron { color: var(--muted); font-size: 18px; }

button.account-card { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform .12s, border-color .12s; }
button.account-card:hover { transform: translateY(-1px); border-color: var(--accent); }
.account-pill.add { border-style: dashed; color: var(--accent); }
.hidden-accounts { margin-top: 14px; }
.hidden-accounts summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.project-card, .budget-row { cursor: pointer; }
.project-card:hover { border-color: var(--accent); }
.budget-row:hover { background: color-mix(in srgb, var(--soft) 40%, transparent); }
.entries .transfer { color: var(--muted); }
@media (max-width: 560px) { #form-body > .field.half { grid-column: 1 / -1; } }
.asset-row, .reminder-row { cursor: pointer; border-radius: 10px; }
.asset-row:hover, .reminder-row:hover { background: color-mix(in srgb, var(--soft) 40%, transparent); }
.reminder-row.inactive { opacity: .6; }
.field input[readonly] { opacity: .65; cursor: not-allowed; }
.goal-list { display: grid; gap: 4px; }
.goal-row { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 12px; align-items: center; padding: 10px 4px; border-radius: 10px; cursor: pointer; }
.goal-row:hover { background: color-mix(in srgb, var(--soft) 40%, transparent); }
.goal-main { display: grid; gap: 6px; }
.goal-title { display: flex; justify-content: space-between; gap: 10px; }

/* =================================================================
   Вид как в приложении для Mac
   ================================================================= */
:root {
  --bg: #efedf7;
  --bg2: #e4def3;
  --card: #ffffff;
  --card-line: rgba(120, 100, 200, .10);
  --pane: rgba(255, 255, 255, .34);
  --pane-line: rgba(140, 120, 210, .22);
  --chip: #ececf2;
  --chip-text: #3a3850;
  --green: #34c759;
  --red: #ff3b30;
  --card-shadow: 0 10px 30px rgba(70, 50, 150, .07), 0 1px 2px rgba(70, 50, 150, .05);
  --sf: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #121019;
  --bg2: #1a1530;
  --card: #1d1a27;
  --card-line: rgba(255, 255, 255, .07);
  --pane: rgba(255, 255, 255, .03);
  --pane-line: rgba(255, 255, 255, .08);
  --chip: #2a2738;
  --chip-text: #dedbf0;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
body {
  font-family: var(--sf);
  background: radial-gradient(1200px 600px at 100% 0%, var(--bg2), transparent 70%), var(--bg);
  background-attachment: fixed;
}
.topbar { background: transparent; border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; position: static; }
main { padding-bottom: 110px; }
#screen-app { max-width: 1480px; margin: 0 auto; padding: 0 clamp(12px, 2.4vw, 32px); }
.page {
  background: var(--pane);
  border: 1px solid var(--pane-line);
  border-radius: 34px;
  padding: clamp(16px, 2vw, 26px);
  gap: 20px;
  min-height: calc(100vh - 190px);
}
.spacer { flex: 1; }
.stack { display: grid; gap: 20px; align-content: start; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.grid-2.tight { gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* Шапка обзора */
.mac-head { display: flex; align-items: center; gap: 16px; padding: 4px 4px 0; }
.mac-head h1 { margin: 0; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
.mac-head p { margin: 2px 0 0; color: var(--muted); }
.mac-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.section-title { margin: 0; font-size: 18px; }

/* Карточки */
.mcard {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: var(--card-shadow);
  display: grid;
  gap: 14px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 12px; min-height: 30px; }
.card-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.card-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c)); flex: none; }
.card-icon svg { width: 19px; height: 19px; }

/* Значки-кружки */
.badge-icon { flex: none; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); color: #fff; line-height: 1; }
.badge-icon.sm { width: 26px; height: 26px; font-size: 13px; }
.badge-icon.md { width: 40px; height: 40px; font-size: 18px; }
.badge-icon.lg { width: 46px; height: 46px; font-size: 20px; }
.badge-icon.xl { width: 58px; height: 58px; font-size: 26px; }

/* Герой-карточки */
.mhero { position: relative; overflow: hidden; border-radius: 28px; color: #fff; padding: 26px 30px; box-shadow: 0 22px 50px rgba(70, 40, 170, .25); }
.mhero.violet { background: linear-gradient(120deg, #5b45d8, #8a52de 60%, #a24fd6); }
.mhero.night { background: linear-gradient(120deg, #241c5e, #3b2a8f 45%, #7a4fb8 85%, #a065c4); }
.mhero.blue { background: linear-gradient(120deg, #2c1f8a, #5040d9 45%, #3f7be8); }
.mhero.amber { background: linear-gradient(120deg, #8a3a1a, #d5743c 50%, #e9a24c); box-shadow: 0 22px 50px rgba(180, 90, 30, .25); }
.mhero .blob { position: absolute; border-radius: 50%; pointer-events: none; }
.mhero .b1 { width: 340px; height: 340px; right: 8%; top: -190px; background: rgba(255, 140, 180, .35); filter: blur(2px); }
.mhero .b2 { width: 260px; height: 260px; left: 16%; bottom: -170px; background: rgba(90, 160, 255, .30); }
.mhero.violet .b1 { background: rgba(255, 255, 255, .10); right: -60px; top: -60px; width: 200px; height: 200px; }
.mhero.violet .b2 { display: none; }
.mhero-body { position: relative; z-index: 1; display: grid; gap: 10px; }
.mhero-top { display: flex; align-items: center; gap: 10px; }
.mhero-label { font-size: 15px; font-weight: 600; opacity: .92; }
.mhero-value { font-size: clamp(38px, 4.4vw, 58px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mhero-stats { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.mhero-stats span { display: block; font-size: 13px; opacity: .8; }
.mhero-stats strong { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.mhero-sep { border-top: 1px solid rgba(255, 255, 255, .22); padding-top: 12px; margin-top: 4px; font-size: 14px; opacity: .8; }
.hero-round { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .2); color: #fff; font-size: 17px; }
.hero-chip { justify-self: start; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; padding: 6px 14px; font-weight: 600; font-size: 14px; }
.hero-badge { background: rgba(255, 255, 255, .16); padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #ffb3c4; }
.hero-row { display: flex; justify-content: space-between; font-size: 16px; opacity: .95; }
.hero-row.bold { font-weight: 700; }
.hero-line { border-top: 1px solid rgba(255, 255, 255, .3); margin: 4px 0; }
.stack-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; background: rgba(255, 255, 255, .2); margin: 8px 0 6px; }
.bal-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.bal-top > div:first-child { display: grid; gap: 8px; min-width: 0; }
.ring-box { display: grid; justify-items: center; text-align: center; font-size: 13px; opacity: .95; }
.ring-box b { font-size: 15px; }
.ring-box small { opacity: .8; }
.ring-wrap { position: relative; width: 92px; height: 92px; }
.ring-wrap strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; }
.pace { position: relative; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; padding: 10px 12px; }
.pace.big { background: none; border: 0; padding: 0; }
.pace-note { position: absolute; right: 14px; top: 10px; font-size: 12px; text-align: right; opacity: .8; }
.cum-line { width: 100%; height: 70px; display: block; }
.pace.big .cum-line { height: 100px; }
.pace-chart .cum-line { height: 180px; }

/* Плитки */
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mtile { background: var(--card); border: 1px solid var(--card-line); border-radius: 22px; padding: 18px 20px; box-shadow: var(--card-shadow); display: grid; gap: 6px; text-align: left; color: inherit; font: inherit; }
.mtile.link { cursor: pointer; }
.tile-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); margin-bottom: 14px; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.tile-sub { font-size: 13px; color: var(--muted); }

/* Списки строк */
.row-list { display: grid; }
.row-item, .pay-row, .op-row, .legend-row, .cat-row, .goal-mac, .rem-tile, .wide-button, .pill-button, .circle-button, .link-button, .plus-link, .acc-chip, .pay-chip, .segmented button { font: inherit; color: inherit; }
.row-item { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 14px; gap: 14px; align-items: center; padding: 10px 2px; background: none; border: 0; text-align: left; cursor: pointer; border-radius: 14px; }
.row-item.static { cursor: default; grid-template-columns: 46px minmax(0, 1fr) auto; }
.row-item.tall { grid-template-columns: 46px minmax(0, 1fr) auto; }
.row-item:hover:not(.static) { background: color-mix(in srgb, var(--soft) 45%, transparent); }
.row-item.dim { opacity: .55; }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-title { font-weight: 600; font-size: 16px; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-value.neg, .neg { color: var(--red); }
.row-value-col { display: grid; justify-items: end; }
.row-value-col .orange { color: #f2994a; font-weight: 600; }
.chev { color: var(--muted); font-size: 20px; }
.wide-button { border: 0; border-radius: 16px; background: color-mix(in srgb, var(--chip) 70%, transparent); padding: 12px; font-weight: 650; cursor: pointer; }
.wide-button:hover { background: var(--chip); }
.kv { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.kv strong { color: var(--text); }
.kv.foot { font-size: 14px; }
.kv-col { display: grid; gap: 2px; color: var(--muted); font-size: 14px; }
.kv-col strong { color: var(--text); font-size: 18px; }

.bar { height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--chip) 90%, transparent); overflow: hidden; display: block; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); }
.bar.red > span { background: linear-gradient(90deg, #c0392b, #e05a4b); }
.bar.light { background: rgba(255, 255, 255, .25); }
.bar.light > span { background: #fbb3c0; }
.debt-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 6px; }
.debt-line small { color: var(--muted); white-space: nowrap; }

/* Цели */
.goal-mac { display: grid; gap: 8px; background: none; border: 0; text-align: left; cursor: pointer; padding: 4px 0; }
.goal-top { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.goal-pct { font-size: 17px; }
.goal-foot { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.goal-foot span:first-child { color: var(--text); font-weight: 600; }

/* Кольцевые диаграммы */
.donut-block { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; align-items: center; }
.donut-mac { position: relative; flex: none; }
.donut-mac svg { display: block; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.donut-center span, .donut-center small { color: var(--muted); font-size: 13px; }
.donut-center strong { font-size: 22px; letter-spacing: -.02em; }
.donut-legend { display: grid; gap: 6px; min-width: 0; }
.legend-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; background: none; border: 0; padding: 5px 0; text-align: left; cursor: pointer; }
.legend-row.static { cursor: default; }
.legend-row .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend-row .name { display: grid; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .name small { color: var(--muted); }
.where { display: grid; justify-items: center; gap: 18px; }
.where .cat-rows { width: 100%; }
.cat-rows { display: grid; gap: 4px; }
.cat-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 14px; gap: 14px; align-items: center; background: none; border: 0; padding: 8px 0; text-align: left; cursor: pointer; }
.cat-main { display: grid; gap: 6px; }
.cat-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.cat-bottom { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; }
.cat-bottom small { color: var(--muted); }
.mm { padding: 2px 8px; border-radius: 8px; font-weight: 600; }
.mm.bad { color: #e5484d; background: rgba(229, 72, 77, .12); }
.mm.good { color: #2a9d5c; background: rgba(42, 157, 92, .12); }
.empty-mid { display: grid; place-items: center; min-height: 160px; color: var(--muted); }

/* Траты по дням */
.daybars { display: grid; gap: 6px; }
.daybars-plot { height: 260px; display: flex; align-items: flex-end; gap: 4px; }
.daybars-plot span { flex: 1; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #8f6bff, #5b3fe0); min-width: 3px; }
.daybars-axis { display: flex; gap: 4px; }
.daybars-axis span { flex: 1; font-size: 12px; color: var(--muted); text-align: center; }

/* Полгода */
.pair-bars { position: relative; }
.pb-plot { position: relative; height: var(--h); margin-right: 64px; margin-bottom: 26px; }
.pb-grid { position: absolute; left: 0; right: -64px; border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.pb-grid span { position: absolute; right: 0; top: -9px; font-size: 13px; color: var(--muted); background: var(--card); padding-left: 6px; }
.pb-avg { position: absolute; left: 0; right: 0; border-top: 2px dashed rgba(255, 80, 80, .5); }
.pb-cols { position: absolute; inset: 0; display: flex; justify-content: space-around; }
.pb-col { flex: 1; display: grid; grid-template-rows: 1fr auto; justify-items: center; }
.pb-pair { display: flex; align-items: flex-end; gap: 10px; height: 100%; }
.pb-pair span { width: 30px; border-radius: 6px 6px 2px 2px; }
.pb-pair .inc { background: linear-gradient(180deg, #8de08f, #4cbc5c); }
.pb-pair .exp { background: linear-gradient(180deg, #ff7676, #e5484d); }
.pb-col small { color: var(--muted); margin-top: 8px; position: absolute; bottom: -26px; }
.pb-col { position: relative; }
.legend-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.legend-inline i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.legend-inline i.g { background: #4cbc5c; } .legend-inline i.r { background: #e5484d; }
.legend-inline i.v { background: #5b3fe0; } .legend-inline i.gr { background: #8e8e93; }

/* Сегменты и кнопки */
.segmented { display: inline-flex; background: color-mix(in srgb, var(--chip) 90%, transparent); border-radius: 14px; padding: 4px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 8px 18px; border-radius: 11px; font-size: 15px; font-weight: 500; color: var(--chip-text); cursor: pointer; }
.segmented button.active { background: linear-gradient(120deg, #5b45d8, #9a4fd6); color: #fff; font-weight: 650; }
.segmented.red button.active { background: #e5484d; }
.segmented.kinds button.active { background: linear-gradient(120deg, #2bb07a, #4cc38a); }
.segmented.kinds button[data-value="expense"].active { background: linear-gradient(120deg, #e5484d, #ff6b6b); }
.segmented.grow { flex: 1; }
.segmented.grow button { flex: 1; }
.pill-button { border: 0; border-radius: 12px; background: color-mix(in srgb, var(--chip) 90%, transparent); padding: 9px 18px; font-size: 15px; cursor: pointer; white-space: nowrap; }
.pill-button:hover { background: var(--chip); }
.circle-button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--chip) 90%, transparent); font-size: 20px; display: grid; place-items: center; cursor: pointer; color: var(--accent); }
.circle-button svg { width: 20px; height: 20px; }
.circle-button:disabled { opacity: .35; cursor: default; }
.link-button { border: 0; background: none; color: #1f6fe5; font-size: 17px; cursor: pointer; }
.plus-link { border: 0; background: none; color: var(--accent); font-size: 22px; cursor: pointer; }
.month-nav-mac { display: flex; align-items: center; gap: 10px; }
.month-nav-mac .circle-button { width: 52px; height: 36px; border-radius: 12px; color: var(--text); }
.mn-title { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; margin-left: 10px; }
.mn-sub { color: var(--muted); margin-left: 10px; }
.tag { padding: 3px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.tag.bad { color: #e5484d; background: rgba(229, 72, 77, .12); }
.tag.good { color: #2a9d5c; background: rgba(42, 157, 92, .12); }
.warn-text { color: #e5484d; margin: 0; }
.ok-text { color: #2a9d5c; margin: 0; }

/* Операции: две колонки */
.split-pane { display: grid; grid-template-columns: minmax(340px, 560px) minmax(0, 1fr); gap: 26px; align-items: start; }
@media (max-width: 1000px) { .split-pane { grid-template-columns: minmax(0, 1fr); } }
.split-left { display: grid; gap: 16px; position: sticky; top: 16px; }
.acc-chips { display: flex; gap: 10px; overflow-x: auto; padding: 8px; background: var(--card); border-radius: 22px; border: 1px solid var(--card-line); }
.acc-chip { flex: none; display: grid; gap: 2px; text-align: left; border: 0; border-radius: 16px; padding: 10px 16px; background: color-mix(in srgb, var(--chip) 80%, transparent); cursor: pointer; min-width: 120px; user-select: none; }
.acc-chip .acc-name { font-size: 14px; font-weight: 600; white-space: nowrap; }
.acc-chip strong { font-size: 16px; white-space: nowrap; }
.acc-chip.on { background: linear-gradient(160deg, #4b8dff, #2f6fef); color: #fff; }
.acc-chip.add { place-content: center; color: var(--accent); min-width: 90px; }
.pay-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.pay-chip { display: grid; justify-items: center; gap: 2px; border: 0; background: color-mix(in srgb, var(--chip) 70%, transparent); border-radius: 14px; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.pay-chip.all { color: var(--muted); }
.ops-pane { display: grid; gap: 16px; min-width: 0; }
.ops-toolbar { display: flex; align-items: center; gap: 10px; }
.ops-month { flex: 1; text-align: center; display: grid; }
.ops-month strong { font-size: 22px; }
.ops-month span { font-size: 13px; color: var(--muted); }
.ops-filters { display: flex; gap: 12px; flex-wrap: wrap; }
.day-groups { display: grid; gap: 18px; }
.day-group { display: grid; gap: 8px; }
.day-head { display: flex; justify-content: space-between; color: var(--muted); font-weight: 600; padding: 0 8px; }
.day-head span:first-child::first-letter { text-transform: uppercase; }
.op-list { display: grid; }
.op-list.boxed { background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; padding: 4px 14px; box-shadow: var(--card-shadow); }
.op-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 4px; background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); text-align: left; cursor: pointer; }
.op-list .op-row:last-child { border-bottom: 0; }
.op-row:hover { background: color-mix(in srgb, var(--soft) 40%, transparent); }
.op-main { display: grid; min-width: 0; }
.op-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-title .biz { margin-left: 6px; font-size: 13px; }
.op-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.op-amount.plus { color: #2ea44f; }

/* Бюджет */
.pay-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 110px; gap: 12px; align-items: center; background: none; border: 0; padding: 7px 0; text-align: left; cursor: pointer; }
.pay-row strong { text-align: right; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b6b3c6; }
.check.on { background: #34c759; border-color: #34c759; }

/* Проекты */
.add-card { place-items: center; min-height: 90px; cursor: pointer; color: var(--accent); font-weight: 650; border-style: dashed; grid-auto-flow: column; gap: 8px; }
.project-mac { cursor: pointer; }
.pj-head { display: grid; grid-template-columns: 58px minmax(0, 1fr) 14px; gap: 14px; align-items: center; }
.pj-title { font-weight: 700; font-size: 20px; }
.pj-sum { display: flex; align-items: baseline; gap: 10px; }
.pj-sum strong { font-size: 34px; letter-spacing: -.03em; }
.pj-pct { margin-left: auto; color: #e5484d; font-weight: 700; }
.mini-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mini-tiles div { background: color-mix(in srgb, var(--chip) 60%, transparent); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.mini-tiles span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-tiles strong { font-size: 16px; }
.pj-bars { display: flex; gap: 10px; height: 110px; align-items: stretch; }
.pj-bars div { flex: 1; display: grid; grid-template-rows: 1fr auto; justify-items: stretch; gap: 6px; }
.pj-bars div span { align-self: end; border-radius: 4px; background: color-mix(in srgb, var(--c) 35%, transparent); min-height: 4px; }
.pj-bars div span.now { background: var(--c); }
.pj-bars small { text-align: center; color: var(--muted); }
.pj-top { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 10px; align-items: center; margin-top: 6px; }
.pj-last { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }

/* Напоминания */
.rem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.rem-tile { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; padding: 16px 18px; box-shadow: var(--card-shadow); cursor: pointer; text-align: left; }
.rem-tile.off { opacity: .55; }
.rem-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, #a46bff, #6b3fe0); }
.rem-icon svg { width: 24px; height: 24px; }

/* Нижняя панель вкладок, как в приложении */
.tabs { background: color-mix(in srgb, var(--card) 80%, transparent); border-color: var(--card-line); padding: 7px; }
.tab { font-size: 15px; font-weight: 600; padding: 10px 18px; color: var(--chip-text); }
.tab.active { background: linear-gradient(120deg, #5b45d8, #a24fd6); }

:root[data-theme="dark"] .pb-grid span { background: var(--card); }

.grid-3 .mhero-value { font-size: clamp(30px, 2.6vw, 42px); }
.grid-3 .mhero { padding: 22px 24px; }
/* Старые блоки (инвестиции, категория) — в том же стиле карточек */
.panel { background: var(--card); border: 1px solid var(--card-line); border-radius: 26px; box-shadow: var(--card-shadow); }
.capital-hero { border-radius: 28px; background: linear-gradient(120deg, #241c5e, #3b2a8f 45%, #7a4fb8 85%, #a065c4); }
.capital-hero::after { content: none; }
.stat-tile { background: var(--card); border-color: var(--card-line); border-radius: 22px; box-shadow: var(--card-shadow); }

/* Операции: один общий список, дни — подзаголовками внутри */
.day-groups { display: block; background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; box-shadow: var(--card-shadow); padding: 4px 0 6px; overflow: hidden; }
.day-group { display: block; }
.day-group + .day-group { border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.day-head { position: sticky; top: 0; z-index: 1; background: color-mix(in srgb, var(--chip) 45%, var(--card)); padding: 6px 16px; font-size: 13px; }
.day-groups .op-list { padding: 0 12px; }
.day-groups .op-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; padding: 6px 4px; border-bottom-color: color-mix(in srgb, var(--line) 45%, transparent); }
.day-groups .badge-icon.md { width: 30px; height: 30px; font-size: 14px; }
.day-groups .op-main { display: flex; align-items: baseline; gap: 8px; }
.day-groups .op-title { flex: none; max-width: 45%; font-size: 15px; }
.day-groups .op-sub { flex: 1; font-size: 13px; }
.day-groups .op-amount { font-size: 15px; }
.op-title .count { margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 6px; border-radius: 6px; }
.op-amount .caret { margin-left: 8px; color: var(--muted); font-size: 12px; }
.op-sublist { margin: 0 0 4px 40px; border-left: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); padding-left: 8px; }
.op-sublist .op-row { padding: 4px 4px; }
.op-sublist .badge-icon.md { width: 24px; height: 24px; font-size: 12px; }
.op-sublist .op-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
.op-row { width: 100%; }

/* Дни — отдельными карточками, заголовок дня над карточкой (как в приложении) */
.day-groups { display: grid; gap: 14px; background: none; border: 0; box-shadow: none; padding: 0; overflow: visible; }
.day-group + .day-group { border-top: 0; }
.day-group { display: grid; gap: 6px; }
.day-head { position: static; background: none; padding: 0 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.day-groups .op-list { background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; box-shadow: var(--card-shadow); padding: 2px 12px; }

/* Левая колонка «Операций» — размер как в приложении */
.split-pane { grid-template-columns: 340px minmax(0, 1fr); gap: 24px; }
@media (max-width: 1000px) { .split-pane { grid-template-columns: minmax(0, 1fr); } }
.split-left { gap: 14px; }
.split-left .mhero { padding: 16px 18px; border-radius: 24px; }
.split-left .mhero-body { gap: 8px; }
.split-left .mhero-label { font-size: 13px; }
.split-left .mhero-value { font-size: 30px; }
.split-left .hero-chip { font-size: 12px; padding: 4px 10px; }
.split-left .ring-box { font-size: 11px; }
.split-left .ring-box b { font-size: 12px; }
.split-left .ring-wrap { width: 66px; height: 66px; }
.split-left .ring-wrap strong { font-size: 14px; }
.split-left .pace { padding: 6px 8px; border-radius: 12px; }
.split-left .pace-note { font-size: 10px; top: 6px; right: 8px; }
.split-left .cum-line { height: 50px; }
.split-left .mhero-sep { font-size: 12px; padding-top: 8px; margin-top: 0; }
.split-left .mhero-stats { margin-top: 0; }
.split-left .mhero-stats span { font-size: 12px; }
.split-left .mhero-stats strong { font-size: 14px; }
.split-left .mhero .b1 { width: 220px; height: 220px; top: -120px; }
.split-left .mhero .b2 { width: 180px; height: 180px; bottom: -120px; }
.acc-chips { background: none; border: 0; padding: 0; gap: 8px; }
.acc-chip { min-width: 0; padding: 7px 12px; border-radius: 12px; }
.acc-chip .acc-name { font-size: 13px; }
.acc-chip strong { font-size: 13px; }
.acc-chip.add { min-width: 44px; padding: 7px 14px; font-size: 18px; }
.pay-card { background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; box-shadow: var(--card-shadow); overflow: hidden; }
.pay-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; font-size: 15px; }
.pay-ico { width: 20px; height: 20px; color: #6b4fe0; display: grid; }
.pay-ico svg { width: 20px; height: 20px; }
.pay-list { display: grid; padding: 0 10px 8px; }
.pay-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; padding: 7px 6px; border: 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; font-size: 14px; }
.pay-line.all { color: var(--accent); grid-template-columns: 1fr; }
.split-left .ring-box small { white-space: nowrap; font-size: 10px; }

/* Карточка баланса на «Операциях» — как в приложении */
.bal-hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 16px 18px 16px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(176, 92, 230, .55), transparent 60%),
    linear-gradient(165deg, #3a1fa0 0%, #5a33c9 40%, #4b56dc 75%, #3f78ea 100%);
  box-shadow: 0 18px 40px rgba(70, 50, 190, .28);
  display: grid; gap: 12px;
}
.bal-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.bal-left { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.bal-label { font-size: 13px; font-weight: 600; opacity: .85; }
.bal-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bal-chip { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .14); color: #fff; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.bal-chip span:nth-child(2) { opacity: .85; }
.bal-ring { display: grid; justify-items: center; text-align: center; line-height: 1.25; }
.bal-ring .ring-wrap { width: 70px; height: 70px; position: relative; }
.bal-ring .ring-wrap strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; }
.bal-ring .ring-cap { font-size: 11px; opacity: .8; margin-top: 2px; }
.bal-ring b { font-size: 12px; }
.bal-ring small { font-size: 10px; opacity: .75; white-space: nowrap; }
.bal-pace { position: relative; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); padding: 8px 10px 6px; }
.bal-pace .cum-line { height: 56px; width: 62%; }
.bal-pace-note { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 11px; text-align: right; opacity: .75; line-height: 1.35; }
.bal-month { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; opacity: .8; }
.bal-month i { flex: 1; height: 1px; background: rgba(255, 255, 255, .25); }
.bal-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bal-stat { display: grid; gap: 4px; min-width: 0; }
.bal-stat.right { justify-items: end; }
.bal-stat-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; opacity: .85; }
.bal-dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--c); background: rgba(255, 255, 255, .16); }
.bal-stat strong { font-size: 14px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------------- Инвестиции ---------------- */
.inv-tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px); z-index: 29; display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: color-mix(in srgb, var(--card) 82%, transparent); border: 1px solid var(--card-line); box-shadow: 0 10px 30px rgba(30, 15, 90, .14); backdrop-filter: blur(18px); max-width: calc(100vw - 20px); overflow-x: auto; }
.inv-tabs button { border: 0; background: none; display: flex; gap: 6px; align-items: center; padding: 8px 14px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 600; color: var(--chip-text); cursor: pointer; white-space: nowrap; }
.inv-tabs button.active { background: linear-gradient(120deg, #237a6a, #2fa08a); color: #fff; }
main { padding-bottom: 170px; }
.inv-narrow { max-width: 1060px; width: 100%; margin: 0 auto; display: grid; gap: 18px; }
.inv-status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 4px 6px; flex-wrap: wrap; }
.inv-status.bad { color: var(--red); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 30%, transparent); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-button.small { font-size: 14px; }
.hero-small { font-size: 13px; opacity: .75; }
.glass-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.glass-tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.glass-tiles > div { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); border-radius: 16px; padding: 10px 14px; display: grid; gap: 2px; justify-items: start; }
.glass-tiles span { font-size: 13px; opacity: .8; }
.glass-tiles strong { font-size: 19px; }
.glass-tiles .hl strong { color: #9ff0c4; }
.glass-line { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; background: rgba(0, 0, 0, .15); border-radius: 16px; padding: 10px 14px; }
.glass-line .row-main span { font-size: 13px; opacity: .8; }
.pay-ico.white { color: #fff; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .15); display: grid; place-items: center; }
.pay-ico.white svg { width: 18px; height: 18px; }
.delta-chip { justify-self: start; background: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.delta-chip.up { color: #1f9d55; } .delta-chip.down { color: #e5484d; }
.up { color: #2ea44f; } .down { color: #e5484d; }
.mhero .up { color: #7ff0b0; } .mhero .down { color: #ffb0b8; }
.mhero.green { background: linear-gradient(110deg, #123d36, #1f6b5c 45%, #4cb07f); box-shadow: 0 22px 50px rgba(20, 110, 80, .25); }
.mhero.green .b1 { background: rgba(120, 230, 190, .22); } .mhero.green .b2 { background: rgba(255, 255, 255, .06); }
.hero-right { display: grid; justify-items: end; text-align: right; }
.hero-right span { font-size: 13px; opacity: .8; }
.hero-right strong { font-size: 18px; }
.hero-delta { font-weight: 700; font-size: 15px; }
.hero-badge.plain { color: #fff; }
.type-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.type-legend span { display: inline-flex; align-items: center; gap: 6px; opacity: .9; }
.type-legend i { width: 8px; height: 8px; border-radius: 50%; }
.card-caption { color: var(--muted); font-weight: 600; font-size: 14px; padding: 0 6px; }
.inv-acc-list { padding: 10px; gap: 8px; }
.inv-acc { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: color-mix(in srgb, var(--chip) 55%, transparent); border-radius: 14px; padding: 10px 14px; }
.inv-acc-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, #ffe066, #f5c400); font-size: 20px; }
.row-value-col small.up, .row-value-col small.down { font-weight: 600; }
.small-card { padding: 16px 18px; gap: 10px; }
.small-card .card-head h2 { font-size: 16px; }
.up-title .card-head h2 { color: #2ea44f; } .down-title .card-head h2 { color: #e5484d; }
.mcard.link { text-align: left; font: inherit; color: inherit; cursor: pointer; min-height: 300px; align-content: start; }
.mover-list { display: grid; gap: 6px; }
.mover-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; background: none; border: 0; font: inherit; color: inherit; text-align: left; padding: 2px 0; cursor: pointer; }
.mover-name { color: #6b4fe0; font-weight: 600; font-size: 14px; }
.pct-pill { border-radius: 999px; padding: 3px 9px; font-weight: 700; font-size: 13px; color: #fff; }
.pct-pill.up { background: #2e8b57; } .pct-pill.down { background: #d64545; }
.big-green { color: #2e8b57; font-size: 24px; font-weight: 800; }
.near-list { display: grid; gap: 4px; font-size: 13px; }
.near-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px; }
.near-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-pane.inv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .split-pane.inv { grid-template-columns: minmax(0, 1fr); } .glass-tiles.three { grid-template-columns: 1fr 1fr; } }

.type-group { display: grid; gap: 8px; }
.type-head { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.type-ico { width: 26px; height: 26px; border-radius: 8px; background: var(--c); }
.type-pct { color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border-radius: 8px; padding: 1px 8px; font-weight: 700; font-size: 13px; }
.pos-list { padding: 4px 14px; gap: 0; }
.pos-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 14px; gap: 14px; align-items: center; padding: 10px 2px; background: none; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.pos-row:hover { background: color-mix(in srgb, var(--soft) 40%, transparent); }
.pos-sub { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.mini-bar { width: 42px; height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--line) 90%, transparent); overflow: hidden; display: inline-block; }
.mini-bar i { display: block; height: 100%; background: var(--c); }
.pl { border-radius: 8px; padding: 1px 8px; font-weight: 700; }
.pl.up { background: rgba(46, 164, 79, .12); } .pl.down { background: rgba(229, 72, 77, .12); }
.more-button { border: 0; margin: 8px 0; border-radius: 10px; padding: 8px; background: color-mix(in srgb, var(--chip) 70%, transparent); color: #1f6fe5; font: inherit; font-weight: 600; cursor: pointer; }
.inv-avatar { position: relative; flex: none; display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--c); color: #fff; font-weight: 800; }
.inv-avatar.md { width: 44px; height: 44px; font-size: 11px; }
.inv-avatar.lg { width: 64px; height: 64px; font-size: 15px; }
.inv-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.chip-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--card-line); background: var(--card); border-radius: 999px; padding: 7px 16px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: inherit; }
.chip.active { background: #1f6fe5; color: #fff; border-color: transparent; }
.chip.active.dark { background: #2f2a8f; }
.chip.active.blue { background: #2f7bf5; }
.kv-col .big { font-size: 26px; }
.kv-row { display: flex; gap: 30px; flex-wrap: wrap; }
.pay-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; height: 280px; align-items: end; }
.pay-bar { display: grid; grid-template-rows: auto 1fr auto; height: 100%; justify-items: center; gap: 4px; }
.pay-bar small { color: var(--muted); font-size: 12px; align-self: end; }
.pay-stack { width: 70%; display: flex; flex-direction: column; border-radius: 6px 6px 2px 2px; overflow: hidden; align-self: end; min-height: 2px; }
.pay-stack i.got { background: linear-gradient(180deg, #8de08f, #4cbc5c); }
.pay-stack i.exp { background: linear-gradient(180deg, #a9c8ff, #6fa0f5); }
.pay-bar > span { font-size: 12px; color: var(--muted); }
.legend-inline i.bl { background: #6fa0f5; } .legend-inline i.or { background: #f2994a; }
.pay-line.static { cursor: default; }
.line-chart { width: 100%; height: auto; color: var(--text); }

.period-row { display: flex; justify-content: center; gap: 6px; }
.period-row button { border: 0; background: none; padding: 5px 12px; border-radius: 10px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; }
.period-row button.active { background: color-mix(in srgb, var(--chip) 90%, transparent); color: var(--text); font-weight: 700; }
.index-curve { height: 150px; }
.index-curve .cum-line { height: 150px; }
.hero-chip b { margin: 0 2px; }
.idea-section { display: grid; gap: 10px; }
.dot-ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; }
.dot-ico.up { background: #2ea44f; } .dot-ico.down { background: #e5484d; }
.idea-cards { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 8px; }
.idea-card { flex: none; width: 210px; background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; padding: 14px 16px; display: grid; gap: 8px; box-shadow: var(--card-shadow); position: relative; overflow: hidden; }
.idea-card::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; right: -30px; top: -40px; background: color-mix(in srgb, var(--c, #2ea44f) 14%, transparent); }
.idea-card.up { --c: #2ea44f; } .idea-card.down { --c: #e5484d; }
.idea-top { display: flex; gap: 8px; align-items: flex-start; position: relative; z-index: 1; }
.rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.idea-pct { font-size: 30px; font-weight: 800; color: var(--c); }
.idea-card .bar { height: 5px; }
.idea-card .bar > span { background: var(--c); }
.idea-list { padding: 8px 16px; gap: 0; }
.idea-line { display: grid; grid-template-columns: 28px 80px minmax(0, 1fr) auto 80px; gap: 10px; padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); font-size: 14px; }
.idea-line strong { text-align: right; }
.search-input { flex: 1; border: 1px solid var(--card-line); background: var(--card); border-radius: 14px; padding: 10px 14px; font: inherit; color: inherit; }
.fut-list { padding: 4px 16px; gap: 0; }
.fut-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.fut-ava { width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); }
.fiz { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.fiz-bar { display: inline-flex; width: 50px; height: 5px; gap: 2px; }
.fiz-bar i { border-radius: 3px; } .fiz-bar i.l { background: #4cbc5c; } .fiz-bar i.s { background: #e5484d; }
.dialog.wide { width: min(760px, calc(100vw - 24px)); }
.pos-head { display: flex; gap: 16px; align-items: center; }
.pos-head h2 { margin: 0; }
.mini-tiles.four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#inv-dialog-body h3 { margin: 6px 0; font-size: 16px; }
.tinvest-form { display: flex; gap: 10px; flex-wrap: wrap; }
.tinvest-form input { flex: 1; min-width: 220px; border: 1px solid var(--card-line); background: var(--bg); border-radius: 12px; padding: 10px 12px; font: inherit; color: inherit; }
.grid-2.eq { align-items: stretch; }
.grid-2.eq > .mcard { height: 100%; min-height: 0; }
.mcard.link .donut-mac { justify-self: center; }
.mcard.link .donut-legend { gap: 2px; }
.mcard.link .legend-row { padding: 3px 0; }

/* Страница категории */
.split-pane.cat { grid-template-columns: 420px minmax(0, 1fr); }
@media (max-width: 1000px) { .split-pane.cat { grid-template-columns: minmax(0, 1fr); } }
.split-pane.cat .mhero-value { font-size: 40px; }
.split-pane.cat .mhero { padding: 22px 24px; }
.cat-months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 180px; align-items: end; }
.cat-months > div { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; height: 100%; gap: 4px; }
.cat-months small { font-size: 10px; color: var(--muted); align-self: end; white-space: nowrap; }
.cat-months span { width: 70%; align-self: end; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--c) 40%, transparent); }
.cat-months span.now { background: var(--c); }
.cat-months em { font-style: normal; font-size: 11px; color: var(--muted); }
.mac-toolbar .badge-icon { flex: none; }

/* Подробный отчёт по категории — как на iPhone */
.cat-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
@media (max-width: 1000px) { .cat-grid { grid-template-columns: minmax(0, 1fr); } }
.cat-hero { color: #fff; border-radius: 28px; padding: 22px 24px; display: grid; gap: 12px; background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 75%, #1e1b4b) 50%, #1e1b4b); box-shadow: 0 18px 40px color-mix(in srgb, var(--c) 30%, transparent); }
.cat-hero-top { display: flex; gap: 12px; align-items: center; }
.cat-hero-top strong { display: block; font-size: 18px; }
.cat-hero-top span { font-size: 13px; opacity: .8; }
.cat-hero-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: rgba(255, 255, 255, .2); font-size: 22px; }
.cat-hero-value { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.cat-compare { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.cmp-pill { border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 13px; }
.cat-hero .cmp-pill.good { background: rgba(120, 240, 170, .25); color: #b8ffd6; }
.cat-hero .cmp-pill.bad { background: rgba(255, 120, 130, .25); color: #ffd0d5; }
.mcard .cmp-pill.good { background: rgba(46, 164, 79, .12); color: #2ea44f; }
.mcard .cmp-pill.bad { background: rgba(229, 72, 77, .12); color: #e5484d; }
.muted-w { opacity: .7; }
.cat-share { display: grid; gap: 6px; font-size: 13px; opacity: .95; }
.cat-share-bar { height: 8px; border-radius: 5px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.cat-share-bar i { display: block; height: 100%; background: #fff; border-radius: 5px; }
.cat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-tile { background: var(--card); border: 1px solid var(--card-line); border-radius: 20px; padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--card-shadow); border-left: 4px solid var(--c); }
.cat-tile span { font-size: 13px; color: var(--muted); }
.cat-tile strong { font-size: 20px; letter-spacing: -.01em; }
.cat-tile small { color: var(--muted); }
.cat-forecast { grid-template-columns: 40px 1fr; align-items: center; }
.fc-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c)); font-size: 18px; }
.cat-forecast div { display: grid; gap: 2px; }
.cat-bars { position: relative; display: flex; gap: 4px; height: 210px; align-items: stretch; }
.cat-bars > div { flex: 1; display: grid; grid-template-rows: 1fr auto; position: relative; min-width: 0; }
.cat-bars > div > span { align-self: end; justify-self: center; width: 72%; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--c) 40%, transparent); margin-bottom: 4px; }
.cat-bars > div > span.on { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c)); }
.cat-bars small { position: absolute; left: 50%; transform: translateX(-50%); top: 0; font-size: 10px; color: var(--muted); white-space: nowrap; }
.cat-bars em { font-style: normal; font-size: 11px; color: var(--muted); text-align: center; height: 16px; white-space: nowrap; }
.cat-bars i.avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed color-mix(in srgb, var(--muted) 70%, transparent); z-index: 1; pointer-events: none; }
.yoy-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.year-rows { display: grid; gap: 8px; }
.year-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; }
.year-row .bar { height: 12px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 120px; }
.week-bars > div { display: grid; grid-template-rows: 1fr auto; justify-items: center; }
.week-bars span { align-self: end; width: 60%; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--c) 35%, transparent); }
.week-bars span.on { background: var(--c); }
.week-bars em { font-style: normal; font-size: 12px; color: var(--muted); }
.place-row { display: grid; gap: 4px; }
.place-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.place-top span::first-letter { text-transform: uppercase; }
.place-bottom { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.place-bottom small { color: var(--muted); }
.mcard .op-list .op-row:last-child { border-bottom: 0; }

/* =========== Главные плашки — единый вид, как «Баланс» на «Операциях» =========== */
.mhero .blob { display: none; }
.mhero { padding: 18px 20px; border-radius: 24px; box-shadow: 0 16px 36px rgba(70, 50, 190, .24); }
.mhero, .mhero.violet, .mhero.night, .mhero.blue {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(176, 92, 230, .55), transparent 60%),
    linear-gradient(165deg, #3a1fa0 0%, #5a33c9 40%, #4b56dc 75%, #3f78ea 100%);
}
.mhero.green {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(120, 230, 180, .35), transparent 60%),
    linear-gradient(165deg, #0f4a3f 0%, #1c6e5c 45%, #2f9a76 100%);
  box-shadow: 0 16px 36px rgba(20, 110, 80, .22);
}
.mhero.amber {
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 190, 140, .45), transparent 60%),
    linear-gradient(165deg, #8a3a1a 0%, #c4612f 50%, #e39a46 100%);
  box-shadow: 0 16px 36px rgba(180, 90, 30, .22);
}
.mhero-body { gap: 8px; }
.mhero-label { font-size: 13px; font-weight: 600; opacity: .85; }
.mhero-value { font-size: 34px; letter-spacing: -.02em; line-height: 1.1; }
.grid-3 .mhero-value, .split-pane.cat .mhero-value { font-size: 30px; }
.mhero-stats { margin-top: 2px; gap: 12px; }
.mhero-stats span { font-size: 12px; }
.mhero-stats strong { font-size: 15px; }
.hero-round { width: 32px; height: 32px; font-size: 15px; }
.hero-badge { font-size: 12px; padding: 3px 10px; }
.hero-row { font-size: 14px; }
.hero-small { font-size: 12px; }
.hero-delta { font-size: 14px; }
.hero-right strong { font-size: 16px; }
.hero-right span { font-size: 12px; }
.glass-tiles { gap: 8px; }
.glass-tiles > div { padding: 8px 12px; border-radius: 14px; }
.glass-tiles span { font-size: 12px; }
.glass-tiles strong { font-size: 16px; }
.glass-line { padding: 8px 12px; border-radius: 14px; }
.stack-bar { height: 8px; margin: 4px 0; }
.type-legend { font-size: 12px; }
.pace.big .cum-line { height: 70px; }
.index-curve, .index-curve .cum-line { height: 110px; }
.cat-hero { padding: 18px 20px; border-radius: 24px; gap: 10px; }
.cat-hero-value { font-size: 34px; }
.cat-hero-icon { width: 38px; height: 38px; font-size: 19px; }
.pay-bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.pay-bar small { align-self: center; }
.pay-stack { flex: none; }

/* =================================================================
   Телефон: как приложение на iPhone
   ================================================================= */
.rem-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
@media (max-width: 1000px) {
  .split-left { position: static; }
}
@media (max-width: 700px) {
  body { background: var(--bg); }
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .brand-sub { display: none; }
  #screen-app { padding: 0 12px; }
  .page { background: none; border: 0; padding: 0; border-radius: 0; gap: 14px; min-height: 0; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .stack, .grid-2, .grid-3, .split-pane, .split-left { gap: 14px; }

  .mac-head h1 { font-size: 28px; }
  .mac-head { flex-wrap: wrap; }
  .mac-head .button { width: 100%; }
  .mac-toolbar { gap: 10px; }
  .mac-toolbar .segmented { max-width: 100%; overflow-x: auto; }
  .segmented { overflow-x: auto; max-width: 100%; }
  .segmented button { padding: 7px 12px; font-size: 14px; white-space: nowrap; }
  .mn-title { font-size: 24px; margin-left: 4px; }
  .mn-sub { margin-left: 4px; font-size: 13px; }
  .month-nav-mac .circle-button { width: 40px; height: 34px; }

  .mcard { padding: 16px; border-radius: 20px; gap: 12px; }
  .card-head h2 { font-size: 17px; }
  .mhero, .bal-hero, .cat-hero { border-radius: 22px; padding: 16px; }
  .mhero-value, .bal-value, .cat-hero-value { font-size: 30px; }
  .mhero-stats { gap: 10px; }
  .tile-grid { gap: 10px; }
  .mtile { padding: 14px; border-radius: 18px; }
  .tile-icon { margin-bottom: 8px; }
  .tile-value { font-size: 19px; }
  .glass-tiles.three { grid-template-columns: 1fr 1fr; }

  /* Операции */
  .ops-toolbar { flex-wrap: wrap; }
  .ops-toolbar .button { order: 5; flex: 1; }
  .ops-month strong { font-size: 19px; }
  .ops-filters { flex-direction: column; }
  .ops-filters .segmented { width: 100%; }
  .ops-filters .segmented button { flex: 1; }
  .day-groups .op-list { padding: 0 10px; border-radius: 16px; }
  .day-groups .op-row { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 8px 2px; }
  .day-groups .badge-icon.md { width: 34px; height: 34px; font-size: 15px; }
  .day-groups .op-main { display: grid; gap: 1px; }
  .day-groups .op-title { max-width: none; }
  .acc-chips { overflow-x: auto; flex-wrap: nowrap; }

  /* Капитал, отчёты, бюджет */
  .donut-block { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .donut-legend { width: 100%; }
  .pb-plot { margin-right: 48px; }
  .pb-grid { right: -48px; }
  .pb-pair { gap: 3px; }
  .pb-pair span { width: 12px; }
  .row-item { grid-template-columns: 40px minmax(0, 1fr) auto 10px; gap: 10px; }
  .row-item.tall, .row-item.static { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .badge-icon.lg { width: 40px; height: 40px; font-size: 18px; }
  .row-item.static .pill-button { padding: 6px 10px; font-size: 13px; }
  .pay-row { grid-template-columns: 20px minmax(0, 1fr) auto auto; }
  .cat-row { grid-template-columns: 40px minmax(0, 1fr) 10px; gap: 10px; }
  .cat-bottom { grid-template-columns: 1fr auto; }
  .cat-bottom .mm { display: none; }
  .mini-tiles { grid-template-columns: 1fr 1fr; }
  .mini-tiles.four { grid-template-columns: 1fr 1fr; }
  .cat-tiles { gap: 10px; }
  .cat-bars { height: 170px; }
  .cat-bars small { display: none; }

  /* Инвестиции */
  .inv-narrow { gap: 14px; }
  .pos-row { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; }
  .pos-row .chev { display: none; }
  .inv-avatar.md { width: 40px; height: 40px; }
  .pos-sub .mini-bar { display: none; }
  .pay-bars { gap: 4px; height: 220px; }
  .pay-bar small { font-size: 9px; }
  .idea-card { width: 170px; }
  .idea-pct { font-size: 24px; }
  .idea-line { grid-template-columns: 22px 64px minmax(0, 1fr) 64px; }
  .idea-line > span:nth-child(4) { display: none; }
  .kv-row { gap: 14px; }
  .hero-right { justify-items: start; text-align: left; }
  .mhero-top { flex-wrap: wrap; }

  /* Нижняя панель — как таб-бар iPhone */
  .tabs {
    left: 0; right: 0; bottom: 0; transform: none; max-width: none; width: 100%;
    border-radius: 22px 22px 0 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    justify-content: flex-start; gap: 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
  .tab { flex: 1 0 68px; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 10px; font-weight: 600; border-radius: 14px; }
  .tab-icon svg { width: 22px; height: 22px; }
  .tab.active { background: none; box-shadow: none; color: var(--accent); }
  .inv-tabs { bottom: calc(68px + env(safe-area-inset-bottom)); left: 8px; right: 8px; transform: none; max-width: none; }
  .inv-tabs button { padding: 7px 10px; font-size: 13px; }

  /* Окна — листом снизу, как на iPhone */
  .dialog, .dialog.wide { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 24px 24px 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  #form-body { grid-template-columns: minmax(0, 1fr); }
  #form-body > .field.half { grid-column: 1 / -1; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) {
  .tab-label { display: block; white-space: nowrap; }
  .mhero-value, .bal-value, .cat-hero-value { font-size: clamp(24px, 8vw, 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .grid-3 .mhero-value { font-size: clamp(24px, 8vw, 30px); }
  .pj-sum strong { font-size: 28px; }
}
.add-card { display: flex; justify-content: center; align-items: center; gap: 8px; }
@media (max-width: 700px) {
  .card-head { flex-wrap: wrap; row-gap: 10px; }
  .card-head > .segmented { flex: 1 1 100%; order: 5; }
  .card-head > .segmented button { flex: 1; }
  .cat-grid, .cat-grid > .stack { min-width: 0; max-width: 100%; }
  .cat-bars { gap: 2px; }
  .cat-bars em { font-size: 9px; }
  .cat-bars > div > span { width: 80%; }
  .mac-toolbar > .segmented { flex: 1 1 100%; order: 5; }
  .mac-toolbar > .segmented button { flex: 1; padding: 7px 6px; }
  .cat-hero-value { font-size: clamp(26px, 9vw, 34px); }
}
#privacy-toggle.on { background: var(--accent); color: #fff; }
.quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.qchip { border: 1px solid var(--card-line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; }
.qchip.active { background: var(--accent); color: #fff; border-color: transparent; }
.rule-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); flex-wrap: wrap; }
.rule-row .link-button { margin-left: auto; color: var(--red); }
.rule-key { font-weight: 600; }
.trash-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.pill-button.small { padding: 6px 12px; font-size: 13px; }
.pb-col { min-width: 0; }
.pb-pair { width: 100%; justify-content: center; gap: 4px; }
.pb-pair span { width: 32%; max-width: 30px; }
.leaders-bar { display: flex; gap: 8px; align-items: center; }
.leaders-bar .segmented:last-child button { padding: 8px 12px; }

/* =================================================================
   Телефон: дизайн как в приложении на iPhone
   ================================================================= */
.mobile-only, .nav-title { display: none; }
.fab-add { display: none; }
@media (max-width: 700px) {
  :root { --bg: #f2f2f7; --bg2: #f2f2f7; }
  :root[data-theme="dark"] { --bg: #000; --bg2: #000; --card: #1c1c1e; --chip: #2c2c2e; }
  body { background: var(--bg); }
  .mobile-only { display: grid; }
  .mobile-only.hidden { display: none; }
  .tab.mobile-only { display: flex; }

  /* Навбар: заголовок по центру, справа круглые кнопки */
  .topbar { position: sticky; top: 0; z-index: 25; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .topbar .brand { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
  .nav-title { display: block; grid-column: 2; font-size: 17px; font-weight: 700; text-align: center; white-space: nowrap; }
  .top-actions { grid-column: 3; justify-self: end; gap: 6px; }
  .top-actions .icon-button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); font-size: 16px; }
  #provider-badge, #save-state, #lock { display: none !important; }
  #screen-connect .topbar, body:has(#screen-app.hidden) .nav-title { display: none; }
  body:has(#screen-app.hidden) .topbar .brand { opacity: 1; width: auto; pointer-events: auto; }
  body:has(#screen-app.hidden) .topbar { grid-template-columns: 1fr auto; }

  /* Плавающая «＋ Добавить» над таб-баром, как в приложении */
  .fab-add { display: block; position: fixed; left: 16px; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 28; border: 0; border-radius: 999px; padding: 14px; font: inherit; font-weight: 700; font-size: 17px; color: #fff;
    background: linear-gradient(120deg, #5b45d8, #8a52de); box-shadow: 0 10px 26px rgba(80, 50, 200, .35); }
  .fab-add.hidden { display: none; }
  body:has(#fab-add:not(.hidden)) main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .ops-toolbar .button.primary { display: none; }

  /* Таб-бар как в iOS: 5 вкладок, «Ещё» */
  .tabs { justify-content: space-around; overflow: hidden; border-radius: 0; padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 88%, transparent); border-top: 1px solid var(--card-line); box-shadow: none; }
  .tab[data-section="overview"], .tab[data-section="projects"], .tab[data-section="budget"], .tab[data-section="reminders"] { display: none; }
  .tab { flex: 1 1 0; min-width: 0; padding: 4px 2px; }
  .tab-label { font-size: 10px; }
  .tab.active { color: var(--accent); background: none; }
  .inv-tabs { bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* Карточки и списки — как сгруппированные таблицы iOS */
  .mcard { border-radius: 18px; box-shadow: none; border: 0; }
  .day-groups .op-list, .op-list.boxed, .pos-list, .fut-list, .mcard.inv-acc-list { box-shadow: none; border: 0; border-radius: 14px; }
  .mtile, .cat-tile, .rem-tile, .idea-card { box-shadow: none; border: 0; }
  .day-head { padding: 0 4px; font-size: 13px; text-transform: none; }
  .row-item { padding: 9px 0; }
  .more-list { padding: 6px 14px; gap: 0; }
  .more-list .row-item { grid-template-columns: 32px minmax(0, 1fr) auto 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); border-radius: 0; }
  .more-list .row-item:last-child { border-bottom: 0; }
  .more-list .card-icon { width: 30px; height: 30px; border-radius: 8px; }
  .more-list .card-icon svg { width: 18px; height: 18px; }

  /* Заголовки страниц — в навбаре; большие заголовки скрываем */
  .mac-head { display: none; }
  .ops-toolbar { display: grid; grid-template-columns: 40px 1fr 40px 40px 40px 40px; }
  .ops-month { grid-column: 2; }
  .mac-toolbar .mn-title { font-size: 20px; }
  .segmented { background: color-mix(in srgb, var(--chip) 100%, transparent); border-radius: 10px; padding: 2px; }
  .segmented button { border-radius: 8px; padding: 6px 10px; font-size: 13px; }
  .segmented button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); font-weight: 600; }
  .segmented.kinds button.active, .segmented.kinds button[data-value="expense"].active { color: #fff; }
  .segmented.grow button.active { background: linear-gradient(120deg, #5b45d8, #9a4fd6); color: #fff; }
}
@media (max-width: 700px) {
  .inv-tabs { position: sticky; top: calc(52px + env(safe-area-inset-top)); bottom: auto; left: auto; right: auto; transform: none; order: -1; z-index: 20; margin: 0 -2px; border-radius: 14px; justify-content: flex-start; }
  .inv-tabs button { padding: 7px 10px; }
  .inv-tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
  .inv-tabs { background: var(--chip); border: 0; box-shadow: none; padding: 3px; }
}
@media (max-width: 700px) {
  .inv-tabs { max-width: 100%; min-width: 0; width: 100%; overflow-x: auto; }
  #page > * { min-width: 0; max-width: 100%; }
}
@media (max-width: 700px) {
  .leaders-bar { flex-wrap: wrap; }
  .leaders-bar .segmented { flex: 1 1 100%; }
  .leaders-bar .segmented button { flex: 1; }
  .split-pane > *, .grid-2 > *, .stack > * { min-width: 0; }
}
@media (max-width: 700px) {
  #form-body input[data-key="amount"] { font-size: 30px; font-weight: 800; min-height: 60px; text-align: center; }
}

/* =================================================================
   Значки SF → SVG, общие правила
   ================================================================= */
.badge-icon.glyph svg { width: 54%; height: 54%; stroke-width: 2.3; }
.circle-button svg { width: 20px; height: 20px; }
.icon-button svg { width: 19px; height: 19px; }
.phone-only { display: none !important; }
.acc-chip .acc-name { display: inline-flex; align-items: center; gap: 6px; }
.acc-ico { display: inline-grid; color: var(--c); }
.acc-ico svg { width: 16px; height: 16px; stroke-width: 2.4; }
.acc-chip.on .acc-ico { color: #fff; }
.bal-pace-note { display: grid; justify-items: end; gap: 1px; }
.pace-pct { font-size: 15px; font-weight: 800; }
.pace-pct.up { color: #ff9eb0; }
.pace-pct.down { color: #8ff0c4; }
.bal-pace-note small { font-size: 10px; opacity: .85; }
@keyframes ktd-spin { to { transform: rotate(360deg); } }
#nav-sync.spin svg { animation: ktd-spin .8s linear infinite; }

/* =================================================================
   Телефон: 1 в 1 с приложением на iPhone (навбар, счета, фильтры, таб-бар)
   ================================================================= */
@media (max-width: 700px) {
  .phone-only { display: grid !important; }
  .desk-only { display: none !important; }

  /* Навбар: слева «таблетка» (Ещё, синхронизация), заголовок, справа «таблетка» (поиск, настройки, глаз) */
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar .brand { display: none; }
  .nav-left { display: flex; grid-column: 1; }
  .nav-title { grid-column: 2; text-align: left; font-size: 19px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
  .nav-left, .top-actions { gap: 0; padding: 2px 4px; border-radius: 999px; background: color-mix(in srgb, var(--card) 78%, transparent); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .top-actions { grid-column: 3; }
  .nav-left .icon-button, .top-actions .icon-button { width: 40px; height: 38px; border-radius: 50%; border: 0; background: none; box-shadow: none; color: var(--text); }
  .nav-left .icon-button svg, .top-actions .icon-button svg { width: 21px; height: 21px; }
  #nav-sync { color: #3478f6; }
  #nav-more { color: var(--accent); }
  #nav-search { order: 1; }
  #settings-open { order: 2; }
  #privacy-toggle { order: 3; }
  #privacy-toggle.on { background: none; color: var(--accent); }
  body:has(#screen-app.hidden) .nav-left { display: none; }

  /* Главная плашка — плотнее, как на iPhone */
  .bal-hero { border-radius: 26px; padding: 18px 18px 16px; gap: 12px;
    background: radial-gradient(120% 80% at 100% 0%, rgba(160, 90, 225, .55), transparent 60%), linear-gradient(160deg, #241a66 0%, #4a2fb8 40%, #4b56dc 75%, #3f7ee8 100%); }
  .bal-ring .ring-wrap { width: 64px; height: 64px; }
  .bal-pace .cum-line { width: 58%; }

  /* Счета: выбранный — синяя плитка, остальные — без фона */
  .acc-chips { gap: 6px; padding: 0; background: none; border: 0; }
  .acc-chip { background: none; padding: 9px 14px; border-radius: 16px; }
  .acc-chip .acc-name { font-size: 15px; }
  .acc-chip strong { font-size: 18px; font-weight: 700; }
  .acc-chip.on { background: linear-gradient(160deg, #4b8dff, #2f6fef); box-shadow: 0 6px 16px rgba(47, 111, 239, .28); }
  .acc-chip.add { background: none; color: var(--text); font-size: 26px; font-weight: 400; min-width: 48px; padding: 0 10px; }
  .acc-add-label { display: none; }

  /* Платежи — белая карточка */
  .pay-card { background: var(--card); border: 0; box-shadow: none; border-radius: 22px; }
  .pay-head strong { font-size: 17px; }

  /* Месяц: белые круглые кнопки */
  .ops-toolbar { grid-template-columns: 44px minmax(0, 1fr) 44px 44px 44px; gap: 8px; }
  .ops-toolbar .circle-button { width: 44px; height: 44px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
  .ops-toolbar .circle-button:disabled { background: color-mix(in srgb, var(--card) 50%, transparent); }
  .ops-month { text-align: center; }
  .ops-month strong { font-size: 22px; font-weight: 800; }

  /* Фильтры в одну строку: Всё/Личное/Бизнес + Расходы/Доходы */
  .ops-filters { flex-direction: row; gap: 8px; align-items: center; }
  .ops-filters .segmented { width: auto; background: var(--card); border-radius: 999px; padding: 3px; overflow: visible; }
  .ops-filters .segmented.grow { flex: 1.25; }
  .ops-filters .segmented.kinds { flex: 1; background: none; }
  .ops-filters .segmented button { border-radius: 999px; padding: 8px 6px; font-size: 15px; flex: 1; }
  .ops-filters .segmented.grow button.active { background: linear-gradient(120deg, #6a4cf0, #b04ed8); }
  .ops-filters .segmented.kinds button.active[data-value="expense"] { background: linear-gradient(120deg, #f0525c, #e5384f); color: #fff; }
  .ops-filters .segmented.kinds button.active[data-value="income"] { background: linear-gradient(120deg, #34c759, #28a745); color: #fff; }

  /* Дни: крупный серый заголовок, строки в общей белой карточке */
  .day-head { font-size: 19px; font-weight: 600; color: var(--muted); padding: 4px 16px 2px; }
  .day-groups .op-list { padding: 2px 14px; border-radius: 22px; background: var(--card); }
  .day-groups .op-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; }
  .day-groups .badge-icon.md { width: 42px; height: 42px; }
  .day-groups .op-title { font-size: 17px; font-weight: 600; }
  .day-groups .op-sub { font-size: 14px; }
  .day-groups .op-amount { font-size: 17px; font-weight: 700; }

  /* «＋ Добавить» — над таб-баром, градиент как в приложении */
  .fab-add { left: 14px; right: 14px; bottom: calc(86px + env(safe-area-inset-bottom)); padding: 15px; font-size: 19px;
    background: linear-gradient(110deg, #5338d6 0%, #4f63e0 60%, #4a83e6 100%); box-shadow: 0 10px 26px rgba(70, 70, 210, .35); }

  /* Таб-бар — плавающая «стеклянная» капсула, 5 вкладок как в приложении */
  .tabs { left: 12px; right: 12px; width: auto; bottom: max(10px, env(safe-area-inset-bottom)); border-radius: 999px; padding: 5px; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
    background: color-mix(in srgb, var(--card) 72%, transparent); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px); }
  .tab[data-section="projects"] { display: flex; }
  .tab.mobile-only[data-section="more"] { display: none; }
  .tab { border-radius: 999px; padding: 7px 2px; color: var(--text); }
  .tab-label { font-size: 11px; font-weight: 600; }
  .tab-icon svg { width: 24px; height: 24px; }
  .tab.active { color: var(--accent); background: color-mix(in srgb, var(--text) 8%, transparent); }
  main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  body:has(#fab-add:not(.hidden)) main { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .inv-tabs { top: calc(56px + env(safe-area-inset-top)); }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) {
  .topbar { background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent)); padding-bottom: 14px; margin-bottom: -8px; }
  .ops-toolbar { grid-template-columns: 40px minmax(0, 1fr) 40px 40px 40px; gap: 6px; }
  .ops-toolbar .circle-button { width: 40px; height: 40px; }
  .ops-month strong { white-space: nowrap; font-size: clamp(18px, 5.6vw, 22px); }
  .ops-filters { flex-wrap: nowrap; }
  .ops-filters .segmented { min-width: 0; }
  .ops-filters .segmented button { padding: 8px 4px; font-size: 14px; }
  .ops-filters .segmented.kinds button:not(.active) { color: var(--muted); }
  .bal-chip svg { width: 15px; height: 15px; }
}
@media (max-width: 700px) { .ops-filters .segmented.grow { flex: 1.7; } .ops-filters .segmented.grow button { padding: 8px 8px; font-size: 15px; } }

/* Телефон: плотнее, как в приложении — больше влезает на экран */
@media (max-width: 700px) {
  .page, .split-pane, .split-left, .stack { gap: 10px; }
  #screen-app { padding: 0 10px; }
  .topbar { padding: 4px 10px 10px; padding-top: max(4px, env(safe-area-inset-top)); }
  .nav-left .icon-button, .top-actions .icon-button { width: 36px; height: 34px; }
  .nav-left .icon-button svg, .top-actions .icon-button svg { width: 19px; height: 19px; }
  .nav-title { font-size: 18px; }

  .bal-hero { padding: 14px 15px 12px; gap: 9px; border-radius: 22px; }
  .bal-label { font-size: 12px; }
  .bal-value { font-size: clamp(24px, 7.6vw, 30px); }
  .bal-chip { padding: 3px 9px; font-size: 11px; }
  .bal-ring .ring-wrap { width: 50px; height: 50px; }
  .bal-ring .ring-wrap strong { font-size: 13px; }
  .bal-ring .ring-cap { font-size: 10px; margin-top: 0; }
  .bal-ring b { font-size: 11px; }
  .bal-ring small { font-size: 9px; }
  .bal-pace { padding: 5px 8px 3px; border-radius: 12px; }
  .bal-pace .cum-line { height: 38px; }
  .bal-pace-note { right: 10px; }
  .pace-pct { font-size: 13px; }
  .bal-pace-note small { font-size: 9px; }
  .bal-month { font-size: 11px; }
  .bal-stats { gap: 6px; }
  .bal-stat { gap: 2px; }
  .bal-stat-label { font-size: 11px; gap: 5px; }
  .bal-dot { width: 16px; height: 16px; font-size: 10px; }
  .bal-stat strong { font-size: 14px; }

  .acc-chip { padding: 6px 11px; border-radius: 13px; gap: 1px; }
  .acc-chip .acc-name { font-size: 13px; }
  .acc-chip strong { font-size: 15px; }
  .acc-ico svg { width: 14px; height: 14px; }
  .acc-chip.add { font-size: 22px; min-width: 40px; }

  .pay-card { border-radius: 18px; }
  .pay-head { padding: 10px 14px; }
  .pay-head strong { font-size: 15px; }

  .ops-pane { gap: 10px; }
  .ops-toolbar { grid-template-columns: 34px minmax(0, 1fr) 34px 34px 34px; gap: 6px; }
  .ops-toolbar .circle-button { width: 34px; height: 34px; }
  .ops-toolbar .circle-button svg { width: 17px; height: 17px; }
  .ops-month strong { font-size: 19px; }
  .ops-month span { font-size: 12px; }
  .ops-filters .segmented { padding: 2px; }
  .ops-filters .segmented button, .ops-filters .segmented.grow button { padding: 6px 6px; font-size: 13px; }

  .day-groups { gap: 8px; }
  .day-head { font-size: 15px; padding: 2px 12px 0; }
  .day-groups .op-list { padding: 0 12px; border-radius: 18px; }
  .day-groups .op-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 7px 0; }
  .day-groups .badge-icon.md { width: 32px; height: 32px; }
  .day-groups .op-title { font-size: 15px; }
  .day-groups .op-sub { font-size: 12px; }
  .day-groups .op-amount { font-size: 15px; }

  .fab-add { padding: 11px; font-size: 16px; bottom: calc(68px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .tabs { left: 10px; right: 10px; padding: 3px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .tab { padding: 5px 2px; gap: 1px; }
  .tab-icon svg { width: 21px; height: 21px; }
  .tab-label { font-size: 10px; }
  main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body:has(#fab-add:not(.hidden)) main { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(124px + env(safe-area-inset-bottom)); }

  .mhero, .cat-hero { padding: 14px; }
  .mhero-value, .cat-hero-value { font-size: clamp(24px, 7.6vw, 30px); }
  .mcard { padding: 13px; gap: 10px; }
  .card-head h2 { font-size: 16px; }
  .row-item { padding: 7px 0; }
  .badge-icon.lg { width: 34px; height: 34px; }
  .row-item { grid-template-columns: 34px minmax(0, 1fr) auto 10px; }
  .row-item.tall, .row-item.static { grid-template-columns: 34px minmax(0, 1fr) auto; }
}
@media (max-width: 700px) { .bal-ring .ring-wrap svg { width: 100%; height: 100%; } .bal-ring { line-height: 1.2; } }

/* Капитал — как в приложении */
.cur-toggle { display: inline-flex; align-items: center; gap: 4px; border: 0; border-radius: 999px; padding: 5px 11px; background: rgba(255, 255, 255, .16); color: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.cur-toggle svg { width: 15px; height: 15px; }
.mhero.night { background: linear-gradient(110deg, #1f1d4a 0%, #33296f 40%, #6a4d93 72%, #9a6aab 100%); }
.mhero.night .stack-bar { height: 12px; border-radius: 8px; background: rgba(255, 255, 255, .18); }
.mhero.night .stack-bar span:first-child { border-radius: 8px 0 0 8px; }
.mhero.night .stack-bar span:last-child { border-radius: 0 8px 8px 0; }
.acc-move { display: inline-flex; gap: 6px; }
.mini-circle { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--chip); color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
.mini-circle:disabled { opacity: .35; cursor: default; }
.row-item.dim .badge-icon { opacity: .45; }
.row-item.dim { opacity: 1; }
.row-item.dim .row-title, .row-item.dim .row-value { opacity: .9; }
.row-value-col small.muted { color: var(--muted); font-size: 13px; }
@media (max-width: 700px) {
  .donut-block { grid-template-columns: auto minmax(0, 1fr); gap: 14px; justify-items: stretch; }
  .donut-legend { width: auto; }
  .legend-row { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; padding: 4px 0; }
  .legend-row .name { font-size: 14px; }
  .legend-row .name small { font-size: 12px; }
  .legend-row strong { font-size: 14px; }
  .legend-row .badge-icon.sm { width: 28px; height: 28px; }
  .mhero.night { padding: 16px; }
  .mhero.night .mhero-value { font-size: clamp(26px, 9vw, 36px); }
  .acc-row .row-value { font-size: 16px; }
  .link-button { font-size: 15px; }
}
@media (max-width: 700px) { .donut-block { gap: 12px; } .legend-row .name { white-space: nowrap; } .legend-row .name > :first-child, .legend-row .name { text-overflow: ellipsis; } }
@media (max-width: 700px) {
  /* Вкладки Капитал/Инвестиции/Проекты/Отчёты: заголовок по центру, справа только «глаз» — как в приложении */
  body:is([data-section="capital"], [data-section="investments"], [data-section="projects"], [data-section="reports"]) .nav-left,
  body:is([data-section="capital"], [data-section="investments"], [data-section="projects"], [data-section="reports"]) #settings-open { display: none !important; }
  body:is([data-section="capital"], [data-section="investments"], [data-section="projects"], [data-section="reports"]) .topbar { grid-template-columns: 48px minmax(0, 1fr) 48px; }
  body:is([data-section="capital"], [data-section="investments"], [data-section="projects"], [data-section="reports"]) .nav-title { text-align: center; }
  body:is([data-section="capital"], [data-section="investments"], [data-section="projects"], [data-section="reports"]) .top-actions { padding: 2px; }
  .legend-row { grid-template-columns: 26px minmax(0, 1fr) auto; gap: 7px; }
  .legend-row .badge-icon.sm { width: 26px; height: 26px; }
}

/* Инвестиции → Портфель (новый экран) */
.inv-tab-ico { display: inline-grid; }
.inv-tab-ico svg { width: 16px; height: 16px; }
.pf-hero .mhero-body { display: grid; gap: 8px; }
.pf-deltas { display: grid; gap: 2px; }
.pf-delta { font-weight: 700; font-size: 15px; }
.pf-delta.up { color: #8ff0c4; }
.pf-delta.down { color: #ffb3c4; }
.pf-delta.muted { color: rgba(255, 255, 255, .7); font-weight: 600; font-size: 13px; }
.pf-chart { display: grid; gap: 4px; min-height: 110px; }
.pf-chart.loading { place-content: center; justify-items: center; gap: 8px; font-size: 13px; opacity: .75; }
.pf-change { font-size: 13px; font-weight: 700; }
.pf-change.up { color: #8ff0c4; }
.pf-change.down { color: #ffb3c4; }
.pf-line { width: 100%; height: 110px; display: block; overflow: visible; }
.pf-periods { display: flex; gap: 4px; background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 3px; }
.pf-periods button { flex: 1; border: 0; background: none; color: rgba(255, 255, 255, .8); font: inherit; font-weight: 700; font-size: 13px; padding: 6px 0; border-radius: 999px; cursor: pointer; }
.pf-periods button.active { background: rgba(255, 255, 255, .92); color: #2b2366; }
.pf-mix { display: grid; gap: 6px; border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 0; cursor: pointer; }
.pf-mix .stack-bar { margin: 2px 0 0; }
.pf-mix .type-legend { gap: 6px 14px; font-size: 12px; }
.pf-acc { grid-template-columns: 46px minmax(0, 1fr) auto; }
.pf-acc small.up { color: #2ea44f; font-weight: 700; }
.pf-acc small.down { color: #e5484d; font-weight: 700; }
.mover-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
.mover-strip::-webkit-scrollbar { display: none; }
.mover-chip { flex: none; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 16px; padding: 8px 12px 8px 8px; font: inherit; color: inherit; cursor: pointer; background: color-mix(in srgb, var(--chip) 85%, transparent); }
.mover-chip .mc-main { display: grid; text-align: left; line-height: 1.2; }
.mover-chip .mc-main b { font-size: 14px; }
.mover-chip .mc-main span { font-size: 13px; font-weight: 700; }
.mover-chip.up .mc-main span { color: #2ea44f; }
.mover-chip.down .mc-main span { color: #e5484d; }
.inv-avatar.sm { width: 30px; height: 30px; font-size: 9px; }
.pf-pay { display: grid; gap: 10px; text-align: left; font: inherit; color: inherit; cursor: pointer; border: 0; }
.pf-pay-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 10px; gap: 12px; align-items: center; }
.pf-pay .big-green { font-size: 20px; }
@media (max-width: 700px) {
  .pf-hero { padding: 14px; }
  .pf-line { height: 92px; }
  .pf-chart { min-height: 96px; }
  .pf-acc { grid-template-columns: 34px minmax(0, 1fr) auto; }
}
/* Портфель: компактная плашка — справа от суммы «за всё время» и «за период» */
.pf-hero .mhero-body { gap: 6px; }
.pf-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.pf-main { display: grid; gap: 2px; min-width: 0; }
.pf-side { display: flex; gap: 14px; text-align: right; }
.pf-side-item { display: grid; justify-items: end; line-height: 1.2; }
.pf-side-item span { font-size: 11px; opacity: .7; }
.pf-side-item b { font-size: 14px; }
.pf-side-item small { font-size: 11px; font-weight: 700; }
.pf-side-item.up small { color: #8ff0c4; }
.pf-side-item.down small { color: #ffb3c4; }
.pf-chart { min-height: 0; }
.pf-chart.loading { min-height: 70px; }
.pf-line { height: 84px; }
.pf-periods { padding: 2px; }
.pf-periods button { padding: 4px 0; font-size: 12px; }
.pf-mix { gap: 4px; }
.pf-mix .stack-bar { height: 8px; }
.pf-mix .type-legend { flex-wrap: nowrap; overflow: hidden; gap: 10px; font-size: 11px; white-space: nowrap; }
@media (max-width: 700px) {
  .pf-hero { padding: 12px 14px; }
  .pf-side { flex-direction: column; gap: 4px; }
  .pf-hero .mhero-value { font-size: clamp(24px, 7.4vw, 30px); }
  .pf-delta { font-size: 13px; }
  .pf-line { height: 64px; }
  .pf-chart { min-height: 0; }
  .pf-chart.loading { min-height: 64px; }
}
@media (max-width: 700px) {
  /* Подвкладки «Инвестиций» — внизу, над таб-баром, как в приложении */
  .inv-tabs { position: fixed; top: auto; order: 0; left: 10px; right: 10px; width: auto; max-width: none; margin: 0;
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 62px); z-index: 29; padding: 4px; border-radius: 18px;
    background: color-mix(in srgb, var(--card) 80%, transparent); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12); backdrop-filter: saturate(180%) blur(22px); -webkit-backdrop-filter: saturate(180%) blur(22px);
    justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .inv-tabs::-webkit-scrollbar { display: none; }
  .inv-tabs button { flex: 1 0 auto; flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 11px; border-radius: 14px; }
  .inv-tabs button .inv-tab-ico svg { width: 18px; height: 18px; }
  .inv-tabs button.active { background: linear-gradient(135deg, #1e2a78, #4338ca); color: #fff; box-shadow: none; }
  body[data-section="investments"] main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) { .inv-tabs button { flex: 1 1 0; min-width: 0; padding: 6px 2px; font-size: 10.5px; letter-spacing: -.01em; } }

/* =================================================================
   Отчёты — как в приложении (iPhone и Mac)
   ================================================================= */
.rep-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rep-nav { display: flex; align-items: center; gap: 10px; }
.rep-nav .circle-button { width: 40px; height: 40px; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.rep-nav-title { display: grid; }
.rep-nav-title strong { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.rep-nav-title span { color: var(--muted); font-size: 14px; }
.segmented.rep-period button.active, .segmented.rep-mode button.active { background: linear-gradient(120deg, #6a3fd8, #8a4fe0); color: #fff; }
.rep-mode button { display: inline-flex; align-items: center; gap: 6px; }
.rep-mode-ico { display: inline-grid; }
.rep-mode-ico svg { width: 17px; height: 17px; }
.rep-compare { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: .85; }
.rep-compare i { width: 18px; border-top: 2px dashed rgba(255, 255, 255, .7); }
.rep-hero .pace.big .cum-line { height: 110px; }
.rep-tiles .mtile { gap: 4px; }
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tile-top .chev { color: var(--muted); }
.tile-ring { position: relative; width: 40px; height: 40px; display: grid; place-items: center; }
.tile-ring .ring { position: absolute; inset: 0; }
.tile-ring .ring circle:first-child { stroke: color-mix(in srgb, #FF9F45 20%, transparent); }
.tile-ring-ico { color: #FF9F45; display: grid; }
.tile-ring-ico svg { width: 18px; height: 18px; }
.rep-tiles .card-icon { width: 36px; height: 36px; border-radius: 10px; }
.rep-tiles .card-icon svg { width: 20px; height: 20px; }
.chg-pill { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
.chg-pill.bad { background: color-mix(in srgb, #e5484d 13%, transparent); color: #e5484d; }
.chg-pill.good { background: color-mix(in srgb, #2ea44f 14%, transparent); color: #2ea44f; }
.cat-bottom .chg-pill { font-size: 12px; }
.crown-line { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.crown-line b { color: var(--text); }
.cmp-note { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.cmp-tile { display: grid; gap: 6px; padding: 14px 16px; border-radius: 18px; background: color-mix(in srgb, var(--chip) 70%, transparent); }
.cmp-tile > span:first-child { color: var(--muted); font-size: 14px; font-weight: 600; }
.cmp-tile strong { font-size: 22px; font-weight: 800; }
.cmp-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.delta-list { display: grid; gap: 2px; }
.delta-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: none; border: 0; padding: 7px 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.delta-pill { font-weight: 800; font-size: 14px; padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.delta-pill.bad { background: color-mix(in srgb, #e5484d 13%, transparent); color: #e5484d; }
.delta-pill.good { background: color-mix(in srgb, #2ea44f 14%, transparent); color: #2ea44f; }
.day-bars { display: grid; gap: 4px; }
.db-plot { position: relative; height: 200px; margin-right: 64px; }
.db-avg { position: absolute; left: 0; right: -64px; border-top: 2px dashed color-mix(in srgb, var(--text) 75%, transparent); }
.db-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 3px; }
.db-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.db-col i { width: 100%; border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, #e94b7a, #c04fd6); min-height: 0; }
.db-labels { display: flex; gap: 3px; margin-right: 64px; font-size: 12px; color: var(--muted); }
.db-labels span { flex: 1; white-space: nowrap; overflow: visible; }
.day-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fact { display: grid; gap: 2px; padding: 12px 14px; border-radius: 16px; font-size: 13px; color: var(--muted); }
.fact strong { color: var(--text); font-size: 17px; }
.fact-ico { display: grid; }
.fact-ico svg { width: 16px; height: 16px; }
.fact.purple { background: color-mix(in srgb, #C94FD6 10%, transparent); } .fact.purple .fact-ico { color: #C94FD6; }
.fact.green { background: color-mix(in srgb, #34C759 10%, transparent); } .fact.green .fact-ico { color: #34C759; }
.fact.orange { background: color-mix(in srgb, #FF8A3D 10%, transparent); } .fact.orange .fact-ico { color: #FF8A3D; }
.dep-bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.dep-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.dep-col span { width: 60%; border-radius: 6px 6px 2px 2px; }
.dep-col span.pos { background: linear-gradient(180deg, #5aa2ff, #2f6fef); }
.dep-col span.neg { background: linear-gradient(180deg, #ff8f8f, #e5484d); }
.dep-col small { color: var(--muted); font-size: 12px; }
.rep-grid { align-items: start; }
@media (max-width: 700px) {
  .rep-head.phone { display: grid; gap: 10px; }
  .rep-head.phone .rep-mode { width: 100%; background: var(--card); border-radius: 999px; padding: 4px; }
  .rep-head.phone .rep-mode button { flex: 1; justify-content: center; padding: 10px 6px; font-size: 16px; border-radius: 999px; }
  .rep-head.phone .rep-mode button.active { background: linear-gradient(110deg, #5338d6, #4a83e6); }
  .rep-head.phone .rep-period { width: 100%; background: var(--card); border-radius: 999px; padding: 3px; }
  .rep-head.phone .rep-period button { flex: 1; border-radius: 999px; padding: 8px 4px; font-size: 14px; }
  .rep-head.phone .rep-period button.active { background: linear-gradient(110deg, #3f7ee8, #5b8cf0); }
  .rep-head.phone .rep-nav { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .rep-head.phone .rep-nav .circle-button { background: var(--card); }
  .rep-head.phone .rep-nav-title { text-align: center; }
  .rep-head.phone .rep-nav-title strong { font-size: 22px; }
  .rep-head.phone .rep-nav-title span { font-size: 12px; }
  .rep-hero .pace.big .cum-line { height: 80px; }
  .rep-tiles .mtile { padding: 14px; }
  .rep-tiles .tile-value { font-size: 18px; }
  .rep-tiles .tile-sub { font-size: 12px; }
  .cmp-tile strong { font-size: 18px; }
  .cmp-tile { padding: 12px; }
  .delta-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; }
  .delta-pill { font-size: 13px; padding: 4px 9px; }
  .db-plot { height: 150px; margin-right: 48px; }
  .db-avg { right: -48px; }
  .db-labels { margin-right: 48px; font-size: 10px; }
  .day-facts { gap: 6px; }
  .fact { padding: 10px; font-size: 11px; }
  .fact strong { font-size: 14px; }
}
.cat-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.cat-bottom .chg-pill { justify-self: end; }
@media (max-width: 900px) {
  .rep-tiles, .cmp-tile-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 700px) {
  .cat-bottom { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .kv.foot { flex-wrap: nowrap; font-size: 13px; }
  .crown-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
.inv-pay-bars .pb-pair .exp { background: linear-gradient(180deg, #8f7bff, #5b3fe0); } .inv-pay-bars .pb-avg { display: none; }

/* Подключение Т-Инвестиций — аккуратная карточка по центру */
.inv-connect { max-width: 560px; width: 100%; margin: 12px auto; background: var(--card); border: 1px solid var(--card-line); border-radius: 26px; box-shadow: var(--card-shadow); padding: 28px; display: grid; gap: 18px; }
.ic-hero { display: grid; justify-items: center; text-align: center; gap: 8px; }
.ic-logo { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: linear-gradient(150deg, #2fd0a7, #1f8f78); box-shadow: 0 10px 24px rgba(31, 143, 120, .3); }
.ic-logo svg { width: 30px; height: 30px; }
.ic-hero h2 { margin: 6px 0 0; font-size: 22px; }
.ic-hero p { margin: 0; color: var(--muted); }
.ic-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ic-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 14px; line-height: 1.4; }
.ic-steps li > b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ic-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.ic-form input { height: 48px; border: 1px solid var(--card-line); background: var(--bg); border-radius: 14px; padding: 0 14px; font: inherit; color: inherit; min-width: 0; }
.ic-form input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: transparent; }
.ic-form .button { height: 48px; padding: 0 20px; border-radius: 14px; }
.ic-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 12px; color: var(--muted); }
.ic-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
@media (max-width: 700px) { .inv-connect { padding: 20px 16px; border-radius: 22px; margin: 0; } .ic-form { grid-template-columns: 1fr; } }
.ic-open { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 16px; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
  background: linear-gradient(120deg, #ffdd2d, #f5c400); color: #1d1d1f; box-shadow: 0 8px 20px rgba(245, 196, 0, .3); }
.ic-open svg { width: 20px; height: 20px; }
.ic-open-arrow { font-weight: 800; }
.ic-open:hover { filter: brightness(1.03); }
@media (max-width: 700px) { .ic-hero h2 { font-size: 20px; } .ic-hero p { font-size: 14px; } .ic-logo { width: 52px; height: 52px; } .ic-steps li { font-size: 13px; } }
