/* Стили сайта. Раньше лежали инлайном в base.html: 57 КБ, которые не кэшировались
   никогда и приезжали заново при каждом переходе между страницами. Здесь их забирает
   браузер один раз — статика версионируется (?v=, core/storage.py) и отдаётся с
   Cache-Control: immutable на год, а nginx отдаёт готовый .gz (gzip_static).

   В base.html инлайном остались только сброс и @font-face: шрифты нужны первому экрану,
   и их URL собирает {% static %}, которого в статическом css быть не может. */

:root {
    --font-ui: 'FV Digits', 'Wix Madefor Text', system-ui, sans-serif;
    --font-head: 'FV Digits', 'Bitter', Georgia, serif;
    /* тикеры, ISIN, промокоды — там, где раньше стоял системный моноширинный */
    --font-num: 'Golos Text', system-ui, sans-serif;
    /* Тема у сайта одна - тёмная. Без этого браузер считает страницу светлой и рисует
       нативные элементы белыми: выпадающий список datalist (конвертер крипты), полосы
       прокрутки, автозаполнение, календари. */
    color-scheme: dark;
    --bg: #0e1016;
    --bg2: #171a23;
    --bg3: #20242f;
    --border: #292d3a;
    --border2: #343a4a;
    --text: #e9ebf4;
    --text2: #8d93ad;
    /* Бренд-акцент: благородный индиго-блю (не «шаблонный» фиолет). */
    --accent: #4f70e6;
    --accent2: #6f8cf0;
    --accent-press: #3f5cc8;
    --accent-soft: rgba(79,112,230,.12);
    --accent-ring: rgba(79,112,230,.40);
    --green: #2bb673;
    --green-soft: rgba(43,182,115,.14);
    --red: #f0544f;
    --red-soft: rgba(240,84,79,.14);
    --yellow: #e8a13a;
    --radius: 12px;
    --radius-sm: 9px;
    --radius-lg: 16px;
    /* Тени мягче и слоистее — без «парящего» template-glow. */
    --shadow: 0 1px 2px rgba(0,0,0,.30), 0 4px 16px rgba(0,0,0,.22);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.45);
    /* Сильные easing-кривые (Emil Kowalski) — у дефолтных нет «характера». */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

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

/* Доступный фокус по всему сайту (раньше outline был везде убран). */
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* Первый табстоп страницы: «Перейти к содержимому». Вне фокуса скрыт,
   по Tab появляется в левом верхнем углу — минуя меню и служебные ссылки. */
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 2000;
    padding: 10px 16px; background: var(--accent); color: #fff;
    font-weight: 600; text-decoration: none; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

::selection { background: var(--accent-soft); color: var(--text); }
/* В полях ввода выделение делаем контрастным: бледный хайлайт (accent-soft, 12%)
   сливался с белым текстом и «прятал» выделенный пароль. Сплошной акцент + белый читаются. */
input::selection, textarea::selection { background: var(--accent); color: #fff; }

/* Тонкие скроллбары в стиле тёмной темы — вместо чужеродных дефолтных «ползунков».
   Покрывает все блоки с overflow (таблицы, скринер, чат, палитра) и страницу. */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }  /* Firefox */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 8px;
    border: 2px solid transparent;   /* отступ от краёв → «плавающий» тонкий бегунок */
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #4a5268; }
::-webkit-scrollbar-corner { background: transparent; }

