/* ==========================================================================
   Портал документации С-Терра · дистрибьютор МОНТ
   Дизайн-система: токены, сброс, типографика, утилиты
   ========================================================================== */

/* --- Токены ---------------------------------------------------------------- */
:root {
  /* палитра бренда */
  --brand-900: #00142e;
  --brand-800: #002f62;
  --brand-700: #004c92;
  --brand-600: #0c5cad;
  --brand-500: #1573d4;
  --brand-400: #4fa3f0;
  --brand-300: #a7d1f7;
  --brand-100: #e8f2fd;

  /* акцент */
  --accent:      #00c2a8;
  --accent-dark: #009688;
  --accent-soft: #e3faf6;

  /* нейтральные */
  --bg:        #f4f7fc;
  --surface:   #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef3fa;
  --border:    #dfe7f2;
  --border-2:  #cbd8e8;
  --text:      #0e1b2e;
  --text-2:    #3d4f68;
  --muted:     #6b7d97;
  --muted-2:   #93a3b8;

  /* состояния */
  --ok:     #12a150;
  --warn:   #f2a900;
  --danger: #e5484d;

  /* типографика */
  --font-ui:   'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
               'Noto Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas,
               'Liberation Mono', monospace;

  /* геометрия */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* тени */
  --sh-1: 0 1px 2px rgba(16, 42, 82, .06), 0 1px 3px rgba(16, 42, 82, .05);
  --sh-2: 0 2px 6px rgba(16, 42, 82, .06), 0 8px 24px rgba(16, 42, 82, .07);
  --sh-3: 0 8px 20px rgba(16, 42, 82, .10), 0 24px 60px rgba(16, 42, 82, .12);
  --sh-brand: 0 10px 30px rgba(12, 92, 173, .28);

  /* каркас */
  --header-h: 70px;
  --container: 1360px;
  --side-w: 330px;
  --aside-w: 250px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --t: .22s var(--ease);
}

/* --- Сброс ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll { overflow: hidden; }

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-600); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--brand-500); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1.25;
  color: var(--brand-900);
  margin: 0 0 .5em;
  letter-spacing: -.015em;
}
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.3vw, 2.05rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
p  { margin: 0 0 1rem; }

::selection { background: var(--brand-300); color: var(--brand-900); }

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

/* --- Скроллбары ------------------------------------------------------------ */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

mark {
  background: #fff2b8;
  color: inherit;
  padding: 1px 3px;
  border-radius: 3px;
}

/* --- Контейнеры и секции --------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 24px; }
.container--narrow { max-width: 940px; }

.section { padding-block: clamp(40px, 6vw, 84px); }
.section--tight { padding-block: clamp(24px, 3vw, 44px); }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 32px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand-600); margin-bottom: 12px;
}
.eyebrow::before {
  content: ''; width: 22px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--brand-500));
  border-radius: 2px;
}

/* --- Утилиты --------------------------------------------------------------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 12px; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.stack > * + * { margin-top: 16px; }

/* --- Кнопки ---------------------------------------------------------------- */
.btn {
  --btn-bg: var(--brand-600);
  --btn-fg: #fff;
  --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px;
  font-family: var(--font-ui); font-size: .88rem; font-weight: 600;
  line-height: 1.2; color: var(--btn-fg);
  background: var(--btn-bg); border: 1px solid var(--btn-bd);
  border-radius: var(--r-sm); cursor: pointer; text-decoration: none;
  white-space: nowrap; user-select: none;
  transition: transform var(--t), box-shadow var(--t), background var(--t),
              color var(--t), border-color var(--t);
}
.btn:hover { transform: translateY(-1px); color: var(--btn-fg); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn--primary { --btn-bg: linear-gradient(135deg, var(--brand-600), var(--brand-700)); box-shadow: var(--sh-brand); }
.btn--primary:hover { box-shadow: 0 14px 34px rgba(12, 92, 173, .36); }
.btn--accent { --btn-bg: linear-gradient(135deg, var(--accent), var(--accent-dark)); box-shadow: 0 10px 26px rgba(0, 194, 168, .3); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--brand-700); --btn-bd: var(--border-2); }
.btn--ghost:hover { --btn-bg: var(--brand-100); --btn-bd: var(--brand-300); }
.btn--soft { --btn-bg: var(--surface-3); --btn-fg: var(--brand-800); }
.btn--soft:hover { --btn-bg: var(--brand-100); }
.btn--dark { --btn-bg: rgba(255,255,255,.12); --btn-fg: #fff; --btn-bd: rgba(255,255,255,.24); }
.btn--dark:hover { --btn-bg: rgba(255,255,255,.22); }
.btn--sm { padding: 8px 14px; font-size: .8rem; border-radius: var(--r-xs); }
.btn--lg { padding: 15px 28px; font-size: .98rem; border-radius: var(--r-md); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* --- Бейджи и чипы --------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-ui); font-size: .7rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--brand-700); background: var(--brand-100);
  border-radius: var(--r-pill); white-space: nowrap;
}
.badge--accent { color: var(--accent-dark); background: var(--accent-soft); }
.badge--muted { color: var(--muted); background: var(--surface-3); }
.badge--dark { color: #cfe4ff; background: rgba(255,255,255,.14); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px;
  font-family: var(--font-ui); font-size: .82rem; font-weight: 500;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  cursor: pointer; text-decoration: none;
  transition: all var(--t);
}
.chip:hover { border-color: var(--brand-400); color: var(--brand-700); background: var(--brand-100); transform: translateY(-1px); }
.chip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* --- Карточки -------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--brand-300); }
.card__body { padding: 22px; }

/* --- Хлебные крошки -------------------------------------------------------- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-size: .8rem; color: var(--muted);
  margin-bottom: 18px; list-style: none; padding: 0;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand-600); }
.crumbs__sep { opacity: .4; }
.crumbs__current { color: var(--text-2); font-weight: 600; }

/* --- Формы ----------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label {
  font-family: var(--font-ui); font-size: .76rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.input, .select, .textarea {
  width: 100%; padding: 11px 14px;
  font-family: var(--font-body); font-size: .92rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); transition: all var(--t);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--brand-400); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(21, 115, 212, .14);
}
.textarea { min-height: 120px; resize: vertical; font-family: var(--font-mono); font-size: .84rem; }
.select {
  appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7d97' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.checkbox {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-ui); font-size: .85rem; color: var(--text-2);
  cursor: pointer; user-select: none;
}
.checkbox input {
  appearance: none; width: 19px; height: 19px; flex: none; margin: 0;
  border: 1.5px solid var(--border-2); border-radius: 5px; background: var(--surface);
  cursor: pointer; transition: all var(--t);
  background-position: center; background-repeat: no-repeat; background-size: 12px;
}
.checkbox input:checked {
  background-color: var(--brand-600); border-color: var(--brand-600);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}

/* --- Шапка ----------------------------------------------------------------- */
.header {
  position: sticky; top: 0; z-index: 90;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 28px;
}
.header__logo { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.header__logo img { height: 32px; width: auto; }
.header__logo-divider {
  width: 1px; height: 26px; background: var(--border-2); flex: none;
}
.header__logo-text {
  font-family: var(--font-ui); font-size: .74rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  line-height: 1.25; max-width: 110px;
}

.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav__link {
  position: relative; padding: 9px 14px;
  font-family: var(--font-ui); font-size: .86rem; font-weight: 600;
  color: var(--text-2); border-radius: var(--r-xs); transition: all var(--t);
}
.nav__link:hover { color: var(--brand-700); background: var(--surface-3); }
.nav__link.is-active { color: var(--brand-700); }
.nav__link.is-active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--brand-500));
}
.header__actions { display: flex; align-items: center; gap: 10px; flex: none; }

