/* WEALTH OS · оформление.
   Одна визуальная система на оба интерфейса. Плоско, линейно, без теней. */

:root {
  color-scheme: light dark;
  --bg: #F5F4F1;
  --surface: #FFFFFF;
  --surface-2: #EDEBE7;
  --ink: #17171A;
  --ink-2: #4E4C54;
  --ink-3: #6E6C74;
  --line: #D6D2CB;
  --line-soft: #E4E1DC;
  --control-line: #858189;
  --accent: #6E54C7;
  --accent-2: #54419E;
  --accent-soft: #EDE9FA;
  --on-accent: #FFFFFF;
  --warm: #A79E90;
  --alert: #8E3B1E;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 80px;

  /* Семь размеров образуют единую шкалу: подпись → метаданные → текст →
     интерфейс → секция → заголовок → главный вывод. */
  --t-xs: .75rem; --t-sm: .8125rem; --t-b: .9375rem; --t-lg: 1rem;
  --t-sec: 1.1875rem; --t-title: 1.5625rem; --t-hero: 2.125rem;

  --motion-fast: 150ms;
  --motion-base: 220ms;
  --motion-slow: 320ms;
  --ease-standard: cubic-bezier(.22, 1, .36, 1);
  --ease-enter: cubic-bezier(.17, 1, .32, 1);
  --ease-move: cubic-bezier(.66, 0, .34, 1);

  --reading: 62ch;
  --nav-w: 248px;
  --pad: 40px;
  --table-pad: 16px;
  --r: 4px;
  /* Системный стек выбран сознательно: в сборке нет скрытой зависимости от
     наличия Inter на конкретном устройстве. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* По умолчанию тема следует настройке устройства; ручной выбор меняет
   только токены. Это не влияет на данные, роли и расчёты. */
@media (prefers-color-scheme: dark) {
  html:not([data-color-mode]) body {
    --bg: #17171A; --surface: #222226; --surface-2: #2B2B30;
    --ink: #F3F1F5; --ink-2: #D0CDD5; --ink-3: #AAA6B1;
    --line: #46434B; --line-soft: #35333A; --control-line: #7B7584;
    --accent: #A995F0; --accent-2: #C1B3FA; --accent-soft: #352C55;
    --on-accent: #17151B; --warm: #B8B0A5; --alert: #E89170;
  }
}
html[data-color-mode="light"] { color-scheme: light; }
html[data-color-mode="dark"] { color-scheme: dark; }
html[data-color-mode="dark"] body {
  --bg: #17171A; --surface: #222226; --surface-2: #2B2B30;
  --ink: #F3F1F5; --ink-2: #D0CDD5; --ink-3: #AAA6B1;
  --line: #46434B; --line-soft: #35333A; --control-line: #7B7584;
  --accent: #A995F0; --accent-2: #C1B3FA; --accent-soft: #352C55;
  --on-accent: #17151B; --warm: #B8B0A5; --alert: #E89170;
}

/* Палитра — настройка клиента, а не смена фирменного языка рабочего места
   советника. Все варианты остаются светлыми и используют проверенные токены. */
html[data-theme-palette="sage"] body[data-view-role="client"] {
  --bg: #F3F5F1;
  --surface-2: #E7ECE7;
  --line: #CCD4CD;
  --line-soft: #DFE5DF;
  --control-line: #748078;
  --accent: #3E6B5B;
  --accent-2: #2F584A;
  --accent-soft: #E0ECE6;
  --warm: #95A194;
}

html[data-theme-palette="mineral"] body[data-view-role="client"] {
  --bg: #F2F4F7;
  --surface-2: #E6EBF1;
  --line: #CBD3DD;
  --line-soft: #DEE3EA;
  --control-line: #707C89;
  --accent: #365F91;
  --accent-2: #284B76;
  --accent-soft: #E0E9F4;
  --warm: #9099A4;
}

html[data-theme-palette="clay"] body[data-view-role="client"] {
  --bg: #F7F2EC;
  --surface-2: #EEE6DE;
  --line: #D8CCC1;
  --line-soft: #E8DED5;
  --control-line: #82766D;
  --accent: #98513C;
  --accent-2: #773D2D;
  --accent-soft: #F2E5DF;
  --warm: #AA8D7D;
}

*, *::before, *::after { box-sizing: border-box; }

/* Авторский display перебивает браузерный [hidden]. Возвращаем приоритет атрибуту:
   иначе элемент с hidden остаётся на экране, а состояние в коде считает его закрытым. */
[hidden] { display: none !important; }

html { font-size: 100%; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-b)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

.auth {
  min-height: 100dvh; display: grid; place-items: center;
  padding: clamp(20px, 5vw, 56px);
  background: var(--bg);
}
.auth-card {
  position: relative; isolation: isolate; overflow: hidden;
  width: min(100%, 480px); padding: clamp(28px, 6vw, 52px);
  border: 1px solid var(--line-soft); border-radius: 24px; background: var(--surface);
}
.auth-card::after {
  content: ""; position: absolute; z-index: -1; inset: -78px -78px auto auto;
  width: 184px; height: 184px; opacity: .68; pointer-events: none;
  background: repeating-radial-gradient(circle at center, transparent 0 13px, var(--line-soft) 14px 15px);
}
.auth-brand { color: var(--accent-2); font-size: var(--t-xs); font-weight: 700; letter-spacing: .22em; }
.auth-card h1 { max-width: 14ch; margin-top: 40px; font-size: clamp(1.75rem, 5vw, 2.125rem); line-height: 1.08; letter-spacing: -.035em; font-weight: 600; text-wrap: balance; }
.auth-card > p:not(.auth-brand):not(.auth-note) { max-width: 39ch; margin-top: var(--s4); color: var(--ink-2); font-size: var(--t-b); line-height: 1.55; }
.auth-form { display: grid; gap: 10px; margin-top: var(--s6); }
.auth-form label { margin-top: 6px; font-size: var(--t-sm); font-weight: 600; }
.auth-form input {
  width: 100%; min-height: 52px; padding: 0 var(--s4);
  border: 1px solid var(--control-line); border-radius: 14px;
  background: var(--bg); color: var(--ink); font: inherit;
}
.auth-form input:hover { border-color: var(--ink-3); }
.auth-form input:focus-visible { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent); outline-offset: 1px; }
.auth-form input[aria-invalid="true"] { border-color: var(--alert); }
.auth-form .btn { width: 100%; min-height: 52px; margin-top: 8px; border-radius: 14px; }
.auth-error { min-height: 1.5em; margin: 2px 0 0; color: var(--alert); font-size: var(--t-sm); }
.auth-note { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line-soft); color: var(--ink-3); font-size: var(--t-sm); }
.theme-choice { margin: var(--s4) 0 var(--s5); }
.theme-preview { display: block; width: 38px; height: 28px; border: 1px solid var(--line); border-radius: 2px; background: linear-gradient(90deg, #F5F4F1 50%, #17171A 50%); }
.theme-preview.is-light { background: #F5F4F1; }
.theme-preview.is-dark { background: #17171A; }

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; flex: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: fixed; top: -60px; left: var(--s4); z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: var(--s3) var(--s4); border-radius: var(--r);
}
.skip:focus { top: var(--s4); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ─────────── Типографика ─────────── */

.t-hero { font-size: clamp(1.625rem, 3vw, var(--t-hero)); line-height: 1.16; letter-spacing: -0.028em; font-weight: 600; text-wrap: balance; }
.t-title { font-size: var(--t-title); line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; text-wrap: balance; }
.t-sec { font-size: var(--t-sec); line-height: 1.3; letter-spacing: -0.012em; font-weight: 600; text-wrap: balance; }
.t-sub { font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.008em; }
.t-body { font-size: var(--t-b); line-height: 1.6; color: var(--ink-2); max-width: var(--reading); text-wrap: pretty; }
.t-lead { font-size: var(--t-lg); line-height: 1.55; color: var(--ink-2); max-width: var(--reading); text-wrap: pretty; }
.t-quiet { font-size: var(--t-sm); color: var(--ink-3); line-height: 1.5; }
.t-label {
  font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.v { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ta-r { text-align: right; }

/* ─────────── Оболочка ─────────── */

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100dvh; }

.side {
  display: flex; flex-direction: column;
  height: 100dvh; position: sticky; top: 0;
  border-right: 1px solid var(--line-soft);
  background: var(--bg);
}

.side-top { flex: none; padding: var(--s5) var(--s5) var(--s4); }
.brand { display: block; font-size: 13px; letter-spacing: 0.26em; font-weight: 600; }
.brand-sub { margin-top: var(--s2); font-size: var(--t-sm); color: var(--ink-3); }

.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 var(--s3) var(--s4); }

.nav-group { padding: var(--s5) var(--s3) var(--s2); font-size: var(--t-xs); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 40px; padding: var(--s2) var(--s3);
  border-radius: var(--r); color: var(--ink-2); font-size: var(--t-b);
}
.nav-item svg { width: 17px; height: 17px; color: var(--ink-3); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-2); font-weight: 500; }
.nav-item.is-active svg { color: var(--accent-2); }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--ink); color: var(--bg);
  font-size: var(--t-xs); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

.side-foot { flex: none; padding: var(--s4) var(--s5) var(--s5); border-top: 1px solid var(--line-soft); }
.who-name { font-size: var(--t-b); font-weight: 600; }
.who-role { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; }
.who-sync { font-size: var(--t-xs); color: var(--ink-3); margin-top: var(--s2); }
.side-palette {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 14px; gap: var(--s2); align-items: center;
  width: 100%; min-height: 44px; margin-top: var(--s3); padding: var(--s2) 0;
  border: 0; background: none; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer;
}
.side-palette > svg { width: 17px; height: 17px; color: var(--accent-2); }
.side-palette > svg:last-child { width: 14px; height: 14px; color: var(--ink-3); }
.side-palette span, .side-palette b, .side-palette small { display: block; min-width: 0; }
.side-palette b { font-size: var(--t-sm); font-weight: 500; }
.side-palette small { margin-top: 1px; color: var(--ink-3); font-size: var(--t-xs); }
.side-palette:hover { color: var(--ink); }
.side-logout { display: block; margin-top: var(--s3); padding: 0; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: var(--t-sm); cursor: pointer; }
.side-logout:hover { color: var(--ink); }

.main-wrap { display: flex; flex-direction: column; min-width: 0; container: workspace / inline-size; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s4) var(--pad);
  background: var(--bg); border-bottom: 1px solid var(--line-soft);
}
.top-context { min-width: 0; }
.crumb { font-size: var(--t-sm); color: var(--ink-3); min-width: 0; }
.crumb b { color: var(--ink); font-weight: 500; }
.crumb-mobile, .top-sync { display: none; }
.top-acts { display: flex; align-items: center; gap: var(--s2); }

.network-state {
  position: sticky; top: 73px; z-index: 19;
  padding: var(--s2) var(--pad); border-bottom: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); font-size: var(--t-sm);
}