body {
    font-family: var(--font-ui);
    /* у Golos цифры пропорциональные по умолчанию — колонки чисел держим на tnum */
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
#main-content { flex: 1; }

/* ── Поведение под пальцем ───────────────────────────────────────────────
   Три вещи, по которым тач-интерфейс на вебе узнают сразу.

   1. Серый прямоугольник, которым Chrome заливает ссылку при тапе. В нативных
      приложениях его нет; вместо него у нас свои `:active` ниже.
   2. Пауза перед реакцией: браузер ждёт, не будет ли второго тапа (двойной тап =
      зум). `manipulation` отключает зум по двойному тапу и отвечает сразу; пинч
      двумя пальцами остаётся.
   3. Выделение текста при чуть более долгом нажатии. На абзацах и числах оно
      нужно (скопировать цену), на кнопках и пунктах меню — это промах: вместо
      перехода человек получает синюю подсветку и лупу. */
/* Только для устройств с пальцем вместо курсора: на десктопе поведение сайта
   остаётся прежним — там и подсветки тапа нет, и выделять текст кнопок можно. */
@media (pointer: coarse) {
    a, button, [role="button"], .btn, .nav-dd-trigger, label, summary {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    button, [role="button"], .btn, .appnav__i, .nav-dd-trigger, .navbar-burger {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Форм-элементы НЕ наследуют шрифт по стандарту (браузерный дефолт — Arial):
   без сброса каждая кнопка без своего font:inherit выпадает из типографики сайта.
   Только family — размеры/жирность у кнопок свои, шорткат font:inherit их бы сбил. */
button, input, select, textarea { font-family: inherit; }

/* Заголовки: чуть плотнее трекинг — текст выглядит «свёрстанным», а не дефолтным. */
h1, h2, h3, h4 { font-family: var(--font-head); }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; }
h1 { letter-spacing: -0.03em; }

a { color: var(--accent2); text-decoration: none; transition: color .18s var(--ease-out); }
a:hover { color: var(--accent); }

/* Лента котировок над меню: бегущая строка, пауза при наведении */
.tape { position:relative; z-index:101; background:var(--bg2); border-bottom:1px solid var(--border);
        overflow:hidden; height:32px; }
.tape[hidden] { display:none; }
.tape-track { display:inline-flex; align-items:center; height:32px; white-space:nowrap;
              animation:tape-scroll 60s linear infinite; will-change:transform; }
/* Тап по ленте котировок на телефоне оставлял :hover — лента замирала насовсем. */
@media (hover: hover) { .tape:hover .tape-track { animation-play-state:paused; } }
@keyframes tape-scroll { from { transform:translateX(0); } to { transform:translateX(-50%); } }
.tape-item { display:inline-flex; align-items:center; gap:6px; padding:0 14px; font-size:12.5px;
             color:var(--text); text-decoration:none; border-right:1px solid var(--border); height:18px; }
@media (hover: hover) { .tape-item:hover { color:var(--accent); } }
.tape-item .ts { font-weight:650; letter-spacing:-0.01em; }
.tape-item .tp { color:var(--text2); font-variant-numeric:tabular-nums; }
.tape-item .tc { font-variant-numeric:tabular-nums; font-weight:600; }
.tape-item .tc.up { color:var(--green); }
.tape-item .tc.down { color:var(--red); }
.tape-item .tc.flat { color:var(--text2); }
@media (max-width:640px){ .tape { height:28px; } .tape-track { height:28px; } .tape-item { font-size:11.5px; padding:0 10px; } }

/* Navbar */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(26,29,39,.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    height: 60px;
}
.navbar__logo {
    font-size: 19px; font-weight: 700; color: var(--text);
    letter-spacing: -0.02em;
}
.navbar__nav { display: flex; gap: 6px; align-items: center; margin-left: 24px; }
.navbar__nav a {
    color: var(--text2); padding: 6px 11px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600; white-space: nowrap;
    transition: color .18s var(--ease-out), background-color .18s var(--ease-out);
}
/* Премиум-метка раздела: бейдж PRO после пункта меню. */
.nav-pro-badge { display: inline-block; font-size: 7.1px; font-weight: 700; line-height: 1.4;
    letter-spacing: .65px; padding: 1px 3px; border-radius: 3px;
    background: rgba(79, 112, 230, .20); color: #9db0f7; margin-left: 3px; vertical-align: 4px;
    -webkit-font-smoothing: antialiased; text-rendering: geometricPrecision; }
.navbar__nav a:hover, .navbar__nav a.active {
    color: var(--text); background: var(--bg3);
}
/* Выпадающее меню вкладки «Акции» (по наведению) */
.nav-dd { position: relative; }
.nav-dd-trigger { display: inline-flex; align-items: center; gap: 4px; }
.nav-dd-trigger svg { opacity: .65; transition: transform .18s var(--ease-out); }
.nav-dd:hover .nav-dd-trigger, .nav-dd.is-open .nav-dd-trigger { color: var(--text); background: var(--bg3); }
.nav-dd:hover .nav-dd-trigger svg, .nav-dd.is-open .nav-dd-trigger svg { transform: rotate(180deg); }
.nav-dd-menu {
    position: absolute; top: 100%; left: 0; padding-top: 8px;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s var(--ease-out), transform .16s var(--ease-out), visibility .16s;
    z-index: 200;
}
.nav-dd:hover .nav-dd-menu, .nav-dd.is-open .nav-dd-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dd-card {
    min-width: 218px; background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.4);
}
.navbar__nav .nav-dd-card a {
    display: block; padding: 9px 12px; border-radius: 8px;
    color: var(--text2); font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.navbar__nav .nav-dd-card a:hover { color: var(--text); background: var(--bg3); }
.navbar__actions { display: flex; gap: 8px; align-items: center; }
/* Значок аккаунта вместо длинного email — круг в габаритах маленькой кнопки. */
.nav-avatar { width: 34px; height: 34px; flex: none; display: inline-flex; align-items: center;
    justify-content: center; border-radius: 50%; background: var(--bg3);
    border: 1px solid var(--border); color: var(--text2);
    transition: color .15s var(--ease-out), border-color .15s var(--ease-out); }
.nav-avatar:hover { color: var(--text); border-color: var(--accent); }
/* Мега-меню «Рынки» в духе TradingView: вертикальный список категорий,
   подпункты каждой выезжают вправо при наведении. */
.nav-mega-list { display: flex; flex-direction: column; min-width: 190px; padding: 6px; }
.nav-mega-cat { position: relative; }
.navbar__nav .nav-mega-cat > a.nav-mega-h { display: flex; align-items: center; justify-content: space-between;
    gap: 20px; font-weight: 600; color: var(--text); font-size: 13.5px; }
.nav-mega-cat > a.nav-mega-h svg { opacity: .55; flex: none; }
.nav-mega-fly { position: absolute; left: 100%; top: -7px; padding-left: 6px;
    opacity: 0; visibility: hidden; transform: translateX(-5px);
    transition: opacity .15s var(--ease-out), transform .15s var(--ease-out), visibility .15s; }
.nav-mega-cat:hover .nav-mega-fly { opacity: 1; visibility: visible; transform: none; }
.nav-mega-fly .nav-dd-card { min-width: 230px; }
/* Меню аккаунта: прижато к правому краю, внутри — почта, ЛК, тарифы, язык, выход.
   Пункты-ссылки оформляются как в навигационных дропдаунах (карточка живёт в
   .navbar__actions, куда правила .navbar__nav не дотягиваются). */
.navbar__actions .nav-dd-card a { display: block; padding: 9px 12px; border-radius: 8px;
    color: var(--text2); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.navbar__actions .nav-dd-card a:hover { color: var(--text); background: var(--bg3); }
.nav-dd-user .nav-dd-menu, .nav-dd-lang .nav-dd-menu { left: auto; right: 0; }
/* Кнопка-глобус и пункты выбора языка. */
.nav-lang-btn { cursor: pointer; padding: 0; }
.nav-lang-item { display: flex; align-items: center; justify-content: space-between; gap: 26px;
    width: 100%; background: none; border: none; cursor: pointer; text-align: left;
    padding: 9px 12px; border-radius: 8px; color: var(--text2); font-size: 13.5px; font-weight: 500; }
.nav-lang-item:hover { color: var(--text); background: var(--bg3); }
.nav-lang-item.on { color: var(--text); font-weight: 600; }
.nav-lang-item .k { font-size: 10.5px; color: var(--text2); letter-spacing: .04em; }
.nav-lang-item.on .k { color: var(--accent2); }
.nav-user-mail { font-size: 11.5px; color: var(--text2); padding: 7px 12px 5px; border-bottom: 1px solid var(--border);
    margin-bottom: 4px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-lang { margin: 6px 12px 4px; }
.nav-user-out { display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer;
    padding: 9px 12px; border-radius: 8px; color: var(--red); font-size: 13.5px; font-weight: 500; }
.nav-user-out:hover { background: var(--bg3); }
/* Переключатель языка RU/EN (форма set_language, кука django_language) */
.lang-switch { display: inline-flex; margin: 0; border: 1px solid var(--border2); border-radius: var(--radius-sm); overflow: hidden; }
.lang-switch button {
    border: 0; background: none; color: var(--text2); font: inherit;
    font-size: 12px; font-weight: 650; letter-spacing: .3px; padding: 6px 8px; cursor: pointer;
}
.lang-switch button.active { background: var(--bg3); color: var(--text); cursor: default; }
.lang-switch button:not(.active):hover { color: var(--text); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 550; cursor: pointer; border: 1px solid transparent;
    text-decoration: none; white-space: nowrap;
    transition: background-color .18s var(--ease-out),
                border-color .18s var(--ease-out),
                color .18s var(--ease-out),
                transform .1s var(--ease-out),
                box-shadow .18s var(--ease-out);
}
/* Отклик на нажатие — интерфейс «слышит» пользователя. */
.btn:active { transform: scale(0.97); }
/* Тач: у кликабельной строки (tr[data-href], карточки) Chrome заливает голубым весь
   элемент - в карточной раскладке это выглядело как подсветка всех ячеек сразу.
   Гасим системную заливку и даём свой отклик - сдержанное затемнение на время нажатия. */
html { -webkit-tap-highlight-color: transparent; }
/* Блоки-карточки на нажатие тоже не красим: любая заливка под пальцем читается как
   «выделилось», а не как нажатие. Отклик на тапе остаётся только у кнопок
   (.btn:active — сжатие, .btn-primary:active — цвет нажатия). */
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
@media (hover: hover) { .btn-primary:hover { background: var(--accent2); color: #fff; box-shadow: 0 4px 14px var(--accent-soft); } }
.btn-primary:active { background: var(--accent-press); }
.btn-ghost {
    background: transparent; color: var(--text2);
    border-color: var(--border2);
}
@media (hover: hover) { .btn-ghost:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); } }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { background: var(--red); color: #fff; }
@media (hover: hover) { .btn-danger:hover { background: #d83b36; color: #fff; } }
.btn-success { background: var(--green); color: #fff; }

/* Layout */
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.page { padding: 32px 0 64px; }

/* Cards */
.card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow);
}
.card-sm { padding: 16px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; letter-spacing: -0.01em; }
/* Кликабельные карточки слегка приподнимаются (только на устройствах с курсором). */
.card-hover { transition: transform .2s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
    .card-hover:hover { transform: translateY(-2px); border-color: var(--border2); box-shadow: var(--shadow-lg); }
    /* Hover-утилиты вместо инлайновых onmouseenter/leave (те ложно срабатывают на тач). */
    .hov-row:hover { background: var(--bg3); }
    .hov-row-txt:hover { background: var(--bg3); color: var(--text); }
    .hov-fade:hover { opacity: 1 !important; }
    .hov-danger:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }
}
.hov-row, .hov-row-txt, .hov-fade, .hov-danger { transition: background-color .15s var(--ease-out), color .15s var(--ease-out), border-color .15s var(--ease-out), opacity .15s var(--ease-out); }

/* Сегмент-контролы со скользящим индикатором: [data-seg] на контейнере кнопок.
   Активная кнопка НЕ красит свой фон сама — его даёт «pill», едущий под активную. */
[data-seg] { position: relative; }
[data-seg] > :not(.seg-pill) { position: relative; z-index: 1; }
.seg-pill {
    position: absolute; top: 0; left: 0; z-index: 0;
    border-radius: var(--seg-r, 7px);
    background: var(--accent); box-shadow: 0 2px 8px var(--accent-soft);
    opacity: 0; pointer-events: none;
    transition: transform .22s var(--ease-out), width .22s var(--ease-out),
                height .22s var(--ease-out), opacity .18s var(--ease-out);
}
@media (prefers-reduced-motion: reduce) { .seg-pill { transition: opacity .18s; } }

/* Grid */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
    background: var(--bg3); color: var(--text2); font-size: 12px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; transition: background-color .15s var(--ease-out); }
tr:last-child td { border-bottom: none; }
/* Подсветка строки — только там, где есть курсор. На тач-экране `:hover` не снимается
   до тапа в другом месте: человек открыл бумагу, вернулся назад — и строка стоит
   подсвеченной, будто он что-то выбрал. Отклика на нажатие тоже не даём: в карточной
   раскладке строка занимает полэкрана, и заливка всех её ячеек читается как «выделил
   полкарточки», а не как нажатие. Ответ пользователю — сам переход на карточку. */
@media (hover: hover) and (pointer: fine) {
    tbody tr:hover td { background: var(--bg3); }
}

/* Tooltip-иконка (чистый CSS: hover на десктопе + focus/тап на мобильных) */
.tooltip-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    color: var(--text2);
    font-size: 11px;
    font-weight: 400;
    margin-left: 3px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}
.tooltip-icon::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: max-content;
    max-width: 250px;
    white-space: normal;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    background: #0f1117;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    padding: 8px 11px;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
    pointer-events: none;
    z-index: 1000;
}
/* В заголовках таблиц .table-wrap имеет overflow-x:auto и обрезал бы
   подсказку сверху — для них показываем её снизу (класс .down). */
.tooltip-icon.down::after {
    bottom: auto;
    top: calc(100% + 8px);
}
/* Иконка у ЛЕВОГО края контейнера с overflow:hidden (сетка .cr-metrics):
   центрированный попап вылезал за левую границу и обрезался. Прижимаем попап
   левым краем к иконке — он раскрывается вправо, внутрь контейнера. */
.tooltip-icon.tip-start::after {
    left: -8px;
    transform: none;
}
/* На тач-экране показ — только классом .tip-open (его тогглит тап, base.html). :hover и
   :focus после тапа «залипают» на иконке, а попап — её же ::after: тап по крестику их не
   снимал, и подсказка не закрывалась. Поэтому hover/focus — лишь при мыши. */
.tooltip-icon.tip-open::after,
.tooltip-icon:focus-visible::after {
    opacity: 1;
    visibility: visible;
}
@media (hover: hover) and (pointer: fine) {
    .tooltip-icon:hover::after,
    .tooltip-icon:focus::after { opacity: 1; visibility: visible; }
}
/* На узком экране подсказка (до 250px, центрированная по иконке) вылезала за правый
   край. Она visibility:hidden, но остаётся в потоке — и молча распирала ДОКУМЕНТ,
   давая горизонтальный скролл всей странице (поймано на «Пульсе рынка» главной).
   Прижимаем её правым краем к иконке и не даём быть шире экрана. */
/* Узкий экран: попап тултипа привязан к иконке (absolute), но иконки часто стоят у
   левого/правого края — тогда попап шириной под 100vw либо уезжает за экран (текст
   обрезан), либо распирает документ и даёт горизонтальный скролл всей страницы
   (карточка облигации прокручивалась на 66px). Открепляем попап от иконки: fixed по
   центру НИЗА экрана, во всю ширину минус поля — как мобильный поповер. Позиция
   иконки на layout попапа больше не влияет. */
@media (max-width: 700px) {
    /* И .down тоже: его top:calc(100%+8px)/bottom:auto специфичнее (.tooltip-icon.down)
       и перебивал bottom — мобильный попап уезжал за нижний край экрана (bottom<0). */
    .tooltip-icon::after,
    .tooltip-icon.down::after,
    .tooltip-icon.tip-start::after {
        position: fixed; left: 12px; right: 12px; bottom: 16px; top: auto;
        transform: none; max-width: none; width: auto; white-space: normal;
        z-index: 1200; box-shadow: 0 12px 32px rgba(0,0,0,.5);
        /* Крестик в правом верхнем углу: попап открывается на пол-экрана, и без
           видимого способа закрыть его непонятно, куда жать. Нарисован фоном —
           внутрь псевдоэлемента отдельную кнопку не вставить, а ::before уже занят
           под увеличенную зону нажатия самой иконки. Закрывает тап по любому месту
           попапа: он часть иконки, а тап по ней и так переключает показ. */
        pointer-events: auto; cursor: pointer;
        padding-right: 40px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d93ad' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px top 14px;
        background-size: 15px;
    }
}

/* Автолинк термина глоссария в тексте урока — ненавязчивая пунктирная ссылка. */
.prose a.term-link {
    color: var(--text); text-decoration: none;
    border-bottom: 1px dashed var(--accent-ring);
    transition: color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.prose a.term-link:hover { color: var(--accent2); border-bottom-color: var(--accent); }

/* ── Подсказка по термину глоссария (тег term_tip) ───────────────────
   В отличие от .tooltip-icon (чистый CSS на ::after), внутри попапа живёт ССЫЛКА
   на статью глоссария — поэтому это настоящий элемент с pointer-events, а не
   псевдоэлемент. Определение приходит из education.Term: один источник правды
   на весь сайт, правка термина обновляет все тултипы разом. */
.term-tip {
    position: relative; display: inline-flex; align-items: center;
    margin-left: 4px; cursor: help; outline: none;
    -webkit-tap-highlight-color: transparent; vertical-align: middle;
}
.term-tip-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    border: 1px solid var(--border2); color: var(--text2);
    font-size: 9px; font-weight: 700; line-height: 1;
    text-transform: none; letter-spacing: normal;
    transition: color .15s var(--ease-out), background-color .15s var(--ease-out),
                border-color .15s var(--ease-out);
}
.term-tip:hover .term-tip-ico,
.term-tip:focus-within .term-tip-ico {
    color: #fff; background: var(--accent); border-color: var(--accent);
}
.term-tip-pop {
    position: absolute; z-index: 400;
    left: 50%; transform: translateX(-50%) translateY(3px);
    width: max-content; max-width: 270px;
    display: flex; flex-direction: column; gap: 6px;
    padding: 11px 13px; border-radius: 10px;
    background: #0f1117; border: 1px solid var(--border2);
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    text-transform: none; letter-spacing: normal; text-align: left; white-space: normal;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .15s var(--ease-out), transform .15s var(--ease-out), visibility .15s;
}
/* Внутри раскрытой подсказки курсор обычный: текст можно выделять и копировать
   без «знака вопроса» (help остаётся только на самой иконке-триггере). */
.term-tip-pop, .term-tip-pop * { cursor: auto; }
.tooltip-icon .tip-pop, .tooltip-icon .tip-pop * { cursor: auto; }
.term-tip-down .term-tip-pop { top: calc(100% + 8px); }
.term-tip-up .term-tip-pop { bottom: calc(100% + 8px); }
/* Мост через зазор между иконкой и попапом. Восемь пикселей пустоты курсор проходил
   «по воздуху»: :hover на .term-tip срывался, попап закрывался, и ссылку «Подробнее
   в глоссарии» нельзя было нажать. Мост — псевдоэлемент САМОГО попапа, поэтому пока
   курсор на нём, :hover родителя держится. Пока попап скрыт, у него pointer-events:none,
   так что мост не ловит ничего лишнего. */
.term-tip-pop::before {
    content: ''; position: absolute; left: 0; right: 0; height: 10px;
}
.term-tip-down .term-tip-pop::before { top: -10px; }
.term-tip-up .term-tip-pop::before { bottom: -10px; }
.term-tip:hover .term-tip-pop,
.term-tip:focus-within .term-tip-pop {
    opacity: 1; visibility: visible; pointer-events: auto;   /* чтобы кликнуть ссылку */
    transform: translateX(-50%) translateY(0);
}
.term-tip-title { font-size: 12.5px; font-weight: 700; color: var(--text); }
.term-tip-text { font-size: 12.5px; font-weight: 400; line-height: 1.5; color: var(--text2); }
.term-tip-link { font-size: 12px; font-weight: 600; color: var(--accent2); }
.term-tip-link:hover { color: var(--accent); }
/* Узкий экран: тот же приём, что и для .tooltip-icon — открепляем попап от иконки и
   показываем fixed по центру низа экрана. Раньше правый край попапа прижимался к
   иконке (right:0), но иконки в таблицах стоят слева, и попап уезжал за левый край —
   определение было видно по первым буквам. */
@media (max-width: 700px) {
    .term-tip-down .term-tip-pop, .term-tip-up .term-tip-pop {
        position: fixed; left: 12px; right: 12px; bottom: 16px; top: auto;
        width: auto; max-width: none; transform: translateY(6px); z-index: 1200;
    }
    .term-tip:hover .term-tip-pop,
    .term-tip:focus-within .term-tip-pop { transform: translateY(0); }
    /* попап откреплён от иконки и прижат к низу экрана — мост тут не к чему вести */
    .term-tip-down .term-tip-pop::before,
    .term-tip-up .term-tip-pop::before { content: none; }
}

/* Badges */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.badge-s { background: rgba(34,197,94,.15); color: var(--green); }
.badge-a { background: rgba(34,197,94,.1); color: #86efac; }
.badge-b { background: rgba(245,158,11,.1); color: var(--yellow); }
.badge-c { background: rgba(239,68,68,.1); color: #fca5a5; }
.badge-d { background: rgba(239,68,68,.15); color: var(--red); }
.badge-buy { background: rgba(34,197,94,.15); color: var(--green); }
.badge-sell { background: rgba(239,68,68,.15); color: var(--red); }
.badge-hold { background: rgba(245,158,11,.1); color: var(--yellow); }

/* Positive / Negative numbers */
.pos { color: var(--green); }
.neg { color: var(--red); }

/* Form elements */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
    width: 100%; background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius-sm); color: var(--text); padding: 10px 14px; font-size: 14px;
    font-family: inherit; outline: none;
    transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
input::placeholder, textarea::placeholder { color: var(--text2); opacity: .7; }
/* Чекбоксы и радио не должны наследовать стиль текстовых полей (width:100%,
   padding, рамка) — иначе ломают верстку (напр. согласие при регистрации). */
input[type="checkbox"], input[type="radio"] {
    width: auto; padding: 0; background: none; border: none;
    border-radius: 0; accent-color: var(--accent); flex: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; }
textarea { resize: vertical; min-height: 100px; }
/* iOS Safari увеличивает страницу при фокусе на поле с кеглем меньше 16px и обратно
   не отдаляет — человек после ввода суммы остаётся с увеличенной страницей. На телефоне
   все текстовые поля и списки — 16px. !important: страничные правила (калькуляторы,
   скринер, конвертер) задают 12–15px своими классами и инлайном. */
@media (max-width: 760px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
    select, textarea { font-size: 16px !important; }
}

/* Alerts */
.alert {
    padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px;
}
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.2); color: #86efac; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2); color: #fca5a5; }
.alert-info { background: rgba(108,99,255,.1); border: 1px solid rgba(108,99,255,.2); color: var(--accent2); }

/* Page header */
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.page-header p { color: var(--text2); font-size: 15px; }

/* ── Скринеры: чипы фильтров, сортировка, селекты, пагинация ──
   Общие примитивы разделов /bonds/ и /etfs/ (эталон — раздел «Облигации»).
   Длинные подписи фильтра переопределяют ширину инлайном style="width:auto". */
.bfilter-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:10px; }
.bfilter-cap { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--text2); width:46px; flex-shrink:0; }
.bchip { display:inline-flex; align-items:center; gap:6px; padding:7px 13px; border-radius:var(--radius-sm); background:var(--bg2); border:1px solid var(--border); color:var(--text2); font-size:13px; font-weight:550; text-decoration:none; cursor:pointer; transition:background-color .18s var(--ease-out), border-color .18s var(--ease-out), color .18s var(--ease-out), box-shadow .18s var(--ease-out), transform .1s var(--ease-out); }
@media (hover: hover) { .bchip:hover { color:var(--text); border-color:var(--accent-ring); background:var(--bg3); } }
.bchip:active { transform:scale(0.97); }
.bchip.active { background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:0 1px 2px rgba(0,0,0,.25); }
.bchip-n { opacity:.7; font-weight:500; }
/* Сегмент-контрол: тумблер между слитыми вкладками (Подбор⇄Лестница, Таблица⇄Карта, Финпоказатели⇄Мультипликаторы) */
.seg-tabs { display:inline-flex; gap:4px; padding:4px; background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:18px; flex-wrap:wrap; }
.seg-tabs a { padding:7px 15px; border-radius:calc(var(--radius-sm) - 3px); font-size:13.5px; font-weight:600; color:var(--text2); text-decoration:none; white-space:nowrap; transition:background-color .15s var(--ease-out), color .15s var(--ease-out); }
.seg-tabs a:hover { color:var(--text); }
.seg-tabs a.on { background:var(--accent); color:#fff; box-shadow:0 1px 2px rgba(0,0,0,.2); }
.bond-mode-toggle { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.bmt-hint { font-size:12px; color:var(--text2); }
.bond-sort { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:4px 0 2px; }
.bond-select, .fv-select { appearance:none; -webkit-appearance:none; background-color:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:7px 34px 7px 12px; color:var(--text); font-size:13px; font-weight:550; cursor:pointer; min-width:160px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a90a0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 11px center; background-size:14px; transition:border-color .18s var(--ease-out), box-shadow .18s var(--ease-out); }
@media (hover: hover) { .bond-select:hover, .fv-select:hover { border-color:var(--accent-ring); } }
.bond-select:focus, .fv-select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.bond-filters { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:6px; }
.bond-filters input { background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius-sm); padding:7px 12px; color:var(--text); font-size:13px; box-sizing:border-box; transition:border-color .18s var(--ease-out), box-shadow .18s var(--ease-out); }
.bond-filters input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.bond-pages { display:flex; gap:6px; align-items:center; margin-top:18px; }
.page-btn { display:inline-flex; align-items:center; justify-content:center; min-width:36px; height:36px; padding:0 12px; background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text2); font-size:13px; text-decoration:none; transition:border-color .18s var(--ease-out), color .18s var(--ease-out), background-color .18s var(--ease-out); }
@media (hover: hover) { .page-btn:hover { border-color:var(--accent-ring); color:var(--text); } }
.page-btn-active { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
.page-btn-active:hover { color:#fff; }

/* Длинный контент (статьи, новости, исследования, юр-страницы) */
.prose { font-size: 16px; line-height: 1.75; color: var(--text2); }
.prose > *:first-child { margin-top: 0; }
.prose h2 { font-size: 22px; font-weight: 700; color: var(--text); margin: 36px 0 14px; letter-spacing: -0.02em; line-height: 1.3; }
.prose h3 { font-size: 18px; font-weight: 650; color: var(--text); margin: 28px 0 10px; letter-spacing: -0.01em; }
.prose h4 { font-size: 15.5px; font-weight: 650; color: var(--text); margin: 22px 0 8px; }
.prose p { margin: 0 0 16px; }
.prose a { color: var(--accent2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--accent-ring); transition: color .15s var(--ease-out), text-decoration-color .15s var(--ease-out); }
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.prose strong, .prose b { color: var(--text); font-weight: 650; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--text2); }
.prose blockquote { margin: 20px 0; padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 12px; margin: 20px 0; border: 1px solid var(--border); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text); }
.prose pre { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 16px; overflow-x: auto; margin: 0 0 16px; }
.prose pre code { background: none; border: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.prose th { background: var(--bg3); color: var(--text2); font-weight: 600; }
/* Лид-абзац (вводка) */
.prose-lead { font-size: 17px; line-height: 1.7; color: var(--text2); margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

/* Назад-ссылка для страниц-читалок */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text2); font-size: 14px; margin-bottom: 20px; transition: color .15s var(--ease-out); }
.back-link:hover { color: var(--text); }
.back-link svg { transition: transform .18s var(--ease-out); }
.back-link:hover svg { transform: translateX(-3px); }

/* Ticker logo */
.ticker-logo {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
}
.ticker-avatar {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--bg3); display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0; letter-spacing: -0.5px;
}

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
    z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; animation: overlayIn .2s var(--ease-out); }
