/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — структура приложения: sidebar, nav, tab-содержимое, page header
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── App layout ───────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}
.container { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }

.crm-main {
    flex: 1;
    overflow: hidden;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 14px 16px;
    gap: 0;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.crm-sidebar {
    width: 240px;
    background: color-mix(in srgb, var(--bg) 92%, var(--bg-card) 8%);
    display: flex;
    flex-direction: column;
    padding: 14px 8px;
    flex-shrink: 0;
    min-height: 0;
}

/* Логотип в sidebar */
.sidebar-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background var(--motion-fast) var(--motion-ease-soft);
}
.sidebar-logo:hover { background: var(--bg-hover); }
.sidebar-icon-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.sidebar-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.crm-logo-img   { height: 28px; width: 28px; border-radius: 6px; object-fit: contain; }
.crm-logo-title { font-weight: 700; font-size: 14px; color: var(--text-primary); letter-spacing: -0.2px; }
.crm-logo-sub   { font-weight: 500; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }

/* Глобальный поиск */
.sidebar-search-wrap  { position: relative; padding: 4px 0 2px; }
.sidebar-search-wrap { display: none; }
.crm-sidebar.search-open .sidebar-search-wrap { display: block; }
.sidebar-search-input {
    width: 100%;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 9px;
    font-size: 11.5px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--motion-fast) var(--motion-ease-soft), background var(--motion-fast) var(--motion-ease-soft);
}
.sidebar-search-input:focus { border-color: var(--accent); background: var(--bg-card); }

.sidebar-search-dropdown {
    position: absolute;
    top: calc(100% - 4px);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    max-height: 340px;
    overflow-y: auto;
}
.search-group-title {
    font-size: 10px; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.6px;
    padding: 8px 12px 4px;
}
.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--motion-fast) var(--motion-ease-soft);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover      { background: var(--bg-hover); }
.search-result-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.search-result-sub  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.search-no-results  { padding: 12px; font-size: 12px; color: var(--text-muted); text-align: center; }

/* Навигация */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.nav-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    transition: transform var(--motion-fast) var(--motion-ease-soft);
}
.nav-group.dragging {
    opacity: 0.65;
}
.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-group-title {
    font-size: 11px; font-weight: 500;
    color: color-mix(in srgb, var(--text-muted) 70%, transparent);
    text-transform: none; letter-spacing: 0;
    margin: 6px 0 2px 6px; padding: 0 3px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background var(--motion-fast) var(--motion-ease-soft);
}
.nav-group-title:hover { background: var(--bg-hover); }
.nav-group-chevron {
    width: 12px; height: 12px; flex-shrink: 0;
    stroke-width: 2; color: var(--text-muted);
    transition: transform var(--motion-fast) var(--motion-ease-soft);
}
.nav-group-title.collapsed .nav-group-chevron {
    transform: rotate(-90deg);
}
.nav-group.collapsed .nav-group-items { display: none; }
.nav-icon {
    width: 13px; height: 13px; flex-shrink: 0;
    stroke-width: 1.75; color: var(--text-muted);
    transition: color var(--motion-fast) var(--motion-ease-soft);
}
.nav-item:hover .nav-icon { color: var(--text-primary); }
.nav-item.active .nav-icon { color: var(--accent); }
.sidebar-btn .nav-icon      { color: var(--text-muted); }
.sidebar-btn:hover .nav-icon{ color: var(--text-primary); }

.nav-item {
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 12.5px; font-weight: 500;
    line-height: 1.25;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft), transform var(--motion-fast) var(--motion-ease-soft);
}
.nav-item:hover:not(.disabled) { background: var(--bg-hover); color: var(--text-primary); }
.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 0;
    flex-shrink: 0;
}
.nav-item.active .nav-count { color: var(--accent); }
.nav-item.active {
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-card) 90%);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.nav-item.disabled { opacity: 0.42; cursor: not-allowed; pointer-events: none; }
.nav-item.dragging {
    opacity: 0.45;
    transform: scale(0.99);
}
.nav-item.drop-before,
.nav-group.drop-before .nav-group-title {
    box-shadow: inset 0 2px 0 var(--accent);
}
.nav-item.drop-after,
.nav-group.drop-after .nav-group-title {
    box-shadow: inset 0 -2px 0 var(--accent);
}
.nav-group-title.drop-inside {
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-card) 88%);
}

