/* Раздел «Учёт» и общий вид в духе Контур.Эврики (серо-голубая оболочка, белые панели, вкладки с подчёркиванием, таблицы без сетки),
   но в тёмно-синей гамме: основной цвет — var(--primary), боковое меню — var(--side). */

/* Вкладки раздела: 16/600, подчёркивание 2px основным цветом */
.acc-tabs { display: flex; flex-wrap: wrap; gap: 0 26px; border-bottom: 1px solid var(--line); margin: -6px 0 20px; overflow: visible; }
.acc-tabs a { padding: 10px 2px 11px; font-size: 15px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.acc-tabs a:hover { color: var(--ink); text-decoration: none; }
.acc-tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }

/* Пилюли-фильтры второго уровня */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 13px; border-radius: 999px; background: #e8edf6; color: var(--ink); font-size: 13.5px; font-weight: 500; border: 0; cursor: pointer; }
.chip:hover { background: #dbe4f3; text-decoration: none; }
.chip.on { background: var(--primary); color: #fff; }

/* Таблицы: без вертикальных линий, шапка 12px приглушённая, подсветка строки при наведении */
table.list th, table.acc-table th { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.list td, table.acc-table td { padding: 10px 14px; border-bottom: 1px solid #eef1f7; vertical-align: top; }
table.list tbody tr:hover td, table.acc-table tbody tr:hover td { background: #f3f6fb; }
table.list tfoot td, table.acc-table tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); background: #f6f8fc; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }
td.wrap { max-width: 560px; }
.num-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: #c50220; }

/* Загрузка файлов */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 26px 18px; text-align: center; color: var(--ink-2); background: var(--surface-2); cursor: pointer; transition: background .12s, border-color .12s; }
.dropzone.drag, .dropzone:focus-visible { border-color: var(--primary); background: var(--primary-50); outline: none; }
.dropzone .link { color: var(--primary); text-decoration: underline; cursor: pointer; }
.acc-result { margin-top: 12px; font-size: 13px; }
.acc-result .ok-line { color: #0d7346; }
.acc-result .bad-line { color: #b3261e; }
.acc-result table { margin-top: 8px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; margin: 10px 0; }
.map-grid label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.map-grid select { height: 32px; }

/* Панель фильтров и полей */
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); font-weight: 500; }
.filters label.check { flex-direction: row; align-items: center; align-self: flex-end; padding-bottom: 8px; }
.filters input[type=date], .filters input[type=search], .filters input[type=text], .filters select { height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13px; background: #fff; color: var(--ink); }
.filters { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; align-items: flex-end; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0 8px; }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.stat.compact.bulk { display: flex; flex-direction: column; gap: 6px; min-width: 320px; }
.stat.compact.bulk select, .stat.compact.bulk input[type=text] { height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 12.5px; }
.stat.stat-warn .num { color: #b7791f; }
.stat.stat-bad .num { color: #c50220; }
.cat-select { height: 30px; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; font: inherit; font-size: 12.5px; max-width: 320px; background: #fff; }
.cat-select.saved { border-color: #2f9e6a; box-shadow: 0 0 0 2px rgba(47, 158, 106, .18); }
.row-review td { background: #fffaf0; }

/* Книги: шапка отчёта и «плитки» расчёта налога */
.book-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile .t-title { font-size: 12px; color: var(--muted); }
.tile .t-num { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.dark { background: var(--primary); border-color: var(--primary); color: #fff; }
.tile.dark .t-title, .tile.dark .t-sub { color: #c5d3f0; }
.warn-list { background: #fff8e6; border: 1px solid #f2dda6; border-radius: 10px; padding: 10px 14px 10px 30px; margin: 0 0 14px; font-size: 13px; color: #7a520f; }
.warn-list li { margin: 3px 0; }
.book-table { font-size: 12.5px; }
.book-table th { text-align: center !important; white-space: normal !important; }
.book-table td.num-r { text-align: right; }
.doc-lines input, .doc-lines select { height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; width: 100%; }
.doc-lines td { padding: 6px 6px; }

.notice.bad { background: #fdeaea; border-color: #f3c0c0; color: #9c1f1f; }
.tile.dark.bad { background: #9c1f1f; border-color: #9c1f1f; }
.err-list { margin: 0; padding-left: 20px; color: #7a1a1a; }
.err-list li { margin: 8px 0; line-height: 1.45; }
.plain-list { margin: 0; padding-left: 20px; color: var(--ink-2); }
.plain-list li { margin: 4px 0; }
.kpp-forms { margin-top: 6px; }

/* Выбор покупателя и договора в документах */
.cp-picker { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cp-search { position: relative; flex: 1 1 360px; min-width: 240px; }
.cp-search input, .cp-picker select { width: 100%; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 13.5px; background: #fff; }
.cp-picker select { width: auto; min-width: 320px; max-width: 100%; flex: 1 1 320px; }
.cp-search .search-results { width: 100%; }
.cp-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
.cp-card-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cp-fields { margin-top: 10px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #fbfcff; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 8px; }
.cp-grid .field.wide { grid-column: 1 / -1; }
.cp-grid label, .cp-fields label { font-size: 12px; color: var(--muted); font-weight: 500; }
.cp-grid input { width: 100%; height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13.5px; }
.inn-row { display: flex; gap: 8px; }
.inn-row input { flex: 1; min-width: 0; }

/* Строка сводных карточек: карточки не растягиваются по высоте самой высокой (панель массовой правки живёт отдельной карточкой справа) */
.stat-row { align-items: flex-start; }
.stat-row .stat.compact { flex: 0 0 auto; min-width: 150px; }
.stat.compact.bulk { flex: 1 1 380px; align-self: stretch; }
.filters select[name=cat] { width: 250px; max-width: 100%; }
.filters input[type=search], .filters input[name=q] { min-width: 220px; }
.dropzone b { font-weight: 600; }
.dropzone .link { display: inline; }
@media (max-width: 900px) { .stat-row .stat.compact { flex: 1 1 150px; } .acc-tabs { gap: 18px; } .cp-picker select { min-width: 0; } }

/* Справка */
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.help-toc { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-height: calc(100vh - 40px); overflow-y: auto; }
.help-toc b { margin-bottom: 6px; color: var(--muted); font-weight: 600; font-size: 12px; }
.help-toc a { padding: 5px 8px; border-radius: 6px; color: var(--ink-2); }
.help-toc a:hover { background: var(--primary-50); text-decoration: none; color: var(--primary); }
.help-body { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 26px 32px; line-height: 1.6; font-size: 14.5px; max-width: 980px; }
.help-body h1 { display: none; }
.help-body h2 { font-size: 20px; margin: 30px 0 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.help-body h2:first-of-type { border-top: 0; margin-top: 0; }
.help-body h3 { font-size: 16px; margin: 20px 0 6px; }
.help-body p { margin: 8px 0; }
.help-body ul, .help-body ol { margin: 8px 0 8px 22px; padding: 0; }
.help-body li { margin: 4px 0; }
.help-body code { background: #eef1f7; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.help-body pre { background: #0f2247; color: #dce6fa; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; }
.help-body blockquote { margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--primary-50); border-radius: 0 8px 8px 0; }
.help-body .md-table { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; }
.help-body .md-table table th, .help-body .md-table table td { white-space: normal; }
@media (max-width: 1100px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; } }

/* КУДиР по форме приказа: страница просмотра */
.kf-title { margin: 0 0 12px; font-size: 18px; }
.kf-h { margin: 0 0 10px; font-size: 15px; }
.kf-sec { margin: 22px 0 10px; }
.kf-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 22px; margin: 0; }
.kf-facts dt { font-size: 12px; color: var(--muted); }
.kf-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.kf-note { margin: 10px 0 0; }
.kf-src td, .kf-src th { white-space: normal; }
.kf-src { min-width: 0; width: 100%; table-layout: auto; }
#kudir-sources { overflow-x: auto; }
.kf-quarter { margin-bottom: 16px; overflow-x: auto; }
.kf-table { min-width: 760px; table-layout: fixed; width: 100%; }
.kf-table thead th { white-space: normal; font-weight: 500; vertical-align: middle; }
.kf-table .kf-nums th { padding: 3px 8px; font-size: 11px; color: var(--muted); }
.kf-table td.kf-c { text-align: center; width: 54px; }
.kf-table td { vertical-align: top; overflow-wrap: anywhere; padding: 8px 12px; }
.kf-table td.num-r, .kf-table th.kf-money { text-align: right !important; }
.kf-table tfoot td { font-size: 13px; }
.kf-ref { width: 100%; border-collapse: collapse; font-size: 13px; }
.kf-ref td { padding: 6px 8px; border-bottom: 1px solid #eef1f7; vertical-align: top; }
.kf-ref td.kf-code { width: 52px; color: var(--muted); }
.kf-ref td.num-r { width: 150px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kf-rest { margin: 0 0 8px; padding-left: 20px; font-size: 13px; }
.kf-rest li { margin: 6px 0; }

/* Книга продаж по форме приложения № 5 */
.law-sheet { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 20px; margin-bottom: 20px; font-family: "Times New Roman", Times, serif; color: #111; }
.law-appendix { text-align: right; font-size: 11px; color: #444; white-space: pre-line; line-height: 1.3; }
.law-title1 { text-align: center; font-size: 15px; margin-top: 10px; }
.law-title { text-align: center; font-size: 20px; font-weight: 700; margin: 2px 0 12px; letter-spacing: .04em; }
.law-facts { margin: 0 0 12px; font-size: 13px; }
.law-facts > div { display: flex; gap: 10px; margin: 2px 0; flex-wrap: wrap; }
.law-facts dt { color: #333; }
.law-facts dd { margin: 0; font-weight: 700; }
.law-scroll { overflow-x: auto; max-width: 100%; }
.law-table { border-collapse: collapse; table-layout: fixed; font-size: 11px; width: 100%; }
.law-table th, .law-table td { border: 1px solid #222; padding: 3px 4px; vertical-align: middle; overflow-wrap: anywhere; }
.law-table th { font-weight: 400; text-align: center; font-size: 10px; line-height: 1.2; background: #fff; text-transform: none; letter-spacing: 0; white-space: normal; color: #111; }
.law-table thead tr:first-child th { height: 118px; }
.law-table thead tr:nth-child(2) th { height: 56px; }
.law-table th.vt { padding: 2px 0; }
.law-table th.vt > div { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 108px; overflow: hidden; text-overflow: ellipsis; margin: 0 auto; }
.law-table th.vt.sub > div { max-height: 50px; }
.law-table th.grp { height: auto; }
.law-table thead tr:first-child th.grp { height: 118px; }
.law-table th.law-nums, .law-table tr.law-nums th { font-size: 10px; padding: 1px; }
.law-table td.c { text-align: center; }
.law-table td.m { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 2px; padding-right: 4px; }
.law-table tfoot td { font-weight: 700; }
.law-table tfoot td.law-all { text-align: right; }
.law-table tbody tr:hover td { background: #f6f8fc; }
.law-sign { margin-top: 22px; font-size: 13px; }
.law-sign > div { margin: 8px 0; }
.law-line { display: inline-block; width: 170px; border-bottom: 1px solid #222; margin: 0 14px; }
.law-cap { display: flex; gap: 190px; font-size: 10px; color: #555; padding-left: 420px; }

/* Налоги за год: УСН и НДС отдельно */
.tax-grid { align-items: start; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 16px; }
.tax-card { min-width: 0; overflow-x: auto; }
.tax-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: #fff; }
.tax-card.usn { background: var(--primary); border-color: var(--primary); color: #fff; }
.tax-kind { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tax-card.usn .tax-kind { color: #c5d3f0; }
.tax-num { font-size: 30px; font-weight: 700; letter-spacing: -.01em; margin: 6px 0 8px; font-variant-numeric: tabular-nums; }
.tax-line { font-size: 13px; margin: 4px 0; color: var(--muted); }
.tax-card.usn .tax-line { color: #dbe5fa; }
.tax-card .tax-line b { color: inherit; }
.tax-card.vat .tax-line { margin-bottom: 10px; }
.tax-warn { margin-top: 8px; font-size: 12.5px; background: #fff3cd; color: #7a520f; padding: 6px 10px; border-radius: 8px; }
.tax-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tax-table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tax-table td { padding: 8px; border-bottom: 1px solid #eef1f7; }
.tax-table .num-r { text-align: right; font-variant-numeric: tabular-nums; }
.tax-table tr.on td { background: #f3f6fb; }
.ok-text { color: #1b7f4b; font-weight: 600; }
.bad-text { color: #b3261e; font-weight: 600; }

/* ===== Документы: список ===== */
.doc-create { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 16px; }
.doc-create-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.doc-create-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(20, 45, 110, .12); transform: translateY(-1px); text-decoration: none; }
.doc-create-card.main { background: var(--primary); border-color: var(--primary); color: #fff; }
.doc-create-card .dc-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #eaf0fc; color: var(--primary); font-weight: 700; font-size: 17px; }
.doc-create-card.main .dc-ico { background: rgba(255, 255, 255, .18); color: #fff; }
.doc-create-card .dc-txt { display: flex; flex-direction: column; min-width: 0; }
.doc-create-card .dc-txt b { font-size: 14px; }
.doc-create-card .dc-txt small { font-size: 12px; color: var(--muted); }
.doc-create-card.main .dc-txt small { color: #c5d3f0; }
.doc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; border-left: 4px solid #c9d5ee; }
.kpi.ok { border-left-color: #2e9e6b; } .kpi.wait { border-left-color: #e2a73b; } .kpi.bad { border-left-color: #d64545; background: #fff6f6; }
.kpi .k-title { font-size: 12px; color: var(--muted); }
.kpi .k-num { font-size: 21px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.doc-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.doc-filters .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip .cnt { margin-left: 6px; font-size: 11px; opacity: .7; }
.chip.warn:not(.on) { color: #b3261e; }
.filters.compact { border: 0; padding: 0; margin: 0; background: none; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters.compact .grow { flex: 1 1 260px; }
.filters.compact .grow input { width: 100%; }
.btn.link { background: none; border: 0; color: var(--primary); padding: 8px 6px; }
.docs-table td { vertical-align: top; }
.docs-table tr.is-overdue td { background: #fff8f8; }
.th-sort { color: inherit; text-decoration: none; white-space: nowrap; }
.th-sort:hover { color: var(--ink); text-decoration: none; }
.doc-cell .doc-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.doc-cell .doc-link:hover b { color: var(--primary); }
.ti { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #eaf0fc; color: var(--primary); font-size: 12px; font-weight: 700; flex: none; }
.ti-torg12 { background: #e8f5ee; color: #1b7f4b; } .ti-act { background: #fdf3df; color: #9a6a10; } .ti-upd { background: #efe9fb; color: #5d3fb0; } .ti-sf { background: #fde9ea; color: #b3261e; } .ti-quote { background: #e6f1fb; color: #1a5fa8; }
.chain-mini { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 0 32px; }
.chain-mini .cm { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #f0f3fa; color: #46567a; text-decoration: none; }
.chain-mini .cm:hover { background: #e2e9f8; text-decoration: none; }
.chain-mini .cm.paid { background: #e3f4ea; color: #1b7f4b; }
.c-act { text-align: right; }
.inline-form { display: inline; margin: 0; }
.act-link { background: none; border: 0; padding: 2px 6px; font: inherit; font-size: 12px; color: var(--primary); cursor: pointer; text-decoration: none; border-radius: 6px; }
.act-link:hover { background: #eef2fb; text-decoration: none; }
.act-link.ok { color: #1b7f4b; }
.badge.bad { background: #fde2e2; color: #b3261e; }
.docs-table tfoot td { font-weight: 700; background: #f6f8fc; border-top: 1px solid var(--line-strong); }

/* ===== Документы: форма ===== */
.doc-head { margin-bottom: 12px; }
.doc-head h2 { margin: 2px 0 0; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.doc-card { margin-bottom: 16px; }
.doc-card-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.doc-card-title .small { font-weight: 400; margin-left: auto; }
.doc-card-title .step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; }
.doc-row { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; }
.doc-row { align-items: flex-start; }
.doc-row .field { margin-bottom: 0; }
.doc-row .w-due { width: 300px; } .doc-row .w-due .chip-row { margin-top: 7px; }
.doc-row .w-num { width: 120px; } .doc-row .w-date { width: 160px; } .doc-row .w-bank { flex: 1 1 260px; min-width: 220px; }
.doc-row .field select, .doc-row .field input { width: 100%; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink); }
.mini:hover { border-color: var(--primary); color: var(--primary); }
.doc-card .field { margin-bottom: 12px; }
.lines-wrap { overflow-x: auto; }
.doc-lines { width: 100%; border-collapse: collapse; min-width: 760px; }
.doc-lines th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.doc-lines td { padding: 6px 4px; vertical-align: top; }
.doc-lines .c-name { width: 34%; } .doc-lines .c-art { width: 11%; } .doc-lines .c-unit { width: 96px; } .doc-lines .c-qty { width: 80px; } .doc-lines .c-price { width: 108px; } .doc-lines .c-vat { width: 116px; } .doc-lines .c-sum { width: 120px; white-space: nowrap; } .doc-lines .c-del { width: 62px; white-space: nowrap; }
.doc-lines input, .doc-lines select { width: 100%; }
.doc-lines .c-sum { text-align: right; padding-top: 12px; }
.doc-lines .c-sum small { display: block; font-size: 11px; }
.line-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 26px; height: 30px; cursor: pointer; color: var(--muted); font-size: 14px; margin-left: 2px; }
.line-btn:hover { color: var(--ink); border-color: var(--primary); }
.lines-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.doc-side { position: sticky; top: 14px; }
.doc-sum { padding: 16px; }
.sum-list { margin: 8px 0 4px; }
.sum-list > div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eef1f7; font-size: 14px; }
.sum-list dt { color: var(--muted); } .sum-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.sum-list .grand { border-bottom: 0; font-size: 18px; font-weight: 700; padding-top: 10px; } .sum-list .grand dt { color: var(--ink); }
.sum-words { font-size: 12px; color: var(--muted); min-height: 32px; margin-bottom: 10px; }
.doc-actions { display: flex; flex-direction: column; gap: 8px; }
.doc-actions .btn { width: 100%; justify-content: center; text-align: center; }
.btn.primary-lg { padding: 12px 16px; font-size: 15px; }
.derive-menu summary { list-style: none; cursor: pointer; }
.derive-menu summary::-webkit-details-marker { display: none; }
.derive-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; }
.derive-list button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); }
.derive-list button:hover { background: #eaf0fc; }
.kbd-hint { margin-top: 10px; text-align: center; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; background: #fff; }
.nom-pop { position: absolute; z-index: 60; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 28px rgba(20, 35, 80, .18); padding: 4px; max-width: 560px; }
.nom-item { display: flex; justify-content: space-between; gap: 14px; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.nom-item:hover, .nom-item.on { background: #eaf0fc; }
.nom-meta { color: var(--muted); white-space: nowrap; font-size: 12px; }
@media (max-width: 1300px) { .doc-layout { grid-template-columns: 1fr; } .doc-side { position: static; } .doc-sum { max-width: 420px; margin-left: auto; } }
@media (max-width: 1000px) { .doc-lines .c-art { display: none; } .doc-lines { min-width: 0; } .doc-lines .c-name { width: auto; } }

/* ===== Документы: просмотр ===== */
.doc-head.view { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc-head.view .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.doc-head.view .subtitle { margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stepper { display: flex; align-items: center; gap: 0; margin: 4px 0 18px; max-width: 560px; }
.step-item { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #e6ebf6; color: #6a7ba0; font-size: 12px; font-weight: 700; }
.step-item.done .step-dot { background: #2e9e6b; color: #fff; } .step-item.now .step-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(37, 68, 140, .15); }
.step-item.now { color: var(--ink); font-weight: 700; }
.step-line { flex: 1; height: 2px; background: #dfe6f3; margin: 0 10px; min-width: 24px; } .step-line.done { background: #2e9e6b; }
.doc-view-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); gap: 18px; align-items: start; }
.doc-view-main .card { margin-bottom: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 20px; margin: 0; }
.info-grid dt { font-size: 12px; color: var(--muted); } .info-grid dd { margin: 2px 0 0; font-weight: 600; } .info-grid dd small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.pay-card.paid { border-color: #bfe3cf; background: #f5fbf8; }
.pay-done { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; } .pay-done > div { flex: 1; min-width: 200px; }
.pay-check { width: 34px; height: 34px; border-radius: 50%; background: #2e9e6b; color: #fff; display: grid; place-items: center; font-size: 18px; }
.cand-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cand { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.cand-tags { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #eef1f7; color: #46567a; } .tag.ok { background: #e3f4ea; color: #1b7f4b; }
.chain { display: flex; flex-direction: column; gap: 6px; }
.chain-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; background: #fff; }
.chain-item:hover { border-color: var(--primary); text-decoration: none; }
.chain-item.now { border-color: var(--primary); background: #f2f6ff; }
.chain-item .ch-name { flex: 1; } .chain-item .ch-sum { font-variant-numeric: tabular-nums; }
.derive-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.words-line { padding: 10px 14px 14px; font-size: 13px; color: var(--muted); font-style: italic; }
.doc-preview { position: sticky; top: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preview-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--line); }
.preview-head a { font-weight: 400; font-size: 12px; }
.preview-frame { width: 100%; height: 78vh; min-height: 520px; border: 0; background: #f0f2f7; }
@media (max-width: 1100px) { .doc-view-grid { grid-template-columns: 1fr; } .doc-preview { position: static; } }

@media (max-width: 1300px) { .law-table { font-size: 10px; } .law-table td.m { font-size: 9.5px; padding-left: 1px; padding-right: 3px; } .law-table td, .law-table th { padding-left: 2px; padding-right: 2px; } }

/* Книги по кварталам */
.qsum { margin-bottom: 16px; }
.qsum-table td, .qsum-table th { padding: 8px 12px; }
.qsum-table tr.on td { background: #f2f6ff; }
.qsum-table tr.qsum-year td { border-bottom: 2px solid var(--line-strong); font-weight: 600; }
.qsum-act { text-align: right; white-space: nowrap; font-size: 12.5px; }

.tax-card.vat { grid-column: 1 / -1; }
.tax-table th { white-space: normal; line-height: 1.2; }
.tax-table td, .tax-table th { padding-left: 6px; padding-right: 6px; }
.tax-card.usn { max-width: 720px; }

/* Справочник договоров: колонки фиксированной доли ширины, длинные названия переносятся внутри своей ячейки (06.10.2026 — «текст поплыл») */
table.list.cat-contracts { table-layout: fixed; width: 100%; }
table.list.cat-contracts td, table.list.cat-contracts th { overflow-wrap: anywhere; word-break: normal; }
table.list.cat-contracts td.num-cell { white-space: normal; }
table.list.cat-contracts td:last-child { white-space: nowrap; }
.filters label.grow { flex: 1 1 280px; }
.org-search-results .result-item.active { background: var(--info-bg, #eef4ff); }
/* поле поиска контрагента внутри подписи-колонки: flex-basis 360px иначе становится высотой и раздвигает форму */
.filters label > .cp-search { flex: none; }

/* разноска: строка «Не разнесено / Разнести автоматически» над списком операций */
.acc-auto { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card, #fff); }
.acc-auto .muted.small { flex: 1 1 320px; }

/* ===== Документы: компактный список (09.11.2026) ===== */
.dl-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.dl-create { display: flex; flex-wrap: wrap; gap: 6px; }
.dl-new { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 7px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.dl-new:hover { border-color: var(--primary); text-decoration: none; }
.dl-new.main { background: var(--primary); border-color: var(--primary); color: #fff; }
.dl-new.main .ti { background: rgba(255, 255, 255, .2); color: #fff; }
.dl-new .ti { width: 22px; height: 22px; }
.dl-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dl-stats .st { flex: 1 1 150px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 8px; padding: 7px 12px; background: #fff; border: 1px solid var(--line); border-left: 4px solid #c9d5ee; border-radius: 10px; color: var(--ink); text-decoration: none; }
.dl-stats .st .st-t { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }
.dl-stats .st b { font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl-stats .st small { font-size: 11.5px; color: var(--muted); }
.dl-stats a.st:hover { border-color: var(--primary); text-decoration: none; }
.dl-stats .st.ok { border-left-color: #2e9e6b; } .dl-stats .st.wait { border-left-color: #e2a73b; } .dl-stats .st.bad { border-left-color: #d64545; background: #fff6f6; } .dl-stats .st.draft { border-left-color: #9aa6bf; flex: 0 1 110px; }
.dl-stats .st.on { box-shadow: 0 0 0 2px var(--primary) inset; }
.dl-stats .st.plain { background: #fafbfd; }
.dl-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.dl-filter select, .dl-filter input[type=search] { height: 32px; padding: 4px 8px; font-size: 13.5px; }
.dl-filter .grow { flex: 1 1 220px; min-width: 180px; }
.dl-filter .period { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dl-filter .p-arrow { display: inline-grid; place-items: center; width: 28px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 18px; text-decoration: none; }
.dl-filter .p-arrow:hover { border-color: var(--primary); text-decoration: none; }
.dl-filter .months { display: flex; flex-wrap: wrap; gap: 2px; margin-left: 4px; background: #f1f4fa; border-radius: 9px; padding: 2px; }
.dl-filter .months .m { padding: 5px 7px; border-radius: 7px; font-size: 12.5px; color: #46567a; text-decoration: none; }
.dl-filter .months .m:hover { background: #e2e9f8; text-decoration: none; }
.dl-filter .months .m.on { background: var(--primary); color: #fff; }
.docs-table th, .docs-table td { padding-top: 7px; padding-bottom: 7px; }
.docs-table .c-chk { width: 30px; padding-left: 10px; padding-right: 0; cursor: pointer; }
.docs-table .c-chk input { width: 16px; height: 16px; cursor: pointer; }
.docs-table tr.is-sel td { background: #eef4ff !important; }
.docs-table tbody tr[data-href] { cursor: pointer; }
.docs-table tbody tr[data-href]:hover td { background: #f7f9fd; }
.docs-table .what { margin: 2px 0 0 32px; font-size: 12px; color: #46567a; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-table .cp-link { font-weight: 500; }
.notice.ok { background: #e7f6ee; border-color: #b9e2cb; color: #17663d; }
.bulk-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 14px; background: #1f2a44; color: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .28); max-width: calc(100vw - 32px); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .bb-grp { display: inline-flex; align-items: center; gap: 6px; }
.bulk-bar label { color: #c9d3ea; display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.bulk-bar input[type=date] { height: 28px; padding: 2px 6px; font-size: 13px; }
.bulk-bar .btn.secondary { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .25); }
.bulk-bar .btn.link { color: #c9d3ea; }
.bulk-bar .btn:disabled { opacity: .45; cursor: default; }
body.has-bulk { padding-bottom: 70px; }
.match-card { margin-bottom: 12px; border: 1px solid #b9cdf3; }
.match-card .mc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.match-card .mc-head .btn.link { margin-left: auto; }
.match-card .clip { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-card .mc-foot { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.compact-list td, .compact-list th { padding: 6px 8px; }

/* ===== Документы: форма плотнее (09.11.2026) ===== */
.doc-layout { grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; }
.doc-card { margin-bottom: 10px; padding-top: 12px; padding-bottom: 12px; }
.doc-card-title { margin-bottom: 8px; flex-wrap: wrap; }
.doc-card .field { margin-bottom: 8px; }
.hint-line { margin-top: 3px; }
.period-box { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 400; font-size: 13px; }
.period-box .pb-lbl { color: var(--muted); margin-right: 2px; }
.period-box select { height: 28px; padding: 2px 6px; font-size: 13px; }
.period-box input[type=number] { width: 70px; height: 28px; padding: 2px 6px; font-size: 13px; }
.period-box .pb-none { display: none; }
.period-box.none select, .period-box.none input, .period-box.none button, .period-box.none .pb-lbl { display: none; }
.period-box.none .pb-none { display: inline; }
.last-note { margin: -2px 0 8px; padding: 6px 10px; background: #eef4ff; border-radius: 8px; font-size: 13px; color: #2b3f6b; }
.last-note[hidden] { display: none; }
.cp-search .search-results .r-head { padding: 6px 12px 2px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cp-search .search-results .r-mine { font-size: 11.5px; color: #1b7f4b; background: #e7f6ee; border-radius: 6px; padding: 0 6px; margin-left: 4px; }
.cp-search .search-results .result-item.active { background: #eef4ff; }
.nom-item .nom-hist { font-size: 11px; color: #1b7f4b; background: #e7f6ee; border-radius: 6px; padding: 0 5px; margin-left: 4px; }
@media (max-width: 1300px) { .doc-layout { grid-template-columns: minmax(0, 1fr) 270px; } .doc-side { position: sticky; } }
@media (max-width: 1000px) { .doc-layout { grid-template-columns: 1fr; } .doc-side { position: static; } }
@media (max-width: 700px) { .dl-filter .months { margin-left: 0; } .bulk-bar { left: 8px; right: 8px; transform: none; max-width: none; } }

/* «Тарифы» в форме документа: свои услуги ИП в одно касание */
.tariff-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.tariff-chips .tc-label { font-size: 12px; color: var(--muted, #667); margin-right: 2px; }
.tc-chip { border: 1px solid var(--line-strong, #c9d3e6); background: #f5f8fe; border-radius: 16px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: inherit; max-width: 100%; text-align: left; }
.tc-chip b { font-weight: 600; color: #1b5fc1; margin-left: 3px; white-space: nowrap; }
.tc-chip:hover { background: #e4edfc; border-color: #9bb5e6; }
