/* citep.ru — компоненты шаблонов v2 (блочная сборка из blueprint конвейера). Поверх site.css. */
:root { --chk-bg: #ffe3e0; --chk-text: #8f1d12; --weight: #7c3aed; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chk-bg: #4a1f1a; --chk-text: #ffb4a8; --weight: #a78bfa; } }
:root[data-theme="dark"] {
  --bg: #0f1418; --surface: #161d23; --surface-2: #1c252c; --line: #2a353e;
  --text: #e8edf2; --muted: #a3afbb; --faint: #7d8995;
  --brand: #3fc59d; --brand-2: #5fd8b2; --brand-soft: #173a31;
  --warn-bg: #3a2f12; --warn-line: #6b5520; --info-bg: #15283b; --info-line: #2b4a6b; --tag: #a78bfa;
  --chk-bg: #4a1f1a; --chk-text: #ffb4a8; --weight: #a78bfa;
}

/* слот блока: подпись в режиме разметки — № пирамиды, тема, вес, формат */
.slot { scroll-margin-top: 84px; }
.slot .blk-tag b { font-weight: 800; }
.weight-bar { display: none; height: 4px; border-radius: 2px; background: var(--surface-2); margin: -8px 0 14px; overflow: hidden; }
.weight-bar i { display: block; height: 100%; background: var(--weight); }
body.show-blocks .weight-bar { display: block; }

/* текст блоков */
.slot h2 { margin-bottom: 12px; }
.slot h3 { margin: 18px 0 8px; }
.slot p:last-child, .slot ul:last-child, .slot ol:last-child { margin-bottom: 0; }
.slot ul.plain { padding-left: 22px; margin: 0 0 1em; } .slot ul.plain li { margin: 4px 0; }
.slot .tbl-wrap { margin: 4px 0 14px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.slot .tbl-wrap table th:first-child, .slot .tbl-wrap table td:first-child { padding-left: 14px; }
.slot .tbl-wrap tr:last-child td { border-bottom: 0; }

/* короткий прямой ответ (owner short_answer) */
.answer p:last-child { margin-bottom: 0; }

/* непроверенная норма: видна редактору, на проде блок не публикуется (L13 NO-GO) */
.chk { background: var(--chk-bg); color: var(--chk-text); border-radius: 4px; padding: 0 4px; font-size: .82em; font-weight: 600; white-space: nowrap; }
.norms-stamp { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin: -4px 0 12px; }

/* FAQ v2: всё видно без клика (без <details>) */
.faq-open .qa { padding: 14px 0; border-bottom: 1px solid var(--line); }
.faq-open .qa:last-child { border-bottom: 0; padding-bottom: 0; }
.faq-open .qa h3 { font-size: 17px; margin: 0 0 6px; }
.faq-open .qa p { margin: 0; color: var(--muted); }

/* оглавление в сайдбаре — порядок пирамиды */
.toc-v2 ol { list-style: none; padding: 0; margin: 0; counter-reset: t; }
.toc-v2 li { counter-increment: t; margin: 0; }
.toc-v2 a { display: flex; gap: 8px; padding: 6px 0; color: var(--text); font-size: 14px; border-bottom: 1px solid var(--line); }
.toc-v2 a::before { content: counter(t); color: var(--faint); min-width: 16px; font-variant-numeric: tabular-nums; }
.toc-v2 li:last-child a { border-bottom: 0; }

/* слот офферов без данных */
.offer.empty { opacity: .75; border-style: dashed; }
.slot-empty { font-size: 13px; color: var(--muted); }

.read-cards a.card { color: var(--text); display: block; }
.read-cards a.card b { display: block; margin-bottom: 4px; }

@media (max-width: 600px) {
  .card { padding: 16px; }
  .slot .tbl-wrap table { font-size: 14px; }
  th, td { padding: 8px 10px; }
}

/* таблицы на телефоне: строка → карточка «подпись: значение» */
@media (max-width: 600px) {
  .slot .tbl-wrap { border: 0; overflow: visible; }
  .slot .tbl-wrap thead { display: none; }
  .slot .tbl-wrap table, .slot .tbl-wrap tbody, .slot .tbl-wrap tr, .slot .tbl-wrap td { display: block; width: 100%; }
  .slot .tbl-wrap tr { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  .slot .tbl-wrap td { border: 0; padding: 4px 0 !important; display: grid; grid-template-columns: 42% 1fr; gap: 10px; }
  .slot .tbl-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .slot .tbl-wrap td:first-child { font-weight: 700; }
}

/* сайдбар растягивается на высоту колонки, чтобы sticky-оглавление ехало за прокруткой */
.layout > .aside { align-self: stretch; }

/* главная v2: разделы по группам хабов */
.cat-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cat-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.cat-group b { display: block; margin-bottom: 6px; font-size: 15px; }
.cat-group a { display: block; padding: 3px 0; font-size: 14px; color: var(--text); }
.cat-group a:hover { color: var(--brand); }
@media (max-width: 900px) { .cat-groups { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .cat-groups { grid-template-columns: 1fr; } }
.hero .card .btn { text-decoration: none; }

/* карточка МФО: условия займа — сетка «подпись / значение» */
.req.cond { margin-top: 4px; font-size: 15px; } .req.cond > div { font-weight: 600; } .req.cond .k { font-weight: 400; }

/* справочная v2: содержание в начале статьи (на телефоне сайдбар уходит вниз) */
.toc-inline { display: none; }
@media (max-width: 980px) { .toc-inline { display: block; } }
