/* Шрифт Inter хранится на нашем сервере (vendor/inter) — без Google Fonts. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/vendor/inter/inter-latin-400.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/vendor/inter/inter-cyrillic-400.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/vendor/inter/inter-latin-500.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/vendor/inter/inter-cyrillic-500.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/vendor/inter/inter-latin-600.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/vendor/inter/inter-cyrillic-600.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/vendor/inter/inter-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/vendor/inter/inter-cyrillic-700.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

/* ===== TransitVeer Design System v1.0 ===== */
:root {
    --bg: #F5F8FC;
    --surface: #FFFFFF;
    --surface-2: #EEF4FA;
    --text: #0A1D35;
    --text-secondary: #52657D;
    --primary: #1264F5;
    --primary-hover: #1687FF;
    --cyan: #16D4FF;
    --border: #D8E3EF;

    --success: #18A66A;
    --warning: #C88600;
    --danger: #D64545;
    --info: #1687FF;
    --delivered: #7157C8;
    /* ТС в ремонте (24 окт 2026) — намеренно коричневый, не пересекается
       с остальной палитрой (успех/предупреждение/опасность/инфо/доставлен). */
    --repair: #8A5A2E;

    --control-height: 32px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --sidebar-bg: #0A1D35;
}

body.dark-theme {
    --bg: #071426;
    --surface: #0D2038;
    --surface-2: #122943;
    --text: #F4F8FF;
    --text-secondary: #A7B9CD;
    --primary: #1687FF;
    --primary-hover: #2B9BFF;
    --cyan: #16D4FF;
    --border: #23405E;

    --success: #35C98A;
    --warning: #FFC247;
    --danger: #FF6262;
    --info: #49A5FF;
    --delivered: #A896FF;
    --repair: #C08A52;

    --sidebar-bg: #071426;
}

/* ===== Общие ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    padding: 0;
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }

/* Находка (13 октября, старт мобильной версии для остальных ролей):
   нативный <input type="file"> (например, загрузка Rate Confirmation
   на странице рейсов) у некоторых браузеров имеет собственную
   внутреннюю минимальную ширину (кнопка "Выбрать файл" + текст имени
   файла) и не сжимается вместе с остальной формой — на телефоне из-за
   этого одного поля могла съезжать вбок вся страница. max-width:100%
   не меняет вид поля там, где места и так достаточно. */
input[type="file"] {
    max-width: 100%;
}

/* Находка (13 октября, мобильная версия — Отчёты): графики Chart.js
   рисуются в <canvas> с внутренней пиксельной шириной (по умолчанию
   браузера, пока сам Chart.js не пересчитает размер под контейнер) —
   без max-width это не давало карточке графика сжаться на телефоне. */
canvas {
    max-width: 100%;
}

/* ===== App Layout (sidebar + content) ===== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar (тёмный navy в обеих темах — брендовая константа) ===== */
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: #F4F8FF;
    position: fixed;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
}

.sidebar nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-logout {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0;
}
.sidebar-logout a {
    color: #A7B9CD;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    padding: 10px 20px;
}
.sidebar-logout a:hover {
    background: rgba(22, 135, 255, 0.12);
}
.sidebar-logout a i {
    width: 20px;
    color: var(--cyan);
}

