    body { background: #f8fafc; color: #0f172a; margin: 0; }

    /* Убираем стрелки у числовых инпутов в таблицах (data-table, reg-bb-input) */
    .reg-bb-input[type=number]::-webkit-inner-spin-button,
    .reg-bb-input[type=number]::-webkit-outer-spin-button,
    .data-table input[type=number]::-webkit-inner-spin-button,
    .data-table input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
    .reg-bb-input[type=number],
    .data-table input[type=number] { -moz-appearance: textfield; appearance: textfield; }

    /* Компактная двухколоночная форма профиля: label слева, input справа */
    .profile-grid {
        display: grid;
        grid-template-columns: 140px 1fr;
        gap: 10px 16px;
        align-items: center;
    }
    .profile-grid > label {
        font-size: 13px;
        color: #6b7280;
        margin: 0;
        text-align: right;
        white-space: nowrap;
    }
    @media (max-width: 640px) {
        .profile-grid { grid-template-columns: 1fr; gap: 4px 0; }
        .profile-grid > label { text-align: left; }
    }

    /* Taxi-checker logo */
    .taxi-logo { padding: 2px; }
    .taxi-sq {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        height: 28px;
        min-width: 28px;
        padding: 0 8px;
        border-radius: 6px;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.03em;
    }
    .taxi-sq-amber {
        background: #F59E0B;
        color: #000;
        box-shadow: 0 0 12px rgba(245,158,11,0.55), 0 0 4px rgba(245,158,11,0.9);
    }
    .taxi-sq-black {
        background: #111;
        color: #e5e7eb;
        box-shadow:
            0 0 10px rgba(255,255,255,0.18),
            0 0 3px rgba(255,255,255,0.25),
            inset 0 0 0 1px rgba(255,255,255,0.08);
    }
    /* Brand block — СТРОГО КВАДРАТ, не прямоугольник */
    .brand-wrap { display: flex; justify-content: center; }
    .brand-block {
        position: relative;
        width: 120px;
        height: 120px;          /* width === height → квадрат */
        border-radius: 20px;
        overflow: hidden;
        background: #0a0a0a;
        isolation: isolate;
        /* Жёлтая подсветка по периметру */
        box-shadow:
            0 0 24px rgba(245,158,11,0.45),
            0 0 8px rgba(245,158,11,0.6),
            inset 0 0 0 1.5px rgba(245,158,11,0.45);
    }
    /* Blurred background for ambient glow */
    .brand-block .brand-bg {
        position: absolute;
        inset: -20px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        filter: blur(18px) saturate(1.4) brightness(0.9);
        transform: scale(1.4);
        z-index: 0;
        opacity: 1;
    }
    /* Slight dark vignette only near bottom for text readability */
    .brand-block::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.75) 100%);
        z-index: 2;
    }
    /* Sharp logo in the center */
    .brand-block .brand-logo-sharp {
        position: absolute;
        top: 10px; left: 10px; right: 10px;
        height: 66px;
        z-index: 1;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
        filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
    }
    .brand-block .brand-text {
        position: absolute;
        left: 0; right: 0; bottom: 0;
        z-index: 3;
        padding: 6px 8px 10px;
        font-size: 13px;
        font-weight: 700;
        color: #ffffff;
        letter-spacing: 0.02em;
        text-align: center;
        line-height: 1.2;
        text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 10px rgba(0,0,0,0.8);
        box-sizing: border-box;
    }
    .brand-block .brand-text span {
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .brand-block.no-logo .brand-bg {
        background: linear-gradient(135deg, rgba(245,158,11,0.22), rgba(245,158,11,0.06));
        filter: none;
        transform: none;
    }

    /* SIDEBAR (dark) */
    .sidebar-link {
        display: flex; align-items: center; gap: 12px;
        padding: 10px 14px; border-radius: 12px;
        color: #9CA3AF; font-size: 14px; font-weight: 500;
        transition: all 0.15s; border: 1px solid transparent;
        text-decoration: none;
    }
    .sidebar-link:hover { background: rgba(255,255,255,0.04); color: #E5E7EB; }
    .sidebar-link.active {
        background: rgba(245,158,11,0.1); color: #FBBF24;
        border-color: rgba(245,158,11,0.2);
    }

    /* Narrow sidebar — horizontal icon+label */
    .sidebar-link-narrow {
        display: flex; align-items: center; gap: 8px;
        padding: 6px 10px; margin-bottom: 1px;
        border-radius: 8px;
        color: #9CA3AF; font-size: 12px; font-weight: 500;
        line-height: 1.15;
        /* Плавная и «дорогая» анимация активного состояния (правило premium-layout). */
        transition: background 0.28s cubic-bezier(.4,0,.2,1),
                    color 0.28s cubic-bezier(.4,0,.2,1),
                    border-color 0.28s cubic-bezier(.4,0,.2,1),
                    font-size 0.28s cubic-bezier(.4,0,.2,1),
                    font-weight 0.28s cubic-bezier(.4,0,.2,1),
                    padding 0.28s cubic-bezier(.4,0,.2,1),
                    box-shadow 0.28s cubic-bezier(.4,0,.2,1);
        border: 1px solid transparent;
        text-decoration: none;
    }
    .sidebar-link-narrow svg {
        flex-shrink: 0; width: 16px; height: 16px;
        transition: width 0.28s cubic-bezier(.4,0,.2,1), height 0.28s cubic-bezier(.4,0,.2,1);
    }
    .sidebar-link-narrow:hover { background: rgba(255,255,255,0.04); color: #E5E7EB; }
    .sidebar-link-narrow.active {
        background: rgba(245,158,11,0.12); color: #FBBF24;
        border-color: rgba(245,158,11,0.28);
        font-size: 13px;
        font-weight: 600;
        padding: 7px 12px;
        box-shadow: 0 1px 0 rgba(245,158,11,0.06) inset, 0 0 0 1px rgba(245,158,11,0.08);
    }
    .sidebar-link-narrow.active svg { width: 17px; height: 17px; }
    .sidebar-group-toggle { background: transparent; cursor: pointer; text-align: left; width: 100%; }
    .sidebar-group.open > .sidebar-group-toggle .sidebar-group-chevron { transform: rotate(180deg); }
    .sidebar-subnav { margin: 0 0 2px 0; }
    .sidebar-sublink { padding: 4px 8px; font-size: 11px; gap: 6px; }
    .sidebar-sub-dot {
        width: 5px; height: 5px; border-radius: 50%;
        background: #4B5563; flex-shrink: 0;
        transition: background 0.15s;
    }
    .sidebar-sublink:hover .sidebar-sub-dot { background: #9CA3AF; }
    .sidebar-sublink.active .sidebar-sub-dot { background: #FBBF24; }

    /* WORK AREA (light) */
    main {
        color: #0f172a;
        min-width: 0;
        /* overflow-x: clip — обрезает горизонтальный overflow, но НЕ ломает
           position: sticky у потомков (в отличие от overflow-x: hidden, который
           создаёт scroll-context и убивает sticky на main-уровне). */
        overflow-x: clip;
    }
    /* Parent flex row */
    body > div.flex { min-height: 100vh; }
    /* Sidebar всегда покрывает весь вьюпорт (position:fixed, кнопки внизу через mt-auto).
       Раньше был position:sticky+height:100vh — в комбинации с длинными вкладками
       (например, тех-поддержка с tall textarea) sticky давал «обрезанный» сайдбар. */
    aside { position: fixed; left: 0; top: 0; height: 100vh; z-index: 40; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
    /* Сдвигаем main, чтобы освободить место под фиксированный сайдбар (152px). */
    main { margin-left: 152px; }
    aside::-webkit-scrollbar { width: 6px; }
    aside::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
    aside::-webkit-scrollbar-track { background: transparent; }
    main h1, main h2, main h3 { color: #0f172a !important; }
    main .text-white { color: #0f172a !important; }
    main .text-gray-300 { color: #334155 !important; }
    main .text-gray-400 { color: #475569 !important; }
    main .text-gray-500 { color: #64748b !important; }
    main .text-gray-600 { color: #94a3b8 !important; }
    main .text-amber-400 { color: #d97706 !important; }
    main .text-amber-500 { color: #d97706 !important; }

    /* Cards in work area = white */
    main .card {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04);
        backdrop-filter: none;
    }

    .btn-yellow {
        background: #F59E0B; color: #000; font-weight: 600;
        padding: 10px 20px; border-radius: 12px;
        transition: all 0.2s; border: none; cursor: pointer;
    }
    .btn-yellow:hover { background: #D97706; transform: translateY(-1px); }

    /* ============================================================
       .tab-header — единая шапка вкладки
       структура: <div class="tab-header">
         <div class="tab-header-left">
           <h1 class="tab-title">Заголовок</h1>
           <span class="tab-counter">N</span> (опционально)
         </div>
         <div class="tab-header-actions">
           <button class="btn-yellow">Primary</button>
           <button class="btn-light">Secondary</button>
           <button class="btn-icon" title="Настройки">⚙</button>
         </div>
       </div>
       ============================================================ */
    /* Topbar (kabin/уведомления/выход) — абсолютно в правом верхнем углу <main>,
       чтобы освободить вертикаль и шапка вкладки была в одной линии слева. */
    .topbar-right {
        /* по умолчанию — в правом верхнем углу main (fallback) */
        position: absolute; top: 24px; right: 24px;
        display: flex; align-items: center; gap: 8px;
        height: 40px;
        z-index: 30;
    }
    /* если JS перенёс topbar внутрь активной tab-header — делаем flex-child справа */
    .tab-header > .topbar-right {
        position: static; top: auto; right: auto;
        margin-left: auto; /* прижимает к правому краю внутри flex */
        flex-shrink: 0;
    }
    @media (max-width: 768px) {
        .topbar-right { top: 16px; right: 12px; gap: 6px; height: 36px; }
    }

    .tab-header {
        display: flex; align-items: center; justify-content: flex-start;
        gap: 12px; flex-wrap: nowrap;
        margin-bottom: 16px;
        min-height: 40px;
        min-width: 0;
    }
    @media (max-width: 768px) { .tab-header { gap: 8px; min-height: 36px; } }
    .tab-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: nowrap; flex-shrink: 0; height: 100%; }
    .tab-header-left .tab-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tab-title-block { display: flex; flex-direction: column; min-width: 0; justify-content: center; }
    .tab-title {
        font-size: 18px; font-weight: 700; color: #0f172a;
        line-height: 1; margin: 0;
        letter-spacing: 0;
        display: inline-flex; align-items: center;
        height: 40px;
    }
    @media (max-width: 768px) { .tab-title { font-size: 16px; height: 36px; } }
    .tab-header-actions { height: 100%; }
    .tab-subtitle { font-size: 12px; color: #64748b; margin: 2px 0 0 0; line-height: 1.3; }
    .tab-counter {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 26px; height: 22px; padding: 0 8px;
        background: #f1f5f9; color: #475569; border-radius: 9999px;
        font-size: 12px; font-weight: 600;
    }
    .tab-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; height: 100%; }

    /* Fallback: плоский <h1> без .tab-header */
    .tab-content > h1:first-child,
    .tab-content > div:first-child > h1:first-child {
        height: 40px;
        line-height: 1;
        margin: 0 0 16px 0;
        display: inline-flex;
        align-items: center;
        font-size: 18px;
        font-weight: 700;
        color: #0f172a;
    }
    @media (max-width: 768px) {
        .tab-content > h1:first-child,
        .tab-content > div:first-child > h1:first-child { height: 36px; font-size: 16px; }
    }

    /* Mobile: secondary buttons прячутся в выпадающее меню за «⋯» */
    .tab-header-more-wrap { position: relative; display: inline-flex; align-items: center; }
    .tab-header-more-btn { display: none; }
    .tab-header-more-menu { display: inline-flex; align-items: center; gap: 8px; }
    /* Порог срабатывания ⋯-меню — 1280px: на средних мониторах (1366, 1440 с масштабом)
       5 кнопок шапки Исполнителей не влезают в одну линию рядом с топбаром справа. */
    @media (max-width: 1280px) {
        .tab-header-more-btn { display: inline-flex; }
        .tab-header-more-menu {
            display: none;
            position: absolute; right: 0; top: calc(100% + 6px);
            background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
            padding: 8px; min-width: 200px; align-items: stretch !important;
            box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 40;
            flex-direction: column; gap: 6px;
        }
        .tab-header-more-menu.show { display: flex; }
        .tab-header-more-menu > * { width: 100%; justify-content: flex-start; }
    }
    .btn-light {
        background: #fff; color: #0f172a; font-weight: 500;
        padding: 8px 14px; border-radius: 10px;
        border: 1px solid #e2e8f0; cursor: pointer; transition: all .15s;
        font-size: 13px;
    }
    .btn-light:hover { background: #f8fafc; border-color: #cbd5e1; }
    .btn-icon {
        display: inline-flex; align-items: center; justify-content: center;
        width: 34px; height: 34px; padding: 0;
        background: #fff; color: #64748b;
        border: 1px solid #e2e8f0; border-radius: 10px;
        cursor: pointer; transition: all .15s;
    }
    .btn-icon:hover { background: #f8fafc; color: #0f172a; }
    .btn-icon svg { width: 18px; height: 18px; }
    /* Совместимость: класс btn в старом коде = btn-light */
    .btn { background: #fff; color: #0f172a; border: 1px solid #e2e8f0; padding: 8px 14px; border-radius: 10px; font-size: 13px; cursor: pointer; }
    .btn:hover { background: #f8fafc; }

    main .stat-value {
        font-size: 2rem; font-weight: 800;
        background: linear-gradient(135deg, #F59E0B, #D97706);
        -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    }
    .tab-content { display: none; }
    .tab-content.active { display: block; }
    /* Vehicles tab: stretch table to bottom */
    #tab-vehicles.active { display: flex; flex-direction: column; height: calc(100vh - 48px); }
    #tab-vehicles.active > #vehicles-list-view:not(.hidden) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    #tab-vehicles.active > #vehicles-list-view.hidden { display: none !important; }
    #tab-vehicles.active > #vehicles-list-view > #vehicles-table-wrap { flex: 1; min-height: 0; max-height: none !important; }

    /* Drivers tab: stretch table to bottom */
    #tab-drivers.active { display: flex; flex-direction: column; height: calc(100vh - 48px); }
    #tab-drivers.active > #drivers-list-view:not(.hidden) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    #tab-drivers.active > #drivers-list-view.hidden { display: none !important; }
    #tab-drivers.active > #drivers-list-view > #drivers-table-wrap { flex: 1; min-height: 0; max-height: none !important; }

    /* Fines tab: stretch table to bottom */
    #tab-fines.active { display: flex; flex-direction: column; height: calc(100vh - 48px); }
    #tab-fines.active > #fines-gibdd-view:not(.hidden) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    #tab-fines.active > #fines-gibdd-view.hidden { display: none !important; }
    #tab-fines.active > #fines-gibdd-view > #fines-table-wrap { flex: 1; min-height: 0; max-height: none !important; }

    /* Statuses tab: stretch detail/grid views to bottom */
    #tab-statuses.active { display: flex; flex-direction: column; height: calc(100vh - 48px); }
    #tab-statuses.active > #statuses-list-view:not(.hidden) { display: block; }
    #tab-statuses.active > #statuses-detail-view:not(.hidden),
    #tab-statuses.active > #statuses-grid1-view:not(.hidden),
    #tab-statuses.active > #statuses-grid2-view:not(.hidden),
    #tab-statuses.active > #statuses-grid3-view:not(.hidden) {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }
    #tab-statuses.active > #statuses-detail-view > #status-detail-wrap,
    #tab-statuses.active > #statuses-grid1-view > #grid1-table-wrap,
    #tab-statuses.active > #statuses-grid2-view > .card.overflow-auto,
    #tab-statuses.active > #statuses-grid3-view > #grid3-groups {
        flex: 1;
        min-height: 0;
        max-height: none !important;
        overflow: auto;
    }
    /* Grid 3 inner: card → data-table-wrap должны растягиваться по высоте */
    #grid3-groups { display: flex; flex-direction: column; }
    #grid3-groups > .card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
    #grid3-groups > .card > .data-table-wrap {
        flex: 1;
        min-height: 0;
        max-height: none !important;
        overflow: auto;
    }

    /* Inputs in work area */
    main .input {
        width: 100%;
        padding: 8px 12px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        color: #0f172a;
        font-size: 13px;
        outline: none;
        transition: all 0.15s;
    }
    main .input:focus {
        border-color: #F59E0B;
        box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
    }
    main .input::placeholder { color: #94a3b8; }
    /* Tailwind padding-left классы должны перебивать дефолтный padding для иконок поиска */
    main .input.pl-8 { padding-left: 32px; }
    main .input.pl-9 { padding-left: 36px; }
    main .input.pl-10 { padding-left: 40px; }

    /* Any input-like fields inside main */
    main input[type="text"], main input[type="email"],
    main input[type="password"], main input[type="tel"],
    main input[type="number"], main input[type="date"],
    main select, main textarea {
        background: #ffffff;
        border-color: #e2e8f0;
        color: #0f172a;
    }
    main input::placeholder, main textarea::placeholder { color: #94a3b8; }

    /* Gray pill buttons inside main */
    main button.bg-gray-800 { background: #f1f5f9 !important; color: #475569 !important; }
    main button.bg-gray-800:hover { background: #e2e8f0 !important; color: #0f172a !important; }

    /* Dropzones in work area */
    main .dropzone {
        display: block;
        border: 2px dashed #cbd5e1;
        border-radius: 12px;
        padding: 24px 12px;
        text-align: center;
        cursor: pointer;
        transition: all 0.15s;
        background: #f8fafc;
    }
    main .dropzone:hover {
        border-color: #F59E0B;
        background: #fffbeb;
    }
    main .dropzone.dragover {
        border-color: #F59E0B;
        background: #fef3c7;
    }

    /* Dashboard stat cards backgrounds (override dark) */
    main .bg-gray-800\/50 { background: #ffffff !important; }
    main .bg-black\/50 { background: #f8fafc !important; }
    main .border-white\/10 { border-color: #e2e8f0 !important; }
    main .border-white\/\[0\.06\] { border-color: #e2e8f0 !important; }
    main .border-white\/5 { border-color: #e2e8f0 !important; }
    main .border-gray-700\/50 { border-color: #e2e8f0 !important; }
    main .bg-gray-800\/50.border-gray-700\/50 { background: #ffffff !important; }

    /* Settings dropdown inside main */
    main #vehicle-settings-menu {
        background: #ffffff !important;
        border-color: #e2e8f0 !important;
        box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    }
    main .col-item { color: #334155; }
    main .col-item:hover { background: #f1f5f9; }

    /* Allow dict popups to escape form cards */
    #driver-form, #vehicle-form, #drivers-form-view, #vehicles-form-view { overflow: visible; }
    #driver-form .card, #vehicle-form .card { overflow: visible !important; }

    /* Dict combobox */
    .dict-combo input::-webkit-calendar-picker-indicator { display: none !important; -webkit-appearance: none; }
    input[list]::-webkit-calendar-picker-indicator { display: none !important; -webkit-appearance: none; opacity: 0; width: 0; height: 0; }
    input[list]::-webkit-list-button { display: none !important; }
    input[list] { -webkit-appearance: none; -moz-appearance: none; appearance: none; }
    .dict-combo { position: relative; width: 33%; min-width: 160px; max-width: 280px; }
    @media (max-width: 768px) { .dict-combo { width: 100%; max-width: none; } }

    /* ============================================================ */
    /* MOBILE: collapsible sidebar                                  */
    /* Collapsed: ~44px (только иконки), main занимает всю ширину    */
    /* Expanded: 220px overlay поверх контента                      */
    /* ============================================================ */
    /* Сайдбар сворачивается ТОЛЬКО на настоящем мобильном (≤768px).
       На десктопе/планшете-с-тачем сайдбар остаётся 152px всегда. */
    @media (max-width: 768px) {
        #sidebar {
            width: 44px !important;
            transition: width 0.25s ease;
            overflow-x: hidden;
            overflow-y: auto;
            z-index: 50;
        }
        #sidebar.expanded {
            width: 220px !important;
            box-shadow: 8px 0 24px rgba(0,0,0,0.35);
        }
        /* Скрываем текст в свёрнутом виде — остаются только иконки */
        #sidebar:not(.expanded) .sidebar-link-narrow span,
        #sidebar:not(.expanded) .sidebar-link span,
        #sidebar:not(.expanded) .sidebar-group-chevron,
        #sidebar:not(.expanded) #brand-inline,
        #sidebar:not(.expanded) .brand-block .brand-text,
        #sidebar:not(.expanded) [data-sidebar-label] {
            display: none !important;
        }
        #sidebar:not(.expanded) .sidebar-link-narrow,
        #sidebar:not(.expanded) .sidebar-link {
            justify-content: center;
            padding: 10px 6px;
        }
        #sidebar:not(.expanded) .sidebar-subnav { display: none !important; }
        /* Подсказка «потяни/нажми» — тонкая полоска-хендл */
        #sidebar:not(.expanded)::after {
            content: "";
            position: absolute;
            right: 2px; top: 50%;
            width: 3px; height: 36px;
            background: rgba(245,158,11,0.5);
            border-radius: 2px;
            transform: translateY(-50%);
        }
        /* Затемнение main когда sidebar expanded */
        #sidebar-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.35);
            z-index: 49;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease;
        }
        #sidebar-backdrop.active {
            opacity: 1;
            pointer-events: auto;
        }
        /* Main contents: уменьшенный padding + offset под узкий fixed-sidebar */
        main { padding-left: 8px !important; padding-right: 8px !important; margin-left: 44px !important; }
    }
    .dict-combo .input { padding-right: 28px; cursor: pointer; }
    .dict-combo::after {
        content: '';
        position: absolute;
        right: 10px; top: 50%; transform: translateY(-25%);
        border: 5px solid transparent;
        border-top-color: #94a3b8;
        pointer-events: none;
    }
    /* Компактные комбобоксы в строке фильтров: ширина по содержимому, ▼ внутри.
       Используется через class="filter-combo" на input[list=dict_*]. */
    .tab-filters-sticky .dict-combo,
    .dict-combo:has(> .filter-combo) {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        flex-shrink: 0;
        display: inline-block;
    }
    .dict-combo > .filter-combo {
        width: 130px;
        padding-right: 24px !important;
    }
    /* Узкие placeholder'ы вроде «Марка»/«Модель» — короче */
    .dict-combo > .filter-combo[placeholder="Марка"],
    .dict-combo > .filter-combo[placeholder="Модель"],
    .dict-combo > .filter-combo[placeholder="Статус"] {
        width: 100px;
    }
    .dict-combo > .filter-combo[placeholder="Год"] { width: 80px; }
    .tab-filters-sticky .dict-combo::after { right: 8px; }
    .dict-popup {
        position: absolute;
        top: 100%; left: 0;
        width: 100%;
        min-width: 240px;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.12);
        z-index: 60;
        max-height: 300px;
        display: flex; flex-direction: column;
        margin-top: 4px;
        overflow: hidden;
    }
    .dict-popup .dict-items {
        overflow-y: auto;
        max-height: 220px;
    }
    .dict-popup .dict-item {
        padding: 8px 12px;
        font-size: 12px;
        color: #0f172a;
        cursor: pointer;
        border-bottom: 1px solid #f1f5f9;
    }
    .dict-popup .dict-item:hover { background: #fffbeb; color: #d97706; }
    .dict-popup .dict-empty {
        padding: 12px; font-size: 11px; color: #94a3b8; text-align: center;
    }
    .dict-popup .dict-add {
        border-top: 1px solid #e2e8f0;
        padding: 8px;
        display: flex; gap: 6px;
        background: #f8fafc;
    }
    .dict-popup .dict-add input {
        flex: 1;
        padding: 6px 10px;
        font-size: 12px;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        background: #fff;
        color: #0f172a;
        outline: none;
    }
    .dict-popup .dict-add input:focus { border-color: #F59E0B; }
    .dict-popup .dict-add button {
        padding: 6px 12px;
        background: #F59E0B;
        color: #000;
        font-weight: 600;
        font-size: 11px;
        border: none;
        border-radius: 8px;
        cursor: pointer;
    }
    .dict-popup .dict-add button:hover { background: #D97706; }

    /* Settings nav (горизонтальные подвкладки) */
    .settings-nav {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        font-size: 13px;
        color: #6b7280;
        font-weight: 500;
        white-space: nowrap;
        transition: all 0.12s;
    }
    .settings-nav:hover { color: #d97706; }
    .settings-nav.active {
        color: #111827;
        font-weight: 600;
        border-bottom: 2px solid #F59E0B;
    }
    .settings-section { display: none; }
    .settings-section.active { display: block; }

    /* List buttons (for fines categories, dictionaries, etc.) */
    .list-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 14px 18px;
        border: none;
        background: transparent;
        border-bottom: 1px solid #e2e8f0;
        cursor: pointer;
        font-size: 14px;
        color: #0f172a;
        text-align: left;
        transition: background 0.12s;
    }
    .list-btn:last-child { border-bottom: none; }
    .list-btn:hover { background: #f8fafc; color: #d97706; }
    .list-btn-arrow { color: #d97706; font-weight: 600; }
    .list-btn-note { color: #9ca3af; font-size: 11px; font-style: italic; }

    .list-btn-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 7px 10px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        cursor: pointer;
        font-size: 13px;
        color: #0f172a;
        text-align: left;
        transition: all 0.12s;
    }
    .list-btn-card:hover {
        background: #fffbeb;
        border-color: #F59E0B;
        color: #d97706;
    }
    .list-btn-card .list-btn-note {
        font-style: normal;
        background: #f1f5f9;
        padding: 2px 8px;
        border-radius: 8px;
        color: #64748b;
    }

    /* Universal sticky data table (vehicles, drivers, fines) */
    .data-table {
        border-collapse: separate;
        border-spacing: 0;
        width: auto;
        max-width: max-content;
    }
    /* Серая граница между ячейками заголовка — видимая подсказка для drag-handle (правило 14b) */
    .data-table thead th { border-right: 1px solid #e2e8f0; }
    .data-table thead th:last-child { border-right: none; }
    .data-table th, .data-table td {
        padding: 8px 12px;
        text-align: left;
        border-bottom: 1px solid #e2e8f0;
        font-size: 12px;
        color: #0f172a;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 0;
    }
    .data-table th { white-space: normal; vertical-align: middle; height: 44px; }
    /* tbody td: текст по словам, 2-строчный обрез — через обёртку .cell-text (line-clamp на td не работает из-за table-cell). Правило feedback_data_tables_style #4 */
    .data-table tbody td {
        white-space: normal;
        word-break: normal;
        overflow-wrap: break-word;
        text-overflow: clip;
        line-height: 1.35;
        vertical-align: top;
        max-width: 300px;
    }
    .data-table tbody td > .cell-text {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        word-break: normal;
        overflow-wrap: break-word;
        line-height: 1.35;
        max-height: 2.7em;
    }
    .data-table th {
        background: #f8fafc;
        color: #475569;
        font-weight: 600;
        position: sticky;
        top: 0;
        z-index: 10;
        user-select: none;
        border-bottom: 1px solid #cbd5e1;
    }
    .data-table th.sortable { cursor: pointer; }
    .data-table th.sortable:hover { color: #d97706; }
    .data-table th { position: relative; padding-right: 18px !important; }
    .col-resizer {
        position: absolute; top: 0; right: 0;
        width: 8px; height: 100%;
        cursor: col-resize; user-select: none;
        z-index: 20;
    }
    .col-resizer:hover { background: rgba(245,158,11,0.4); }
    /* Row-resizer: drag нижней границы строки для смены высоты (правило 2a).
       Появляется на ховере по строке, чтобы не мешать обычному клику. */
    .data-table tbody tr { position: relative; }
    .row-resizer {
        position: absolute; left: 0; right: 0; bottom: 0;
        height: 4px; cursor: row-resize; user-select: none;
        z-index: 19; opacity: 0;
    }
    .data-table tbody tr:hover .row-resizer { opacity: 1; background: rgba(245,158,11,0.25); }
    .row-resizer:hover { opacity: 1 !important; background: rgba(245,158,11,0.5) !important; }
    /* Колл-центр: th имеют overflow:hidden в базе data-table, что обрезает
       resize-handle. Для заголовков таблицы звонков переопределяем на visible,
       а ellipsis-клиппинг переносим на внутренний .th-content. */
    #calls-thead th { overflow: visible !important; }
    #calls-thead th > .th-content {
        display: flex; align-items: center; gap: 4px;
        overflow: hidden; min-width: 0; width: 100%;
    }
    #calls-thead th > .th-content > .th-label {
        overflow: hidden; text-overflow: ellipsis;
        white-space: normal; line-height: 1.2; max-height: 2.4em;
    }
    #vehicles-table th { position: relative; padding-right: 18px !important; white-space: normal; }
    .data-table th.sorted::after {
        content: '';
        display: inline-block;
        margin-left: 6px;
        border: 4px solid transparent;
    }
    .data-table th.sorted.asc::after {
        border-bottom-color: #F59E0B;
        margin-bottom: 2px;
    }
    .data-table th.sorted.desc::after {
        border-top-color: #F59E0B;
        margin-top: 2px;
    }
    .data-table th.sticky-col, .data-table td.sticky-col {
        position: sticky;
        left: 0;
        background: #ffffff;
        z-index: 5;
        border-right: 1px solid #e2e8f0;
    }
    .data-table th.sticky-col {
        background: #f8fafc;
        top: 0;
        left: 0;
        z-index: 25;
    }
    .data-table thead tr th {
        position: sticky;
        top: 0;
        z-index: 20;
    }

    /* Header content wrapper: label + filter button in a flex row */
    .th-content {
        display: flex;
        align-items: center;
        gap: 6px;
        width: 100%;
        overflow: hidden;
    }
    .th-content > .th-label {
        flex: 1;
        overflow: hidden;
        min-width: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        line-height: 1.15;
        max-height: 2.3em;
    }

    /* Excel-style column filter button + popup */
    .col-filter-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 16px; height: 16px;
        border-radius: 3px;
        cursor: pointer;
        color: #94a3b8;
        background: transparent;
        border: 1px solid transparent;
        font-size: 9px;
        transition: all 0.12s;
    }
    .col-filter-btn:hover { background: #fef3c7; color: #d97706; border-color: #fcd34d; }
    .col-filter-btn.active {
        background: rgba(245,158,11,0.2); color: #f59e0b; border-color: #f59e0b;
        box-shadow: 0 0 0 1px rgba(245,158,11,0.3);
    }
    .col-filter-popup {
        position: fixed;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        z-index: 1000;
        width: 260px;
        max-height: 400px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .col-filter-popup .cf-search {
        padding: 8px;
        border-bottom: 1px solid #e2e8f0;
    }
    .col-filter-popup .cf-search input {
        width: 100%;
        padding: 6px 10px;
        font-size: 12px;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        outline: none;
    }
    .col-filter-popup .cf-search input:focus { border-color: #F59E0B; }
    .col-filter-popup .cf-actions {
        display: flex;
        gap: 6px;
        padding: 6px 8px;
        border-bottom: 1px solid #e2e8f0;
        background: #f8fafc;
    }
    .col-filter-popup .cf-actions button {
        flex: 1;
        padding: 4px 8px;
        font-size: 11px;
        background: transparent;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        cursor: pointer;
        color: #475569;
    }
    .col-filter-popup .cf-actions button:hover { background: #fffbeb; color: #d97706; }
    .col-filter-popup .cf-list {
        flex: 1;
        overflow-y: auto;
        padding: 4px 0;
    }
    .col-filter-popup .cf-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 5px 12px;
        font-size: 12px;
        color: #0f172a;
        cursor: pointer;
    }
    .col-filter-popup .cf-item:hover { background: #fffbeb; }
    .col-filter-popup .cf-item input { accent-color: #F59E0B; }
    .col-filter-popup .cf-footer {
        padding: 8px;
        border-top: 1px solid #e2e8f0;
        display: flex;
        gap: 6px;
    }
    .col-filter-popup .cf-footer button {
        flex: 1;
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 6px;
        border: none;
        cursor: pointer;
    }
    .col-filter-popup .cf-apply { background: #F59E0B; color: #000; font-weight: 600; }
    .col-filter-popup .cf-apply:hover { background: #d97706; }
    .col-filter-popup .cf-cancel { background: #f1f5f9; color: #475569; }
    .data-table tbody tr:hover td { background: #f8fafc; }
    .data-table tbody tr:hover td.sticky-col { background: #f1f5f9; }
    .data-table tbody tr { cursor: pointer; }

    /* Wrapper with scroll. По умолчанию — block + max-width:100%, иначе
       шеринг ширины с colgroup-based таблицами (водители/авто/тарифы)
       ломается. Для таблиц, которым нужна усадка по контенту (reg-steps),
       точечный override в их шаблоне: display:inline-block. */
    .data-table-wrap {
        overflow: auto;
        max-width: 100%;
        max-height: calc(100vh - 280px);
        border-radius: 16px;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        position: relative;
    }

    /* ──────────────────────────────────────────────────────────────────
       ПРАВИЛО: таблицы-списки, которые могут быть выше экрана.
       Применяется к главным таблицам вкладок: Исполнители, Авто, Штрафы,
       Осмотры, Ремонты, Звонки и т.п.

       Поведение:
       — таблица НЕ ограничена высотой окна (max-height: none),
       — Y-скролл уходит на страницу (overflow-y: visible),
       — X-скролл (для широких таблиц) остаётся локальным,
       — шапка таблицы прилипает к самому верху окна (position: sticky; top: 0),
         так что при прокрутке страницы вниз исчезают шапка вкладки и фильтры,
         а заголовки столбцов видны всё время.

       Это даёт стандартный «спредшит-эффект»: один общий скролл, и при
       прокрутке колонки остаются на виду. Для таблиц внутри карточек
       (компактных) класс не ставим — у них свой локальный скролл.
       ────────────────────────────────────────────────────────────────── */
    /* ════════════════════════════════════════════════════════════════
       ПРАВИЛО 16a (DATA TABLES UX) — модель скролла «app-shell»
       для всех главных таблиц вкладок (.full-window):

       1. Body-скролл работает для контента ВЫШЕ обёртки таблицы
          (заголовок вкладки, кнопки, виджеты).
       2. .tab-filters-sticky — sticky top:0 к окну (липнет к верху,
          когда заголовок вкладки уехал вверх по body-скроллу).
       3. .data-table-wrap.full-window — sticky top: var(--filters-h),
          height: calc(100vh - var(--filters-h) - 8px). Растянута до
          низа окна, внутри — собственный скролл по X и Y.
       4. thead th — sticky top:0 ВНУТРИ обёртки (не относительно окна).
       5. Левый верхний угол (thead × sticky-col) — top:0 left:0
          с самым высоким z-index, чтобы перекрывал и шапку и колонку.

       Реальная высота .tab-filters-sticky пробрасывается из
       tables.js → syncStickyOffsets() в CSS-переменную --filters-h.

       Применяется к: Исполнители, Авто, Штрафы, Колл-центр, Регламенты,
       Лизинг, Подбор, Глонасс, Склады, Ремонты, Сотрудники, Осмотры,
       Статусы и любым новым «главным» таблицам вкладок.
       ════════════════════════════════════════════════════════════════ */
    .data-table-wrap.full-window {
        position: sticky !important;
        top: var(--filters-h, 60px) !important;
        height: calc(100vh - var(--filters-h, 60px) - 8px) !important;
        max-height: none !important;
        overflow: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
    }
    /* Поисковая строка / фильтры над .full-window таблицей.
       Sticky к верху окна, как только заголовок вкладки уехал вверх
       по body-скроллу. */
    .tab-filters-sticky {
        position: sticky !important;
        top: 0 !important;
        z-index: 40 !important;
        /* Цвет фона под body (#f8fafc), чтобы строка фильтров сливалась с
           рабочим пространством — без эффекта «поле-в-поле». */
        background: #f8fafc !important;
        padding: 8px 0 !important;
        /* ВАЖНО: overflow:visible — иначе popup'ы шестерёнки/филтра внутри
           обрезаются обёрткой overflow-x-auto.
           Правило premium-layout: popup всегда поверх всего. */
        overflow: visible !important;
    }
    /* Тонкий скроллбар у контейнеров подвкладок (overflow-x-auto). */
    .vehicles-subtab,
    .repair-subtab,
    .cc-subtab,
    .rc-view-btn,
    .rep-tab,
    .settings-nav,
    .emp-subtab,
    .users-subnav { /* dummy — see below */ }
    /* Контейнеры подвкладок: делаем горизонтальный скроллбар тоньше.
       WebKit + Firefox. */
    div.flex.items-center.gap-1.overflow-x-auto::-webkit-scrollbar,
    div.mb-2.flex.items-center.overflow-x-auto::-webkit-scrollbar { height: 4px; }
    div.flex.items-center.gap-1.overflow-x-auto::-webkit-scrollbar-thumb,
    div.mb-2.flex.items-center.overflow-x-auto::-webkit-scrollbar-thumb {
        background: rgba(148,163,184,0.4); border-radius: 2px;
    }
    div.flex.items-center.gap-1.overflow-x-auto,
    div.mb-2.flex.items-center.overflow-x-auto {
        scrollbar-width: thin; scrollbar-color: rgba(148,163,184,0.4) transparent;
    }
    /* Pill-style горизонтальные подвкладки (vehicles/statuses/glonass и т.п.).
       Активная подвкладка — заливка светло-amber, без длинной нижней полосы. */
    .vehicles-subtab,
    .repair-subtab,
    .cc-subtab,
    .rc-view-btn,
    .rep-tab,
    .settings-nav,
    .emp-subtab,
    .users-subnav {
        padding: 6px 14px !important;
        background: transparent !important;
        border: none !important;
        border-bottom: none !important;
        border-radius: 8px !important;
        color: #6b7280 !important;
        font-weight: 500 !important;
        font-size: 13px !important;
        cursor: pointer !important;
        white-space: nowrap;
        transition: background 0.15s, color 0.15s !important;
    }
    .vehicles-subtab:hover,
    .repair-subtab:hover,
    .cc-subtab:hover,
    .rc-view-btn:hover,
    .rep-tab:hover,
    .settings-nav:hover,
    .emp-subtab:hover,
    .users-subnav:hover {
        background: rgba(245,158,11,0.06) !important;
        color: #111827 !important;
    }
    .vehicles-subtab.active,
    .repair-subtab.active,
    .cc-subtab.active,
    .rc-view-btn.active,
    .rep-tab.active,
    .settings-nav.active,
    .emp-subtab.active,
    .users-subnav.active {
        /* Тот же жёлтый, что и у `.btn-yellow` (+ Создать) — единый акцент бренда. */
        background: #F59E0B !important;
        color: #000 !important;
        font-weight: 600 !important;
    }
    /* Убираем синий браузерный focus-ring у pill-подвкладок — он перекрывает амбер. */
    .vehicles-subtab,
    .repair-subtab,
    .cc-subtab,
    .rc-view-btn,
    .rep-tab,
    .settings-nav,
    .emp-subtab,
    .users-subnav {
        outline: none !important;
    }
    .vehicles-subtab:focus,
    .repair-subtab:focus,
    .cc-subtab:focus,
    .rc-view-btn:focus,
    .rep-tab:focus,
    .settings-nav:focus,
    .emp-subtab:focus,
    .users-subnav:focus,
    .vehicles-subtab:focus-visible,
    .repair-subtab:focus-visible,
    .cc-subtab:focus-visible,
    .rc-view-btn:focus-visible,
    .rep-tab:focus-visible,
    .settings-nav:focus-visible,
    .emp-subtab:focus-visible,
    .users-subnav:focus-visible {
        outline: none !important;
        box-shadow: none !important;
    }
    /* Шапка таблицы — sticky top:0 ВНУТРИ обёртки (scrollport — сама
       обёртка, а не окно). При вертикальном скролле внутри обёртки
       шапка остаётся на месте. */
    .data-table-wrap.full-window.below-sticky-filters thead th,
    .data-table-wrap.full-window.below-sticky-filters thead tr th {
        position: sticky !important;
        top: 0 !important;
        z-index: 25 !important;
        background: #ffffff !important;
    }
    /* Левый верхний угол: пересечение thead × первый столбец —
       z-index выше обоих, чтобы при одновременном sticky top+left
       обе оси работали. top:0 относительно scrollport обёртки. */
    .data-table-wrap.full-window.below-sticky-filters thead tr th:first-child,
    .data-table-wrap.full-window.below-sticky-filters thead tr th.sticky-col {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 31 !important;
        background: #f8fafc !important;
        box-shadow: inset -1px -1px 0 #e2e8f0;
    }
    /* Tbody-ячейки sticky-col (первый «прибитый» столбец) — тоже белый фон,
       чтобы прилипшая шапка их полностью перекрывала, а они полностью
       перекрывали соседние tbody-ячейки при горизонтальном скролле. */
    .data-table-wrap.full-window td.sticky-col {
        background: #ffffff;
    }

    /* Утилитарный класс для скрытия отдельных ячеек (используется шестерёнкой
       управления столбцами в Колл-центре и других таблицах). */
    .data-table .cell-hidden,
    .data-table-wrap .cell-hidden {
        display: none !important;
    }

    /* Empty/loading placeholder — sibling of <table>, avoids colspan cell merging */
    .data-table-placeholder {
        padding: 32px 16px;
        text-align: center;
        color: #94a3b8;
        font-size: 13px;
        background: #ffffff;
    }
    .data-table-wrap > .data-table-placeholder { border-top: 1px solid #f1f5f9; }

    /* Vehicles sticky table — legacy selectors still needed for settings flow */
    #vehicles-table { table-layout: fixed; }
    #vehicles-table th, #vehicles-table td {
        padding: 8px 12px;
        text-align: left;
        border-bottom: 1px solid #e2e8f0;
        font-size: 12px;
        color: #0f172a;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 0; /* Important: allow td to shrink below content width */
    }
    #vehicles-table td span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        max-width: 100%;
    }
    #vehicles-table th {
        background: #f8fafc;
        color: #475569;
        font-weight: 600;
        position: sticky;
        top: 0;
        z-index: 10;
        cursor: pointer;
        user-select: none;
        border-bottom: 1px solid #cbd5e1;
    }
    #vehicles-table th:hover { color: #d97706; }
    #vehicles-table th.sorted::after {
        content: '';
        display: inline-block;
        margin-left: 6px;
        border: 4px solid transparent;
    }
    #vehicles-table th.sorted.asc::after {
        border-bottom-color: #F59E0B;
        margin-bottom: 2px;
    }
    #vehicles-table th.sorted.desc::after {
        border-top-color: #F59E0B;
        margin-top: 2px;
    }
    /* Sticky first column */
    #vehicles-table th.sticky-col, #vehicles-table td.sticky-col {
        position: sticky;
        left: 0;
        background: #ffffff;
        z-index: 5;
        border-right: 1px solid #e2e8f0;
    }
    #vehicles-table th.sticky-col {
        background: #f8fafc;
        z-index: 15;
    }
    #vehicles-table tbody tr:hover td { background: #f8fafc; }
    #vehicles-table tbody tr:hover td.sticky-col { background: #f1f5f9; }

    .col-item {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 8px;
        border-radius: 8px;
        cursor: move;
        font-size: 12px;
        color: #334155;
    }
    .col-item:hover { background: #f1f5f9; }
    .driver-card-tab { border-bottom: 2px solid transparent; transition: all 0.15s; cursor: pointer; }
    .driver-card-tab.active { color: #f59e0b; border-bottom-color: #f59e0b; }
    .driver-card-tab:hover { color: #d97706; }
    .col-item.dragging { opacity: 0.4; }
    .col-item input[type="checkbox"] { accent-color: #F59E0B; }

    /* Inspections tab: stretch table to bottom */
    #tab-inspections.active { display: flex; flex-direction: column; height: calc(100vh - 48px); }
    #tab-inspections.active > #inspections-create-view:not(.hidden) { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
    #tab-inspections.active > #inspections-create-view.hidden { display: none !important; }
    #tab-inspections.active > #inspections-create-view > #inspections-history { flex: 1; min-height: 0; max-height: none !important; }

    /* Callcenter tab: stretch table to bottom */
    #tab-callcenter.active { display: flex; flex-direction: column; height: calc(100vh - 48px); }
    #tab-callcenter.active > #calls-list-view:not(.hidden) { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    #tab-callcenter.active > #calls-list-view.hidden { display: none !important; }
    #tab-callcenter.active > #calls-detail-view:not(.hidden) { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
    #tab-callcenter.active > #calls-detail-view.hidden { display: none !important; }
    #tab-callcenter.active > #calls-list-view > #calls-table-wrap { flex: 1; min-height: 0; max-height: none !important; }

    /* =========================================================
       AI-саппорт — плавающая кнопка и панель чата
       ========================================================= */
    #support-chat-fab {
        position: fixed;
        right: 20px;
        bottom: 20px;
        width: 52px; height: 52px;
        border-radius: 50%;
        background: linear-gradient(135deg, #F59E0B 0%, #d97706 100%);
        color: #0f172a;
        border: none;
        box-shadow: 0 8px 24px rgba(245,158,11,0.35);
        cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        z-index: 9998;
        transition: transform 0.15s, box-shadow 0.15s;
    }
    #support-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(245,158,11,0.45); }
    #support-chat-fab.hidden { display: none; }

    #support-chat-panel {
        position: fixed;
        right: 20px;
        bottom: 20px;
        width: 380px;
        height: 560px;
        max-height: calc(100vh - 40px);
        background: #ffffff;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(15,23,42,0.25);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        z-index: 9999;
        border: 1px solid #e2e8f0;
    }
    #support-chat-panel.hidden { display: none; }
    @media (max-width: 480px) {
        #support-chat-panel {
            right: 0; bottom: 0; left: 0;
            width: 100%; height: 100%;
            max-height: 100vh;
            border-radius: 0;
        }
    }

    .support-chat-header {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        color: #fff;
        padding: 12px 16px;
        display: flex; align-items: center; justify-content: space-between;
        flex-shrink: 0;
    }
    .support-chat-avatar {
        width: 32px; height: 32px;
        border-radius: 50%;
        background: #F59E0B;
        color: #0f172a;
        font-weight: 700; font-size: 12px;
        display: flex; align-items: center; justify-content: center;
    }

    .support-chat-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        background: #f8fafc;
        display: flex; flex-direction: column; gap: 8px;
    }
    .support-chat-msg {
        max-width: 85%;
        padding: 8px 12px;
        border-radius: 12px;
        font-size: 13px;
        line-height: 1.4;
        word-wrap: break-word;
        white-space: pre-wrap;
    }
    .support-chat-msg-user {
        align-self: flex-end;
        background: #F59E0B;
        color: #0f172a;
        border-bottom-right-radius: 4px;
    }
    .support-chat-msg-assistant {
        align-self: flex-start;
        background: #ffffff;
        color: #0f172a;
        border: 1px solid #e2e8f0;
        border-bottom-left-radius: 4px;
    }
    .support-chat-msg-loading {
        align-self: flex-start;
        color: #94a3b8;
        font-style: italic;
        font-size: 12px;
    }
    .support-chat-msg-error {
        align-self: stretch;
        background: #fef2f2;
        color: #991b1b;
        border: 1px solid #fecaca;
        font-size: 12px;
    }

    .support-chat-input {
        display: flex; gap: 8px; align-items: flex-end;
        padding: 10px 12px;
        border-top: 1px solid #e2e8f0;
        background: #ffffff;
        flex-shrink: 0;
    }
    .support-chat-input textarea {
        flex: 1;
        resize: none;
        border: 1px solid #cbd5e1;
        border-radius: 10px;
        padding: 8px 10px;
        font-size: 13px;
        font-family: inherit;
        max-height: 120px;
        outline: none;
    }
    .support-chat-input textarea:focus { border-color: #F59E0B; }
    .support-chat-input button { align-self: stretch; }

/* ==== AI-импорт: модальное окно =========================================== */
.ai-import-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.ai-import-modal.hidden { display: none; }
.ai-import-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.ai-import-dialog {
    position: relative; background: #fff; border-radius: 12px;
    width: min(920px, 95vw); max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.ai-import-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #eee;
}
.ai-import-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.ai-import-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 18px; border-top: 1px solid #eee;
}
.ai-imp-two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 700px) { .ai-imp-two-col { grid-template-columns: 1fr; } }
.ai-imp-table-wrap { max-height: 340px; overflow-y: auto; border: 1px solid #eee; border-radius: 6px; padding: 6px 10px; }
.ai-import-dialog .input-sm { padding: 2px 6px; font-size: 12px; }

/* thumbs up/down для ответов ассистента */
.support-chat-fb { margin-top: 6px; display: flex; gap: 4px; opacity: 0.55; transition: opacity .15s; }
.support-chat-msg-assistant:hover .support-chat-fb { opacity: 1; }
.support-chat-fb button {
    background: none; border: 1px solid rgba(0,0,0,0.08);
    border-radius: 4px; padding: 1px 5px; font-size: 12px; cursor: pointer;
}
.support-chat-fb button:hover { background: rgba(0,0,0,0.04); }
.support-chat-fb button.active { background: #F59E0B33; border-color: #F59E0B; }

/* история чатов — выдвижная панель внутри чата */
.support-chat-history {
    position: absolute; left: 0; right: 0; top: 54px; bottom: 60px;
    background: #fff; border-top: 1px solid #eee; z-index: 5;
    display: flex; flex-direction: column;
}
.support-chat-history.hidden { display: none; }
.support-chat-history-title { padding: 10px 14px; font-weight: 600; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.support-chat-history-list { flex: 1; overflow-y: auto; }
.support-chat-history-item {
    padding: 10px 14px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background .1s;
}
.support-chat-history-item:hover { background: #FFF7E6; }
.support-chat-history-item-title { font-size: 13px; color: #222; line-height: 1.3; }
.support-chat-history-item-date { font-size: 11px; color: #999; margin-top: 2px; }
#support-chat-panel { position: fixed; }

/* ============ RECRUITMENT: Лиды/Сделки + Канбан/Список ============ */
.rc-navbar { padding: 4px 0; }
.rc-entity-tabs { background: #f1f5f9; padding: 4px; border-radius: 10px; }
.rc-entity-tab {
    padding: 8px 18px; border: none; background: transparent;
    border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
    color: #64748b; transition: all .12s; display: inline-flex; align-items: center; gap: 6px;
}
.rc-entity-tab:hover { color: #d97706; }
.rc-entity-tab.active { background: #fff; color: #111827; box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.rc-entity-count {
    background: #e2e8f0; color: #475569; font-size: 11px; padding: 2px 7px;
    border-radius: 10px; font-weight: 600; min-width: 20px; text-align: center;
}
.rc-entity-tab.active .rc-entity-count { background: #fef3c7; color: #d97706; }

.rc-view-toggle { background: #f1f5f9; padding: 3px; border-radius: 8px; }
.rc-view-btn {
    padding: 6px 12px; border: none; background: transparent; border-radius: 6px;
    cursor: pointer; font-size: 13px; color: #64748b; transition: all .12s;
    display: inline-flex; align-items: center; gap: 6px;
}
.rc-view-btn:hover { color: #d97706; }

/* Legal affairs (Юр дела) view toggle — отдельный класс,
   чтобы не конфликтовать с глобальным querySelector('.rc-view-btn') в recruitment.js */
.lg-view-btn {
    padding: 6px 14px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px !important;
    color: #6b7280 !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    cursor: pointer !important;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s !important;
    outline: none !important;
}
.lg-view-btn:hover { background: rgba(245,158,11,0.06) !important; color: #111827 !important; }
.lg-view-btn.active { background: #F59E0B !important; color: #000 !important; font-weight: 600 !important; }
.rc-view-btn.active { background: #fff; color: #111827; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 500; }

/* Канбан */
.rc-kanban-wrap { overflow-x: auto; padding-bottom: 8px; }
.rc-kanban { display: flex; gap: 10px; min-height: 60vh; align-items: flex-start; }
.rc-kanban-col {
    flex: 0 0 280px; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 8px; max-height: 72vh; display: flex; flex-direction: column;
    position: relative; min-width: 120px;
}
.rc-kanban-col-resizer {
    position: absolute; top: 0; right: -3px; width: 6px; height: 100%;
    cursor: col-resize; z-index: 10; background: transparent;
    transition: background 0.15s;
}
.rc-kanban-col-resizer:hover, .rc-kanban-col-resizer.active {
    background: rgba(245, 158, 11, 0.4);
}
.rc-kanban-col.drag-over { background: #fef3c7; border-color: #f59e0b; }
.rc-kanban-col-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 6px 8px; border-bottom: 1px solid #e2e8f0; margin-bottom: 6px;
}
.rc-kanban-col-title {
    font-size: 12px; font-weight: 600; color: #334155;
    text-transform: uppercase; letter-spacing: .02em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px;
}
.rc-kanban-col-count {
    font-size: 11px; background: #e2e8f0; color: #475569;
    padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.rc-kanban-col-body { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.rc-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: 8px 10px; cursor: grab; transition: all .12s;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.rc-card:hover { border-color: #f59e0b; box-shadow: 0 2px 6px rgba(245,158,11,.15); }
.rc-card:active { cursor: grabbing; }
.rc-card.dragging { opacity: .4; }
.rc-card-name { font-size: 13px; font-weight: 600; color: #111827; line-height: 1.3; margin-bottom: 4px; }
.rc-card-phone { font-size: 11px; color: #6b7280; font-family: ui-monospace, monospace; }
.rc-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 6px; }
.rc-card-source { font-size: 10px; color: #64748b; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.rc-card-date { font-size: 10px; color: #9ca3af; }
.rc-kanban-empty { text-align: center; padding: 40px 20px; color: #9ca3af; font-size: 13px; }

/* ── Внутренний мессенджер ─────────────────────────────────────────── */
.chat-side-tab { color: #64748b; border-bottom: 2px solid transparent; transition: all 0.15s; background: transparent; }
.chat-side-tab.active { color: #b45309; border-bottom-color: #f59e0b; background: #fffbeb; }
.chat-side-tab:hover:not(.active) { background: #f8fafc; }
#chat-thread .group:hover .msg-actions { display: flex !important; }
.msg-flash { animation: msgFlash 1.5s ease-out; }
@keyframes msgFlash {
    0% { background: #fef3c7; }
    100% { background: transparent; }
}
.chat-list-item.bg-amber-50 { background: #fef3c7 !important; }
