/* ЛК shell + component library. Built strictly on tokens.css (axplusb.eu). */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* как на главной (base.css): clip, не hidden — hidden делает body скролл-
   контейнером и ломает sticky-сайдбар */
html, body { overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; margin: 0; }
button { font-family: var(--body); cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 100px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; transition: background .15s, box-shadow .15s, border-color .15s;
}
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { box-shadow: var(--shadow-soft); }
.btn-soft { background: var(--accent-soft); color: var(--ink); }
.btn-soft:hover { box-shadow: var(--shadow-soft); }
.btn-line { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-line:hover { border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--neg); border-color: var(--neg); }
.btn-danger:hover { background: rgba(194,114,74,.10); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- pill / chip ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 100px; font-size: 12px; font-weight: 600;
  background: var(--accent-soft); color: var(--ink);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pill.pos { background: rgba(63,125,90,.14); color: var(--pos); }
.pill.pos .dot { background: var(--pos); }
.pill.neg { background: rgba(194,114,74,.14); color: var(--neg); }
.pill.neg .dot { background: var(--neg); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 100px; font-size: 12px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface);
}

/* ---------- card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.card-title { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* ---------- stat card ---------- */
.statcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.statcard .label { color: var(--muted); font-size: 13px; }
.statcard .value { font-family: var(--head); font-size: 30px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- trend value ---------- */
.trend { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.trend.pos { color: var(--pos); }
.trend.neg { color: var(--neg); }
.trend.flat { color: var(--muted); }

/* ---------- grid ---------- */
.grid { display: grid; gap: var(--gap); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- next action banner ---------- */
.next-action {
  display: flex; align-items: center; gap: 18px; justify-content: space-between;
  background: var(--accent-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; box-shadow: inset 3px 0 0 var(--accent);
}
.next-action .na-body h3 { font-size: 16px; }
.next-action .na-body p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.next-action.danger { background: rgba(194,114,74,.10); box-shadow: inset 3px 0 0 var(--neg); }
.next-action.danger .na-body h3 { color: var(--neg); }

/* ---------- state blocks (loading/empty/error/disconnected) ---------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 48px 24px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface);
}
.state .state-icon { font-size: 30px; line-height: 1; }
.state .state-title { font-family: var(--head); font-weight: 600; color: var(--ink); }
.state.error { border-color: var(--neg); }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { font-family: var(--mono); text-align: right; }

/* ================= SHELL ================= */
/* flex, не grid: на ≤820px сайдбар становится fixed-drawer и выпадает из
   потока — main должен занять всю ширину, как .ax-app на главной. */
.shell { display: flex; align-items: flex-start; min-height: 100vh; }

/* left navbar — компонент меню главной страницы, стили в css/sidebar.css */
.nav-foot { color: var(--muted); font-size: 12px; }

/* main column */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* top bar: ticker/status (left) + right corner (avatar/bell/lang) */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 22px;
}
.market-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.market-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); }
/* FR-712: рынок закрыт — индикатор красный, а не приглушённый */
.market-status.closed .dot { background: var(--neg); }
.ticker { display: flex; gap: 16px; overflow: hidden; flex: 1; min-width: 0; }
.ticker .tk { display: inline-flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.ticker .tk b { font-family: var(--body); }
.ticker .tk .up { color: var(--pos); }
.ticker .tk .down { color: var(--neg); }

.rightcorner { display: flex; align-items: center; gap: 10px; margin-left: auto; }
/* FR-712 · «FR 19:21» — текущее время во Франции слева от поиска */
.fr-clock {
  display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 100px;
  background: var(--surface);
}
.fr-clock-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.fr-clock-val { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; font-size: 16px; position: relative;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn .badge {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 100px; background: var(--neg); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 100px; overflow: hidden; background: var(--surface); }
.lang-switch button { background: transparent; border: none; padding: 7px 11px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lang-switch button.active { background: var(--accent-soft); color: var(--ink); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft);
  display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 14px; border: 1px solid var(--line);
}

/* меню пользователя (FR-540): имя/аватар открывает выпадающий список с выходом */
.usermenu { position: relative; }
.um-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px;
  border: 1px solid var(--line); border-radius: 100px; background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer; max-width: 220px;
}
.um-btn:hover { border-color: var(--accent); }
.um-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-caret { color: var(--muted); font-size: 11px; }
.um-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 18px 40px rgba(0,0,0,.18); padding: 6px; display: none;
}
.usermenu.on .um-menu { display: block; }
.um-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.um-head b { display: block; font-size: 13.5px; }
.um-head span { display: block; font-size: 12px; color: var(--muted); word-break: break-all; }
.um-item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer;
}
.um-item:hover { background: var(--accent-soft); }
.kbd {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px;
}
.kbd kbd { font-family: var(--mono); font-size: 11px; background: var(--bg); border-radius: 5px; padding: 1px 5px; }