.modal {
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 440px;
    box-shadow: var(--shadow-lg);
    /* Модалка центрирована (не привязана к триггеру) → transform-origin: center. */
    animation: modalIn .22s var(--ease-out);
}
@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalIn {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.02em; }
.modal-close {
    position: absolute; top: 14px; right: 14px;
    background: none; border: none; color: var(--text2);
    cursor: pointer; font-size: 20px; line-height: 1;
    width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .15s var(--ease-out), background-color .15s var(--ease-out);
}
@media (hover: hover) { .modal-close:hover { color: var(--text); background: var(--bg3); } }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
    padding: 10px 16px; font-size: 14px; font-weight: 500; cursor: pointer;
    border-bottom: 2px solid transparent; color: var(--text2);
    transition: color .18s var(--ease-out), border-color .18s var(--ease-out);
    background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Ticker change color */
.change-positive { color: var(--green); }
.change-negative { color: var(--red); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* Footer */
footer {
    background: var(--bg2); border-top: 1px solid var(--border);
    padding: 48px 0 28px; margin-top: 80px;
    color: var(--text2); font-size: 14px;
}
footer .footer-cols { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 36px; margin-bottom: 28px; }
footer .footer-brand { max-width: 300px; }
footer .footer-tag { font-size: 12.5px; color: var(--text2); line-height: 1.55; }
footer .footer-legal { display: flex; gap: 18px; flex-wrap: wrap; }
footer .footer-logo { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-bottom: 10px; }
footer .footer-col-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .5px; }
footer .footer-links { display: flex; flex-direction: column; gap: 10px; }
footer .footer-bottom {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
    border-top: 1px solid var(--border); padding-top: 20px; font-size: 13px;
}
footer .footer-inner { display: flex; justify-content: space-between; align-items: center; }
footer a { color: var(--text2); text-decoration: none; }
footer a:hover { color: var(--text); }
@media (max-width: 768px) {
    footer .footer-cols { grid-template-columns: 1fr 1fr; gap: 26px; }
    footer .footer-brand { grid-column: 1 / -1; max-width: none; }
    footer .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* Spinner — чуть быстрее: загрузка ощущается быстрее (Emil Kowalski). */
.spinner {
    width: 20px; height: 20px; border: 2px solid var(--border2);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin .5s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ChartKit: состояния загрузки графиков (скелетон / спиннер / ошибка) ── */
.ck-state { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; }
.chart-skeleton {
    position: absolute; inset: 0; border-radius: var(--radius-sm);
    background: linear-gradient(100deg, var(--bg3) 30%, var(--bg2) 50%, var(--bg3) 70%);
    background-size: 200% 100%; animation: ckShimmer 1.3s var(--ease-in-out) infinite;
}
@keyframes ckShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.chart-error { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text2); font-size: 13px; text-align: center; }
.chart-error .ck-retry {
    padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border2);
    background: var(--bg3); color: var(--text); font-size: 13px; cursor: pointer;
    transition: border-color .15s var(--ease-out);
}
.chart-error .ck-retry:hover { border-color: var(--accent-ring); }
@media (prefers-reduced-motion: reduce) { .chart-skeleton { animation: none; } }