.main { padding: var(--s7) var(--pad) var(--s9); max-width: 1240px; width: 100%; }
.main:focus { outline: none; }

.mnav { display: none; }
.mobile-today-app, .mobile-screen-summary { display: none; }

/* ─────────── Кнопки ─────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4);
  border: 1px solid var(--control-line); border-radius: var(--r);
  background: none; cursor: pointer; font-size: var(--t-b); white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active, .icon-btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: var(--alert); border-color: var(--alert); color: #FFFFFF; font-weight: 500; }
.btn-danger:hover { filter: brightness(.9); border-color: var(--alert); }
.btn-quiet { border-color: var(--control-line); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 0; border-radius: var(--r);
  background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; border: 0; background: none; padding: 0;
  color: var(--accent); font-size: var(--t-b); cursor: pointer;
}
.link:hover { color: var(--accent-2); }
.link svg { width: 15px; height: 15px; }

.acts { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }

/* ─────────── Страница ─────────── */

.page-head { margin-bottom: var(--s7); }
.page-head .t-lead { margin-top: var(--s4); }

.sec { margin-top: var(--s8); }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap;
  margin-top: var(--s7);
  padding-bottom: var(--s3); margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line-soft);
}
.page-head + .sec-head { margin-top: 0; }
.page-head + .t-quiet + .sec-head { margin-top: var(--s5); }

.note {
  margin: var(--s5) 0;
  padding: var(--s3) 0 var(--s3) var(--s4);
  border-left: 2px solid var(--line);
  font-size: var(--t-b); color: var(--ink-2); max-width: var(--reading);
}
.note-accent { border-left-color: var(--ink); }

.foot { margin-top: var(--s8); padding-top: var(--s4); border-top: 1px solid var(--line-soft); font-size: var(--t-xs); color: var(--ink-3); }

/* ─────────── Статусы ─────────── */

.st { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; }
.st-mark {
  width: 15px; height: 15px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; line-height: 1; flex: none;
}
.st-verified .st-mark { background: var(--ink); color: var(--bg); }
.st-manual .st-mark { box-shadow: inset 0 0 0 1.3px var(--ink-3); color: transparent; }
.st-stale .st-mark { box-shadow: inset 0 0 0 1.3px var(--ink-3); color: var(--ink-3); }
.st-syncing .st-mark { box-shadow: inset 0 0 0 1.3px var(--ink-3); color: var(--ink-3); }

/* ─────────── Показатели ─────────── */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); }
.stat { background: var(--bg); padding: var(--s4) var(--s5); }
.stat dt { font-size: var(--t-sm); color: var(--ink-3); }
.stat dd { margin: var(--s2) 0 0; font-size: var(--t-title); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat dd.sm { font-size: var(--t-lg); letter-spacing: -0.008em; }
.stat p { margin-top: var(--s2); font-size: var(--t-sm); color: var(--ink-3); }

/* ─────────── Табличные данные ─────────── */

.rows-scroll { margin-top: var(--s2); max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.rows { table-layout: fixed; min-width: 640px; }
.rows-head th {
  padding: var(--s3) var(--table-pad); border-bottom: 1px solid var(--ink);
  font-size: var(--t-xs); letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; text-align: left;
}
.rows-head th.ta-r { text-align: right; }
.row .cell {
  padding: var(--s4) var(--table-pad); border-bottom: 1px solid var(--line-soft);
  vertical-align: middle; min-width: 0; font-size: var(--t-b); font-weight: 400; text-align: left;
  overflow-wrap: anywhere;
}
.row .cell.ta-r { text-align: right; }
.row-action:hover .cell { background: var(--surface-2); }
.row-action:hover .cell b { color: var(--accent-2); }
.cell b { font-weight: 500; display: block; }
.cell small { display: block; font-size: var(--t-sm); color: var(--ink-3); margin-top: 2px; }
.row-main {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  width: 100%; min-height: 32px; padding: 0; border: 0; background: none;
  color: inherit; text-align: left; cursor: pointer; font: inherit;
}
.row-main > span:first-child { min-width: 0; }
.row-chev { color: var(--ink-3); margin-left: auto; flex: none; }
.row-chev svg { width: 16px; height: 16px; }

/* ─────────── Ввод данных ─────────── */

.connect-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft);
}
.connect-row b { font-weight: 500; }

.field input[type=text], .field input[type=number], .field input[type=date], .field textarea {
  width: 100%; min-height: 40px; padding: 0 var(--s3);
  border: 1px solid var(--control-line); border-radius: var(--r);
  background: var(--bg); font: inherit;
}
.field textarea { min-height: 104px; padding-block: var(--s3); line-height: 1.45; resize: vertical; }
.field input:focus { border-color: var(--accent); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--alert); }
.field-error { min-height: 1.35em; margin-top: var(--s1); color: var(--alert); font-size: var(--t-sm); }
.field-hint { display: block; margin-top: var(--s1); color: var(--ink-3); font-size: var(--t-sm); }

/* ─────────── Пользовательские цели и палитра ─────────── */

.goal-edit-trigger {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0;
  border: 0; background: none; color: var(--accent-2); font: inherit; font-size: var(--t-sm); cursor: pointer;
}
.goal-edit-trigger svg { width: 17px; height: 17px; }

.goal-manage-list { border-top: 1px solid var(--line-soft); }
.goal-manage-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: center;
  min-height: 76px; padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft);
}
.goal-manage-copy { min-width: 0; }
.goal-manage-copy b, .goal-manage-copy small { display: block; }
.goal-manage-copy b { font-weight: 600; overflow-wrap: anywhere; }
.goal-manage-copy small { margin-top: var(--s1); color: var(--ink-3); font-size: var(--t-sm); }
.goal-manage-actions { display: flex; gap: var(--s1); }
.goal-manage-actions .icon-btn { width: 42px; height: 42px; }
.goal-manage-actions .is-delete { color: var(--alert); }
.goal-form-note { margin-bottom: var(--s5); padding: var(--s3); border: 1px solid var(--line-soft); color: var(--ink-2); font-size: var(--t-sm); }
.goal-empty-action {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 82px; margin-top: var(--s2); padding: var(--s4);
  border: 1px dashed var(--line); border-radius: 18px; background: var(--surface); color: inherit; text-align: left; cursor: pointer;
}
.goal-empty-action > svg { color: var(--accent-2); }
.goal-empty-action span, .goal-empty-action b, .goal-empty-action small { display: block; }
.goal-empty-action b { font-weight: 600; }
.goal-empty-action small { margin-top: 3px; color: var(--ink-3); font-size: var(--t-sm); }

.palette-choice { display: grid; gap: var(--s2); }
.palette-choice-item {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: var(--s3); align-items: center;
  width: 100%; min-height: 68px; padding: var(--s3); border: 1px solid var(--line-soft);
  border-radius: 12px; background: var(--surface); color: inherit; text-align: left; cursor: pointer;
}
.palette-choice-item.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.palette-choice-item b, .palette-choice-item small { display: block; }
.palette-choice-item b { font-weight: 600; }
.palette-choice-item small { margin-top: 2px; color: var(--ink-3); font-size: var(--t-sm); }
.palette-preview { display: grid; grid-template-columns: repeat(3, 14px); gap: 3px; align-content: center; justify-content: center; width: 54px; height: 38px; border-radius: 8px; background: var(--preview-bg); }
.palette-preview i { display: block; width: 14px; height: 22px; border-radius: 4px; background: var(--preview-accent); }
.palette-preview i:nth-child(2) { height: 16px; background: var(--preview-soft); }
.palette-preview i:nth-child(3) { height: 11px; background: var(--preview-ink); }
.palette-preview.is-lavender { --preview-bg: #F5F4F1; --preview-accent: #6E54C7; --preview-soft: #EDE9FA; --preview-ink: #17171A; }
.palette-preview.is-sage { --preview-bg: #F3F5F1; --preview-accent: #3E6B5B; --preview-soft: #E0ECE6; --preview-ink: #17171A; }
.palette-preview.is-mineral { --preview-bg: #F2F4F7; --preview-accent: #365F91; --preview-soft: #E0E9F4; --preview-ink: #17171A; }
.palette-preview.is-clay { --preview-bg: #F7F2EC; --preview-accent: #98513C; --preview-soft: #F2E5DF; --preview-ink: #17171A; }

/* ─────────── История значения ─────────── */

.hist { margin-top: var(--s3); }
.hist-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr) minmax(90px, auto) minmax(90px, auto);
  gap: var(--s4); align-items: center;
  padding: var(--s3) var(--table-pad);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--t-sm);
}
.hist-date { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hist-track { height: 3px; background: var(--surface-2); position: relative; }
.hist-track i { position: absolute; inset: 0 auto 0 0; background: var(--ink-3); }
.hist-v { font-variant-numeric: tabular-nums; text-align: right; font-size: var(--t-b); }
.hist-d { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }

/* ─────────── Пары ─────────── */

.pairs > div {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5);
  padding: var(--s3) var(--table-pad); border-bottom: 1px solid var(--line-soft);
  font-size: var(--t-b);
}
.pairs dt { min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.pairs dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.pairs-tight > div { padding: var(--s2) var(--table-pad); font-size: var(--t-sm); }

/* ─────────── Чипы ─────────── */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 0 var(--s3);
  border: 1px solid var(--control-line); border-radius: 100px;
  background: none; font-size: var(--t-sm); cursor: pointer; color: var(--ink-2);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.currency-choice { display: grid; margin-top: var(--s5); }
.currency-choice-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  width: 100%; min-height: 64px; padding: var(--s3) 0;
  border: 0; border-bottom: 1px solid var(--line-soft); background: none;
  text-align: left; cursor: pointer;
}
.currency-choice-item > span:first-child { display: grid; gap: 2px; }
.currency-choice-item b { font-weight: 600; }
.currency-choice-item small { color: var(--ink-3); font-size: var(--t-sm); }
.currency-choice-item > svg { width: 16px; height: 16px; color: var(--ink-3); }
.currency-choice-item.is-selected { color: var(--accent-2); }

/* ─────────── Полосы ─────────── */

.bars { margin-top: var(--s3); }
.bar {
  display: grid; grid-template-columns: minmax(0, 1.4fr) auto minmax(70px, 0.9fr);
  gap: var(--s4); align-items: center; padding: var(--s2) var(--table-pad);
  font-size: var(--t-sm);
}
.bar-v { font-variant-numeric: tabular-nums; }
.bar-track { height: 3px; background: var(--surface-2); position: relative; }
.bar-track i { position: absolute; inset: 0 auto 0 0; background: var(--ink-3); }
.bar.is-on .bar-track i { background: var(--ink); }

/* ─────────── Сегодня ─────────── */

.today-state { max-width: 62ch; }
.today-date { font-size: var(--t-sm); color: var(--ink-3); }
.today-head {
  margin-top: var(--s3);
  font-size: clamp(1.625rem, 3.4vw, 2.375rem); line-height: 1.15;
  letter-spacing: -0.028em; font-weight: 600;
  text-wrap: balance;
}
.today-lead { margin-top: var(--s4); font-size: var(--t-lg); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.today-state-calm .today-lead {
  font-size: clamp(1.625rem, 3.4vw, 2.375rem); line-height: 1.15;
  letter-spacing: -0.028em; font-weight: 600; color: var(--ink);
}
.today-state .acts { margin-top: var(--s5); }
.today-mobile-context { display: none; }

.today-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px; background: var(--line-soft);
  border: 1px solid var(--line-soft); margin-top: var(--s8);
}
.today-tile {
  display: flex; flex-direction: column; gap: var(--s2);
  background: var(--bg); padding: var(--s5); min-height: 168px;
}
a.today-tile:hover { background: var(--surface); }
.today-label { font-size: var(--t-sm); color: var(--ink-3); }
.today-big { font-size: var(--t-title); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.today-big-sm { font-size: var(--t-lg); letter-spacing: -0.008em; font-weight: 600; }
.today-note { font-size: var(--t-sm); color: var(--ink-2); }
.today-go {
  margin-top: auto; padding-top: var(--s3);
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--t-sm); color: var(--accent);
}
.today-go svg { width: 14px; height: 14px; }
.today-tile-act .today-label { color: var(--ink); font-weight: 600; }

.today-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5);
  margin-top: var(--s5); padding-top: var(--s4);
  border-top: 1px solid var(--line-soft);
}