.burger {
  display: none; width: 42px; height: 42px; padding: 0; flex: none;
  background: transparent; border: 1px solid var(--border); border-radius: var(--r-xs);
  cursor: pointer; position: relative;
}
.burger span, .burger span::before, .burger span::after {
  content: ''; position: absolute; left: 11px; width: 18px; height: 2px;
  background: var(--brand-800); border-radius: 2px; transition: all var(--t);
}
.burger span { top: 19px; }
.burger span::before { left: 0; top: -6px; }
.burger span::after { left: 0; top: 6px; }
.burger.is-open span { background: transparent; }
.burger.is-open span::before { transform: translateY(6px) rotate(45deg); }
.burger.is-open span::after { transform: translateY(-6px) rotate(-45deg); }

/* мобильное меню */
.drawer {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 80;
  background: var(--surface); overflow-y: auto;
  padding: 20px 24px 40px;
  transform: translateX(100%); transition: transform .3s var(--ease);
  visibility: hidden;
}
.drawer.is-open { transform: translateX(0); visibility: visible; }
.drawer__nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 24px; }
.drawer__nav a {
  padding: 14px 12px; font-family: var(--font-ui); font-weight: 600;
  font-size: 1rem; color: var(--text); border-bottom: 1px solid var(--border);
}
.drawer__nav a.is-active { color: var(--brand-600); }

/* --- Hero ------------------------------------------------------------------ */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(0, 194, 168, .28), transparent 62%),
    radial-gradient(900px 520px at 88% 8%, rgba(79, 163, 240, .32), transparent 60%),
    linear-gradient(150deg, var(--brand-900) 0%, var(--brand-800) 42%, var(--brand-700) 100%);
  color: #fff;
  padding-block: clamp(52px, 8vw, 104px) clamp(48px, 7vw, 92px);
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(700px 420px at 50% 20%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(700px 420px at 50% 20%, #000 30%, transparent 78%);
}
.hero::after {
  content: ''; position: absolute; right: -140px; bottom: -220px;
  width: 560px; height: 560px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(0,194,168,.22), transparent 65%);
  filter: blur(10px);
}
.hero__inner { position: relative; z-index: 1; max-width: 900px; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 16px; margin-bottom: 24px;
  font-family: var(--font-ui); font-size: .74rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: #cfe9ff; background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.18); border-radius: var(--r-pill);
  backdrop-filter: blur(6px);
}
.hero__eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 194, 168, .22);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0,194,168,.22); }
  50%      { box-shadow: 0 0 0 8px rgba(0,194,168,.06); }
}
.hero h1 {
  color: #fff; margin: 0 0 18px;
  font-weight: 800; letter-spacing: -.025em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(92deg, #7ce7d8, #9fd0ff 60%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero__lead {
  font-size: clamp(1rem, .95rem + .4vw, 1.18rem);
  color: rgba(226, 238, 252, .88); max-width: 66ch; margin: 0 0 34px;
}
.hero__stats {
  display: flex; flex-wrap: wrap; gap: 34px;
  margin-top: 42px; padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,.14);
}
.hero__stat b {
  display: block; font-family: var(--font-ui); font-size: 1.75rem;
  font-weight: 800; color: #fff; line-height: 1.1;
}
.hero__stat span {
  font-size: .8rem; color: rgba(207, 226, 250, .7);
  letter-spacing: .03em;
}

/* --- Поисковое поле с подсказками ------------------------------------------ */
.searchbox { position: relative; }
.searchbox__form {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 9px 9px 20px;
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: 0 18px 44px rgba(0, 12, 32, .32);
  border: 1px solid rgba(255,255,255,.5);
}
.searchbox__icon { width: 21px; height: 21px; flex: none; color: var(--muted-2); }
.searchbox__input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 1rem; color: var(--text); padding: 8px 0;
}
.searchbox__input::placeholder { color: var(--muted-2); }
.searchbox__clear {
  flex: none; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface-3);
  color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1;
  display: none; transition: all var(--t);
}
.searchbox__clear:hover { background: var(--border); color: var(--text); }
.searchbox.has-value .searchbox__clear { display: block; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 8px; max-height: 60vh; overflow-y: auto;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
.suggest.is-open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.suggest__item {
  display: block; padding: 10px 12px; border-radius: var(--r-xs);
  color: var(--text); text-decoration: none; transition: background var(--t);
}
.suggest__item:hover, .suggest__item.is-cursor { background: var(--brand-100); }
.suggest__title {
  font-family: var(--font-ui); font-size: .9rem; font-weight: 600;
  color: var(--brand-900); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.suggest__meta {
  display: flex; gap: 8px; align-items: center; margin-top: 3px;
  font-size: .74rem; color: var(--muted);
}
.suggest__empty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: .88rem; }
.suggest__foot {
  margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: .78rem; color: var(--muted);
}

/* --- Быстрые ссылки под поиском -------------------------------------------- */
.hero__quick { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; align-items: center; }
.hero__quick-label {
  font-family: var(--font-ui); font-size: .76rem; color: rgba(207,226,250,.62);
  letter-spacing: .06em; text-transform: uppercase; margin-right: 4px;
}
.hero__quick a {
  padding: 6px 14px; font-size: .82rem; font-family: var(--font-ui); font-weight: 500;
  color: #e6f1ff; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16); border-radius: var(--r-pill);
  transition: all var(--t);
}
.hero__quick a:hover { background: rgba(255,255,255,.2); color: #fff; transform: translateY(-1px); }

/* --- Сетки ----------------------------------------------------------------- */
.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* --- Карточка продукта ----------------------------------------------------- */
.pcard {
  position: relative; display: flex; flex-direction: column;
  padding: 26px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.pcard::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(180deg, var(--pc-accent, var(--brand-500)), var(--accent));
  opacity: .85; transition: width var(--t);
}
.pcard:hover { transform: translateY(-5px); box-shadow: var(--sh-3); border-color: var(--brand-300); }
.pcard:hover::before { width: 6px; }
.pcard__icon {
  width: 48px; height: 48px; border-radius: var(--r-sm);
  display: grid; place-items: center; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--brand-100), var(--accent-soft));
  color: var(--brand-700);
}
.pcard__icon svg { width: 25px; height: 25px; }
.pcard__title {
  font-family: var(--font-ui); font-size: 1.14rem; font-weight: 700;
  color: var(--brand-900); margin: 0 0 8px;
}
.pcard__title a { color: inherit; }
.pcard__title a:hover { color: var(--brand-600); }
.pcard__text { color: var(--muted); font-size: .9rem; margin: 0 0 18px; flex: 1 1 auto; }
.pcard__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.pcard__links {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 16px; border-top: 1px solid var(--border);
}

