* { box-sizing: border-box; }
:root {
  --header-h: 54px;
}
body {
  margin: 0;
  font: 14px/1.45 system-ui, "Segoe UI", Roboto, sans-serif;
  color: #1f2733;
  background: #f4f6f9;
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 16px;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 22px;
  background: #1f2b45;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.22);
}
header h1 { font-size: 18px; margin: 0; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.count { color: #b9c4dc; font-size: 13px; }

.nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 0; }
.nav a {
  color: #b9c4dc; text-decoration: none; padding: 6px 14px; border-radius: 7px; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: #2f6df0; color: #fff; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid #e3e8ef;
}
.filters input, .filters select {
  padding: 7px 10px;
  border: 1px solid #cfd6e0;
  border-radius: 7px;
  font: inherit;
}
.filters input[type="search"] { min-width: 260px; }
.filters label { display: inline-flex; align-items: center; gap: 6px; color: #55627a; }

.btn {
  padding: 7px 14px;
  border: 0;
  border-radius: 7px;
  background: #2f6df0;
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.btn:hover { background: #2559c9; }
.btn-ghost { background: #eef1f6; color: #38445c; }
.btn-ghost:hover { background: #e2e7f0; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: #fff;
  border-bottom: 1px solid #e3e8ef;
}
.sel-info { color: #7a8299; font-size: 13px; }

.import-result {
  margin: 14px 22px 0;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
}
.import-result .ir-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.import-result .ir-head span:last-child { display: flex; gap: 8px; }
.import-result .nf { color: #c1620d; font-size: 13px; }
.import-result .ok { color: #1c8a48; font-size: 13px; }
.import-result .btn-sm { padding: 4px 10px; font-size: 12px; }

.col-chk { width: 34px; text-align: center; }
.col-chk input { cursor: pointer; }

/* Банк: сопоставленные / красные */
tr.tx-red { background: #fde6e6; }
tr.tx-red:hover { background: #fbd8d8; }
tr.tx-matched { background: #eaf7ef; }
tr.tx-matched:hover { background: #ddf0e5; }

/* Кэшфлоу */
.filters .chk { display: inline-flex; align-items: center; gap: 6px; color: #55627a; }
td.num.neg { color: #c0392b; }
td.num.pos { color: #1c8a48; }
td.acct { white-space: nowrap; color: #55627a; }
.cf-table { table-layout: fixed; width: 100%; overflow: visible; }
.cf-table th:nth-child(1), .cf-table td:nth-child(1) { width: 64px; }
.cf-table th:nth-child(2), .cf-table td:nth-child(2) { width: 78px; }
.cf-table th:nth-child(3), .cf-table td:nth-child(3) { width: 108px; }
.cf-table th:nth-child(4), .cf-table td.counterparty { width: 13%; min-width: 130px; }
.cf-table th:nth-child(5), .cf-table td.note-bank { width: 28%; min-width: 260px; }
.cf-table th:nth-child(6), .cf-table td.pr-purpose { width: 14%; }
.cf-table th:nth-child(7), .cf-table td:nth-child(7) { width: 100px; }
.cf-table th:nth-child(8), .cf-table td:nth-child(8) { width: 84px; }
.cf-table th:nth-child(9), .cf-table td.acct-month-cell { width: 96px; }
.cf-table th:nth-child(10), .cf-table td.cat-cell { width: 15%; min-width: 170px; }
.cf-table select.acct-month-sel { width: 100%; font: inherit; font-size: 12px; padding: 2px 4px; border: 1px solid #cfd6e0; border-radius: 4px; background: #fff; }
.cf-table select.acct-month-sel:focus { border-color: #6b9fd4; outline: none; }
.cf-table .acct-month-readonly { color: #8896aa; font-size: 12px; }
tr.split-child { background: #f3f8ff; }
tr.split-parent { background: #f8fafc; cursor: pointer; }
tr.split-parent:hover { background: #eef4fc; }
.split-indent { color: #7a8aa0; }
.split-parts-label { color: #55627a; font-size: 12px; white-space: nowrap; }
.split-toggle { font-weight: 700; min-width: 28px; }
.cf-tabs { display: flex; gap: 4px; padding: 10px 20px 0; }
.cf-tab { padding: 8px 16px; border: 1px solid #cfd6e0; border-bottom: none; border-radius: 8px 8px 0 0; background: #f5f8fc; color: #55627a; cursor: pointer; font: inherit; }
.cf-tab.active { background: #fff; color: #1a2233; font-weight: 600; border-color: #b8c4d8; }
.cf-summary-wrap { padding: 0 20px 24px; }
.cf-summary-scroll { overflow: auto; max-width: 100%; border: 1px solid #eef1f5; border-radius: 8px; background: #fff; }
.cf-summary { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.cf-summary th, .cf-summary td { padding: 4px 8px; border-bottom: 1px solid #eef1f5; }
.cf-summary th.num, .cf-summary td.num { text-align: right; white-space: nowrap; }
.cf-summary td.lbl { min-width: 220px; max-width: 360px; }
.cf-summary tr.row-section td { background: #f0f4fa; font-weight: 600; color: #3d4d66; }
.cf-summary tr.row-sub td { background: #fafcff; font-weight: 600; }
.cf-summary tr.row-open td, .cf-summary tr.row-close td { background: #fff8e6; font-weight: 600; }
.cf-summary tr.row-bank td { background: #f8fafc; color: #64748b; font-size: 12px; }
.cf-summary tr.row-net td { background: #eaf7ef; font-weight: 600; }
.cf-summary tr.row-transfer td { background: #f3f0ff; font-weight: 600; }
.cf-summary-title { font-size: 18px; font-weight: 600; margin: 12px 0 4px; }
.cf-opening { margin: 0 0 12px; font-size: 14px; }
.cf-summary-note { margin-top: 8px; }
.cf-amt-in { color: #1a2233; }
.cf-amt-out { color: #c62828; }
.cf-amt-balance { color: #1a2233; font-weight: 600; }
.cf-amt-drill { cursor: pointer; text-decoration: underline dotted #b8c4d8; text-underline-offset: 2px; }
.cf-amt-drill:hover { background: #f0f6ff; }
.cf-drill-pop {
  position: fixed; z-index: 10050; min-width: 320px; max-width: 480px; max-height: 360px;
  overflow: auto; background: #fff; border: 1px solid #cfd6e0; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20,35,60,.16); padding: 10px 12px 10px; font-size: 12px;
}
.cf-drill-close {
  position: absolute; top: 6px; right: 8px; border: none; background: none;
  font-size: 20px; line-height: 1; color: #64748b; cursor: pointer; padding: 0 4px;
}
.cf-drill-close:hover { color: #1a2233; }
.cf-drill-head { font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.cf-drill-foot { margin-top: 6px; font-size: 11px; }
.cf-drill-table { width: 100%; border-collapse: collapse; }
.cf-drill-table th, .cf-drill-table td { padding: 3px 6px; border-bottom: 1px solid #eef1f5; text-align: left; }
.cf-drill-table th.num, .cf-drill-table td.num { text-align: right; white-space: nowrap; }
.cf-drill-table tfoot td { font-weight: 600; border-top: 1px solid #dde3ec; }
.cf-modal { border: none; border-radius: 12px; padding: 0; max-width: 720px; width: calc(100% - 32px); box-shadow: 0 16px 48px rgba(20,35,60,.18); }
.cf-modal::backdrop { background: rgba(15, 23, 42, .35); }
.cf-modal form { padding: 20px 22px; }
.cf-modal h2 { margin: 0 0 14px; font-size: 18px; }
.cf-modal h3 { margin: 16px 0 6px; font-size: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.split-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eef1f5; }
.split-part { display: grid; grid-template-columns: 110px 1fr 150px 32px; gap: 8px; margin-bottom: 8px; }
.split-part input, .split-part select { padding: 6px 8px; border: 1px solid #cfd6e0; border-radius: 6px; font: inherit; }
.split-acct-hint { margin: 0 0 8px; }
.split-sum-hint { margin: 0 0 10px; font-size: 13px; }
.split-sum-hint.split-sum-bad { color: #b42318; font-weight: 600; }
.split-mismatch { color: #b42318; font-weight: 700; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.modal-actions .spacer { flex: 1; }
.btn-danger { background: #fde6e6; color: #b42318; border: 1px solid #f5b5b0; }
td.note { overflow: hidden; text-overflow: ellipsis; }
td.note-bank { max-width: none; white-space: normal; word-break: break-word; line-height: 1.35; }
td.counterparty { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.pr-purpose { max-width: 220px; white-space: nowrap; }
tr.uncat-row { background: #fff8e6; }
tr.uncat-row:hover { background: #fff2cf; }
.cat-inp { width: 100%; min-width: 160px; padding: 5px 8px; border: 1px solid #cfd6e0; border-radius: 6px; font: inherit; background: #fff; }
tr.uncat-row .cat-inp { border-color: #e0a53a; background: #fffdf5; }
.cat-ac { position: relative; }
.cat-ac-list { position: fixed; z-index: 1000; max-height: 240px; overflow-y: auto; background: #fff; border: 1px solid #cfd6e0; border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 35, 60, 0.12); }
.cat-ac-item { display: block; width: 100%; padding: 7px 10px; border: none; background: transparent; text-align: left; font: inherit; color: #1a2233; cursor: pointer; }
.cat-ac-item:hover, .cat-ac-item.active { background: #eaf1fb; }

/* Заявки */
.btn-sm { padding: 4px 10px; font-size: 13px; }
.muted { color: #99a3b5; font-size: 12px; }
.badge.src { background: #eef1f6; color: #55627a; }
.purpose-inp { width: 100%; min-width: 160px; padding: 5px 8px; border: 1px solid #cfd6e0; border-radius: 6px; font: inherit; }
tr.uncat-row .purpose-inp { border-color: #e0a53a; background: #fffdf5; }
.row-actions { white-space: nowrap; }
.today-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 20px; background: #2f6df0; color: #fff; font-size: 11px; font-weight: 600; }

/* Заявки: узкие строки + фиксированные ширины колонок */
.pr-table { table-layout: fixed; overflow: visible; }
.pr-table th, .pr-table td { padding: 1px 8px; font-size: 12.5px; line-height: 1.3; vertical-align: middle; }
.pr-table .purpose-inp, .pr-table .comment-inp { min-width: 0; padding: 2px 6px; }
.pr-table td.cp { font-size: 12px; color: #3a4256; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-table .row-actions { display: flex; gap: 3px; }
.pr-table .btn-sm { padding: 2px 6px; font-size: 12px; }
.pr-table .badge { padding: 1px 7px; }
.pr-table .muted { font-size: 11px; }
/* Чередование цветов строк (зебра) — не трогает жёлтые/красные подсветки */
.pr-table tbody tr:nth-child(even):not(.flagged):not(.uncat-row) { background: #f5f8fc; }
.pr-table tbody tr:hover:not(.flagged):not(.uncat-row) { background: #eaf1fb; }
/* Фиксированная шапка таблицы при прокрутке (ниже site header) */
.pr-table thead th { position: sticky; top: var(--header-h); z-index: 3; box-shadow: inset 0 -1px 0 #e3e8ef; }
col.c-flag { width: 30px; }
col.c-date { width: 90px; }
col.c-cp { width: 158px; }
col.c-sum { width: 96px; }
col.c-purpose { width: 24%; }
col.c-inv { width: 168px; }
col.c-docs { width: 52px; }
col.c-bank { width: 80px; }
col.c-src { width: 84px; }
col.c-status { width: 98px; }
col.c-comment { width: 20%; }
col.c-act { width: 138px; }

/* Доступ владельца: элементы видны только в режиме владельца */
.owner-only { display: none; }
body.role-boss .owner-only { display: inline-block; }

.role-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #e8eef5;
  color: #334;
  margin-right: 0.5rem;
}

input[readonly], input:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

/* «Обратить внимание» — красная строка (приоритет над остальными подсветками) */
tr.flagged, tr.flagged.due-today, tr.flagged.uncat-row { background: #fde6e6; }
tr.flagged:hover { background: #fbd8d8; }
.flag-cell { text-align: center; width: 30px; }
.flag-chk { cursor: pointer; }
.comment-inp { width: 100%; min-width: 150px; padding: 5px 8px; border: 1px solid #cfd6e0; border-radius: 6px; font: inherit; }

.modal { position: fixed; inset: 0; background: rgba(20,28,48,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 22px 24px; width: 560px; max-width: 92vw; box-shadow: 0 12px 40px rgba(20,30,60,.25); }
.modal-box h3 { margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #55627a; }
.form-grid input, .form-grid select { padding: 7px 10px; border: 1px solid #cfd6e0; border-radius: 7px; font: inherit; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.field-block { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #55627a; }
.field-block select { padding: 7px 10px; border: 1px solid #cfd6e0; border-radius: 7px; font: inherit; }
.export-accounts { margin-top: 16px; }
.export-accounts-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #55627a; }
.check-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; margin-top: 8px; padding: 10px 12px; border: 1px solid #eef1f5; border-radius: 8px; background: #fafbfd; }
.check-list label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #334; cursor: pointer; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

main { padding: 18px 22px; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(20,30,60,.06); }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eef1f5; }
th { background: #fafbfd; font-weight: 600; color: #55627a; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.col-exp { width: 34px; }
tr.main-row { cursor: pointer; }
tr.main-row:hover { background: #f6f9ff; }
.exp-toggle { color: #8a97ad; user-select: none; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.paid { background: #e3f6ea; color: #1c8a48; }
.badge.unpaid { background: #fdecdc; color: #c1620d; }

.detail-row td { background: #fafcff; padding: 0; }
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 16px 20px; }
.detail h3 { margin: 0 0 8px; font-size: 13px; color: #55627a; text-transform: uppercase; letter-spacing: .03em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: #7a8299; }
.kv dd { margin: 0; }
.lines { grid-column: 1 / -1; }
.lines table { box-shadow: none; border: 1px solid #eef1f5; }
.lines th { font-size: 11px; }
.pdf-link { grid-column: 1 / -1; }
.empty { color: #7a8299; text-align: center; padding: 40px; }

.modal-wide { max-width: 920px; width: 95vw; }
.doc-meta { font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.doc-meta p { margin: 4px 0; }
.lines-grid { width: 100%; box-shadow: none; border: 1px solid #eef1f5; margin-top: 8px; }
.badge.src { background: #eef2ff; color: #3b4fc4; }
.badge.warn { background: #fff3e0; color: #b45309; }
.badge.card { background: #ede9fe; color: #5b21b6; }
#grid tr.partial-row { background: #fffbeb; }
#grid tr.partial-row:hover { background: #fef3c7; }
.muted { color: #7a8299; font-size: 13px; }

.salary-layout { display: grid; gap: 24px; padding: 0 20px 24px; }
.salary-tab-hidden { display: none !important; }
.salary-pnl-matrix-panel { padding: 0 0 24px; }
.salary-payroll-matrix .matrix-cell { vertical-align: top; min-width: 88px; }
.salary-payroll-matrix .matrix-inp {
  width: 100%; max-width: 96px; box-sizing: border-box;
  font: inherit; font-size: 12px; text-align: right;
  border: 1px solid #cfd6e0; border-radius: 4px; padding: 2px 4px;
}
.salary-payroll-matrix .matrix-cell.manual .matrix-inp { border-color: #6b9fd4; background: #f0f7ff; }
.salary-payroll-matrix .matrix-hints { font-size: 10px; line-height: 1.3; margin-top: 2px; color: #8896aa; }
.salary-payroll-matrix .matrix-hint.cf { color: #5a7a9a; }
.salary-payroll-matrix .matrix-hint.lista { color: #6a8f6a; }
.matrix-hint-sample { font-size: 12px; color: #5a7a9a; }
.matrix-hint-sample.lista { color: #6a8f6a; }
.salary-runs h2, .salary-detail h2 { font-size: 16px; margin: 0 0 12px; }
.salary-detail { border-top: 1px solid #eef1f5; padding-top: 20px; }

/* Документы: сверка EUR/USD */
.match-panel { margin: 0 20px 20px; padding: 16px 18px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.match-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.match-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.match-table { width: 100%; margin-bottom: 12px; }
.match-table tr.tx-unpaid { background: #fde6e6; }
.match-table tr.tx-unpaid:hover { background: #fbd8d8; }
.match-table tr.tx-paid { background: #eaf7ef; }
.match-unmatched { margin-top: 8px; font-size: 13px; }
.match-unmatched summary { cursor: pointer; color: #55627a; font-weight: 500; padding: 6px 0; }
.match-unmatched table { width: 100%; margin-top: 8px; }
.match-unmatched tr { background: #fff8e6; }

/* VAT module */
.vat-summary { padding: 0 20px 16px; }
.vat-cards { display: flex; flex-wrap: wrap; gap: 16px; }
.vat-card {
  flex: 1 1 200px; min-width: 180px; padding: 16px 20px;
  border-radius: 10px; border: 1px solid #e2e8f0; background: #fff;
}
.vat-card-label { font-size: 13px; color: #64748b; margin-bottom: 6px; }
.vat-card-value { font-size: 24px; font-weight: 700; color: #1a2233; }
.vat-card-sub { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.vat-in { border-left: 4px solid #3b82f6; }
.vat-out { border-left: 4px solid #8b5cf6; }
.vat-oss { border-left: 4px solid #f59e0b; }
.vat-oss .vat-card-value { color: #b45309; }
.vat-balance { border-left: 4px solid #64748b; }
.vat-pay { border-left-color: #dc2626; }
.vat-pay .vat-card-value { color: #dc2626; }
.vat-refund { border-left-color: #16a34a; }
.vat-refund .vat-card-value { color: #16a34a; }
.vat-section-title { font-size: 15px; font-weight: 600; margin: 20px 20px 8px; color: #3d4d66; }
.vat-table { width: calc(100% - 40px); margin: 0 20px 8px; }
.vat-total-row td { font-weight: 600; background: #f8fafc; border-top: 2px solid #e2e8f0; }
.vat-hint { padding: 20px; color: #64748b; font-size: 14px; }
.vat-table tr.kor-row { background: #fff8e6; }
.vat-mode { display: flex; gap: 4px; margin-right: 8px; }
.vat-mode-btn {
  padding: 6px 12px; border: 1px solid #cfd6e0; border-radius: 6px;
  background: #fff; font-size: 13px; cursor: pointer; color: #3d4d66;
}
.vat-mode-btn.active { background: #2f6df0; border-color: #2f6df0; color: #fff; }
.vat-quarterly-wrap { padding: 0 20px 8px; }
.vat-quarterly-scroll { overflow: auto; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.vat-quarterly-table { width: 100%; margin: 0; }
.vat-quarterly-table tr.vat-q-row { cursor: default; }
.vat-quarterly-table tr.vat-q-row.active td { background: #eef4ff; }
.vat-quarterly-table tr.muted td { color: #94a3b8; }
.vat-q-link {
  border: none; background: none; padding: 0; font: inherit; color: #2f6df0;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px;
}
.vat-pay-text { color: #dc2626; }
.vat-refund-text { color: #16a34a; }

/* PnL (ОПУ) — матрица как Excel */
.pnl-matrix-wrap {
  margin: 0 16px 24px; overflow: auto; max-height: calc(100vh - 160px);
  border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
}
.pnl-matrix {
  border-collapse: collapse; width: max-content; min-width: 100%;
  font-size: 13px;
}
.pnl-matrix th, .pnl-matrix td {
  border: 1px solid #e8edf3; padding: 3px 6px; white-space: nowrap;
}
.pnl-matrix thead th {
  position: sticky; top: 0; z-index: 2; background: #f1f5f9; font-weight: 600;
  font-size: 12px; padding: 4px 6px;
}
.pnl-matrix .pnl-stub {
  position: sticky; left: 0; z-index: 1; background: #fff; text-align: left;
  min-width: 168px; max-width: 210px; width: 190px;
}
.pnl-matrix thead .pnl-stub { z-index: 3; background: #f1f5f9; }
.pnl-matrix .num {
  text-align: right; font-variant-numeric: tabular-nums;
  min-width: 62px; max-width: 88px; width: 68px;
}
.pnl-matrix .num.pnl-pct { text-align: left; min-width: 44px; width: 48px; }

/* Чередование строк (листья без tone) */
.pnl-matrix tbody tr.pnl-row-even td,
.pnl-matrix tbody tr.pnl-row-even .pnl-stub { background: #f4f6f8; }
.pnl-matrix tbody tr.pnl-row-odd td,
.pnl-matrix tbody tr.pnl-row-odd .pnl-stub { background: #fff; }

/* Раскрывающиеся группы (без tone-строк) */
.pnl-matrix tbody tr.pnl-has-kids:not(.pnl-row-yellow):not(.pnl-row-pink):not(.pnl-row-green) td,
.pnl-matrix tbody tr.pnl-has-kids:not(.pnl-row-yellow):not(.pnl-row-pink):not(.pnl-row-green) .pnl-stub {
  background: #eef1f4 !important;
  font-weight: 600;
}
.pnl-matrix tbody tr.pnl-has-kids.pnl-role-group:not(.pnl-row-yellow):not(.pnl-row-pink) td,
.pnl-matrix tbody tr.pnl-has-kids.pnl-role-group:not(.pnl-row-yellow):not(.pnl-row-pink) .pnl-stub {
  background: #e8eef4 !important;
  color: #334155;
}

/* Основные статьи: выручка и прибыль — жёлтые, расходы (агрегация) — красные */
.pnl-row-yellow td, .pnl-row-yellow .pnl-stub {
  background: #f5f0dc !important;
  font-weight: 700;
  color: #5c5340;
}
.pnl-row-pink td, .pnl-row-pink .pnl-stub {
  background: #f3e4e4 !important;
  font-weight: 700;
  color: #6b4f4f;
}
.pnl-row-green td, .pnl-row-green .pnl-stub { background: #e6f2e8 !important; font-weight: 700; }

.pnl-matrix tbody tr.pnl-mrow.pnl-row-yellow:hover td,
.pnl-matrix tbody tr.pnl-mrow.pnl-row-yellow:hover .pnl-stub,
.pnl-matrix tbody tr.pnl-mrow.pnl-row-pink:hover td,
.pnl-matrix tbody tr.pnl-mrow.pnl-row-pink:hover .pnl-stub {
  filter: none;
}

.pnl-matrix tbody tr.pnl-mrow:not(.pnl-row-yellow):not(.pnl-row-pink):hover td,
.pnl-matrix tbody tr.pnl-mrow:not(.pnl-row-yellow):not(.pnl-row-pink):hover .pnl-stub {
  filter: brightness(0.97);
}
.pnl-row-muted td { color: #64748b; font-size: 12px; background: #f8fafc !important; }
.pnl-row-muted .pnl-stub { background: #f8fafc !important; }
.pnl-neg { color: #c92a2a; }
.pnl-twist {
  border: none; background: transparent; cursor: pointer; width: 18px;
  padding: 0; margin-right: 4px; color: #64748b; font-size: 12px;
}
.pnl-twist-sp { display: inline-block; width: 18px; margin-right: 4px; }
.pnl-label { vertical-align: middle; }
.pnl-cards-dlg {
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 0; max-width: 640px; width: 92vw;
}
.pnl-cards-form { padding: 16px 20px; margin: 0; }
.pnl-cards-hint { font-size: 13px; color: #64748b; margin: 0 0 12px; }
.pnl-cards-scroll { max-height: 360px; overflow: auto; }
.pnl-cards-form menu { display: flex; justify-content: flex-end; margin: 12px 0 0; padding: 0; }

.pnl-card-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; }
.pnl-acct-cell { max-width: 88px; white-space: nowrap; font-size: 12px; }
.pnl-cp-cell {
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px;
}
.pnl-title-cell {
  max-width: none; white-space: normal; word-break: break-word; line-height: 1.35;
  font-size: 12px; color: #334155; min-width: 280px;
}
.pnl-doc-cell { text-align: center; }
.pnl-doc-cb { width: 16px; height: 16px; accent-color: #2f6df0; cursor: pointer; }
tr.pnl-doc-ok td { background: #f0fdf4; }
.pnl-card-section { margin: 16px 20px 8px; font-size: 15px; color: #1e293b; }
.pnl-party-link {
  border: none; background: none; padding: 0; color: #1d4ed8; cursor: pointer;
  font: inherit; text-align: left;
}
.pnl-party-link:hover { text-decoration: underline; }
tr.pnl-agg-total td { font-weight: 700; background: #f1f5f9; }
.pnl-transport-matrix .pnl-stub { min-width: 140px; max-width: 200px; width: 160px; }
.pnl-payable-row td, .pnl-payable-row .pnl-stub {
  background: #fef3c7 !important; font-weight: 600; color: #92400e;
}

.pr-inv-num { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.erp-sent {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px; font-size: 11px; color: #3a4256; font-weight: 500;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.erp-sent input { width: 16px; height: 16px; accent-color: #2f6df0; flex: none; }
.erp-sent.is-sent { color: #1a7f4b; }
.erp-sent.is-err { color: #b42318; }
.erp-warn { color: #b42318; margin: 0 0 8px; }
.erp-table-wrap { max-height: 360px; overflow: auto; margin-top: 8px; }
