/* Базовые стили блога (по мотивам Cleverence Docusaurus custom.css) */
:root {
  --cleverence-primary: #0083b0;
  --cleverence-primary-dark: #00759d;
  --cleverence-text: #1a1a2e;
  --cleverence-muted: #5c6370;
  --cleverence-bg: #ffffff;
  /* Как .container в подвале — одна ширина контентной области */
  --cleverence-max-width: 1140px;
  /* Превью ленты / похожие: стандартное 16:9 (близко к старым обложкам Bitrix) */
  --cleverence-preview-aspect-ratio: 16 / 9;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--cleverence-text);
  background: var(--cleverence-bg);
}

.page-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Верхняя панель в духе Docusaurus (.navbar--fixed-top, .navbar__brand, .navbar__logo) */
.site-navbar {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
  display: flex;
  align-items: stretch;
  background: var(--cleverence-bg);
  border-bottom: 1px solid #dadde1;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.site-navbar__inner {
  width: 100%;
  max-width: var(--cleverence-max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
}

.site-navbar__left {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
}

.site-navbar__desktop {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
  min-width: 0;
}

.site-navbar__nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-navbar__nav-link {
  color: #1a1a2e;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.site-navbar__nav-link:hover {
  color: #2f57d3;
}

.site-navbar__cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 38px;
  padding: 0 1rem;
  border: 0;
  border-radius: 8px;
  background: #2f57d3;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.site-navbar__cta-btn:hover {
  background: #2445ab;
  color: #fff;
}

@media (max-width: 1100px) {
  .site-navbar__desktop {
    gap: 0.75rem;
  }

  .site-navbar__nav {
    gap: 0.75rem;
  }

  .site-navbar__nav-link,
  .site-navbar__cta-btn {
    font-size: 0.875rem;
  }

  .site-navbar__cta-btn {
    padding: 0 0.75rem;
  }
}

.site-navbar__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  margin-right: 1rem;
}

.site-navbar__brand:hover {
  opacity: 0.9;
}

.site-navbar__logo {
  display: flex;
  align-items: center;
  line-height: 0;
  width: 160px;
  height: auto;
  aspect-ratio: 320 / 54;
  flex-shrink: 0;
}

.site-navbar__logo-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.site-navbar__mobile-actions {
  display: none;
}

.site-navbar__community-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 0.75rem;
  border: 2px solid #2f57d3;
  border-radius: 8px;
  color: #2f57d3;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  background: #fff;
  white-space: nowrap;
}

.site-navbar__community-btn:hover {
  color: #2445ab;
  border-color: #2445ab;
}

.site-navbar__burger {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.site-navbar__burger span {
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: #2f2f2f;
}

.article-mobile-menu {
  display: none;
}

@media (max-width: 576px) {
  .site-navbar__logo {
    width: 160px;
    height: auto;
    aspect-ratio: 320 / 54;
  }

  .site-navbar__logo-img {
    width: 100%;
    height: 100%;
  }
}

/* Мобильная шапка: кнопка «Сообщество», бургер и полноэкранное меню (планшеты и телефоны) */
@media (max-width: 768px) {
  .site-navbar {
    height: auto;
  }

  .site-navbar__inner {
    min-height: 60px;
    gap: 0.625rem;
  }

  .site-navbar__desktop {
    display: none;
  }

  .site-navbar__left {
    flex: 0 1 auto;
  }

  .site-navbar__brand {
    margin-right: 0;
  }

  .site-navbar__mobile-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .site-navbar__community-btn {
    height: 36px;
    padding: 0 0.625rem;
    font-size: 0.9rem;
  }

  /* Перебиваем глобальное display:none — иначе при снятии hidden меню остаётся невидимым */
  .article-mobile-menu {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: #fff;
    padding: calc(60px + 3rem) 1rem 1rem;
    overflow-y: auto;
  }

  .article-mobile-menu[hidden] {
    display: none !important;
  }

  body.article-mobile-menu-open {
    overflow: hidden;
  }

  .article-mobile-menu__close {
    position: absolute;
    top: calc(60px + 0.35rem);
    right: 0.75rem;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1a1a2e;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
  }

  .article-mobile-menu__close:hover {
    background: #f0f2f5;
  }

  .article-mobile-menu__close:focus-visible {
    outline: 2px solid #0083b0;
    outline-offset: 2px;
  }

  /* Крестик из двух линий */
  .article-mobile-menu__close-icon {
    position: relative;
    display: block;
    width: 22px;
    height: 22px;
  }

  .article-mobile-menu__close-icon::before,
  .article-mobile-menu__close-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transform-origin: center;
  }

  .article-mobile-menu__close-icon::before {
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .article-mobile-menu__close-icon::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .article-mobile-menu__nav nav,
  .article-mobile-menu__nav #TableOfContents {
    display: block;
    width: 100%;
  }

  .article-mobile-menu__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .article-mobile-menu__nav ul ul {
    margin-top: 0.35rem;
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 2px solid #e8eaed;
  }

  .article-mobile-menu__nav li {
    margin-bottom: 0.5rem;
  }

  .article-mobile-menu__nav a {
    text-decoration: none;
    color: #5c6370;
    font-size: 0.95rem;
    line-height: 1.35;
  }

  .article-mobile-menu__nav a:hover {
    color: #0083b0;
  }
}

