/* tokens.css и v3fonts.css подключены ссылками в v3/base.html:
   через @import они кэшировались без версии и правки не доезжали.
   ==== ========================================================================
   VPN-HUB · v3/app.css — стили каркаса /v3.
   Основа — static/rd/css/app.css (черновик редизайна), почти без изменений
   в разделах reset/base/layout/nav/components/article/forms/states/util.

   Отличия от черновика:
   - слой fonts убран целиком: шрифты грузятся не тут, а @import'ом ниже,
     JetBrains Mono боевым /static/fonts/vhfonts.css, а Unbounded/Manrope
     новым /static/fonts/v3fonts.css (оба подключены до этого файла в
     base.html), здесь только имена семейств через tokens.css.
   - иконки: черновик рисовал inline SVG-спрайт, здесь — боевой шрифт Tabler
     (.ti .ti-*, static/icons/tabler-subset.css), поэтому .icon/.icon--sm ниже
     заточены под шрифтовую иконку (font-size), а не под <svg width/height>.
   - в конце файла — блок «v3 extra»: водяной знак и переходы между
     страницами, перенесённые из боевого templates/base.html (см. main.py
     /v3 маршруты и templates/v3/base.html), плюс мелкие компоненты витрины
     базы знаний (карточка «начните здесь», строка статьи).
   ========================================================================== */


@layer reset, base, layout, nav, components, article, forms, states, util, v3;

/* ----------------------------------------------------------------- RESET --- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body { min-height: 100vh; line-height: var(--lh); -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility; }
  img, svg, video { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; cursor: pointer; }
  a { color: inherit; text-decoration: none; }
  ul, ol { list-style: none; padding: 0; }
  table { border-collapse: collapse; width: 100%; }
  :where(a, button, input, [tabindex]):focus-visible {
    outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm);
  }
  ::selection { background: color-mix(in oklab, var(--accent) 30%, transparent); }
  html { scrollbar-width: thin; scrollbar-color: #59616d #0d0f13; }
  html::-webkit-scrollbar { width: 12px; }
  html::-webkit-scrollbar-track { background: #0d0f13; }
  html::-webkit-scrollbar-thumb { min-height: 52px; border: 3px solid #0d0f13; border-radius: 999px; background: #59616d; }
  html::-webkit-scrollbar-thumb:hover { background: var(--accent); }
  :root[data-theme="light"] { scrollbar-color: #a99d8b #faf8f4; }
  :root[data-theme="light"]::-webkit-scrollbar-track { background: #faf8f4; }
  :root[data-theme="light"]::-webkit-scrollbar-thumb { border-color: #faf8f4; background: #a99d8b; }
}

/* ------------------------------------------------------------------ BASE --- */
@layer base {
  body { background: var(--bg); color: var(--text);
    font-family: var(--font-sans); font-size: var(--fs-body); }
  h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 800;
    line-height: var(--lh-tight); letter-spacing: var(--ls-display); text-wrap: balance; }
  /* было font-weight:700 (Unbounded даёт только 600/800, берём готовое начертание,
     не полагаемся на подмену веса браузером); letter-spacing было -.015em */
  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
  h3 { font-size: var(--fs-lg); }
  p { text-wrap: pretty; }
  a { color: var(--accent-ink); transition: color var(--dur-fast) var(--ease); }
  a:hover { color: var(--accent-hover); }
  code, kbd, samp, pre { font-family: var(--font-mono); }
  strong, b { font-weight: 700; }
  small { font-size: var(--fs-sm); }
  hr { border: 0; border-top: 1px solid var(--border); }
}

/* ---------------------------------------------------------------- LAYOUT ---
   Десктоп: боковое меню + контент. До 1200px: меню уходит, сверху топбар,
   снизу — нижняя панель. Один брейкпоинт — как в черновике (десктоп первичен:
   80.9% заходов с компьютеров). */
@layer layout {
  .app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - 70px); transition: grid-template-columns var(--dur-base) var(--ease); }
  .content { display: flex; min-width: 0; flex-direction: column; overflow-x: clip; }
  .content > .main { flex: 1 0 auto; }
  .container { width: 100%; max-width: var(--content-max); margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 3rem); }
  .section { padding-block: clamp(1rem, 2vw, 1.75rem); } /* было clamp(1.25rem, 3vw, 2.5rem), меньше пустот между секциями */
  .topbar, .bottombar { display: none; }

  .stack { display: flex; flex-direction: column; gap: var(--sp-4); }
  .row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
  .grid { display: grid; gap: var(--sp-5);
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } /* было без колонок (1 колонка факт.) */
  .between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
  .flex-1 { flex: 1; min-width: 0; }

  @media (min-width: 1200px) {
    :root.sidebar-is-collapsed .app { grid-template-columns: 0 minmax(0, 1fr); }
    :root.sidebar-is-collapsed .sidebar { visibility: hidden; opacity: 0; overflow: hidden; padding-inline: 0; border-right-color: transparent; }
  }

  @media (max-width: 1199.98px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    /* Основной site-navbar уже содержит все мобильные действия. Второй topbar
       дублировал логотип и тему, съедал высоту и ломал первый экран. */
    .topbar { display: none; }
    .bottombar { display: flex; position: fixed; inset: auto 0 0 0; z-index: 40;
      height: calc(var(--bottombar-h) + env(safe-area-inset-bottom));
      padding-bottom: env(safe-area-inset-bottom);
      background: var(--surface); border-top: 1px solid var(--border); }
    .content { padding-bottom: calc(var(--bottombar-h) + var(--sp-5)); }
  }
}

