/*
 * Компактный вид и печать — перенос legacy `custom.css` (Filament 3) на Filament 5.11.
 * Селекторы `fi-*` сверены с vendor/filament/*/resources/{css,views} этой версии:
 * в v4/v5 утилиты Tailwind в разметке заменены семантическими классами, поэтому
 * старые цели (`.p-6`, `.gap-6`, `.w-1`, `.shadow-*`, `.fi-ta-checkbox-cell`,
 * `.fi-ta-actions-cell`, `.fi-ta-header-cell-sort-icon`) переписаны на актуальные.
 */

/* ===== ПЛОТНЫЕ ТАБЛИЦЫ ===== */

/*
 * В v5 у `.fi-ta-cell` уже `padding: 0`, вертикальный отступ задаёт содержимое
 * колонки (`.fi-ta-text` и т.п. — `py-4`) внутри обёртки `.fi-ta-col`.
 * Legacy-правило `.fi-ta-cell div` поэтому раскрыто в три цели.
 */
.fi-ta-cell,
.fi-ta-cell .fi-ta-col,
.fi-ta-cell .fi-ta-col > * {
    padding-top: 0.5px !important;
    padding-bottom: 1px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.fi-ta-ctn {
    position: relative;
}

.fi-ta-empty-state {
    padding-bottom: 1rem !important;
    padding-top: 1rem !important;
}

/* Шапка таблицы (заголовок + действия) и тулбар поиска. */
.fi-ta-header {
    padding: 0.7rem 1.5rem !important;
}

.fi-ta-header-cell {
    padding-bottom: 0.5rem !important;
    padding-top: 0.5rem !important;
}

/* ===== КЛАССЫ ДЛЯ ФОНОВЫХ ЛИНИЙ ===== */
/* Имена сохранены как в legacy — на них рассчитывают отчёты и графики. */
.backgraund-line {
    background-color: rgba(22, 163, 74, 1);
    color: white;
}

.backgraund-line-blue {
    background-color: rgb(121, 204, 245);
    color: white;
}

.backgraund-line-orange {
    background-color: rgb(252, 139, 18);
    color: white;
}

.backgraund-line-birthday {
    background-color: rgb(209, 255, 196);
}

.backgraund-line-red {
    background-color: rgb(229, 27, 27);
    color: white !important;
}

.column-color-class {
    background-color: rgba(22, 163, 74, 1) !important;
    color: white !important;
    padding: 4px !important;
    border-radius: 7px !important;
}

/* Белый текст наследует вся строка: ячейки колонок, их содержимое и legacy-подписи.
   Кнопки действий живут вне `.fi-ta-col`, поэтому свой цвет сохраняют; бейджи тоже. */
.backgraund-line .fi-ta-col,
.backgraund-line .fi-ta-col *:not(.fi-badge):not(.fi-badge *),
.backgraund-line .fi-ta-text-item,
.backgraund-line .fi-ta-text-item-label {
    color: white;
}

/* ===== КОМПАКТНАЯ РАСКЛАДКА ===== */
.fi-tabs {
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}

.fi-header-heading {
    font-size: 1.5rem !important;
}

/* v3 `.gap-6` → v5 держит этот отступ в `.fi-sc-has-gap`; шаг между секциями
   страницы в v5 вырос до 2rem (`.fi-page-content`), возвращаем legacy-плотность. */
.fi-sc-has-gap {
    gap: 1rem !important;
}

.fi-page-content {
    row-gap: 1rem;
}

.fi-input-admin input {
    padding: 0 !important;
}

/* v3 `.fi-section-admin .p-6` → класс вешается на внешнюю обёртку секции
   (`extraAttributes` попадают на `.fi-sc-section`), поэтому селектор вложенный. */
.erp-compact .fi-section-content {
    padding: 0.5rem 1.5rem !important;
}

.erp-compact .fi-section-header {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Колонки дня не растягиваются друг под друга — legacy `align-self: start`. */
.erp-day-column {
    align-self: start;
}

/* Блок «Отчёт смены» в синей рамке (design §2.1). */
.erp-shift-report {
    border: 3px solid #2563eb;
    border-radius: 15px;
}

.onlyprint {
    display: none !important;
}

/* ======================================== */
/* ===== СТИЛИ ДЛЯ ПЕЧАТИ ===== */
/* ======================================== */
@media print {
    /* Каркас Filament 5 (`.fi-layout{height:100%;overflow-x:clip}`,
       `.fi-main-ctn{min-height:100dvh;display:flex}`) резал распечатку суточника
       по первой странице и по правому краю листа — на печати распускаем его.
       В Filament 3 такого не было, поэтому в legacy-css правил нет. */
    .fi-layout,
    .fi-main-ctn {
        display: block !important;
    }

    .fi-layout,
    .fi-main-ctn,
    .fi-main,
    .fi-page {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    /* Таблицы v5 живут в прокручиваемом контейнере — правые колонки уезжали за лист. */
    .fi-ta-ctn,
    .fi-ta-content-ctn {
        overflow: visible !important;
    }

    /* Светлая схема: фоны ниже гасятся, а в тёмной теме текст оставался светлым
       и распечатка выходила почти пустой. */
    :root,
    .fi-body {
        color-scheme: light !important;
    }

    .fi-body,
    .fi-body * {
        color: #000 !important;
    }

    /* ----- Скрываем элементы интерфейса ----- */
    .noprint {
        display: none !important;
    }

    .onlyprint {
        display: block !important;
    }

    .fi-topbar,
    .fi-sidebar,
    .fi-sidebar-nav,
    .fi-sidebar-close-overlay,
    .fi-pagination,
    /* заголовок секции на печати нужен — уходят только кнопки действий в нём
       (Filament 5 кладёт их в `.fi-section-header-after-ctn` как `.fi-sc-actions`/`.fi-ac`) */
    .fi-section-header .fi-ac,
    .fi-section-collapse-btn,
    .fi-ta-header,
    .fi-ta-header-toolbar,
    .fi-ta-actions,
    .fi-header-actions-ctn {
        display: none !important;
    }

    /* v3 `.fi-ta-actions-cell` → в v5 ячейка действий — обычная `.fi-ta-cell`
       с `.fi-ta-actions` внутри; заголовок — `.fi-ta-actions-header-cell`. */
    .fi-ta-cell:has(.fi-ta-actions),
    .fi-ta-actions-header-cell {
        display: none !important;
    }

    /* v3 `.fi-ta-checkbox-cell` → v5 `.fi-ta-selection-cell`. */
    .fi-ta-selection-cell,
    .fi-ta-group-selection-cell {
        display: none !important;
    }

    /* v3 `.fi-ta-header-cell-sort-icon` → в v5 иконка лежит внутри кнопки сортировки. */
    .fi-ta-header-cell-sort-btn .fi-icon {
        display: none !important;
    }

    .fi-ta-summary-row td:first-child {
        display: none !important;
    }

    /* v3 `.w-1` (пустая служебная колонка) → v5 `.fi-ta-empty-header-cell`. */
    .fi-ta-empty-header-cell {
        display: none !important;
    }

    /* ----- Убираем фоновые линии при печати ----- */
    .backgraund-line,
    .backgraund-line-blue,
    .backgraund-line-orange,
    .backgraund-line-birthday,
    .backgraund-line-red,
    .column-color-class {
        background: none !important;
        background-color: transparent !important;
        background-image: none !important;
        color: #000 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .backgraund-line .fi-ta-col,
    .backgraund-line .fi-ta-col *,
    .backgraund-line .fi-ta-text-item,
    .backgraund-line-red .fi-ta-text-item {
        color: #000 !important;
    }

    .fi-ta-table *,
    .fi-ta-cell,
    .fi-ta-header-cell,
    td, th,
    .fi-ta-row,
    .fi-ta-row:nth-child(even),
    .fi-ta-row:nth-child(odd) {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
    }

    /* v3 перечислял `.shadow-*`; в v5 тени приходят из скомпилированных
       семантических правил, поэтому гасим их целиком. */
    * {
        background-image: none !important;
        box-shadow: none !important;
    }

    /* ===== ОРИЕНТАЦИЯ ===== */
    /* По умолчанию все страницы вертикальные */
    @page {
        size: A4 portrait !important;
        margin: 10mm !important;
    }

    html, body {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    /* ----- Стили для таблиц в .print-landscape ----- */
    .print-landscape .fi-ta-table {
        font-size: 7px !important;
        width: 100% !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
    }

    .print-landscape td,
    .print-landscape th,
    .print-landscape .fi-ta-cell,
    .print-landscape .fi-ta-header-cell {
        padding: 1px 3px !important;
        font-size: 7px !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
        border: 0.5px solid #ccc !important;
        background: transparent !important;
    }

    .print-landscape thead th,
    .print-landscape .fi-ta-header-cell {
        background: #f5f5f5 !important;
        background-color: #f5f5f5 !important;
        font-weight: bold !important;
    }

    /* v3 `.fi-ta-table-wrapper` / `.overflow-x-auto` → v5 `.fi-ta-content-ctn`. */
    .print-landscape .fi-ta-content-ctn {
        overflow: visible !important;
        transform: scale(0.9);
        transform-origin: top left;
        width: 111% !important;
    }

    /* v3 `.fi-ta-container` → v5 `.fi-ta-ctn`. */
    .print-landscape .fi-ta-content,
    .print-landscape .fi-ta-ctn {
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    /* v3 `.p-6` → v5 `.fi-section-content`; v3 `.px-3` → внутренние отступы колонок. */
    .print-landscape .fi-section-content {
        padding: 0.3rem !important;
    }

    .print-landscape .fi-ta-col > * {
        padding-left: 0.15rem !important;
        padding-right: 0.15rem !important;
    }

    .print-landscape thead {
        display: table-header-group !important;
    }

    .print-landscape .fi-ta-row {
        page-break-inside: avoid !important;
    }
}

/* подписи инфолиста чёрные, как в legacy */
.fi-sc-text { color: inherit; }
.erp-label-inherit {}

/* панель «Архив»: история действий */
.erp-activity-row { padding: .5rem 0; border-bottom: 1px solid rgba(0,0,0,.08); }
.erp-activity-meta { font-size: .8rem; color: #6b7280; }
.erp-activity-subject { font-weight: 600; }
.erp-activity-changes { margin: .25rem 0 0 1rem; list-style: disc; font-size: .85rem; }
.erp-activity-empty { color: #6b7280; padding: 1rem 0; }

/* шапка секции в одну строку (legacy): заголовок + кнопка */
.erp-compact .fi-section-header-content { display: flex; flex-wrap: nowrap; align-items: center; gap: .5rem; }
.erp-compact .fi-section-header-text-ctn { min-width: 0; }
.erp-compact .fi-section-header-heading { white-space: normal; line-height: 1.2; }
.erp-compact .fi-section-header-after-ctn { flex-shrink: 0; }
.erp-compact .fi-section-header .fi-btn { padding-block: .3rem; padding-inline: .6rem; font-size: .8rem; }

/* legacy: без текста «Показано … из …» в пагинации */
.fi-pagination-overview { display: none; }

/* ===== ОТЧЁТ ПО ЗАКАЗАМ (план 11, задача 1) ===== */
/* Подсветка строк и сводки — цвета дословно из легаси OrdersReports. */
.fi-ta-row.order-pickup,
.fi-ta-row.order-pickup:hover {
    background-color: #bae6fd !important;
}

.fi-ta-row.order-exact,
.fi-ta-row.order-exact:hover {
    background-color: #fde68a !important;
}

.late-stats {
    display: grid;
    grid-template-columns: 1.3fr repeat(5, 1fr);
    gap: 12px;
    padding: 12px 16px 4px;
}

.late-card {
    background: var(--erp-card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-top: 4px solid var(--c);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.late-label {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.late-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 2px;
}

.late-count {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--c);
}

.late-unit {
    font-size: 12px;
    color: #6b7280;
}

.late-percent {
    margin-left: auto;
    font-size: 15px;
    font-weight: 700;
    color: var(--c);
}

.late-bar {
    height: 5px;
    background: #f3f4f6;
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.late-bar > span {
    display: block;
    height: 100%;
    background: var(--c);
    border-radius: 3px;
}

.late-note {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.dark .late-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 1100px) {
    .late-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .late-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== ОТЧЁТ ПО ОТМЕНАМ (план 12, задача 7) ===== */
/* Карточек 2–5, а не 6 как в «Отчёте по заказам» — колонки по содержимому. */
.late-stats.erp-stats-auto {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* ===== ОТЧЁТ ПО СВ (план 12, задача 8) ===== */
.pickup-days-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.pickup-days-table th,
.pickup-days-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.pickup-days-table th:nth-child(2),
.pickup-days-table th:nth-child(3),
.pickup-days-table td:nth-child(2),
.pickup-days-table td:nth-child(3) {
    text-align: right;
}

.pickup-days-table td:nth-child(4) {
    width: 160px;
}

.pickup-days-total td {
    font-weight: 700;
    border-top: 2px solid #d1d5db;
    border-bottom: none;
}

@media print {
    .pickup-days-table th:nth-child(4),
    .pickup-days-table td:nth-child(4) {
        display: none;
    }
}

/* ===== ОТЧЁТ ПО ФИНАНСАМ (план 12, задача 5) ===== */
.erp-finance-scroll { overflow-x: auto; }
.erp-finance-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.erp-finance-table th,
.erp-finance-table td { padding: .35rem .6rem; border-bottom: 1px solid rgba(0,0,0,.08); text-align: right; white-space: nowrap; }
.erp-finance-table th { font-weight: 600; color: #6b7280; }
.erp-finance-table th:first-child,
.erp-finance-table td:first-child,
.erp-finance-name { text-align: left; font-weight: 600; }
.erp-finance-total { font-weight: 700; }
.erp-finance-bold td { font-weight: 700; background: rgba(0,0,0,.03); }
.erp-finance-cell { cursor: pointer; }
.erp-finance-cell:hover { background: rgba(37,99,235,.08); }
.dark .erp-finance-table th,
.dark .erp-finance-table td { border-color: rgba(255,255,255,.1); }
.dark .erp-finance-bold td { background: rgba(255,255,255,.04); }
/* ===== ТАБЕЛЬ (план 12, задача 9) ===== */
.erp-timesheet { width: 100%; border-collapse: collapse; font-size: .85rem; }
.erp-timesheet th,
.erp-timesheet td { padding: .3rem .5rem; border-bottom: 1px solid rgba(0,0,0,.08); text-align: center; white-space: nowrap; }
.erp-timesheet th { font-weight: 600; color: #6b7280; }
.erp-timesheet th:first-child, .erp-timesheet td:first-child,
.erp-timesheet th:nth-child(2), .erp-timesheet td:nth-child(2) { text-align: left; }
.erp-timesheet-rev { font-weight: 400; font-size: .75rem; }
.erp-timesheet-total td { font-weight: 700; }
.dark .erp-timesheet th, .dark .erp-timesheet td { border-color: rgba(255,255,255,.1); }
/* Узкие колонки и рамки печати уже заданы для `.print-landscape` выше; здесь — только
   альбомная ориентация именованной страницей (глобальный `@page` остаётся портретным)
   и заголовок, видимый лишь на печати. */
@media print {
    @page erp-landscape {
        size: A4 landscape !important;
        margin: 8mm !important;
    }

    .print-landscape {
        page: erp-landscape;
    }

    .erp-print-title {
        font-size: 10px !important;
        font-weight: bold !important;
        margin-bottom: 3px !important;
    }
}

/* ===== ОТЧЁТ ПО РАСХОДАМ (план 12, задача 6) ===== */
/* Матрица «статья × филиал»: своя таблица во вью, а не `fi-ta` — колонок столько,
   сколько филиалов, поэтому нужен горизонтальный скролл и плотные ячейки. */
.erp-matrix-ctn {
    overflow-x: auto;
    background: var(--erp-card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.erp-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

.erp-matrix th,
.erp-matrix td {
    padding: 4px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
}

.erp-matrix thead th,
.erp-matrix tfoot th {
    font-weight: 700;
    background: #f9fafb;
}

.erp-matrix .erp-matrix-name,
.erp-matrix th:first-child {
    text-align: left;
    white-space: normal;
}

.erp-matrix-note {
    display: block;
    font-size: 11px;
    color: #6b7280;
    font-weight: 400;
}

.erp-matrix-cell {
    cursor: pointer;
}

.erp-matrix-cell:hover {
    background: #f3f4f6;
}

/* превышение порога статьи (`expense_items.report_threshold_pct`) */
.erp-matrix-over,
.erp-matrix-over:hover {
    background: #fee2e2;
}

.erp-matrix-empty {
    text-align: center;
    color: #6b7280;
    padding: 1rem;
}

.dark .erp-matrix-ctn {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .erp-matrix th,
.dark .erp-matrix td {
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .erp-matrix thead th,
.dark .erp-matrix tfoot th {
    background: rgba(255, 255, 255, 0.05);
}

.dark .erp-matrix-cell:hover {
    background: rgba(255, 255, 255, 0.07);
}

.dark .erp-matrix-over,
.dark .erp-matrix-over:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Отчёт по ЗП (план 12, задача 10): сетка от «Финансов», свои цвета отклонений */
.erp-payroll-table + .erp-payroll-table { margin-top: 1rem; }
.erp-fot-good { color: #15803d; }
.erp-fot-bad { color: #b91c1c; }
.erp-fot-percent { color: #6b7280; font-size: .78rem; }
.dark .erp-fot-good { color: #4ade80; }
.dark .erp-fot-bad { color: #f87171; }

/* ===== LFL (спец. 2026-11-05) ===== */
.erp-lfl-grid { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 1024px) { .erp-lfl-grid { grid-template-columns: 2fr 1fr; } }
.erp-lfl-col { display: grid; gap: 3rem; align-items: start; }
.erp-lfl-scroll { overflow-x: auto; }
.erp-lfl-table { width: 100%; border-collapse: collapse; font-size: .72rem; }
.erp-lfl-table + .erp-lfl-table { margin-top: 1.5rem; }
.erp-lfl-table td { padding: .2rem .4rem; border-bottom: 1px solid rgba(0,0,0,.08); text-align: right; white-space: nowrap; color: #374151; }
.erp-lfl-table td.erp-lfl-label { text-align: left; }
.erp-lfl-bold td { font-weight: 700; }
/* цвета строк взяты из легаси-blade (lfl-reports.blade.php) один в один */
.erp-lfl-lfl td { background: #ffc000; font-weight: 700; }
.erp-lfl-days td { background: #fff9e6; font-weight: 700; }
.erp-lfl-plan td { background: #fff2cc; }
.erp-lfl-fact td { background: #ffd966; }
.erp-lfl-gross td { background: #92d050; }
.erp-lfl-head td { background: lightgray; font-weight: 700; }
.erp-lfl-table td.erp-lfl-link { cursor: pointer; color: #0369a1; text-decoration: underline; }
.erp-lfl-table td.erp-lfl-good { color: green; }
.erp-lfl-table td.erp-lfl-bad { color: orangered; }
.erp-lfl-table td.erp-lfl-zero { color: #000; }

/* ===== НЕДЕЛЬНЫЕ ГРАФИКИ ===== */
/* компактный режим сжимает строки до 1px, а плашка смены имеет свой фон — она наезжала на соседей */
.erp-week-grid .fi-ta-cell {
    padding: 1px 6px !important;
}

.erp-week-grid .fi-ta-cell .fi-ta-col,
.erp-week-grid .fi-ta-cell .fi-ta-col > *,
.erp-week-grid .fi-ta-header-cell > * {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
    gap: 0 !important;
}

.erp-week-grid .fi-ta-row { height: 19px; }

.erp-week-grid .fi-ta-cell,
.erp-week-grid .fi-ta-header-cell { line-height: 1.2; }

.erp-week-grid td,
.erp-week-grid th { white-space: nowrap; }

.erp-week-grid .fi-ta-cell span {
    display: inline-block;
    padding: 0;
    border-radius: 3px;
    line-height: 1.1;
}

.erp-week-grid .fi-ta-cell button { line-height: 1.05; }

/* ===== СУТОЧНИКИ: ПЛОТНЫЕ ТАБЛИЦЫ ===== */
/* таблицы суточника живут в своих Livewire-секциях, класс erp-compact до них не доходит —
   поэтому плотность задаём и по колонке страницы */
.erp-compact .fi-ta-row,
.fi-resource-client-feedbacks .fi-ta-row,
.fi-resource-yandex-penalties .fi-ta-row,
.fi-resource-candidates .fi-ta-row,
.fi-resource-recruitment-requests .fi-ta-row,
.erp-day-column .fi-ta-row { height: 19px; }

.erp-compact .fi-ta-cell,
.erp-compact .fi-ta-header-cell,
.erp-compact .fi-ta-summary-row .fi-ta-cell,
.fi-resource-client-feedbacks .fi-ta-cell,
.fi-resource-client-feedbacks .fi-ta-header-cell,
.fi-resource-yandex-penalties .fi-ta-cell,
.fi-resource-yandex-penalties .fi-ta-header-cell,
.fi-resource-candidates .fi-ta-cell,
.fi-resource-candidates .fi-ta-header-cell,
.fi-resource-recruitment-requests .fi-ta-cell,
.fi-resource-recruitment-requests .fi-ta-header-cell,
.erp-day-column .fi-ta-cell,
.erp-day-column .fi-ta-header-cell,
.erp-day-column .fi-ta-summary-row .fi-ta-cell {
    line-height: 1.2;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}

.erp-compact .fi-ta-cell .fi-ta-col,
.erp-compact .fi-ta-cell .fi-ta-col > *,
.erp-compact .fi-ta-header-cell > *,
.fi-resource-client-feedbacks .fi-ta-cell .fi-ta-col,
.fi-resource-client-feedbacks .fi-ta-cell .fi-ta-col > *,
.fi-resource-client-feedbacks .fi-ta-header-cell > *,
.fi-resource-yandex-penalties .fi-ta-cell .fi-ta-col,
.fi-resource-yandex-penalties .fi-ta-cell .fi-ta-col > *,
.fi-resource-yandex-penalties .fi-ta-header-cell > *,
.fi-resource-candidates .fi-ta-cell .fi-ta-col,
.fi-resource-candidates .fi-ta-cell .fi-ta-col > *,
.fi-resource-candidates .fi-ta-header-cell > *,
.fi-resource-recruitment-requests .fi-ta-cell .fi-ta-col,
.fi-resource-recruitment-requests .fi-ta-cell .fi-ta-col > *,
.fi-resource-recruitment-requests .fi-ta-header-cell > *,
.erp-day-column .fi-ta-cell .fi-ta-col,
.erp-day-column .fi-ta-cell .fi-ta-col > *,
.erp-day-column .fi-ta-header-cell > * {
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    gap: 0 !important;
}

/* строка сводки: подпись и сумма шли в две строки с собственными отступами */
.erp-day-column .fi-ta-summary-row .fi-ta-cell,
.erp-compact .fi-ta-summary-row .fi-ta-cell {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

.erp-day-column .fi-ta-summary-row .fi-ta-cell > *,
.erp-compact .fi-ta-summary-row .fi-ta-cell > * {
    gap: 0 !important;
    line-height: 1.15;
}

/* у блока сводки свои вертикальные отступы — из-за них строка была втрое выше содержимого */
.erp-day-column .fi-ta-text-summary,
.erp-compact .fi-ta-text-summary {
    padding: 0 !important;
    min-height: 0 !important;
    gap: 0 !important;
}

.erp-day-column .fi-ta-text-summary-label,
.erp-compact .fi-ta-text-summary-label {
    font-size: .7rem;
    line-height: 1.1;
}

/* у графика и калькулятора купюр своя таблица со своими отступами — рамка секции лишняя */
.fi-section-content:has(.erp-week-grid),
.fi-section-content:has(.erp-denominations) {
    padding: 0 !important;
}

/* ===== ТАБЛИЦЫ ОТЧЁТОВ ВО ВЬЮ ===== */
/* в blade-вью Tailwind-утилиты (w-full, px-2, text-end) не компилируются — нужен свой класс */
.erp-report-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.erp-report-table th,
.erp-report-table td {
    padding: 0.25rem 0.5rem;
    text-align: left;
    vertical-align: middle;
}

.erp-report-table thead th {
    font-weight: 500;
    color: rgb(107 114 128);
    border-bottom: 1px solid rgb(229 231 235);
}

.erp-report-table tbody tr + tr td {
    border-top: 1px solid rgb(243 244 246);
}

.erp-report-table tfoot td {
    font-weight: 600;
    border-top: 1px solid rgb(229 231 235);
}

.erp-report-table .erp-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.erp-report-share {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark .erp-report-table thead th {
    color: rgb(156 163 175);
    border-bottom-color: rgb(55 65 81);
}

.dark .erp-report-table tbody tr + tr td,
.dark .erp-report-table tfoot td {
    border-color: rgb(55 65 81);
}

/* ===== ОТЧЁТ ПО СКИДКАМ ===== */
/* одна полоса на весь период: видно соотношение типов скидок без отдельного графика */
.erp-discount-bar {
    display: flex;
    height: 10px;
    margin: 12px 0 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgb(243 244 246);
}

.erp-discount-bar > span {
    display: block;
    height: 100%;
}

.erp-discount-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 999px;
    vertical-align: middle;
}

.dark .erp-discount-bar {
    background: rgb(55 65 81);
}

.erp-report-table .erp-bold {
    font-weight: 700;
}

/* ===== БЛАНК ВЫДАЧИ ЗП ===== */
/* раскладка как в легаси ZpPrint: слева суммы, справа смены, внизу дата и подпись */
.erp-slip {
    font-size: 0.95rem;
}

.erp-slip-title {
    font-size: 1.4rem;
    text-align: center;
    line-height: 1.3;
    margin-bottom: 24px;
}

.erp-slip-print {
    float: right;
    padding: 0.3rem 0.8rem;
    border-radius: 0.5rem;
    color: #fff;
    background: #6b7280;
}

.erp-slip-body {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.erp-slip-col {
    flex: 1;
    min-width: 0;
}

.erp-slip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 0;
    border-bottom: 1px solid rgb(243 244 246);
}

.erp-slip-row b {
    font-weight: 600;
}

.erp-slip-signs {
    display: flex;
    align-items: flex-end;
    gap: 28px;
    margin-top: 60px;
    font-size: 1.05rem;
}

.erp-slip-line {
    flex: 1;
    max-width: 240px;
    border-bottom: 1px solid #aaa;
}

.dark .erp-slip-row {
    border-bottom-color: rgb(55 65 81);
}

@media print {
    .erp-slip-body {
        gap: 24px;
    }
}

/* ===== ОБРАТНАЯ СВЯЗЬ И ШТРАФЫ ЯНДЕКС ===== */
/* Списки длинные, текста много: уменьшаем кегль и ограничиваем ширину колонок,
   иначе «Содержание» и «Решение филиала» растягивают строку на пол-экрана. */
.fi-resource-client-feedbacks .fi-ta-cell,
.fi-resource-yandex-penalties .fi-ta-cell,
.fi-resource-candidates .fi-ta-cell,
.fi-resource-recruitment-requests .fi-ta-cell,
.fi-resource-client-feedbacks .fi-ta-header-cell,
.fi-resource-yandex-penalties .fi-ta-header-cell,
.fi-resource-candidates .fi-ta-header-cell,
.fi-resource-recruitment-requests .fi-ta-header-cell {
    font-size: 0.75rem;
}

.fi-resource-client-feedbacks .fi-ta-cell .fi-ta-text-item-label,
.fi-resource-yandex-penalties .fi-ta-cell .fi-ta-text-item-label,
.fi-resource-candidates .fi-ta-cell .fi-ta-text-item-label,
.fi-resource-recruitment-requests .fi-ta-cell .fi-ta-text-item-label {
    line-height: 1.25;
}

/* ===== ШАПКА И СВОДКА ТАБЛИЦ ===== */
/* Строки с названиями столбцов и со сводкой плотными быть не должны: в них читают
   подписи и итоги, поэтому им отдельная высота во всех разделах (правило владельца). */
.fi-ta-header-cell,
.fi-ta-summary-row .fi-ta-cell {
    height: 36px;
    vertical-align: middle;
}

.fi-ta-summary-row .fi-ta-cell .fi-ta-col,
.fi-ta-summary-row .fi-ta-cell .fi-ta-col > * {
    line-height: 1.2;
}
