/* Дизайн-система Mini App — фирменный стиль по логотипу (кольцо: золото, изумруд, аметист на ночном синем).
   Две темы: тёмная и светлая, выбирается по теме Telegram (класс на <html>, см. app.js applyTheme).
   Роли цветов: золото — вклады и акценты, изумруд — бумаги и доход, аметист — трейдинг и предупреждения. */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/manrope-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/manrope-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/manrope-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/unbounded-cyrillic-ext.woff2) format('woff2'); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/unbounded-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/unbounded-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root, :root[data-theme="dark"] {
  --bg: #0B0A1A;
  --card: #16152B;
  --card-line: rgba(255,255,255,.07);
  --card-shadow: none;
  --text: #F3F0E8;
  --hero: #F6EFD9;
  --hint: #A9A5BD;
  --mute: #8C88A3;
  --header: #C9A866;
  --link: #E3CB92;
  --accent: #C9A866;
  --accent-grad: linear-gradient(135deg, #F1E2B8, #C9A866);
  --accent-text: #1A1508;
  --sep: rgba(255,255,255,.09);
  --danger: #F08A93;
  --pos: #4FD6A6;
  --neg: #F08A93;
  --warn: #E3CB92;
  --field: rgba(255,255,255,.06);
  --gold: #D9BC7E;   --gold-bar: linear-gradient(180deg, #F1E2B8, #B8975A); --gold-bg: rgba(227,203,146,.12);
  --em: #2CC28F;     --em-bar: linear-gradient(180deg, #4FD6A6, #127A5C);   --em-bg: rgba(44,194,143,.13);
  --pu: #A97FE0;     --pu-text: #C8A8F0;  --pu-bg: rgba(180,139,230,.14);   --pu-line: rgba(180,139,230,.30);
  --sky: #7FA7E0;
  --neg-bg: rgba(240,138,147,.14);
  --nav-bg: rgba(11,10,26,.92);
  --radius: 18px;
  --nav-h: 58px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F4F3F8;
  --card: #FFFFFF;
  --card-line: rgba(23,20,43,.06);
  --card-shadow: 0 1px 2px rgba(23,20,43,.06);
  --text: #17142B;
  --hero: #17142B;
  --hint: #5F5A75;
  --mute: #6B6680;
  --header: #85672E;
  --link: #85672E;
  --accent: #B8975A;
  --accent-grad: linear-gradient(135deg, #F1E2B8, #C9A866);
  --accent-text: #1A1508;
  --sep: rgba(23,20,43,.10);
  --danger: #C2344A;
  --pos: #0E7A57;
  --neg: #C2344A;
  --warn: #85672E;
  --field: rgba(23,20,43,.05);
  --gold: #B8975A;   --gold-bar: linear-gradient(180deg, #E8D3A0, #B8975A); --gold-bg: rgba(184,151,90,.15);
  --em: #23B486;     --em-bar: linear-gradient(180deg, #23B486, #0F7A5C);   --em-bg: rgba(35,180,134,.12);
  --pu: #8E62C9;     --pu-text: #6D45A8;  --pu-bg: rgba(164,123,219,.13);   --pu-line: rgba(109,69,168,.25);
  --sky: #5B84C4;
  --neg-bg: rgba(194,52,74,.10);
  --nav-bg: rgba(255,255,255,.94);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 500 16px/1.35 Manrope, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.num, .money { font-variant-numeric: tabular-nums; }

main { max-width: 640px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }

/* --- заголовок экрана --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 14px 4px 10px; }
.page-head h1 { font-family: Unbounded, Manrope, sans-serif; font-size: 24px; line-height: 1.15; font-weight: 600; margin: 0; letter-spacing: 0;
  display: flex; align-items: center; gap: 10px; }
.brand-ring { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  background: conic-gradient(from 210deg, #F1E2B8, #C9A866, #8E62C9, #B48BE6, #127A5C, #2CC28F, #F1E2B8);
  -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px); mask: radial-gradient(circle, transparent 7px, #000 8px); }
.head-action { border: 0; background: none; color: var(--link); font-size: 16px; font-weight: 500; padding: 6px 0; cursor: pointer; }

/* --- «герой»: главная цифра экрана --- */
.hero { padding: 4px 4px 16px; }
.hero .label { color: var(--hint); font-size: 14px; }
.hero .value { font-size: 36px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--hero); white-space: nowrap; }
.hero .meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* --- секции и сгруппированные списки --- */
.section { margin-bottom: 22px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; padding: 0 16px 8px;
  color: var(--header); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.section-title button { border: 0; background: none; color: var(--link); font-size: 14px; text-transform: none; letter-spacing: 0; padding: 0; cursor: pointer; }
.section-note { color: var(--hint); font-size: 13px; padding: 7px 16px 0; line-height: 1.4; }
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--card-line), var(--card-shadow); }
.group + .group { margin-top: 10px; }
.pad { padding: 14px 16px; }

.row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 52px; position: relative; width: 100%;
  border: 0; background: none; text-align: left; }