.sidebar-bottom-logo {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-bottom-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar .logo {
    font-size: 20px;
    font-weight: 700;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.company-name {
    text-align: center;
    font-size: 12px;
    color: #A7B9CD;
    padding: 8px 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-height: 14px;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin-top: 12px;
}

.sidebar nav ul li {
    padding: 10px 20px;
    border-left: 3px solid transparent;
}

.sidebar nav ul li a {
    color: #A7B9CD;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.sidebar nav ul li:hover {
    background: rgba(22, 135, 255, 0.12);
}

.sidebar nav ul li.active {
    background: rgba(22, 135, 255, 0.16);
    border-left: 3px solid var(--cyan);
}

.sidebar nav ul li a i {
    width: 20px;
    color: var(--cyan);
}

/* ===== Раскрывающиеся группы меню (Фаза 13) ===== */
.menu-group > a {
    cursor: pointer;
}
.menu-sublist {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
    padding-left: 0;
    margin: 0;
}
.menu-group.expanded > .menu-sublist {
    max-height: 500px;
}
.menu-group.expanded > a .menu-group-arrow {
    transform: rotate(180deg);
}
.menu-sublist li {
    padding-left: 8px !important;
    padding-right: 8px !important;
}
.menu-sublist li a {
    font-size: 14px !important;
}
.menu-sublist li a i {
    width: 16px !important;
}

/* ===== Content ===== */
.content {
    margin-left: 220px;
    padding: 20px 30px;
    flex: 1;
    /* Находка (13 октября, старт мобильной версии для остальных ролей):
       у flex-элемента по умолчанию min-width:auto — он НЕ сжимается
       уже своей "естественной" ширины, которую диктует самый широкий
       потомок (например, таблица рейсов в 15 колонок). На телефоне
       это означало, что .content целиком растягивался на сотни
       лишних пикселей и уезжал за край экрана вместе с хэдером и
       фильтрами — overflow-x:auto на отдельной таблице (см.
       .table-container выше) тут не помогал, потому что сам контейнер
       даже не пытался стать уже. min-width:0 разрешает .content
       сжиматься до ширины экрана; после этого переполнение берёт на
       себя именно .table-container, как и задумано. На десктопе, где
       доступного места и так достаточно, это ничего не меняет. */
    min-width: 0;
    background: var(--bg);
    min-height: 100vh;
}

.content header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: var(--surface);
    padding: 15px 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(10,29,53,0.06);
}

.content header h1 {
    font-size: 24px;
    color: var(--text);
    display: flex;
    align-items: center;
}

.status {
    font-size: 14px;
    color: var(--success);
    background: var(--surface-2);
    padding: 5px 15px;
    border-radius: var(--radius-pill);
}

/* ===== KPI Cards =====
   Модуль 13, Удобство: раньше была жёсткая сетка repeat(4, 1fr) — ровно
   под старые 4 карточки дашборда (единственная страница, где используется
   класс .kpi). На дашборде добавились ещё 2 карточки (ТС в ремонте, ждут
   подтверждения) — auto-fit сам подбирает число колонок по ширине вместо
   жёстко заданных 4, так что добавлять туда новые карточки в будущем
   можно будет не трогая CSS. */
.kpi {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--primary), var(--cyan)) 1;
    box-shadow: 0 2px 8px rgba(10,29,53,0.06);
    text-align: center;
}

.card h3 {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
    font-weight: 600;
}

.card div {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

/* ===== Rows & Columns ===== */
.row {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.col {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 15px;
    box-shadow: 0 2px 8px rgba(10,29,53,0.06);
}

.col h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text);
}

.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: 0 2px 8px rgba(10,29,53,0.06);
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--surface-2);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}

tr:hover {
    background: var(--surface-2);
}

/* ===== Сортировка таблиц по клику на заголовок (table-sort.js) =====
   Класс навешивается на сортируемые <th>; .sort-arrow — маленькая
   стрелка направления сортировки, которая живёт внутри заголовка и не
   пропадает при перерисовке tbody.innerHTML (мы её не трогаем). */
th.sortable-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable-th:hover {
    color: var(--primary);
}
th.sortable-th .sort-arrow {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.35; /* нейтральная ⇅ — видна, но не отвлекает, пока столбец не выбран */
}
th.sortable-th .sort-arrow.sort-arrow--active {
    opacity: 0.9;
    color: var(--primary);
}

/* ===== Скрываемые колонки таблиц (Column Manager) =====
   Класс навешивается на сам <table>, поэтому переживает перерисовку tbody.innerHTML.
   :not([colspan]) — чтобы не прятать строки-заглушки "Загрузка.../Нет данных",
   у которых одна ячейка на всю ширину таблицы. */