/* Toast */
#toast {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.toast-item {
    padding: 12px 20px; border-radius: var(--radius-sm); font-size: 14px;
    background: var(--bg3); border: 1px solid var(--border2);
    box-shadow: var(--shadow-lg); max-width: 340px;
    opacity: 1; transform: none;
    transition: opacity .28s var(--ease-out), transform .28s var(--ease-out);
}
/* Вход и выход через transition (а не мгновенное появление/удаление). */
.toast-item.enter { opacity: 0; transform: scale(0.96) translateY(6px); }
.toast-item.leaving { opacity: 0; transform: scale(0.96) translateY(-6px); }
@media (prefers-reduced-motion: reduce) { .toast-item { transition: none; } }
.toast-ok { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }

/* ── Шапка на средних ширинах ────────────────────────────────────────
   Меню разрослось до 10 пунктов, и между 769px и ~1430px оно вместе с кнопками
   «Войти/Регистрация» не помещалось в строку: .navbar__actions выезжал за вьюпорт,
   и вся страница получала горизонтальный скролл (ноутбуки 1280/1366, планшеты).
   Ниже 769px меню и так скрыто — поэтому на телефоне баг не был виден.
   Лечим сжатием, а не выкидыванием пунктов: навигация остаётся доступной. */
@media (max-width: 1440px) {
    .navbar { padding: 0 14px; }
    .navbar__nav { gap: 1px; }
    .navbar__nav a { padding: 6px 7px; font-size: 13px; }
    .navbar__actions { gap: 6px; }
}
@media (max-width: 1280px) {
    /* Поиск сворачивается в иконку (⌘K остаётся), кнопки — компактные.
       Порог 1280, а не 1200: без сжатия шапке нужно ровно 1280px, и на 1201-1279
       меню (видимое до 1200) уводило страницу вбок. */
    .navbar-search { padding: 6px 8px; }
    .navbar-search span { display: none; }
    .navbar__actions .btn { padding: 5px 10px; font-size: 12.5px; }
    /* Длинный email в кнопке профиля не должен распирать шапку. */
    .navbar__actions a.btn-ghost {
        max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
}
/* Ниже ~1200px пункты меню не влезают даже сжатыми (замер: минимальная ширина строки
   шапки — 1186px после того, как «Обучение» стало дропдауном со стрелкой). Прячем
   меню, а не даём ему горизонтальный скролл: скроллящийся контейнер обрезал бы
   выпадающие подменю «Акции»/«Облигации» (они position:absolute). Навигация
   остаётся через поиск (⌘K) — то же решение, что принято для телефонов.
   ВАЖНО: добавляете пункт меню — перепроверьте этот порог, иначе на всём сайте
   возвращается горизонтальный скролл. (1240, а не 1200: переключатель RU/EN
   добавил ~46px к правому блоку шапки.) */
@media (max-width: 1240px) {
    .navbar__nav { display: none; }
}

@media (max-width: 768px) {
    .navbar__nav { display: none; }
    /* Переключатель RU/EN уходит из шапки: тот же переключатель есть в мобильной панели
       (mnav-head), а в строке шапки он занимает 69px и вместе с кнопками распирал
       ДОКУМЕНТ — на 390px шапке требовалось 490px, и горизонтальный скролл получала
       каждая страница сайта. На десктопе этот же элемент уже двигал порог медиазапроса
       с 1200 до 1240 (см. комментарий выше). */
    .navbar__actions .lang-switch { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .container { padding: 0 16px; }
}

/* ── Мобильная навигация: бургер + выдвижная панель ───────────────────
   До 1200px десктопное меню скрыто (в строку не влезает), и до появления этой
   панели навигации по разделам на планшете и телефоне не было вообще — только
   поиск. Панель повторяет структуру меню, но списком: на тач-экране hover-
   дропдаунов не бывает. */
.navbar-burger {
    display: none; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 40px; padding: 0 9px; cursor: pointer;
    border: 1px solid var(--border2); border-radius: var(--radius-sm);
    background: var(--bg3);
}
.navbar-burger span {
    display: block; height: 2px; width: 100%; border-radius: 2px; background: var(--text);
    transition: transform .22s var(--ease-out), opacity .18s var(--ease-out);
}
.navbar-burger.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.navbar-burger.is-open span:nth-child(2) { opacity: 0; }
.navbar-burger.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mnav-overlay {
    position: fixed; inset: 0; z-index: 1900; display: none;
    background: rgba(8,10,15,.6); backdrop-filter: blur(2px);
}
.mnav-overlay.is-open { display: block; }
.mnav {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1901;
    width: min(340px, 86vw); display: flex; flex-direction: column;
    background: var(--bg2); border-left: 1px solid var(--border);
    transform: translateX(100%); transition: transform .28s var(--ease-out);
    overflow-y: auto; overscroll-behavior: contain;
}
.mnav.is-open { transform: none; }
.mnav-head {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--bg2);
}
.mnav-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text2); }
.mnav-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid var(--border2); background: var(--bg3); color: var(--text); cursor: pointer;
}
.mnav-body { padding: 8px 0 28px; }
.mnav-group { padding: 10px 0; border-bottom: 1px solid var(--border); }
.mnav-group:last-child { border-bottom: none; }
.mnav-group a {
    display: block; padding: 11px 18px; font-size: 14px; color: var(--text2);
    text-decoration: none; min-height: 44px;      /* палец, а не курсор */
    display: flex; align-items: center;
}
.mnav-group a:focus-visible { background: var(--bg3); color: var(--text); }
@media (hover: hover) { .mnav-group a:hover { background: var(--bg3); color: var(--text); } }
.mnav-lead { font-size: 15px !important; font-weight: 700; color: var(--text) !important; }
.mnav-flat a { font-size: 15px; font-weight: 600; color: var(--text); }