button.row, .row.tap { cursor: pointer; }
button.row:active, .row.tap:active { background: var(--field); }
.row + .row::before, .row + details::before, details + .row::before, details + details::before {
  content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; background: var(--sep); transform: scaleY(.5); }
.row.with-av + .row::before, .row.with-av + details::before, details.with-av + details::before { left: 64px; }
.row .body { flex: 1; min-width: 0; }
.row .title { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { color: var(--hint); font-size: 13px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.row .end .v { font-size: 16px; font-weight: 700; white-space: nowrap; }
.row .end .d { font-size: 13px; margin-top: 1px; }
.row .chev { color: var(--hint); opacity: .5; font-size: 20px; margin-left: -4px; }
.row .mini-bar { margin-top: 7px; }

.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 15px; color: #fff; background: #8e8e93; letter-spacing: -.02em; }
.av.sq { border-radius: 11px; }
.av.sm { width: 30px; height: 30px; font-size: 13px; }

.pos { color: var(--pos); } .neg { color: var(--neg); } .hint { color: var(--hint); } .warn { color: var(--warn); }

/* --- плитки со статистикой --- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: inset 0 0 0 1px var(--card-line), var(--card-shadow); }
.tile .k { color: var(--hint); font-size: 13px; }
.tile .v { font-size: 20px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .s { font-size: 12px; color: var(--hint); margin-top: 2px; }
.kv-list .row { min-height: 44px; }
.kv-list .row .body { color: var(--text); font-size: 15px; }
.kv-list .row .end .v { font-size: 15px; font-weight: 500; }

/* --- плашки, сегменты --- */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--field); color: var(--hint); white-space: nowrap; }
.pill.pos { background: var(--em-bg); color: var(--pos); }
.pill.neg { background: var(--neg-bg); color: var(--neg); }
.pill.warn { background: var(--gold-bg); color: var(--warn); }
.pill.accent { background: var(--pu-bg); color: var(--pu-text); }

.seg { display: flex; background: var(--field); border-radius: 10px; padding: 2px; gap: 2px; overflow-x: auto; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 10px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text); white-space: nowrap; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.15); font-weight: 600; }
.seg-wrap { margin: 0 0 10px; }