/* --- Карточка-фича --------------------------------------------------------- */
.fcard {
  padding: 26px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--sh-1); transition: all var(--t);
  display: block; color: inherit; text-decoration: none;
}
.fcard:hover { transform: translateY(-4px); box-shadow: var(--sh-2); border-color: var(--brand-300); color: inherit; }
.fcard__icon {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  display: grid; place-items: center; margin-bottom: 16px;
  background: var(--brand-100); color: var(--brand-700);
}
.fcard__icon svg { width: 23px; height: 23px; }
.fcard h3 { font-size: 1.04rem; margin: 0 0 8px; }
.fcard p { margin: 0; color: var(--muted); font-size: .88rem; }
.fcard__count {
  margin-top: 14px; font-family: var(--font-ui); font-size: .78rem;
  font-weight: 700; color: var(--accent-dark);
}

/* --- Заголовок внутренней страницы ----------------------------------------- */
.page-head {
  background:
    radial-gradient(760px 340px at 88% -30%, rgba(0,194,168,.16), transparent 62%),
    linear-gradient(140deg, var(--brand-900), var(--brand-700));
  color: #fff;
  padding-block: clamp(28px, 4vw, 46px);
}
.page-head h1 { color: #fff; margin: 0 0 10px; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem); }
.page-head p { color: rgba(214, 231, 250, .82); margin: 0; max-width: 78ch; }
.page-head .crumbs { color: rgba(200, 222, 248, .7); }
.page-head .crumbs a { color: rgba(200, 222, 248, .8); }
.page-head .crumbs a:hover { color: #fff; }
.page-head .crumbs__current { color: #fff; }
.page-head .crumbs__sep { opacity: .4; }

/* --- Подвал ---------------------------------------------------------------- */
.footer {
  margin-top: auto;
  background: var(--brand-900); color: rgba(214, 231, 250, .72);
  padding-block: 52px 26px; font-size: .9rem;
}
.footer__grid {
  display: grid; gap: 32px;
  grid-template-columns: 1.7fr 1fr 1.15fr 1fr 1.35fr;
  padding-bottom: 34px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer__brand img { height: 30px; width: auto; filter: brightness(0) invert(1); margin-bottom: 16px; }
.footer__brand p { max-width: 40ch; color: rgba(214, 231, 250, .6); font-size: .86rem; }
.footer h4 {
  color: #fff; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  margin: 0 0 16px; font-weight: 700;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer a { color: rgba(214, 231, 250, .72); }
.footer a:hover { color: #fff; }
.footer__contacts { display: flex; flex-direction: column; gap: 11px; }
.footer__contacts div { display: flex; gap: 10px; align-items: flex-start; }
.footer__contacts svg { width: 17px; height: 17px; flex: none; margin-top: 3px; color: var(--accent); }
.footer__bottom {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between;
  align-items: center; padding-top: 24px; font-size: .8rem;
  color: rgba(214, 231, 250, .45);
}
.footer__bottom a { color: rgba(214, 231, 250, .6); }

/* ==========================================================================
   Читалка документации
   ========================================================================== */
.docs {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--aside-w);
  gap: 40px;
  align-items: start;
  max-width: var(--container);
  margin-inline: auto;
  padding: 30px 24px 80px;
}
.docs__side,
.docs__aside { position: sticky; top: calc(var(--header-h) + 22px); }
.docs__side {
  max-height: calc(100vh - var(--header-h) - 44px);
  display: flex; flex-direction: column; min-height: 0;
}
.docs__aside {
  max-height: calc(100vh - var(--header-h) - 44px); overflow-y: auto;
  padding-top: 6px;
}

/* --- Панель комплекта ------------------------------------------------------ */
.setcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
  overflow: hidden;
}
.setcard__head {
  padding: 16px 16px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  flex: none;
}
.setcard__title {
  display: block; font-family: var(--font-ui); font-size: .95rem; font-weight: 700;
  color: var(--brand-900); line-height: 1.3; margin-bottom: 4px;
}
.setcard__sub { display: block; font-size: .76rem; color: var(--muted); }
.setcard__filter { padding: 12px 14px; border-bottom: 1px solid var(--border); flex: none; }
.setcard__filter input {
  width: 100%; padding: 8px 12px 8px 34px;
  font-size: .84rem; font-family: var(--font-body);
  border: 1px solid var(--border-2); border-radius: var(--r-xs);
  background: var(--surface-2) no-repeat 10px center / 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a3b8' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  transition: all var(--t);
}
.setcard__filter input:focus {
  outline: none; border-color: var(--brand-500); background-color: var(--surface);
  box-shadow: 0 0 0 3px rgba(21,115,212,.12);
}
.setcard__tree { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 8px 8px 16px; }

/* --- Дерево оглавления ----------------------------------------------------- */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; position: relative; }
.tree ul::before {
  content: ''; position: absolute; left: 5px; top: 2px; bottom: 6px;
  width: 1px; background: var(--border);
}
.tree li { position: relative; }
.tree__row { display: flex; align-items: stretch; gap: 2px; }
.tree__toggle {
  flex: none; width: 22px; height: 30px; padding: 0; margin-right: 1px;
  background: transparent; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--muted-2);
  border-radius: 4px; transition: all var(--t);
}
.tree__toggle:hover { background: var(--surface-3); color: var(--brand-600); }
.tree__toggle svg { width: 12px; height: 12px; transition: transform .18s var(--ease); }
.tree__toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.tree__toggle--stub { visibility: hidden; }

.tree__link {
  flex: 1 1 auto; min-width: 0;
  display: block; padding: 5px 10px;
  font-size: .855rem; line-height: 1.45; color: var(--text-2);
  border-radius: var(--r-xs); transition: all var(--t);
  word-break: break-word;
}
.tree__link:hover { background: var(--surface-3); color: var(--brand-700); }
.tree__link.is-current {
  background: linear-gradient(90deg, var(--brand-100), rgba(232,242,253,.4));
  color: var(--brand-800); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand-500);
}
.tree__link.is-external::after {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 5px;
  vertical-align: baseline; opacity: .5;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7d97' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E");
}
.tree__group { font-family: var(--font-ui); font-weight: 600; color: var(--brand-900); }
.tree__children[hidden] { display: none; }
.tree li.is-hidden { display: none; }
.tree__empty { padding: 14px 10px; font-size: .83rem; color: var(--muted-2); text-align: center; }

/* --- «На этой странице» ---------------------------------------------------- */
.onpage__title {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 12px;
}
.onpage { border-left: 2px solid var(--border); padding-left: 16px; }
.onpage ul { list-style: none; margin: 0; padding: 0; }
.onpage a {
  display: block; padding: 5px 0; font-size: .82rem; line-height: 1.4;
  color: var(--muted); border-left: 2px solid transparent;
  margin-left: -18px; padding-left: 16px; transition: all var(--t);
}
.onpage a:hover { color: var(--brand-600); border-color: var(--brand-300); }
.onpage a.is-active { color: var(--brand-700); font-weight: 600; border-color: var(--brand-500); }
.onpage a[data-level="3"] { padding-left: 28px; font-size: .79rem; }
.onpage__tools { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }

/* --- Кнопка открытия сайдбара на мобильных --------------------------------- */
.toc-fab {
  display: none; position: fixed; z-index: 70;
  left: 16px; bottom: 18px; align-items: center; gap: 9px;
  padding: 12px 18px; border: 0; cursor: pointer;
  font-family: var(--font-ui); font-size: .86rem; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  border-radius: var(--r-pill); box-shadow: var(--sh-brand);
}
.toc-fab svg { width: 17px; height: 17px; }

/* ==========================================================================
   Типографика статьи
   ========================================================================== */
.article__head { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.article__head h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2.15rem);
  margin: 0 0 12px; letter-spacing: -.02em; text-wrap: balance;
}
.article__meta {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center;
  font-size: .8rem; color: var(--muted);
}
.article__meta span { display: inline-flex; align-items: center; gap: 6px; }
.article__meta svg { width: 15px; height: 15px; opacity: .65; }