@media (max-width: 1240px) {
    .navbar-burger { display: flex; }
}
/* Кнопка email и «Выйти» — широкие (email до 200px), на телефоне не влезали в шапку
   и давали горизонтальный скролл у ЗАЛОГИНЕННЫХ на всех страницах. На мобиле их
   прячем — действия аккаунта переехали в выдвижное меню (.mnav). */
@media (max-width: 768px) {
    .nav-account { display: none; }
}

/* ── Глобальный адаптив: планшет и телефон ────────────────────────────
   Правила общие для всех разделов — точечные правки живут в своих шаблонах. */
@media (max-width: 1024px) {
    /* Любая таблица прокручивается внутри своего контейнера, а не распирает
       страницу: горизонтальный скролл документа — главная болезнь на планшете. */
    .table-wrap { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 768px) {
    body { font-size: 14.5px; }
    h1 { font-size: 26px; }
    h2 { font-size: 21px; }
    h3 { font-size: 17px; }
    .card { padding: 16px; }
    /* Тап-таргеты: палец промахивается по кнопкам меньше 40px. */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }
    /* Модалки и палитра — во всю ширину, с отступами от краёв. */
    .cmdk-overlay { padding: 8vh 12px 12px; }
    /* Иконки-подсказки «?» визуально 14px, но зона нажатия должна быть пальцем
       достижима: невидимый ::before растягивает кликабельную область до 40px, не
       раздвигая вёрстку. Работает для обоих типов тултипов на всём сайте. */
    .term-tip, .tooltip-icon { position: relative; }
    .term-tip::before, .tooltip-icon::before {
        content: ''; position: absolute; top: 50%; left: 50%;
        width: 40px; height: 40px; transform: translate(-50%, -50%);
    }
    .tooltip-icon::before { z-index: 0; }
}
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    h1 { font-size: 23px; }
    .navbar__actions .btn { padding: 6px 9px; font-size: 12px; }
}
/* На 320px (iPhone SE и подобные) шапке нужно 335px: логотип 118 + бургер 40 +
   «Войти» 57 + «Регистрация» 95 + гэпы и паддинги. Лишние 15px распирали ДОКУМЕНТ,
   и горизонтальный скролл получала каждая страница сайта. Дожимаем кнопки, а не
   глушим overflow-x на body: это спрятало бы симптом и сломало position:sticky. */