/* --- прогресс --- */
.bar { height: 6px; background: var(--field); border-radius: 3px; overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.bar.thick { height: 10px; border-radius: 5px; }
.bar .mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .7; }
.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.stack > i { display: block; height: 100%; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* --- цели --- */
.goal { padding: 16px; }
.goal + .goal { border-top: .5px solid var(--sep); }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.goal-name { font-size: 17px; font-weight: 600; }
.goal-date { color: var(--hint); font-size: 14px; white-space: nowrap; }
.goal-progress { display: flex; justify-content: space-between; font-size: 14px; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.goal-progress b { font-weight: 600; }
.goal .tiles { margin-top: 12px; }
.goal .tile { background: var(--field); padding: 10px 12px; }
.goal .tile .v { font-size: 18px; }
.goal-status { margin-top: 12px; font-size: 14px; line-height: 1.35; }
.goal-status .pill { margin-bottom: 6px; }
.gs-line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.gs-line span { color: var(--hint); }
.gs-line b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- таблица по месяцам --- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mtable th { white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--hint); text-align: right; padding: 10px 8px 6px; }
.mtable th:first-child, .mtable td:first-child { text-align: left; padding-left: 16px; }
.mtable th:last-child, .mtable td:last-child { padding-right: 16px; }
.mtable td { text-align: right; padding: 9px 6px; font-size: 14px; white-space: nowrap; border-top: .5px solid var(--sep); vertical-align: top; }
.mtable td .r { font-size: 12px; margin-top: 1px; }
.mtable tr.total td { font-weight: 600; }

/* --- раскрывающиеся позиции --- */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .chev { transform: rotate(90deg); }
details .inner { padding: 0 16px 14px; }
.lots th { font-size: 12px; color: var(--hint); font-weight: 500; text-align: right; padding: 6px 4px; }
.lots td { font-size: 13px; text-align: right; padding: 6px 4px; border-top: .5px solid var(--sep); }
.lots th:first-child, .lots td:first-child { text-align: left; }

/* --- кнопки --- */
.btn { display: block; width: 100%; border: 0; border-radius: 999px; padding: 14px; font-size: 16px; font-weight: 700; cursor: pointer;
  background: var(--accent-grad); color: var(--accent-text); }
.btn.secondary { background: transparent; color: var(--link); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 45%, transparent); }
.btn.danger { background: var(--card); color: var(--danger); }
.btn.plain { background: var(--field); color: var(--text); }
.btn:disabled { opacity: .5; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mtable .th-sub { font-size: 10px; font-weight: 400; color: var(--hint); text-transform: none; letter-spacing: 0; }
.mature-banner { background: var(--pu-bg); border: 1px solid var(--pu-line); border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.mature-banner .mb-text { font-weight: 600; margin-bottom: 10px; line-height: 1.35; }
.mature-banner .mb-hint { color: var(--hint); font-size: 13px; line-height: 1.35; margin-top: 8px; }
.stack-gap > * + * { margin-top: 10px; }

/* --- нижняя навигация --- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  background: var(--nav-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.nav button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--hint); font-size: 10.5px; font-weight: 500; padding: 2px 0; cursor: pointer; position: relative; }
.nav button svg { width: 26px; height: 26px; }
.nav button.on { color: var(--link); font-weight: 700; }
.nav .badge { position: absolute; top: -2px; left: calc(50% + 6px); background: var(--neg); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* --- шторки (формы, детали) --- */
dialog.sheet { border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh;
  background: var(--bg); color: var(--text); border-radius: 16px 16px 0 0; overflow-y: auto;
  animation: up .22s ease-out; }
@media (min-width: 700px) { dialog.sheet { max-width: 560px; margin: auto; border-radius: 16px; } }
dialog.sheet::backdrop { background: rgba(0,0,0,.45); }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-inner { padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--hint); opacity: .35; margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { font-size: 20px; margin: 0; font-weight: 800; }
/* Закрыть — «светофор» macOS: насыщенный красный с лёгким объёмом, тёмный ободок, тёмно-красный крестик; 30 px */
.sheet-head .x { position: relative; flex-shrink: 0; width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 1px solid #c8352e; background: radial-gradient(circle at 50% 30%, #ff7a72 0%, #ff5f57 45%, #e5453d 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35); cursor: pointer; outline: none; }
.sheet-head .x::after { content: ""; position: absolute; inset: 0; margin: auto; width: 13px; height: 13px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 2.4l7.2 7.2M9.6 2.4l-7.2 7.2' stroke='%23600a04' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.sheet-head .x:active { filter: brightness(.85); }

/* поля форм — сгруппированные строки */
.fields { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; box-shadow: inset 0 0 0 1px var(--card-line); }
.field { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-height: 48px; position: relative; }
.field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--sep); transform: scaleY(.5); }
.field > span { color: var(--text); font-size: 16px; flex-shrink: 0; min-width: 96px; }
.field input, .field select { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: right;
  padding: 12px 0; outline: none; -webkit-appearance: none; appearance: none; }
.field select { direction: rtl; text-align-last: right; cursor: pointer; }
.field select option { direction: ltr; }
.field input::placeholder { color: var(--hint); opacity: .7; }
.field.stack { flex-direction: column; align-items: stretch; padding: 10px 16px; gap: 6px; }
.field.stack input { text-align: left; padding: 4px 0; }
.form-hint { color: var(--hint); font-size: 13px; padding: 0 16px 12px; line-height: 1.4; }
.form-error { color: var(--danger); font-size: 14px; padding: 0 16px 10px; min-height: 0; }
.form-error:empty { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 12px; }
.chips button { border: 0; background: var(--gold-bg); color: var(--link); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 500; cursor: pointer; }

.empty { text-align: center; color: var(--hint); padding: 28px 16px; font-size: 15px; }
.skeleton { color: var(--hint); padding: 18px 16px; font-size: 14px; }
.error-card { background: var(--card); box-shadow: inset 0 0 0 1px var(--card-line); border-radius: var(--radius); padding: 18px 16px; margin-top: 20px; }
svg.chart { display: block; width: 100%; height: auto; }
[hidden] { display: none !important; }

/* --- v0.9: подразделы «Ещё», чек-лист, счётчик --- */
.back-link { border: 0; background: none; color: var(--link); font-size: 16px; padding: 10px 4px 0; cursor: pointer; }
.badge-inline { background: var(--neg); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-right: 6px; }
.checklist .row.check { gap: 12px; min-height: 46px; cursor: pointer; }
.checklist .row.check input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.checklist .row.check span { font-size: 15px; line-height: 1.3; }
.hero .value.pos { color: var(--pos); } .hero .value.neg { color: var(--neg); }
button.row[disabled] { cursor: default; opacity: 1; }
[hidden] { display: none !important; }

/* --- v0.10: подсказки «i» --- */
.tip { position: relative; display: inline-grid; place-items: center; width: 17px; height: 17px; margin: 0 0 0 5px; padding: 0;
  border: 1px solid currentColor; border-radius: 50%; background: none; color: var(--hint); font: italic 700 11px/1 Georgia, serif;
  vertical-align: 1px; cursor: pointer; opacity: .8; text-transform: none; letter-spacing: 0; }
.tip::after { content: ""; position: absolute; inset: -10px; }        /* палец попадает легко */
.section-title .tip { color: var(--header); border: 1px solid currentColor; padding: 0; font-size: 11px; }
.tip:hover { opacity: 1; color: var(--link); }
.tip-text { font-size: 16px; line-height: 1.5; margin: 0 2px 8px; }

/* --- прогноз --- */
.fc-years .group + .group { margin-top: 8px; }
.fc-table { margin: 0 0 6px; }
.fc-table td, .fc-table th { font-size: 13px; }

.row .sub.pos { color: var(--pos); }

/* --- «?» на экранах и инструкция --- */
.page-head .head-right { display: flex; align-items: center; gap: 12px; }
.help-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--link) 40%, transparent); background: transparent; color: var(--link);
  font-size: 16px; font-weight: 700; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.help-btn:active { opacity: .7; }
