/* ============================================
   Оформление контентных блоков в текстах: таблицы, образцы документов, содержание
   Подключается на всех страницах (themes/2020/views/frontend/include/_header.php)
   ============================================ */

/* ========== Таблицы (figure.table — так их вставляет CKEditor) ==========
   Базовый стиль общий для статей и страниц услуг (перенесён из css/2024/services.css).
   Правила только для статей ограничены .resource__desc ниже. */

figure.table {
  display: block;
  width: 100%;
  margin-bottom: 80px;
}
figure.table table {
  width: 100%;
}
figure.table table thead {
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
}
figure.table table thead tr {
  border: none;
  background-color: #33836E;
}
figure.table table thead tr th {
  text-align: left;
  padding: 16px;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
figure.table table thead tr th:last-child {
  border-radius: 0 12px 12px 0;
}
figure.table table thead tr th:first-child {
  border-radius: 12px 0 0 12px;
}
figure.table table tbody tr {
  border: none;
}
figure.table table tbody tr:nth-child(even) {
  background-color: rgba(47, 43, 67, 0.04);
}
figure.table table tbody tr td {
  text-align: left;
  padding: 16px;
  color: #140A32;
}
figure.table table tbody tr td:last-child {
  border-radius: 0 12px 12px 0;
}
figure.table table tbody tr td:first-child {
  border-radius: 12px 0 0 12px;
}

@media (max-width: 992px) {
  figure.table {
    margin-bottom: 40px;
  }
  figure.table table thead tr th {
    padding: 12px;
    font-size: 14px;
  }
  figure.table table tbody tr td {
    padding: 12px;
    font-size: 14px;
  }
}

/* ---------- Таблицы в статьях ---------- */

.resource__desc figure.table {
  margin: 25px 0 30px;
}
/* ячейка из одной колонки (th:first-child и :last-child одновременно) — скругляем все углы */
.resource__desc figure.table th:only-child,
.resource__desc figure.table td:only-child {
  border-radius: 12px;
}
.resource__desc figure.table table thead tr th,
.resource__desc figure.table table tbody tr td {
  font-size: 15px;
  line-height: 1.45;
  vertical-align: top;
}
/* глобальное правило `* { color: #140A32 }` перекрашивает <strong>, <a>, <abbr> внутри шапки */
.resource__desc figure.table thead th * {
  color: inherit;
}
.resource__desc figure.table td p,
.resource__desc figure.table th p {
  margin: 0;
}
.resource__desc figure.table td p + p {
  margin-top: 8px;
}
/* строка-заголовок внутри tbody (таблицы без <thead>, «Столбец заголовка» в CKEditor) */
.resource__desc figure.table tbody th {
  text-align: left;
  padding: 16px;
  font-size: 15px;
  font-weight: 600;
  vertical-align: top;
}
/* рамки от HTML-атрибута border="1" в старых таблицах */
.resource__desc figure.table table,
.resource__desc figure.table td,
.resource__desc figure.table th {
  border: none;
}
.resource__desc figure.table td ul,
.resource__desc figure.table td ol {
  margin: 0;
}

@media (max-width: 992px) {
  .resource__desc figure.table table thead tr th,
  .resource__desc figure.table table tbody tr td,
  .resource__desc figure.table tbody th {
    padding: 12px;
    font-size: 14px;
  }
}

/* Телефон.
   2 колонки — остаётся таблицей (как на услугах).
   3+ колонок с шапкой — сервер добавляет .table--stack и data-label ячейкам
   (App\services\TableMobileLabels), строки превращаются в карточки.
   3+ колонок без шапки — горизонтальная прокрутка. */
@media (max-width: 767px) {
  .resource__desc figure.table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .resource__desc figure.table:not(.table--stack):has(tr > :nth-child(3)) table {
    min-width: 540px;
  }

  .resource__desc figure.table--stack {
    overflow: visible;
  }
  .resource__desc figure.table--stack table,
  .resource__desc figure.table--stack tbody,
  .resource__desc figure.table--stack tr,
  .resource__desc figure.table--stack td {
    display: block;
    width: 100%;
  }
  .resource__desc figure.table--stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .resource__desc figure.table--stack table tbody tr,
  .resource__desc figure.table--stack table tbody tr:nth-child(even) {
    background-color: rgba(47, 43, 67, 0.04);
    border-radius: 12px;
    padding: 6px 0;
    margin-bottom: 10px;
  }
  .resource__desc figure.table--stack table tbody tr td,
  .resource__desc figure.table--stack table tbody tr td:first-child,
  .resource__desc figure.table--stack table tbody tr td:last-child {
    border-radius: 0;
    padding: 6px 16px;
  }
  .resource__desc figure.table--stack table tbody tr td:first-child {
    font-weight: 600;
    font-size: 15px;
  }
  .resource__desc figure.table--stack td[data-label]:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    line-height: 1.3;
    color: #33836E;
    margin-bottom: 2px;
  }
}