/* page content */
.content { padding: 26px 26px 60px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.page-head h1 { font-size: 26px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.section-gap > * + * { margin-top: var(--gap); }

/* ---------- ⌘K palette ---------- */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(30,20,10,.28);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh;
}
.cmdk {
  width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop); overflow: hidden;
}
.cmdk input {
  width: 100%; border: none; padding: 18px 20px; font-size: 16px; font-family: var(--body);
  background: transparent; color: var(--ink); border-bottom: 1px solid var(--line);
}
.cmdk input:focus { outline: none; }
.cmdk-hint { padding: 16px 20px; color: var(--muted); font-size: 14px; }
.cmdk-list { max-height: 300px; overflow: auto; }
.cmdk-list .row { padding: 12px 20px; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.cmdk-list .row:hover, .cmdk-list .row.sel { background: var(--bg); }

/* ================= LOGIN ================= */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card .brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--head); font-weight: 700; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); font-size: 15px; font-family: var(--body); color: var(--ink);
}
.field input:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.field-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.auth-error { color: var(--neg); font-size: 13px; margin: 4px 0 12px; min-height: 18px; }
.auth-hint { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* FR-791 · регистрация, подтверждение email, восстановление пароля */
.auth-card-wide { width: min(520px, 100%); }
.field select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); font-size: 15px; font-family: var(--body); color: var(--ink);
}
.field select:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.field input[type="date"] { min-height: 46px; -webkit-appearance: none; appearance: none; }
.field input.invalid, .field select.invalid { border-color: var(--neg); }
.field-error { margin-top: 5px; font-size: 12px; color: var(--neg); }
.field-error:empty { display: none; }
/* FR-906 · шкала сложности и совпадение паролей */
.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pw-meter[hidden] { display: none; }
.pw-meter__bars { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter__bars span { height: 4px; border-radius: 2px; background: var(--line); transition: background .15s; }
.pw-meter__label { font-size: 12px; font-weight: 600; min-width: 92px; text-align: right; }
.pw-meter[data-level="0"] .on, .pw-meter[data-level="1"] .on { background: var(--neg); }
.pw-meter[data-level="2"] .on { background: var(--accent); }
.pw-meter[data-level="3"] .on, .pw-meter[data-level="4"] .on { background: var(--pos); }
.pw-meter[data-level="0"] .pw-meter__label, .pw-meter[data-level="1"] .pw-meter__label { color: var(--neg); }
.pw-meter[data-level="2"] .pw-meter__label { color: var(--accent); }
.pw-meter[data-level="3"] .pw-meter__label, .pw-meter[data-level="4"] .pw-meter__label { color: var(--pos); }
.pw-match { margin-top: 5px; font-size: 12px; }
.pw-match:empty { display: none; }
.pw-match.ok { color: var(--pos); }
.pw-match.bad { color: var(--neg); }
.field:has(.field-error:not(:empty)) .pw-match.bad { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-row > .field { min-width: 0; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.field-label-row label { margin-bottom: 0; }
.auth-link {
  background: none; border: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--accent); cursor: pointer; text-align: left;
}
.auth-link:hover { text-decoration: underline; }
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 20px 0 12px; color: var(--muted); font-size: 13px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; margin: 0 0 12px; }
.auth-notice .auth-resend { margin-top: 10px; }
.auth-ok { font-size: 13px; color: var(--pos); margin-top: 8px; }
.auth-ok:empty { display: none; }
.auth-resend { margin-top: 6px; }
.auth-legal { font-size: 12px; color: var(--muted); margin: 2px 0 10px; line-height: 1.5; }
.auth-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 22px; margin-bottom: 14px; }
.auth-icon.ok { color: var(--pos); }
.auth-steps { margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.auth-hint-left { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.auth-modal-text { font-size: 15px; line-height: 1.6; }
.auth-card .sub { overflow-wrap: anywhere; }
@media (max-width: 520px) {
  /* FR-936: и на телефоне по центру экрана; форма выше экрана (регистрация)
     просто растягивает контейнер — прокрутка от верха, ничего не обрезается */
  .auth-wrap { padding: 14px; }
  .auth-card { padding: 22px 18px; }
  .field-row { grid-template-columns: 1fr; }
  .field input, .field select { font-size: 16px; }   /* iOS не зумит поле при фокусе */
}

/* ================= ЛК-1 · ГЛАВНАЯ (обзор портфеля) ================= */

/* freshness label + disconnected banner */
.fresh-row { display: flex; align-items: center; }
.fresh-stamp { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.fresh-stamp .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); }
.disc-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgba(192,138,62,.10); border: 1px solid var(--accent);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; color: var(--ink);
}