.help-list { margin: 0 0 8px; padding-left: 22px; font-size: 16px; line-height: 1.5; }
.help-list li { margin-bottom: 10px; padding-left: 2px; }
.help-list li::marker { color: var(--link); font-weight: 700; }
.sheet-head { gap: 12px; } .sheet-head h3 { flex: 1; min-width: 0; }

/* --- лестница вкладов --- */
.ladder { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; }
.lad-col { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.lad-v { font-size: 10px; color: var(--hint); height: 12px; white-space: nowrap; }
.lad-bar { width: 100%; height: 70px; background: var(--field); border-radius: 4px; display: flex; align-items: flex-end; overflow: hidden; }
.lad-bar > i { display: block; width: 100%; background: var(--gold-bar); border-radius: 4px 4px 0 0; }
.lad-m { font-size: 10px; color: var(--hint); }

/* --- «Финансовый год» --- */
.year-card { border-radius: 24px; padding: 20px 18px 16px; color: #F3F0E8; margin-top: 4px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(164,123,219,.38), transparent 60%), radial-gradient(90% 80% at 0% 100%, rgba(35,180,134,.30), transparent 60%), #0F0D22;
  box-shadow: 0 10px 30px rgba(15,13,34,.25); }
.year-card .yc-big { color: #F1E2B8; }
.yc-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 17px; }
.yc-badge { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.22); padding: 3px 9px; border-radius: 999px; }
.yc-label { margin-top: 18px; font-size: 13px; opacity: .85; }
.yc-big { font-size: 42px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.yc-sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.yc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.yc-stat { background: rgba(255,255,255,.16); border-radius: 14px; padding: 10px 12px; }
.yc-k { font-size: 12px; opacity: .85; }
.yc-v { font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.yc-s { font-size: 11px; opacity: .8; margin-top: 2px; }
.yc-goal { margin-top: 14px; font-size: 14px; }
.yc-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.25); margin-top: 6px; overflow: hidden; }
.yc-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #C9A866, #F1E2B8); border-radius: 4px; }
.yc-foot { margin-top: 14px; font-size: 11px; opacity: .7; text-align: right; }
.ofz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.ofz-cell { background: var(--field); border-radius: 10px; padding: 6px 8px; text-align: center; font-size: 13px; }
.ofz-cell b { font-size: 15px; }