/* ------------------------------------------------------------------- NAV --- */
@layer nav {
  .site-navbar { position: sticky; top: 0; z-index: 25; display: grid;
    grid-template-columns: auto minmax(150px, 1fr) minmax(260px, 560px) auto minmax(0, 1fr) auto auto auto;
    align-items: center; gap: var(--sp-3); min-height: 70px; padding: var(--sp-3) clamp(1rem, 3vw, 2rem);
    border-bottom: 1px solid var(--border); background: color-mix(in oklab, var(--bg) 92%, transparent);
    backdrop-filter: blur(14px); }
  .site-navbar__brand { display: inline-flex; align-items: center; gap: var(--sp-2); width: max-content;
    color: var(--text); font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; }
  .site-navbar__brand b { color: var(--accent-ink); }
  .site-navbar__sidebar-toggle,
  .site-navbar__mobile-menu-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--r-pill); color: var(--text-muted); background: color-mix(in srgb, var(--surface-2) 78%, transparent); transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .site-navbar__mobile-menu-toggle { display: none; }
  .site-navbar__sidebar-toggle:hover,
  .site-navbar__mobile-menu-toggle:hover { color: var(--accent-ink); background: var(--accent-bg); transform: scale(.96); }
  .site-navbar__sidebar-toggle:active,
  .site-navbar__mobile-menu-toggle:active { transform: scale(.9); }
  .site-navbar__sidebar-toggle:focus-visible,
  .site-navbar__mobile-menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .site-navbar__search { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; height: 42px;
    padding-inline: var(--sp-4); border: 1px solid var(--border-strong); border-radius: var(--r-pill);
    color: var(--text-muted); background: var(--surface); transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
  .site-navbar__search:hover { border-color: var(--accent); transform: scale(.985); }
  .site-navbar__search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
  .site-navbar__search:active { color: var(--accent-ink); background: var(--surface); border-color: var(--accent); transform: scale(.96); }
  .site-navbar__search:active input { color: var(--text); }
  .site-navbar__search:active input::placeholder { color: var(--text-muted); }
  .site-navbar__search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); }
  .site-navbar__search input[type="search"]::-webkit-search-cancel-button { appearance: none; }
  .site-navbar__search input::placeholder { color: var(--text-muted); }
  .site-navbar__shortcut { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--text-muted); }
  .site-navbar__shortcut kbd { padding: 2px 6px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--r-sm);
    color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 14%, transparent); font-family: var(--font-mono); font-size: var(--fs-caption); }
  .site-navbar__search.is-searching .site-navbar__shortcut { display: none; }
  .site-navbar__search-status { flex: none; color: var(--accent-ink); font-family: var(--font-mono); font-size: var(--fs-caption); font-weight: 700; white-space: nowrap; }
  .site-navbar__search-status.is-empty { color: var(--text-muted); }
  .site-navbar__search-clear { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: -6px;
    border-radius: 50%; color: var(--accent); font-size: 17px; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .site-navbar__search-clear:hover { color: var(--accent-contrast); background: var(--accent); transform: scale(1.08); }
  body.search-is-open { overflow: hidden; }
  .search-palette[hidden] { display: none; }
  .search-palette { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: start center; padding: clamp(72px, 10vh, 120px) 20px 24px; }
  .search-palette__backdrop { position: absolute; inset: 0; background: color-mix(in srgb, #050607 72%, transparent); backdrop-filter: blur(9px) saturate(.7); animation: palette-fade .16s ease both; }
  .search-palette__dialog { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(780px, 100%); max-height: min(720px, calc(100dvh - 96px)); overflow: hidden; border: 1px solid var(--border-strong); border-radius: 24px; background: color-mix(in srgb, var(--raised) 96%, #000); box-shadow: 0 32px 90px color-mix(in srgb, #000 58%, transparent); animation: palette-in .2s var(--ease) both; }
  @keyframes palette-fade { from { opacity: 0; } }
  @keyframes palette-in { from { opacity: 0; transform: translateY(-10px) scale(.985); } }
  .search-palette__bar { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .search-palette__bar>i { color: var(--text-muted); font-size: 21px; }
  .search-palette__bar input { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--r-pill); outline: 0; color: var(--text); background: color-mix(in srgb, var(--surface) 88%, #000); font: 650 var(--fs-base)/1 var(--font-sans); box-shadow: inset 0 0 0 2px color-mix(in srgb, #000 32%, transparent); }
  .search-palette__bar input:focus { border-color: color-mix(in srgb, var(--text-muted) 70%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 7%, transparent), inset 0 0 0 2px color-mix(in srgb, #000 32%, transparent); }
  .search-palette__bar button { height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; color: var(--text-muted); background: var(--surface); font: 750 var(--fs-caption)/1 var(--font-sans); cursor: pointer; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
  .search-palette__bar button:hover { color: var(--text); border-color: var(--border-strong); }
  .search-palette__results { min-height: 240px; padding: 10px 9px 18px; overflow-y: auto; scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
  .search-palette__group h3 { margin: 12px 12px 7px; color: var(--text-muted); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
  .search-palette__item { display: grid; grid-template-columns: 40px minmax(0, 1fr) 22px; align-items: center; gap: 12px; min-height: 66px; padding: 8px 12px; border: 1px solid transparent; border-radius: 14px; color: var(--text); transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
  .search-palette__item:hover,.search-palette__item.is-active { border-color: color-mix(in srgb, var(--border) 80%, transparent); color: var(--text); background: color-mix(in srgb, var(--surface) 86%, transparent); }
  .search-palette__icon { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--border); border-radius: 11px; color: var(--text-muted); background: color-mix(in srgb, var(--surface) 75%, transparent); font-size: 18px; }
  .search-palette__copy { display: grid; gap: 4px; min-width: 0; }
  .search-palette__copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Сниппет из тела статьи: до двух строк, дальше многоточие. */
  .search-palette__copy small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .search-palette__copy small mark { background: color-mix(in oklab, var(--accent) 32%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }
  .search-palette__lock { flex: none; align-self: center; }
  .search-palette__copy strong { font-size: var(--fs-sm); }
  .search-palette__copy small { color: var(--text-muted); font-size: var(--fs-caption); }
  .search-palette mark { padding: 0 2px; border-radius: 3px; color: var(--text); background: color-mix(in srgb, var(--text) 13%, transparent); }
  .search-palette__enter { color: var(--text-muted); opacity: 0; }.search-palette__item.is-active .search-palette__enter { opacity: 1; }
  .search-palette__empty { display: grid; min-height: 210px; place-content: center; justify-items: center; gap: 8px; padding: 28px; color: var(--text-muted); text-align: center; }
  .search-palette__empty[hidden] { display: none; }.search-palette__empty i { font-size: 28px; }.search-palette__empty strong { color: var(--text-2); }.search-palette__empty span { font-size: var(--fs-sm); }
  .search-palette__footer { display: flex; align-items: center; gap: 18px; min-height: 48px; padding: 0 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-caption); }
  .search-palette__footer span { display: inline-flex; align-items: center; gap: 5px; }.search-palette__footer kbd { display: inline-grid; min-width: 23px; height: 23px; place-items: center; padding: 0 5px; border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); background: var(--surface); font-family: var(--font-sans); }.search-palette__footer em { margin-left: auto; font-style: normal; }
  @media (max-width: 640px) { .search-palette { align-items: stretch; padding: 0; }.search-palette__dialog { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }.search-palette__bar { grid-template-columns: 20px minmax(0,1fr) auto; padding: 10px; }.search-palette__bar input { height: 40px; }.search-palette__bar button { padding-inline: 9px; }.search-palette__footer { gap: 10px; padding-inline: 10px; }.search-palette__footer em { display: none; }.search-palette__footer span { font-size: 0; }.search-palette__footer kbd { font-size: var(--fs-caption); }.search-palette__item { min-height: 62px; padding-inline: 8px; } }
  .site-navbar__ask { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; column-gap: 8px; box-sizing: border-box; width: 132px; height: 42px;
    padding: 0 14px; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--r-pill); color: var(--text); font-weight: 600;
    transition: width var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
  .site-navbar__ask:hover, .site-navbar__ask:focus-visible { width: 126px; color: var(--accent-ink); background: var(--accent-bg); border-color: var(--accent); transform: scale(.96); }
  .site-navbar__ask:active { width: 122px; color: var(--accent-contrast); background: var(--accent); transform: scale(.90); }
  .site-navbar__ask-glyph { width: 18px; height: 18px; background: currentColor; -webkit-mask: url('/static/v3/img/assistant-icon.svg') center / contain no-repeat; mask: url('/static/v3/img/assistant-icon.svg') center / contain no-repeat; }
  .site-navbar__ask-text { min-width: 0; white-space: nowrap; font-size: var(--fs-sm); line-height: 1; }
  .site-navbar__market-group { grid-column: 6; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; }
  .site-navbar__market { display: inline-flex; align-items: center; color: var(--text); font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 600; }
  .site-navbar__market-divider { width: 1px; height: 17px; background: var(--border-strong); opacity: .7; }
  .site-navbar__balance-control { display: inline-flex; align-items: center; min-height: 28px; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--raised); }
  .site-navbar__balance { display: inline-flex; align-items: center; gap: 5px; min-height: 27px; padding: 0 9px;
    color: var(--text); font-size: var(--fs-caption); white-space: nowrap;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
  .site-navbar__balance .ti { color: var(--text-muted); font-size: 13px; }
  .site-navbar__balance strong { font-weight: 800; }
  .site-navbar__balance-add { display: inline-grid; place-items: center; width: 27px; align-self: stretch; border-left: 1px solid var(--border);
    color: var(--accent); font-size: 18px; font-weight: 800; line-height: 1; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
  .site-navbar__balance-add:hover { background: var(--accent); color: var(--accent-contrast); }
  /* Обе половины пилюли — ссылки: сумма ведёт в кошелёк, «+» сразу в пополнение. */
  .site-navbar__balance-control a { text-decoration: none; cursor: pointer; }
  .site-navbar__balance:hover { color: var(--accent-ink); background: var(--accent-bg); }
  .site-navbar__theme { grid-column: 7; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--border-strong);
    border-radius: 50%; color: var(--text); transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .site-navbar__theme .ti { font-size: 13px; }
  .site-navbar__theme:hover { color: var(--accent-ink); background: var(--accent-bg); transform: rotate(14deg); }
  .site-navbar__logout { grid-column: 8; display: inline-flex; align-items: center; justify-content: center;
    justify-self: end; position: relative; width: 28px; height: 28px; overflow: hidden; border: 1px solid var(--border-strong);
    border-radius: 50%; color: var(--text); transition: width var(--dur-fast) var(--ease), border-radius var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
  .site-navbar__market:hover { color: var(--accent-ink); }
  .site-navbar__logout:hover { color: var(--text); background: var(--raised); }
  .site-navbar__logout .ti { position: absolute; font-size: 13px; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .site-navbar__logout-label { position: absolute; opacity: 0; transform: translateX(8px); white-space: nowrap;
    font-size: var(--fs-sm); font-weight: 600; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  @media (hover: hover) {
    .site-navbar__logout:hover, .site-navbar__logout:focus-visible { width: 70px; border-radius: var(--r-pill); }
    .site-navbar__logout:hover .ti, .site-navbar__logout:focus-visible .ti { opacity: 0; transform: translateX(-8px) scale(.8); }
    .site-navbar__logout:hover .site-navbar__logout-label, .site-navbar__logout:focus-visible .site-navbar__logout-label { opacity: 1; transform: translateX(0); }
  }
  .sidebar { position: sticky; top: 70px; align-self: start; height: calc(100vh - 70px); overflow-y: auto;
    display: flex; flex-direction: column; gap: var(--sp-4);
    padding: var(--sp-4); border-right: 1px solid var(--border); background: var(--surface);
    scrollbar-width: thin; scrollbar-color: #59616d #15181e; direction: rtl; }
  .sidebar > * { direction: ltr; }
  .sidebar::-webkit-scrollbar { width: 10px; }
  .sidebar::-webkit-scrollbar-track { background: #15181e; border-right: 1px solid #2b3039; }
  .sidebar::-webkit-scrollbar-thumb { min-height: 44px; background: #59616d; border: 2px solid #15181e;
    border-radius: 999px; }
  .sidebar::-webkit-scrollbar-thumb:hover { background: var(--accent); }
  :root[data-theme="light"] .sidebar { scrollbar-color: #a99d8b #f4f0e8; }
  :root[data-theme="light"] .sidebar::-webkit-scrollbar-track { background: #f4f0e8; border-right-color: #e4ddd2; }
  :root[data-theme="light"] .sidebar::-webkit-scrollbar-thumb { background: #a99d8b; border-color: #f4f0e8; }
  /* ⛔мобильный: прячем боковое меню именно здесь, в слое nav. В слое layout
     это правило проигрывает: слой объявлен раньше и уступает независимо от
     медиазапроса, из-за чего на телефоне меню занимало весь первый экран. */
  @media (max-width: 1199.98px) { .sidebar { display: none; } }
  @media (max-width: 1199.98px) {
    .site-navbar { position: relative; grid-template-columns: auto minmax(0, 1fr) auto auto auto auto; min-height: 58px; }
    .site-navbar__sidebar-toggle { display: none; }
    .site-navbar__mobile-menu-toggle { display: inline-grid; }
    .site-navbar__brand { font-size: var(--fs-sm); }
    .site-navbar__search { display: none; }
    .site-navbar__ask { display: none; }
    .site-navbar__market-group, .site-navbar__theme, .site-navbar__logout { grid-column: auto; }
    .site-navbar__market-divider, .site-navbar__balance-control { display: none; }
  }
  @media (max-width: 700px) { .site-navbar__ask-text { display: none; }
    .site-navbar__ask { grid-template-columns: 18px; width: 42px; padding: 0 11px; }
    .site-navbar__market { font-size: var(--fs-caption); }
    .site-navbar__logout { width: 28px; height: 28px; } }
  .brand { display: flex; align-items: center; justify-content: flex-start; gap: var(--sp-2);
    font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg);
    letter-spacing: -.01em; padding: var(--sp-2) var(--sp-2) 0; }
  .brand b { color: var(--accent-ink); font-weight: 700; }
  .brand-logo { width: 30px; height: 30px; border-radius: 7px; flex: none; display: block; }
  .brand-logo--image { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
  .brand-mark { display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: var(--accent-contrast); font-family: var(--font-display);
    font-size: 15px; font-weight: 800; line-height: 1; }
  .brand-word { display: inline-flex; align-items: center; }
  .nav-group { display: flex; flex-direction: column; gap: 2px; }
  .nav-group + .nav-group { margin-top: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid color-mix(in srgb, var(--border) 78%, transparent); }
  .nav-cap { display: flex; align-items: center; min-height: 26px; font-family: var(--font-mono); font-size: var(--fs-caption);
    font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--text-muted); padding: var(--sp-1) var(--sp-2); }
  .nav-item { display: flex; align-items: center; gap: var(--sp-3);
    min-height: 40px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r);
    color: var(--text-2); font-size: var(--fs-body); font-weight: 500;
    border-left: 2px solid transparent; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
  .nav-item:hover { background: var(--raised); color: var(--text); }
  .nav-item[aria-current="page"] { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-ink);
    border-left-color: var(--accent); box-shadow: inset 1px 0 0 color-mix(in srgb, var(--accent) 48%, transparent); font-weight: 600; }
  .nav-item .ti { flex: none; font-size: 17px; }
  .nav-count { margin-left: auto; min-width: 20px; padding: 1px 5px; border-radius: var(--r-pill); font-family: var(--font-mono); font-size: var(--fs-caption);
    color: var(--text-muted); background: color-mix(in srgb, var(--raised) 76%, transparent); text-align: center; }
  .nav-item[aria-current="page"] .nav-count { color: var(--accent-ink); }
  .nav-admin { margin-top: auto; padding-top: var(--sp-3); border-top: 1px dashed var(--border); }

  /* нижняя панель (мобайл) */
  .bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; min-height: 44px; color: var(--text-muted);
    font-size: 10px; font-weight: 600; }
  .bottombar a .ti { font-size: 19px; }
  .bottombar a[aria-current="page"] { color: var(--accent-ink); }

  /* мобильное выезжающее меню (drawer) */
  .drawer { position: fixed; inset: 0; z-index: 50; display: none; }
  html:has(#nav-toggle:checked) .drawer { display: block; }
  .drawer__scrim { position: absolute; inset: 0; background: var(--overlay); }
  .drawer__panel { position: absolute; inset: 0 20% 0 0; max-width: 320px;
    background: var(--surface); border-right: 1px solid var(--border);
    padding: var(--sp-4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-4);
    animation: drawer-in var(--dur) var(--ease); }
  @keyframes drawer-in { from { transform: translateX(-8px); opacity: 0; } }
  @media (min-width: 1200px) {
    .drawer { display: none !important; }
  }
  @media (max-width: 1199.98px) {
    html:has(#nav-toggle:checked),
    body:has(#nav-toggle:checked) { overflow: hidden; }
    .drawer__scrim { background: var(--bg); }
    .drawer__panel {
      inset: 0;
      max-width: none;
      border: 0;
      padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-4) calc(var(--sp-6) + env(safe-area-inset-bottom));
      box-shadow: none;
    }
  }
}

/* ------------------------------------------------------------ COMPONENTS --- */
@layer components {
  .eyebrow { font-family: var(--font-mono); font-size: var(--fs-caption);
    font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--accent-ink); }
  .muted { color: var(--text-muted); }
  .mono { font-family: var(--font-mono); }
  .lead { color: var(--text-2); font-size: var(--fs-md); max-width: 56ch; }

  /* поиск */
  .search { display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-strong);
    border-radius: var(--r); color: var(--text-muted); background: var(--surface); }
  .search input { flex: 1; min-width: 0; border: 0; background: none; outline: none;
    color: var(--text); }
  .search input::placeholder { color: var(--text-muted); }
  .search .kbd { margin-left: auto; }
  .kbd { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px 6px; }

  /* кнопки */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    min-height: 44px; padding: 0 var(--sp-4); border-radius: var(--r);
    font-weight: 600; font-size: var(--fs-body); line-height: 1; white-space: nowrap;
    border: 1px solid transparent; color: var(--text);
    transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease); }
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: translateY(1px); }
  .btn--primary { background: var(--accent); color: var(--accent-contrast); }
  .btn--primary:hover { background: var(--accent-btn-hover); color: var(--accent-contrast); }
  .btn--ghost { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
  .btn--ghost:hover { background: var(--raised); }
  .btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
  .btn--block { width: 100%; }
  .btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

  /* бейджи */
  .badge { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-height: 19px;
    font-family: var(--font-mono); font-size: 10px; font-weight: 800;
    letter-spacing: .045em; padding: 2px 5px; border-radius: var(--r-pill); border: 1px solid var(--border); color: var(--text-2);
    line-height: 1; text-transform: uppercase; white-space: nowrap; }
  .badge--pro { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: color-mix(in oklab, var(--accent) 52%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent); }
  /* было = .badge--pro один в один (--accent-ink/--accent-bg), в списке статей
     метки-близнецы неразличимы. NEW теперь на холодном токене --new-*, PRO
     остаётся оранжевым (платная метка). */
  .badge--new { color: var(--new-ink); background: color-mix(in srgb, var(--new-bg) 72%, transparent);
    border-color: color-mix(in oklab, var(--new-ink) 48%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--new-ink) 7%, transparent); }
  .badge--new::before { content: '✦'; font-size: .85em; line-height: 1; }
  /* HUBSearch beta: гамма NEW (--new-*), но с ромбиком вместо звёздочки — метки различимы рядом */
  .badge--beta { color: var(--new-ink); background: color-mix(in srgb, var(--new-bg) 72%, transparent);
    border-color: color-mix(in oklab, var(--new-ink) 48%, transparent); }
  .badge--beta::before { content: ''; width: 5px; height: 5px; flex: none; background: currentColor;
    transform: rotate(45deg); border-radius: 1px; }
  /* HUBSearch beta: на узких экранах ссылку палитры прячем, как соседний em, — иначе оверфлоу на 320px */
  @media (max-width: 640px) { .search-palette__footer [data-hubsearch-all] { display: none; } }
  .badge--free { color: var(--text-muted); background: color-mix(in srgb, var(--text-muted) 8%, transparent);
    border-color: color-mix(in oklab, var(--border-strong) 72%, transparent); }
  .badge--free::before { width: 5px; height: 5px; content: ''; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 14%, transparent); }
  /* пакет «Гайды по CDN» — статьи открывает частичный доступ, не только полный PRO */
  .badge--cdn { color: var(--accent-ink); border-color: color-mix(in oklab, var(--accent) 24%, transparent); }
  .badge--dr { color: var(--text-muted); } /* черновик — виден только автору/allowlist */

  /* карточки */
  .card { background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); container-type: inline-size; }
  .card--pad { padding: clamp(.85rem, 2.5cqi, 1.15rem); } /* было clamp(1rem, 3cqi, 1.4rem) */
  .card__head { display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); background: var(--raised);
    border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .card__body { padding: clamp(.85rem, 2.5cqi, 1.15rem); } /* было clamp(1rem, 3cqi, 1.4rem) */
  /* кликабельная карточка — черновик стилизовал только блок, не ссылку */
  a.card { transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
  a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }

  /* статистика */
  .stats { display: flex; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
  .stat { flex: 1; padding: var(--sp-4); }
  .stat + .stat { border-left: 1px solid var(--border); }
  .stat__num { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); }
  .stat__num--accent { color: var(--accent-ink); }
  .stat__label { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 4px; }

  /* таблицы: единая сетка для обёрнутых и обычных таблиц в статьях */
  .table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
  .table, .prose > table { border-collapse: separate; border-spacing: 0; background: var(--surface); }
  .table { min-width: 580px; }
  .prose > table { overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-lg); }
  .table th, .table td, .prose > table th, .prose > table td { text-align: left; vertical-align: middle; padding: 12px 16px;
    border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
  .table th, .prose > table th { color: var(--text); background: var(--raised); font-family: var(--font-sans); font-weight: 700; }
  .table th:not(:last-child), .table td:not(:last-child), .prose > table th:not(:last-child), .prose > table td:not(:last-child) { border-right: 1px solid var(--border); }
  .table tbody tr:last-child td, .prose > table tbody tr:last-child td { border-bottom: 0; }
  .table tbody tr, .prose > table tbody tr { transition: background var(--dur-fast) var(--ease); }
  .table tbody tr:hover, .prose > table tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
  .table thead th:first-child, .prose > table thead th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
  .table thead th:last-child, .prose > table thead th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }
  .prose > table tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--r-lg) - 1px); }
  .prose > table tbody tr:last-child td:last-child { border-bottom-right-radius: calc(var(--r-lg) - 1px); }
  .table .num { text-align: right; font-family: var(--font-mono); }
  .table .num--accent { color: var(--accent-ink); }
  .table tfoot td, .table .total td { font-weight: 700; background: var(--raised); }

  /* чипы-фильтры */
  .filters { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
  /* было без display:inline-flex/align-items/justify-content: <button>/<a> без
     этих свойств не центрируют свою же однострочную надпись по min-height,
     текст прижимался к верхнему краю пилюли (админка: «Выдать / забрать PRO»,
     «Новости» в account.html, те же .chip и в фильтрах статей на home.html).
     Приведено к тому же паттерну, что и у .btn ниже. */
  .chip { display: inline-flex; align-items: center; justify-content: center;
    min-height: 36px; padding: 0 var(--sp-3); line-height: 1; border: 1px solid var(--border);
    border-radius: var(--r-pill); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .chip:hover { border-color: var(--border-strong); }
  .chip:active { transform: scale(.95); }
  .chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }

  /* цены */
  .price-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r); }
  .price-row--set { background: var(--accent-bg);
    border-color: color-mix(in oklab, var(--accent) 34%, var(--border)); }
  .price { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); white-space: nowrap; }
  .price--accent { color: var(--accent-ink); }
  .price s { color: var(--text-muted); font-weight: 400; }

  /* иконка-кнопка (бургер, поиск, тема на мобиле) */
  .icon-btn { display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--r); color: var(--text-2); flex: none;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .icon-btn:hover { background: var(--raised); color: var(--text); }
  .icon-btn:active { transform: scale(.92); }
  .icon-btn .ti { font-size: 20px; }

  footer.site { padding: var(--sp-6) 0 var(--sp-8); border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: var(--fs-sm); }
}

/* --------------------------------------------------------------- ARTICLE ---
   Пока не используется на /v3 (страница статьи — отдельная задача), но
   оставлено для следующего каркаса поверх этой же дизайн-системы. */
@layer article {
  .article { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: var(--sp-6);
    align-items: start; }
  .prose { max-width: var(--measure); font-size: var(--fs-md); line-height: var(--lh-article); }
  .prose > * + * { margin-top: 1.1em; }
  .prose h2 { font-size: var(--fs-xl); margin-top: 1.8em; }
  .prose h3 { font-size: var(--fs-lg); margin-top: 1.5em; }
  .prose a { text-decoration: underline; text-underline-offset: 2px;
    text-decoration-color: color-mix(in oklab, var(--accent-ink) 45%, transparent); }
  .prose :not(pre) > code { font-size: .88em; color: var(--code-text); background: var(--code-bg);
    border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 6px; }
  .toc { position: sticky; top: var(--sp-4); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--sp-4); background: var(--raised); font-size: var(--fs-sm); }
  .toc a { display: block; padding: var(--sp-1) 0; color: var(--text-2); }
  .toc a[aria-current="true"] { color: var(--accent-ink); font-weight: 600; }

  .code { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--r-lg);
    overflow: hidden; }
  .code__bar { display: flex; align-items: center; gap: 6px; padding: var(--sp-2) var(--sp-4);
    border-bottom: 1px solid var(--border); font-family: var(--font-mono);
    font-size: var(--fs-caption); color: var(--text-muted); }
  .code__dot { width: 9px; height: 9px; border-radius: 50%; opacity: .55; }
  .code pre { margin: 0; padding: var(--sp-4); overflow-x: auto;
    font-size: var(--fs-sm); line-height: 1.65; color: var(--code-text); }
  .code .kw { color: var(--code-kw); }
  .code .cm { color: var(--text-muted); }

  .callout { border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: var(--sp-4); background: var(--raised); }
  .callout__label { font-family: var(--font-mono); font-size: var(--fs-caption);
    font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
    margin-bottom: var(--sp-2); }

  @container (max-width: 620px) {
    .article { grid-template-columns: 1fr; }
    .toc { position: static; order: -1; }
  }
}

/* ----------------------------------------------------------------- FORMS --- */
@layer forms {
  .form { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 380px; }
  .field { display: flex; flex-direction: column; gap: var(--sp-2); }
  .label { font-size: var(--fs-sm); font-weight: 600; }
  .input { min-height: 44px; padding: 0 var(--sp-3); border: 1px solid var(--border-strong);
    border-radius: var(--r); background: var(--surface); color: var(--text); width: 100%;
    transition: border-color var(--dur-fast) var(--ease); }
  .input:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
  .input::placeholder { color: var(--text-muted); }
  .input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
  .help { font-size: var(--fs-sm); color: var(--text-muted); }

  /* чекбоксы/радио: без переопределения внешнего вида, только тактильный отклик на нажатие */
  input[type="checkbox"], input[type="radio"] { transition: transform var(--dur-fast) var(--ease); }
  input[type="checkbox"]:active, input[type="radio"]:active { transform: scale(.88); }
}

/* ---------------------------------------------------------------- STATES --- */
@layer states {
  .skeleton { background: linear-gradient(90deg, var(--raised) 0%,
      color-mix(in oklab, var(--raised) 60%, var(--border)) 50%, var(--raised) 100%);
    background-size: 200% 100%; border-radius: var(--r-sm); animation: shimmer 1.2s linear infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .empty, .error-box { border: 1px dashed var(--border); border-radius: var(--r-lg);
    padding: var(--sp-6); text-align: center; color: var(--text-muted); }
  .error-box { border-style: solid; border-color: color-mix(in oklab, var(--error) 40%, var(--border));
    color: var(--error); }
  [hidden] { display: none !important; }
}

/* ------------------------------------------------------------------ UTIL --- */
@layer util {
  .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .ml-auto { margin-left: auto; }
  .stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
  .divider { height: 1px; background: var(--border); }
}

/* ============================================================================
   v3 EXTRA — перенесено из боевого templates/base.html (не из черновика):
   водяной знак и бесшовные переходы между страницами. Плюс собственные мелкие
   компоненты витрины базы знаний (start-card/art-row), которых нет ни в
   черновике, ни в проде (там их рисует другой шаблон/раскладка).
   ========================================================================== */
@layer v3 {
  /* --- водяной знак: сетка "@username · id" поверх любой страницы залогиненного.
     Перенесено из base.html прода 1:1 (см. .wm там же), только имя переменной
     цвета текста заменено на токен этой дизайн-системы (--text вместо --txt). */
  .wm { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; opacity: .045; }  /* -1: знак уходит ЗА текст и не мешает читать, оставаясь видимым в промежутках */
  :root[data-theme="light"] .wm { opacity: .08; } /* на светлой теме знак должен остаться виден */
  .wm span { position: absolute; white-space: nowrap; transform: rotate(-28deg);
    font-size: 17px; color: var(--text); font-weight: 600; }

  /* --- переходы между страницами (SPA): контент .main мягко уходит/приходит,
     вверху едет прогресс-бар. Перенесено из base.html прода 1:1. */
  .main.is-leaving { opacity: .35; transform: translateY(4px); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .main.is-entering { animation: vhPageIn var(--dur-slow) var(--ease); }
  @keyframes vhPageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  #navProgress { position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 99; pointer-events: none;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover)); opacity: 0;
    transition: width .25s ease, opacity .2s; }
  #navProgress.on { width: 92%; opacity: 1; transition: width 1.1s cubic-bezier(.1,.8,.2,1), opacity .12s; }
  @media (prefers-reduced-motion: reduce) {
    .main.is-leaving, .main.is-entering { transition: none; animation: none; opacity: 1; transform: none; }
  }

  /* --- витрина базы знаний: точка входа в чтение (карточка «начните здесь»)
     и строка статьи в общем списке. Первый экран десктопа должен показывать
     список статей без прокрутки — см. templates/v3/home.html. */
  /* padding здесь переопределяет .card--pad (слой components): слой v3 объявлен
     позже и выигрывает независимо от специфичности, поэтому значение держим
     в паре с components, иначе правка там окажется незаметно перебита тут. */
  .start-card { align-items: center; gap: var(--sp-4); padding: clamp(.85rem, 2.5cqi, 1.15rem); } /* было clamp(1rem, 3cqi, 1.3rem) */
  .start-ic { flex: none; width: 46px; height: 46px; border-radius: var(--r-lg);
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-bg); color: var(--accent-ink); font-size: 21px; }
  .art-row { align-items: flex-start; gap: var(--sp-3); padding: .65rem .85rem; }
  .art-ic { flex: none; margin-top: 2px; color: var(--success); font-size: 15px; }
  .art-ic.is-locked { color: var(--text-muted); }
  .art-title { display: block; font-weight: 600; font-size: var(--fs-body); }
  .art-sum { display: block; font-size: var(--fs-caption); margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}


@layer nav {
  /* Заголовок страницы в шапке: длинное название ломалось на три строки и налезало
     на логотип. Держим одну строку, а на телефоне убираем совсем: там сразу под
     шапкой идёт тот же заголовок крупно. */
  .topbar .mono.ml-auto{max-width:40ch;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  @media (max-width: 900px){
    .topbar .mono.ml-auto{display:none}
  }
}


@layer nav, components;

@layer nav {
  /* Тот же шрифт, что в заголовках: интерфейсу он идёт, читается плотно и узнаваемо. */
  .nav-item, .nav-cap, .nav-count, .art-sec-t, .art-sec-c, .art-link-t,
  .sidebar .btn, .drawer .btn{
    font-family: var(--font-display);
    letter-spacing: -.01em;
  }
  .nav-cap{letter-spacing:.08em}
}

@layer components {
  .btn, .badge, .chip, .card__title, .stat b, .price, .kbd{
    font-family: var(--font-display);
    letter-spacing: -.01em;
  }
  /* Метки короткие и заглавными: им нужен чуть более широкий трекинг, иначе слипаются. */
  .badge{letter-spacing:.04em}
}


/* ============================================================================
   Правки по аудиту интерфейса.
   ========================================================================== */
@layer v3 {
  /* Длинные слова переносим, а не режем краем экрана. На 390px заголовок оферты
     «Условия использования и лицензия» терял половину слова. */
  h1, h2, h3, h4, p, li, dd, dt, summary, .card, .prose { overflow-wrap: break-word; }
  /* Ломать слово посреди букв некрасиво: у страницы lang=ru, поэтому браузер
     умеет переносить по слогам. break-word остаётся страховкой. */
  /* Переносы включаем только на узких экранах: на десктопе колонка широкая,
     слова помещаются, и дефисы там были бы лишним шумом. */
  /* Крупный дисплейный заголовок на узком экране: уменьшаем, иначе одно длинное
     слово занимает всю строку и всё равно ломается. */
  @media (max-width: 560px) {
    h1, h2, h3, h4, p, li { hyphens: auto; }
    h1 { font-size: clamp(1.45rem, 1.1rem + 3vw, 2rem); }
  }

  /* Кнопка во всю ширину живёт в узких колонках (пейвол статьи, карточка оплаты).
     Запрет переноса там срезал хвост надписи вместе с ценой. */
  .btn--block { white-space: normal; line-height: 1.3; padding-top: 10px; padding-bottom: 10px; }
}

/* ── Фильтр статей по панели управления (Remnawave / 3x-ui / Общие) ───────── */
.panel-filter{display:flex;flex-wrap:wrap;gap:6px;margin:12px 6px 16px;padding:0}
.panel-chip{
  appearance:none;-webkit-appearance:none;cursor:pointer;font:inherit;line-height:1;
  font-size:11px;font-weight:600;letter-spacing:.01em;
  padding:5px 11px;border-radius:999px;
  border:1px solid light-dark(rgba(15,23,42,.12),rgba(255,255,255,.14));
  background:light-dark(rgba(15,23,42,.03),rgba(255,255,255,.04));
  color:light-dark(#475569,#9aa4b2);
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.panel-chip:hover{color:light-dark(#0f172a,#e6eaf0);border-color:light-dark(rgba(15,23,42,.22),rgba(255,255,255,.24))}
.panel-chip:focus-visible{outline:2px solid #1f9fe0;outline-offset:2px}
.panel-chip.is-active{background:light-dark(#0f172a,#e6eaf0);color:light-dark(#fff,#0f172a);border-color:transparent}
.panel-chip--remna.is-active{background:#7c5cff;color:#fff}
.panel-chip--xui.is-active{background:#1f9fe0;color:#fff}
.panel-chip--common.is-active{background:light-dark(#64748b,#94a3b8);color:light-dark(#fff,#0f172a)}

/* микро-бейдж панели рядом с названием статьи в сайдбаре */
.panel-pill{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:16px;height:15px;padding:0 4px;border-radius:5px;
  font-size:9px;font-weight:700;letter-spacing:.02em;line-height:1;white-space:nowrap;
}
.panel-pill--remna{background:rgba(124,92,255,.16);color:light-dark(#6a45f5,#a58cff)}
.panel-pill--xui{background:rgba(31,159,224,.16);color:light-dark(#1682bd,#5cc1f0)}
.panel-pill--both{background:light-dark(rgba(15,23,42,.08),rgba(255,255,255,.1));color:light-dark(#475569,#c3ccd8)}

/* бейдж панели в шапке статьи */
.panel-badge{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12px;font-weight:600;line-height:1;
  padding:6px 12px;border-radius:999px;
  border:1px solid transparent;
}
.panel-badge i{font-size:14px}
.panel-badge--remna{background:rgba(124,92,255,.14);color:light-dark(#6a45f5,#b7a3ff);border-color:rgba(124,92,255,.28)}
.panel-badge--xui{background:rgba(31,159,224,.14);color:light-dark(#1682bd,#7cccf2);border-color:rgba(31,159,224,.28)}
.panel-badge--both{background:light-dark(rgba(15,23,42,.06),rgba(255,255,255,.08));color:light-dark(#334155,#cbd5e1);border-color:light-dark(rgba(15,23,42,.14),rgba(255,255,255,.16))}

/* ── Вкладки «Remnawave ⇆ 3x-ui» внутри статьи ───────────────────────────── */
.panes{margin:22px 0}
.pane-tabs{
  display:inline-flex;gap:4px;padding:4px;margin:0 0 16px;border-radius:12px;
  background:light-dark(rgba(15,23,42,.05),rgba(255,255,255,.05));
  border:1px solid light-dark(rgba(15,23,42,.08),rgba(255,255,255,.08));
}
.pane-tab{
  appearance:none;-webkit-appearance:none;cursor:pointer;font:inherit;
  font-size:13px;font-weight:600;line-height:1;padding:8px 17px;border-radius:9px;
  border:1px solid transparent;background:transparent;
  color:light-dark(#64748b,#9aa4b2);transition:background .15s ease,color .15s ease,box-shadow .15s ease;
}
.pane-tab:hover{color:light-dark(#0f172a,#e6eaf0)}
.pane-tab:focus-visible{outline:2px solid #1f9fe0;outline-offset:2px}
.pane-tab.is-active{background:light-dark(#fff,#1c2230);color:light-dark(#0f172a,#fff);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.pane-tab[data-pane-btn="remnawave"].is-active{color:light-dark(#6a45f5,#b7a3ff)}
.pane-tab[data-pane-btn="3x-ui"].is-active{color:light-dark(#1682bd,#7cccf2)}
.pane{display:none}
.pane.is-active{display:block;animation:paneIn .18s ease}
@keyframes paneIn{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}

/* второй ряд фильтров витрины — по панели управления */
.v3-panel-filters{margin-top:8px}
.v3-panel-filters .chip[data-panelf="remnawave"][aria-pressed="true"]{color:#fff;background:#7c5cff}
.v3-panel-filters .chip[data-panelf="3x-ui"][aria-pressed="true"]{color:#fff;background:#1f9fe0}
.v3-panel-filters .chip[aria-pressed="true"]{background:light-dark(#0f172a,#e6eaf0);color:light-dark(#fff,#0f172a)}
.v3-panel-filters .chip[data-panelf="all"][aria-pressed="true"],
.v3-panel-filters .chip[data-panelf="common"][aria-pressed="true"]{background:light-dark(#64748b,#94a3b8);color:light-dark(#fff,#0f172a)}
/* метка панели на карточке витрины */
.art-card__badges .panel-pill{margin-right:2px}

/* ── Автозаполнение Chrome ломало тёмную тему ──────────────────────────────
   Жалоба «дизайн полетел»: на Android Chrome красит поля с сохранёнными
   данными в свой белый фон и тёмный текст, игнорируя наши токены — на тёмной
   странице это выглядит как сломанная вёрстка. Перебиваем: фон подменяем
   внутренней тенью (сам background браузер не отдаёт), текст — text-fill-color. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
          box-shadow: 0 0 0 1000px var(--surface) inset !important;
  caret-color: var(--text) !important;
  transition: background-color 9999s ease-in-out 0s;
}

/* ── prefers-reduced-motion: общий предохранитель ─────────────────────────
   Точечное правило в слое v3 (.main.is-leaving/.is-entering) оставлено как
   было — оно ещё и фиксирует конечное состояние (opacity/transform), а не
   только гасит переход. Это правило — рубильник на весь /v3: файл грузится
   на каждой странице, поэтому гасит переходы/анимации и в других css
   (article/pro/shop/hubsearch и т.д.), до которых руки отдельно не доходили.
   Длительность не 0, а .001ms + одна итерация: у бесконечных анимаций
   (.skeleton — шиммер загрузки) это на слабом одноядерном сервере важнее,
   чем просто "незаметно" — реально останавливает пересчёты кадра, а не
   крутит их неощутимо быстро вхолостую.
   Автозаполнение Chrome выше нарочно висит на transition 9999s (чтобы жёлтый
   фон браузера не мелькал) — здесь это единственное осознанное исключение,
   его не трогаем. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:active,
  textarea:-webkit-autofill,
  select:-webkit-autofill {
    transition-duration: 9999s !important;
  }
}

/* vh-thin-space-fix: разделитель разрядов у нас тонкий пробел (U+2009), а
   моноширинный шрифт рисует ЛЮБОЙ знак на всю ширину — «10 499 ₽» расползалось
   в «10   499   ₽». Поджимаем пробелы там, где шрифт моноширинный. */
@layer v3 {
  .pro-price, .pro-total, .pro-sum-strike, .pro-stickybar-total,
  .pro-wrap .table .num, .pro-pricetable-save b,
  .fn-num, .fn-money-v, .wh-prize-w {
    word-spacing: -0.34em;
  }
}

@layer v3 {
  /* Флажки и переключатели — цветом сайта, а не браузерным синим. */
  input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
}


/* MOBSEARCH-300826 — вход в палитру поиска на мобильных.
   Кнопка в нижней панели стоит в одном ряду со ссылками, поэтому повторяет их
   правила (.bottombar a), но <button> дополнительно нужно раздеть от браузерных
   умолчаний: рамки, фона и своего шрифта. */
.bottombar button[data-search-open] {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; min-height: 44px; padding: 0;
  border: 0; background: none; font: inherit; font-size: 10px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.bottombar button[data-search-open] .ti { font-size: 19px; }
.bottombar button[data-search-open]:active { color: var(--accent-ink); }

.drawer__search {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  margin: var(--sp-3) 0 0; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-muted);
  font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.drawer__search .ti { font-size: 18px; }
.drawer__search:active { border-color: var(--accent); color: var(--accent-ink); }


/* NAVFIT-300826 — мобильная шапка не должна наезжать сама на себя.
   Бренд стоит в колонке minmax(0,1fr), но с width:max-content он не ужимается,
   а вылезает поверх соседа: словесный знак налезал на «Маркет» и на плашку PRO.
   min-width:0 возвращает ему право сжаться, а на узких экранах снимаем два
   дубля — словесный знак (рядом логотип-картинка) и ссылку «Маркет» (тот же
   пункт есть в нижней панели). */
@media (max-width: 1199.98px) {
  .site-navbar__brand { min-width: 0; overflow: hidden; }
}
@media (max-width: 700px) {
  .site-navbar__brand > span { display: none; }
  .site-navbar__market { display: none; }
  .site-navbar { gap: var(--sp-2); }
}

/* NAVFIT2-300826 — на 320px (iPhone SE и подобные) «Купить доступ» всё ещё
   наезжал на тему. Плашка PRO там влезала, а кнопка нет: она шире. Ужимаем
   саму кнопку и поля шапки, ярлык не режем — он и есть призыв к действию. */
@media (max-width: 400px) {
  .site-navbar { padding-inline: 12px; }
  .site-navbar__buy { height: 32px; padding: 0 11px; font-size: 12px; }
  .site-navbar__pro { height: 32px; padding: 0 11px; font-size: 11.5px; }
}