/* KPI-сетка + actions top row */
.ov-top { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--gap); align-items: stretch; }
@media (max-width: 900px) { .ov-top { grid-template-columns: 1fr; } }

/* FR-510: KPI-плитки заменены карточками-картинами — см. css/overview-cards.css */

/* единый hover для всех плиток вкладки «Обзор» */
.ov-page .card, .ov-page .act-card {
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease, background .2s ease;
}
.ov-page .card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 30%, var(--surface));
  box-shadow: var(--shadow-soft); transform: translateY(-2px);
}
.ov-page .act-card:hover { transform: translateY(-2px); }
/* контейнер «Что необходимо сделать сейчас» — пассивная обёртка:
   сам не подсвечивается, реагируют только внутренние .act-card */
.ov-page .ov-top > .card:hover {
  border-color: var(--line); background: var(--surface);
  box-shadow: none; transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .ov-page .card:hover, .ov-page .act-card:hover { transform: none; }
}

.hero-card { display: flex; flex-direction: column; justify-content: center; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.hero-label { color: var(--muted); font-size: 13px; }
.hero-value { font-family: var(--head); font-weight: 700; font-size: 42px; letter-spacing: -.02em; margin: 4px 0 8px; }
.hero-change { font-size: 15px; }
.hchg { font-family: var(--mono); font-weight: 600; }
.hchg.pos { color: var(--pos); }
.hchg.neg { color: var(--neg); }
.hchg.flat { color: var(--muted); }
.hchg-pct { font-weight: 500; }
.hchg-since { font-size: 13px; }

.chipnav { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chipnav .chip { cursor: pointer; background: var(--surface); transition: background .12s, color .12s, border-color .12s; }
.chipnav .chip:hover { border-color: var(--accent); }
.chipnav .chip.on { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); font-weight: 600; }

/* "Что необходимо сделать сейчас" */
.act-list { display: flex; flex-direction: column; gap: 10px; }
/* FR-565: блок стоит в одном ряду с KPI-сеткой и тянется по её высоте
   (2 x 212px + 20px = 444px). Список действий заполняет блок целиком, а
   содержимое карточки центрируется по вертикали — под последней карточкой
   не остаётся пустого места, каким бы коротким ни был текст. Внешние
   габариты блока и KPI-плиток при этом не меняются. */
.ov-page .ov-top > .card { display: flex; flex-direction: column; }
.ov-page .ov-top > .card > .act-list,
.ov-page .ov-top > .card > .act-ok { flex: 1 1 auto; }
.ov-page .act-list > .act-card {
  flex: 1 1 0; display: flex; flex-direction: column; justify-content: center;
}
/* единственная карточка не растягивается на весь блок — остаётся своего
   размера и центрируется по вертикали */
.ov-page .act-list > .act-card:only-child { flex: 0 1 auto; margin-block: auto; }
.act-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px;
  box-shadow: inset 3px 0 0 var(--accent); cursor: pointer; transition: box-shadow .12s, border-color .12s;
}
.act-card:hover { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent), var(--shadow-soft); }
.act-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.act-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.act-card h4 { font-size: 15px; }
/* FR-713: суть рекомендации видна сразу, без наведения. Две строки максимум —
   высота карточки от этого не растёт (список делит фиксированную высоту блока). */