/* --- доход по месяцам --- */
.link-btn { border: 0; background: none; color: var(--link); font-size: 14px; padding: 0; cursor: pointer; }
.mon-chips { display: flex; gap: 14px; margin-top: 8px; font-size: 14px; flex-wrap: wrap; }
.mon-chips span { display: inline-flex; align-items: center; gap: 6px; color: var(--hint); }
.mon-chips i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.mon-chips b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.mon-chips b.pos { color: var(--pos); } .mon-chips b.neg { color: var(--neg); }
.mon-labels { position: relative; height: 16px; margin-top: 4px; font-size: 11px; color: var(--hint); }
.mon-labels span { position: absolute; transform: translateX(-50%); }
.mon-labels span.on { color: var(--text); font-weight: 650; }
button.lad-col { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.lad-col.on .lad-m { color: var(--text); font-weight: 650; }
.lad-col:not(.on) .lad-bar > i { opacity: .55; }
.lad-sel { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 15px; }
.lad-sel span { color: var(--hint); } .lad-sel b { font-weight: 650; font-variant-numeric: tabular-nums; }
.lad-item { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--hint); margin-top: 4px; }

/* --- бумаги против индекса и вклада --- */
.cmp-row { margin-top: 12px; }
.cmp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.cmp-top b { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-bar { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cmp-track { flex: 1; height: 8px; border-radius: 4px; background: var(--field); overflow: hidden; }
.cmp-track > i { display: block; height: 100%; border-radius: 4px; }
.cmp-bar > span { min-width: 72px; text-align: right; font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; }
.cmp-verdict { margin-top: 14px; padding-top: 12px; border-top: 0.5px solid var(--sep); font-size: 15px; line-height: 1.4; }
.cmp-verdict b.pos { color: var(--pos); } .cmp-verdict b.neg { color: var(--neg); }

/* --- логотипы компаний --- */
.av { position: relative; overflow: hidden; }
.av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.flag { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; max-width: 100%; }
.flag > .pill { min-width: 0; overflow: hidden; text-overflow: ellipsis; } .flag > :not(.pill) { flex-shrink: 0; }

/* --- плашка «раздел в тестовом режиме» --- */
.beta-card { background: var(--pu-bg); border: 1px solid var(--pu-line); border-radius: 16px; padding: 12px 14px; margin: 0 0 14px; }
.beta-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.beta-list { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.45; color: var(--hint); }
.beta-list li + li { margin-top: 3px; }
.beta-list b { color: var(--text); font-weight: 650; }

/* --- брокеры и счета (T29, T43) --- */
.ro-plate { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 16px; margin: 0 0 18px;
  background: var(--em-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pos) 35%, transparent); font-size: 13.5px; line-height: 1.45; color: var(--hint); }
.ro-plate svg { flex-shrink: 0; color: var(--pos); margin-top: 1px; }
.ro-plate b { color: var(--text); font-size: 14.5px; }
.group.conn + .group.conn { margin-top: 12px; }
.conn .acc-name { font-weight: 500; font-size: 15px; }
.conn .row .pill { flex-shrink: 0; }
.conn-err { color: var(--neg); font-size: 13px; margin-top: 4px; white-space: normal; }
.conn-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--sep); }
.conn-actions button { border: 0; background: none; color: var(--link); font: 600 14px var(--body, inherit); cursor: pointer; padding: 4px 0; }
.conn-actions button.danger { color: var(--neg); }
.broker-av { background: var(--field) !important; color: var(--link) !important; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 40%, transparent); font-weight: 800; }
h2.q { font-family: Unbounded, Manrope, sans-serif; font-weight: 600; font-size: 21px; line-height: 1.25; margin: 4px 4px 16px; }
.broker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.broker-tile { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 16px; border: 0; cursor: pointer; min-width: 0;
  background: var(--card); box-shadow: inset 0 0 0 1px var(--card-line), var(--card-shadow); color: var(--text); text-align: left; font: inherit; }
