:root {
  --app-primary: #2563eb;
  --bs-link-color: #0a58ca; --bs-link-color-rgb: 10, 88, 202; --bs-link-hover-color: #084298;
  --sidebar-w: 248px;
  --rail-w: 64px;
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}
html { -webkit-text-size-adjust: 100%; }
body { background: #f4f6f9; padding-top: var(--safe-top); }
a { text-decoration: none; }
.text-pdz { color: var(--app-primary); }
.btn-pdz { --bs-btn-color: #fff; --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--app-primary); --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--app-primary); --bs-btn-active-border-color: var(--app-primary);
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--app-primary); --bs-btn-focus-shadow-rgb: 31, 78, 121; }
.btn-pdz:hover { filter: brightness(1.15); }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 2000; }
.skip-link:focus { left: 8px; top: 8px; background: #fff; padding: 6px 10px; }

/* ---------- Каркас ---------- */
.app-topbar { background: var(--app-primary); color: #fff; position: sticky; top: 0; z-index: 1030;
  min-height: 56px; padding-left: env(titlebar-area-x, 0); }
.app-topbar a, .app-topbar .btn-link { color: #fff; }
/* выпадающие меню шапки (профиль, уведомления, язык) — обычные цвета, а не белые как сама шапка */
.app-topbar .dropdown-menu { color: var(--bs-body-color); }
.app-topbar .dropdown-menu a:not(.btn), .app-topbar .dropdown-menu .dropdown-item { color: var(--bs-dropdown-link-color, var(--bs-body-color)); }
.app-topbar .dropdown-menu .dropdown-item:hover, .app-topbar .dropdown-menu .dropdown-item:focus { color: var(--bs-dropdown-link-hover-color, var(--bs-body-color)); }
.app-topbar .dropdown-menu .text-muted, .app-topbar .dropdown-menu .dropdown-item-text { color: var(--bs-secondary-color) !important; }
.app-topbar .brand img { height: 32px; width: 32px; border-radius: 6px; background: #fff; }
.app-sidebar { display: none; }
.app-main { padding: 12px 12px calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px); }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff;
  border-top: 1px solid #dee2e6; display: flex; padding-bottom: var(--safe-bottom); height: calc(var(--bottom-nav-h) + var(--safe-bottom)); }
.bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #495057; font-size: .75rem; border: 0; background: none; min-height: 48px; }
.bottom-nav a.active { color: var(--app-primary); font-weight: 600; }
.bottom-nav i { font-size: 1.35rem; }
.titlebar-drag { -webkit-app-region: drag; app-region: drag; }
.titlebar-drag a, .titlebar-drag button, .titlebar-drag form, .titlebar-drag input { -webkit-app-region: no-drag; app-region: no-drag; }

@media (min-width: 1024px) {
  /* Меню в стиле Meta Ads: светлая полоса слева, всегда открыто с подписями; кнопкой внизу сворачивается до значков
     (выбор запоминается). Само не прячется и не выезжает при наведении. */
  .app-sidebar { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w);
    background: var(--bs-body-bg); color: var(--bs-secondary-color); border-right: 1px solid var(--bs-border-color); z-index: 1040;
    overflow-x: clip; overflow-y: auto; scrollbar-width: thin; }
  .app-sidebar .nav-link { color: var(--bs-body-color); border-radius: 10px; margin: 1px 10px; padding: 8px 11px; white-space: nowrap;
    display: flex; align-items: center; gap: 14px; font-size: .92rem; }
  .app-sidebar .nav-link i { font-size: 1.2rem; flex: 0 0 22px; text-align: center; color: var(--bs-secondary-color); }
  .app-sidebar .nav-link:hover { background: var(--bs-tertiary-bg); }
  .app-sidebar .nav-link.active { background: color-mix(in srgb, var(--app-primary, #2563eb) 12%, transparent); color: var(--app-primary, #2563eb); font-weight: 600; }
  .app-sidebar .nav-link.active i { color: var(--app-primary, #2563eb); }
  .app-sidebar .brand { padding: 12px 14px; color: var(--bs-body-color); font-weight: 700; display: flex; gap: 12px; align-items: center; white-space: nowrap; }
  .app-sidebar .brand img { height: 36px; width: 36px; border-radius: 8px; background: #fff; flex: 0 0 36px; }
  .app-sidebar .sidebar-caption { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color);
    padding: 12px 22px 4px; white-space: nowrap; }
  /* кнопка свернуть/развернуть — круглый «язычок» на правом краю меню, посередине по высоте */
  .sidebar-toggle { position: fixed; top: 50%; left: calc(var(--sidebar-w) - 10px); transform: translateY(-50%); z-index: 1045;
    width: 20px; height: 72px; padding: 0; border-radius: 10px; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg);
    color: var(--bs-secondary-color); display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
  .sidebar-toggle:hover { background: var(--app-primary, #2563eb); border-color: var(--app-primary, #2563eb); color: #fff; }
  .sidebar-toggle i { font-size: 1rem; line-height: 1; -webkit-text-stroke: .5px; transition: transform .15s; }
  .app-topbar, .app-main { margin-left: var(--sidebar-w); }
  /* свёрнуто кнопкой: только значки, подписи — во всплывающих подсказках (title) */
  html.nav-mini .app-sidebar { width: var(--rail-w); }
  html.nav-mini .app-topbar, html.nav-mini .app-main { margin-left: var(--rail-w); }
  html.nav-mini .app-sidebar .nav-link, html.nav-mini .app-sidebar .brand span { font-size: 0; gap: 0; justify-content: center; }
  html.nav-mini .app-sidebar .sidebar-caption { color: transparent; border-top: 1px solid var(--bs-border-color); margin: 8px 14px 0; padding: 0; height: 9px; }
  html.nav-mini .app-sidebar .sidebar-help { display: none; }
  /* значки строго по центру узкой полосы, не уезжают под кнопку */
  html.nav-mini .app-sidebar > ul, html.nav-mini .app-sidebar > ul > li { width: var(--rail-w); min-width: 0; max-width: var(--rail-w); }
  html.nav-mini .app-sidebar .nav-link { width: 44px; margin: 1px auto; padding: 8px 0; }
  html.nav-mini .app-sidebar .brand { justify-content: center; padding: 12px 0; }
  html.nav-mini .sidebar-toggle { left: calc(var(--rail-w) - 10px); }
  html.nav-mini .sidebar-toggle i { transform: rotate(180deg); }
  .app-topbar .brand { display: none !important; }
  .app-main { padding: 20px 24px 32px; }
  .bottom-nav { display: none; }
  .mobile-only { display: none !important; }
}
@media (max-width: 1023.98px) { .desktop-only { display: none !important; } }

/* Таблицы с закреплённой шапкой */
.table-sticky { max-height: 70vh; overflow: auto; }
.table-sticky thead th { position: sticky; top: 0; background: #f8f9fa; z-index: 2; box-shadow: inset 0 -1px 0 #dee2e6; }
.table td, .table th { vertical-align: middle; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-hidden { display: none !important; }

/* Карточки вместо таблиц на телефоне */
.cards-mobile { display: none; }
@media (max-width: 767.98px) {
  .table-desktop { display: none; }
  .cards-mobile { display: block; }
  .btn-touch { min-height: 44px; min-width: 44px; }
  h1, .h1 { font-size: 1.4rem; }
}
.client-card { border-left: 4px solid #adb5bd; }
.client-card.lvl-danger { border-left-color: #dc3545; }
.client-card.lvl-warning { border-left-color: #fd7e14; }
.client-card.lvl-info { border-left-color: #0dcaf0; }
.client-card.lvl-success { border-left-color: #198754; }

/* KPI и план */
.kpi { border: 0; border-radius: 14px; }
.kpi .kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; overflow-wrap: normal; word-break: normal; }
.kpi-xl .kpi-value { font-size: 2.3rem; }
.plan-block .list-group-item { padding: .55rem .75rem; }
.plan-block .card-header { font-weight: 600; }
.quick-actions .btn { padding: .3rem .55rem; }
.badge-new { background: #ffc107; color: #000; }
.chart-box { position: relative; height: 300px; }
.chart-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .chart-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1600px) { .chart-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }
.fullscreen-target:fullscreen { background: #f4f6f9; overflow: auto; padding: 24px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #dee2e6; }
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-item::before { content: ""; position: absolute; left: -19px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--app-primary); border: 2px solid #fff; }
.timeline-item.no-contact::before { background: #adb5bd; }

#install-btn[hidden] { display: none !important; }
.toast-container { z-index: 2000; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px) !important; }
@media (min-width: 1024px) { .toast-container { bottom: 16px !important; } }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.kbd { border: 1px solid #ccc; border-radius: 4px; padding: 0 5px; font-size: .8em; background: #fff; color: #333; }

/* ---------- Печать ---------- */
@media print {
  .app-sidebar, .app-topbar, .bottom-nav, .no-print, .btn, .toast-container, .modal, form.no-print { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; font-size: 11pt; }
  .card { border: 1px solid #999 !important; box-shadow: none !important; break-inside: avoid; }
  .table-desktop { display: block !important; }
  .cards-mobile { display: none !important; }
  .table-sticky { max-height: none; overflow: visible; }
  a { color: #000; }
  .print-only { display: block !important; }
  .chart-box { height: 240px; }
}
.print-only { display: none; }
.min-w-0, .plan-block .list-group-item > .me-auto, .list-group-item > .me-auto { min-width: 0; overflow-wrap: anywhere; }

/* Контраст (WCAG AA) */
.btn-outline-secondary { --bs-btn-color: #495057; --bs-btn-border-color: #6c757d; }
.btn-outline-success { --bs-btn-color: #146c43; --bs-btn-border-color: #198754; }
.btn-outline-primary { --bs-btn-color: #0a58ca; }
.text-success { color: #146c43 !important; }
.text-warning { color: #995700 !important; }
.text-info { color: #087990 !important; }
.text-muted { color: #5c636a !important; }
.chart-grid > * { min-width: 0; } .chart-box canvas { max-width: 100%; }

/* ---------- Обучение (тур) ---------- */
.tour-layer { position: fixed; inset: 0; z-index: 3000; }
.tour-box { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10, 20, 35, .62); transition: all .25s ease;
  outline: 3px solid #ffc107; pointer-events: none; }
.tour-card { position: fixed; background: #fff; color: #212529; border-radius: 14px; padding: 14px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35);
  max-width: calc(100vw - 24px); transition: top .25s ease, left .25s ease; }
.tour-card .tour-title { color: var(--app-primary); }
@media print { .tour-layer { display: none !important; } }
@page wide { size: A4 landscape; margin: 10mm; }
.print-head { align-items: center; gap: 12px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 2px solid #2563eb; }
@media print {
  @page { size: A4; margin: 12mm; }
  .report-tabs { display: none !important; }
  .table-responsive { overflow: visible !important; }
  body:has(.print-wide) { page: wide; }
  .kpi { break-inside: avoid; }
  a[href]::after { content: none !important; }
  .table { font-size: 8pt; } .table td.num, .table th.num { white-space: nowrap; }
  .table > :not(caption) > * > * { padding: .2rem .3rem; } .table thead th { white-space: normal !important; vertical-align: bottom; }
  .table .small, .table small { font-size: 7.5pt; }
  .progress { border: 1px solid #999; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ---------- Чек-лист «Начало работы» ---------- */
.onboarding .step { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed #e3e7ec; }
.onboarding .step:last-child { border-bottom: 0; }
.onboarding .step .bi { font-size: 1.25rem; line-height: 1; }
.onboarding .step.done .step-title { text-decoration: line-through; color: #6c757d; }
.help-fab { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff !important; }
.help-fab:hover { background: rgba(255,255,255,.3); }
.sidebar-help { margin: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff !important; display: block; }
.sidebar-help:hover { background: rgba(255,255,255,.16); }
.help-toc a { display: block; padding: 4px 8px; border-radius: 6px; color: inherit; }
.help-toc a:hover { background: #eef2f6; }
.help-section { scroll-margin-top: 116px; }
.help-section h2 { scroll-margin-top: 116px; }
.help-steps li { margin-bottom: 4px; }

.num, td.num { white-space: nowrap; }

/* ---------- Современная панель фильтров ---------- */
.fbar { border: 0; border-radius: 14px; }
.fbar-search { position: relative; }
.fbar-search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #8a94a6; pointer-events: none; }
.fbar-search .form-control { padding-left: 40px; border-radius: 999px; background: #f4f6f9; border-color: transparent; height: 42px; }
.fbar-search .form-control:focus { background: #fff; border-color: var(--app-primary); box-shadow: 0 0 0 .2rem rgba(31, 78, 121, .15); }
.fbar-more-btn { border-radius: 999px; height: 42px; padding: 0 14px; white-space: nowrap; }
.fbar-more-btn[aria-expanded="true"] { background: var(--app-primary); color: #fff; border-color: var(--app-primary) !important; }
.fbar-row { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px 0;
  -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.fbar-row::-webkit-scrollbar { display: none; }
.fbar-label { color: #8a94a6; flex: none; width: 20px; text-align: center; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid #dfe3ea; background: #fff; color: #33415c; font-size: .875rem; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.fchip:hover { border-color: var(--app-primary); color: var(--app-primary); }
.btn-check:checked + .fchip { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.btn-check:focus-visible + .fchip { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.fchip-n { font-size: .75rem; padding: 0 6px; border-radius: 999px; background: #eef1f6; color: #5b6b85; font-variant-numeric: tabular-nums; }
.btn-check:checked + .fchip .fchip-n { background: rgba(255, 255, 255, .22); color: #fff; }
.fdot { width: 8px; height: 8px; border-radius: 50%; background: #adb5bd; flex: none; }
.fchip-create .fdot { background: #198754; } .fchip-update .fdot { background: #0d6efd; }
.fchip-delete .fdot, .fchip-denied .fdot, .fchip-login_failed .fdot { background: #dc3545; }
.fchip-export .fdot, .fchip-bulk .fdot { background: #ffc107; } .fchip-login .fdot, .fchip-logout .fdot { background: #6c757d; }
.btn-check:checked + .fchip .fdot { box-shadow: 0 0 0 2px #fff; }
.fchip-active { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 999px;
  background: rgba(31, 78, 121, .1); color: var(--app-primary); font-weight: 500; }
.fchip-active i { font-size: .7rem; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(31, 78, 121, .15); }
.fchip-active:hover i { background: var(--app-primary); color: #fff; }
.fbar-results.htmx-request { opacity: .55; transition: opacity .15s; pointer-events: none; }
.audit-meta { white-space: nowrap; }
@media (max-width: 767.98px) { .audit-meta { white-space: normal; margin-left: 0 !important; width: 100%; font-size: .8rem; } }

/* ---------- Тёмная тема ---------- */
.theme-switch .btn.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
[data-bs-theme=dark] {
  --bs-body-bg: #12161c; --bs-body-color: #dde3ea; --bs-secondary-bg: #1b2129; --bs-tertiary-bg: #171c23;
  --bs-border-color: #2c3440; --bs-emphasis-color: #f1f4f8;
  --bs-link-color: #79b0ff; --bs-link-color-rgb: 121, 176, 255; --bs-link-hover-color: #a6c9ff;
  --bs-light-rgb: 33, 40, 49; --bs-white-rgb: 27, 33, 41;
  color-scheme: dark;
}
[data-bs-theme=dark] body { background: #0e1217; }
[data-bs-theme=dark] .card, [data-bs-theme=dark] .modal-content, [data-bs-theme=dark] .dropdown-menu,
[data-bs-theme=dark] .offcanvas, [data-bs-theme=dark] .list-group-item, [data-bs-theme=dark] .accordion-item { --bs-card-bg: #171c23; background-color: #171c23; }
[data-bs-theme=dark] .card-header, [data-bs-theme=dark] .card-footer { background-color: #1b2129; }
[data-bs-theme=dark] .shadow-sm { box-shadow: 0 .125rem .35rem rgba(0,0,0,.45) !important; }
[data-bs-theme=dark] .app-topbar { background: color-mix(in srgb, var(--app-primary) 55%, #0e1217); }
[data-bs-theme=dark] .app-sidebar { background: #0f141a; border-right: 1px solid #1f2630; }
[data-bs-theme=dark] .bottom-nav { background: #12161c; border-top-color: #2c3440; }
[data-bs-theme=dark] .bottom-nav a, [data-bs-theme=dark] .bottom-nav button { color: #aab4c2; }
[data-bs-theme=dark] .bottom-nav a.active, [data-bs-theme=dark] .text-pdz, [data-bs-theme=dark] .tour-card .tour-title { color: #79b0ff; }
/* светлые кнопки, таблицы и плашки Bootstrap не меняются сами — подстраиваем */
[data-bs-theme=dark] .btn-light { --bs-btn-color: #dde3ea; --bs-btn-bg: #222a34; --bs-btn-border-color: #2c3440;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #2a3340; --bs-btn-hover-border-color: #3a4554;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #313b49; --bs-btn-active-border-color: #3a4554; }
[data-bs-theme=dark] .table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(255,255,255,.03); --bs-table-hover-bg: rgba(255,255,255,.05); }
[data-bs-theme=dark] .table-light { --bs-table-color: #dde3ea; --bs-table-bg: #1b2129; --bs-table-border-color: #2c3440;
  --bs-table-striped-bg: #1f262f; --bs-table-hover-bg: #232b35; color: #dde3ea; }
[data-bs-theme=dark] .table-sticky thead th { background: #1b2129; box-shadow: inset 0 -1px 0 #2c3440; }
[data-bs-theme=dark] .text-bg-light { color: #dde3ea !important; background-color: #232b35 !important; }
[data-bs-theme=dark] .bg-white { background-color: #171c23 !important; }
[data-bs-theme=dark] .alert-light { --bs-alert-bg: #1b2129; --bs-alert-color: #dde3ea; --bs-alert-border-color: #2c3440; }
[data-bs-theme=dark] .form-control, [data-bs-theme=dark] .form-select { background-color: #12161c; border-color: #2f3946; }
[data-bs-theme=dark] .form-control:disabled, [data-bs-theme=dark] .form-select:disabled { background-color: #1b2129; }
[data-bs-theme=dark] .app-topbar .form-control, [data-bs-theme=dark] .app-topbar .form-select { background-color: rgba(255,255,255,.1); color: #fff; border-color: transparent; }
[data-bs-theme=dark] .app-topbar .form-control::placeholder { color: rgba(255,255,255,.6); }
[data-bs-theme=dark] .app-topbar .form-select option { color: #dde3ea; background: #171c23; }
/* контрастные цвета текста для тёмного фона */
[data-bs-theme=dark] .text-success { color: #5cd08f !important; }
[data-bs-theme=dark] .text-warning { color: #ffc65c !important; }
[data-bs-theme=dark] .text-info { color: #5fd3ea !important; }
[data-bs-theme=dark] .text-muted { color: #98a3b3 !important; }
[data-bs-theme=dark] .text-danger { color: #ff7b86 !important; }
[data-bs-theme=dark] .text-primary { color: #79b0ff !important; }
[data-bs-theme=dark] .btn-outline-secondary { --bs-btn-color: #c3cad5; --bs-btn-border-color: #5a6574; --bs-btn-hover-bg: #2a3340; --bs-btn-hover-border-color: #6c7787; --bs-btn-hover-color: #fff; }
[data-bs-theme=dark] .btn-outline-primary { --bs-btn-color: #79b0ff; --bs-btn-border-color: #3d7fe0; --bs-btn-hover-bg: #1d4f99; --bs-btn-hover-color: #fff; }
[data-bs-theme=dark] .btn-outline-success { --bs-btn-color: #5cd08f; --bs-btn-border-color: #2f9a62; }
[data-bs-theme=dark] .btn-link { --bs-btn-color: #79b0ff; }
[data-bs-theme=dark] .app-topbar .btn-link { color: #fff; }
[data-bs-theme=dark] .kbd { background: #222a34; color: #dde3ea; border-color: #3a4554; }
[data-bs-theme=dark] .timeline::before { background: #2c3440; }
[data-bs-theme=dark] .timeline-item::before { border-color: #171c23; }
[data-bs-theme=dark] .tour-card { background: #1b2129; color: #dde3ea; }
[data-bs-theme=dark] .help-toc a:hover { background: #222a34; }
[data-bs-theme=dark] .onboarding .step { border-bottom-color: #2c3440; }
[data-bs-theme=dark] .fullscreen-target:fullscreen { background: #0e1217; }
[data-bs-theme=dark] .fbar-search .form-control { background: #1b2129; }
[data-bs-theme=dark] .fbar-search .form-control:focus { background: #12161c; }
[data-bs-theme=dark] .fchip { background: #1b2129; border-color: #2f3946; color: #c3cad5; }
[data-bs-theme=dark] .fchip:hover { color: #79b0ff; border-color: #3d7fe0; }
[data-bs-theme=dark] .fchip-n { background: #2a3340; color: #aab4c2; }
[data-bs-theme=dark] .fchip-active { background: rgba(121,176,255,.14); color: #a6c9ff; }
[data-bs-theme=dark] .fchip-active i { background: rgba(121,176,255,.2); }
[data-bs-theme=dark] .badge.text-bg-warning, [data-bs-theme=dark] .badge-new { color: #000 !important; }

/* ---------- Этапы взыскания ---------- */
.stage-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: #eef1f6; color: #4a5568; white-space: nowrap; margin-top: 2px; }
.stage-reminder { background: #e7f1ff; color: #0a58ca; } .stage-negotiation { background: #e6f7fb; color: #087990; }
.stage-claim { background: #fff4e0; color: #995700; } .stage-notice { background: #ffe9dc; color: #b54708; }
.stage-court { background: #fde8ea; color: #b02a37; }
.stage-badge.stuck { box-shadow: inset 0 0 0 1.5px #dc3545; }
[data-bs-theme=dark] .stage-badge { background: #2a3340; color: #c3cad5; }
[data-bs-theme=dark] .stage-reminder { background: rgba(61,127,224,.2); color: #8fbcff; }
[data-bs-theme=dark] .stage-negotiation { background: rgba(13,202,240,.15); color: #6fdcf2; }
[data-bs-theme=dark] .stage-claim { background: rgba(255,193,7,.15); color: #ffd36b; }
[data-bs-theme=dark] .stage-notice { background: rgba(253,126,20,.18); color: #ffad6b; }
[data-bs-theme=dark] .stage-court { background: rgba(220,53,69,.2); color: #ff8f9a; }
.stage-steps { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0; counter-reset: st; }
.stage-steps li { flex: 1 1 0; min-width: 0; position: relative; padding: 8px 6px 6px; border-radius: 10px; text-align: center; font-size: .8rem;
  background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); line-height: 1.2; }
.stage-steps li::before { counter-increment: st; content: counter(st); display: flex; width: 22px; height: 22px; margin: 0 auto 4px; border-radius: 50%;
  align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; background: var(--bs-secondary-bg); border: 1px solid var(--bs-border-color); }
.stage-steps li.done { color: #146c43; } .stage-steps li.done::before { content: "✓"; background: #198754; color: #fff; border-color: #198754; }
.stage-steps li.current { background: var(--app-primary); color: #fff; font-weight: 600; }
.stage-steps li.current::before { background: #fff; color: var(--app-primary); border-color: #fff; }
.stage-steps li.current.stuck { background: #dc3545; } .stage-steps li.current.stuck::before { color: #dc3545; }
@media (max-width: 575.98px) { .stage-steps li { font-size: .68rem; padding: 6px 2px; } .stage-steps li span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } }
.stage-card { border-radius: 14px; }
.funnel-card { border: 0; border-radius: 14px; transition: transform .1s; } .funnel-card:hover { transform: translateY(-2px); }
.funnel-card .bar { height: 6px; border-radius: 3px; background: var(--bs-secondary-bg); overflow: hidden; }
.funnel-card .bar > span { display: block; height: 100%; background: var(--app-primary); }
[data-bs-theme=dark] .stage-steps li.done { color: #5cd08f; }

/* ---------- Отчёты ---------- */
.report-tabs .nav-link { border-radius: 999px; padding: .35rem .9rem; color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
.report-tabs .nav-link.active { background: var(--app-primary); color: #fff; }
.aging-bar { display: flex; height: 22px; border-radius: 11px; overflow: hidden; background: var(--bs-secondary-bg); }
.aging-bar span { display: block; height: 100%; min-width: 3px; }
.aging-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ab-1_30 { background: #0dcaf0; } .ab-31_60 { background: #ffc107; } .ab-61_90 { background: #fd7e14; }
.ab-91_180 { background: #dc3545; } .ab-180 { background: #7a1f2b; }
.heat-1_30 { background: rgba(13,202,240,.12) !important; } .heat-31_60 { background: rgba(255,193,7,.16) !important; }
.heat-61_90 { background: rgba(253,126,20,.16) !important; } .heat-91_180 { background: rgba(220,53,69,.16) !important; }
.heat-180 { background: rgba(122,31,43,.2) !important; }
.aging-table td.heat { font-weight: 600; }
.aging-table tfoot td { border-top: 2px solid var(--bs-border-color); }
[data-bs-theme=dark] .weekly-card td[style*="background"] { background: #1b2129 !important; }
[data-bs-theme=dark] .weekly-card [style*="color:#5c636a"] { color: #98a3b3 !important; }
[data-bs-theme=dark] .weekly-card tr[style*="border"] { border-color: #2c3440 !important; }
[data-bs-theme=dark] .weekly-card [style*="color:#146c43"] { color: #5cd08f !important; }
[data-bs-theme=dark] .weekly-card [style*="color:#b02a37"] { color: #ff8f9a !important; }
[data-bs-theme=dark] .weekly-card [style*="color:#995700"] { color: #ffc65c !important; }
.aging-table { font-size: .875rem; } .aging-table th { white-space: nowrap; } .aging-table td:first-child { min-width: 170px; }
@media print { .aging-table { font-size: 7.5pt; } .aging-table th { white-space: normal; } .aging-table td:first-child { min-width: 0; } }
.report-kpis .kpi-value, .kpi .kpi-value.fs-4 { font-size: clamp(1.05rem, 1.6vw, 1.45rem) !important; }
[data-bs-theme=dark] .btn-outline-dark { --bs-btn-color: #dde3ea; --bs-btn-border-color: #6c7787; --bs-btn-hover-bg: #dde3ea; --bs-btn-hover-color: #12161c; --bs-btn-hover-border-color: #dde3ea; }
[data-bs-theme=dark] .text-bg-dark { background-color: #3a4554 !important; }
@media (max-width: 575.98px) {
  .weekly-card .weekly-kpis, .weekly-card .weekly-kpis tbody, .weekly-card .weekly-kpis tr { display: block; }
  .weekly-card .weekly-kpis td { display: block; width: auto !important; margin-bottom: 8px; }
  .report-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .report-tabs .nav-link { white-space: nowrap; }
}
[data-bs-theme=dark] .table-danger { --bs-table-bg: rgba(220,53,69,.2); --bs-table-color: #f6d5d9; --bs-table-border-color: #4a2a30; color: #f6d5d9; }
[data-bs-theme=dark] .table-warning { --bs-table-bg: rgba(255,193,7,.14); --bs-table-color: #f5e6b8; --bs-table-border-color: #4a4128; color: #f5e6b8; }
[data-bs-theme=dark] .table-success { --bs-table-bg: rgba(25,135,84,.16); --bs-table-color: #cdeedd; --bs-table-border-color: #234a37; color: #cdeedd; }
[data-bs-theme=dark] .table-info { --bs-table-bg: rgba(13,202,240,.14); --bs-table-color: #cdf2fa; --bs-table-border-color: #1f4650; color: #cdf2fa; }

/* ---------- Интеграции ---------- */
.api-code { background: #0f1720; color: #d6e2f0; padding: 12px 14px; border-radius: 10px; font-size: .78rem; line-height: 1.45;
  white-space: pre; overflow-x: auto; max-width: 100%; }
.api-doc code { font-size: .8rem; }
.fchip-link { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--bs-border-color);
  color: var(--bs-body-color); background: var(--bs-body-bg); font-size: .875rem; }
.fchip-link.active { background: var(--app-primary); color: #fff; border-color: var(--app-primary); }

/* ---------- Справочный центр ---------- */
.hc-hero { border-radius: 20px; background: linear-gradient(135deg, var(--app-primary), #3b82f6 60%, #8b5cf6); color: #fff; overflow: visible; }
.hc-hero-in { padding: 28px 28px 22px; }
@media (max-width: 575.98px) { .hc-hero-in { padding: 20px 16px 16px; } }
.hc-kicker { font-size: .8rem; opacity: .85; font-weight: 600; letter-spacing: .02em; }
.hc-title { font-size: clamp(1.6rem, 3.2vw, 2.3rem); font-weight: 800; margin: 2px 0 0; letter-spacing: -.02em; }
.hc-tour { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; backdrop-filter: blur(4px); }
.hc-tour:hover { background: rgba(255,255,255,.28); color: #fff; }
.hc-search { position: relative; max-width: 760px; }
.hc-search > i { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 1.1rem; z-index: 1; }
.hc-search input { width: 100%; height: 56px; border: 0; border-radius: 16px; padding: 0 18px 0 50px; font-size: 1.02rem;
  background: #fff; color: #1e293b; box-shadow: 0 10px 30px rgba(15,23,42,.18); outline: none; }
.hc-search input:focus { box-shadow: 0 10px 30px rgba(15,23,42,.18), 0 0 0 4px rgba(255,255,255,.45); }
[data-bs-theme="dark"] .hc-search input { background: var(--bs-body-bg); color: var(--bs-body-color); }
.hc-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20; background: var(--bs-body-bg); color: var(--bs-body-color);
  border-radius: 16px; box-shadow: 0 18px 50px rgba(15,23,42,.25); padding: 6px; max-height: 60vh; overflow: auto; }
.hc-r { display: block; padding: 10px 12px; border-radius: 12px; color: inherit; }
.hc-r:hover, .hc-r:focus { background: var(--bs-tertiary-bg); }
.hc-r-g { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 700; }
.hc-r-t { display: block; font-weight: 600; }
.hc-r-s { display: block; font-size: .82rem; color: var(--bs-secondary-color); }
.hc-r-s mark { background: #fde68a; color: inherit; padding: 0 2px; border-radius: 3px; }
.hc-r-none { padding: 14px; color: var(--bs-secondary-color); }
.hc-popular { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hc-pill { padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff !important; font-size: .86rem;
  border: 1px solid rgba(255,255,255,.28); transition: background .15s; }
.hc-pill:hover { background: rgba(255,255,255,.3); }

.hc-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 575.98px) { .hc-grid { grid-template-columns: 1fr; gap: 12px; } }
.hc-card { background: var(--bs-body-bg); border-radius: 18px; padding: 18px 16px 10px; box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 20px rgba(15,23,42,.05);
  border: 1px solid var(--bs-border-color-translucent); transition: transform .15s, box-shadow .15s; }
.hc-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15,23,42,.06), 0 14px 34px rgba(15,23,42,.09); }
.hc-card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; padding: 0 4px; }
.hc-blob { flex: none; width: 48px; height: 48px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: #fff; background: var(--hc-grad); box-shadow: 0 6px 16px var(--hc-shadow); }
.hc-card-title { font-size: 1.08rem; font-weight: 700; margin: 0; }
.hc-card-desc { font-size: .82rem; color: var(--bs-secondary-color); }
.hc-topics { list-style: none; padding: 0; margin: 0; }
.hc-topics a { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; color: var(--bs-body-color); font-size: .93rem; }
.hc-topics a:hover { background: var(--hc-soft); }
.hc-topics a:hover .hc-go { transform: translateX(3px); color: var(--hc-c); }
.hc-ti { color: var(--hc-c); width: 18px; text-align: center; }
.hc-go { color: var(--bs-secondary-color); font-size: .8rem; transition: transform .15s; }
.hc-role { font-size: .68rem; padding: 2px 8px; border-radius: 999px; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); white-space: nowrap; }
.hc-green  { --hc-c: #16a34a; --hc-grad: linear-gradient(135deg, #22c55e, #059669); --hc-shadow: rgba(22,163,74,.3); --hc-soft: rgba(34,197,94,.08); }
.hc-blue   { --hc-c: #2563eb; --hc-grad: linear-gradient(135deg, #3b82f6, #1d4ed8); --hc-shadow: rgba(37,99,235,.3); --hc-soft: rgba(59,130,246,.08); }
.hc-teal   { --hc-c: #0d9488; --hc-grad: linear-gradient(135deg, #14b8a6, #0f766e); --hc-shadow: rgba(13,148,136,.3); --hc-soft: rgba(20,184,166,.08); }
.hc-orange { --hc-c: #ea580c; --hc-grad: linear-gradient(135deg, #fb923c, #ea580c); --hc-shadow: rgba(234,88,12,.3); --hc-soft: rgba(251,146,60,.1); }
.hc-purple { --hc-c: #7c3aed; --hc-grad: linear-gradient(135deg, #a78bfa, #7c3aed); --hc-shadow: rgba(124,58,237,.3); --hc-soft: rgba(167,139,250,.1); }
.hc-slate  { --hc-c: #475569; --hc-grad: linear-gradient(135deg, #94a3b8, #475569); --hc-shadow: rgba(71,85,105,.3); --hc-soft: rgba(148,163,184,.12); }
.hc-pink   { --hc-c: #db2777; --hc-grad: linear-gradient(135deg, #f472b6, #db2777); --hc-shadow: rgba(219,39,119,.3); --hc-soft: rgba(244,114,182,.1); }
[data-bs-theme=dark] .hc-green { --hc-c: #4ade80; } [data-bs-theme=dark] .hc-blue { --hc-c: #60a5fa; } [data-bs-theme=dark] .hc-teal { --hc-c: #2dd4bf; }
[data-bs-theme=dark] .hc-orange { --hc-c: #fb923c; } [data-bs-theme=dark] .hc-purple { --hc-c: #a78bfa; } [data-bs-theme=dark] .hc-slate { --hc-c: #94a3b8; }
[data-bs-theme=dark] .hc-pink { --hc-c: #f472b6; }
[data-bs-theme=dark] .hc-card, [data-bs-theme=dark] .hc-support { background: #171c23; border-color: #2c3440; }
[data-bs-theme=dark] .hc-hero { background: linear-gradient(135deg, #1e3a8a, #312e81 60%, #4c1d95); }

.hc-support { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; background: var(--bs-body-bg); border-radius: 18px; padding: 18px;
  border: 1px solid var(--bs-border-color-translucent); box-shadow: 0 6px 20px rgba(15,23,42,.05); }
.hc-sup-blob { --hc-grad: linear-gradient(135deg, #f472b6, #8b5cf6); --hc-shadow: rgba(139,92,246,.3); }

.hc-panel { --bs-offcanvas-width: min(600px, 100vw); border-left: 0 !important; }
@media (max-width: 575.98px) { .hc-panel { --bs-offcanvas-width: 100vw; } }
.hc-a-head { display: flex; gap: 14px; align-items: center; margin: 6px 0 10px; }
.hc-a-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--hc-c); }
.hc-a-title { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.hc-lead { font-size: 1.02rem; color: var(--bs-secondary-color); margin-bottom: 16px; }
.hc-steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 14px; position: relative; }
.hc-steps li { counter-increment: s; position: relative; padding: 2px 0 14px 46px; }
.hc-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--hc-grad);
  color: #fff; font-weight: 700; font-size: .85rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px var(--hc-shadow); }
.hc-steps li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 2px; width: 2px; background: var(--hc-soft); }
.hc-tip { display: flex; gap: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #713f12; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; font-size: .9rem; }
.hc-tip i { color: #f59e0b; margin-top: 2px; }
[data-bs-theme=dark] .hc-tip { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fde68a; }
.hc-faq details { border: 1px solid var(--bs-border-color); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.hc-faq summary { font-weight: 600; cursor: pointer; }
.hc-faq details > div { color: var(--bs-secondary-color); margin-top: 6px; }
.hc-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--bs-border-color); }
.hc-nav a { display: block; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--bs-border-color); color: inherit; }
.hc-nav a:hover { border-color: var(--hc-c); }
.hc-nav small { display: block; color: var(--bs-secondary-color); font-size: .75rem; }
.hc-nav span { font-weight: 600; font-size: .9rem; }
.hc-nav-next { text-align: right; grid-column: 2; }
.hc-lock { color: var(--bs-secondary-color); font-size: .8rem; opacity: .7; }

/* ---------- Цвета кнопок фильтров на разных страницах ---------- */
.fchip-s-debt .fdot, .fchip-g-reminder .fdot, .fchip-m-card .fdot, .fchip-r-callback .fdot, .fchip-t-today .fdot { background: #0d6efd; }
.fchip-s-overdue .fdot, .fchip-g-court .fdot, .fchip-g-stuck .fdot, .fchip-r-refused .fdot, .fchip-r-wrong_number .fdot,
.fchip-t-overdue .fdot, .fchip-p-broken .fdot { background: #dc3545; }
.fchip-s-new .fdot, .fchip-g-claim .fdot, .fchip-p-today .fdot, .fchip-m-mortgage .fdot { background: #ffc107; }
.fchip-s-paid .fdot, .fchip-m-cash .fdot, .fchip-r-paid .fdot, .fchip-r-promise .fdot, .fchip-t-done .fdot, .fchip-p-kept .fdot { background: #198754; }
.fchip-g-negotiation .fdot, .fchip-m-bank .fdot, .fchip-m-transfer .fdot { background: #0dcaf0; }
.fchip-g-notice .fdot { background: #fd7e14; }
.fchip-r-no_answer .fdot, .fchip-m-other .fdot, .fchip-r-other .fdot, .fchip-p-pending .fdot { background: #adb5bd; }
.fbar .input-group-sm .form-control { min-width: 0; }
.fbar-sep { flex: none; width: 1px; height: 22px; background: var(--bs-border-color); margin: 0 4px; }
.fbar-select { height: 42px; border-radius: 999px; }

/* ---------- Компактная таблица клиентов ---------- */
table[data-cols-key="clients"] { font-size: .9rem; }
table[data-cols-key="clients"] th { white-space: nowrap; }
table[data-cols-key="clients"] td { padding-top: .45rem; padding-bottom: .45rem; }
.cl-proj { max-width: 190px; }
.cl-proj-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table[data-cols-key="clients"] td:nth-child(2) a.fw-semibold { white-space: nowrap; }
/* суммы в карточках-показателях не переносят «сум» на новую строку */
.kpi .kpi-value { font-size: clamp(1.05rem, 1.55vw, 1.6rem); overflow-wrap: normal; word-break: keep-all; }
.onb-compact { border-radius: 14px; }
.onb-head { padding: 10px 14px; }
.onb-toggle { background: none; border: 0; padding: 0; color: inherit; min-width: 0; flex: 1 1 auto; }
.onb-chev { color: var(--bs-secondary-color); transition: transform .2s; }
.onb-toggle[aria-expanded="true"] .onb-chev { transform: rotate(180deg); }
.onb-ring { --p: 0; flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--app-primary) calc(var(--p) * 1%), var(--bs-secondary-bg) 0); }
.onb-ring span { width: 32px; height: 32px; border-radius: 50%; background: var(--bs-body-bg); display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; }
[data-bs-theme=dark] .onb-ring span { background: #171c23; }

/* меню языка (общее с CRM) */
.lang-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; border-radius: 10px; border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg); color: var(--bs-body-color); padding: 6px 10px; }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { border-color: #9fb7d1; color: var(--bs-link-color); background: var(--bs-tertiary-bg); }
.lang-btn::after { margin-left: 2px; }
.lang-list { min-width: 190px; padding: 6px; border-radius: 14px; border: 1px solid var(--bs-border-color); box-shadow: 0 16px 40px rgba(15,34,54,.14); }
.lang-list .dropdown-item { display: flex; justify-content: space-between; align-items: center; border-radius: 9px; padding: 8px 10px; font-weight: 500; }
.lang-list .dropdown-item small { color: #8a99a8; font-weight: 600; }
.lang-list .dropdown-item.active { background: var(--bs-primary-bg-subtle); color: var(--bs-link-color); }
.lang-list .dropdown-item.active small { color: var(--bs-link-color); }


/* ---------- Облегчённый режим для слабых устройств ----------
   Класс .lite ставится до отрисовки (скрипт в <head>), если у устройства мало памяти или ядер, включена экономия трафика
   или медленная сеть; то же — при «уменьшить движение» в системе. Выключаются размытие, анимации, тяжёлые тени и 3D. */
.lite *, .lite *::before, .lite *::after { animation: none !important; transition: none !important; }
.lite .pub-nav { backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; }
.lite .pub-logo, .lite .pub-cta { box-shadow: none; }
.lite .hc-tour { backdrop-filter: none; }
.lite .card, .lite .shadow-sm, .lite .shadow, .lite .shadow-lg { box-shadow: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Узкие экраны (старые и недорогие телефоны, 320–400 px) ---------- */
/* Вкладки (отчёты, интеграции) — в одну строку с прокруткой пальцем, а не за край экрана */
.report-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
.report-tabs::-webkit-scrollbar { display: none; }
.report-tabs .nav-link { white-space: nowrap; }
/* Длинные метки статуса в заголовках переносятся */
h1 .badge, .h3 .badge { white-space: normal; text-align: left; line-height: 1.25; }
/* Суммы в карточках-показателях подстраиваются под ширину карточки */
@media (max-width: 420px) { .kpi .kpi-value { font-size: .95rem !important; overflow-wrap: anywhere; } }
@supports (container-type: inline-size) {
  .kpi .card-body { container-type: inline-size; }
  .kpi .kpi-value { font-size: clamp(.78rem, 10.5cqi, 1.6rem) !important; overflow-wrap: normal; }
}
/* На самых узких телефонах (до 374 px) карточки с суммами — по одной в строку: «1 234 567 890 сум» иначе не помещается */
@media (max-width: 374px) {
  .row > .col-6:has(> .kpi), .row > .col-6:has(> .card.kpi) { flex: 0 0 100%; max-width: 100%; }
}
.fchip.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
/* карточка клиента на телефоне: действия всегда под рукой (над нижним меню) */
.card-actionbar { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px); z-index: 1029;
  display: flex; gap: 8px; padding: 8px; background: rgba(255,255,255,.96); border: 1px solid #dee2e6; border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.card-actionbar[hidden] { display: none; }
.card-actionbar .btn { min-height: 44px; }
[data-bs-theme="dark"] .card-actionbar { background: rgba(33,37,41,.96); border-color: #495057; }
/* самые узкие телефоны: колокольчик занял место — кнопку «?» прячем, справка есть в меню профиля */
@media (max-width: 359.98px) { .app-topbar .help-fab { display: none; } }
/* шахматка */
.u-board { overflow-x: auto; }
.u-floor { display: flex; align-items: stretch; gap: 6px; margin-bottom: 6px; }
.u-floor-n { flex: none; width: 34px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--bs-secondary-color); font-size: .85rem; }
.u-cells { display: flex; gap: 4px; flex-wrap: nowrap; }
.u-cell { flex: none; min-width: 58px; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; display: flex; flex-direction: column; align-items: center; line-height: 1.15; font-size: .85rem; cursor: pointer; }
.u-cell small { font-size: .7rem; opacity: .85; }
.u-cell:focus-visible { outline: 3px solid var(--app-primary); outline-offset: 1px; }
.u-free { background: #d1f2df; color: #0f5132; border-color: #a3dfbd; }
.u-reserved { background: #fff1c2; color: #7a5600; border-color: #f1d77a; }
.u-sold { background: #f8d7da; color: #842029; border-color: #efb1b7; }
.u-closed { background: #e9ecef; color: #6c757d; border-color: #d3d7db; }
.u-dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: .35em; vertical-align: baseline; }
.u-dot.u-free { background: #2fb36b; } .u-dot.u-reserved { background: #e0a800; } .u-dot.u-sold { background: #dc3545; } .u-dot.u-closed { background: #adb5bd; }
[data-bs-theme="dark"] .u-free { background: #12392a; color: #a6e9c3; border-color: #1f6b47; }
[data-bs-theme="dark"] .u-reserved { background: #3d3112; color: #ffe08a; border-color: #7a5d1a; }
[data-bs-theme="dark"] .u-sold { background: #3f1a1e; color: #f5b5bb; border-color: #7d2c34; }
[data-bs-theme="dark"] .u-closed { background: #2b3036; color: #adb5bd; border-color: #444b52; }
@media print { .u-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* шахматка: сравнение и планировка */
.u-cell.u-cmp{outline:3px solid var(--app-primary,#2563eb);outline-offset:1px}
.u-cmp-bar{position:fixed;left:50%;transform:translateX(-50%);bottom:76px;z-index:1040;background:var(--bs-body-bg);border:1px solid var(--bs-border-color);border-radius:999px;padding:.4rem .6rem .4rem 1rem;display:flex;align-items:center;gap:.25rem;white-space:nowrap}
@media (min-width:992px){.u-cmp-bar{bottom:20px}}
.u-plan-img{max-height:260px;object-fit:contain;background:#fff}
.u-cmp-table td,.u-cmp-table th{vertical-align:top}
.u-cmp-table img{max-width:100%;max-height:240px;object-fit:contain;background:#fff}

/* полоска загрузки при смене раздела (js/nav.js) — только если раздел ещё не скачан */
.nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 2000; background: var(--app-primary, #0d6efd); opacity: 0; pointer-events: none; }
.nav-progress.run { opacity: 1; width: 80%; transition: width 2s cubic-bezier(.1,.7,.2,1); }
.nav-progress.done { width: 100%; opacity: 0; transition: width .15s, opacity .25s .1s; }
#main:focus { outline: none; }

/* 3D-вид шахматки */
.u3d { position: relative; overflow: hidden; }
.u3d canvas { touch-action: none; cursor: grab; background: linear-gradient(#b9d6f0 0%, #dcebf7 45%, #eef3f8 100%); }
[data-bs-theme="dark"] .u3d canvas { background: linear-gradient(#1b2028, #12161c); }
.u3d-tip { position: absolute; z-index: 5; max-width: 260px; pointer-events: none; background: rgba(17,24,39,.92); color: #fff; font-size: .8rem; padding: .35rem .55rem; border-radius: .4rem; }
.u3d-load { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* шахматка: подбор и режим «Оплата» */
.u-cell.u-dim { opacity: .18; }
.u-paymode .u-cell:not([class*="pay-"]) { opacity: .28; }
.u-paymode .u-cell.u-dim { opacity: .12; }
.u-block-bar { width: 80px; height: 6px; }
.pay-paid { background: #cfe2ff !important; color: #084298 !important; border-color: #9ec5fe !important; }
.pay-ok { background: #c3f3e2 !important; color: #0b5a43 !important; border-color: #8fdcc1 !important; }
.pay-od30 { background: #fff3cd !important; color: #664d03 !important; border-color: #ffda6a !important; }
.pay-od90 { background: #ffe5d0 !important; color: #7a3a05 !important; border-color: #feb272 !important; }
.pay-od90p { background: #f8d7da !important; color: #842029 !important; border-color: #ea868f !important; font-weight: 600; }
.pay-dispute { background: #e2d9f3 !important; color: #432874 !important; border-color: #c5b3e6 !important; }
.pay-nocontract { background: #e9ecef !important; color: #495057 !important; border-color: #ced4da !important; }
[data-bs-theme="dark"] .pay-paid { background: #0b2a55 !important; color: #9ec5fe !important; border-color: #1d4f99 !important; }
[data-bs-theme="dark"] .pay-ok { background: #0d3b2e !important; color: #8fdcc1 !important; border-color: #1a6b52 !important; }
[data-bs-theme="dark"] .pay-od30 { background: #3d3112 !important; color: #ffda6a !important; border-color: #7a5d1a !important; }
[data-bs-theme="dark"] .pay-od90 { background: #43260c !important; color: #feb272 !important; border-color: #8a4a12 !important; }
[data-bs-theme="dark"] .pay-od90p { background: #4a1a1f !important; color: #f1aeb5 !important; border-color: #8f2d37 !important; }
[data-bs-theme="dark"] .pay-dispute { background: #2c2142 !important; color: #c5b3e6 !important; border-color: #4f3b7a !important; }
[data-bs-theme="dark"] .pay-nocontract { background: #2b3036 !important; color: #adb5bd !important; border-color: #444b52 !important; }
.u-dot.pay-paid { background: #0d6efd !important; } .u-dot.pay-ok { background: #20c997 !important; } .u-dot.pay-od30 { background: #ffc107 !important; }
.u-dot.pay-od90 { background: #fd7e14 !important; } .u-dot.pay-od90p { background: #dc3545 !important; } .u-dot.pay-dispute { background: #6f42c1 !important; }
.u-dot.pay-nocontract { background: #6c757d !important; }
/* шахматка: подъезд — колонка постоянной ширины (по самому полному этажу); на этаже с меньшим числом квартир ячейки шире */
.u-sec { display: flex; gap: 4px; flex: none; width: calc(var(--n, 1) * 62px - 4px); }
.u-sec .u-cell { flex: 1 1 58px; }
.u-sec + .u-sec { margin-left: 14px; padding-left: 14px; border-left: 2px dashed var(--bs-border-color); box-sizing: content-box; }

/* 3D: подъезды — кнопки над моделью и карточка подъезда */
.u3d-entr-list { display: flex; flex-wrap: nowrap; overflow-x: auto; align-items: center; gap: 4px; white-space: nowrap; scrollbar-width: thin; }
.u3d-entr-list:empty { display: none; }
.u3d-entr-list .ue-btn { padding: .05rem .5rem; min-width: 2rem; }
.u3d-entr-list .ue-btn.active { background: var(--app-primary, #2563eb); color: #fff; border-color: transparent !important; }
.u3d-entr-list .ue-sep { display: inline-block; width: 1px; height: 1.2rem; background: var(--bs-border-color); margin: 0 .5rem; }
.u3d-entr { position: absolute; z-index: 6; right: 12px; top: 92px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 140px); overflow: auto;
  background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: .6rem; padding: .7rem .8rem; }
.u3d-entr-grid .ue-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.u3d-entr-grid .ue-f { width: 1.9rem; flex: none; text-align: right; font-size: .75rem; color: var(--bs-secondary-color); margin-right: 3px; border: 0; background: none; padding: 0 3px 0 0; border-radius: 4px; }
.u3d-entr-grid .ue-f:hover, .u3d-entr-grid .ue-f:focus-visible { background: var(--app-primary, #2563eb); color: #fff; }
.u3d-entr-grid .ue-row:hover { background: var(--bs-tertiary-bg); border-radius: 5px; }
.u3d-entr-grid .ue-cell { flex: 1 1 0; min-width: 2.2rem; font-size: .72rem; padding: 2px 3px; border-radius: 5px; border: 1px solid transparent; line-height: 1.2; }
@media (max-width: 767.98px) { .u3d-entr { position: static; width: auto; max-height: none; margin: .5rem; } }
/* 3D: ночь */
.u3d.u3d-night canvas { background: linear-gradient(#050a18 0%, #0f1b33 55%, #1b2640 100%); }
/* 3D: кнопки поверх модели — идти по коридору, выйти из окна */
.u3d-pad { position: absolute; z-index: 7; left: 12px; bottom: 44px; display: flex; flex-direction: column; gap: 6px; }
.u3d-pad button { min-width: 48px; min-height: 48px; border-radius: 12px; border: 1px solid rgba(0,0,0,.15); background: rgba(255,255,255,.9); font-size: 1.2rem; touch-action: none; user-select: none; }
.u3d-pad .u3d-pad-x { font-size: .9rem; padding: 0 .9rem; }
/* 3D: компас и солнце по времени */
.u3d-compass { position: absolute; z-index: 6; right: 12px; bottom: 44px; display: flex; flex-direction: column; align-items: center; pointer-events: none; font-size: .7rem; color: #444; }
.u3d-compass svg { transition: transform .1s linear; }
.u3d-sun { position: absolute; z-index: 6; right: 66px; bottom: 50px; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.9);
  border: 1px solid rgba(0,0,0,.12); border-radius: 999px; padding: 2px 10px; font-size: .8rem; margin: 0; }
.u3d-sun input { width: 110px; }
@media (max-width: 575.98px) { .u3d-sun input { width: 80px; } }

/* тепловая карта шахматки: 0 — холодно (дёшево / не продаётся), 4 — горячо */
.u-heatmode .u-cell:not([class*="heat-"]) { opacity: .25; }
.u-heatmode .u-cell.u-dim { opacity: .12; }
.heat-0 { background: #3d7be0 !important; color: #fff !important; border-color: #2c5fb3 !important; }
.heat-1 { background: #6cc3d5 !important; color: #063c48 !important; border-color: #4aa6ba !important; }
.heat-2 { background: #f2d15c !important; color: #4d3d00 !important; border-color: #d9b53a !important; }
.heat-3 { background: #f39237 !important; color: #fff !important; border-color: #d4741c !important; }
.heat-4 { background: #d9433c !important; color: #fff !important; border-color: #b02f29 !important; }
.u-heatmode .u-cell small { color: inherit !important; opacity: .85; }

/* генплан ЖК с метками блоков */
.upl-wrap { position: relative; display: block; max-width: 100%; user-select: none; }
.upl-wrap img { display: block; width: 100%; height: auto; border-radius: .5rem; }
.upl-mark { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  padding: .2rem .5rem; border: 2px solid #fff; border-radius: .5rem; background: var(--app-primary, #2563eb); color: #fff; font-size: .8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: pointer; white-space: nowrap; }
.upl-mark::after { content: ""; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #fff; }
.upl-mark small { color: #c9f7d8; font-weight: 600; }
.upl-mark:hover, .upl-mark:focus-visible { filter: brightness(1.15); outline: none; }
.upl-editing { cursor: crosshair; outline: 2px dashed var(--app-primary, #2563eb); outline-offset: 2px; border-radius: .5rem; }
.upl-editing .upl-mark { pointer-events: none; opacity: .85; }
.u-block-flash { box-shadow: 0 0 0 3px var(--app-primary, #2563eb) !important; transition: box-shadow .3s; }
#upl-edit-bar[hidden], #u-heat-legend[hidden] { display: none !important; }

/* воронка продаж: доска заявок по этапам */
.ld-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.ld-col { background: var(--bs-tertiary-bg); border-radius: .75rem; padding: .5rem; min-height: 120px; }
.ld-col-h { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; padding: .25rem .25rem .5rem; }
.ld-card { margin-bottom: .5rem; }
.ld-card .dropdown-menu form { margin: 0; }
.ld-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.ld-new { background: #6c8ebf; } .ld-contacted { background: #17a2b8; } .ld-showing { background: #6f42c1; }
.ld-reserved { background: #f0b400; } .ld-contract { background: #2fb36b; } .ld-lost { background: #dc3545; }
.ld-badge.ld-new, .ld-badge.ld-contacted, .ld-badge.ld-showing, .ld-badge.ld-contract, .ld-badge.ld-lost { color: #fff; }
.ld-badge.ld-reserved { color: #3b2c00; }
.ld-bar { height: 1.1rem; border-radius: .35rem; min-width: 2px; }
.ld-progress { display: flex; flex-wrap: wrap; gap: .25rem; }
.ld-step { padding: .2rem .7rem; border-radius: 1rem; background: var(--bs-tertiary-bg); font-size: .85rem; color: var(--bs-secondary-color); }
.ld-step.cur { background: var(--app-primary, #2563eb); color: #fff; font-weight: 600; }
@media (max-width: 767.98px) { .ld-board { grid-auto-columns: 82vw; } }
.sp-in { width: 5rem; text-align: right; } .sp-in-w { width: 9rem; }
.sh-week { display: grid; grid-template-columns: repeat(7, minmax(118px, 1fr)); gap: .5rem; overflow-x: auto; }
.sh-week .sh-cancelled, .sh-week .sh-noshow { opacity: .6; }
.sh-week .sh-done { background: rgba(47, 179, 107, .08); }
@media (max-width: 991.98px) { .sh-week { grid-template-columns: 1fr; } }
/* паркинг: схема подземного этажа */
.pk-floor { background: #3d4248; border-radius: .75rem; padding: .6rem; overflow-x: auto; }
.pk-floor > .small { color: #e9ecef; }
.pk-row { display: flex; gap: 3px; }
.pk-row-b { margin-top: 0; }
.pk-spot { min-width: 46px; height: 70px; border: 2px solid rgba(255,255,255,.85); border-radius: 3px; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px; font-size: .75rem; cursor: pointer; }
.pk-row-b .pk-spot { align-items: flex-start; padding-top: 4px; }
.pk-spot.pk-store { height: 46px; min-width: 40px; }
.pk-lane { height: 34px; display: flex; align-items: center; justify-content: center; color: #f8f9fa; font-size: .7rem; letter-spacing: .1em;
  border-top: 2px dashed rgba(255,255,255,.35); border-bottom: 2px dashed rgba(255,255,255,.35); margin: 4px 0; }
.pk-spot:hover, .pk-spot:focus-visible { outline: 3px solid #fff; outline-offset: 1px; }
/* фото и панорамы квартиры */
.u-photos { display: flex; flex-wrap: wrap; gap: .35rem; }
.u-photos a, .u-photos button { width: 72px; height: 54px; border-radius: .35rem; overflow: hidden; border: 1px solid var(--bs-border-color); padding: 0; position: relative; background: #000; }
.u-photos img { width: 100%; height: 100%; object-fit: cover; }
.u-photos .pano-tag { position: absolute; left: 2px; bottom: 2px; background: rgba(0,0,0,.65); color: #fff; font-size: .65rem; padding: 0 .25rem; border-radius: .2rem; }
.pano-box { position: fixed; inset: 0; z-index: 2000; background: #000; }
.pano-bar { height: 48px; display: flex; align-items: center; gap: .5rem; padding: 0 .75rem; color: #fff; }
.pano-title { margin-right: auto; font-weight: 600; }
.pano-box canvas { display: block; touch-action: none; cursor: grab; }
/* цены конкурентов: горизонтальные столбики, одна шкала */
.cp-row { display: grid; grid-template-columns: minmax(110px, 28%) 1fr auto; gap: .5rem; align-items: center; margin-bottom: 6px; font-size: .85rem; }
.cp-track { background: transparent; }
.cp-bar { height: 14px; border-radius: 0 4px 4px 0; background: #9aa4b1; min-width: 2px; }
.cp-bar.cp-ours { background: var(--app-primary, #2563eb); }
.cp-val { font-variant-numeric: tabular-nums; color: var(--bs-body-color); white-space: nowrap; }
.cp-key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: #9aa4b1; margin-right: .3rem; vertical-align: -1px; }
.cp-key.cp-ours { background: var(--app-primary, #2563eb); }
.cr-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem; }
.cr-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: .4rem; }
.bc-score { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; color: #fff; flex: none; }
.bc-good { background: #2fb36b; } .bc-mid { background: #e0a800; } .bc-bad { background: #dc3545; }
.cf-bar { height: 8px; border-radius: 0 4px 4px 0; min-width: 1px; }
.cf-in { background: #2fb36b; } .cf-out { background: #9aa4b1; }
.cf-key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

/* вкладки раздела вверху страницы (как в Meta Ads: Кампании / Группы / Объявления) */
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bs-border-color); overflow-x: auto; scrollbar-width: none; }
.page-tabs a { padding: 8px 14px; color: var(--bs-secondary-color); text-decoration: none; border-bottom: 3px solid transparent;
  margin-bottom: -1px; white-space: nowrap; font-weight: 500; border-radius: 6px 6px 0 0; }
.page-tabs a:hover { color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
.page-tabs a.active { color: var(--app-primary, #2563eb); border-bottom-color: var(--app-primary, #2563eb); }
.page-tabs .nav-link { padding: 8px 14px; color: var(--bs-secondary-color); border-radius: 6px 6px 0 0; }
.page-tabs .nav-link.active { color: var(--app-primary, #2563eb); border-bottom: 3px solid var(--app-primary, #2563eb); background: transparent; }
.pf-table .pf-block td { background: color-mix(in srgb, #198754 10%, transparent); font-weight: 600; }
.pf-pct { display: inline-block; min-width: 3.5rem; border-radius: 6px; padding: 0 6px; }
.pf-pct.good { background: #d9ead3; color: #1d5b2d; } .pf-pct.mid { background: #fff2cc; color: #7a5a00; } .pf-pct.bad { background: #f4cccc; color: #8a1c1c; }
[data-bs-theme=dark] .pf-pct.good { background: #1f3b27; color: #9fd3ac; } [data-bs-theme=dark] .pf-pct.mid { background: #3d3214; color: #f0d27a; }
[data-bs-theme=dark] .pf-pct.bad { background: #43191c; color: #f1a9ad; }

/* ипотека: воронка этапов */
.mortgage-funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.mf-step { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color); border-top: 4px solid var(--mf, #6c757d); color: var(--bs-body-color); text-decoration: none; }
.mf-step b { font-size: 1.3rem; } .mf-step.active { box-shadow: 0 0 0 2px var(--mf, #6c757d); }
.mf-lawyer { --mf: #6f42c1; } .mf-ready { --mf: #0d6efd; } .mf-submitted { --mf: #0dcaf0; } .mf-review { --mf: #fd7e14; }
.mf-approved { --mf: #20c997; } .mf-rejected { --mf: #dc3545; } .mf-funded { --mf: #198754; }
.mf-badge { background: var(--mf, #6c757d); color: #fff; }

/* Переключатель проектов: у названия компании в меню и чип в шапке */
.scope-switch .brand { cursor: pointer; border-radius: 10px; margin: 4px 6px 0; width: calc(100% - 12px) !important; padding: 8px; }
.scope-switch .brand:hover { background: var(--bs-tertiary-bg); }
.scope-switch .scope-text { min-width: 0; flex: 1; line-height: 1.2; }
.scope-switch .scope-text small { font-weight: 500; font-size: .75rem; }
.scope-switch .scope-on { color: var(--app-primary, #2563eb); font-weight: 600 !important; }
.scope-switch .scope-caret { color: var(--bs-secondary-color); font-size: .9rem; }
.scope-menu { z-index: 1060; min-width: 280px; max-width: min(360px, 92vw); max-height: 70vh; overflow-y: auto; border-radius: 12px; }
.scope-item { display: flex; align-items: center; gap: 10px; border-radius: 8px; padding: 8px 10px; white-space: normal; }
.scope-item > i:first-child { font-size: 1.1rem; color: var(--bs-secondary-color); }
.scope-item.active, .scope-item:active { background: color-mix(in srgb, var(--app-primary, #2563eb) 12%, transparent); color: var(--bs-body-color); }
.scope-item.active > i { color: var(--app-primary, #2563eb); }
.scope-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1);
  color: #fff; border-radius: 999px; padding: 3px 10px; font-size: .82rem; white-space: nowrap; }
.scope-chip.on { background: #fff; color: var(--app-primary, #2563eb); font-weight: 600; border-color: #fff; }
.scope-chip:hover { background: rgba(255,255,255,.2); }
.scope-chip.on:hover { background: #f1f4f8; }
@media (max-width: 575.98px) { .scope-chip { max-width: 104px; padding: 4px 8px; } .scope-chip .bi-chevron-down { display: none; }
  .scope-chip-wrap.off .scope-chip span { display: none; } .app-topbar form[role=search] { min-width: 90px; } }
html.nav-mini .scope-switch .brand { justify-content: center; padding: 12px 0; margin: 0; width: 100% !important; }
html.nav-mini .scope-switch .scope-text, html.nav-mini .scope-switch .scope-caret { display: none; }
@media (min-width: 1024px) { html:not(.nav-mini) .scope-chip-wrap.off { display: none; } }

/* Конструктор отчёта: шаги, календарь «с … по …», флажки проектов и разделов */
.rb-step { font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rb-num { width: 24px; height: 24px; border-radius: 50%; background: var(--app-primary, #2563eb); color: #fff; font-size: .8rem;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; }
#rb-form.rb-collapsed .rb-params { display: none; }
.rc-preset { border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); color: var(--bs-body-color); border-radius: 999px;
  padding: 4px 12px; font-size: .85rem; }
.rc-preset:hover { background: var(--bs-tertiary-bg); }
.rc-preset.active { background: var(--app-primary, #2563eb); border-color: var(--app-primary, #2563eb); color: #fff; }
.rc-months { display: grid; grid-template-columns: 1fr; gap: 24px; max-width: 640px; user-select: none; }
@media (min-width: 768px) { .rc-months { grid-template-columns: 1fr 1fr; } }
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rc-title { font-weight: 600; text-transform: capitalize; }
.rc-nav { border: 0; background: var(--bs-tertiary-bg); width: 30px; height: 30px; border-radius: 8px; font-size: 1.1rem; line-height: 1; color: var(--bs-body-color); }
.rc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; text-align: center; }
.rc-wd { font-size: .72rem; color: var(--bs-secondary-color); padding: 2px 0 4px; text-transform: lowercase; }
.rc-day { border: 0; background: none; height: 36px; font-size: .88rem; color: var(--bs-body-color); border-radius: 0; }
.rc-day:hover { background: var(--bs-tertiary-bg); border-radius: 8px; }
.rc-day.today { font-weight: 700; text-decoration: underline; }
.rc-day.in { background: color-mix(in srgb, var(--app-primary, #2563eb) 14%, transparent); }
.rc-day.edge { background: var(--app-primary, #2563eb); color: #fff; font-weight: 600; }
.rc-day.start { border-radius: 8px 0 0 8px; } .rc-day.end { border-radius: 0 8px 8px 0; } .rc-day.start.end { border-radius: 8px; }
.rb-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.rb-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bs-border-color); border-radius: 999px; padding: 4px 12px 4px 8px;
  cursor: pointer; font-size: .88rem; }
.rb-check:has(input:checked) { border-color: var(--app-primary, #2563eb); background: color-mix(in srgb, var(--app-primary, #2563eb) 10%, transparent); }
.rb-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.rb-sec { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.rb-sec input { margin-top: 4px; }
.rb-sec small { display: block; color: var(--bs-secondary-color); font-size: .78rem; }
.rb-sec:has(input:checked) { border-color: var(--app-primary, #2563eb); background: color-mix(in srgb, var(--app-primary, #2563eb) 6%, transparent); }
.rb-tpl { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--bs-border-color); border-radius: 999px; padding: 2px 4px 2px 12px; font-size: .85rem; }
.rb-tpl a { text-decoration: none; }
.rb-tpl.active { border-color: var(--app-primary, #2563eb); background: color-mix(in srgb, var(--app-primary, #2563eb) 10%, transparent); font-weight: 600; }
.rb-tpl-x { border: 0; background: none; color: var(--bs-secondary-color); font-size: 1rem; line-height: 1; padding: 0 6px; }
.rb-tpl-x:hover { color: var(--bs-danger); }

/* --- мелочи вёрстки --- */
/* место под круглую кнопку ИИ-помощника справа внизу: последние строки и кнопки не прячутся под ней */
@media (min-width: 1024px) { .app-main { padding-bottom: 88px; } }
@media (max-width: 1023.98px) { .app-main { padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 80px); } }
/* названия проектов и менеджеров в отчётах — в одну строку, а не «ЖК / «Навруз / Сити»» */
.pf-table td:first-child, .pf-table th:first-child { white-space: nowrap; min-width: 10rem; }
.pf-table th { white-space: normal; min-width: 6.5rem; vertical-align: bottom; }
/* шапка на телефоне: поиск не сжимается в «Поиск к», вопрос — в меню «Ещё» */
@media (max-width: 575.98px) {
  .app-topbar { gap: 4px !important; }
  .app-topbar .help-fab { display: none; }
  .app-topbar form[role=search] { min-width: 0 !important; flex: 1 1 auto; }
  .scope-chip span { display: none; }
  .scope-chip { padding: 4px 8px; max-width: none; }
  .scope-chip.on { padding: 4px 8px; }
  .scope-chip.on span { display: inline; max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 768px) { .pr-name { min-width: 11rem; } }
/* старение долга: названия объектов в одну строку */
.aging-table td:first-child { white-space: nowrap; }
/* свёрнутое меню: список проектов открывается справа от узкой полосы, а не поверх значков */
@media (min-width: 1024px) {
  html.nav-mini .scope-switch .scope-menu.show { position: fixed !important; inset: 8px auto auto calc(var(--rail-w) + 8px) !important; transform: none !important; margin: 0 !important; }
}

/* умное меню: плавное сворачивание и подсказки-названия у значков */
html.nav-anim .app-sidebar { transition: width .18s ease; }
html.nav-anim .app-topbar, html.nav-anim .app-main { transition: margin-left .18s ease; }
html.nav-anim .sidebar-toggle { transition: left .18s ease; }
.nav-tip { position: fixed; z-index: 1080; background: #1d2733; color: #fff; font-size: .82rem; font-weight: 500; padding: 5px 10px;
  border-radius: 8px; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.nav-tip::before { content: ""; position: absolute; left: -5px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-left: 0; border-right-color: #1d2733; }
@media (prefers-reduced-motion: reduce) { html.nav-anim .app-sidebar, html.nav-anim .app-topbar, html.nav-anim .app-main { transition: none; } }

.rb-delta { font-size: .75rem; font-weight: 600; white-space: nowrap; color: var(--bs-secondary-color); }
.rb-delta.good { color: #198754; } .rb-delta.bad { color: #dc3545; }
.rb-dset { border-top: 1px dashed var(--bs-border-color); padding-top: 12px; }

/* план-факт как в таблице клиента */
.pf-client td, .pf-client th { border: 1px solid var(--bs-border-color); }
.pf-client thead th { font-style: italic; font-size: .78rem; text-align: center !important; vertical-align: middle; background: var(--bs-body-bg); }
.pf-client .pf-grand td { font-weight: 700; font-style: italic; }
.pf-client .pf-block td { background: #c6e0b4; font-weight: 700; font-style: italic; border-top: 2px solid #555; }
.pf-client .pf-c.good { background: #c6efce; } .pf-client .pf-c.mid { background: #ffeb9c; } .pf-client .pf-c.bad { background: #ffc7ce; }
.pf-client .u-flat { background: #ddebf7; } .pf-client .u-park { background: #fce4d6; } .pf-client .u-store { background: #e2efda; }
.pf-client .pf-gap { border: 0 !important; background: transparent !important; width: 10px; padding: 0; }
.pf-client .pf-none { border: 0 !important; background: transparent !important; }
[data-bs-theme=dark] .pf-client .pf-block td { background: #2e4a2a; } [data-bs-theme=dark] .pf-client .pf-c.good { background: #1f4d2c; }
[data-bs-theme=dark] .pf-client .pf-c.mid { background: #5a4b12; } [data-bs-theme=dark] .pf-client .pf-c.bad { background: #5a2329; }
[data-bs-theme=dark] .pf-client .u-flat { background: #22344a; } [data-bs-theme=dark] .pf-client .u-park { background: #4a3226; } [data-bs-theme=dark] .pf-client .u-store { background: #263d26; }
.pf-client { width: auto; min-width: 100%; }
.pf-client .pf-gap { width: 14px; min-width: 14px; max-width: 14px; }
.pf-client th:not(.pf-gap) { min-width: 6.5rem; }

/* кнопки одного нажатия под полем формы: готовые даты и суммы */
.fill-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.fill-chips button { border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); color: var(--bs-secondary-color); border-radius: 999px;
  padding: 1px 9px; font-size: .75rem; line-height: 1.5; }
.fill-chips button:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.fill-chips button.active { background: var(--app-primary, #2563eb); border-color: var(--app-primary, #2563eb); color: #fff; }

/* простой режим: в карточке клиента этапы взыскания свёрнуты до одной строки */
.stage-compact .stage-steps, .stage-compact .stage-steps ~ div { display: none !important; }
.stage-card:not(.stage-compact) .stage-more i { transform: rotate(180deg); }

/* кнопка «Админ-панель» в меню — только разработчику платформы */
.app-sidebar .nav-link.nav-admin { background: color-mix(in srgb, var(--app-primary, #2563eb) 10%, transparent); color: var(--app-primary, #2563eb); font-weight: 600; }
.app-sidebar .nav-link.nav-admin i { color: var(--app-primary, #2563eb); }

/* ---------- техподдержка в кабинете ---------- */
.sup-hero { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; padding: 20px 22px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--app-primary, #2563eb), color-mix(in srgb, var(--app-primary, #2563eb) 55%, #6d5cff)); box-shadow: 0 14px 34px -18px rgba(31,78,121,.8); }
.sup-hero-ico { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 18px; display: grid; place-items: center; font-size: 1.6rem; background: rgba(255,255,255,.16); color: #fff; }
.sup-hero-txt { flex: 1 1 320px; min-width: 0; } .sup-hero-txt h1 { color: #fff; font-weight: 700; } .sup-hero-txt p { opacity: .88; font-size: .93rem; max-width: 62ch; }
.sup-contacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sup-contacts a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.14); color: #fff; font-size: .82rem; text-decoration: none; }
.sup-contacts a:hover { background: rgba(255,255,255,.26); color: #fff; }
.sup-hero-btn { border-radius: 14px; font-weight: 600; padding: 10px 18px; color: var(--app-primary, #2563eb); border: 0; }
.sup-box { display: grid; grid-template-columns: 330px 1fr; min-height: 520px; height: calc(100vh - 330px); max-height: 760px; border-radius: 20px; overflow: hidden;
  background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); box-shadow: 0 10px 30px -22px rgba(20,30,60,.5); }
.sup-side { display: flex; flex-direction: column; border-right: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); min-height: 0; }
.sup-side-head { padding: 16px 18px 10px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sup-side-head span { font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.sup-list { overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.sup-item { display: flex; gap: 11px; padding: 11px 12px; border-radius: 14px; color: var(--bs-body-color); text-decoration: none; transition: background .12s; }
.sup-item:hover { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.sup-item.on { background: var(--bs-body-bg); box-shadow: 0 4px 16px -8px rgba(20,30,60,.45), inset 3px 0 0 var(--app-primary, #2563eb); }
.sup-item-body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.sup-item-top { display: flex; gap: 8px; align-items: baseline; } .sup-item-top b { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.sup-item-top time { font-size: .72rem; color: var(--bs-secondary-color); white-space: nowrap; }
.sup-item-text { font-size: .82rem; color: var(--bs-secondary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-kind { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.05rem; }
.sup-kind.k-bug { background: #ffe6e8; color: #dc3545; } .sup-kind.k-question { background: #e6f0ff; color: #2f6fed; }
.sup-kind.k-idea { background: #fff4d6; color: #c98a00; } .sup-kind.k-other { background: #ece9ff; color: #6d4dff; }
.sup-st { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; width: fit-content; white-space: nowrap; }
.sup-st i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sup-st.st-new { color: #dc3545; } .sup-st.st-done { color: #159a52; } .sup-st.st-wait { color: var(--bs-secondary-color); }
.sup-st.st-new i { box-shadow: 0 0 0 4px rgba(220,53,69,.18); }
.sup-none { text-align: center; color: var(--bs-secondary-color); padding: 34px 12px; font-size: .9rem; } .sup-none i { display: block; font-size: 1.8rem; opacity: .5; margin-bottom: 6px; }
.sup-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sup-head { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--bs-border-color); }
.sup-back { display: none; width: 36px; height: 36px; border-radius: 50%; place-items: center; color: var(--bs-body-color); background: var(--bs-tertiary-bg); text-decoration: none; }
.sup-thread { flex: 1 1 auto; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 0;
  background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--app-primary, #2563eb) 6%, transparent), transparent 55%); }
.sup-day { text-align: center; margin: 6px 0; } .sup-day span { font-size: .72rem; font-weight: 600; padding: 3px 12px; border-radius: 999px; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }
.sup-row { display: flex; gap: 9px; align-items: flex-end; max-width: 78%; } .sup-row.sup-out { align-self: flex-end; } .sup-row.sup-in { align-self: flex-start; }
.sup-ava { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .9rem;
  background: linear-gradient(135deg, #6d5cff, #3b82f6); }
.sup-msg { padding: 9px 13px 6px; border-radius: 18px; overflow-wrap: anywhere; min-width: 70px; box-shadow: 0 1px 2px rgba(20,30,60,.08); }
.sup-out .sup-msg { background: var(--app-primary, #2563eb); color: #fff; border-bottom-right-radius: 6px; }
.sup-in .sup-msg { background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-bottom-left-radius: 6px; }
.sup-text { white-space: pre-wrap; } .sup-who { font-size: .74rem; font-weight: 700; color: #6d5cff; margin-bottom: 1px; }
.sup-msg time { display: block; text-align: right; font-size: .68rem; opacity: .65; margin-top: 2px; }
.sup-img { display: block; margin: 4px 0; } .sup-img img { max-width: 100%; max-height: 260px; border-radius: 12px; display: block; }
.sup-rate { align-self: center; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; align-items: center; margin-top: 8px; padding: 10px 14px; border-radius: 16px;
  background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); box-shadow: 0 6px 18px -12px rgba(20,30,60,.5); font-size: .88rem; }
.sup-rate-btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 14px; font-weight: 600; font-size: .84rem; border: 1px solid; background: transparent; }
.sup-rate-btn.yes { color: #159a52; border-color: #159a52; } .sup-rate-btn.yes:hover { background: #159a52; color: #fff; }
.sup-rate-btn.no { color: #dc3545; border-color: #dc3545; } .sup-rate-btn.no:hover { background: #dc3545; color: #fff; }
.sup-rated { align-self: center; font-size: .84rem; color: #159a52; padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, #159a52 12%, transparent); }
.sup-compose { padding: 12px 16px 14px; border-top: 1px solid var(--bs-border-color); }
.sup-bar { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 22px; background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); transition: border-color .12s, box-shadow .12s; }
.sup-bar:focus-within { border-color: var(--app-primary, #2563eb); box-shadow: 0 0 0 4px color-mix(in srgb, var(--app-primary, #2563eb) 18%, transparent); }
.sup-bar textarea { flex: 1 1 auto; border: 0; outline: 0; background: transparent; color: var(--bs-body-color); resize: none; padding: 7px 4px; max-height: 140px; line-height: 1.4; }
.sup-clip, .sup-send { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer; margin: 0; }
.sup-clip { color: var(--bs-secondary-color); background: transparent; font-size: 1.15rem; } .sup-clip:hover { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.sup-send { background: var(--app-primary, #2563eb); color: #fff; } .sup-send:hover { filter: brightness(1.15); }
.sup-file-name { font-size: .8rem; color: var(--bs-secondary-color); } .sup-compose .sup-file-name.on { margin: 0 0 6px 8px; }
.sup-new { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sup-topics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sup-topic { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 1.5px solid var(--bs-border-color); cursor: pointer; font-weight: 600; font-size: .9rem; transition: border-color .12s, background .12s; }
.sup-topic:hover { background: var(--bs-tertiary-bg); }
.btn-check:checked + .sup-topic { border-color: var(--app-primary, #2563eb); background: color-mix(in srgb, var(--app-primary, #2563eb) 9%, transparent); }
.btn-check:focus-visible + .sup-topic { outline: 2px solid var(--app-primary, #2563eb); outline-offset: 2px; }
.sup-area { border-radius: 16px; padding: 12px 14px; }
.sup-drop { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1.5px dashed var(--bs-border-color); cursor: pointer; color: var(--bs-secondary-color); }
.sup-drop:hover { border-color: var(--app-primary, #2563eb); background: var(--bs-tertiary-bg); } .sup-drop > i { font-size: 1.5rem; }
.sup-drop b { display: block; color: var(--bs-body-color); font-size: .9rem; } .sup-drop small { display: block; font-size: .78rem; }
.sup-drop .sup-file-name { margin-left: auto; font-weight: 600; color: var(--app-primary, #2563eb); }
.sup-submit { border-radius: 14px; padding-inline: 26px; }
.sup-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px; text-align: center; color: var(--bs-secondary-color); }
.sup-empty .sup-hero-ico { background: color-mix(in srgb, var(--app-primary, #2563eb) 12%, transparent); color: var(--app-primary, #2563eb); width: 72px; height: 72px; font-size: 2rem; border-radius: 24px; }
[data-bs-theme=dark] .sup-kind.k-bug { background: #401c22; color: #ff8a94; } [data-bs-theme=dark] .sup-kind.k-question { background: #1a2b4d; color: #7fb0ff; }
[data-bs-theme=dark] .sup-kind.k-idea { background: #3d3212; color: #f5c452; } [data-bs-theme=dark] .sup-kind.k-other { background: #2a2350; color: #b3a2ff; }
[data-bs-theme=dark] .sup-who { color: #a99cff; } [data-bs-theme=dark] .sup-st.st-done, [data-bs-theme=dark] .sup-rated { color: #5fd698; } [data-bs-theme=dark] .sup-st.st-new { color: #ff8a94; }
[data-bs-theme=dark] .sup-out .sup-msg { background: color-mix(in srgb, var(--app-primary, #2563eb) 80%, #fff); }
[data-bs-theme=dark] .sup-hero-btn { background: #fff; }
@media (max-width: 991.98px) {
  .sup-box { grid-template-columns: 1fr; height: auto; max-height: none; min-height: 0; }
  .sup-side { border-right: 0; } .sup-hide-sm { display: none !important; } .sup-back { display: grid; }
  .sup-thread { max-height: 56vh; min-height: 240px; } .sup-row { max-width: 90%; } .sup-hero { padding: 16px; } .sup-hero-btn { width: 100%; }
}
/* выбранный проект в шапке — в тёмном режиме не белая плашка, а в тон шапке */
[data-bs-theme=dark] .scope-chip.on { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.32); }
[data-bs-theme=dark] .scope-chip.on:hover { background: rgba(255,255,255,.22); }
@media (max-width: 991.98px) { .sup-hero.sup-hide-sm { display: none !important; } .sup-head { padding: 10px 12px; gap: 9px; } .sup-head .small { display: none; } .sup-thread { max-height: 62vh; } }
/* «Проблемные»: место — причине и разговору, а не шапке про обещания */
.pr-table .pr-talk { min-width: 17rem; } .pr-table .pr-plan { min-width: 10rem; max-width: 16rem; }
.pr-table th.pr-narrow { white-space: normal; max-width: 7.5rem; line-height: 1.2; }

/* импорт: шаги и окно загрузки файла */
.imp-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 18px; }
.imp-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); font-size: .88rem; font-weight: 600; }
.imp-steps li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bs-secondary-bg); font-size: .8rem; }
.imp-steps li.on { background: color-mix(in srgb, var(--app-primary, #2563eb) 12%, transparent); color: var(--app-primary, #2563eb); }
.imp-steps li.on span { background: var(--app-primary, #2563eb); color: #fff; }
.imp-steps li.done span { background: #159a52; color: #fff; }
.imp-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 18px; padding: 20px; box-shadow: 0 10px 28px -22px rgba(20,30,60,.5); }
.imp-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 250px; padding: 26px 18px; cursor: pointer; margin: 0;
  border: 2px dashed color-mix(in srgb, var(--app-primary, #2563eb) 35%, var(--bs-border-color)); border-radius: 16px;
  background: color-mix(in srgb, var(--app-primary, #2563eb) 4%, transparent); transition: background .15s, border-color .15s, transform .15s; }
.imp-drop:hover, .imp-drop.over { background: color-mix(in srgb, var(--app-primary, #2563eb) 10%, transparent); border-color: var(--app-primary, #2563eb); }
.imp-drop.over { transform: scale(1.01); } .imp-drop.has { border-style: solid; border-color: #159a52; background: color-mix(in srgb, #159a52 7%, transparent); }
.imp-drop-ico { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; font-size: 2rem; color: #fff;
  background: linear-gradient(135deg, var(--app-primary, #2563eb), color-mix(in srgb, var(--app-primary, #2563eb) 55%, #6d5cff)); box-shadow: 0 12px 24px -12px rgba(31,78,121,.8); }
.imp-drop-title { font-size: 1.08rem; } .imp-drop-sub { font-size: .86rem; color: var(--bs-secondary-color); max-width: 44ch; }
.imp-file { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 14px; border-radius: 12px; background: var(--bs-body-bg); border: 1px solid #159a52; font-weight: 600; max-width: 100%; }
.imp-file i { color: #159a52; font-size: 1.2rem; } .imp-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .imp-file small { color: var(--bs-secondary-color); font-weight: 400; white-space: nowrap; }
.imp-h { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; } .imp-h i { color: var(--app-primary, #2563eb); font-size: 1.15rem; }
.imp-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .9rem; }
.imp-list li { position: relative; padding-left: 26px; } .imp-list li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; color: #159a52; background: color-mix(in srgb, #159a52 15%, transparent); margin-top: 2px; }
.imp-langs { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; } .imp-langs a { padding: 5px 10px; border-radius: 999px; background: var(--bs-tertiary-bg); font-size: .8rem; text-decoration: none; color: var(--bs-body-color); }
.imp-langs a:hover { background: var(--bs-secondary-bg); }
[data-bs-theme=dark] .imp-steps li.on, [data-bs-theme=dark] .imp-h i { color: #9ec5ff; }

.imp-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.imp-sum-i { padding: 10px 14px; border-radius: 14px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); }
.imp-sum-i b { display: block; font-size: 1.4rem; line-height: 1.15; } .imp-sum-i span { font-size: .78rem; color: var(--bs-secondary-color); }
.imp-sum-i.warn { border-color: #e0a800; } .imp-sum-i.warn b { color: #b98900; } .imp-sum-i.bad { border-color: #dc3545; } .imp-sum-i.bad b { color: #dc3545; }

/* предпросмотр импорта — спокойно: одна строка итога, короткий список «проверьте», остальное свёрнуто */
.imp-ready { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 18px; margin-bottom: 14px;
  background: color-mix(in srgb, #159a52 8%, var(--bs-body-bg)); border: 1px solid color-mix(in srgb, #159a52 30%, transparent); }
.imp-ready-ico { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; display: grid; place-items: center; background: #159a52; color: #fff; font-size: 1.3rem; }
.imp-ready b { font-size: 1.08rem; } .imp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.imp-chips span { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); color: var(--bs-secondary-color); }
.imp-chips .c-new { color: #159a52; border-color: color-mix(in srgb, #159a52 40%, transparent); } .imp-chips .c-chg { color: #b98900; border-color: #e6c35c; }
.imp-chips .c-err { color: #dc3545; border-color: color-mix(in srgb, #dc3545 40%, transparent); }
.imp-check { border-radius: 18px; border: 1px solid #e6c35c; background: color-mix(in srgb, #f0b429 7%, var(--bs-body-bg)); margin-bottom: 14px; overflow: hidden; }
.imp-check-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px 10px; } .imp-check-head b { display: block; }
.imp-check-head small { color: var(--bs-secondary-color); font-size: .84rem; } .imp-all { font-size: .86rem; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; margin: 0; }
.imp-row { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 18px; border-top: 1px solid color-mix(in srgb, #e6c35c 60%, transparent); cursor: pointer; margin: 0; }
.imp-row:hover { background: color-mix(in srgb, #f0b429 9%, transparent); } .imp-row.plain { cursor: default; border-top-color: var(--bs-border-color); padding-inline: 4px; }
.imp-row.plain:hover { background: transparent; }
.imp-row-who { flex: 0 0 15rem; min-width: 0; } .imp-row-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .imp-row-who small { color: var(--bs-secondary-color); }
.imp-row-ch { flex: 1 1 18rem; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .88rem; } .imp-row-ch s { color: var(--bs-secondary-color); text-decoration-thickness: 1px; }
.imp-row-ch i { font-size: .75rem; color: var(--bs-secondary-color); }
.imp-more { margin-bottom: 12px; border-radius: 14px; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); padding: 0 16px; }
.imp-more > summary { padding: 11px 0; cursor: pointer; font-size: .9rem; color: var(--bs-secondary-color); list-style-position: inside; }
.imp-more[open] > summary { border-bottom: 1px solid var(--bs-border-color); margin-bottom: 10px; color: var(--bs-body-color); font-weight: 600; }
.imp-more[open] { padding-bottom: 12px; } .imp-more .card { box-shadow: none !important; }
.imp-notes { display: grid; gap: 8px; } .imp-note { font-size: .86rem; color: var(--bs-secondary-color); } .imp-note i { color: var(--app-primary, #2563eb); }
.imp-w { font-size: .78rem; color: var(--bs-secondary-color); }
@media (max-width: 575.98px) { .imp-row-who { flex-basis: 100%; } .imp-ready .btn { width: 100%; } }

/* галочки в «Проверьте договоры»: круглая отметка вместо системного квадратика */
.imp-all { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid #e6c35c; background: var(--bs-body-bg);
  font-size: .84rem; font-weight: 600; color: #8a6a00; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.imp-all:hover { background: color-mix(in srgb, #f0b429 16%, var(--bs-body-bg)); } .imp-all.on { background: #159a52; border-color: #159a52; color: #fff; }
.imp-tick { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #d3b24a; background: var(--bs-body-bg);
  color: transparent; font-size: .85rem; transition: background .15s, border-color .15s, transform .15s; }
.imp-row:hover .imp-tick { border-color: #159a52; }
.imp-ok:checked + .imp-tick { background: #159a52; border-color: #159a52; color: #fff; transform: scale(1.06); }
.imp-ok:focus-visible + .imp-tick { outline: 2px solid var(--app-primary, #2563eb); outline-offset: 2px; }
.imp-row:has(.imp-ok:checked) { background: color-mix(in srgb, #159a52 8%, transparent); }
.imp-row:has(.imp-ok:checked) .imp-row-ch s { opacity: .6; }
[data-bs-theme=dark] .imp-all { color: #f5c452; }

/* Взаиморасчёты — вид привычной таблицы Excel: голубая шапка, зелёная колонка суммы, красная просрочка */
.ledger { font-size: .74rem; border-collapse: separate; border-spacing: 0; white-space: nowrap; }
.ledger thead th { background: #9fc5e8 !important; color: #10243a; font-weight: 700; text-align: center; vertical-align: middle; white-space: normal;
  border: 1px solid #7fa9cf; padding: .3rem .35rem; line-height: 1.15; }
.ledger td { border: 1px solid #e3e6ea; padding: .16rem .4rem; vertical-align: middle; }
.ledger td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ledger .lg-name { white-space: normal; min-width: 12rem; max-width: 17rem; position: sticky; left: 0; background: var(--bs-body-bg); z-index: 1; }
.ledger thead th:first-child { position: sticky; left: 0; z-index: 4; }
.ledger .lg-green { background: #d9ead3; }
.ledger .lg-red { color: #cc1616; font-weight: 600; }
.ledger tbody tr:hover td { background: #eef5fc; }
.ledger tbody tr:hover td.lg-green { background: #cfe4c7; }
.ledger tfoot td { font-weight: 700; background: #f3f6f9; border: 1px solid #d5dae0; padding: .3rem .4rem; position: sticky; bottom: 0; z-index: 2; }
.ledger tfoot td:first-child { left: 0; z-index: 3; }
.ledger-wrap { max-height: 74vh; }
[data-bs-theme=dark] .ledger thead th { background: #27496b !important; color: #e8f1fa; border-color: #35597e; }
[data-bs-theme=dark] .ledger td { border-color: #2f3640; }
[data-bs-theme=dark] .ledger .lg-green { background: #23402a; }
[data-bs-theme=dark] .ledger .lg-red { color: #ff7b7b; }
[data-bs-theme=dark] .ledger tbody tr:hover td { background: #26303b; }
[data-bs-theme=dark] .ledger tbody tr:hover td.lg-green { background: #2b4d33; }
[data-bs-theme=dark] .ledger tfoot td { background: #222a33; border-color: #2f3640; }

.ledger .lg-tick { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; border-radius: 50%;
  border: 1.5px solid #b9c2cc; color: transparent; cursor: pointer; font-size: .8rem; transition: all .12s; margin: 0; }
.ledger .lg-chk:checked + .lg-tick { background: #1e9e5a; border-color: #1e9e5a; color: #fff; }
.ledger .lg-chk:disabled + .lg-tick { cursor: default; opacity: .6; }
.ledger .lg-chk:focus-visible + .lg-tick { outline: 2px solid #5b9bd5; outline-offset: 1px; }
[data-bs-theme=dark] .ledger .lg-tick { border-color: #55606c; }
.ledger td.lg-cell { position: relative; }      /* скрытый флажок остаётся внутри своей ячейки: фокус на нём не сдвигает страницу */

/* взаиморасчёты: позвонить, записать звонок и внести платёж — прямо из строки; колонка закреплена справа */
.ledger .lg-act { position: sticky; right: 0; background: var(--bs-body-bg); z-index: 1; padding: .1rem .3rem; border-left: 1px solid #d5dae0; }
.ledger thead th.lg-act { z-index: 4; min-width: 0; }
.ledger .lg-act .btn { padding: 1px 7px; min-height: 0; min-width: 0; font-size: .82rem; line-height: 1.5; }
.ledger tbody tr:hover td.lg-act { background: #eef5fc; }
[data-bs-theme=dark] .ledger .lg-act { border-left-color: #2f3640; }
[data-bs-theme=dark] .ledger tbody tr:hover td.lg-act { background: #26303b; }
/* тёмная тема: выбранная вкладка — светлый акцент, а не тёмно-синий на тёмном (было почти не видно) */
[data-bs-theme=dark] .page-tabs a.active, [data-bs-theme=dark] .page-tabs .nav-link.active { color: #8fb8ff; border-bottom-color: #8fb8ff; }
[data-bs-theme=dark] .report-tabs .nav-link.active { color: #fff; background: #2f6fed; border-color: #2f6fed; }