.doc-body {
  font-size: 1rem; line-height: 1.75; color: var(--text-2);
  max-width: 82ch; overflow-wrap: break-word;
}
.doc-body > :first-child { margin-top: 0; }
.doc-body h2, .doc-body h3, .doc-body h4, .doc-body h5, .doc-body h6 {
  scroll-margin-top: calc(var(--header-h) + 20px);
  margin-top: 2em; margin-bottom: .7em; color: var(--brand-900);
}
.doc-body h2 {
  font-size: 1.45rem; padding-bottom: .35em;
  border-bottom: 1px solid var(--border);
}
.doc-body h3 { font-size: 1.18rem; }
.doc-body h4 { font-size: 1.03rem; color: var(--brand-800); }
.doc-body h5, .doc-body h6 { font-size: .95rem; text-transform: none; color: var(--text); }

.doc-body p { margin: 0 0 1.05em; }
.doc-body a { color: var(--brand-600); text-decoration: underline; text-decoration-color: rgba(12,92,173,.3); text-underline-offset: 2px; }
.doc-body a:hover { color: var(--brand-500); text-decoration-color: currentColor; }
.doc-body a.ext::after {
  content: ''; display: inline-block; width: .72em; height: .72em;
  margin-left: .25em; vertical-align: baseline; opacity: .55;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c5cad' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E");
}
.doc-body strong, .doc-body b { font-weight: 700; color: var(--brand-900); }
.doc-body em, .doc-body i { font-style: italic; }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 2.2em 0; }

/* списки */
.doc-body ul, .doc-body ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.doc-body li { margin-bottom: .45em; }
.doc-body li::marker { color: var(--brand-400); font-weight: 600; }
.doc-body ul.doc-list { list-style: none; padding-left: 0; }
.doc-body ul.doc-list > li {
  position: relative; padding-left: 1.45em; margin-bottom: .5em;
}
.doc-body ul.doc-list > li::before {
  content: ''; position: absolute; left: .25em; top: .68em;
  width: 6px; height: 6px; border-radius: 2px;
  background: linear-gradient(135deg, var(--brand-400), var(--accent));
}
.doc-body ol.doc-list { list-style: none; counter-reset: doclist; padding-left: 0; }
.doc-body ol.doc-list > li {
  position: relative; padding-left: 2.1em; margin-bottom: .55em;
  counter-increment: doclist;
}
.doc-body ol.doc-list > li::before {
  content: counter(doclist) '.';
  position: absolute; left: 0; top: 0;
  min-width: 1.7em; font-family: var(--font-ui); font-weight: 700;
  font-size: .88em; color: var(--brand-600);
}

/* таблицы */
.table-wrap {
  overflow-x: auto; margin: 1.5em 0; border-radius: var(--r-sm);
  border: 1px solid var(--border); box-shadow: var(--sh-1); background: var(--surface);
}
.doc-table {
  width: 100%; border-collapse: collapse; font-size: .9rem;
  background: var(--surface);
}
.doc-table caption {
  caption-side: top; text-align: left; padding: 10px 14px;
  font-family: var(--font-ui); font-size: .82rem; font-weight: 600; color: var(--muted);
}
.doc-table th, .doc-table td {
  padding: 11px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); line-height: 1.55;
}
.doc-table thead th {
  position: sticky; top: 0; z-index: 1;
  font-family: var(--font-ui); font-size: .8rem; font-weight: 700;
  letter-spacing: .02em; color: var(--brand-900);
  background: var(--surface-3); border-bottom: 2px solid var(--border-2);
  white-space: nowrap;
}
.doc-table tbody tr:nth-child(even) { background: var(--surface-2); }
.doc-table tbody tr:hover { background: var(--brand-100); }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table td > p, .doc-table th > p { margin: 0 0 .5em; }
.doc-table td > p:last-child, .doc-table th > p:last-child { margin-bottom: 0; }

/* код */
.doc-body code, .doc-body tt, .doc-body kbd, .doc-body samp {
  font-family: var(--font-mono); font-size: .86em;
  padding: .16em .42em; border-radius: 5px;
  background: var(--surface-3); color: #0a4c8a;
  border: 1px solid var(--border);
  word-break: break-word;
}
.doc-body pre {
  margin: 1.4em 0; padding: 16px 18px; overflow-x: auto;
  background: var(--brand-900); color: #d7e6f8;
  border-radius: var(--r-sm); font-size: .84rem; line-height: 1.6;
  box-shadow: var(--sh-2);
}
.doc-body pre code, .doc-body pre tt {
  background: none; border: 0; padding: 0; color: inherit;
  font-size: inherit; white-space: pre;
}

/* картинки */
.doc-img {
  max-width: 100%; height: auto; margin: 1.3em auto;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--sh-1); cursor: zoom-in;
}

/* акценты (из IntenseEmphasis) и плашки-предупреждения */
.doc-body .emph {
  font-weight: 700; color: var(--brand-800);
}
.doc-body .note-label {
  display: inline-block; padding: 1px 8px; margin-right: 8px;
  font-family: var(--font-ui); font-size: .78rem; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase;
  color: #fff; background: linear-gradient(135deg, var(--warn), #d98c00);
  border-radius: var(--r-xs); vertical-align: baseline;
}
.doc-body .anchor { scroll-margin-top: calc(var(--header-h) + 16px); }
.doc-body [id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* цитаты */
.doc-body blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 20px;
  border-left: 3px solid var(--brand-300); color: var(--muted);
  font-style: italic;
}

/* --- Навигация вперёд/назад ------------------------------------------------ */
.pager {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
  margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border);
}
.pager__item {
  display: flex; flex-direction: column; gap: 5px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text); transition: all var(--t);
  text-decoration: none;
}
.pager__item:hover { border-color: var(--brand-400); box-shadow: var(--sh-2); transform: translateY(-2px); color: var(--text); }
.pager__item--next { text-align: right; align-items: flex-end; }
.pager__item--empty { visibility: hidden; }
.pager__label {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px;
}
.pager__label svg { width: 13px; height: 13px; }
.pager__title { font-family: var(--font-ui); font-size: .92rem; font-weight: 600; color: var(--brand-800); }