/* Выдвижное меню (.mnav) стоит за правым краем на transform:translateX(100%) и в
   закрытом виде растягивает документ: на разделе «Валюты» страница ехала вбок на 14 px.
   Глушить overflow-x у body нельзя — это ломает position:sticky у шапки (см. заметку
   ниже). `clip` делает то же самое, но прокрутку у предков sticky не отменяет, поэтому
   шапка продолжает липнуть. Только для узких экранов: на десктопе ничего не меняем. */
@media (max-width: 900px) {
    html { overflow-x: clip; }
}

/* Шапка на телефоне требовала 406 px при экране 390: логотип 116 + бургер 40 +
   кнопка языка 34 + «Войти» 56 + «Регистрация» 95 + отступы и гэпы. Лишнее распирало
   документ — на браузерах без поддержки `overflow-x: clip` (Safari до 16, старые
   Android) страница ехала вбок, а «Регистрация» обрезалась правым краем.

   Убираем из шапки кнопку языка: тот же переключатель RU/EN стоит в шапке мобильного
   меню (`.mnav-head .lang-switch`), в которое ведёт бургер рядом. Плюс ужимаем боковые
   отступы. Освобождается 64 px — шапка помещается на всех ширинах вплоть до 320 px,
   и название сайта остаётся на месте. */