.act-card p {
  margin: 4px 0 8px; color: var(--muted); font-size: 13px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* FR-713: правый верхний угол карточки — статус и таймер срока действия */
.act-top-r { display: flex; align-items: center; gap: 6px; flex: none; }
.act-timer {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 100px; padding: 1px 7px;
  white-space: nowrap; line-height: 1.5;
}
.act-timer.urgent { color: var(--neg); border-color: var(--neg); }
.act-timer.over { color: var(--neg); border-color: var(--neg); font-weight: 600; }
.act-cta { color: var(--accent); font-weight: 600; font-size: 13px; }
.act-ok { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.act-ok-ic {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: rgba(63,125,90,.14); color: var(--pos); display: grid; place-items: center; font-size: 18px;
}
.act-ok-title { font-family: var(--head); font-weight: 600; }

/* value chart */
.chart { position: relative; width: 100%; }
.chart-svg { width: 100%; height: 240px; display: block; }
.chart-tip {
  position: absolute; top: 6px; pointer-events: none; transition: opacity .1s;
  background: var(--ink); color: var(--surface); border-radius: 8px; padding: 6px 10px;
  font-size: 12px; display: flex; flex-direction: column; gap: 1px; white-space: nowrap; box-shadow: var(--shadow-soft);
}
.chart-tip b { font-family: var(--head); font-size: 13px; }
.chart-tip span { color: var(--line); font-family: var(--mono); }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.chart-legend b.pos { color: var(--pos); }
.leg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: middle; background: var(--accent); }
.leg-dot.neg { background: var(--neg); }
.leg-dash {
  display: inline-block; width: 16px; height: 0; margin-right: 7px; vertical-align: middle;
  border-top: 2px dotted var(--pos);
}

/* allocation donut */
.alloc-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.donut-svg { display: block; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 11px; }
.alloc-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 160px; }
.alloc-item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.alloc-item b { margin-left: auto; font-family: var(--mono); }
.alloc-item:hover { color: var(--accent); }

/* risk card */
.risk-kv { display: grid; grid-template-columns: 1fr auto; gap: 12px 10px; align-items: center; font-size: 14px; }
.risk-kv dt { color: var(--muted); margin: 0; }
.risk-kv dd { margin: 0; text-align: right; }
.card-link { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }

/* feeds: changes / recommendations / notifications */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feed-row:last-child { border-bottom: none; }
.feed-row.rec, .feed-row.notif { cursor: pointer; }
.feed-text { flex: 1; min-width: 0; }
.feed-why { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.dotmark { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dotmark.pos { background: var(--pos); }
.dotmark.neg { background: var(--neg); }
.dotmark.flat { background: var(--muted); }
.notif-lvl { width: 20px; text-align: center; flex: none; }
.notif-lvl.warn { color: var(--accent); }

/* mobile: single column, tighter paddings */
@media (max-width: 680px) {
  .content { padding: 18px 16px 48px; }
  .hero-value { font-size: 34px; }
  .hero-top { flex-direction: column; gap: 12px; }
  .alloc-row { justify-content: center; }
}

/* ============================================================================
   ЛК-5 · Профиль клиента + риск-профилирование (FR-444)
   All selectors are pf-* namespaced so they never collide with other sections.
   ========================================================================== */
.pf-kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: center; }
.pf-kv dt { color: var(--muted); font-size: 13px; }
.pf-kv dd { text-align: right; font-weight: 600; }

/* banners: suitability / KYC state */
.pf-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 4px; }
.pf-banner.neg { background: rgba(194,114,74,.12); border: 1px solid rgba(194,114,74,.35); }
.pf-banner.warn { background: rgba(192,134,62,.12); border: 1px solid rgba(192,134,62,.35); }
.pf-banner.info { background: var(--surface); border: 1px solid var(--line); }   /* FR-841 */
.pf-banner .pf-i { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted); font-size: 12px; font-weight: 700; font-style: italic; }
.pf-banner-ic { font-size: 18px; line-height: 1.2; }
.pf-banner p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.pf-notes { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* goals */
.pf-goals { display: flex; flex-direction: column; gap: 16px; }
.pf-goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pf-goal-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; font-size: 13px; }
.pf-bar { height: 8px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; }
.pf-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.pf-grow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 14px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pf-grow > b { grid-column: 1 / -1; }

/* forms */
.pf-field { display: flex; flex-direction: column; gap: 5px; }
.pf-flabel { color: var(--muted); font-size: 12px; }
.pf-input { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; }
.pf-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.pf-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.pf-err { color: var(--neg); font-size: 13px; margin-top: 8px; }
.pf-chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pf-checks { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 8px; }
.pf-check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* pf-switch: a compact toggle built on a checkbox */
.pf-switch { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; border-radius: 22px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex: none; }
.pf-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.pf-switch:checked { background: var(--accent); }
.pf-switch:checked::after { left: 20px; }

/* KYC */
.pf-kyc-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 4px 0 14px; font-size: 13px; }
.pf-uptiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.pf-uptile { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); text-align: center; }
.pf-uplist { display: flex; flex-direction: column; gap: 6px; }
.pf-uprow { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: 13px; }