/* ─────────── Специалисты на главном ─────────── */

.pros { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); margin-top: var(--s2); }
.pro-card {
  display: block; text-align: left; border: 0; cursor: pointer;
  background: var(--bg); padding: var(--s4) var(--s5); min-height: 92px;
}
.pro-card:hover { background: var(--accent-soft); }
.pro-role { display: block; font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.pro-card b { display: block; margin-top: var(--s2); font-size: var(--t-lg); font-weight: 600; }
.pro-card small { display: block; margin-top: var(--s1); font-size: var(--t-sm); color: var(--ink-3); }

.filters-two { display: flex; flex-wrap: wrap; gap: var(--s5) var(--s6); }
.filters-two .t-label { display: block; margin-bottom: var(--s2); }
.queue-filter-trigger { display: none; }

.family-person { padding: var(--s5) 0; border-bottom: 1px solid var(--line-soft); }
.family-person-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr); gap: var(--s6); }
.family-person-main .t-quiet { margin-top: var(--s1); }
.family-person-fact { margin-top: var(--s4); color: var(--ink-2); font-size: var(--t-b); }

/* ─────────── Курсы и ввод ─────────── */

.rates { margin-top: var(--s4); }
.rates-list { display: flex; flex-wrap: wrap; gap: var(--s5); margin-top: var(--s3); }
.rates-list > div { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--t-sm); }
.rates-list dt { color: var(--ink-3); }
.rates-list dd { margin: 0; font-variant-numeric: tabular-nums; }

/* Кнопки ввода не должны читаться как ещё один фильтр */
.btn-add { border-style: dashed; color: var(--ink-2); }
.btn-add:hover { border-style: solid; border-color: var(--ink); color: var(--ink); }
.btn-add svg { width: 15px; height: 15px; }

.filters { margin-top: var(--s4); }

/* ─────────── Карта капитала ─────────── */

.map-tabs {
  display: flex; align-items: flex-end; flex-wrap: wrap;
  gap: var(--s3) var(--s5); max-width: 100%;
}
.map-tabs-mobile { display: none; }
.map-tab {
  position: relative; flex: none;
  padding: 0 0 9px; border: 0; background: none;
  color: var(--ink-3); font-size: var(--t-sm); cursor: pointer;
  white-space: nowrap;
}
.map-tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -13px;
  height: 2px; background: transparent;
}
.map-tab:hover { color: var(--ink); }
.map-tab.is-on { color: var(--ink); font-weight: 600; }
.map-tab.is-on::after { background: var(--ink); }

.map-wrap {
  margin-top: var(--s5);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  overflow: hidden;
}
.map { display: block; width: 100%; height: auto; aspect-ratio: 23 / 15; }
.map-orbit {
  fill: none; stroke: var(--line-soft); stroke-width: 1;
  stroke-dasharray: 2 6; vector-effect: non-scaling-stroke;
}
.map-orbit-groups { opacity: .72; }
.map-orbit-objects { opacity: .46; }

.map-node { cursor: pointer; }
.map-node .map-hit { fill: transparent; stroke: none; pointer-events: all; }
.map-node .map-disc {
  fill: var(--bg); stroke: var(--ink-3); stroke-width: 1.15;
  vector-effect: non-scaling-stroke;
}
/* :hover только там, где есть указатель: на планшете он залипает после касания
   и на карте оказывались подсвечены сразу два объекта */
@media (hover: hover) {
  .map-node:hover .map-disc { stroke: var(--accent); stroke-width: 1.8; }
}
.map-node:focus-visible .map-disc { stroke: var(--accent); stroke-width: 1.8; }
.map-node.is-on .map-disc {
  fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2;
}
.map-node text {
  font-family: var(--font); fill: var(--ink);
  pointer-events: none; font-variant-numeric: tabular-nums;
}
.map-node .map-name { font-size: 11px; font-weight: 500; }
.map-node .map-v { font-size: 10px; font-weight: 400; fill: var(--ink-3); }
.map-selected-name { font: 550 11px var(--font); fill: var(--ink); }
.map-selected-value { font: 400 10px var(--font); fill: var(--ink-3); }
.map-node.is-neg .map-disc { fill: var(--surface); stroke-dasharray: 4 3; }
.map-node.is-neg .map-v { fill: var(--ink-2); }

.map-group .map-disc { fill: var(--surface-2); stroke: var(--ink-2); }
.map-group .map-count {
  font-size: 10px; font-weight: 600; fill: var(--ink-2);
}
.map-group.is-on .map-count { fill: var(--accent-2); }

.map-hub .map-disc { fill: var(--ink); stroke: var(--ink); }
.map-hub.is-on .map-disc { fill: var(--accent-2); stroke: var(--accent-2); }
.map-hub-name { fill: var(--bg) !important; font-size: 11px; font-weight: 600; }
.map-hub-value { fill: rgba(245,244,241,.76) !important; font-size: 10px; font-weight: 400; }

.map-link {
  stroke: var(--line); stroke-width: 1; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.map-link-root { stroke: var(--ink-3); opacity: .72; }
.map-link-object { opacity: .82; }
.map-link.is-neg { stroke-dasharray: 4 4; }
.map-link.is-on { stroke: var(--accent); stroke-width: 1.7; opacity: 1; }

.map-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5);
  padding: var(--s3) var(--s4); border-top: 1px solid var(--line-soft);
  font-size: var(--t-sm); color: var(--ink-3);
}
.map-tools {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s2) var(--s4); border-top: 1px solid var(--line-soft);
}
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.map-legend i { display: inline-block; flex: none; }
.legend-node {
  width: 10px; height: 10px; border: 1px solid var(--ink-3);
  border-radius: 50%; background: var(--bg);
}
.legend-link, .legend-neg { width: 18px; height: 1px; background: var(--line); }
.legend-neg {
  height: 0; background: none; border-top: 1px dashed var(--ink-3);
}

/* ─────────── Ось времени ─────────── */

.horizon { margin-top: var(--s6); }
.horizon-head { display: flex; align-items: baseline; gap: var(--s3); padding: 0 var(--table-pad) var(--s2); border-bottom: 1px solid var(--ink); }
.horizon-head h2 { font-size: var(--t-lg); font-weight: 600; }
.tl-row {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) 150px 20px;
  gap: var(--s4); align-items: center; width: 100%; text-align: left;
  padding: var(--s4) var(--table-pad); border: 0; border-bottom: 1px solid var(--line-soft);
  background: none; cursor: pointer;
}
.tl-row:hover { background: var(--surface-2); }
.tl-date { font-size: var(--t-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-copy b { display: block; font-weight: 500; }
.tl-copy small { display: block; font-size: var(--t-sm); color: var(--ink-3); margin-top: 2px; }
.tl-amt { font-variant-numeric: tabular-nums; text-align: right; font-size: var(--t-b); }

/* ─────────── Событие ─────────── */

.ev-card {
  padding: var(--s5); border: 1px solid var(--line-soft); background: var(--surface);
  margin-top: var(--s5);
}
.ev-kind { font-size: var(--t-sm); color: var(--ink-3); }
.ev-client { margin-top: var(--s3); font-size: var(--t-lg); line-height: 1.5; max-width: var(--reading); }
.ev-meta { display: flex; flex-wrap: wrap; gap: var(--s5); margin-top: var(--s5); }
.ev-meta div { font-size: var(--t-sm); }
.ev-meta dt { color: var(--ink-3); }
.ev-meta dd { margin: 2px 0 0; font-weight: 500; }

.basis { margin-top: var(--s3); }
.basis li { padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft); font-size: var(--t-b); }
.basis li b { font-weight: 500; }

.draft {
  margin-top: var(--s4); padding: var(--s4);
  border: 1px dashed var(--line); background: var(--surface);
  font-size: var(--t-b); line-height: 1.55; max-width: var(--reading);
}
.draft-tag { display: block; margin-bottom: var(--s2); font-size: var(--t-xs); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

/* ─────────── Сценарий ─────────── */

.sc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--s7); margin-top: var(--s5); }
.field { margin-bottom: var(--s5); }
.field label { display: block; font-size: var(--t-sm); color: var(--ink-2); margin-bottom: var(--s2); }
.field input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.field select {
  width: 100%; min-height: 40px; padding: 0 var(--s3);
  border: 1px solid var(--control-line); border-radius: var(--r); background: var(--bg); font: inherit;
}
.delta { font-variant-numeric: tabular-nums; color: var(--ink-2); }

