/* «Сводная 091» (ТЗ 14.10.2026): фильтры слева (год, квартал, тип отчёта, район, вид деятельности), справа — таблицы */

.r91l { container-type: inline-size; container-name: r91l; }
.r91l-grid { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 18px; align-items: start; }
.r91l-main { min-width: 0; }
/* --card-sticky-h — высота неподвижной шапки карточки (если она есть), чтобы панель не уходила под неё */
.r91l-side { position: sticky; top: calc(var(--card-sticky-h, 0px) + 14px); z-index: 2; }

.r91l-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
    max-height: calc(100vh - var(--card-sticky-h, 0px) - 28px); overflow: auto; overscroll-behavior: contain; }
.r91l-panel-h { display: flex; align-items: center; gap: 8px; padding: 13px 14px 11px; font-size: 13.5px; font-weight: 750; color: var(--text);
    background: linear-gradient(180deg, #f7f9fe, #fff); border-bottom: 1px solid var(--border-soft); position: sticky; top: 0; z-index: 1; }
.r91l-panel-h svg { color: var(--accent); }
.r91l-reset { margin-left: auto; border: 0; background: none; padding: 2px 4px; font: inherit; font-size: 12px; font-weight: 650; color: var(--accent); cursor: pointer; border-radius: 6px; }
.r91l-reset:hover { background: var(--accent-soft); }

.r91l-sec { padding: 11px 12px 12px; border-top: 1px solid var(--border-soft); }
.r91l-panel-h + .r91l-sec { border-top: 0; }
.r91l-cap { display: flex; align-items: center; gap: 6px; margin: 0 2px 7px; font-size: 10.5px; font-weight: 800; letter-spacing: .55px; text-transform: uppercase; color: var(--muted); }
.r91l-cap svg { color: var(--faint); }
.r91l-sec-period .r91l-cap:not(:first-child) { margin-top: 12px; }
.r91l-year { width: 100%; font-weight: 700; }
.r91l .csel-btn { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-weight: 700; }

.r91l-qs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.r91l-q { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 34px; border: 1.5px solid var(--border); border-radius: 9px;
    background: #fff; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text-2); cursor: pointer; transition: all .13s; white-space: nowrap; }
.r91l-q:hover { border-color: #c9d4f3; color: var(--accent-2); }
.r91l-q.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(59, 100, 244, .28); }
.r91l-q .r91l-dot { position: absolute; top: 4px; right: 4px; }

.r91l-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: #c4cbd8; }
.r91l-dot.ok { background: var(--ok); }
.r91l-dot.warn { background: var(--warn); }
.r91l-dot.bad { background: var(--err); }
.r91l-dot.mute { background: #c4cbd8; }
.r91l-q.on .r91l-dot { box-shadow: 0 0 0 2px #fff; }

.r91l-list { display: flex; flex-direction: column; gap: 2px; }
.r91l-item { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; border: 0; background: none; padding: 7px 8px; border-radius: 9px; text-align: left;
    font: inherit; font-size: 12.8px; color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; }
.r91l-item:hover { background: #f4f6fb; color: var(--text); }
.r91l-item.on { background: var(--accent-soft); color: var(--accent-2); }
.r91l-item.on .r91l-item-t { font-weight: 750; }
.r91l-radio { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #c3cad8; background: #fff; flex: 0 0 15px; transition: border .12s; }
.r91l-item:hover .r91l-radio { border-color: #9fb0dd; }
.r91l-item.on .r91l-radio { border: 4.5px solid var(--accent); }
.r91l-item-b { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.r91l-item-t { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 650; line-height: 1.3; }
.r91l-item-t b { font-weight: 800; color: var(--text); }
.r91l-item.on .r91l-item-t b { color: var(--accent-2); }
.r91l-item-sub { display: flex; align-items: center; gap: 5px; font-size: 11.3px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.r91l-item .r091-badge { margin-left: auto; }
.r91l-tax { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.r91l-item.on .r91l-tax { color: var(--accent-2); }
.r91l-place, .r91l-act { align-items: flex-start; }
.r91l-place .r91l-radio, .r91l-act .r91l-radio { margin-top: 2px; }
.r91l-code { display: inline-flex; padding: 1px 6px; border-radius: 6px; background: #0e1526; color: #fff; font-size: 10.8px; font-weight: 800; letter-spacing: .2px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.r91l-code.primary { background: var(--accent); }
.r91l-act-name { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-weight: 600; font-size: 12px; line-height: 1.32; color: var(--text-2); }
.r91l-item.on .r91l-act-name { color: var(--accent-2); }
.r91l-rates { font-size: 11.3px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.r91l-item.on .r91l-rates { color: var(--accent-2); }

.r91l-info { display: flex; align-items: flex-start; gap: 8px; padding: 8px 9px; border-radius: 10px; background: #f6f8fc; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.r91l-info svg { color: var(--accent); flex: 0 0 auto; margin-top: 1px; }
.r91l-info b { font-weight: 800; color: var(--text); }
.r91l-info em { display: block; font-style: normal; font-size: 11.3px; color: var(--muted); margin-top: 2px; }

.r91l-sec-total { padding-top: 10px; }
.r91l-total { display: flex; align-items: center; gap: 10px; width: 100%; border: 1.5px dashed #cdd6ee; background: #f8faff; border-radius: 11px; padding: 9px 11px;
    font: inherit; text-align: left; cursor: pointer; color: var(--accent-2); transition: all .13s; }
.r91l-total:hover { border-style: solid; background: var(--accent-soft); }
.r91l-total.on { border: 1.5px solid var(--accent); background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(59, 100, 244, .25); }
.r91l-total span { display: flex; flex-direction: column; min-width: 0; }
.r91l-total b { font-size: 12.8px; font-weight: 750; }
.r91l-total em { font-style: normal; font-size: 11px; opacity: .8; margin-top: 1px; }

/* шапка квартала без переключателей: вид отчёта и «итог по клиенту» — метками */
.r91l-kind-tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; background: #f3edff; color: #6b3fc4; font-size: 11.5px; font-weight: 750; }
.r91l-view-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-2); font-size: 11.5px; font-weight: 750; }
.r91l-main .q-head { row-gap: 8px; }

/* «Всего по клиенту за квартал» над таблицами видов */
.sa91-sumbar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid #e1e7f6; background: linear-gradient(90deg, #f6f8ff, #fff 75%); flex-wrap: wrap; }
.sa91-sumbar-ico { width: 32px; height: 32px; border-radius: 10px; background: #fff; border: 1px solid #dfe6fb; display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex: 0 0 32px; }
.sa91-sumbar-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 260px; font-size: 12.5px; color: var(--muted); }
.sa91-sumbar-t > b { font-size: 13px; color: var(--text); font-weight: 750; }
.sa91-sumbar-t span b { color: var(--text); font-weight: 750; font-variant-numeric: tabular-nums; }
.sa91-sumbar .btn { margin-left: auto; }

/* все районы: блок на район — шапка района и таблицы его видов */
.sa91-dgroup { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid #dfe6fb; border-radius: 16px; background: linear-gradient(180deg, #f5f7ff, #fbfcfe 120px); }
.sa91-dg-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 2px 4px; }
.sa91-dg-h .spacer { margin-left: auto; }
.sa91-dg-code { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 36px; padding: 0 8px; border-radius: 11px; background: #fff; border: 1px solid #d5def9;
    color: var(--accent-2); font-size: 14px; font-weight: 800; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.sa91-dg-t { min-width: 0; }
.sa91-dg-name { font-size: 14px; font-weight: 750; color: var(--text); }
.sa91-dg-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* «Суммы собраны из документов»: текст делит строку со значком и переносится сам, кнопки — справа */
.r91l-main .r091-src > span:not(.r091-src-ico):not(.spacer) { flex: 1 1 280px; min-width: 0; }
.r91l-main .r091-src .spacer { display: none; }

/* таблицы справа плотнее: рядом панель фильтров */
.r91l-main table.grid.rev-legs td input { width: 112px; }
.r91l-main table.grid.sa91-t td input { width: 118px; }

/* Ноутбук и список организаций развёрнут: таблицам нужна ширина — панель складывается в полосу над ними */
@container r91l (max-width: 1060px) {
    .r91l-main table.grid.rev-legs th, .r91l-main table.grid.rev-legs td { padding-left: 9px; padding-right: 9px; }
    .r91l-main table.grid.rev-legs th:first-child, .r91l-main table.grid.rev-legs td:first-child { padding-left: 14px; }
    .r91l-main table.grid.rev-legs td input, .r91l-main table.grid.sa91-t td input { width: 100px; }
}
@container r91l (max-width: 920px) {
    .r91l-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .r91l-side { position: static; }
    .r91l-panel { display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 22px; row-gap: 4px; padding: 6px 12px 10px; max-height: none; overflow: visible; }
    .r91l-panel-h { display: none; }
    .r91l-sec, .r91l-panel-h + .r91l-sec { border-top: 0; padding: 6px 0 0; flex: 0 1 auto; min-width: 0; }
    .r91l-sec-period { display: flex; align-items: flex-end; gap: 10px; }
    .r91l-sec-period > .r91l-cap { display: none; }
    .r91l-sec-period .csel, .r91l-year { width: 96px !important; }
    .r91l-qs { grid-template-columns: repeat(4, 42px); }
    .r91l-list { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .r91l-item { width: auto; padding: 6px 10px; border: 1px solid var(--border-soft); background: #fbfcfe; }
    .r91l-item.on { border-color: #cfdaf9; background: var(--accent-soft); }
    .r91l-item-sub, .r91l-tax { display: none; }
    .r91l-act-name { display: none; }
    .r91l-act .r91l-item-t { gap: 5px; }
    .r91l-place .r91l-radio, .r91l-act .r91l-radio { margin-top: 0; }
    .r91l-place, .r91l-act { align-items: center; }
    .r91l-info { padding: 6px 10px; }
    .r91l-info em { display: none; }
    .r91l-sec-total { display: flex; align-items: flex-end; }
    .r91l-total { width: auto; padding: 7px 12px; }
    .r91l-total em { display: none; }
}

/* ═══ Справочник клиента (ТЗ 14.10.2026, handbook.js): тела строк «Кассы ККМ», «Банковские счета», «Покупатели (B2B)»,
   «Правила «не выручка»» в «Профиле» — строки и раскрытие рисует карточка, здесь — содержимое ═══ */
.hb-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hb-hint { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 10px; background: #f4f6fb; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.hb-hint svg { flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.hb-empty { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); font-size: 12.8px; }
.hb-empty svg { flex: 0 0 auto; color: var(--faint); }
.hb-empty .btn { margin-left: auto; }
.hb-scroll { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 12px; }
table.grid.hb-t { font-size: 12.8px; }
table.grid.hb-t th { padding: 8px 10px; white-space: nowrap; }
table.grid.hb-t td { padding: 8px 10px; vertical-align: middle; }
table.grid.hb-t th:first-child, table.grid.hb-t td:first-child { padding-left: 14px; }
table.grid.hb-t td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid.hb-t .cell-sub { font-size: 11.3px; }
table.grid.hb-t .mono, .hb-t .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: -.2px; }
table.grid.hb-t .csel-btn { min-height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 12.5px; }
.hb-name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-note { width: 100%; min-width: 120px; height: 32px; padding: 5px 9px; border: 1.5px solid var(--border); border-radius: 9px; font: inherit; font-size: 12.5px; background: #fff; }
.hb-note:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 100, 244, .13); }
.hb-def { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; background: #f3f5fa; color: var(--text-2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.hb-def svg { color: var(--accent); }
.hb-by { font-size: 10.8px; color: var(--faint); margin-top: 2px; }
.hb-tag { display: inline-flex; margin-top: 3px; padding: 1px 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok-deep); font-size: 10.5px; font-weight: 750; }
.hb-st { width: 34px; text-align: center; }
.hb-st span { display: inline-flex; }
.hb-ok { color: var(--ok); }
.hb-err { color: var(--err); }
.hb-saving { color: var(--muted); animation: hbspin 1s linear infinite; }
@keyframes hbspin { to { transform: rotate(360deg); } }
.hb-tools { display: flex; align-items: center; gap: 10px; }
.hb-search { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 10px; background: #fff; color: var(--muted); width: min(340px, 100%); }
.hb-search input { border: 0; outline: 0; padding: 7px 0; font: inherit; font-size: 13px; width: 100%; background: transparent; }
.hb-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px rgba(59, 100, 244, .13); }
.hb-kind { display: inline-flex; padding: 2px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 750; background: #f1f3f7; color: var(--text-2); white-space: nowrap; }
.hb-kind.k-keyword { background: #f3edff; color: #6b3fc4; }
.hb-kind.k-own_account { background: var(--accent-soft); color: var(--accent-2); }
.hb-kind.k-founder_inn { background: var(--ok-soft); color: var(--ok-deep); }
.hb-kind.k-lender_inn { background: var(--warn-soft); color: var(--warn-deep); }
.hb-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed #cfd8ee; border-radius: 12px; background: #fafbff; }
.hb-add input { flex: 1 1 180px; min-width: 0; height: 34px; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: 9px; font: inherit; font-size: 12.8px; background: #fff; }
.hb-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 100, 244, .13); }
.hb-add .csel-btn { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 12.8px; }
.hb-sugg { display: flex; flex-direction: column; gap: 7px; }
.hb-sugg-h { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.hb-sugg-h svg { color: #8b5cf6; }
.hb-sugg-list { display: flex; flex-wrap: wrap; gap: 6px; }
.hb-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px dashed #d8cdf5; background: #faf7ff; color: var(--text-2); border-radius: 9px; padding: 5px 10px;
    font: inherit; font-size: 12px; cursor: pointer; text-align: left; transition: all .12s; }
.hb-chip:hover { border-style: solid; background: #f3edff; color: #4b2a9a; }
.hb-chip svg { flex: 0 0 auto; color: #8b5cf6; }
.hb-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-global { border: 1px solid var(--border-soft); border-radius: 12px; background: #fff; }
.hb-global summary { display: flex; align-items: center; gap: 7px; padding: 10px 12px; cursor: pointer; font-size: 12.8px; font-weight: 700; color: var(--text-2); list-style: none; }
.hb-global summary::-webkit-details-marker { display: none; }
.hb-global summary svg { color: var(--ok-deep); }
.hb-global summary .muted { font-weight: 500; }
.hb-global-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; padding: 4px 14px 14px; }
.hb-global-t { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 5px; }
.hb-global-i { font-size: 12px; color: var(--text-2); padding: 3px 0; line-height: 1.35; }
.hb-global-i span { display: block; font-size: 11px; color: var(--muted); }
.hb-body .add-line { margin-top: -4px; }
.hb-body .warn, td .warn { color: var(--warn-deep); }
/* точки и словарь видов (ТЗ 26.10.2026 «Уточнёнки 091», 4.1 и 4.3) */
.hb-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.hb-tags .hb-tag { margin-top: 0; align-items: center; gap: 3px; background: #f1f3f7; color: var(--text-2); }
.hb-tags .hb-tag svg { flex: 0 0 auto; }
.hb-tags .hb-tag-main { background: var(--accent-soft); color: var(--accent-2); }
.hb-pt-add { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border: 1px dashed #cfd8ee; border-radius: 9px; background: #fafbff;
    color: var(--accent-2); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.hb-pt-add:hover { border-style: solid; background: var(--accent-soft); }
.hb-pt-form .form-grid input, .hb-pt-form .form-grid select { width: 100%; }
.hb-pt-sec { display: flex; align-items: center; gap: 6px; margin: 18px 0 8px; font-size: 12.8px; font-weight: 750; color: var(--text); }
.hb-pt-sec svg { color: var(--accent); }
.hb-pt-sec .muted { font-weight: 500; font-size: 12px; }
.hb-pt-acts, .hb-pt-binds { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; padding: 4px; border: 1px solid var(--border-soft); border-radius: 12px; }
.hb-pt-act, .hb-pt-bind { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 9px; font-size: 12.8px; color: var(--text-2); cursor: pointer; }
.hb-pt-act:hover, .hb-pt-bind:hover { background: #f6f8fc; }
.hb-pt-act input, .hb-pt-bind input { width: 16px; height: 16px; padding: 0; flex: 0 0 auto; accent-color: var(--accent); box-shadow: none; }
.hb-pt-act > span:nth-of-type(1) { flex: 1 1 auto; min-width: 0; }
.hb-pt-main { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hb-pt-bind span { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.hb-pt-bind svg { color: var(--muted); flex: 0 0 auto; }
.hb-pt-bind i { font-style: normal; font-size: 11.5px; color: var(--warn-deep); white-space: nowrap; }

/* невысокий экран (ноутбук 768 px): панель фильтров плотнее, чтобы помещалась без прокрутки */
@media (max-height: 820px) {
    .r91l-panel-h { padding: 10px 14px 8px; }
    .r91l-sec { padding: 8px 12px 9px; }
    .r91l-item { padding: 5px 8px; }
    .r91l-sec-period .r91l-cap:not(:first-child) { margin-top: 9px; }
    .r91l-total { padding: 7px 10px; }
}
