/* ==========================================================================
   buhgalteriya — обзор сервиса (single-bh_company.php) и сравнение двух сервисов (single-bh_compare.php).
   Только раскладка этих двух страниц и модификаторы общих компонентов:
   .bh-passport--notes, .bh-cmp--pair, .bh-cmp--scen, .bh-cmp__label--text, .bh-trust--flat.
   Цвета, размеры и линии — из tokens.css. Медиазапросы: min-width 768px и 1200px.
   ========================================================================== */

/* ---------- Обзор: шапка, лист «Цена и переход», тело ---------- */
.bh-co { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px var(--bh-gap); align-items: start; padding-top: 4px; }
.bh-co > * { min-width: 0; }
.bh-co__head { display: grid; gap: 12px; }
.bh-co__id { display: grid; grid-template-columns: var(--bh-logo-l) minmax(0, 1fr); gap: 16px; align-items: center; }
.bh-co__idtext { display: grid; gap: 8px; min-width: 0; }
.bh-co__tags { display: flex; flex-wrap: wrap; gap: 6px 8px; }

.bh-co__aside { display: grid; gap: 16px; }
.bh-co__price { display: grid; gap: 2px; min-width: 0; }
.bh-co__facts { border-top: var(--bh-border-ink); font-size: var(--bh-fs-small); line-height: var(--bh-lh-small); }
.bh-co__facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: var(--bh-border); }
.bh-co__facts dt { color: var(--bh-text-muted); }
.bh-co__facts dd { text-align: right; font-weight: var(--bh-fw-semibold); }
.bh-co__toc { display: none; }

.bh-co__body > .bh-section:first-of-type { margin-top: 32px; }
.bh-co__cta { margin-top: 16px; }
.bh-co__cta .bh-btn { width: 100%; }
.bh-co__scoretext { display: grid; gap: 6px; flex: 1 1 240px; min-width: 0; max-width: var(--bh-measure); font-size: var(--bh-fs-small); line-height: 22px; }
.bh-co .bh-note--calc .bh-ruled { margin-top: 4px; }

/* ---------- Паспорт с примечаниями: графа — значение — примечание и источник ---------- */
.bh-passport--notes { grid-template-columns: minmax(0, 1fr); }
.bh-passport--notes .bh-passport__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: baseline; padding: 10px 0; }
.bh-passport--notes .bh-passport__k { max-width: none; display: flex; align-items: center; gap: 6px; }
.bh-passport--notes .bh-passport__v { font-weight: var(--bh-fw-semibold); }
.bh-passport--notes .bh-passport__src { margin-left: 0; white-space: nowrap; }
.bh-passport__note { grid-column: 1 / -1; max-width: 76ch; font-size: var(--bh-fs-small); line-height: var(--bh-lh-small); color: var(--bh-text-muted); }

/* ---------- Цифры блока «Цены и тарифы» ---------- */
.bh-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; border-top: var(--bh-rule); }
.bh-figs__item { display: grid; gap: 6px; align-content: start; min-width: 0; padding: 12px 12px 12px 0; border-bottom: var(--bh-border); }
.bh-figs__item:nth-child(even) { padding-left: 12px; border-left: var(--bh-border); }
.bh-figs__item dd { display: grid; gap: 2px; min-width: 0; }
.bh-figs__item .bh-num { white-space: normal; }

/* тарифы: на телефоне строка — название и две суммы, под ними «что известно»; от 768px — таблица */
.bh-co__tariffs .bh-mini, .bh-co__tariffs tbody { display: block; }
.bh-co__tariffs thead { display: none; }
.bh-co__tariffs tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 16px; align-items: end; padding: 10px 0; border-bottom: var(--bh-border); }
.bh-co__tariffs tr:last-child { border-bottom: 0; }
.bh-co__tariffs th, .bh-co__tariffs td { padding: 0; border-bottom: 0; }
.bh-co__tariffs td.bh-mini__num::before { content: attr(data-label); display: block; font-size: var(--bh-fs-micro); line-height: var(--bh-lh-micro); color: var(--bh-text-muted); }
.bh-co__tariffs tbody th, .bh-cmp-crit tbody th { font-weight: var(--bh-fw-semibold); white-space: nowrap; }
.bh-co__tariffs td:last-child { grid-column: 1 / -1; color: var(--bh-text-muted); }
.bh-co__hist { min-width: 560px; }
.bh-co__hist td:last-child { color: var(--bh-text-muted); }

.bh-trust--flat { border-top: 0; padding-top: 0; }