.page-main {
  flex: 1;
  width: 100%;
  max-width: var(--cleverence-max-width);
  margin: 0 auto;
  /* Горизонтальные отступы как у .container в подвале */
  padding: 1.5rem 1rem 3rem;
  min-width: 0;
  overflow-x: clip;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
}

img {
  max-width: 100%;
  height: auto;
}

.article-content__img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
}

a {
  color: var(--cleverence-primary);
}

a:hover {
  color: var(--cleverence-primary-dark);
}

/* Виджет «Готовые решения» — shortcode {{< solutions-promo >}} */
.clv-spromo {
  margin: 2rem 0;
  padding: 1.35rem 1.1rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.clv-spromo__heading {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  color: #111827;
}

.clv-spromo__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .clv-spromo__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .clv-spromo__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.clv-spromo-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
  padding: 1.1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.clv-spromo-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.clv-spromo-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.clv-spromo-card__title a {
  color: #1d4ed8;
  text-decoration: none;
}

.clv-spromo-card__title a:hover {
  text-decoration: underline;
}

.clv-spromo-card__ico {
  flex-shrink: 0;
  line-height: 0;
}

.clv-spromo-card__ico img,
.clv-spromo-card__img {
  display: block;
  width: 72px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
}

.clv-spromo-card__text {
  flex: 1 1 auto;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #374151;
}

.clv-spromo-card__btn {
  align-self: flex-start;
  display: inline-block;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0369a1;
  border: 1px solid #7dd3fc;
  border-radius: 6px;
  text-decoration: none;
  background: #fff;
}

.clv-spromo-card__btn:hover {
  background: #f0f9ff;
}

/* Мобильная колонка: только три основных направления (остальное — с планшета 640px) */
@media (max-width: 639px) {
  .clv-spromo__grid .clv-spromo-card:nth-child(n + 4) {
    display: none;
  }
}

/* Виджет «Полезные сервисы» — shortcode {{< services-promo >}} */
/* Пока грузится API — не показывать устаревший SSR из сборки Hugo */
.clv-svc-promo-mount--loading .clv-svc-promo--ssr {
  display: none;
}
.clv-svc-promo-mount--loading {
  min-height: 16rem;
}
.clv-svc-promo {
  margin: 2rem 0;
  padding: 1.35rem 1.1rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.clv-svc-promo__heading {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  color: #111827;
}

.clv-svc-promo__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Смартфоны: две карточки друг под другом, третья скрыта */
@media (max-width: 639px) {
  .clv-svc-promo-card:nth-child(3) {
    display: none;
  }
}

@media (min-width: 640px) {
  .clv-svc-promo__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.clv-svc-promo-card {
  display: flex;
  flex-direction: column;
  min-height: 260px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.clv-svc-promo-card__media {
  display: block;
  flex: 0 0 50%;
  min-height: 120px;
  max-height: 50%;
  line-height: 0;
  overflow: hidden;
  background: #f1f5f9;
}

.clv-svc-promo-card__img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 120px;
  object-fit: cover;
  object-position: center;
}

.clv-svc-promo-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.85rem 1rem 1rem;
}

.clv-svc-promo-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.clv-svc-promo-card__title a {
  color: #1d4ed8;
  text-decoration: none;
}

.clv-svc-promo-card__title a:hover {
  text-decoration: underline;
}

.clv-svc-promo-card__btn {
  align-self: flex-start;
  display: inline-block;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0369a1;
  border: 1px solid #7dd3fc;
  border-radius: 6px;
  text-decoration: none;
  background: #fff;
}

.clv-svc-promo-card__btn:hover {
  background: #f0f9ff;
}

/* Широкий блок «Полезные сервисы» — перед 3-м H3 (иначе перед 2-м H2) */
.clv-svc-featured-mount--loading .clv-svc-featured--ssr {
  display: none;
}
.clv-svc-featured-mount--loading {
  min-height: 10rem;
}
.clv-svc-featured-mount:empty {
  display: none;
}

.clv-svc-featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 2rem 0;
  padding: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

@media (min-width: 720px) {
  .clv-svc-featured {
    grid-template-columns: minmax(0, 0.42fr) minmax(0, 0.58fr);
    align-items: stretch;
  }
}

.clv-svc-featured__media {
  display: block;
  line-height: 0;
  overflow: hidden;
  background: #f1f5f9;
  min-height: 160px;
}

.clv-svc-featured__img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
  object-position: center;
}

@media (min-width: 720px) {
  .clv-svc-featured__media,
  .clv-svc-featured__img {
    min-height: 100%;
  }
}

.clv-svc-featured__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.65rem;
  padding: 1.1rem 1.15rem 1.25rem;
  background: #fff;
}