.sc-chart { margin-top: var(--s4); border: 1px solid var(--line-soft); background: var(--surface); padding: var(--s4); }
.sc-chart svg { width: 100%; height: auto; }
.sc-line-a { stroke: var(--ink-3); stroke-width: 1.4; fill: none; }
.sc-line-b { stroke: var(--ink); stroke-width: 1.8; fill: none; }
.sc-axis { stroke: var(--line); stroke-width: 1; }
.sc-tick { font: 400 10px var(--font); fill: var(--ink-3); }

/* ─────────── Панель ─────────── */

.panel {
  position: fixed; inset: 0 0 0 auto; z-index: 70;
  width: min(520px, 100%); max-width: none; height: 100dvh; max-height: none;
  margin: 0 0 0 auto; padding: 0;
  display: none; flex-direction: column;
  color: var(--ink); background: var(--bg); border: 0; border-left: 1px solid var(--line-soft);
  transform: translateX(100%); transition: transform var(--motion-base) var(--ease-enter);
}
.panel[open] { display: flex; }
.panel.is-open { transform: translateX(0); }
.panel::backdrop { background: rgba(23,23,26,.28); }
.panel-handle { display: none; }
.panel-head {
  flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4);
  padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--line-soft);
}
.panel-head > div { min-width: 0; }
.panel-head .icon-btn { flex: none; }
.panel-head h2 { font-size: var(--t-sec); letter-spacing: -0.012em; }
.panel-head p { margin-top: var(--s1); font-size: var(--t-sm); color: var(--ink-3); }
.panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s5) var(--s5) var(--s9); }
.panel-acts { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }
.panel-body .t-label { display: block; margin: var(--s6) 0 var(--s3); }
.panel-body .t-label:first-child { margin-top: 0; }

/* ─────────── Поиск ─────────── */