/* ========== Образец документа (div.document в тексте статьи) ==========
   Шапку с кнопкой «Скачать» и подсветку пропусков добавляет сервер
   (App\services\DocumentSampleBlock), блок получает класс .doc-sample.
   Старый стиль .document (жёлтая рамка) — css/2023/style.css, здесь перекрывается. */

.resource__desc .document.doc-sample {
  margin: 25px 0 30px;
  padding: 0;
  border: 1px solid rgba(47, 43, 67, 0.12);
  border-radius: 12px;
  overflow: hidden;
  background-color: #fff;
  text-align: left;
  line-height: 1.6;
}
.resource__desc .doc-sample__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 12px 20px;
  background-color: #33836E;
}
.resource__desc .doc-sample__title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}
.resource__desc .doc-sample__title::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2z'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.resource__desc a.doc-sample__btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 8px;
  background-color: #fff;
  color: #33836E;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s;
}
.resource__desc a.doc-sample__btn:hover {
  background-color: #eef5f2;
  color: #140A32;
  text-decoration: none;
}

.resource__desc .doc-sample__body {
  padding: 28px 32px;
}
/* разметка из Word: шрифты, отступы и интерлиньяж выравниваем, выравнивание по краю оставляем */
.resource__desc .doc-sample__body * {
  font-family: inherit !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  text-indent: 0 !important;
  color: #140A32;
}
.resource__desc .doc-sample__body p {
  margin: 0 0 10px !important;
}
.resource__desc .doc-sample__body p:last-child {
  margin-bottom: 0 !important;
}
.resource__desc .doc-sample__body [style*="justify"] {
  text-align: left !important;
}
.resource__desc .doc-sample__body ul,
.resource__desc .doc-sample__body ol {
  margin: 0 0 10px !important;
  padding-left: 22px;
}
.resource__desc .doc-sample__body ol {
  list-style: decimal;
}
.resource__desc .doc-sample__body ul {
  list-style: disc;
}
.resource__desc .doc-sample__body ol li,
.resource__desc .doc-sample__body ul li {
  margin: 0 0 4px;
  padding-left: 0;
}
/* селектор не короче: иначе проигрывает .resource__desc ol li:nth-child(-n+9):before (style.css) */
.resource__desc .doc-sample__body ol li::before,
.resource__desc .doc-sample__body ul li::before {
  content: none;
}
.resource__desc .doc-sample__body .doc-blank {
  color: #33836E !important;
  word-break: break-all;
}

@media (max-width: 767px) {
  .resource__desc .doc-sample__head {
    padding: 10px 12px 10px 16px;
  }
  .resource__desc .doc-sample__title {
    font-size: 15px;
  }
  .resource__desc a.doc-sample__btn {
    padding: 7px 12px;
    font-size: 13px;
  }
  .resource__desc .doc-sample__body {
    padding: 18px 16px;
  }
  .resource__desc .doc-sample__body * {
    font-size: 14px !important;
  }
}

/* ========== Содержание статьи (protected/views/article/_toc.php) ==========
   Один блок под главной картинкой (внутри .mobile-nav) на всех экранах, длинный список
   сворачивается до первых пунктов. Боковое содержание убрано 2026-10-08.
   Префикс .q_row нужен, чтобы перебить старое правило .q_row .mobile-nav.active a
   (redisign-media.css). */

.q_row nav.toc {
  counter-reset: toc;
  margin: 0 0 30px;
  padding: 24px;
  border-radius: 12px;
  background-color: rgba(47, 43, 67, 0.04);
}
.q_row nav.toc .toc__title {
  display: block;
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}
.q_row nav.toc .toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.q_row nav.toc .toc__item {
  position: relative;
  margin: 0;
  padding: 9px 0 9px 34px;
  border-top: 1px solid rgba(47, 43, 67, 0.08);
  line-height: 1.45;
}
.q_row nav.toc .toc__item:first-child {
  border-top: none;
}
.q_row nav.toc .toc__item--l2 {
  counter-increment: toc;
}
.q_row nav.toc .toc__item--l2::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  top: 9px;
  left: 0;
  color: #33836E;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}
/* подзаголовок H3 — без номера, с отступом и без разделителя */
.q_row nav.toc .toc__item--l3 {
  padding: 2px 0 6px 52px;
  border-top: none;
}
.q_row nav.toc .toc__item--l3::before {
  content: "–";
  position: absolute;
  top: 2px;
  left: 34px;
  color: #33836E;
}
.q_row nav.toc .toc__item > a {
  display: inline;
  margin: 0;
  color: #140A32;
  font-size: 15px;
  line-height: 1.45;
  text-decoration: none;
  transition: color 0.2s;
}
.q_row nav.toc .toc__item--l3 > a {
  font-size: 14px;
}
.q_row nav.toc .toc__item > a:hover {
  color: #33836E;
  text-decoration: underline;
}

.q_row nav.toc--collapsed:not(.toc--open) .toc__item--extra {
  display: none;
}
.q_row nav.toc .toc__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0 34px;
  padding: 0;
  border: none;
  background: none;
  color: #33836E;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