table.hide-col-1 th:nth-child(1), table.hide-col-1 td:nth-child(1):not([colspan]) { display: none; }
table.hide-col-2 th:nth-child(2), table.hide-col-2 td:nth-child(2):not([colspan]) { display: none; }
table.hide-col-3 th:nth-child(3), table.hide-col-3 td:nth-child(3):not([colspan]) { display: none; }
table.hide-col-4 th:nth-child(4), table.hide-col-4 td:nth-child(4):not([colspan]) { display: none; }
table.hide-col-5 th:nth-child(5), table.hide-col-5 td:nth-child(5):not([colspan]) { display: none; }
table.hide-col-6 th:nth-child(6), table.hide-col-6 td:nth-child(6):not([colspan]) { display: none; }
table.hide-col-7 th:nth-child(7), table.hide-col-7 td:nth-child(7):not([colspan]) { display: none; }
table.hide-col-8 th:nth-child(8), table.hide-col-8 td:nth-child(8):not([colspan]) { display: none; }
table.hide-col-9 th:nth-child(9), table.hide-col-9 td:nth-child(9):not([colspan]) { display: none; }
table.hide-col-10 th:nth-child(10), table.hide-col-10 td:nth-child(10):not([colspan]) { display: none; }
table.hide-col-11 th:nth-child(11), table.hide-col-11 td:nth-child(11):not([colspan]) { display: none; }
table.hide-col-12 th:nth-child(12), table.hide-col-12 td:nth-child(12):not([colspan]) { display: none; }
table.hide-col-13 th:nth-child(13), table.hide-col-13 td:nth-child(13):not([colspan]) { display: none; }
table.hide-col-14 th:nth-child(14), table.hide-col-14 td:nth-child(14):not([colspan]) { display: none; }

/* Кнопка "⚙ Колонки" рядом с таблицей */
.col-manager-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 8px;
}
.col-manager-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
}
.col-manager-btn:hover {
    background: var(--surface-2);
}
.col-manager-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(10,29,53,0.12);
    padding: 8px 0;
    min-width: 220px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 50;
}
.col-manager-dropdown.open {
    display: block;
}
.col-manager-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    font-weight: normal;
}
.col-manager-dropdown label:hover {
    background: var(--surface-2);
}
.col-manager-dropdown input[type="checkbox"] {
    width: auto;
}

/* ===== Компактный режим таблиц (глобальный переключатель) ===== */
body.compact-tables table th,
body.compact-tables table td {
    padding: 2px 6px;
    font-size: 12px;
}
body.compact-tables table th {
    font-size: 11px;
}

/* ===== Status Badges (семантические цвета; никогда не brand-blue) ===== */
.status-badge {
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}
.status-available { background: rgba(24,166,106,0.20); color: var(--success); }
.status-reserved   { background: rgba(200,134,0,0.20); color: var(--warning); }
.status-loaded     { background: rgba(22,135,255,0.20); color: var(--info); }
.status-delivered  { background: rgba(113,87,200,0.20); color: var(--delivered); }
/* ТС в ремонте (24 окт 2026, просьба пользователя) — виртуальный статус
   поверх обычного (available/reserved/loaded/delivered), выставляется на
   фронтенде, когда у машины vehicle.in_repair=true; в этом состоянии
   машину нельзя выбрать в рейс и нельзя поставить резерв. */
.status-repair      { background: rgba(138,90,46,0.20); color: var(--repair); }

body.dark-theme .status-available { background: rgba(53,201,138,0.32); color: var(--success); }
body.dark-theme .status-reserved   { background: rgba(255,194,71,0.32); color: var(--warning); }
body.dark-theme .status-loaded     { background: rgba(73,165,255,0.32); color: var(--info); }
body.dark-theme .status-delivered  { background: rgba(168,150,255,0.32); color: var(--delivered); }
body.dark-theme .status-repair     { background: rgba(192,138,82,0.32); color: var(--repair); }

/* Статусы заявок на ремонт (Модуль 2 — механик) — отдельный набор имён,
   не пересекается со статусами рейса/ТС выше. */