/* modal overlay (pf-modal-* — self-contained, does not touch shared ov-*) */
.pf-modal-back { position: fixed; inset: 0; background: rgba(30,24,16,.42); display: grid; place-items: center; z-index: 60; padding: 20px; }
.pf-modal { width: 460px; max-width: 100%; max-height: 88vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.pf-modal-wide { width: 560px; }
.pf-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pf-modal-head h3 { font-family: var(--head); font-size: 18px; }
.pf-modal-close { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; line-height: 1; }
.pf-modal-body { display: flex; flex-direction: column; gap: 12px; }

/* risk wizard */
.pf-wizard { display: flex; flex-direction: column; gap: 14px; }
.pf-wiz-progress { display: flex; flex-direction: column; gap: 6px; }
.pf-wiz-bar { height: 6px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; }
.pf-wiz-bar > i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.pf-qtitle { font-family: var(--head); font-size: 17px; }
.pf-opts { display: flex; flex-direction: column; gap: 10px; }
.pf-opt { text-align: left; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; transition: border-color .12s, background .12s; }
.pf-opt:hover { border-color: var(--accent); }
.pf-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.pf-result { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 8px 0; }
.pf-result-ic { width: 48px; height: 48px; border-radius: 50%; background: rgba(63,125,90,.14); color: var(--pos); display: grid; place-items: center; font-size: 24px; }
.pf-result-badge { display: flex; gap: 10px; align-items: center; }

@media (max-width: 720px) {
  .pf-grow { grid-template-columns: 1fr; }
  .pf-uptiles { grid-template-columns: 1fr; }
}

/* ================= ЛК-6 · АКТИВЫ И ПОДКЛЮЧЕНИЯ ================= */

/* soft-amber "warn" pill for stale / partial sync status (pos=green, neg=orange) */
.pill.warn { background: rgba(192,138,62,.16); color: #9a6b1f; }
.pill.warn .dot { background: #b8860b; }

/* net-worth hero */
.nw-card { display: flex; flex-direction: column; gap: 18px; }
.nw-total { display: flex; flex-direction: column; gap: 4px; }
.nw-value { font-family: var(--head); font-weight: 700; font-size: 40px; letter-spacing: -.02em; }
.nw-break { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.nw-item {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px;
}
.nw-item span { font-size: 13px; }
.nw-item b { font-size: 18px; font-family: var(--head); }
.nw-item b.pos { color: var(--pos); }
.nw-item b.neg { color: var(--neg); }

/* toolbar + inline forms */
.conn-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.conn-forms:empty { display: none; }
.conn-forms { margin-top: 14px; }
.conn-form { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.conn-label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.conn-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-family: var(--body); font-size: 14px;
}
.conn-input:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.form-err { color: var(--neg); font-size: 13px; }

/* connections list */
.conn-list { display: flex; flex-direction: column; gap: 14px; }
.conn-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.conn-card.attn { border-color: var(--neg); box-shadow: inset 3px 0 0 var(--neg); }
.conn-row-main { display: flex; align-items: center; gap: 14px; }
.conn-ic {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 12px; background: var(--accent-soft); font-size: 18px;
}
.conn-id { flex: 1; min-width: 0; }
.conn-name { font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn-acct { font-family: var(--mono); font-size: 12px; font-weight: 400; }
.conn-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 13px; flex-wrap: wrap; }
.conn-bal { font-family: var(--head); font-weight: 700; font-size: 18px; white-space: nowrap; }

/* capabilities (available / unavailable data) */
.conn-caps { display: flex; gap: 8px; flex-wrap: wrap; }
.cap {
  font-size: 12px; padding: 3px 10px; border-radius: 100px; border: 1px solid var(--line);
}
.cap.on { color: var(--pos); border-color: rgba(63,125,90,.35); }
.cap.off { color: var(--muted); opacity: .7; text-decoration: line-through; }

/* error remediation steps */
.conn-err {
  background: rgba(194,114,74,.08); border: 1px solid rgba(194,114,74,.30);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.conn-err-title { font-weight: 600; color: var(--neg); margin-bottom: 6px; }
.conn-steps { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink); }
.conn-steps li { margin: 3px 0; }
.conn-deeplink { margin-top: 10px; }

/* management actions */
.conn-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn-freq-wrap { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.conn-freq-sel {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-family: var(--body); font-size: 13px;
}

@media (max-width: 680px) {
  .nw-break { grid-template-columns: 1fr; }
  .conn-row-main { flex-wrap: wrap; }
  .conn-bal { width: 100%; text-align: right; }

}

/* ---------- ЛК-7 · налоги и документы ---------- */
.doc-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.doc-search {
  flex: 1; min-width: 220px; padding: 10px 14px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: var(--body); font-size: 14px;
}
.doc-search:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.chip-n { margin-left: 6px; opacity: .6; font-variant-numeric: tabular-nums; }

.doc-list { display: flex; flex-direction: column; }
.doc-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: none; }
.doc-row.attn { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; }
.doc-ic {
  width: 38px; height: 38px; flex: none; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--ink); font-size: 18px;
}
.doc-main { flex: 1; min-width: 0; cursor: pointer; }
.doc-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-title { font-weight: 600; }
.doc-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 13px; }
.doc-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.doc-actions .btn { padding: 8px 14px; font-size: 13px; }

/* overlay (viewer + modal) */
.ov-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,18,14,.5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.ov-panel { width: 100%; max-width: 860px; }
.ov-close { background: transparent; border: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 6px; border-radius: 8px; }
.ov-close:hover { color: var(--ink); }

.doc-view {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-soft); display: flex; flex-direction: column; max-height: 88vh; overflow: hidden;
}
.doc-view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.doc-view-head h3 { font-size: 17px; }
.doc-view-head .muted { font-size: 13px; }
.doc-frame { width: 100%; height: 62vh; border: none; background: var(--bg); }
.doc-view-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }

.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-soft); max-width: 420px; margin: 0 auto; padding: 0 20px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 12px; }
.modal-head h3 { font-size: 17px; }
.form-err { color: var(--neg); font-size: 13px; margin-bottom: 10px; }

@media (max-width: 680px) {
  .doc-row { flex-wrap: wrap; }
  .doc-actions { width: 100%; }
  .ov-backdrop { padding: 0; }
  .doc-view { max-height: 100vh; height: 100vh; border-radius: 0; }
  .doc-frame { height: 100%; flex: 1; }
}

/* ================= ЛК-8 · УВЕДОМЛЕНИЯ (FR-447) ================= */

/* filter bar */
.notif-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.notif-filters .chip { cursor: pointer; background: var(--surface); }
.notif-filters .chip:hover { border-color: var(--accent); }
.notif-filters .chip.on { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); font-weight: 600; }
.chip-badge {
  margin-left: 6px; background: var(--accent); color: var(--accent-ink); border-radius: 100px;
  font-size: 10px; font-weight: 700; min-width: 15px; height: 15px; padding: 0 4px;
  display: inline-grid; place-items: center;
}

/* notification list */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 4px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(192,138,62,.05); }
.notif-ic { width: 22px; text-align: center; flex: none; font-size: 15px; line-height: 1.4; }
.notif-ic.lvl-warn { color: var(--accent); }
.notif-ic.lvl-critical { color: var(--neg); }
.notif-ic.lvl-info { color: var(--muted); }
.notif-main { flex: 1; min-width: 0; }
.notif-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.notif-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
  color: var(--muted); border: 1px solid var(--line); border-radius: 100px; padding: 1px 8px;
}
.notif-time { font-size: 12px; font-family: var(--mono); }
.notif-title { font-weight: 600; font-size: 14px; }
.notif-body { font-size: 13px; margin-top: 2px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 6px; }

/* preferences: type × channel matrix */
.pref-lead { margin: 0 0 14px; font-size: 14px; }
.matrix-scroll { overflow-x: auto; }
.tbl.matrix { width: 100%; }
.tbl.matrix th, .tbl.matrix td { padding: 10px 8px; }
.tbl.matrix td.num, .tbl.matrix th.num { text-align: center; }
.matrix-type { text-align: left; white-space: nowrap; }
.matrix-type .crit-tag {
  margin-left: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--neg); border: 1px solid var(--neg); border-radius: 100px; padding: 1px 7px; font-weight: 700;
}