.broker-tile.soon { opacity: .55; }
.broker-tile .av { width: 34px; height: 34px; font-size: 14px; }
.bt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bt-name { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-m { font-size: 12px; font-weight: 650; }
.group.explain p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--hint); }
.group.explain b.pos { color: var(--pos); } .group.explain b.warn { color: var(--warn); }
.conn-head { display: flex; align-items: center; gap: 12px; margin: 0 4px 16px; }
.conn-head .av { width: 44px; height: 44px; font-size: 17px; }
.conn-title { font-family: Unbounded, Manrope, sans-serif; font-weight: 600; font-size: 20px; }
.steps-title { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--header); margin-bottom: 10px; }
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; }
ol.steps li { counter-increment: st; display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 14.5px; line-height: 1.4; }
ol.steps li::before { content: counter(st); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-bg); color: var(--link); font-weight: 800; font-size: 13px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px; margin: 12px 0; border-radius: 18px; cursor: pointer;
  border: 1.5px dashed color-mix(in srgb, var(--link) 50%, transparent); background: var(--gold-bg); color: var(--text); font-weight: 650; text-align: center; }
.dropzone svg { color: var(--link); }
.dropzone small { font-size: 12.5px; color: var(--hint); font-weight: 500; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone.busy { opacity: .7; pointer-events: none; }
.report-prev .rp-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.report-prev .rp-head .hint { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-prev .kv-list, .report-prev .row { padding-left: 0; padding-right: 0; }
.report-prev + .btn { margin-top: 12px; }
.role-opt.on { background: var(--gold-bg); }
.acc-cards { display: grid; gap: 10px; }
.acc-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px; border: 0; cursor: pointer; text-align: left; font: inherit; color: var(--text);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--card-line), var(--card-shadow); }
.ac-top { display: flex; align-items: center; gap: 12px; width: 100%; }
.ac-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-name b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-name .hint { font-size: 13px; }
.ac-sum { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ac-sum b { font-size: 15.5px; } .ac-sum span { font-size: 13px; }
.ac-bar { display: block; height: 5px; border-radius: 3px; background: var(--field); overflow: hidden; }
.ac-bar i { display: block; height: 100%; background: var(--gold-bar); }
.ac-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--hint); }
.conn .row .sub { white-space: normal; line-height: 1.35; }
.field.stack input, .field.stack select { flex: none; width: 100%; }
.report-prev .rp-head { flex-direction: column; align-items: flex-start; gap: 2px; } .report-prev .rp-head .hint { max-width: 100%; }
.acc-cards > .acc-card { width: 100%; min-width: 0; } .ac-top .av { flex-shrink: 0; } .ac-foot span:last-child { text-align: right; }
.field.stack { height: auto; overflow: visible; border-radius: 0; }   /* не путать с полоской распределения .stack */

/* --- ИИС и вычеты (T35) --- */
.iis-bar { height: 10px; border-radius: 6px; background: var(--field); overflow: hidden; }
.iis-bar.thin { height: 6px; margin: 6px 0 2px; }
.iis-bar > i { display: block; height: 100%; background: var(--gold-bar); border-radius: 6px; }
.iis-room { margin: 10px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--hint); }
.iis-room b { color: var(--text); }
.iis-note { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.45; background: var(--field); color: var(--hint); }
.iis-note.warn { background: var(--pu-bg); color: var(--pu-text); }
.iis-note.ok { background: var(--em-bg); color: var(--pos); }
.iis-note .link-btn { display: block; margin-top: 6px; font-weight: 650; }
.group.iis-acc + .group.iis-acc { margin-top: 10px; }
ul.iis-warn { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--hint); }
.article p { font-size: 15px; line-height: 1.5; margin: 0 0 10px; }
.article h4 { font-family: Unbounded, Manrope, sans-serif; font-weight: 600; font-size: 15px; margin: 18px 0 8px; }
.article .group { margin-bottom: 10px; }