/* ---------- Сравнение: вывод «А или Б» ---------- */
.bh-vs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px var(--bh-gap); align-items: stretch; margin-top: 4px; }
.bh-vs__side { display: grid; grid-template-rows: auto 1fr auto auto; gap: 14px; min-width: 0; padding: var(--bh-box-pad); background: var(--bh-surface); border: var(--bh-border-ink); border-radius: var(--bh-r-0); }
.bh-vs__head { display: grid; grid-template-columns: var(--bh-logo-l) minmax(0, 1fr); gap: 4px 16px; align-items: center; }
.bh-vs__head a { transition: color var(--bh-t); }
.bh-vs__head a:hover { color: var(--bh-accent); }
.bh-vs__verdict { max-width: 62ch; }
.bh-vs__verdict b { font-weight: var(--bh-fw-semibold); }
.bh-vs__nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding-top: 12px; border-top: var(--bh-border); }
.bh-vs__nums > div { display: grid; gap: 2px; align-content: start; justify-items: start; min-width: 0; }
.bh-vs__acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-self: end; }
.bh-vs__or { align-self: center; text-align: center; font-family: var(--bh-font-heading); font-style: italic; font-size: 22px; line-height: 28px; color: var(--bh-text-muted); }

/* ---------- Сравнение: таблица на двоих ----------
   Телефон: подпись графы — строка на всю ширину, под ней два значения рядом. От 768px — обычная таблица. */
.bh-cmp--pair, .bh-cmp--pair thead, .bh-cmp--pair tbody, .bh-cmp--pair tfoot { display: block; }
.bh-cmp--pair tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bh-cmp--pair th, .bh-cmp--pair td { min-width: 0; }
.bh-cmp--pair .bh-cmp__label { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding-block: 8px; border-right: 0; border-bottom: 0; }
.bh-cmp--pair thead .bh-cmp__label { display: none; }
.bh-cmp--pair td + td { border-left: var(--bh-border); }
.bh-cmp--pair td::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: var(--bh-fs-micro); line-height: var(--bh-lh-micro); color: var(--bh-text-muted); }
.bh-cmp--pair .bh-cmp__best::after { content: none; }   /* слово «лучше» стоит в разметке рядом со значением */
.bh-cmp--pair tfoot td { border-bottom: 0; }
.bh-cmp--pair tfoot td::before { content: none; }