/* Footer sidebar */
.sidebar-footer {
    margin-top: 6px; padding: 6px 8px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-user-row {
    display: flex; align-items: center; gap: 8px;
    min-width: 0;
}
.sidebar-avatar {
    width: 28px; height: 28px; border-radius: 7px;
    background: color-mix(in srgb, var(--accent) 15%, var(--bg-card) 85%);
    color: var(--accent);
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
}
.sidebar-user-info {
    flex: 1; min-width: 0;
}
.sidebar-user-name {
    font-size: 12.5px; font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px; font-weight: 400;
    color: var(--accent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 1px;
}
.sidebar-user-actions {
    display: flex; align-items: center; gap: 1px; flex-shrink: 0;
}

/* Старый header — скрыт */
.crm-header { display: none !important; }

/* ── Tab-содержимое ───────────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    animation: fadeInUp var(--motion-base) var(--motion-ease) backwards;
}

/* Dashboard: отдельная прокрутка контента, без наложений */
#tab-dashboard.active {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0 !important;
}

/* Shipowners tabs: allow vertical page scroll for long content */
#tab-shipowner-pipeline.active,
#tab-shipowners-db.active {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 0 !important;
}

/* Finance: контент зафиксирован, скролл внутри таблиц */
#tab-finance.active {
    overflow: hidden;
    padding: 0 !important;
}

/* Карточка судовладельца: колоночная раскладка как у карточки моряка */
#shipowner-profile-page.active {
    overflow: hidden;
    padding: 0 !important;
}
#tab-dashboard .page-header {
    position: sticky;
    top: 0;
    z-index: 12;
    border-radius: 10px 10px 0 0;
}
#tab-dashboard thead th {
    position: static;
    top: auto;
}
#tab-dashboard .dash-row,
#tab-dashboard .dash-row-full {
    margin-left: 12px;
    margin-right: 12px;
}
#tab-dashboard .dash-stats-row {
    margin-left: 28px;
    margin-right: 28px;
    margin-top: 12px;
}
.profile-section        { display: none; }
.profile-section.active { display: block; }

/* ── Page header ──────────────────────────────────────────────────────────── */
h2 {
    color: var(--text-primary);
    margin: 0 0 10px;
    font-size: 13px; font-weight: 600; letter-spacing: -0.1px;
    display: flex; align-items: center; gap: 8px;
}
.page-title    { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.3px; margin: 0; }
.page-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; }

.page-header {
    display: flex; align-items: baseline;
    justify-content: space-between; gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
/* Sticky page header внутри tab-card */
.tab-content.active .page-header {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg-card) 92%, var(--bg) 8%);
    padding: 12px 20px; margin-bottom: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}

/* ── Pipeline — фиксированный layout ─────────────────────────────────────── */
#tab-pipeline.active {
    overflow: hidden;
    display: flex; flex-direction: column;
    min-height: 0;
    background: var(--bg-card) !important;
    padding: 0 !important;
}
#tab-pipeline .page-header {
    flex-shrink: 0;
    background: color-mix(in srgb, var(--bg-card) 92%, var(--bg) 8%);
    border-radius: 10px 10px 0 0;
    position: relative; z-index: 10;
    box-shadow: none;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
}

/* Внутренняя карточка с таблицей */
#pipeline-table-card {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden; min-height: 0;
    background: color-mix(in srgb, var(--bg-card) 92%, var(--bg) 8%) !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 8px 8px !important;
}

/* Фильтр-бар Pipeline */
#pipeline-filter-bar {
    flex-shrink: 0;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--bg-card) 82%, var(--bg) 18%);
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--border) 72%, transparent);
    justify-content: flex-start;
}
#pipeline-filter-bar h2 { display: none; }