@media (max-width: 480px) {
    .navbar { padding: 0 12px; }
    .navbar__actions { gap: 6px; }
    .navbar__actions .nav-dd-lang { display: none; }
}

@media (max-width: 360px) {
    .navbar { padding: 0 10px; }
    .navbar__actions { gap: 5px; }
    .navbar__actions .btn { padding: 6px 8px; font-size: 11.5px; }
}
@media (max-width: 340px) {
    .navbar { padding: 0 8px; }
    .navbar__actions .btn { padding: 6px 7px; font-size: 11px; }
    .navbar__brand span { font-size: 15px; }
}

/* ── Командная палитра ⌘K (открытие мгновенное — клавиатурное действие не анимируем) ── */
.navbar-search {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 10px; border-radius: var(--radius-sm);
    border: 1px solid var(--border2); background: var(--bg3); color: var(--text2);
    cursor: pointer; font-size: 13px;
    transition: color .18s var(--ease-out), border-color .18s var(--ease-out);
}
.navbar-search:hover { color: var(--text); border-color: var(--text2); }
.navbar-search .nbk { font-size: 11px; border: 1px solid var(--border2); border-radius: 5px; padding: 1px 5px; line-height: 1.4; }

.cmdk-overlay {
    display: none; position: fixed; inset: 0; z-index: 2000;
    background: rgba(8,10,15,.62); backdrop-filter: blur(3px);
    align-items: flex-start; justify-content: center; padding: 12vh 16px 16px;
}
.cmdk-overlay.open { display: flex; }
.cmdk {
    width: 100%; max-width: 560px; background: var(--bg2);
    border: 1px solid var(--border2); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); overflow: hidden;
    display: flex; flex-direction: column; max-height: 62vh;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.cmdk-input-wrap svg { color: var(--text2); flex-shrink: 0; }
.cmdk-input-wrap input { border: none; background: none; padding: 0; font-size: 16px; color: var(--text); width: 100%; }
.cmdk-input-wrap input:focus { box-shadow: none; border: none; }
.cmdk-input-wrap input:focus-visible { outline: none; }
.cmdk-kbd { font-size: 11px; color: var(--text2); border: 1px solid var(--border2); border-radius: 6px; padding: 2px 7px; flex-shrink: 0; }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); padding: 10px 10px 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.cmdk-item.is-active { background: var(--bg3); }
.cmdk-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; color: var(--text2); flex-shrink: 0; letter-spacing: -0.5px; }
.cmdk-item.is-active .cmdk-ic { background: var(--accent-soft); color: var(--accent2); }
.cmdk-label { font-size: 14px; font-weight: 550; color: var(--text); }
.cmdk-sub { font-size: 12px; color: var(--text2); margin-left: auto; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 12px; }
.cmdk-empty { padding: 28px 16px; text-align: center; color: var(--text2); font-size: 14px; }