.search {
  position: fixed; inset: 0; z-index: 90; width: 100%; max-width: none; height: 100dvh; max-height: none;
  margin: 0; border: 0; background: transparent; color: var(--ink);
  display: none; justify-content: center; align-items: flex-start; padding: 10vh var(--s4) var(--s4);
}
.search[open] { display: flex; }
.search::backdrop { background: rgba(23,23,26,.3); }
.search-box { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--control-line); border-radius: var(--r); overflow: hidden; }
.search-field { flex: none; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3) 0 var(--s4); border-bottom: 1px solid var(--line-soft); }
.search-field svg { color: var(--ink-3); }
.search-field input { flex: 1 1 auto; min-width: 0; min-height: 54px; border: 0; background: none; font: inherit; font-size: var(--t-lg); outline: none; }
.search-field:focus-within { box-shadow: inset 0 -2px var(--accent); }
.search-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.search-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: var(--s3);
  align-items: center; width: 100%; text-align: left;
  padding: var(--s3) var(--s4); border: 0; background: none; cursor: pointer;
}
.search-item.is-active, .search-item:hover { background: var(--accent-soft); }
.search-item b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item small { display: block; font-size: var(--t-sm); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item svg { width: 16px; height: 16px; color: var(--ink-3); }
.search-hint { flex: none; padding: var(--s3) var(--s4); border-top: 1px solid var(--line-soft); font-size: var(--t-xs); color: var(--ink-3); }

/* ─────────── Уведомление и демо ─────────── */

.toast {
  position: fixed; left: 50%; bottom: var(--s5); z-index: 120;
  transform: translate(-50%, 14px);
  padding: var(--s3) var(--s4); border-radius: var(--r);
  background: var(--ink); color: var(--bg); font-size: var(--t-sm);
  opacity: 0; pointer-events: none;
  transition: opacity var(--motion-base) var(--ease-standard), transform var(--motion-base) var(--ease-standard);
  max-width: calc(100% - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.demo {
  position: fixed; left: var(--s4); bottom: 228px; z-index: 110;
  width: calc(var(--nav-w) - var(--s6));
  display: flex; flex-direction: column; align-items: stretch; gap: var(--s2);
  padding: var(--s3); border: 1px solid var(--control-line); border-radius: var(--r);
  background: var(--bg);
}
.demo label { font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.demo select { width: 100%; min-height: 32px; border: 1px solid var(--control-line); border-radius: var(--r); background: var(--bg); font: inherit; font-size: var(--t-sm); padding: 0 var(--s2); }

/* ─────────── Роль ─────────── */

.role-switch { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--control-line); border-radius: 100px; }
.role-btn { min-height: 30px; padding: 0 var(--s3); border: 0; border-radius: 100px; background: none; font-size: var(--t-sm); color: var(--ink-2); cursor: pointer; }
.role-btn.is-on { background: var(--ink); color: var(--bg); }
.role-switch-label {
  margin-top: var(--s3); margin-bottom: 5px;
  font-size: 10px; line-height: 1.3; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 600;
}

/* ─────────── Ролевой доступ ─────────── */

.access-controls { display: grid; margin-top: 10px; border-top: 1px solid var(--line); }
.access-permission { padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.access-toggle {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 38px; gap: 10px; align-items: center;
  width: 100%; min-height: 64px; padding: 12px 0 6px; border: 0;
  background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.access-toggle > span:first-child { min-width: 0; display: grid; gap: 3px; }
.access-toggle b { font-size: 14px; line-height: 1.25; font-weight: 600; }
.access-toggle small { color: var(--ink-3); font-size: 11px; line-height: 1.35; }
.access-toggle-state { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.access-toggle-track { position: relative; width: 38px; height: 22px; border-radius: 20px; background: var(--control-line); transition: background .18s ease; }
.access-toggle-track i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .18s ease; }
.access-toggle[aria-pressed="true"] .access-toggle-track { background: var(--accent); }
.access-toggle[aria-pressed="true"] .access-toggle-track i { transform: translateX(16px); }
.access-toggle:focus-visible, .access-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.access-check {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0;
  border: 0; background: none; color: var(--accent-2); font-size: 12px; font-weight: 600; cursor: pointer;
}
.access-check svg { width: 14px; height: 14px; }
.access-demo-note { margin-top: 14px; }
.professional-access-status { margin: 0 0 18px; padding: 14px 0; border-block: 1px solid var(--line-soft); }
.professional-access-status p { margin-top: 7px; color: var(--ink-3); font-size: 12px; line-height: 1.45; }
.access-denied-card {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 15px; align-items: start;
  max-width: 680px; padding: 20px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--surface);
}
.access-denied-card > svg { width: 28px; height: 28px; color: var(--accent-2); }
.access-denied-card h2 { font-size: var(--t-h3); font-weight: 600; }
.access-denied-card p { margin-top: 6px; color: var(--ink-2); line-height: 1.5; }
.role-access-dot { display: block; width: 10px; height: 10px; margin: auto; border-radius: 50%; background: var(--accent); }

.empty { padding: var(--s5) var(--table-pad); color: var(--ink-3); border-bottom: 1px solid var(--line-soft); }
.family-quality { margin-top: var(--s5); }
.family-quality:first-child { margin-top: 0; }
.family-choice { display: grid; gap: var(--s2); margin-top: var(--s5); }
.family-choice-btn {
  justify-content: space-between; min-height: 58px; height: auto; padding-block: var(--s2);
  text-align: left; white-space: normal;
}
.family-choice-btn > span { display: block; }
.family-choice-btn b, .family-choice-btn small { display: block; }
.family-choice-btn small { margin-top: 2px; color: var(--ink-3); font-size: var(--t-sm); }
.family-choice-btn svg { width: 16px; height: 16px; }
.panel-nav { margin-bottom: var(--s6); }
.panel-nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: 58px; padding: var(--s3) 0; border-bottom: 1px solid var(--line-soft);
}
.panel-nav button.panel-nav-item { width: 100%; text-align: left; border-top: 0; border-left: 0; border-right: 0; background: none; cursor: pointer; }
.panel-nav-item.is-selected { background: var(--accent-soft); margin-inline: calc(-1 * var(--s3)); padding-inline: var(--s3); }
.panel-nav-item > span { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px var(--s3); align-items: center; }
.panel-nav-item b { font-weight: 500; }
.panel-nav-item small { grid-column: 2; color: var(--ink-3); font-size: var(--t-sm); }
.panel-nav-item > svg { width: 16px; height: 16px; color: var(--ink-3); }
/* Строки сервисов не имеют ведущей иконки: это отдельная вертикальная
   типографическая группа, а не двухколоночная строка меню. */
.panel-nav-item > .panel-nav-copy {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.panel-nav-item > .panel-nav-copy b,
.panel-nav-item > .panel-nav-copy small {
  grid-column: auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.panel-nav-item > .panel-nav-copy small { line-height: 1.35; }
.map-view-list .panel-nav-item { align-items: flex-start; }
.map-view-list .panel-nav-item > span:first-child { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.map-view-list .panel-nav-item > span:first-child small { grid-column: 1; overflow-wrap: anywhere; line-height: 1.35; }
.map-view-list .panel-nav-item > .st { flex: none; align-self: center; }
.panel-acts-split { justify-content: space-between; }
.install-note { margin-top: var(--s3); }

/* ─────────── Адаптив ─────────── */

@container workspace (max-width: 760px) {
  .sc-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .pros { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container workspace (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1280px) {
  :root { --pad: 32px; --nav-w: 220px; }
}

@media (max-width: 1100px) {
  :root { --pad: 24px; --nav-w: 204px; }
  .sc-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
}

@media (max-width: 980px) and (min-width: 861px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
  :root {
    --pad: 20px;
    --table-pad: 0px;
    --t-b: .9375rem;
    --t-lg: 1rem;
    --t-sec: 1.375rem;
    --t-title: 1.75rem;
    --t-hero: 2rem;
  }

  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main {
    padding: 28px var(--pad) calc(96px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .top {
    min-height: calc(64px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) var(--pad) 8px;
    align-items: center;
  }
  .top-context { overflow: hidden; }
  .crumb-desktop { display: none; }
  .crumb-mobile {
    display: flex; align-items: baseline; gap: 7px;
    color: var(--ink-2); font-size: 15px; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .crumb-mobile b { color: var(--ink); font-weight: 600; }
  .crumb-mobile i { color: var(--ink-3); font-style: normal; }
  .top-sync {
    display: block; max-width: 100%; min-height: 24px; margin-top: 3px; padding: 0;
    border: 0; background: none; color: var(--ink-3); font-size: 12px;
    text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer;
  }
  .top-sync:disabled { cursor: default; opacity: 1; }
  .top-acts { margin-inline-start: auto; }
  /* На телефоне действия уже находятся в компактной шапке маршрута.
     Десктопная группа не должна дублировать поиск и экспорт. */
  .top-acts { display: none; }
  .top-acts .icon-btn { width: 48px; height: 48px; }
  #btn-export, #btn-sync { display: none; }
  body[data-view-role="client"] .top-acts { display: none; }

  .network-state {
    top: calc(64px + env(safe-area-inset-top));
    padding: 8px var(--pad);
  }

  .page-head { margin-bottom: 40px; }
  .page-head .t-hero { font-size: 30px; line-height: 1.12; }
  .page-head .t-lead { margin-top: 12px; font-size: 15px; line-height: 1.48; }
  .sec-head {
    margin-top: 44px; margin-bottom: 16px; padding-bottom: 10px;
    flex-wrap: wrap; align-items: flex-end;
  }
  .sec-head .t-sec { font-size: 21px; }
  .sec-head > .acts { width: 100%; }
  .foot { margin-top: 48px; }

  .btn { min-height: 48px; }
  .icon-btn { width: 48px; height: 48px; }
  .link { min-height: 48px; }
  .chip { min-height: 48px; padding-inline: 14px; }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: transparent; border: 0; column-gap: 18px; row-gap: 0;
  }
  .stat { padding: 14px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
  .stat dt { font-size: 12px; }
  .stat dd { margin-top: 5px; font-size: 21px; overflow-wrap: anywhere; }
  .stat dd.sm { font-size: 15px; line-height: 1.35; }
  .stat p { margin-top: 5px; font-size: 12px; line-height: 1.4; }

  /* Сегодня: вывод → действие → четыре опорных факта. */
  .today-state { position: relative; max-width: none; padding-inline-start: 18px; }
  .today-state::before {
    content: ""; position: absolute; inset: 4px auto 4px 0;
    width: 3px; background: var(--accent);
  }
  .today-date { font-size: 13px; }
  .today-head { margin-top: 10px; font-size: clamp(30px, 9vw, 34px); line-height: 1.08; }
  .today-lead { margin-top: 14px; font-size: 16px; line-height: 1.46; }
  .today-state .acts { margin-top: 20px; }
  .today-state .btn-primary { width: 100%; }
  .today-mobile-context {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    margin-top: 36px; border-block: 1px solid var(--line-soft);
  }
  .today-mobile-context > div {
    min-width: 0; padding: 11px 0 11px 16px; border-bottom: 1px solid var(--line-soft);
  }
  .today-mobile-context > div:last-child { border-bottom: 0; }
  .today-mobile-context .today-mobile-primary {
    grid-row: 1 / span 3; padding: 16px 16px 16px 0;
    border-right: 1px solid var(--line-soft); border-bottom: 0;
  }
  .today-mobile-context dt { color: var(--ink-3); font-size: 12px; }
  .today-mobile-context dd {
    margin: 3px 0 0; color: var(--ink); font-size: 17px; line-height: 1.2;
    font-variant-numeric: tabular-nums;
  }
  .today-mobile-context p { margin-top: 4px; color: var(--ink-3); font-size: 11px; }
  .today-mobile-primary dd { margin-top: 10px; font-size: clamp(27px, 8vw, 34px); letter-spacing: -.03em; }
  .today-grid { display: none; }
  .today-meta { margin-top: 18px; padding-top: 0; border-top: 0; gap: 2px 18px; }
  .today-meta .st, .today-meta > .t-quiet { display: none; }
  .today-meta .link { font-size: 13px; }
  .today .sec-head { margin-top: 48px; }
  .pros { grid-template-columns: minmax(0, 1fr); border-inline: 0; }
  .pro-card { min-height: 86px; padding-inline: 16px; }

  .mnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    min-height: calc(66px + env(safe-area-inset-bottom));
    background: var(--bg); background: color-mix(in srgb, var(--bg) 96%, transparent); border-top: 1px solid var(--line-soft);
    padding: 4px 4px env(safe-area-inset-bottom);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .mnav a, .mnav button {
    position: relative; flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 58px; padding: 5px 2px; border: 0; background: none;
    font-size: 10px; line-height: 1; color: var(--ink-3); cursor: pointer; white-space: nowrap;
  }
  .mnav svg { width: 20px; height: 20px; stroke-width: 1.75; }
  .mnav .is-active { color: var(--accent-2); font-weight: 600; }
  .mnav .is-active::after {
    content: ""; position: absolute; left: 32%; right: 32%; bottom: 1px;
    height: 2px; background: var(--accent);
  }

  /* Таблицы сохраняют семантику, визуально становятся мобильными строками. */
  .rows-scroll { overflow: visible; }
  .rows, .rows tbody { display: block; min-width: 0; width: 100%; }
  .rows colgroup, .rows thead { display: none; }
  .rows .row { display: block; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
  .rows .row .cell {
    display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr); gap: 12px;
    padding: 4px 0; border: 0; text-align: left; font-size: 14px;
  }
  .rows .cell::before { content: attr(data-l); color: var(--ink-3); font-size: 12px; font-weight: 400; }
  .rows .cell:first-child::before { display: none; }
  .rows .row .cell:first-child { display: block; padding-bottom: 5px; font-size: 16px; }
  .rows .row .cell.ta-r { text-align: left; }
  .row-main { min-height: 44px; }
  .row-chev { align-self: center; }

  .capital-assets .row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 16px; padding: 15px 0;
  }
  .capital-assets .row .cell { display: block; padding: 0; }
  .capital-assets .row .cell::before { display: none; }
  .capital-assets .row .cell:nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
  .capital-assets .row .cell:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; font-size: 15px; }
  .capital-assets .row .cell:nth-child(3) { grid-column: 1; grid-row: 3; color: var(--ink-3); font-size: 12px; padding-inline-start: 0; }
  .capital-assets .row .cell:nth-child(4) { grid-column: 2; grid-row: 3; text-align: right; }
  .capital-assets .row-main { align-items: flex-start; min-height: 48px; }
  .capital-assets .row-main b { font-size: 16px; line-height: 1.3; }
  .capital-assets .row-main small { margin-top: 4px; font-size: 12px; }
  .capital-assets .row-chev { display: none; }
  .capital-assets .st { font-size: 12px; }
  .capital-assets .cell:nth-child(2) small { font-size: 11px; }

  .rates { margin-top: 12px; }
  .rates-list { gap: 8px 16px; }
  .rates-list > div { font-size: 12px; }
  .filters .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--pad)); padding-inline: var(--pad); scrollbar-width: none; }
  .filters .chip { flex: none; }
  .filters .chips::-webkit-scrollbar { display: none; }

  .map-tabs-desktop { display: none; }
  .map-tabs-mobile { display: flex; align-items: flex-end; gap: 20px; min-width: 0; }
  .map-tabs-mobile .map-tab { min-width: 48px; min-height: 48px; padding-bottom: 9px; }
  .map-tabs-mobile .map-tab::after { bottom: 0; }
  .map-tab-more { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
  .map-tab-more svg { width: 14px; height: 14px; }
  .map-wrap { margin-inline: calc(-1 * var(--pad)); overflow: hidden; border-color: var(--line-soft); }
  .map { min-width: 0; width: 100%; aspect-ratio: 2 / 3; touch-action: manipulation; }
  .map-node .map-name { font-size: 10px; }
  .map-node .map-disc { stroke-width: 1.5; }
  .map-tools { min-height: 56px; padding: 6px var(--pad); }
  .map-tools .link { min-height: 44px; padding: 0; font-size: 15px; }
  .map-tools .t-quiet { display: none; }
  .map-legend { padding: 10px var(--pad); gap: 8px 16px; font-size: 11px; }
  .map-legend span:nth-child(4) { display: none; }

  /* Развёрнутая карта — отдельный рабочий холст, а не неочевидный reset. */
  .panel[data-kind="map-full"] { inset: 0; max-height: none; border: 0; border-radius: 0; }
  .panel[data-kind="map-full"] .panel-handle { display: none; }
  .panel[data-kind="map-full"] .panel-head { padding-top: calc(18px + env(safe-area-inset-top)); }
  .panel[data-kind="map-full"] .panel-body { display: flex; flex: 1 1 auto; flex-direction: column; padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); overflow: hidden; }
  .map-full-controls { flex: none; padding: 0 var(--pad); overflow-x: auto; scrollbar-width: none; }
  .map-full-controls::-webkit-scrollbar { display: none; }
  .map-tabs-full { flex-wrap: nowrap; gap: 18px; width: max-content; }
  .map-tabs-full .map-tab { min-height: 44px; font-size: 13px; }
  .map-wrap-expanded { display: flex; flex: 1 1 auto; flex-direction: column; margin-top: 10px; margin-inline: 0; border-top: 1px solid var(--line-soft); }
  .map-wrap-expanded .map { flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; }
  .map-wrap-expanded .map-tools { flex: none; padding-inline: var(--pad); }
  .map-wrap-expanded .map-legend { display: none; }
  .map-full-note { flex: none; margin: 10px var(--pad) 0; color: var(--ink-3); font-size: 11px; line-height: 1.4; }

  .sc-mobile-impact { display: grid; gap: 8px; }
  .sc-context { margin-top: 26px; border-block: 1px solid var(--line-soft); }
  .sc-context summary { display: flex; align-items: center; min-height: 52px; color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }
  .sc-context p { padding: 0 0 14px; color: var(--ink-3); font-size: 12px; line-height: 1.45; }
  .sc-impact-item { padding: 16px; border-radius: 16px; background: var(--surface); }
  .sc-impact-item > span { display: block; color: var(--ink-3); font-size: 12px; }
  .sc-impact-item b { display: block; margin-top: 8px; font-size: 22px; line-height: 1.1; font-weight: 600; letter-spacing: -.025em; }
  .sc-impact-item b .delta { color: var(--ink); }
  .sc-impact-item small { display: block; margin-top: 8px; color: var(--ink-3); font-size: 11px; }
  .sc-impact-details { border-top: 1px solid var(--line-soft); }
  .sc-impact-details summary { min-height: 52px; display: flex; align-items: center; color: var(--accent-2); font-size: 14px; cursor: pointer; }
  .sc-impact-details > div { padding: 0 0 8px; }
  .sc-impact-details p { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line-soft); color: var(--ink-3); font-size: 12px; }
  .sc-impact-details p b { color: var(--ink); font-weight: 500; text-align: right; white-space: nowrap; }

  /* Будущее становится осью, а не набором одинаковых строк. */
  .horizon { margin-top: 42px; }
  .horizon-head { padding: 0 0 10px; border-bottom-color: var(--line); }
  .horizon-head h2 { font-size: 18px; }
  .tl-row {
    position: relative; display: grid;
    grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px;
    min-height: 88px; padding: 16px 8px 16px 36px;
    border-bottom: 0; border-radius: var(--r);
  }
  .tl-row::before {
    content: ""; position: absolute; left: 10px; top: 0; bottom: 0;
    width: 1px; background: var(--line);
  }
  .tl-row::after {
    content: ""; position: absolute; left: 6px; top: 24px;
    width: 9px; height: 9px; border: 1px solid var(--ink-3); border-radius: 50%; background: var(--bg);
  }
  .tl-row.is-nearest { background: var(--accent-soft); }
  .tl-row.is-nearest::after { border-color: var(--accent); background: var(--accent); }
  .tl-row.is-nearest .tl-copy small { color: var(--ink-2); }
  .tl-date { grid-column: 1; grid-row: 1; font-size: 12px; }
  .tl-copy { grid-column: 1; grid-row: 2; }
  .tl-copy b { font-size: 16px; line-height: 1.35; }
  .tl-copy small { font-size: 12px; }
  .tl-amt { grid-column: 1; grid-row: 3; text-align: left; font-size: 13px; color: var(--ink-2); }
  .tl-row .row-chev { grid-column: 2; grid-row: 1 / span 3; align-self: center; }

  .family-person { padding: 20px 0; }
  .family-person-grid { display: block; }
  .family-person-main .t-sub { font-size: 18px; }
  .family-person-fact { margin-top: 11px; font-size: 14px; }
  .family-person-detail { margin-top: 12px; }
  .family-person-detail .pairs > div { padding: 8px 0; font-size: 12px; }

  .queue-filter-trigger { display: inline-flex; margin: 0 0 12px; }
  .queue-filter-trigger span {
    display: inline-grid; place-items: center; min-width: 22px; height: 22px;
    border-radius: 11px; background: var(--ink); color: var(--bg); font-size: 11px;
  }
  .queue-filters-inline { display: none; }
  .advisor-queue .stats { margin-bottom: 8px; }
  .advisor-queue .stat p { display: none; }
  .advisor-queue .rows .row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 14px;
    padding: 16px 0;
  }
  .advisor-queue .rows .cell { display: block; padding: 0; }
  .advisor-queue .rows .cell::before { display: none; }
  .advisor-queue .rows .cell:nth-child(1) { grid-column: 1; grid-row: 1; font-size: 13px; color: var(--ink-2); }
  .advisor-queue .rows .cell:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .advisor-queue .rows .cell:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; }
  .advisor-queue .rows .cell:nth-child(4) { grid-column: 1; grid-row: 3; }
  .advisor-queue .rows .cell:nth-child(5) { grid-column: 1 / -1; grid-row: 4; color: var(--ink-3); font-size: 12px; }
  .advisor-queue .row-main { min-height: 32px; }
  .advisor-queue .row-main b { font-size: 16px; }
  .advisor-queue .row-main small { font-size: 12px; }
  .advisor-queue .row-chev { display: none; }
  .queue-filters-sheet { display: grid; gap: 28px; margin-top: 4px; }
  .queue-filters-sheet .chips { gap: 8px; }
  .demo-panel-field { margin: 10px 0 0; }
  .demo-panel-field select { min-height: 48px; }

  .hist-row { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); }
  .hist-track { grid-column: 1 / -1; }

  .panel {
    --sheet-drag-y: 0px;
    inset: auto 0 0; width: 100%; height: auto; max-height: 90dvh; margin: auto 0 0;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% + var(--sheet-drag-y)));
  }
  .panel.is-open { transform: translateY(var(--sheet-drag-y)); }
  .panel.is-dragging { transition: none; }
  .panel-handle {
    display: block; position: absolute; top: 7px; left: 50%; z-index: 2;
    width: 36px; height: 4px; border-radius: 2px; background: var(--line);
    transform: translateX(-50%); touch-action: pan-x;
  }
  .panel-head { padding: 24px var(--pad) 14px; touch-action: pan-x; }
  .panel-head .icon-btn { margin: -8px -10px 0 0; }
  .panel-body { padding: 20px var(--pad) calc(28px + env(safe-area-inset-bottom)); }
  .panel-acts { gap: 10px; }
  .panel-acts .btn-primary { flex: 1 1 auto; }
  .panel-nav-item { min-height: 64px; }

  .search { padding: calc(10px + env(safe-area-inset-top)) 10px 10px; }
  .search-box { max-height: calc(100dvh - env(safe-area-inset-top) - 20px); }

  .ev-meta { gap: var(--s4); }
  .demo { display: none !important; }
  .toast { bottom: calc(74px + env(safe-area-inset-bottom)); }

  /* Мобильная оболочка: знакомая финансовая грамматика, содержание Wealth OS. */
  .main {
    padding-top: 18px;
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }
  .top {
    min-height: calc(72px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) var(--pad) 8px;
    border-bottom: 0;
  }
  .top-context, .crumb { width: 100%; }
  .top-sync { display: none; }
  .crumb-mobile.mobile-appbar {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center; gap: 10px; width: 100%;
    overflow: visible; color: var(--ink); font-size: inherit;
  }
  .mobile-profile, .mobile-appbar-button, .mobile-advisor-button {
    display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: var(--surface-2); cursor: pointer;
  }
  .mobile-profile span, .mobile-advisor-button span {
    font-size: 11px; line-height: 1; letter-spacing: .04em; font-weight: 600;
  }
  .mobile-appbar-copy {
    display: grid; min-width: 0; text-align: center; line-height: 1.2;
  }
  .mobile-appbar-copy b {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ink); font-size: 15px; font-weight: 600;
  }
  .mobile-appbar-copy small {
    margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--ink-3); font-size: 11px;
  }
  .mobile-appbar-actions { display: flex; gap: 2px; }
  .mobile-appbar-button { background: none; }
  .mobile-appbar-button svg { width: 21px; height: 21px; }
  .mobile-advisor-button {
    position: relative; background: var(--ink); color: var(--bg);
  }
  .mobile-advisor-button::after {
    content: ""; position: absolute; right: 1px; bottom: 2px;
    width: 9px; height: 9px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent);
  }
  .mobile-advisor-button.is-access-off { background: var(--surface-2); color: var(--ink-2); }
  .mobile-advisor-button.is-access-off::after { background: var(--ink-3); }
  .mobile-appbar-advisor { grid-template-columns: 44px minmax(0, 1fr) 44px; }

  .mnav {
    left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto; max-width: 560px; min-height: 64px; height: 64px; margin-inline: auto;
    padding: 4px; border: 1px solid var(--line); border-radius: 24px;
    background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .mnav a, .mnav button {
    min-height: 54px; padding: 5px 3px; border-radius: 18px;
  }
  .mnav .is-active { background: var(--accent-soft); }
  .mnav .is-active::after { display: none; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }

  .mobile-today-app, .mobile-screen-summary { display: block; }
  .today-desktop { display: none; }
  .mobile-today-hero { display: grid; gap: 14px; }

  .mobile-overline {
    color: var(--ink-3); font-size: 12px; line-height: 1.35; letter-spacing: .02em;
  }
  /* Сумма и валюта — две разные цели: тап по сумме объясняет её происхождение */
  .mobile-currency {
    display: inline-flex; align-items: center; gap: 3px; flex: none;
    min-height: 30px; padding: 0 9px; border: 0; border-radius: 100px;
    background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 600;
  }
  button.mobile-currency { min-height: 44px; padding-inline: 12px; cursor: pointer; }
  .mobile-currency svg { width: 12px; height: 12px; }
  .mobile-info {
    display: inline-grid; place-items: center; width: 18px; height: 18px;
    border: 1px solid var(--control-line); border-radius: 50%; color: var(--ink-3); font-size: 11px;
  }

  /* Изменение с контрольной даты: отвечает на вопрос экрана, в отличие
     от самой суммы капитала, которая на «Сегодня» больше не показывается */
  .mobile-brief-change {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 44px; margin-top: 4px; padding: 0;
    border: 0; background: none; color: var(--ink-2);
    font-size: 13px; font-variant-numeric: tabular-nums; text-align: left; cursor: pointer;
  }

  .mobile-brief {
    padding: 19px 20px 20px; border-radius: 20px; background: var(--surface);
  }
  .mobile-brief-decision, .mobile-brief-source { background: var(--accent-soft); }
  .mobile-brief-kicker {
    display: flex; justify-content: space-between; gap: 12px;
    color: var(--ink-3); font-size: 11px; line-height: 1.3;
  }
  .mobile-brief-kicker span { color: var(--accent-2); font-weight: 600; }
  .mobile-brief h1 {
    margin-top: 13px; font-size: 25px; line-height: 1.13; letter-spacing: -.028em; font-weight: 600;
    text-wrap: balance;
  }
  .mobile-brief > p { margin-top: 11px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
  .mobile-brief-calm > .mobile-brief-lead {
    margin-top: 9px; color: var(--ink); font-size: 25px; line-height: 1.13;
    letter-spacing: -.028em; font-weight: 600;
  }
  .mobile-brief-action, .mobile-brief-link {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; min-height: 48px; margin-top: 17px; padding: 0 15px;
    border: 0; border-radius: 14px; cursor: pointer; font-size: 14px; font-weight: 500;
  }
  .mobile-brief-action { background: var(--accent); color: var(--on-accent); }
  .mobile-brief-link { justify-content: flex-start; padding: 0; background: none; color: var(--accent-2); }
  .mobile-brief-action svg, .mobile-brief-link svg { width: 16px; height: 16px; }

  .mobile-section { margin-top: 38px; }
  .mobile-section-head {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px;
  }
  .mobile-section-head h2 { font-size: 20px; line-height: 1.25; letter-spacing: -.018em; font-weight: 600; }
  .mobile-section-head a {
    display: inline-flex; align-items: center; min-height: 44px; color: var(--accent-2); font-size: 12px;
  }

  .mobile-capital-rail, .mobile-goal-rail, .mobile-family-rail {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(154px, 43vw); gap: 10px;
    margin: 2px calc(-1 * var(--pad)) 0; padding: 2px var(--pad) 6px;
    overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: inline proximity;
    scroll-padding-inline: var(--pad);
    scrollbar-width: none;
  }
  .mobile-capital-rail::-webkit-scrollbar, .mobile-goal-rail::-webkit-scrollbar, .mobile-family-rail::-webkit-scrollbar { display: none; }
  .mobile-capital-rail li, .mobile-goal-rail li, .mobile-family-rail li { min-width: 0; scroll-snap-align: start; }
  .mobile-capital-card {
    display: flex; flex-direction: column; min-height: 138px; padding: 16px;
    width: 100%; border: 1px solid transparent; border-radius: 18px; background: var(--surface);
    color: inherit; text-align: left; cursor: pointer;
  }
  .mobile-capital-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }
  .mobile-card-label { color: var(--ink-2); font-size: 13px; line-height: 1.3; }
  .mobile-capital-card b {
    margin-top: 10px; font-size: 21px; line-height: 1.15; letter-spacing: -.025em;
    font-weight: 600; font-variant-numeric: tabular-nums;
  }
.mobile-capital-card small { margin-top: auto; padding-top: 12px; color: var(--ink-3); font-size: 10px; line-height: 1.35; }

/* На телефоне «Капитал» — выбор класса и вход в детали. Полная карта
     остаётся рабочим десктопным представлением и не конкурирует с обзором. */
.mobile-capital-selection { display: none; }
  .capital-page .capital-desktop-content { display: none; }
  .mobile-capital-selection { display: block; margin-top: 28px; padding: 0; border-top: 1px solid var(--line-soft); }
  .mobile-capital-selection-empty { padding: 18px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.45; }
  .mobile-capital-back {
    display: inline-flex; align-items: center; min-height: 44px; margin-top: 5px; padding: 0;
    border: 0; background: none; color: var(--accent-2); font-size: 12px; font-weight: 600; cursor: pointer;
  }
  .mobile-capital-selection-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 18px 0; }
  .mobile-capital-selection-head > div { min-width: 0; }
  .mobile-capital-selection-head p { color: var(--ink-3); font-size: 12px; }
  .mobile-capital-selection-head h2 { margin-top: 5px; font-size: 21px; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; }
  .mobile-capital-selection-head > b { flex: none; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .mobile-capital-finding { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; line-height: 1.45; }
  .mobile-capital-details { border-top: 1px solid var(--line-soft); }
  .mobile-capital-details li + li { border-top: 1px solid var(--line-soft); }
  .mobile-capital-details a, .mobile-capital-details button { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; gap: 10px; align-items: center; width: 100%; min-height: 64px; padding: 12px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
  .mobile-capital-details a span, .mobile-capital-details button span { min-width: 0; }
  .mobile-capital-details a b, .mobile-capital-details a small, .mobile-capital-details button b, .mobile-capital-details button small { display: block; }
  .mobile-capital-details a b, .mobile-capital-details button b { font-size: 14px; line-height: 1.3; font-weight: 600; }
  .mobile-capital-details a small, .mobile-capital-details button small { margin-top: 4px; color: var(--ink-3); font-size: 12px; line-height: 1.3; }
  .mobile-capital-details a strong, .mobile-capital-details button strong { font-size: 14px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .mobile-capital-details a strong small, .mobile-capital-details button strong small { display: none; }
  .mobile-capital-details a svg, .mobile-capital-details button svg { width: 16px; color: var(--ink-3); }

  .mobile-capital-profile-shell { border-top: 0; }
  .mobile-capital-profile {
    position: relative; isolation: isolate; overflow: hidden;
    padding: 22px 20px 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface);
  }
  .mobile-capital-profile::after {
    content: ""; position: absolute; z-index: -1; top: -58px; right: -58px;
    width: 132px; height: 132px; opacity: .8; pointer-events: none;
    background: repeating-radial-gradient(circle at center, transparent 0 10px, var(--line-soft) 11px 12px);
  }
  .mobile-capital-profile-overline, .mobile-capital-profile-label {
    color: var(--ink-3); font-size: 11px; line-height: 1.35; letter-spacing: .11em;
    text-transform: uppercase; font-weight: 600;
  }
  .mobile-capital-profile h2 {
    max-width: 16ch; margin-top: 12px; font-size: 25px; line-height: 1.15;
    letter-spacing: -.028em; font-weight: 600;
  }
  .mobile-capital-profile-body { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
  .capital-profile-metrics { margin-top: 21px; }
  .capital-profile-metric + .capital-profile-metric { margin-top: 20px; }
  .capital-profile-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .capital-profile-copy dt { min-width: 0; font-size: 14px; line-height: 1.35; font-weight: 500; }
  .capital-profile-copy dd {
    flex: none; color: var(--ink-2); font-size: 12px; line-height: 1.35;
    font-variant-numeric: tabular-nums; white-space: nowrap;
  }
  .capital-profile-scale {
    --profile-position: 50%;
    position: relative; height: 18px; margin-top: 5px;
    background-image: linear-gradient(to right, var(--control-line) 0 1px, transparent 1px);
    background-position: left center; background-repeat: repeat-x; background-size: 25% 8px;
  }
  .capital-profile-scale::before {
    content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 1px; background: var(--control-line);
  }
  .capital-profile-scale::after {
    content: ""; position: absolute; top: 3px; left: calc(var(--profile-position) - 6px);
    width: 12px; height: 12px; border: 2px solid var(--surface); border-radius: 50%;
    background: var(--accent); outline: 1px solid var(--accent);
  }
  .mobile-capital-profile-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-height: 58px; margin-top: 18px; padding: 0;
    border: 0; border-top: 1px solid var(--line); background: none;
    color: var(--ink); font-size: 14px; text-align: left; cursor: pointer;
  }
  .mobile-capital-profile-link svg { width: 16px; color: var(--ink-3); }
  .mobile-capital-profile-date { margin: 11px 4px 0; color: var(--ink-3); font-size: 11px; }

  .mobile-action-list { overflow: hidden; border-radius: 20px; background: var(--surface); }
  .mobile-action-list li + li { border-top: 1px solid var(--line-soft); }
  .mobile-action-list a {
    display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 3px 12px;
    min-height: 106px; padding: 16px 17px;
  }
  .mobile-action-date { grid-column: 1; color: var(--accent-2); font-size: 11px; font-weight: 600; }
  .mobile-action-list b { grid-column: 1; font-size: 15px; line-height: 1.35; font-weight: 600; }
  .mobile-action-list small { grid-column: 1; color: var(--ink-3); font-size: 11px; }
  .mobile-action-list svg { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: 16px; color: var(--ink-3); }
  .mobile-empty { padding: 18px; border-radius: 18px; background: var(--surface); color: var(--ink-3); font-size: 13px; }

  .mobile-service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mobile-service {
    display: flex; flex-direction: column; align-items: flex-start; gap: 17px;
    width: 100%; min-height: 132px; padding: 17px; border: 0; border-radius: 18px;
    background: var(--surface); text-align: left; cursor: pointer;
  }
  .mobile-service.is-featured { background: var(--accent-soft); }
  .mobile-service > svg { width: 21px; height: 21px; color: var(--ink-2); }
  .mobile-service span { display: grid; gap: 5px; margin-top: auto; }
  .mobile-service b { font-size: 14px; line-height: 1.25; font-weight: 600; }
  .mobile-service small { color: var(--ink-3); font-size: 10px; line-height: 1.35; }

  .mobile-advisor-card {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    width: 100%; min-height: 78px; padding: 13px 15px; border: 0; border-radius: 18px;
    background: var(--surface); text-align: left; cursor: pointer;
  }
  .mobile-advisor-avatar, .mobile-person-avatar {
    display: inline-grid; place-items: center; width: 44px; height: 44px;
    border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600;
  }
  .mobile-advisor-card > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
  .mobile-advisor-card b { font-size: 14px; font-weight: 600; }
  .mobile-advisor-card small { color: var(--ink-3); font-size: 10px; line-height: 1.35; }
  .mobile-advisor-link { color: var(--accent-2); font-size: 11px; }
  .mobile-demo-note { margin-top: 30px; color: var(--ink-3); font-size: 10px; text-align: center; }

  .capital-page > .page-head, .future-page > .page-head, .family-page > .page-head,
  .capital-page > .stats, .future-page > .stats, .capital-currency-desktop { display: none; }
  .mobile-screen-summary { padding-top: 2px; }
  .mobile-summary-value {
    min-width: 0; padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: clamp(26px, 7.4vw, 32px); line-height: 1.05;
    letter-spacing: -.035em; font-weight: 600; font-variant-numeric: tabular-nums;
    color: inherit; text-align: left; white-space: nowrap;
  }
  .mobile-summary-value-row { display: flex; align-items: center; gap: 9px; margin-top: 7px; }
  .mobile-summary-value {
    min-width: 0; padding: 0; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: clamp(26px, 7.4vw, 32px); line-height: 1.05;
    letter-spacing: -.035em; font-weight: 600; font-variant-numeric: tabular-nums;
    color: inherit; text-align: left; white-space: nowrap;
  }
  .mobile-summary-value-row > b {
    min-width: 0; font-size: clamp(31px, 9vw, 39px); line-height: 1.05;
    letter-spacing: -.04em; font-weight: 600; font-variant-numeric: tabular-nums;
  }
  .mobile-summary-facts {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 20px; border-block: 1px solid var(--line-soft);
  }
  .mobile-summary-facts > div { min-width: 0; padding: 14px 14px 14px 0; }
  .mobile-summary-facts > div + div { padding-left: 14px; border-left: 1px solid var(--line-soft); }
  .mobile-summary-facts dt { color: var(--ink-3); font-size: 11px; }
  .mobile-summary-facts dd {
    margin-top: 5px; overflow-wrap: anywhere; font-size: 19px; line-height: 1.2;
    letter-spacing: -.018em; font-weight: 600; font-variant-numeric: tabular-nums;
  }
  .mobile-summary-facts small { display: block; margin-top: 4px; color: var(--ink-3); font-size: 10px; line-height: 1.35; }
  .mobile-capital-summary .mobile-capital-rail { margin-top: 22px; }
  .capital-page > .sec-head:first-of-type { margin-top: 42px; }

  .mobile-future-date {
    display: block; margin-top: 9px; font-size: 31px; line-height: 1.08;
    letter-spacing: -.035em; font-weight: 600; font-variant-numeric: tabular-nums;
  }
  .mobile-future-summary > h2 { margin-top: 9px; font-size: 18px; line-height: 1.32; font-weight: 600; }
  .mobile-future-summary > p:not(.mobile-overline) { margin-top: 5px; color: var(--ink-3); font-size: 12px; }
  .mobile-goal-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 30px; }
  .mobile-goal-label { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
  .mobile-goal-heading .goal-edit-trigger { min-height: 44px; font-size: 12px; }
  .mobile-goal-rail { margin-top: 10px; }
  .mobile-goal-rail button {
    display: flex; flex-direction: column; width: 100%; min-height: 132px; padding: 15px;
    border: 0; border-radius: 18px; background: var(--surface); text-align: left; cursor: pointer;
  }
  .mobile-goal-rail span { color: var(--ink-3); font-size: 10px; }
  .mobile-goal-rail b { margin-top: 11px; font-size: 14px; line-height: 1.35; font-weight: 600; }
  .mobile-goal-rail small { margin-top: auto; padding-top: 10px; color: var(--ink-2); font-size: 11px; }

  .mobile-family-summary > h2 { margin-top: 8px; font-size: 27px; line-height: 1.12; letter-spacing: -.03em; font-weight: 600; }
  .mobile-family-summary > p:not(.mobile-overline) { margin-top: 10px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
  .mobile-family-rail { grid-auto-columns: minmax(150px, 42vw); margin-top: 22px; }
  /* Карточка стала кнопкой: раньше человек нажимал и ничего не происходило */
  .mobile-family-rail li { display: block; }
  .mobile-family-rail li button {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 16px; gap: 2px 11px; align-items: center;
    width: 100%; min-height: 78px; padding: 12px; border: 0; border-radius: 18px;
    background: var(--surface); color: inherit; text-align: left; cursor: pointer;
  }
  .mobile-family-rail .mobile-person-avatar { grid-row: 1 / span 2; }
  .mobile-family-rail b { grid-column: 2; align-self: end; font-size: 13px; line-height: 1.25; font-weight: 600; }
  .mobile-family-rail small { grid-column: 2; align-self: start; color: var(--ink-3); font-size: 10px; }
  .mobile-family-rail li button svg { grid-column: 3; grid-row: 1 / span 2; align-self: center; width: 16px; color: var(--ink-3); }
  .mobile-access-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 3px 12px;
    width: 100%; min-height: 68px; margin-top: 12px; padding: 13px 15px;
    border: 0; border-radius: 18px; background: var(--surface); text-align: left; cursor: pointer;
  }
  .mobile-access-row span { grid-column: 1; color: var(--ink-3); font-size: 10px; }
  .mobile-access-row b { grid-column: 1; font-size: 13px; font-weight: 600; }
  .mobile-access-row svg { grid-column: 2; grid-row: 1 / span 2; align-self: center; width: 16px; color: var(--ink-3); }

  .access-controls { display: grid; margin-top: 10px; border-top: 1px solid var(--line); }
  .access-permission { padding-bottom: 10px; }
  .access-toggle {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 38px; gap: 10px; align-items: center;
    width: 100%; min-height: 68px; padding: 12px 0 6px; border: 0;
    background: none; color: var(--ink); text-align: left; cursor: pointer;
  }
  .access-toggle > span:first-child { min-width: 0; display: grid; gap: 3px; }
  .access-toggle b { font-size: 14px; line-height: 1.25; font-weight: 600; }
  .access-toggle small { color: var(--ink-3); font-size: 11px; line-height: 1.35; }
  .access-toggle-state { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
  .access-toggle-track { position: relative; width: 38px; height: 22px; border-radius: 20px; background: var(--control-line); transition: background .18s ease; }
  .access-toggle-track i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform .18s ease; }
  .access-toggle[aria-pressed="true"] .access-toggle-track { background: var(--accent); }
  .access-toggle[aria-pressed="true"] .access-toggle-track i { transform: translateX(16px); }
  .access-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .access-check { min-height: 40px; }

  /* Карточка доступа завершает мобильное резюме семьи. Следующий рабочий
     раздел должен читаться как новый уровень, а не как подпись к карточке. */
  .family-page > .sec-head:first-of-type { margin-top: 38px; }

  .currency-choice-item { min-height: 68px; }
}

@media (max-width: 340px) {
  :root { --pad: 16px; }
  .main { padding-top: 24px; }
  .mnav a, .mnav button { font-size: 9px; }
  .crumb-mobile.mobile-appbar { gap: 6px; }
  .mobile-profile, .mobile-appbar-button, .mobile-advisor-button { width: 42px; height: 42px; }
  .mobile-service { min-height: 124px; padding: 15px; }
  .today-mobile-primary dd { font-size: 26px; }
  .map-tabs-mobile { gap: 12px; }
  .map-tabs-mobile .map-tab { font-size: 12px; }
}

@media (min-width: 600px) and (max-width: 719px) {
  :root { --pad: 32px; }
  .main { padding-top: 36px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 24px; }
  .today-mobile-context { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .today-mobile-context > div,
  .today-mobile-context .today-mobile-primary {
    grid-row: auto; padding: 16px; border-right: 1px solid var(--line-soft); border-bottom: 0;
  }
  .today-mobile-context > div:first-child { padding-left: 0; }
  .today-mobile-context > div:last-child { border-right: 0; }
  .today-mobile-primary dd { font-size: 27px; }
  .map-wrap { margin-inline: 0; }
  .map-tools, .map-legend { padding-inline: 16px; }
  .mobile-today-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  /* Изменение с контрольной даты: отвечает на вопрос экрана, в отличие
     от самой суммы капитала, которая на «Сегодня» больше не показывается */
  .mobile-brief-change {
    display: inline-flex; align-items: center; gap: 7px;
    min-height: 44px; margin-top: 4px; padding: 0;
    border: 0; background: none; color: var(--ink-2);
    font-size: 13px; font-variant-numeric: tabular-nums; text-align: left; cursor: pointer;
  }

  .mobile-brief { min-height: 100%; }
  .mobile-capital-rail, .mobile-goal-rail, .mobile-family-rail { grid-auto-columns: 210px; }
  .mobile-service-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-service { min-height: 140px; }
}

@media (min-width: 680px) and (max-width: 719px) {
  .map { aspect-ratio: 23 / 15; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .capital-profile-scale::before { background: CanvasText; }
  .capital-profile-scale::after { border-color: Canvas; background: Highlight; outline-color: Highlight; }
}

/* ─────────── Печатный документ ─────────── */

.printdoc { display: none; }

.picks li { border-bottom: 1px solid var(--line-soft); }
.picks label {
  display: flex; align-items: center; gap: var(--s3);
  min-height: 46px; cursor: pointer;
}
.picks input { width: 17px; height: 17px; accent-color: var(--accent); }

@media print {
  .printdoc { display: block; }
  .doc { font: 400 10.5pt/1.45 var(--font); color: #000; }
  .doc header { margin-bottom: 22pt; padding-bottom: 10pt; border-bottom: 1pt solid #000; }
  .doc-brand { font-size: 8pt; letter-spacing: 0.24em; font-weight: 700; }
  .doc h1 { font-size: 20pt; margin-top: 8pt; letter-spacing: -0.02em; }
  .doc-sub { font-size: 9.5pt; color: #444; margin-top: 4pt; }
  .doc section { margin-bottom: 18pt; break-inside: avoid; }
  .doc h2 { font-size: 12pt; margin-bottom: 6pt; padding-bottom: 3pt; border-bottom: 0.5pt solid #999; }
  .doc table { width: 100%; border-collapse: collapse; }
  .doc th {
    text-align: left; font-size: 7.5pt; letter-spacing: 0.08em; text-transform: uppercase;
    color: #555; font-weight: 600; padding: 4pt 6pt 4pt 0; border-bottom: 0.5pt solid #000;
  }
  .doc td { padding: 4pt 6pt 4pt 0; border-bottom: 0.4pt solid #ddd; vertical-align: top; }
  .doc td:nth-child(n+3) { text-align: right; white-space: nowrap; }
  .doc .doc-total td { font-weight: 600; border-top: 0.5pt solid #000; border-bottom: none; }
  .doc footer { margin-top: 20pt; padding-top: 8pt; border-top: 0.5pt solid #999; font-size: 8pt; color: #444; }
  @page { margin: 16mm 14mm; }

  .side, .top, .mnav, .demo, .panel, .scrim, .search, .toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
}