.pipeline-filter-controls {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.pipeline-filter-controls > * { flex-shrink: 0; }
#pipeline-filter-bar .pipe-type-btn { min-width: 112px; }

/* Скролл-обёртка таблицы Pipeline */
#pipeline-table-card .table-scroll-wrap {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow-x: auto;
    overflow-y: scroll;
    overscroll-behavior: contain;
    position: relative;
    margin: 8px 12px 12px;
    border: none;
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    scrollbar-width: thin;
}
#pipeline-table-card .table-scroll-wrap table {
    width: 100%; min-width: 980px;
    border-collapse: separate; border-spacing: 0;
}
#pipeline-table-card .table-scroll-wrap::-webkit-scrollbar { width: 5px; height: 5px; }
#pipeline-table-card .table-scroll-wrap::-webkit-scrollbar-track { background: transparent; }
#pipeline-table-card .table-scroll-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* Sticky thead Pipeline */
#pipeline-table-card thead th {
    position: sticky; top: 0; z-index: 5;
    background: color-mix(in srgb, var(--table-header) 88%, var(--bg) 12%);
    border-bottom: 2px solid color-mix(in srgb, var(--border) 84%, transparent);
    padding-top: 9px; padding-bottom: 9px;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--border) 80%, transparent), 0 1px 0 rgba(0,0,0,0.03);
}

/* ── Vacancies / Database / Crew — Pipeline baseline ─────────────────────── */
#vacancies-table-card,
#database-table-card,
#crew-table-card,
#docs-pipeline-card,
#docs-catalog-card,
#task-card-ops,
#task-card-exec {
    display: flex; flex-direction: column;
    overflow: hidden; min-height: 0;
    background: color-mix(in srgb, var(--bg-card) 92%, var(--bg) 8%) !important;
    border: none !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 8px 8px !important;
    flex: 1 1 auto;
}

#task-filter-bar-ops,
#task-filter-bar-exec,
#vacancies-filter-bar,
#database-filter-bar,
#crew-filter-bar,
#orders-filter-bar {
    flex-shrink: 0;
    padding: 10px 12px;
    margin: 0;
    background: color-mix(in srgb, var(--bg-card) 82%, var(--bg) 18%);
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--border) 72%, transparent);
    justify-content: flex-start;
}
#vacancies-filter-bar h2,
#database-filter-bar h2,
#crew-filter-bar h2,
#orders-filter-bar h2 { display: none; }

.vacancies-filter-controls,
.database-filter-controls,
.crew-filter-controls {
    display: flex; gap: 6px; align-items: center; flex-wrap: wrap; flex: 1; margin: 0;
}
#orders-filter-bar .pipeline-filter-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    margin: 0;
}

#database-table-card #filter_panel { margin: 0 12px 12px !important; }

/* Скролл-обёртки */
#vacancies-table-card .table-scroll-wrap,
#database-table-card .table-scroll-wrap,
#crew-table-card .table-scroll-wrap,
#docs-catalog-card .table-scroll-wrap,
#docs-pipeline-card .table-scroll-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    margin: 8px 12px 12px;
    border: none;
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    scrollbar-width: thin;
}
#docs-catalog-card .table-scroll-wrap {
    overflow-x: auto !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
    max-height: none;
    min-height: 0;
    margin: 8px 12px 12px;
}
#docs-pipeline-card .table-scroll-wrap {
    overflow-x: auto !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
}
#vacancies-table-card .table-scroll-wrap table,
#database-table-card .table-scroll-wrap table { width: 100%; min-width: 900px; }
#docs-catalog-card .table-scroll-wrap table { min-width: 1240px; }
#crew-table-card .table-scroll-wrap table      { min-width: 1100px; }
#docs-pipeline-card .table-scroll-wrap table   { min-width: 1180px; }