.clv-svc-featured__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: #1d4ed8;
}

.clv-svc-featured__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #374151;
}

.clv-svc-featured__btn {
  align-self: flex-start;
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0369a1;
  border: 1px solid #7dd3fc;
  border-radius: 6px;
  text-decoration: none;
  background: #fff;
}

.clv-svc-featured:hover .clv-svc-featured__title {
  text-decoration: underline;
}

.clv-svc-featured:hover .clv-svc-featured__btn {
  background: #f0f9ff;
}

/*
 * Виджет внутри статьи: partial article-inline-images подставляет cleverence.ru img
 * как .article-content__img (margin: 1rem auto), а типографика .article .content h3/p
 * даёт лишние отступы — сброс только внутри .clv-spromo / .clv-svc-*.
 */
.article .content .clv-spromo .clv-spromo-card__title,
.article .content .clv-svc-promo .clv-svc-promo-card__title,
.article .content .clv-svc-featured .clv-svc-featured__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: #1d4ed8;
}

.article .content .clv-spromo .clv-spromo-card__title a,
.article .content .clv-svc-promo .clv-svc-promo-card__title a {
  color: #1d4ed8;
  text-decoration: none;
}

.article .content .clv-spromo .clv-spromo-card__text,
.article .content .clv-svc-featured .clv-svc-featured__text {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.article .content .clv-svc-featured .clv-svc-featured__text {
  margin: 0;
}

.article .content .clv-spromo .clv-spromo-card__ico .article-content__img,
.article .content .clv-spromo .clv-spromo-card__ico img,
.article .content .clv-spromo .clv-spromo-card__img {
  margin: 0;
  display: block;
  width: 72px;
  max-width: 72px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
}

.article .content .clv-svc-featured .clv-svc-featured__img,
.article .content .clv-svc-featured .article-content__img {
  margin: 0;
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
}

/* Типографика статей (Markdown / HTML из Bitrix) */
.article .content,
.article-html {
  font-size: 1.05rem;
  /* Иначе длинные URL и строки без пробелов раздувают сетку и дают горизонтальный скролл + «съезжание» шапки */
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article .content a,
.article-html a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article .content li,
.article-html li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article .content pre,
.article-html pre {
  overflow-x: auto;
  max-width: 100%;
}

.article .content h2,
.article-html h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.article .content h3,
.article-html h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.article .content p,
.article-html p {
  margin: 0.75rem 0;
}

/*
 * Таблицы из Markdown оборачиваются render-table.html в .article-table-wrap.
 * Рамка на всю ширину колонки статьи; при широкой таблице — горизонтальный скролл внутри рамки
 * (без table-layout:fixed, иначе на телефоне текст ломается по букве в узких колонках).
 */
.article .content .article-table-wrap,
.article-html .article-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  margin: 1rem 0;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  background: #fff;
}

.article .content .article-table-wrap > table,
.article-html .article-table-wrap > table {
  display: table;
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
  margin: 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.article .content .article-table-wrap th,
.article .content .article-table-wrap td,
.article-html .article-table-wrap th,
.article-html .article-table-wrap td {
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  min-width: clamp(4rem, 16vw, 9rem);
}

.article .content th,
.article .content td,
.article-html th,
.article-html td {
  border: 1px solid #ddd;
  padding: 0.5rem 0.75rem;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

.article .content th,
.article-html th {
  background: #f4f6f8;
}

/*
 * Матрицы маркировок («Склад 15» / «Магазин 15»): обёртка скроллит по X, когда сумма минимальных
 * ширин колонок больше контейнина. Перенос текста включается; колонку не уже clamp(rem, vw, cap).
 * «Липкая» первая колонка только на экранах ≥997px — на телефоне вся строка участвует в горизонтальном скролле.
 */
.article .content .wh15-wrap,
.article-html .wh15-wrap,
.article .content .mag15-wrap,
.article-html .mag15-wrap {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
  max-width: 100%;
}

.article .content table.wh15-table,
.article-html table.wh15-table,
.article .content table.mag15-table,
.article-html table.mag15-table {
  display: table;
  table-layout: auto;
  width: auto;
  min-width: 100%;
  max-width: none;
  border-collapse: collapse;
  overflow: visible;
}

/* Базовый минимум ячейки: и rem, и доля viewport (не «четверть экрана на всю таблицу», а нижняя планка ~1/5–1/6 ширины) */
.article .content .wh15-table th,
.article .content .wh15-table td,
.article .content .mag15-table th,
.article .content .mag15-table td,
.article-html .wh15-table th,
.article-html .wh15-table td,
.article-html .mag15-table th,
.article-html .mag15-table td {
  box-sizing: border-box;
  vertical-align: top;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
  min-width: clamp(3.25rem, 18vw, 8.5rem);
}

/*
 * Шапка матриц: длинные названия столбцов должны переноситься (!= nowrap у ячеек с ✓ в tbody).
 */
.article .content .wh15-table thead th,
.article .content .mag15-table thead th,
.article-html .wh15-table thead th,
.article-html .mag15-table thead th {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Первая колонка (товарные группы): шире минимум, перенос разрешён */
.article .content .wh15-table > thead > tr > th:first-child,
.article .content .wh15-table > tbody > tr > td:first-child,
.article .content .mag15-table > thead > tr > th:first-child,
.article .content .mag15-table > tbody > tr > td:first-child,
.article-html .wh15-table > thead > tr > th:first-child,
.article-html .wh15-table > tbody > tr > td:first-child,
.article-html .mag15-table > thead > tr > th:first-child,
.article-html .mag15-table > tbody > tr > td:first-child {
  text-align: left;
  min-width: clamp(6.5rem, 28vw, 14rem);
}

/* Склад 15: колонка «Версия» — короткие номера в одну строку */
.article .content .wh15-table > thead > tr > th:nth-child(2),
.article .content .wh15-table > tbody > tr > td:nth-child(2),
.article-html .wh15-table > thead > tr > th:nth-child(2),
.article-html .wh15-table > tbody > tr > td:nth-child(2) {
  white-space: nowrap;
  min-width: clamp(3.5rem, 14vw, 7rem);
  max-width: none;
}

/* Колонки с ✓ / ✗: одна строка, узкий минимум */
.article .content .wh15-table td:nth-child(n + 3),
.article .content .mag15-table td:nth-child(n + 2),
.article-html .wh15-table td:nth-child(n + 3),
.article-html .mag15-table td:nth-child(n + 2) {
  white-space: nowrap;
  text-align: center;
}

.article .content .mag15-table th:nth-child(n + 2),
.article-html .mag15-table th:nth-child(n + 2) {
  white-space: normal;
  text-align: center;
}

.article .content .wh15-table thead th:nth-child(n + 3),
.article-html .wh15-table thead th:nth-child(n + 3) {
  white-space: normal;
  text-align: center;
}

/* Десктоп: липкая шапка и первая колонка при скролле */
@media (min-width: 997px) {
  .article .content .wh15-table thead th,
  .article .content .mag15-table thead th,
  .article-html .wh15-table thead th,
  .article-html .mag15-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .article .content .wh15-table thead th:first-child,
  .article .content .mag15-table thead th:first-child,
  .article-html .wh15-table thead th:first-child,
  .article-html .mag15-table thead th:first-child {
    z-index: 4;
  }

  .article .content .wh15-table thead th:first-child,
  .article .content .wh15-table tbody td:first-child,
  .article .content .mag15-table thead th:first-child,
  .article .content .mag15-table tbody td:first-child,
  .article-html .wh15-table thead th:first-child,
  .article-html .wh15-table tbody td:first-child,
  .article-html .mag15-table thead th:first-child,
  .article-html .mag15-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    box-shadow: 3px 0 10px rgba(26, 26, 46, 0.08);
  }

  .article .content .mag15-table tbody td:first-child,
  .article .content .wh15-table tbody td:first-child,
  .article-html .mag15-table tbody td:first-child,
  .article-html .wh15-table tbody td:first-child {
    z-index: 1;
  }

  /* угол: пересечение шапки и первой колонки */
  .article .content .wh15-table thead th:first-child,
  .article .content .mag15-table thead th:first-child,
  .article-html .wh15-table thead th:first-child,
  .article-html .mag15-table thead th:first-child {
    z-index: 5;
  }

  /* Длинные заголовки колонок: ограничиваем ширину, чтобы текст переносился внутри ячейки */
  .article .content .wh15-table thead th:nth-child(n + 3),
  .article .content .mag15-table thead th:nth-child(n + 2),
  .article-html .wh15-table thead th:nth-child(n + 3),
  .article-html .mag15-table thead th:nth-child(n + 2) {
    max-width: 15rem;
  }
}

/* Поиск по товарной группе в матрицах маркировок — только десктоп (как липкая первая колонка) */
.marking-matrix-filter {
  display: none;
}

@media (min-width: 997px) {
  .marking-matrix {
    margin: 1.5rem 0;
  }

  .marking-matrix-filter {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f8f9fb;
  }

  .marking-matrix-filter__label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1a1a2e;
  }

  .marking-matrix-filter__row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .marking-matrix-filter__input {
    flex: 1 1 16rem;
    min-width: 12rem;
    max-width: 28rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid #c8cdd4;
    border-radius: 4px;
    font: inherit;
    font-size: 0.92rem;
    background: #fff;
    color: #1a1a2e;
  }

  .marking-matrix-filter__input:focus {
    outline: 2px solid #4a7fc4;
    outline-offset: 1px;
    border-color: #4a7fc4;
  }

  .marking-matrix-filter__count {
    font-size: 0.85rem;
    color: #5c6370;
    white-space: nowrap;
  }

  .marking-matrix-filter__hint {
    margin: 0.45rem 0 0;
    font-size: 0.82rem;
    color: #5c6370;
    line-height: 1.4;
  }

  .marking-matrix-filter__empty {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
    color: #721c24;
  }

  .marking-matrix-filter__empty[hidden] {
    display: none;
  }

  .marking-matrix .wh15-wrap,
  .marking-matrix .mag15-wrap {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* Мобильные: убрать липкость из встроенных <style> в статьях (иначе снова «залипает» только первая колонка) */
@media (max-width: 996px) {
  .article .content .wh15-table th,
  .article .content .wh15-table td,
  .article .content .mag15-table th,
  .article .content .mag15-table td,
  .article-html .wh15-table th,
  .article-html .wh15-table td,
  .article-html .mag15-table th,
  .article-html .mag15-table td {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
  }

  /* Матрицы маркировок на узком экране: без table-layout:fixed (он давал «столбик» по букве).
     Таблица не уже ~⅓ экрана; первая колонка — не уже трети viewport; остальные — разумный min.
     Ширше контейнера — горизонтальный скролл у .wh15-wrap / .mag15-wrap. */
  .article .content table.wh15-table,
  .article-html table.wh15-table,
  .article .content table.mag15-table,
  .article-html table.mag15-table {
    width: max-content;
    min-width: max(33vw, 100%);
    max-width: none;
    table-layout: auto;
  }

  .article .content .wh15-table th,
  .article .content .wh15-table td,
  .article .content .mag15-table th,
  .article .content .mag15-table td,
  .article-html .wh15-table th,
  .article-html .wh15-table td,
  .article-html .mag15-table th,
  .article-html .mag15-table td {
    min-width: clamp(3rem, 9vw, 9rem);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: manual;
  }

  .article .content .wh15-table > thead > tr > th:first-child,
  .article .content .wh15-table > tbody > tr > td:first-child,
  .article .content .mag15-table > thead > tr > th:first-child,
  .article .content .mag15-table > tbody > tr > td:first-child,
  .article-html .wh15-table > thead > tr > th:first-child,
  .article-html .wh15-table > tbody > tr > td:first-child,
  .article-html .mag15-table > thead > tr > th:first-child,
  .article-html .mag15-table > tbody > tr > td:first-child {
    min-width: max(11rem, 33vw);
  }

  .article .content .wh15-table > thead > tr > th:nth-child(2),
  .article .content .wh15-table > tbody > tr > td:nth-child(2),
  .article-html .wh15-table > thead > tr > th:nth-child(2),
  .article-html .wh15-table > tbody > tr > td:nth-child(2) {
    white-space: nowrap;
    min-width: clamp(4rem, 12vw, 7.5rem);
  }

  .article .content .wh15-table td:nth-child(n + 3),
  .article .content .mag15-table td:nth-child(n + 2),
  .article-html .wh15-table td:nth-child(n + 3),
  .article-html .mag15-table td:nth-child(n + 2) {
    white-space: nowrap;
    text-align: center;
    word-break: normal;
    min-width: clamp(2.75rem, 7vw, 4.5rem);
  }

  /* Markdown-таблицы в .article-table-wrap: не сжимать колонки, скролл у обёртки */
  .article .content .article-table-wrap > table,
  .article-html .article-table-wrap > table {
    width: max-content;
    min-width: max(100%, 33vw);
    max-width: none;
    table-layout: auto;
  }

  .article .content .article-table-wrap th,
  .article .content .article-table-wrap td,
  .article-html .article-table-wrap th,
  .article-html .article-table-wrap td {
    min-width: clamp(4.5rem, 22vw, 11rem);
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: manual;
  }

  .article .content .article-table-wrap > table > thead > tr > th:first-child,
  .article .content .article-table-wrap > table > tbody > tr > td:first-child,
  .article-html .article-table-wrap > table > thead > tr > th:first-child,
  .article-html .article-table-wrap > table > tbody > tr > td:first-child {
    min-width: max(7rem, 28vw);
  }
}

/* Ленты (ширину задаёт .page-main) */
.sections-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.article-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-feed__item {
  padding: 0.65rem 0;
  border-bottom: 1px solid #e8eaed;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
}

.article-feed__item time {
  color: var(--cleverence-muted);
  font-size: 0.875rem;
}

.nav-crumb {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--cleverence-muted);
}

.nav-crumb a {
  color: var(--cleverence-primary);
  text-decoration: none;
}

/* Общие хлебные крошки для ленты и статьи */
.blog-breadcrumbs {
  font-size: 0.9rem;
  color: #5c6370;
  margin-bottom: 1rem;
}

.blog-breadcrumbs a {
  color: #0083b0;
  text-decoration: none;
}

.blog-breadcrumbs a:hover {
  text-decoration: underline;
}

.blog-breadcrumbs__sep {
  margin: 0 0.35rem;
  color: #a0a4ae;
}

.blog-breadcrumbs__current {
  color: #1a1a2e;
}

/* Баннер cookies перед футером: показываем только новым посетителям */
.cookie-consent {
  position: relative;
  transform: translateY(8px);
  width: min(760px, calc(100% - 24px));
  margin: 0 auto 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cookie-consent--visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (min-width: 997px) {
  .cookie-consent {
    position: fixed !important;
    left: auto !important;
    right: 16px !important;
    bottom: 14px !important;
    margin: 0 !important;
    width: min(360px, calc(100% - 24px)) !important;
    max-width: min(360px, calc(100% - 24px)) !important;
    z-index: 1200;
    transform: translateY(0);
  }

  .cookie-consent.cookie-consent--in-toc {
    left: auto !important;
    right: 16px !important;
    width: min(360px, calc(100% - 24px)) !important;
    max-width: min(360px, calc(100% - 24px)) !important;
  }

  .cookie-consent.cookie-consent--in-toc .cookie-consent__inner {
    border-radius: 12px 0 0 12px;
  }

  .cookie-consent.cookie-consent--desktop-fixed {
    left: auto !important;
    right: 16px !important;
    bottom: 14px !important;
    margin: 0 !important;
    width: min(360px, calc(100% - 24px)) !important;
    max-width: min(360px, calc(100% - 24px)) !important;
  }
}

.cookie-consent__inner {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #e6e9ef;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 12px 14px;
}

.cookie-consent__title {
  font-size: 14px;
  font-weight: 600;
  color: #101828;
  margin: 0 0 6px;
}

.cookie-consent__text {
  margin: 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
}

.cookie-consent__text a {
  color: var(--cleverence-primary);
  word-break: break-word;
}

.cookie-consent__btn {
  margin-top: 10px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #344054;
  border-radius: 8px;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
}

.cookie-consent__btn:hover {
  border-color: #b9c1cf;
  background: #f8fafc;
}

/* RuTube — shortcode {{< rutube >}} */
.video-embed {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 1.5rem auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f172a;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