.status-reported    { background: rgba(214,69,69,0.15); color: var(--danger); }
.status-assigned     { background: rgba(230,180,50,0.18); color: #a9781a; }
.status-in_progress  { background: rgba(30,120,220,0.15); color: #1e78dc; }
.status-completed    { background: rgba(40,160,90,0.15); color: #28a05a; }

/* ===== Buttons ===== */
.action-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 13px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 10px;
    font-weight: 600;
}
.action-btn:hover {
    background: var(--primary-hover);
}
.danger-btn {
    background: var(--danger);
}
.danger-btn:hover {
    filter: brightness(1.1);
}
.success-btn {
    background: var(--success);
}
.success-btn:hover {
    filter: brightness(1.1);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 8px;
}
.form-group label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
/* Американские поля и колонки (MC#, DOT#, FMCSA, Samsara и т.п.) на
   испанской установке не нужны: units.js ставит html.region-es. */
html.region-es .us-only { display: none !important; }

/* Обязательные поля — красная звёздочка у подписи. Работает для любой
   формы автоматически (:has() поддерживается всеми современными браузерами),
   не нужно помечать поля вручную на каждой странице. */
.form-group:has(> input:required) > label::after,
.form-group:has(> select:required) > label::after,
.form-group:has(> textarea:required) > label::after {
    content: " *";
    color: var(--danger);
    font-weight: 700;
}
.form-group input,
.form-group select {
    width: 100%;
    height: var(--control-height);
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
}
/* "Расчётная прибыль"/"Минимальная ставка" на форме рейса — поля вне
   .form-group (своя раскладка), поэтому правило выше их не красит, и без
   этого браузер рисовал текст цветом по умолчанию (чёрным) — на тёмном
   фоне --surface-2 в тёмной теме это не видно (жалоба пользователя
   8 октября). Стилевое правило, а не inline-цвет в HTML: JS в trips.js
   (_runProfitEstimate) временами явно сбрасывает цвет через
   el.style.color = '' (когда не нужно подсвечивать красным/зелёным) —
   inline-цвет такой сброс стирает начисто, а это правило остаётся и
   корректно просвечивает снова как база.
*/
#calculatedProfit, #costBasis { color: var(--text); }
/* Точечные поля ввода прямо в ячейках таблиц (например, предложение цены
   на странице "Грузы") — тот же визуальный стиль, что и у полей форм. */
.table-input {
    height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
}
.table-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18,100,245,0.18);
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18,100,245,0.18);
}
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

/* ===== Проверка полей формы — единый стиль для всех форм (см.
   tv-form-validation в shared-ui.js). Красная рамка у невалидного поля +
   понятная подпись под ним вместо того, чтобы рассчитывать на системную
   всплывающую подсказку браузера (она не всегда по-русски и легко
   остаётся незамеченной). ===== */
.form-group input.tv-field-error,
.form-group select.tv-field-error,
.form-group textarea.tv-field-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(214,69,69,0.15);
}
.tv-field-error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-top: 3px;
    line-height: 1.3;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 4px;
    flex-wrap: wrap;
}
.tab-btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.tab-btn:hover {
    background: var(--border);
}
.tab-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(10,29,53,0.12);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ===== History scroll ===== */
.history-scroll {
    max-height: 440px;
    overflow-y: auto;
}
.history-scroll table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ===== Filters ===== */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}
.filters label {
    font-weight: 500;
    font-size: 12px;
}
.filters select,
.filters input {
    padding: 5px 8px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
}

/* ===== Export filters ===== */
.export-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}
.export-filters label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    font-size: 12px;
}
.export-filters select,
.export-filters input {
    padding: 5px 8px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
}

/* ===== Settings sections ===== */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(10,29,53,0.06);
    margin-bottom: 20px;
}
.settings-section h2 {
    margin-bottom: 15px;
    font-size: 20px;
}

/* ===== Planner ===== */
.planner-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