/* --- переносы: без «висящего» последнего слова; заголовки — сбалансированно --- */
p, li, .section-note, .hint, .tip-text, .form-hint, .ro-plate, .iis-note, .iis-room, .beta-list, .empty, .row .sub, .group.explain p,
.cmp-verdict, .conn-err { text-wrap: pretty; }
h1, h2, h3, h4, .sheet-head h3, .page-head h1 { text-wrap: balance; }

/* --- вход в браузере и подключение MAX (T41, T42) --- */
html.login .nav { display: none; }
html.login main { padding-bottom: 32px; }
.login-card { max-width: 440px; margin: 7vh auto 0; padding: 0 4px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.login-brand h1 { font-family: Unbounded, Manrope, sans-serif; font-weight: 600; font-size: 26px; margin: 0; }
.brand-ring.big { width: 40px; height: 40px; -webkit-mask: radial-gradient(circle, transparent 10px, #000 11px); mask: radial-gradient(circle, transparent 10px, #000 11px); }
.login-lead { color: var(--hint); margin: 0 0 22px; line-height: 1.45; text-wrap: pretty; }
.login-steps { list-style: none; counter-reset: st; margin: 0 0 16px; padding: 0; }
.login-steps li { counter-increment: st; position: relative; padding: 0 0 18px 40px; }
.login-steps li::before { content: counter(st); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; background: var(--gold-bg); color: var(--gold); }
.login-steps li > div:first-child { font-weight: 600; margin-bottom: 10px; line-height: 1.35; }
.login-steps .form-error { padding: 8px 0 0; }
.login-note { font-size: 13px; line-height: 1.45; text-wrap: pretty; }
.btn.ghost { background: var(--card); color: var(--link); box-shadow: inset 0 0 0 1px var(--card-line), var(--card-shadow);
  text-align: center; text-decoration: none; }
.code-row { display: flex; gap: 10px; }
.code-row .btn { width: auto; padding: 14px 22px; flex-shrink: 0; }
.code-input { flex: 1; min-width: 0; border: 0; border-radius: 14px; padding: 12px 16px; background: var(--field); color: var(--text);
  font: 700 24px/1.2 Manrope, sans-serif; letter-spacing: .12em; text-align: center; box-shadow: inset 0 0 0 1px var(--card-line); }
.code-input:focus { outline: 2px solid var(--gold); outline-offset: 0; }
.code-big { font: 800 34px/1.1 Manrope, sans-serif; letter-spacing: .1em; color: var(--hero); margin: 2px 0 6px;
  font-variant-numeric: tabular-nums; user-select: all; }
.hint-label { color: var(--hint); font-size: 13px; padding: 0 16px 8px; }
.mini-links { padding: 10px 16px 0; font-size: 14px; }
.mini-links a { color: var(--link); text-decoration: none; }
#tipBody .login-steps { margin-top: 6px; }
#tipBody .hint { font-size: 13px; color: var(--hint); margin: 0; }

/* --- компьютер (T42): меню слева, экран во всю ширину, разделы колонками, формы — панелью справа --- */
.nav-brand, .row .xc, .row.thead, .av-gap { display: none; }
@media (hover: hover) {
  .row.tap:hover, .nav button:hover { background: var(--field); }
  .btn:hover { filter: brightness(1.05); }
  .acc-card:hover { filter: brightness(1.08); }
}
@media (min-width: 900px) {
  html:not(.login) body { padding-left: 240px; }
  .nav { top: 0; right: auto; width: 240px; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 22px 14px; border-top: 0; border-right: .5px solid var(--sep); }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 12px 24px; color: var(--text);
    font-family: Unbounded, Manrope, sans-serif; font-weight: 600; font-size: 18px; }
  .nav-brand .brand-ring { width: 26px; height: 26px; }
  .nav button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 11px 12px;
    border-radius: 12px; }
  .nav button svg { width: 22px; height: 22px; }
  .nav button.on { background: var(--gold-bg); }
  .nav .badge { position: static; margin-left: auto; }
  main { max-width: none; margin: 0; padding: 18px clamp(24px, 3vw, 48px) 56px; }
  #view { max-width: 1480px; margin: 0 auto; }
  #view:not(.cols) { max-width: 820px; }
  .page-head { padding-top: 16px; }
  .page-head h1 { font-size: 30px; }
  .page-head .brand-ring { display: none; }          /* знак уже в меню слева */
  .hero .value { font-size: 44px; }
  /* формы и карточки — панелью справа: список остаётся виден */
  dialog.sheet { margin: 0 0 0 auto; width: 500px; max-width: 500px; height: 100dvh; max-height: 100dvh;
    border-radius: 22px 0 0 22px; animation: drawer .22s ease-out; }
  dialog.sheet .grabber { display: none; }
  dialog.sheet .sheet-inner { padding: 22px 26px 28px; }
  #tipDialog, dialog.sheet.ask { margin: auto; height: auto; max-height: 85vh; border-radius: 18px; animation: up .18s ease-out; }
  #tipDialog { width: 560px; max-width: 560px; }
}
@keyframes drawer { from { transform: translateX(48px); opacity: .5; } to { transform: none; opacity: 1; } }
/* колонки: app.js раскладывает разделы по колонкам с выравниванием по высоте */
.colgrid { display: grid; grid-template-columns: repeat(var(--ncols, 2), minmax(0, 1fr)); gap: 0 28px; align-items: start; }
.colgrid > .col > .section:last-child { margin-bottom: 22px; }
#view.measure > .section:not(.wide) { width: calc((100% - (var(--ncols, 2) - 1) * 28px) / var(--ncols, 2)); }
@media (min-width: 1200px) {
  .row .xc { display: flex; flex-shrink: 0; gap: 0; font-variant-numeric: tabular-nums; }
  .row .xc > span { width: 150px; text-align: right; font-size: 15px; font-weight: 600; white-space: nowrap; }
  .row .xc small { display: block; font-size: 12.5px; font-weight: 500; color: var(--hint); margin-top: 1px; }
  .row .xc .pos small, .row .xc .neg small { color: inherit; opacity: .8; }
  .pos-table .row .end { width: 150px; }
  .row.thead { display: flex; min-height: 0; padding: 12px 16px 8px; color: var(--hint); font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em; }
  .row.thead .av-gap { display: block; width: 36px; flex-shrink: 0; }
  .row.thead .xc > span { font-size: 12px; font-weight: 600; }
  .row.thead + details::before { display: none; }
}
@media (min-width: 1200px) {
  #view > .seg, #view > .seg-wrap { max-width: 460px; }          /* переключатель — не во всю ширину экрана */
  #view .acc-cards { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
}
@media (min-width: 1800px) {
  #view { max-width: 1720px; }
}

/* --- своё окно «Подтвердить / Отмена» (MAX и браузер) --- */
.ask-text { font-size: 17px; line-height: 1.45; margin: 18px 4px 20px; text-wrap: pretty; }
.btn-row.one { grid-template-columns: 1fr; }
@media (min-width: 700px) { dialog.sheet.ask { max-width: 420px; } }

/* --- подбор вклада через Финуслуги (T37) --- */
.partner .pad { display: flex; flex-direction: column; gap: 8px; }
.pt-head { display: flex; align-items: center; gap: 12px; }
.pt-logo { background: #e30613; color: #fff; font-weight: 800; }
.pt-name { font-weight: 700; }
.pt-text { margin: 0; line-height: 1.45; text-wrap: pretty; }
.partner .btn { margin-top: 6px; }
.ad-label { color: var(--mute); font-size: 11.5px; line-height: 1.35; text-align: center; }

/* --- календарь выплат (T36) --- */
.pay-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; }
.pay-stack { flex-direction: column-reverse; justify-content: flex-start; height: 96px; }
.pay-stack > i { border-radius: 0; }
.pay-stack > i:last-child { border-radius: 4px 4px 0 0; }
.pay-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--hint); }
.pay-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
@media (min-width: 1200px) { .pay-stack { height: 150px; } }
.pay-back { font-size: 11px; color: var(--gold); height: 13px; line-height: 13px; }

/* --- пример с вымышленными данными (T39) --- */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--pu-bg); border: 1px solid var(--pu-line); border-radius: 14px; padding: 10px 14px; margin: 6px 0 4px;
  font-size: 14px; line-height: 1.35; }
.demo-bar button { border: 0; background: none; color: var(--link); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