/* Установленное приложение (Android/TWA и PWA с домашнего экрана): оплаты в нём нет.
   Google Play запрещает продавать цифровую подписку мимо Play Billing, а Play Billing
   для российских счетов отключён с 26.12.2024 — приложение с кнопкой «оплатить» не
   пройдёт ревью. Подписка оформляется на сайте, в приложении пользователь просто
   входит и видит свой PRO.
   ponytail: признак — display-mode, поэтому правило накрывает и PWA, установленную на
   десктопе. Пока таких пользователей нет; появятся платящие — разводить приложение и
   сайт по разным адресам (app.fv.market) и решать на сервере по Host. */
@media (display-mode: standalone) {
    a[href^="/tariffs"], a[href^="/payment"] { display: none !important; }
}

/* Нижняя панель приложения. На сайте её нет — там шапка и панель браузера снизу;
   в установленном приложении шапка остаётся, но до её пунктов на телефоне тянуться
   далеко, а низ экрана — это то, что достаёт большой палец.
   `env(safe-area-inset-bottom)` — полоса жестовой навигации Android: без неё нижний
   ряд подписей оказывается под ней. */
.appnav { display: none; }

/* Плавный переход между страницами вместо белой вспышки перезагрузки (Chrome,
   cross-document view transitions). Работает вместе с prefetch из base.html: документ
   уже скачан, а смена кадра — кроссфейд, как в нативном приложении.
   Только в установленном приложении: в браузере вкладка и так живёт по своим правилам,
   а анимация навигации там ощущается чужой.
   Деградирует молча — браузер без поддержки просто перейдёт по ссылке как раньше. */
@media (display-mode: standalone) {
    @view-transition { navigation: auto; }
}

@media (display-mode: standalone) and (max-width: 900px) {
    /* Бегущая строка съедает верх маленького экрана и тянет к себе взгляд движением.
       На сайте она уместна, в приложении верхние 28 px дороже. */
    .tape { display: none !important; }

    /* Шапка уезжает при прокрутке вниз и возвращается при прокрутке вверх — так ведут
       себя и нативные приложения, и сам Chrome со своей адресной строкой. На экране
       телефона её 60 px рядом с нижней панелью и статус-баром забирали седьмую часть
       высоты у контента. Класс вешает base.html. */
    .navbar { transition: transform .22s var(--ease-out); will-change: transform; }
    .navbar.is-tucked { transform: translateY(-100%); }
    /* Липкие полосы под шапкой (разделы акции/облигации/фонда, шапка скринера) стоят на
       top:60px — высоте шапки. Шапка уехала — они оставались на 60 px ниже верха, и в щели
       над ними просвечивал контент. Едут вверх вместе с ней, той же анимацией. */
    .bndu-anchors, .stku-anchors, .etfu-anchors, .ei-nav, .screener-tbl thead th,
    .cr-cmp-table thead, .exam-timer, .lk-nav {
        transition: top .22s var(--ease-out); }
    body:has(.navbar.is-tucked) :is(.bndu-anchors, .stku-anchors, .etfu-anchors, .ei-nav,
        .screener-tbl thead th, .cr-cmp-table thead) { top: 0; }
    /* У этих свой зазор под шапкой (72 и 84 px при шапке 60) — сохраняем его. */
    body:has(.navbar.is-tucked) .exam-timer { top: 12px; }
    body:has(.navbar.is-tucked) .lk-nav { top: 24px; }

    /* Подвал сайта — пять колонок ссылок на разделы: на телефоне это экран с лишним
       меню под каждой страницей, а в приложении разделы и так лежат в нижней панели и
       в «Ещё». Оставляем правовой низ: копирайт, конфиденциальность, условия,
       дисклеймер — на них ссылается и карточка в Google Play. */
    footer { margin-top: 32px; padding: 20px 0 16px; }
    footer .footer-cols { display: none; }
    footer .footer-bottom { border-top: none; padding-top: 0; }
    .appnav {
        /* Панель не должна мигать при каждом переходе: своё имя выводит её из общего
           кроссфейда — страница сменяется, панель стоит на месте. */
        view-transition-name: appnav;
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 60;
        background: color-mix(in srgb, var(--bg2) 92%, transparent);
        backdrop-filter: blur(12px);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .appnav__i {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 4px 2px;
        border: none;
        background: none;
        color: var(--text2);
        line-height: inherit;   /* «Ещё» — <button> с line-height: normal, подпись вставала выше соседей */
        font-size: 10.5px;
        font-weight: 550;
        text-decoration: none;
        cursor: pointer;
    }
    .appnav__i svg { width: 21px; height: 21px; }
    .appnav__i.is-on { color: var(--accent2); }
    /* Панель перекрывает низ страницы — освобождаем под неё место. */
    body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
    /* Кнопка ассистента висит по низу экрана (chat_widget.html) — поднимаем над панелью. */
    .ai-fab-wrap, .ai-panel { bottom: calc(70px + env(safe-area-inset-bottom)) !important; }

    /* Бургер — в самый конец строки. В разметке он идёт первым в правой группе, и на
       узком экране группа растягивается почти во всю ширину: три полоски оказывались
       вплотную к названию сайта, будто относятся к нему. Порядком двигаем только
       отображение, разметка не меняется. */
    .navbar-burger { order: 99; }

    /* Терминал — рабочее место на весь экран с графиком и watchlist, на телефоне им
       не пользуются. В приложении кнопку убираем; сам раздел остаётся доступен по
       адресу и на десктопе. */
    .nav-terminal { display: none; }
    /* Всплывающие подсказки на телефоне прижимаются к низу экрана (bottom:16px), а в
       приложении там стоит панель навигации — попап уходил под неё, и прочитать текст
       было нельзя. Поднимаем над панелью, как кнопку ассистента. */
    .tooltip-icon::after,
    .tooltip-icon.down::after,
    .tooltip-icon.tip-start::after,
    .term-tip-down .term-tip-pop,
    .term-tip-up .term-tip-pop { bottom: calc(74px + env(safe-area-inset-bottom)) !important; }
}

/* Уважение к настройке «меньше движения»: оставляем фейды, убираем перемещения. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .08ms !important;
        scroll-behavior: auto !important;
    }
    .btn:active, .card-hover:hover { transform: none; }
}

/* Выдвижная панель фильтров (скринер) лежит ВЫШЕ панели навигации (z-index 90 против 60)
   и закрывает её, поэтому отдельного отступа под навигацию ей не нужно. Был padding-bottom
   58px — липкая кнопка «Показать бумаги» поднималась на него, и под ней листались фильтры. */