/* ===== Автоподсказки городов / клиента ===== */
.autocomplete-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 10px rgba(10,29,53,0.1);
}
.autocomplete-suggestions.open { display: block; }
.autocomplete-suggestions div {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}
.autocomplete-suggestions div:hover,
.autocomplete-suggestions div.active {
    background: var(--surface-2);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .kpi {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar .logo {
        font-size: 14px;
        padding: 10px;
    }
    .company-name {
        display: none;
    }
    .sidebar nav ul li a span {
        display: none;
    }
    .sidebar nav ul li a i {
        font-size: 20px;
    }
    .content {
        margin-left: 60px;
        padding: 15px;
    }
    .kpi {
        grid-template-columns: 1fr;
    }
    .row {
        flex-direction: column;
    }
    header h1 {
        font-size: 18px;
    }
    /* Находка (13 октября, старт мобильной версии для остальных ролей):
       многие таблицы (рейсы — 15 колонок, список машин и т.д.) на
       ширине телефона шире самого экрана. Без этого правила такая
       таблица раздвигала всю страницу вбок (уезжал и сайдбар, и
       хэдер) — теперь в сторону скроллится только сама таблица
       внутри своей рамки, а не вся страница. Правило намеренно
       только здесь, внутри мобильного @media, а не в базовом классе
       .table-container: на десктопе у заголовков таблиц (th{position:
       sticky}) "прилипание" при прокрутке страницы считается
       относительно ближайшего предка со своим overflow — если дать
       .table-container overflow-x:auto безусловно, по спецификации
       CSS это заодно переводит и overflow-y в auto, контейнер
       становится (пустым) scroll-контекстом, и sticky-заголовок на 13
       других страниц сайта перестаёт следовать за прокруткой окна.
       Ограничив правило мобильным разрешением, десктоп это вообще не
       затрагивает (проверено независимым ревью 13 октября). */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
@media (max-width: 480px) {
    .content {
        padding: 10px;
    }
    .card div {
        font-size: 22px;
    }
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    .export-filters {
        flex-direction: column;
    }
    /* Находка (13 октября, старт мобильной версии для остальных ролей):
       форма карточки автомобиля (.vehicle-form-grid) устроена как
       строгая сетка 12 колонок, и каждое поле занимает в разметке
       фиксированный style="grid-column:span N" (2-4 из 12) — на
       ширине телефона это даёт 3-4 узких поля в ряд с наползающими
       друг на друга подписями. Отменяем разметку span'ов (у
       инлайн-style выше по специфичности, поэтому !important) и
       переводим каждое поле на всю ширину — ряд за рядом, как в
       обычной мобильной форме. Остальные страницы с обычными
       .form-row/.fg-* эта сетка не затрагивает (см. комментарий у
       .vehicle-form-grid выше). */
    .vehicle-form-grid {
        grid-template-columns: 1fr;
    }
    .vehicle-form-grid > .form-group {
        grid-column: 1 / -1 !important;
    }
}

/* ===== Логотип TransitVeer в заголовке "Главная" (зависит от темы) ===== */
.dash-logo {
    height: 100%;
    max-height: 100%;
    width: auto;
    vertical-align: middle;
    margin-right: 10px;
}
.dash-logo-dark { display: none; }
body.dark-theme .dash-logo-dark { display: inline-block; }
body.dark-theme .dash-logo-light { display: none; }

/* ===== Dark theme overrides (палитра уже переопределена переменными выше;
   здесь только то, что не покрывается var()) ===== */
body.dark-theme #vehicleList li {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-bottom-color: var(--border) !important;
}

/* ===== Кастомный календарь (Фаза 15) ===== */
.dp-wrap {
    position: relative;
    display: inline-block;
    width: 100%;
}
.dp-native {
    /* Не display:none — иначе некоторые браузеры блокируют программные
       .value-присвоения на скрытых полях; прячем визуально, но оставляем
       функциональным для остального кода, который читает/пишет .value. */
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    border: 0 !important;
    opacity: 0 !important;
}
.dp-display {
    width: 100%;
    height: var(--control-height);
    padding: 6px 34px 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}
.dp-display:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18,100,245,0.18);
}
.dp-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
    pointer-events: none;
}
.dp-popup {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 5000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 10px;
    width: 240px;
    user-select: none;
}
.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}
.dp-nav {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}
.dp-nav:hover {
    background: var(--surface-2);
    color: var(--text);
}
.dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.dp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.dp-day {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}
.dp-day:hover {
    background: var(--surface-2);
}
.dp-day.dp-empty {
    cursor: default;
}
.dp-day.dp-today {
    border: 1px solid var(--primary);
}
.dp-day.dp-selected {
    background: var(--primary);
    color: #fff;
}

/* ===== Всплывающие окна Google Maps (машины, рейсы) =====
   InfoWindow — отдельный DOM-узел Google, его фон всегда белый, тема
   приложения на него не распространяется. Текст без явного цвета
   наследует var(--text) от body — в тёмной теме это почти белый
   (#F4F8FF), и текст пропадает на белом фоне пузыря. Цвет здесь задан
   жёстко, не через переменные темы. */