#vacancies-table-card .table-scroll-wrap::-webkit-scrollbar,
#database-table-card .table-scroll-wrap::-webkit-scrollbar,
#crew-table-card .table-scroll-wrap::-webkit-scrollbar,
#docs-catalog-card .table-scroll-wrap::-webkit-scrollbar,
#docs-pipeline-card .table-scroll-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
#vacancies-table-card .table-scroll-wrap::-webkit-scrollbar-track,
#database-table-card .table-scroll-wrap::-webkit-scrollbar-track,
#crew-table-card .table-scroll-wrap::-webkit-scrollbar-track,
#docs-catalog-card .table-scroll-wrap::-webkit-scrollbar-track,
#docs-pipeline-card .table-scroll-wrap::-webkit-scrollbar-track { background: transparent; }
#vacancies-table-card .table-scroll-wrap::-webkit-scrollbar-thumb,
#database-table-card .table-scroll-wrap::-webkit-scrollbar-thumb,
#crew-table-card .table-scroll-wrap::-webkit-scrollbar-thumb,
#docs-catalog-card .table-scroll-wrap::-webkit-scrollbar-thumb,
#docs-pipeline-card .table-scroll-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* ── Tasks table scroll ── */
#task-card-ops .table-scroll-wrap,
#task-card-exec .table-scroll-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
    position: relative;
    margin: 8px 12px 12px;
    border: none;
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    scrollbar-width: thin;
}
#task-card-ops .table-scroll-wrap table,
#task-card-exec .table-scroll-wrap table { width: 100%; min-width: 900px; }
#task-card-ops .table-scroll-wrap::-webkit-scrollbar,
#task-card-exec .table-scroll-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
#task-card-ops .table-scroll-wrap::-webkit-scrollbar-track,
#task-card-exec .table-scroll-wrap::-webkit-scrollbar-track { background: transparent; }
#task-card-ops .table-scroll-wrap::-webkit-scrollbar-thumb,
#task-card-exec .table-scroll-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* Sticky thead */
#vacancies-table-card thead th,
#database-table-card thead th,
#crew-table-card thead th,
#docs-catalog-card thead th,
#docs-pipeline-card thead th,
#task-card-ops thead th,
#task-card-exec thead th {
    position: sticky; top: 0; z-index: 5;
    background: color-mix(in srgb, var(--table-header) 88%, var(--bg) 12%);
    border-bottom: 2px solid color-mix(in srgb, var(--border) 84%, transparent);
    padding-top: 9px; padding-bottom: 9px;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--border) 80%, transparent), 0 1px 0 rgba(0,0,0,0.03);
}

/* Таблица каталога: аккуратные отступы первой/последней колонки как в эталоне */
#docs-catalog-card thead th,
#catalog-tbody td {
    padding-left: 10px;
    padding-right: 10px;
}
#docs-catalog-card thead th:first-child,
#catalog-tbody td:first-child {
    padding-left: 20px;
}

/* Vacancies: синхронизируем paddings thead/tbody по всем колонкам */
#vacancies-table-card thead th,
#vacancies-body td {
    padding-left: 10px;
    padding-right: 10px;
}
#vacancies-table-card thead th:first-child,
#vacancies-body td:first-child {
    padding-left: 20px;
}

/* Pipeline: синхронизируем paddings thead/tbody по всем колонкам */
#pipeline-table-card thead th,
#table-body td {
    padding-left: 10px;
    padding-right: 10px;
}
#pipeline-table-card thead th:first-child,
#table-body td:first-child {
    padding-left: 20px;
}

/* ── Таблицы в pipeline/vacancies/database — компактный стиль ─────────────── */
#tab-pipeline table,
#tab-vacancies table,
#tab-database table { font-size: 12px; }

#tab-pipeline th,
#tab-vacancies th,
#tab-database th { font-size: 10px; letter-spacing: 0.4px; }

#tab-pipeline td,
#tab-vacancies td,
#tab-database td { font-size: 12px; }

#table-body td { padding-top: 12px; padding-bottom: 12px; font-size: 12.5px; }
#table-body select { font-size: 11px; padding: 4px 28px 4px 8px !important; min-width: 170px; }

/* Hover в основных таблицах */
#tab-pipeline tbody tr,
#tab-vacancies tbody tr,
#tab-database tbody tr,
#tab-crew tbody tr { transition: background var(--motion-fast) var(--motion-ease-soft); }