/* ==========================================================================
   Страница поиска
   ========================================================================== */
.search-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
  padding: 20px; margin-bottom: 26px;
}
.search-panel__filters {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.search-panel__filters .field { min-width: 190px; flex: 1 1 190px; }
.search-panel__filters .checkbox { padding-bottom: 11px; }

.search-summary {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline;
  justify-content: space-between; margin-bottom: 18px;
  font-size: .88rem; color: var(--muted);
}
.search-summary b { font-family: var(--font-ui); color: var(--brand-900); font-size: 1rem; }

.results { display: flex; flex-direction: column; gap: 14px; }
.result {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 20px 22px;
  box-shadow: var(--sh-1); transition: all var(--t);
}
.result:hover { border-color: var(--brand-300); box-shadow: var(--sh-2); transform: translateX(3px); }
.result__path {
  display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
  font-size: .76rem; color: var(--muted); margin-bottom: 8px;
}
.result__path .badge { font-size: .66rem; padding: 2px 8px; }
.result__path svg { width: 12px; height: 12px; opacity: .5; }
.result__title {
  font-family: var(--font-ui); font-size: 1.08rem; font-weight: 700;
  color: var(--brand-800); margin: 0 0 8px; line-height: 1.35;
}
.result__title a { color: inherit; }
.result__title a:hover { color: var(--brand-500); }
.result__snippet { margin: 0; color: var(--text-2); font-size: .92rem; line-height: 1.65; }

.pagination { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 34px; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-size: .86rem; font-weight: 600;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-xs);
  transition: all var(--t); text-decoration: none;
}
.pagination a:hover { border-color: var(--brand-400); color: var(--brand-700); background: var(--brand-100); }
.pagination .is-current { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pagination .is-disabled { opacity: .4; pointer-events: none; }

.empty-state {
  text-align: center; padding: 70px 24px;
  background: var(--surface); border: 1px dashed var(--border-2);
  border-radius: var(--r-lg);
}
.empty-state__icon {
  width: 68px; height: 68px; margin: 0 auto 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted-2);
}
.empty-state__icon svg { width: 32px; height: 32px; }
.empty-state h3 { margin: 0 0 10px; font-size: 1.2rem; }
.empty-state p { color: var(--muted); max-width: 46ch; margin: 0 auto 20px; }

/* ==========================================================================
   Регламенты
   ========================================================================== */
.reg-toolbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  justify-content: space-between; margin-bottom: 28px;
}
.reg-cats { display: flex; flex-wrap: wrap; gap: 10px; }
.reg-cats a {
  display: flex; flex-direction: column; gap: 4px; min-width: 172px;
  padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text); text-decoration: none; transition: all var(--t);
}
.reg-cats a:hover { border-color: var(--brand-400); box-shadow: var(--sh-2); transform: translateY(-2px); color: var(--text); }
.reg-cats a.is-active {
  border-color: var(--brand-500); background: var(--brand-100);
  box-shadow: inset 0 0 0 1px var(--brand-400);
}
.reg-cats__title { font-family: var(--font-ui); font-size: .9rem; font-weight: 700; color: var(--brand-900); }
.reg-cats__count { font-size: .76rem; color: var(--muted); }

.reg-group { margin-bottom: 40px; }
.reg-group__head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid var(--border);
}
.reg-group__head h2 { margin: 0; font-size: 1.28rem; }
.reg-group__head p { margin: 0; color: var(--muted); font-size: .87rem; }

.reg-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); }
.reg-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1); transition: all var(--t);
}
.reg-card:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--brand-300); }
.reg-card__thumb {
  position: relative; aspect-ratio: 3 / 4; background: var(--surface-3);
  border-bottom: 1px solid var(--border); overflow: hidden;
  display: grid; place-items: center;
}
.reg-card__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s var(--ease); }
.reg-card:hover .reg-card__thumb img { transform: scale(1.045); }
.reg-card__thumb-placeholder {
  display: grid; place-items: center; width: 100%; height: 100%;
  color: var(--border-2); background:
    linear-gradient(135deg, var(--surface-3) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(225deg, var(--surface-3) 25%, transparent 25%) -10px 0/20px 20px,
    linear-gradient(315deg, var(--surface-3) 25%, transparent 25%) 0 0/20px 20px,
    linear-gradient(45deg, var(--surface-3) 25%, transparent 25%) 0 0/20px 20px;
}
.reg-card__thumb-placeholder svg { width: 46px; height: 46px; }
.reg-card__badge {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 9px; font-family: var(--font-ui); font-size: .66rem; font-weight: 700;
  letter-spacing: .05em; color: #fff; background: rgba(0, 20, 46, .78);
  border-radius: var(--r-pill); backdrop-filter: blur(4px);
}
.reg-card__body { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; }
.reg-card__title {
  font-family: var(--font-ui); font-size: .89rem; font-weight: 600;
  line-height: 1.4; color: var(--brand-900); margin: 0; flex: 1 1 auto;
}
.reg-card__size { font-size: .74rem; color: var(--muted-2); }
.reg-card__actions { display: flex; gap: 8px; }
.reg-card__actions .btn { flex: 1 1 auto; padding: 9px 10px; font-size: .79rem; }

/* ==========================================================================
   Лайтбокс для картинок
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center; padding: 34px;
  background: rgba(0, 12, 30, .88); backdrop-filter: blur(6px); cursor: zoom-out;
}
.lightbox.is-open { display: flex; animation: fade .18s var(--ease); }
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: var(--r-sm); box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.lightbox__close {
  position: absolute; top: 18px; right: 22px; width: 42px; height: 42px;
  border: 1px solid rgba(255,255,255,.25); border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff; font-size: 1.3rem;
  cursor: pointer; line-height: 1; display: grid; place-items: center;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Прочие страницы
   ========================================================================== */
.setlist { display: flex; flex-direction: column; gap: 14px; }
.setrow {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 18px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-1); transition: all var(--t); text-decoration: none; color: inherit;
}
.setrow:hover { border-color: var(--brand-400); box-shadow: var(--sh-2); transform: translateX(4px); color: inherit; }
.setrow__main { flex: 1 1 260px; min-width: 0; }
.setrow__title { font-family: var(--font-ui); font-size: 1.02rem; font-weight: 700; color: var(--brand-900); margin: 0 0 4px; }
.setrow__sub { font-size: .84rem; color: var(--muted); margin: 0; }
.setrow__meta { display: flex; gap: 8px; flex-wrap: wrap; flex: none; }

.info-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.stat {
  padding: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
}
.stat b {
  display: block; font-family: var(--font-ui); font-size: 2rem; font-weight: 800;
  line-height: 1.1; color: var(--brand-700);
  background: linear-gradient(135deg, var(--brand-600), var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat span { display: block; margin-top: 6px; font-size: .82rem; color: var(--muted); }

.contact-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1);
}
.contact-card__icon {
  width: 42px; height: 42px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--brand-100); color: var(--brand-700);
}
.contact-card__icon svg { width: 21px; height: 21px; }
.contact-card h4 { margin: 0 0 4px; font-size: .95rem; }
.contact-card p, .contact-card a { margin: 0; font-size: .9rem; color: var(--muted); }
.contact-card a:hover { color: var(--brand-600); }