.vehicle-popup, .trip-popup {
    color: #1a1a1a;
    font-size: 13px;
    line-height: 1.5;
}
.vehicle-popup b, .trip-popup b {
    color: #0a0a0a;
}
.vehicle-popup small, .trip-popup small {
    color: #666666;
}

/* ===== Модификаторы ширины form-group ===== */
.form-group.fg-xs   { flex: none; width: 80px;  }
.form-group.fg-sm   { flex: none; width: 110px; }
.form-group.fg-md   { flex: none; width: 145px; }
.form-group.fg-lg   { flex: none; width: 180px; }
.form-group.fg-auto { flex: 1;    min-width: 160px; }
/* Общая CSS Grid раскладка для формы автомобиля (просьба пользователя
   8 октября 2026 — выровнять окна полей по вертикали "как в таблице",
   чтобы форма выглядела так же аккуратно, как форма рейса). Раньше
   каждая смысловая группа полей была своим flex-рядом (.form-row) со
   своей собственной шириной полей (fg-xs/sm/md/lg), и границы колонок
   в соседних рядах не совпадали — окна оказывались "вразнобой". Эти
   правила используются ТОЛЬКО внутри .vehicle-form-grid — обычные
   .form-row/.fg-* на других страницах (рейсы, грузы и т.д.) не
   затронуты. 12 одинаковых по ширине колонок: каждое поле занимает
   grid-column:span N (см. разметку в fleet-vehicles.html), и сумма
   span у полей одной смысловой группы равна 12 — следующая группа
   сама переносится на новую строку сетки, а граница колонки №N у всех
   групп физически один и тот же пиксель на странице. */
.vehicle-form-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 8px 12px;
    align-items: start;
}
.vehicle-form-grid > .form-group {
    margin-bottom: 0;
    min-width: 0;
}
.searchable-select-wrapper { position: relative; }
.searchable-select-wrapper input.ss-input { width: 100%; height: var(--control-height); padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--surface); color: var(--text); box-sizing: border-box; }
.searchable-select-wrapper input.ss-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(18,100,245,0.18); }
.ss-dropdown { display: none; position: absolute; top: 100%; left: 0; width: 100%; max-height: 200px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1000; }
.ss-dropdown.open { display: block; }
.ss-option { padding: 6px 10px; font-size: 13px; cursor: pointer; color: var(--text); }
.ss-option:hover, .ss-option.active { background: var(--primary); color: #fff; }

/* "Фото и документы ТС" (21 окт 2026) — module_fleet, карточка автомобиля.
   Минимальный набор правил: дропзона для ZIP, фильтр-чипы категорий,
   сетка миниатюр, модалка-лайтбокс (сам лайтбокс собирается в JS с
   инлайн-разметкой, здесь только статичные размеры/рамки). */
.vehicle-media-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
}
.vehicle-media-dropzone:hover,
.vehicle-media-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--surface-2);
}
.vehicle-media-dropzone i.fa-file-archive { font-size: 22px; color: var(--text-secondary); margin-right: 6px; }

.vehicle-media-filter-btn {
    background: var(--surface-2);
    color: var(--text);
    opacity: 0.75;
}
.vehicle-media-filter-btn.active {
    background: var(--primary);
    color: #fff;
    opacity: 1;
}

.vehicle-media-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.vehicle-media-thumb {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-2);
    cursor: pointer;
    aspect-ratio: 1 / 1;
}
.vehicle-media-thumb img,
.vehicle-media-thumb .vehicle-media-pdf-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-secondary);
}
.vehicle-media-thumb .vehicle-media-checkbox {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    z-index: 2;
}
.vehicle-media-thumb .vehicle-media-status-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 10px;
    text-align: center;
    padding: 2px 0;
    color: #fff;
    background: rgba(0,0,0,0.55);
}
.vehicle-media-thumb .vehicle-media-status-badge.pending { background: rgba(214, 160, 20, 0.85); }
.vehicle-media-thumb .vehicle-media-status-badge.confirmed { background: rgba(37, 150, 90, 0.85); }
.vehicle-media-thumb .vehicle-media-status-badge.rejected { background: rgba(214, 69, 69, 0.85); }

.vehicle-media-review-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.vehicle-media-review-item:last-child { border-bottom: none; }
.ss-option.empty { color: var(--text-secondary); pointer-events: none; }