#tab-pipeline tbody tr:hover td,
#tab-vacancies tbody tr:hover td,
#tab-database tbody tr:hover td,
#tab-crew tbody tr:hover td { background: rgba(0,0,0,0.025); }

[data-theme="dark"] #tab-pipeline tbody tr:hover td,
[data-theme="dark"] #tab-vacancies tbody tr:hover td,
[data-theme="dark"] #tab-database tbody tr:hover td,
[data-theme="dark"] #tab-crew tbody tr:hover td { background: rgba(255,255,255,0.04); }

/* Последняя ячейка (действия) — no-wrap */
#table-body td:last-child,
#vacancies-body td:last-child,
#db-body td:last-child { white-space: nowrap; width: 1%; }

/* ── Tab content thead (общий fallback) ──────────────────────────────────── */
.tab-content.active thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--table-header);
}

/* ── Filter panel (database) ─────────────────────────────────────────────── */
#filter_panel {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    padding: 12px !important;
    margin-bottom: 12px !important;
}

/* ── Грид форм в drawer вакансий/моряков ─────────────────────────────────── */
#vac-drawer .vac-grid-details { grid-template-columns: repeat(3, 1fr) !important; }
#vac-drawer .vac-grid-actions { grid-template-columns: repeat(3, 1fr) !important; }

.vac-grid-main    { grid-template-columns: 2fr 1fr 2fr 2fr !important; }
.vac-grid-meta    { grid-template-columns: 1fr 1fr 2fr !important; }
.vac-grid-details { grid-template-columns: repeat(6, 1fr) !important; }
.vac-grid-actions { grid-template-columns: repeat(4, 1fr) !important; margin-top: 4px; }
.sea-grid-main    { grid-template-columns: 2fr 2fr 1fr 2fr !important; }
.sea-form-2col    { grid-template-columns: 1fr 1fr !important; }
.sea-form-3col    { grid-template-columns: 1fr 1fr 1fr !important; }
.vac-save-wrap    { display: flex; align-items: flex-end; }
.vac-save-btn     { width: 100%; }
.sea-save-btn     { margin-top: 8px; }

#pipe-form .form-row,
#vac-form .form-row,
#sea-form .form-row { margin-bottom: 8px; }

#pipe-form label { margin-bottom: 3px; color: var(--text-secondary); font-size: 10.5px; }
#pipe-form input[type="text"],
#pipe-form textarea { background: var(--bg-input); height: 30px; min-height: 30px; font-size: 12px; }

/* ── Медиа-запросы ───────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .vac-grid-main,
    .sea-grid-main     { grid-template-columns: 1fr 1fr !important; }
    .vac-grid-details  { grid-template-columns: repeat(3, 1fr) !important; }
    .vac-grid-actions  { grid-template-columns: 1fr 1fr !important; }
    .pipeline-drawer-content { width: min(520px, calc(100vw - 20px)); max-width: min(520px, calc(100vw - 20px)); }
    .filter-chip { min-width: 120px; }
    .pipeline-drawer-row-top,
    .pipeline-drawer-row-comments { grid-template-columns: 1fr !important; }
}

@media (max-width: 860px) {
    body { padding: 10px; }
    .card { padding: 14px; }

    #tab-vacancies .form-row,
    #tab-pipeline .form-row,
    #tab-database .form-row,
    .vac-grid-main, .vac-grid-meta, .vac-grid-details, .vac-grid-actions,
    .sea-grid-main { grid-template-columns: 1fr !important; }

    .pipeline-drawer-content {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: 92vh;
    }
    .pipeline-drawer-header,
    .pipeline-drawer-body { padding-left: 16px; padding-right: 16px; }
    .pipeline-drawer-row-meta { grid-template-columns: 1fr !important; }
    .pipe-actions-buttons { justify-content: stretch; flex-direction: column; }
    #btn_assign_pipe,
    #btn_cancel_pipe { width: 100%; min-width: 0; }

    .modal-content { width: 96vw; max-width: 96vw; max-height: 92vh; padding: 14px; }
}