.bh-cmp__labeltext { display: inline-flex; align-items: center; gap: 6px; }
.bh-cmp__same { font-family: var(--bh-font-body); font-weight: var(--bh-fw-regular); font-size: var(--bh-fs-micro); line-height: var(--bh-lh-micro); letter-spacing: 0; text-transform: none; color: var(--bh-text-muted); }
.bh-cmp__label--text { font-family: var(--bh-font-body); font-size: var(--bh-fs-table); line-height: var(--bh-lh-table); font-weight: var(--bh-fw-semibold); letter-spacing: 0; text-transform: none; color: var(--bh-text); }
.bh-cmp__val { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-weight: var(--bh-fw-semibold); }
.bh-cmp__bestword { font-size: var(--bh-fs-micro); line-height: var(--bh-lh-micro); font-weight: var(--bh-fw-semibold); color: var(--bh-accent-2-deep); }
.bh-cmp__bestword::before { content: "— "; }
.bh-cmp__note { display: block; margin-top: 4px; max-width: 56ch; font-size: var(--bh-fs-micro); line-height: var(--bh-lh-micro); font-weight: var(--bh-fw-regular); color: var(--bh-text-muted); }
.bh-cmp__svc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: center; min-width: 0; }
.bh-cmp__svc > div { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.bh-cmp__name { font-size: 17px; line-height: 22px; font-weight: var(--bh-fw-bold); transition: color var(--bh-t); }
.bh-cmp__name:hover { color: var(--bh-accent); }
.bh-cmp__acts { display: grid; gap: 8px; }
.bh-cmp__acts .bh-btn { width: 100%; }

/* сценарии «одна задача — два тарифа»: третья графа — разница */
.bh-cmp--scen thead { display: none; }
.bh-cmp--scen td:last-child { grid-column: 1 / -1; border-left: 0; }
.bh-cmp-scen__title { margin: 32px 0 8px; }
.bh-cmp-scen__sub { margin: 0 0 var(--bh-block-gap); }

.bh-cmp-year { min-width: 640px; }
.bh-cmp-year td:last-child { min-width: 280px; color: var(--bh-text-muted); }
.bh-cmp-crit { min-width: 600px; }
.bh-cmp-crit td { min-width: 200px; }
.bh-cmp-crit tbody tr:last-child th { border-bottom: 0; }
.bh-cmp-crit .bh-scorecard__weight { display: block; margin: 2px 0 0; font-weight: var(--bh-fw-regular); }

/* ---------- Сравнение: дебет и кредит каждого, «кому что выбрать», ссылки ---------- */
.bh-pair-dc { display: grid; gap: 40px; }
.bh-choose__row { display: grid; gap: 8px; padding-block: 12px; }
.bh-choose .bh-ruled__margin { padding-top: 16px; }
.bh-choose__pickbox { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.bh-choose__pick { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: var(--bh-fw-semibold); }
.bh-choose__why { max-width: var(--bh-measure); font-size: var(--bh-fs-small); line-height: 22px; color: var(--bh-text-muted); }
.bh-cmp-more { margin-top: 24px; }

/* ==========================================================================
   768px
   ========================================================================== */
@media (min-width: 768px) {
  .bh-co { grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); }
  .bh-co__body { grid-column: 1 / -1; }
  .bh-co__cta .bh-btn { width: auto; }

  .bh-passport--notes .bh-passport__row { grid-template-columns: 220px 170px minmax(0, 1fr); gap: 4px 20px; }
  .bh-passport--notes .bh-passport__v { text-align: left; }
  .bh-passport__note { grid-column: auto; }

  .bh-co__tariffs .bh-mini { display: table; min-width: 580px; }
  .bh-co__tariffs thead { display: table-header-group; }
  .bh-co__tariffs tbody { display: table-row-group; }
  .bh-co__tariffs tr { display: table-row; }
  .bh-co__tariffs th, .bh-co__tariffs td { padding: 10px 12px; border-bottom: var(--bh-border); }
  .bh-co__tariffs thead th { border-bottom: var(--bh-rule); }
  .bh-co__tariffs tbody tr:last-child th, .bh-co__tariffs tbody tr:last-child td { border-bottom: 0; }
  .bh-co__tariffs td.bh-mini__num::before { content: none; }
  .bh-co__tariffs td:last-child { min-width: 240px; }

  .bh-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bh-figs__item:nth-child(even) { padding-left: 0; border-left: 0; }
  .bh-figs__item + .bh-figs__item { padding-left: 16px; border-left: var(--bh-border); }

  .bh-vs { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }

  .bh-cmp--pair { display: table; }
  .bh-cmp--pair thead { display: table-header-group; }
  .bh-cmp--pair tbody { display: table-row-group; }
  .bh-cmp--pair tfoot { display: table-footer-group; }
  .bh-cmp--pair tr { display: table-row; }
  .bh-cmp--pair .bh-cmp__label, .bh-cmp--pair thead .bh-cmp__label { display: table-cell; width: 200px; padding-block: 10px; border-right: var(--bh-margin-line); border-bottom: var(--bh-border); }
  .bh-cmp--pair thead .bh-cmp__label { border-bottom: var(--bh-rule); }
  .bh-cmp--pair tfoot .bh-cmp__label, .bh-cmp--pair tbody tr:last-child .bh-cmp__label { border-bottom: 0; }
  .bh-cmp--pair tbody tr:last-child td { border-bottom: 0; }
  .bh-cmp--pair tfoot th, .bh-cmp--pair tfoot td { border-top: var(--bh-border-ink); }
  .bh-cmp--pair td::before { content: none; }
  .bh-cmp__labeltext { display: flex; margin-bottom: 6px; }
  .bh-cmp__svc { grid-template-columns: var(--bh-logo-m) minmax(0, 1fr); gap: 12px; }
  .bh-cmp__acts { display: flex; flex-wrap: wrap; }
  .bh-cmp__acts .bh-btn { width: auto; }
  .bh-cmp--scen thead { display: table-header-group; }
  .bh-cmp--scen thead th { background: var(--bh-bg-2); font-family: var(--bh-font-mono); font-weight: var(--bh-fw-bold); font-size: var(--bh-fs-label); line-height: var(--bh-lh-label); letter-spacing: var(--bh-ls-caps); text-transform: uppercase; color: var(--bh-text-muted); }
  .bh-cmp--scen .bh-cmp__label { width: 260px; }
  .bh-cmp--scen td:last-child { border-left: var(--bh-border); }

  .bh-choose__row { grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 7fr); gap: 8px 24px; align-items: start; }
}

/* ==========================================================================
   1200px
   ========================================================================== */
@media (min-width: 1200px) {
  .bh-co { grid-template-columns: minmax(0, 1fr) var(--bh-aside-w); grid-template-rows: auto 1fr; column-gap: 40px; }
  .bh-co__head { grid-column: 1; grid-row: 1; }
  .bh-co__body { grid-column: 1; grid-row: 2; }
  .bh-co__aside { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 12px; max-height: calc(100vh - 24px); gap: 12px; overflow-y: auto; scrollbar-width: thin; }
  .bh-co__toc { display: grid; gap: 8px; }
  .bh-co__toc ol { border-top: var(--bh-border-ink); }
  .bh-co__toc a { display: block; padding: 4px 0; border-bottom: var(--bh-border); font-size: var(--bh-fs-small); line-height: var(--bh-lh-small); transition: color var(--bh-t), background-color var(--bh-t); }
  .bh-co__toc a:hover { color: var(--bh-accent); background: var(--bh-surface); }

  .bh-passport--notes .bh-passport__row { grid-template-columns: 250px 190px minmax(0, 1fr); }
  .bh-vs__nums { grid-template-columns: repeat(3, auto); justify-content: space-between; }
  .bh-cmp--pair .bh-cmp__label, .bh-cmp--pair thead .bh-cmp__label { width: 260px; }
  .bh-cmp--scen .bh-cmp__label { width: 340px; }
  .bh-pair-dc { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 40px; align-items: start; }
}