.prose { max-width: 78ch; }
.prose h2 { margin-top: 2em; }
.prose ul { padding-left: 1.3em; }

/* --- Ошибки ---------------------------------------------------------------- */
.error-page { display: grid; place-items: center; min-height: 62vh; padding: 60px 24px; text-align: center; }
.error-page__code {
  font-family: var(--font-ui); font-size: clamp(4.5rem, 3rem + 8vw, 9rem);
  font-weight: 800; line-height: 1; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--brand-500), var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.error-page h1 { font-size: 1.7rem; margin: 12px 0 10px; }
.error-page p { color: var(--muted); max-width: 52ch; margin: 0 auto 26px; }

/* ==========================================================================
   Админка
   ========================================================================== */
.admin-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 20px; margin-bottom: 24px;
  background: var(--brand-900); color: #cfe4ff; border-radius: var(--r-md);
  font-family: var(--font-ui); font-size: .84rem;
}
.admin-bar a { color: #9fd0ff; font-weight: 600; }
.admin-bar a:hover { color: #fff; }
.admin-bar form { display: inline; }
.admin-grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.admin-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-1); overflow: hidden;
}
.admin-panel__head {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-family: var(--font-ui); font-size: .84rem; font-weight: 700;
  color: var(--brand-900); letter-spacing: .03em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.admin-panel__body { padding: 18px 20px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.admin-table th, .admin-table td {
  padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-family: var(--font-ui); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); font-weight: 700;
}
.admin-table tr:last-child td { border-bottom: 0; }
.log-view {
  margin: 0; padding: 18px; max-height: 62vh; overflow: auto;
  background: #0b1626; color: #b8d4f0;
  font-family: var(--font-mono); font-size: .78rem; line-height: 1.6;
  border-radius: var(--r-sm); white-space: pre-wrap; word-break: break-word;
}
.login-wrap { display: grid; place-items: center; min-height: 74vh; padding: 40px 20px; }
.login-card {
  width: 100%; max-width: 400px; padding: 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-3); text-align: center;
}
.login-card img { height: 34px; margin: 0 auto 22px; }
.login-card h1 { font-size: 1.3rem; margin-bottom: 8px; }
.login-card p { color: var(--muted); font-size: .88rem; margin-bottom: 24px; }
.alert {
  padding: 12px 16px; border-radius: var(--r-sm); font-size: .88rem;
  margin-bottom: 18px; border: 1px solid;
}
.alert--error { background: #fdecec; border-color: #f6c6c8; color: #9b2c30; }
.alert--ok { background: var(--accent-soft); border-color: #b6ece4; color: #06695d; }

/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media (max-width: 1500px) {
  :root { --side-w: 300px; --aside-w: 220px; }
}

@media (max-width: 1340px) {
  .docs { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .docs__aside { display: none; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  .nav { display: none; }
  .burger { display: block; }
  .header__inner { gap: 14px; }
  .header__logo-text { display: none; }
  .header__logo-divider { display: none; }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    padding: 20px 18px 90px; gap: 0;
  }
  .docs__side {
    position: fixed; inset: 0 auto 0 0; z-index: 100;
    width: min(88vw, 380px); max-height: none; padding: 0;
    transform: translateX(-102%); transition: transform .3s var(--ease);
    background: var(--surface); box-shadow: var(--sh-3);
  }
  .docs__side.is-open { transform: translateX(0); }
  .setcard { border-radius: 0; border: 0; height: 100%; }
  .toc-fab { display: inline-flex; }
  .toc-backdrop {
    position: fixed; inset: 0; z-index: 99; background: rgba(0, 12, 30, .5);
    opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
  }
  .toc-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .doc-body { max-width: none; }
}

@media (max-width: 860px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .grid--auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .hero__stats { gap: 22px; }
  .hero__stat b { font-size: 1.4rem; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager__item--empty { display: none; }
  .footer__grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .reg-cats a { min-width: 100%; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .container { padding-inline: 16px; }
  .searchbox__form { padding: 7px 7px 7px 14px; border-radius: var(--r-sm); }
  .searchbox__input { font-size: .94rem; }
  .header__actions .btn span { display: none; }
  .header__actions .btn { padding: 10px; }
  .hero { padding-block: 40px 44px; }
  .hero__lead { font-size: .98rem; }
  .result { padding: 16px; }
  .reg-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
  .doc-body { font-size: .96rem; line-height: 1.7; }
  .doc-body h2 { font-size: 1.25rem; }
  .doc-body h3 { font-size: 1.06rem; }
  .doc-table { font-size: .82rem; }
  .doc-table th, .doc-table td { padding: 9px 10px; }
  .search-panel { padding: 16px; }
  .search-panel__filters .field { flex: 1 1 100%; }
}

@media (max-width: 400px) {
  .reg-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- Печать ---------------------------------------------------------------- */
@media print {
  .header, .footer, .docs__side, .docs__aside, .toc-fab, .toc-backdrop,
  .pager, .crumbs, .article__meta, .searchbox, .admin-bar { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .docs { display: block; padding: 0; max-width: none; }
  .doc-body { max-width: none; color: #000; }
  .doc-body a { color: #000; text-decoration: underline; }
  .doc-body pre { background: #f4f4f4; color: #000; box-shadow: none; border: 1px solid #ccc; }
  .table-wrap { box-shadow: none; border-color: #999; }
  .doc-table thead th { position: static; background: #eee; }
  .doc-img { box-shadow: none; border-color: #999; page-break-inside: avoid; }
  .article__head h1 { font-size: 20pt; }
  h2, h3 { page-break-after: avoid; }
  tr, pre, blockquote { page-break-inside: avoid; }
}

/* --- Уважение к prefers-reduced-motion ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Компактный поиск в шапке ---------------------------------------------- */
.searchbox--compact { flex: 0 1 340px; min-width: 180px; }
.searchbox--compact .searchbox__form {
  padding: 4px 4px 4px 13px; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  box-shadow: none; background: var(--surface-2);
  transition: all var(--t);
}
.searchbox--compact .searchbox__form:hover { border-color: var(--border-2); background: var(--surface); }
.searchbox--compact .searchbox__form:focus-within {
  border-color: var(--brand-500); background: var(--surface);
  box-shadow: 0 0 0 4px rgba(21, 115, 212, .13);
}
.searchbox--compact .searchbox__input { font-size: .88rem; padding: 7px 0; }
.searchbox--compact .searchbox__clear { width: 26px; height: 26px; font-size: .95rem; }
.searchbox__form > svg { color: var(--muted-2); flex: none; }
.searchbox--compact .suggest { top: calc(100% + 8px); }

/* --- Основная колонка читалки ---------------------------------------------- */
.docs__main { min-width: 0; }
.article__head { scroll-margin-top: calc(var(--header-h) + 16px); }
.article__tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.onpage__tools .btn { justify-content: flex-start; }

/* --- Ссылки-вложения и «мёртвые» ссылки из исходных документов -------------- */
.doc-body a.attachment {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 2px 10px 2px 8px; margin: 0 2px;
  font-family: var(--font-ui); font-size: .85em; font-weight: 600;
  text-decoration: none; color: var(--brand-700);
  background: var(--brand-100); border: 1px solid var(--brand-300);
  border-radius: var(--r-pill); vertical-align: baseline;
  transition: all var(--t);
}
.doc-body a.attachment::before {
  content: '\2193'; font-size: 1.05em; line-height: 1; color: var(--accent-dark);
}
.doc-body a.attachment:hover {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
  box-shadow: 0 4px 12px rgba(12, 92, 173, .28);
}
.doc-body a.attachment:hover::before { color: #d8fff8; }
.doc-body .dead-link {
  color: var(--muted-2); text-decoration: line-through;
  text-decoration-color: var(--border-2); cursor: not-allowed;
}

/* ==========================================================================
   Хуки страниц (body.page-*) и финальные штрихи
   ========================================================================== */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > main { flex: 1 0 auto; }

/* главная: hero прижимается к шапке без отступа */
.page-home main > .hero:first-child { margin-top: 0; }
.page-home .header { border-bottom-color: transparent; }

/* читалка: плотная раскладка от самой шапки */
.page-docs .header { box-shadow: var(--sh-1); }
.page-docs main { background:
  linear-gradient(180deg, var(--surface-2) 0, var(--bg) 340px); }

/* поиск и регламенты: лёгкий фон под заголовком */
.page-search .page-head,
.page-regulations .page-head { padding-bottom: clamp(32px, 4vw, 52px); }

/* pager: стрелки в нужную сторону */
.pager__item--prev .pager__label { flex-direction: row; }
.pager__item--next .pager__label { flex-direction: row-reverse; }
.pager__item--prev { border-left: 3px solid var(--brand-300); }
.pager__item--next { border-right: 3px solid var(--brand-300); }
.pager__item--prev:hover { border-left-color: var(--brand-500); }
.pager__item--next:hover { border-right-color: var(--brand-500); }

/* клавиши в тексте (Ctrl+K, /) */
kbd {
  display: inline-block; min-width: 1.6em; padding: 2px 7px;
  font-family: var(--font-mono); font-size: .8em; line-height: 1.4;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border-2); border-bottom-width: 2px;
  border-radius: 5px; text-align: center; white-space: nowrap;
}

/* плавное появление контента */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
main > .section:first-of-type,
main > .container:first-of-type,
.hero__inner > * {
  animation: rise .45s var(--ease) both;
}
.hero__inner > *:nth-child(2) { animation-delay: .06s; }
.hero__inner > *:nth-child(3) { animation-delay: .12s; }
.hero__inner > *:nth-child(4) { animation-delay: .18s; }
.hero__inner > *:nth-child(5) { animation-delay: .24s; }

/* ==========================================================================
   Баннер согласия на cookie
   ========================================================================== */
.cookiebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(600px 200px at 8% 0%, rgba(0, 194, 168, .22), transparent 62%),
    linear-gradient(135deg, var(--brand-900) 0%, var(--brand-800) 60%, var(--brand-700) 100%);
  color: rgba(226, 238, 252, .92);
  border-top: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 -14px 44px rgba(0, 12, 32, .34);
  animation: cookieUp .34s var(--ease) both;
}
.cookiebar[hidden] { display: none; }
.cookiebar.is-leaving { animation: cookieDown .26s var(--ease) both; }
@keyframes cookieUp   { from { transform: translateY(110%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cookieDown { from { transform: none; opacity: 1; } to { transform: translateY(110%); opacity: 0; } }

.cookiebar__inner {
  max-width: var(--container); margin-inline: auto;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.cookiebar__icon {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: #7ce7d8; background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
}
.cookiebar__text {
  flex: 1 1 420px; margin: 0;
  font-size: .88rem; line-height: 1.55;
}
.cookiebar__text a {
  color: #8fd6ff; text-decoration: underline;
  text-decoration-color: rgba(143, 214, 255, .4); text-underline-offset: 2px;
}
.cookiebar__text a:hover { color: #fff; text-decoration-color: currentColor; }
.cookiebar__actions { display: flex; align-items: center; gap: 10px; flex: none; }
.cookiebar__close {
  width: 36px; height: 36px; padding: 0; flex: none;
  border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%;
  background: rgba(255, 255, 255, .07); color: rgba(226, 238, 252, .8);
  font-size: 1.25rem; line-height: 1; cursor: pointer; transition: all var(--t);
}
.cookiebar__close:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* мобильная кнопка оглавления не должна перекрываться баннером */
body:has(.cookiebar:not([hidden])) .toc-fab { bottom: 96px; }

@media (max-width: 760px) {
  .cookiebar { padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .cookiebar__inner { gap: 12px; }
  .cookiebar__icon { display: none; }
  .cookiebar__text { flex: 1 1 100%; font-size: .84rem; }
  .cookiebar__actions { width: 100%; }
  .cookiebar__actions .btn { flex: 1 1 auto; }
  body:has(.cookiebar:not([hidden])) .toc-fab { bottom: 150px; }
}

/* ==========================================================================
   Сервисы МОНТ — партнёрские кнопки на главной
   ========================================================================== */
.partners { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.partner {
  position: relative; display: flex; align-items: center; gap: 20px;
  padding: 24px 26px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  color: inherit; text-decoration: none;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.partner::after {
  content: ''; position: absolute; right: -60px; top: -60px;
  width: 190px; height: 190px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(0, 194, 168, .16), transparent 68%);
  transition: transform .4s var(--ease);
}
.partner:hover {
  transform: translateY(-4px); box-shadow: var(--sh-3);
  border-color: var(--brand-400); color: inherit;
}
.partner:hover::after { transform: scale(1.5); }
.partner__icon {
  flex: none; width: 56px; height: 56px; border-radius: var(--r-md);
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  box-shadow: var(--sh-brand);
}
.partner__icon svg { width: 27px; height: 27px; }
.partner__body { flex: 1 1 auto; min-width: 0; position: relative; z-index: 1; }
.partner__badge {
  display: inline-block; margin-bottom: 6px;
  font-family: var(--font-ui); font-size: .66rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent-dark);
}
.partner__title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--font-ui); font-size: 1.1rem; font-weight: 700;
  color: var(--brand-900); margin: 0 0 5px; line-height: 1.3;
}
.partner__title svg { width: 16px; height: 16px; color: var(--muted-2); flex: none; transition: all var(--t); }
.partner:hover .partner__title svg { color: var(--brand-500); transform: translate(2px, -2px); }
.partner__text { display: block; margin: 0; font-size: .87rem; color: var(--muted); }
.partner__host {
  display: block; margin-top: 8px;
  font-family: var(--font-mono); font-size: .74rem; color: var(--brand-500);
}

@media (max-width: 860px) {
  .partners { grid-template-columns: minmax(0, 1fr); }
  .partner { padding: 20px; gap: 16px; }
  .partner__icon { width: 48px; height: 48px; }
  .partner__icon svg { width: 23px; height: 23px; }
  .partner__title { font-size: 1rem; }
}

/* ==========================================================================
   ТЁМНАЯ ТЕМА
   Токены инвертируются, плюс точечные переопределения там, где белый текст
   лежит на «залитой» поверхности (кнопки, иконки, блоки кода).
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg:        #080f1c;
  --surface:   #0f1a2c;
  --surface-2: #142137;
  --surface-3: #1b2c47;
  --border:    #22344e;
  --border-2:  #33506f;

  --text:    #e7eefb;
  --text-2:  #c3d3e9;
  --muted:   #93a7c2;
  --muted-2: #6c819f;

  /* шкала бренда переворачивается: 900 — самый светлый (текст заголовков) */
  --brand-900: #eaf4ff;
  --brand-800: #cfe6fd;
  --brand-700: #a5d4fc;
  --brand-600: #7cc0fa;
  --brand-500: #5aa9ee;
  --brand-400: #3d84cf;
  --brand-300: #2d5f92;
  --brand-100: #14293f;

  --accent:      #23d3b8;
  --accent-dark: #4fdccb;
  --accent-soft: #0d3330;

  --ok:     #35d07f;
  --warn:   #ffbf33;
  --danger: #ff6b6f;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .5);
  --sh-2: 0 2px 8px rgba(0, 0, 0, .5), 0 10px 28px rgba(0, 0, 0, .4);
  --sh-3: 0 10px 24px rgba(0, 0, 0, .55), 0 28px 64px rgba(0, 0, 0, .5);
  --sh-brand: 0 10px 28px rgba(28, 110, 190, .4);
}

/* --- Поверхности с белым текстом: фиксируем цвет, не токены ---------------- */
html[data-theme="dark"] .btn--primary {
  --btn-bg: linear-gradient(135deg, #1573d4, #0c5cad);
  --btn-fg: #ffffff;
}
html[data-theme="dark"] .btn--accent {
  --btn-bg: linear-gradient(135deg, #00c2a8, #009688);
  --btn-fg: #04121f;
}
html[data-theme="dark"] .btn--ghost {
  --btn-fg: var(--brand-700);
  --btn-bd: var(--border-2);
}
html[data-theme="dark"] .btn--ghost:hover { --btn-bg: var(--surface-3); }
html[data-theme="dark"] .chip.is-active {
  background: linear-gradient(135deg, #1573d4, #0c5cad);
  border-color: #1573d4; color: #fff;
}
html[data-theme="dark"] .checkbox input:checked {
  background-color: #1573d4; border-color: #1573d4;
}
html[data-theme="dark"] .partner__icon {
  background: linear-gradient(135deg, #1573d4, #0c5cad);
  box-shadow: 0 10px 26px rgba(21, 115, 212, .35);
}

/* --- Шапка и логотип ------------------------------------------------------- */
html[data-theme="dark"] .header {
  background: rgba(9, 16, 29, .82);
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .header__logo img {
  /* чёрный текст логотипа -> белый, синий знак остаётся синим */
  filter: invert(1) hue-rotate(180deg) saturate(1.15);
}
html[data-theme="dark"] .nav__link:hover { background: var(--surface-3); }

/* --- Контент статей -------------------------------------------------------- */
html[data-theme="dark"] .doc-body pre {
  background: #050b16; color: #cfe2f7;
  border: 1px solid var(--border); box-shadow: none;
}
html[data-theme="dark"] .doc-body code,
html[data-theme="dark"] .doc-body tt,
html[data-theme="dark"] .doc-body kbd {
  background: var(--surface-3); color: #8fd6ff; border-color: var(--border-2);
}
html[data-theme="dark"] mark { background: #6b5300; color: #ffe9a3; }
html[data-theme="dark"] .doc-body a { color: var(--brand-600); text-decoration-color: rgba(124,192,250,.35); }
html[data-theme="dark"] .doc-body a.attachment { color: var(--brand-700); }
html[data-theme="dark"] .doc-body a.attachment:hover { color: #04121f; }
html[data-theme="dark"] .doc-img { background: #fff; }

/* --- Компоненты с жёстко заданными светлыми цветами ------------------------ */
html[data-theme="dark"] .alert--error {
  background: #3a1618; border-color: #6b2a2d; color: #ffb4b6;
}
html[data-theme="dark"] .alert--ok {
  background: var(--accent-soft); border-color: #17544e; color: #8ff0e2;
}
html[data-theme="dark"] .badge--accent { color: var(--accent-dark); }
html[data-theme="dark"] .card,
html[data-theme="dark"] .result,
html[data-theme="dark"] .setcard,
html[data-theme="dark"] .reg-card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .contact-card,
html[data-theme="dark"] .admin-panel,
html[data-theme="dark"] .search-panel,
html[data-theme="dark"] .pcard,
html[data-theme="dark"] .fcard,
html[data-theme="dark"] .setrow,
html[data-theme="dark"] .suggest,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .reg-cats a,
html[data-theme="dark"] .pager__item {
  box-shadow: var(--sh-1);
}
html[data-theme="dark"] .empty-state { background: var(--surface); border-color: var(--border-2); }
html[data-theme="dark"] .docs__main { color: var(--text-2); }
html[data-theme="dark"] .page-docs main {
  background: linear-gradient(180deg, var(--surface-2) 0, var(--bg) 340px);
}

/* Уже тёмные блоки — чуть приглушаем, чтобы не спорили с фоном */
html[data-theme="dark"] .hero,
html[data-theme="dark"] .page-head {
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(0, 194, 168, .18), transparent 62%),
    radial-gradient(900px 520px at 88% 8%, rgba(21, 115, 212, .26), transparent 60%),
    linear-gradient(150deg, #050b16 0%, #0a1729 45%, #0d2340 100%);
}
html[data-theme="dark"] .footer { background: #050b16; }
html[data-theme="dark"] .footer__brand img { filter: brightness(0) invert(1); }
html[data-theme="dark"] .cookiebar {
  background:
    radial-gradient(600px 200px at 8% 0%, rgba(0, 194, 168, .16), transparent 62%),
    linear-gradient(135deg, #050b16, #0d2340);
}

/* --- Переключатель темы ---------------------------------------------------- */
.theme-toggle {
  width: 40px; height: 40px; padding: 0; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-xs); color: var(--text-2); cursor: pointer;
  transition: all var(--t);
}
.theme-toggle:hover { color: var(--brand-600); border-color: var(--brand-400); background: var(--surface-3); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 640px) {
  .theme-toggle { width: 36px; height: 36px; }
}

/* Печать всегда светлая, независимо от выбранной темы */
@media print {
  html[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #eee;
    --border: #999; --border-2: #777;
    --text: #000; --text-2: #000; --muted: #333; --muted-2: #555;
    --brand-900: #000; --brand-800: #111; --brand-700: #0c5cad;
    --brand-600: #0c5cad; --brand-500: #1573d4; --brand-400: #3d84cf;
    --brand-300: #a7d1f7; --brand-100: #eef3fa;
  }
  html[data-theme="dark"] .doc-body pre {
    background: #f4f4f4; color: #000; border-color: #ccc;
  }
  html[data-theme="dark"] .header__logo img,
  html[data-theme="dark"] .footer__brand img { filter: none; }
  .cookiebar { display: none !important; }
}