/* стрелка-галочка вниз: «Показать все» и кнопка «Скачать» в плашке документов */
.q_row nav.toc .toc__more::after,
.docs-teaser .docs-teaser__btn::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.q_row nav.toc.toc--open .toc__more::after {
  transform: translateY(2px) rotate(-135deg);
}
.q_row nav.toc .toc__more:hover {
  color: #140A32;
}

@media (max-width: 992px) {
  .q_row .mobile-nav.active {
    background-color: transparent;
  }
  /* нижний отступ задаёт обёртка .mobile-nav */
  .q_row .mobile-nav nav.toc {
    margin-bottom: 0;
  }
}

@media (max-width: 767px) {
  .q_row nav.toc {
    padding: 20px 16px;
  }
}

/* ========== Строка с данными статьи под хлебными крошками (.post-info-wrap) ==========
   Автор слева, справа в одну строку: время чтения, дата (и «обновлено»), просмотры,
   рейтинг. Иконки слева от текста; при нехватке места пункты переносятся целиком.
   Перекрывает старые правила redisign.css / redisign-media.css / style.css. */

.q_row .q_content .post-info-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 22px;
  padding: 14px 0;
  margin-bottom: 30px;
}
.q_row .q_content .post-info-wrap .post-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: none;
  margin: 0;
  white-space: nowrap;
}
.q_row .q_content .post-info-wrap .post-info-item.author {
  margin: 0 auto 0 0;
  white-space: normal;
}
.q_row .q_content .post-info-wrap .author-avatar {
  flex-shrink: 0;
}
.q_row .q_content .post-info-wrap .author-block .name {
  margin-bottom: 0;
  line-height: 1.3;
}
.q_row .q_content .post-info-wrap .author-block .user {
  font-size: 13px;
  line-height: 1.3;
}
.q_row .q_content .post-info-wrap .icon {
  display: flex;
  flex-shrink: 0;
}
.q_row .q_content .post-info-wrap .icon img {
  width: 18px;
  height: 18px;
}
.q_row .q_content .post-info-wrap b,
.q_row .q_content .post-info-wrap time {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}
.q_row .q_content .post-info-wrap .post-info-updated,
.q_row .q_content .post-info-wrap .post-info-updated time {
  font-size: 12px;
  font-weight: 400;
  color: rgba(47, 43, 67, 0.6);
}
.q_row .q_content .post-info-wrap .rating-result {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}
/* компактный рейтинг: одна звезда и «5 (5)» — пять звёзд не помещались в строку */
.q_row .q_content .post-info-wrap .rating-result svg {
  width: 16px;
  height: 16px;
}
.q_row .q_content .post-info-wrap .rating-result svg ~ svg {
  display: none;
}

/* колонка текста уже ~720px (телефон и десктоп 993–1199, где рядом боковая колонка):
   автор отдельной строкой, данные — строкой ниже, а не вразброс по двум строкам */
@media (min-width: 993px) and (max-width: 1199px), (max-width: 767px) {
  .q_row .q_content .post-info-wrap .post-info-item.author {
    flex-basis: 100%;
    margin-right: 0;
  }
}
@media (max-width: 767px) {
  .q_row .q_content .post-info-wrap {
    gap: 10px 18px;
    padding: 12px 0;
  }
  /* дата длинная — отдельной строкой в конце, короткие пункты остаются в одной строке */
  .q_row .q_content .post-info-wrap .post-info-date {
    order: 1;
    flex-basis: 100%;
  }
}

/* ========== Плашка «Образцы документов для скачивания» (protected/views/article/_docs_teaser.php) ==========
   Светлый фон в фирменном зелёном, внимание держат иконка и кнопка «Скачать».
   Вложенные элементы не ловят клики: скрипт плавной прокрутки (js/scripts.js)
   срабатывает, только когда цель клика — сама ссылка <a>. */

a.docs-teaser {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 30px;
  padding: 14px 16px;
  border: 1px solid rgba(51, 131, 110, 0.25);
  border-radius: 12px;
  background-color: #eef5f2;
  transition: border-color 0.2s, background-color 0.2s;
}
a.docs-teaser > * {
  pointer-events: none;
}
a.docs-teaser:hover {
  border-color: #33836E;
  background-color: #e5f0ec;
}
.docs-teaser__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #33836E;
  color: #fff;
}
.docs-teaser__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.docs-teaser .docs-teaser__title {
  color: #140A32;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}
.docs-teaser .docs-teaser__sub {
  color: #33836E;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.docs-teaser .docs-teaser__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 8px;
  background-color: #33836E;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 0.2s;
}
a.docs-teaser:hover .docs-teaser__btn {
  background-color: #2a6b5a;
}

@media (max-width: 575px) {
  a.docs-teaser {
    gap: 12px;
    padding: 12px;
  }
  .docs-teaser__icon {
    width: 40px;
    height: 40px;
  }
  .docs-teaser .docs-teaser__title {
    font-size: 15px;
  }
  /* на узком экране кнопка — только стрелка */
  .docs-teaser .docs-teaser__btn {
    padding: 10px 12px;
    font-size: 0;
    gap: 0;
  }
}