/* toggle switch */
.switch-wrap { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch-wrap.locked { cursor: not-allowed; }
.switch { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px; height: 22px; border-radius: 100px; background: var(--line);
  position: relative; transition: background .15s; flex: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(40,30,15,.3); transition: transform .15s;
}
.switch:checked + .switch-track { background: var(--accent); }
.switch:checked + .switch-track::after { transform: translateX(16px); }
.switch:disabled + .switch-track { opacity: .6; }
.switch:focus-visible + .switch-track { box-shadow: var(--ring); }

/* quiet hours */
.quiet-box { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.quiet-head { display: flex; align-items: center; gap: 12px; }
.quiet-head .small { font-size: 12px; }
.quiet-times { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.time-input {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); font-family: var(--mono); font-size: 14px; color: var(--ink);
}
.time-input:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }

.pref-foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.save-status { font-size: 13px; }

/* event-bus demo */
.sim-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sim-box .btn { padding: 6px 14px; font-size: 13px; }

@media (max-width: 680px) {
  .notif-bar { flex-direction: column; align-items: stretch; }
}

/* ================= SETTINGS (ЛК-9) ================= */
/* setting rows: label(+sub) left, control right */
.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.card > .set-row:last-child { border-bottom: none; padding-bottom: 0; }
.card > .set-row:first-of-type { padding-top: 0; }
.set-row-l { min-width: 0; }
.set-row-label { font-weight: 600; font-size: 14px; }
.set-row-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.set-row-c { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 100px; background: var(--line);
  transition: background .15s;
}
.switch .knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-soft); transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .knob { transform: translateX(18px); }
.switch input:disabled + .track { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(30,20,10,.32);
  display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px;
  overflow: auto;
}
.modal-card {
  width: min(460px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h3 { font-size: 18px; }
.modal-x { background: transparent; border: none; font-size: 24px; line-height: 1; color: var(--muted); padding: 0 4px; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 14px 22px 22px; }
.modal-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.secret-key {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; margin-bottom: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.secret-key code { font-size: 16px; letter-spacing: .06em; word-break: break-all; }

/* toast · FR-932: светлая карточка в стиле ЛК вместо чёрной «таблетки» —
   длинный текст в ней переносился в несколько строк и выглядел как авария */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
  display: flex; align-items: flex-start; gap: 10px;
  width: max-content; max-width: min(440px, calc(100vw - 32px)); box-sizing: border-box;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  padding: 12px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 500; line-height: 1.45;
  z-index: 90; opacity: 0; transition: opacity .2s, transform .2s;
  box-shadow: 0 18px 40px -18px rgba(30, 20, 10, .35);
}
.toast::before {
  content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px;
  border-radius: 50%; background: var(--accent);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.pos { border-left-color: var(--pos); }
.toast.pos::before { background: var(--pos); }
.toast.neg { border-left-color: var(--neg); }
.toast.neg::before { background: var(--neg); }
/* на планшете и в Android внизу панель навигации — тост над ней */
@media (max-width: 1179px) { .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }

@media (max-width: 680px) {
  .set-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .set-row-c { align-self: flex-end; }
}

/* мобильный топбар: место под фиксированный бургер drawer'а; вторичные
   элементы убраны, чтобы правый угол (язык, уведомления, аватар) помещался
   в экран — так же, как главная прячет .axutil-sec на узких вьюпортах */
@media (max-width: 820px) {
  /* FR-850: бургера слева больше нет — слева логотип, кнопка меню справа */
  .topbar { padding-left: 16px; }
  .topbar .ticker, .topbar .kbd, .topbar .market-status { display: none; }
  /* часы остаются и на телефоне — они и есть самая компактная часть шапки */
  .fr-clock { padding: 4px 8px; }
  /* в шапке остаётся только аватар — имя пользователя видно в самом меню */
  .um-name, .um-caret { display: none; }
  .um-btn { padding: 3px; border-color: transparent; background: none; }
}
/* FR-842 · узкие телефоны (360 dp и меньше): правый угол шапки — часы, язык,
   колокольчик, аватар — не помещался, аватар обрезался. Поджимаем отступы и
   кнопки языка; на самых узких прячем часы (язык и уведомления важнее). */
@media (max-width: 420px) {
  .topbar { padding-right: 12px; gap: 8px; }
  .rightcorner { gap: 6px; }
  .lang-switch button { padding: 6px 7px; font-size: 11.5px; }
  .fr-clock { padding: 4px 7px; gap: 4px; }
  .fr-clock-tag { font-size: 9px; }
  .fr-clock-val { font-size: 12px; }
  .icon-btn, .avatar { width: 34px; height: 34px; }
}
@media (max-width: 350px) {
  .fr-clock { display: none; }
}
/* FR-850: на телефоне язык переключается в меню (хаб / лист «Ещё») */
@media (max-width: 767px) {
  .topbar .lang-switch { display: none; }
}
.bell-ic { display: grid; place-items: center; color: var(--ink); }
/* FR-854: есть непрочитанные — короткое покачивание раз в 8 с и мягкий ореол у бейджа */
@media (prefers-reduced-motion: no-preference) {
  .icon-btn.has-unread .bell-ic { transform-origin: 50% 3px; animation: bell-ring 8s ease-in-out 1s infinite; }
  .icon-btn.has-unread .badge { animation: bell-halo 8s ease-out 1s infinite; }
}
@keyframes bell-ring {
  0%, 10%, 100% { transform: rotate(0); }
  2% { transform: rotate(14deg); } 4% { transform: rotate(-11deg); }
  6% { transform: rotate(7deg); } 8% { transform: rotate(-4deg); }
}
@keyframes bell-halo {
  0% { box-shadow: 0 0 0 0 rgba(194, 114, 74, .45); }
  12%, 100% { box-shadow: 0 0 0 6px rgba(194, 114, 74, 0); }
}

/* FR-793 · тумблеры Toggle() снова видны. Старое правило .switch (паттерн
   .switch-wrap выше) прячет элемент opacity:0, а компонент Toggle() — это
   label.switch, и второе правило .switch прозрачность не возвращало. */
label.switch { opacity: 1; }

/* FR-793 · mobile «Настройки и безопасность» и «Профиль клиента» (.m-fit).
   Таблицы (сессии, журнал безопасности, история входов, документы KYC,
   история версий) на узком экране становятся карточками: подпись колонки
   берётся из data-l, который ставит Table(). Длинные значения переносятся,
   ничего не выходит за экран и не обрезается. */
.m-fit .card, .m-fit .grid > * { min-width: 0; }
@media (max-width: 680px) {
  .m-fit .card { padding: 18px 16px; overflow-wrap: anywhere; }
  .m-fit .card-title { flex-wrap: wrap; gap: 6px 12px; }
  .m-fit .tbl, .m-fit .tbl tbody, .m-fit .tbl tr, .m-fit .tbl td { display: block; width: 100%; }
  .m-fit .tbl thead { display: none; }
  .m-fit .tbl tr { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; margin-bottom: 10px; }
  .m-fit .tbl tr:last-child { margin-bottom: 0; }
  .m-fit .tbl td, .m-fit .tbl tr:last-child td {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--line); text-align: right; min-width: 0;
  }
  .m-fit .tbl tr td:last-child { border-bottom: none; }
  .m-fit .tbl td:not([data-l]) { justify-content: flex-end; }
  .m-fit .tbl td[data-l]::before {
    content: attr(data-l); flex: 0 0 auto; max-width: 45%; text-align: left;
    color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  }
  .m-fit .tbl td > * { min-width: 0; overflow-wrap: anywhere; }
  .m-fit .set-row-l { max-width: 100%; }
  .m-fit .set-row-c { max-width: 100%; flex-wrap: wrap; justify-content: flex-end; }
  .m-fit .pf-kv > * { min-width: 0; overflow-wrap: anywhere; }
  .m-fit .pf-goal-top, .m-fit .pf-goal-foot { flex-wrap: wrap; }
  .m-fit .pf-uprow { flex-wrap: wrap; overflow-wrap: anywhere; }
}

/* FR-825 · юридический блок регистрации и окно документа */
.reg-legal { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 6px 0 12px; background: var(--surface); }
.reg-legal.invalid { border-color: var(--neg); }
.reg-legal__head { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.reg-legal__lead { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.reg-legal__docs { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.reg-legal__sub { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0 4px; }
.reg-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; margin: 4px 0; cursor: pointer; }
.reg-check input { margin-top: 3px; flex: 0 0 auto; }
.reg-legal__desc { font-size: 12px; color: var(--muted); margin: 2px 0 0 24px; line-height: 1.45; }
.legal-link { padding: 0; font-size: inherit; text-align: left; display: inline; width: auto; margin: 0; vertical-align: baseline; }
.legal-modal .modal-card { max-width: 720px; }
.legal-modal .modal-body { max-height: 70vh; overflow-y: auto; }
.legal-doc h4 { margin: 14px 0 6px; font-size: 14px; }
.legal-doc p, .legal-doc li { font-size: 13.5px; line-height: 1.55; }
.legal-doc ul { padding-left: 18px; margin: 4px 0; }
.legal-doc__meta { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.legal-doc__foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.legal-docs-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 12px; font-size: 13px; }

/* FR-854: «?» у метрики и всплывающее объяснение */
.mhelp {
  display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 6px; padding: 0;
  border: 1px solid currentColor; border-radius: 50%; background: transparent; color: inherit;
  font: 700 10px/1 var(--body, inherit); opacity: .7; cursor: help; vertical-align: 1px;
}
.mhelp:hover, .mhelp:focus-visible { opacity: 1; }
.mhelp:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mhelp-pop {
  position: fixed; z-index: 1200; max-width: 240px; padding: 8px 10px; border-radius: 8px;
  background: #1d232d; color: #f4f1ea; font-size: 12.5px; line-height: 1.4; font-weight: 400;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22); pointer-events: none;
}
.nowrap { white-space: nowrap; }
