/* ═══════════════════════════════════════════════════════════════════════════
   COMPONENTS — переиспользуемые UI-компоненты
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Анимации ─────────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-5px); }
    40%, 80%  { transform: translateX(5px); }
}
@keyframes highlight-fade {
    0%   { background: rgba(37, 99, 235, 0.18); }
    100% { background: transparent; }
}

/* ── Inline SVG иконки ────────────────────────────────────────────────────── */
.ic    { width: 14px; height: 14px; flex-shrink: 0; vertical-align: middle; position: relative; top: -1px; overflow: visible; }
.btn .ic, .btn-outline .ic, .btn-ghost .ic, .row-action-btn .ic, .action-btn .ic { top: 0; overflow: visible; }
.ic-sm { width: 13px; height: 13px; }
.ic-md { width: 15px; height: 15px; }

/* ── Кнопки ───────────────────────────────────────────────────────────────── */
.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 5px 11px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    font-family: inherit;
    letter-spacing: -0.1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background var(--motion-fast) var(--motion-ease-soft), transform var(--motion-fast) var(--motion-ease-soft);
}
.btn:hover  { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 1; cursor: pointer; background: var(--accent); }
/* Кнопка заблокирована по правам роли */
.btn-perm-disabled {
    opacity: 0.42 !important;
    cursor: not-allowed !important;
    background: var(--text-muted) !important;
    color: var(--bg-card) !important;
    pointer-events: none !important;
}
[data-theme="dark"] .btn,
[data-theme="dark"] .btn-primary {
    color: #f3f6fb;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background var(--motion-fast) var(--motion-ease-soft), border-color var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.btn-outline:hover { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-strong); }

/* Размеры */
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-lg { padding: 6px 14px; font-size: 13px; }

/* Семантические варианты */
.btn-primary { background: var(--accent); color: #fff; border: none; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-warning { background: #7c3aed !important; color: #fff !important; }
.btn-warning:hover { background: #6d28d9 !important; }

/* Outline-цветовые варианты */
.btn-edit    { color: var(--accent);   border-color: var(--accent); }
.btn-edit:hover    { background: var(--accent-light);   color: var(--accent); }
.btn-success { color: var(--success);  border-color: var(--success); }
.btn-success:hover { background: var(--success-light);  color: var(--success); }
.btn-danger  { color: var(--danger);   border-color: var(--danger); }
.btn-danger:hover  { background: var(--danger-light);   color: var(--danger); }
.btn-file    { color: #5856D6; border-color: #5856D6; }
.btn-file:hover { background: rgba(88,86,214,0.08); }
[data-theme="dark"] .btn-file       { color: #9B8FFF; border-color: #9B8FFF; }
[data-theme="dark"] .btn-file:hover { background: rgba(155,143,255,0.10); }

/* Ссылки-кнопки */
a.btn-outline { text-decoration: none; }

/* Кнопка-призрак (закрытие модалок) */
.btn-ghost {
    background: var(--bg-input);
    color: var(--text-muted);
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.btn-ghost:hover { background: var(--bg-input-hover); color: var(--text-primary); }

/* Кнопка загрузки (disabled-вид) */
.btn-loading { pointer-events: none; opacity: 0.7; }

/* Отступ между соседними btn-outline в td */
td .btn-outline + .btn-outline { margin-left: 4px; }

/* ── Иконки-кнопки в таблицах ────────────────────────────────────────────── */
/* Крупная таблица — .action-btn */
.action-btn {
    width: 26px; height: 26px;
    border-radius: var(--radius-xs);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
    font-family: inherit;
    opacity: 0;
}
tr:hover .action-btn { opacity: 1; }
.action-btn:hover         { background: var(--bg-hover); color: var(--text-primary); }
.action-btn.danger:hover  { background: var(--danger-light); color: var(--danger); }
.action-btn.primary:hover { background: var(--accent-light); color: var(--accent); }

/* Компактная таблица профиля — .row-action-btn */
.row-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--motion-fast) var(--motion-ease-soft);
    justify-content: flex-end;
}
tr:hover .row-actions            { opacity: 1; }
#p-seaservice .row-actions,
#p-refs .row-actions             { opacity: 0.3; }
#p-seaservice tr:hover .row-actions,
#p-refs tr:hover .row-actions    { opacity: 1; }

.row-action-btn {
    width: 24px; height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.row-action-btn:hover        { background: var(--bg-hover); color: var(--text-primary); }
.row-action-btn.danger:hover { background: var(--danger-light); color: var(--danger); }

/* ── Меню действий (⋯) ───────────────────────────────────────────────────── */
.table-actions-cell { width: 52px; text-align: right; }

.table-actions {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.table-actions-trigger {
    width: 26px; height: 26px;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.3;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft), opacity var(--motion-fast) var(--motion-ease-soft);
}
tr:hover .table-actions-trigger        { opacity: 1; }
.table-actions-trigger.menu-open       { opacity: 1; }
.table-actions-trigger:hover           { background: var(--bg-hover); color: var(--text-primary); }

/* В небольших таблицах профиля — всегда слегка видна */
#p-seaservice .table-actions-trigger,
#p-refs .table-actions-trigger         { opacity: 0.35; }
#p-seaservice tr:hover .table-actions-trigger,
#p-refs tr:hover .table-actions-trigger{ opacity: 1; }

.table-actions-menu {
    position: fixed;
    top: 0; left: 0;
    min-width: 190px;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12), 0 1px 4px rgba(15, 23, 42, 0.06);
    border: 1px solid var(--border);
    padding: 6px;
    opacity: 0;
    transform: translateY(-2px) scale(0.98);
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--motion-fast) var(--motion-ease-soft), transform var(--motion-fast) var(--motion-ease-soft), visibility 0s linear var(--motion-fast);
    z-index: 20000;
    will-change: transform, opacity;
}
.table-actions-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--motion-fast) var(--motion-ease-soft), transform var(--motion-fast) var(--motion-ease-soft);
}

.table-actions-item {
    width: 100%;
    border: none;
    background: transparent;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.table-actions-item:hover        { background: var(--bg-hover); color: var(--text-primary); }
.table-actions-item:active       { background: color-mix(in srgb, var(--bg-hover) 78%, var(--border) 22%); }
.table-actions-item.danger       { color: var(--danger); }
.table-actions-item.danger:hover { background: var(--danger-light); color: var(--danger); }

/* ── Формы ────────────────────────────────────────────────────────────────── */
label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 3px;
    display: block;
}

input, select, textarea {
    padding: 5px 9px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    width: 100%;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    font-weight: 400;
    transition: background var(--motion-fast) var(--motion-ease-soft), border-color var(--motion-fast) var(--motion-ease-soft), box-shadow var(--motion-fast) var(--motion-ease-soft);
}
input:hover, select:hover, textarea:hover {
    background: var(--bg-input-hover);
}
input:focus, select:focus, textarea:focus {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A3A3A3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
    padding-right: 32px !important;
    cursor: pointer;
}

/* Инпуты внутри ячеек таблиц */
td input {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border) !important;
}
td input:disabled {
    background: transparent !important;
    border-color: transparent !important;
    color: var(--text-muted) !important;
}

/* Readonly */
.input-readonly {
    background: var(--bg-input) !important;
    color: var(--text-secondary);
    cursor: not-allowed;
}
.input-readonly-muted {
    background: var(--bg-input) !important;
    color: var(--text-muted);
    font-weight: bold;
    cursor: not-allowed;
}

/* Сетка полей формы */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.form-row:last-child             { margin-bottom: 0; }
.profile-form-card .form-row:last-child { margin-bottom: 0; }
.form-row-submit                 { margin-top: 6px; align-items: flex-end; }

/* Заголовки внутри форм */
.form-section-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0 0 10px 0;
}
.form-subtitle {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-muted);
    margin: 12px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-subtitle::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.form-subtitle-tight { margin-top: 8px; }

.form-divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Сообщения об ошибках */
.form-error        { margin-top: 4px; font-size: 12px; color: var(--danger); }
.form-hint         { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.form-control-error{ border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-light); }
.error-msg         { color: var(--danger); font-size: 13px; }
.field-error       { border-color: #E53E3E !important; animation: shake var(--motion-base) var(--motion-ease-soft); }
.required-star     { color: #E53E3E; font-weight: 700; margin-left: 2px; }

/* ── Таблицы ──────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }

th {
    background: var(--table-header);
    color: var(--text-muted);
    padding: 5px 10px;
    text-align: left;
    font-weight: 500;
    font-size: 11px;
    border-bottom: 1px solid var(--table-border);
    white-space: nowrap;
    letter-spacing: 0;
    text-transform: none;
}
td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--table-border);
    vertical-align: middle;
    color: var(--text-primary);
    font-size: 12.5px;
    transition: background var(--motion-fast) var(--motion-ease-soft);
}
tr:last-child td     { border-bottom: none; }
tbody tr             { transition: background var(--motion-fast) var(--motion-ease-soft); }
tr:hover td          { background: var(--bg-hover); }
[data-theme="dark"] tr:hover td { background: rgba(255,255,255,0.04); }

/* Обёртка таблицы */
.table-scroll-wrap {
    overflow-x: auto;
    border: 1px solid var(--table-border);
    border-radius: var(--radius);
    background: var(--bg-card);
}
.table-scroll-wrap table { margin-top: 0; }

/* Пустые значения */
.empty-val { opacity: 0.35; font-style: italic; }

/* ── Сортировка по заголовку таблицы ─────────────────────────────────────── */
table[data-sortable] thead th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
    transition: background 0.15s, color 0.15s;
}
table[data-sortable] thead th:last-child {
    cursor: default;
}
table[data-sortable] thead th::after {
    content: '↕';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}
table[data-sortable] thead th:not(:last-child):hover::after {
    opacity: 0.45;
}
table[data-sortable] thead th[data-sort]::after {
    opacity: 1;
    color: var(--accent);
}
table[data-sortable] thead th[data-sort="asc"]::after  { content: '↑'; }
table[data-sortable] thead th[data-sort="desc"]::after { content: '↓'; }
table[data-sortable] thead th:not(:last-child):hover {
    background: var(--bg-hover);
}
table[data-sortable] thead th[data-sort] {
    background: var(--bg-hover);
    color: var(--accent);
}

/* Кнопка Сбросить подсвечивается когда есть активная сортировка.
   !important нужен чтобы перебить inline style="display:none" от filterSeafarers() */
.pipeline-reset-btn.sort-active {
    display: inline-flex !important;
    color: var(--accent);
    border-color: var(--accent);
}


/* Подсветка строк */
tr.row-warn   td { background: rgba(245,158,11,0.08) !important; }
tr.row-danger td { background: rgba(239,68,68,0.09) !important; }
tr.highlight-row  { animation: highlight-fade 2s ease-out forwards; }
.editing-row td   { background: color-mix(in srgb, var(--accent) 8%, transparent) !important; }

/* ── Статус-селект (цвет через CSS-переменные) ───────────────────────────── */
.table-status-select,
.pipeline-status-select {
    background: var(--status-bg, var(--bg-input));
    color: var(--status-color, var(--text-primary));
    font-weight: 500;
    border-radius: 999px;
    padding: 2px 18px 2px 8px;
    width: 170px;
    max-width: 170px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--motion-fast) var(--motion-ease-soft);
}
[data-theme="dark"] .table-status-select,
[data-theme="dark"] .pipeline-status-select {
    background: var(--status-bg-dark, var(--status-bg));
    color: var(--status-color-dark, var(--status-color));
    filter: saturate(0.82) brightness(0.96);
}

/* ── Бейджи и пилюли ─────────────────────────────────────────────────────── */
.badge-count {
    display: inline-block;
    min-width: 22px;
    text-align: center;
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    padding: 1px 7px;
    margin-left: 6px;
    vertical-align: middle;
}
.badge-danger-sm {
    font-size: 10px; font-weight: 600;
    background: var(--danger-light); color: var(--danger);
    padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}
.badge-success-sm {
    font-size: 11px;
    background: var(--success-light); color: var(--success);
    padding: 2px 7px; border-radius: 5px;
}
.table-rank-pill {
    font-size: 11px;
    background: var(--accent-light);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}
.table-count-badge {
    background: var(--accent);
    color: #fff;
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
[data-theme="dark"] .table-count-badge,
[data-theme="dark"] .badge-count,
[data-theme="dark"] .filter-active-badge {
    background: color-mix(in srgb, var(--accent) 82%, #2a3445 18%);
    color: #f1f5fb;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.expiry-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.expiry-badge.red    { background: var(--danger-light);  color: var(--danger); }
.expiry-badge.yellow { background: var(--warning-light); color: var(--warning); }
.expiry-badge.green  { background: var(--success-light); color: var(--success); }
.expiry-badge.grey   { background: var(--bg-input);      color: var(--text-muted); }

.soon-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-left: auto;
}

/* ── Карточки ─────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    padding: 14px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    border: 1px solid var(--border);
    transition: background var(--motion-base) var(--motion-ease-soft), border-color var(--motion-base) var(--motion-ease-soft);
}
/* Внутри tab-content карточки выглядят как плоские секции */
.tab-content.active .card {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    padding: 16px 20px;
}
.tab-content.active .card:last-child { border-bottom: none; }

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
}
.card-header-row h2 { margin: 0; flex-shrink: 0; }

/* ── Модальные оверлеи ────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity var(--motion-base) var(--motion-ease-soft);
}
.modal-overlay.show {
    display: flex !important;
    opacity: 1;
}

/* Большой контент (профиль) */
.modal-content {
    background: var(--bg-card);
    width: 1180px;
    max-width: min(94vw, 1180px);
    max-height: 88vh;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.12), 0 24px 64px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    transform: scale(0.97) translateY(8px);
    transition: transform var(--motion-slow) var(--motion-ease);
    overflow-y: auto;
    overflow-x: hidden;
    will-change: transform;
}
.modal-overlay.show .modal-content { transform: scale(1) translateY(0); }

/* Компактное модальное окно */
.modal {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    max-width: 620px;
    width: 100%;
    position: relative;
    padding: 20px 22px 18px;
    transform: scale(0.97) translateY(6px);
    transition: transform var(--motion-base) var(--motion-ease);
    will-change: transform;
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.modal-body  { font-size: 13px; color: var(--text-secondary); }
.modal-footer{ margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Drawer (pipeline / vacancies / seafarers) ───────────────────────────── */
.pipeline-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    background: rgba(10, 14, 20, 0.36);
    backdrop-filter: blur(2px);
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--motion-base) var(--motion-ease-soft), visibility 0s linear var(--motion-base);
}
.pipeline-modal.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--motion-base) var(--motion-ease-soft);
}

.pipeline-drawer-content {
    width: min(540px, 88vw);
    max-width: min(540px, 88vw);
    max-height: min(92vh, 760px);
    border-radius: 12px;
    background: var(--bg-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 48px rgba(15,23,42,0.24), 0 4px 14px rgba(15,23,42,0.14);
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    transform: translateY(8px) scale(0.985);
    opacity: 0;
    transition: transform var(--motion-base) var(--motion-ease), opacity var(--motion-base) var(--motion-ease-soft);
    will-change: transform, opacity;
}
.pipeline-modal.show .pipeline-drawer-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Пайплайн-форма — скролл тела при переполнении */
#pipe-assign-card .pipeline-drawer-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
}
#pipe-assign-card .pipeline-drawer-body::-webkit-scrollbar { width: 5px; }
#pipe-assign-card .pipeline-drawer-body::-webkit-scrollbar-track { background: transparent; }
#pipe-assign-card .pipeline-drawer-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

/* Дроверы форм вакансий/моряков — шире */
#vac-drawer .pipeline-drawer-content,
#sea-drawer .pipeline-drawer-content {
    width: min(680px, 94vw);
    max-width: min(680px, 94vw);
    max-height: min(94vh, 960px);
    opacity: 1;
    transform: scale(0.97) translateY(8px);
    transition: transform var(--motion-slow) var(--motion-ease);
}
#vac-drawer.show .pipeline-drawer-content,
#sea-drawer.show .pipeline-drawer-content {
    transform: scale(1) translateY(0);
}
#vac-drawer .pipeline-drawer-body,
#sea-drawer .pipeline-drawer-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    padding-bottom: 20px;
}
#vac-drawer .pipeline-drawer-body::-webkit-scrollbar { width: 5px; }
#vac-drawer .pipeline-drawer-body::-webkit-scrollbar-track { background: transparent; }
#vac-drawer .pipeline-drawer-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

.pipeline-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}
.pipeline-drawer-header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.pipeline-drawer-kicker    { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.pipeline-drawer-body      { padding: 12px 16px 14px; }

/* ── Confirm dialog ───────────────────────────────────────────────────────── */
.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity var(--motion-base) var(--motion-ease-soft);
}
.confirm-overlay.show { display: flex !important; opacity: 1; }

.confirm-card {
    background: var(--bg-card);
    width: 360px;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    text-align: left;
    transform: scale(0.97) translateY(6px);
    transition: transform var(--motion-base) var(--motion-ease);
    will-change: transform;
}
.confirm-overlay.show .confirm-card { transform: scale(1) translateY(0); }

.confirm-title   { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text-primary); }
.confirm-text    { font-size: 12px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.confirm-buttons { display: flex; justify-content: flex-end; gap: 6px; }

.confirm-btn {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    border: 1px solid var(--border);
    background: transparent;
    transition: background var(--motion-fast) var(--motion-ease-soft), border-color var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.confirm-btn-cancel { color: var(--text-secondary); }
.confirm-btn-cancel:hover { background: var(--bg-input); color: var(--text-primary); }
.confirm-btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.confirm-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.confirm-btn-accent { color: #fff; background: var(--accent); border-color: var(--accent); }
.confirm-btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Поля внутри confirm-оверлеев */
.overlay-field {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color var(--motion-fast) var(--motion-ease-soft), box-shadow var(--motion-fast) var(--motion-ease-soft);
}
.overlay-field:focus        { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.overlay-field-accent       { border-color: var(--accent); }
.overlay-label {
    font-size: 11px; font-weight: 500; color: var(--text-secondary);
    display: block; margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.overlay-field-wrap { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 20px; right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    align-items: flex-end;
}
.toast {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 9px 14px;
    border-radius: var(--radius);
    font-size: 12.5px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastSlideIn var(--motion-slow) var(--motion-ease) forwards;
    pointer-events: all;
    white-space: nowrap;
    min-width: 200px;
}
.toast.fade-out {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: all var(--motion-slow) var(--motion-ease-soft);
}

/* ── Автокомплит ──────────────────────────────────────────────────────────── */
.ac-container { position: relative; width: 100%; }
.ac-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    border: 1px solid var(--border);
}
.ac-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--table-border);
    transition: background var(--motion-fast) var(--motion-ease-soft);
    font-size: 13.5px;
    color: var(--text-primary);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover      { background: var(--bg-input); }
.ac-subtext { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }

/* ── Попап кандидатов вакансии ───────────────────────────────────────────── */
.vac-candidates-popover {
    position: fixed;
    z-index: 999;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 280px;
    max-width: 360px;
    overflow: hidden;
    animation: fadeInUp var(--motion-fast) var(--motion-ease-soft);
}
.vac-popover-header {
    padding: 10px 14px 8px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.vac-popover-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--table-border);
    transition: background var(--motion-fast) var(--motion-ease-soft);
}
.vac-popover-item:last-child { border-bottom: none; }
.vac-popover-item:hover      { background: var(--bg-input); }
.vac-popover-name {
    font-size: 13px; font-weight: 500; color: var(--accent);
    cursor: pointer; flex: 1;
}
.vac-popover-name:hover { text-decoration: underline; }
.vac-popover-empty { padding: 14px; text-align: center; font-size: 12px; color: var(--text-muted); }

/* ── Детали вакансии ─────────────────────────────────────────────────────── */
.vac-detail-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-top: 4px; }
.vac-detail-item   { display: flex; flex-direction: column; gap: 3px; }
.vac-detail-label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.vac-detail-value  { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
.vac-detail-section{
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted); padding: 12px 0 8px;
    border-top: 1px solid var(--border); margin-top: 8px;
}
#vac-detail-modal .modal-content { max-width: 560px !important; padding: 18px !important; }
.vac-detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 4px;
}

/* ── Фильтры (chip style) ────────────────────────────────────────────────── */
.filter-chip {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    height: 28px;
    width: auto !important;
    min-width: 132px;
    font-family: inherit;
    transition: background var(--motion-fast) var(--motion-ease-soft), border-color var(--motion-fast) var(--motion-ease-soft);
}
select.filter-chip        { appearance: none; padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.filter-chip:hover        { background: var(--bg-hover); border-color: var(--text-muted); }
.filter-chip:focus        { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.filter-chip-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 10px;
}
.filter-chip-search i { color: var(--text-muted); flex-shrink: 0; }
.filter-chip-search input {
    border: none; background: transparent; outline: none;
    width: 100%; min-width: 82px;
    font: inherit; color: var(--text-primary); padding: 0;
}
.filter-chip-search input::placeholder { color: var(--text-muted); }
.filter-chip-search input:focus {
    box-shadow: none !important;
    border-color: transparent !important;
}
.filter-chip-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.checkbox-chip {
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-weight: 400;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
}
.checkbox-chip input[type="checkbox"] {
    width: 14px; height: 14px;
    margin: 0; cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.checkbox-chip:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.checkbox-chip:has(input:checked) { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.filter-chip-danger { border-color: var(--danger); color: var(--danger); }
.filter-chip-danger:hover { background: var(--danger-light); border-color: var(--danger); }
.filter-chip-danger:has(input:checked) { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }

.filter-panel-row {
    display: flex; flex-wrap: wrap; gap: 6px;
    align-items: center; margin-bottom: 6px;
}
.filter-group-label {
    font-size: 10.5px; color: var(--text-muted); font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.5px;
    white-space: nowrap; align-self: center;
}
.filter-panel-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0 6px; }
.filter-active-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 10px; background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 700; margin-left: 4px;
}
.pipeline-reset-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ── Секция-заголовок (с линией) ─────────────────────────────────────────── */
.section-title {
    font-size: 11px; font-weight: 500;
    color: var(--text-muted);
    margin: 20px 0 10px;
    display: flex; align-items: center; gap: 8px;
    text-transform: none; letter-spacing: 0;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Ссылки и интерактивные имена ───────────────────────────────────────── */
.clickable-name {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}
.clickable-name:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

.vessel-tip {
    color: var(--text-primary); font-weight: 600;
    cursor: help; border-bottom: 1px dashed var(--border-strong);
}

/* ── Seafarers DB helpers (zero inline styles) ──────────────────────────── */
.sea-contract-dot-empty {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
}
.sea-export-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sea-th-name { width: 220px; padding-left: 20px; }
.sea-th-nat  { width: 90px; }
.sea-th-status { min-width: 210px; width: 210px; }
.sea-th-center { text-align: center; }
.sea-th-actions { width: 96px; }
.sea-row { cursor: pointer; }
.sea-row-blacklist { background: rgba(231,76,60,0.07); }
.sea-td-name { padding-left: 20px; }
.sea-name-link {
    font-size: 13px;
    color: var(--text-primary);
}
.sea-name-link.clickable-name:hover {
    color: var(--text-primary);
    text-decoration: none;
}
.sea-td-muted-sm { font-size: 12px; color: var(--text-secondary); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sea-age-sub { color: var(--text-muted); }
.sea-td-center { text-align: center; }
.sea-doc-traffic-btn {
    border: none;
    background: transparent;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    transition: background var(--motion-fast);
}
.sea-doc-traffic-btn:hover {
    background: var(--bg-hover);
}
.sea-doc-traffic-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 999px;
}
.sea-cv-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}
.sea-cv-empty { color: var(--text-muted); font-size: 12px; }
.sea-docs-popover {
    position: fixed;
    z-index: 999;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    min-width: 320px;
    max-width: 380px;
    overflow: hidden;
    animation: fadeInUp var(--motion-fast) var(--motion-ease-soft);
}
.sea-docs-popover-header {
    padding: 10px 14px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.sea-docs-popover-item {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--table-border);
}
.sea-docs-popover-item:last-of-type { border-bottom: none; }
.sea-docs-popover-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sea-doc-dot, var(--text-muted));
}
.sea-docs-popover-name {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sea-docs-popover-exp {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.sea-docs-popover-empty {
    padding: 12px 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.sea-docs-popover-more {
    padding: 7px 14px 10px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--table-border);
}

/* ── Vacancies helpers (zero inline styles) ─────────────────────────────── */
.vac-count-empty { color: var(--text-muted); font-size: 12px; }
.vac-td-vessel { padding-left: 20px !important; }
.vac-vessel-name { font-weight: 600; font-size: 13px; }
.vac-vessel-meta { font-size: 11px; color: var(--text-muted); }
.vac-salary { font-weight: 600; font-size: 13px; }
.vac-company { font-size: 13px; }
.vac-join-date { font-size: 12px; color: var(--text-secondary); }
.vac-join-date-overdue { color: var(--danger); font-weight: 600; }
.vac-priority-cell { font-size: 12px; }
.vac-count-cell { text-align: center; }

.vac-popover-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vac-dot-bg, var(--bg-hover));
    border: 1px solid var(--vac-dot-border, var(--border-strong));
    flex-shrink: 0;
}
.vac-popover-manager {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.vac-detail-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.vac-detail-title { margin: 0; font-size: 18px; font-weight: 700; }
.vac-detail-rank-pill {
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
}
.vac-detail-priority {
    font-size: 12px;
    font-weight: 600;
    color: var(--vac-priority-color, var(--text-secondary));
}
/* ── Кликабельные строки вакансий ─────────────────────────────────────── */
.vac-row-clickable { cursor: pointer; }
.vac-vessel-name { display: inline-flex; align-items: center; gap: 5px; }
.vac-eye-btn  { opacity: 0; transition: opacity .15s; color: var(--text-muted); flex-shrink: 0; }
.vac-row-clickable:hover .vac-eye-btn { opacity: 1; color: var(--accent); }

.vac-detail-comment {
    font-size: 13px; color: var(--text-secondary);
    background: var(--bg-hover); border-radius: var(--radius-xs);
    padding: 8px 10px; line-height: 1.5; white-space: pre-wrap;
}
.vac-detail-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.vac-match-msg { color: var(--text-secondary); font-size: 13px; }
.vac-match-msg-pad { padding: 4px 0; }
#vac-detail-match-results {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
}
.vac-match-found {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 16px;
    margin-bottom: 8px;
}
.vac-match-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--bg-card);
    margin-bottom: 5px;
    border: 1px solid var(--border);
}
.vac-match-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}
.vac-match-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 5px;
    background: var(--vac-match-status-bg, var(--bg-input));
    color: var(--vac-match-status-color, var(--text-secondary));
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state      { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 28px; margin-bottom: 8px; opacity: 0.4; }
.empty-state-text { font-size: 12px; font-weight: 400; color: var(--text-muted); }

/* ── Аватар моряка ───────────────────────────────────────────────────────── */
.seafarer-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0; letter-spacing: -0.3px;
}

/* ── Коллапс форм ────────────────────────────────────────────────────────── */
.collapsible-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--motion-slow) var(--motion-ease), opacity var(--motion-slow) var(--motion-ease-soft);
}
.collapsible-body.open { max-height: 800px; opacity: 1; }
.form-card-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; user-select: none; padding: 2px 0 0; margin-bottom: 0;
}
.form-card-header h2    { margin: 0; border: none; padding: 0; cursor: pointer; }
.form-card-header:hover h2 { color: var(--accent); }
.collapse-chevron {
    width: 20px; height: 20px; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); flex-shrink: 0;
    transition: transform var(--motion-base) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.form-card-header:hover .collapse-chevron { color: var(--text-primary); }
.collapse-chevron.open { transform: rotate(180deg); }

/* ── Иконки вкладок Sea Service ──────────────────────────────────────────── */
.tab-icon {
    font-size: 12px; cursor: pointer;
    border-radius: 4px; padding: 2px 5px;
    display: inline-flex; align-items: center;
}
.tab-icon-copy   { background: var(--bg-input); }
.tab-icon-copy:hover { background: var(--bg-input-hover); }
.tab-icon-delete { background: var(--danger-light); color: var(--danger); }
.tab-icon-delete:hover { background: var(--danger); color: #fff; }

/* Действия на табах (появляются при hover) */
.tab-actions {
    display: inline-flex; align-items: center;
    margin-left: 6px; opacity: 0; pointer-events: none;
    transition: opacity var(--motion-fast) var(--motion-ease-soft); font-size: 11px; line-height: 1;
}
.m-tab:hover .tab-actions { opacity: 1; pointer-events: auto; }

/* ── Кнопка темы ─────────────────────────────────────────────────────────── */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft);
}
.theme-toggle:hover { background: var(--bg-input); color: var(--text-primary); }

/* ── Поиск кандидата в панели пайплайна ──────────────────────────────────── */
.db-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.db-toolbar input[type="text"] { flex: 1; max-width: 280px; }

/* ── Колокольчик уведомлений ─────────────────────────────────────────────── */

.notif-bell-wrap {
    position: relative;
    display: inline-flex;
}
.notif-badge {
    position: absolute;
    top: -3px; right: -3px;
    min-width: 16px; height: 16px;
    padding: 0 3px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    line-height: 1;
}
.notif-dot-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    background: var(--danger);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    pointer-events: none;
}
.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s var(--motion-ease-soft), transform .15s var(--motion-ease-soft);
}
.notif-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
}
.notif-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.notif-read-all-btn { padding: 3px; color: var(--text-muted); }
.notif-read-all-btn:hover { color: var(--text-primary); }
.notif-list {
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.notif-empty,
.notif-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 13px;
    justify-content: center;
}
@keyframes notif-spin { to { transform: rotate(360deg); } }
.notif-spin { animation: notif-spin .8s linear infinite; }
.notif-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--bg-hover); }
.notif-row--unread { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.notif-row--unread:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.notif-row-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    background: var(--bg-input);
    color: var(--text-muted);
}
.notif-type-new_vacancy { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.notif-type-doc_expiry  { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.notif-type-commerce    { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.notif-type-crew        { background: color-mix(in srgb, #7c3aed 12%, transparent); color: #7c3aed; }
.notif-type-task        { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.notif-row-body { flex: 1; min-width: 0; }
.notif-row-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-row-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-row-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Таск-менеджер ───────────────────────────────────────────────────────── */
.task-row--done td { opacity: .5; }
.task-row--done td.table-actions-cell { opacity: 1; }
.task-row--done .task-title-text { text-decoration: line-through; }
.task-title-cell { max-width: 320px; }
.task-title-text { display: block; font-weight: 500; color: var(--text-primary); }
.task-desc-wrap {
    position: relative; display: flex; align-items: flex-start;
    gap: 4px; margin-top: 2px; max-width: 100%; cursor: pointer;
}
.task-desc-wrap:hover .task-desc-eye { opacity: 1; }
.task-desc-eye {
    flex-shrink: 0; opacity: 0; transition: opacity .15s;
    color: var(--text-muted); padding: 1px; border-radius: 3px;
}
.task-desc-eye:hover { color: var(--accent); }
.task-desc-text {
    font-size: 12px; color: var(--text-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; max-width: 260px; line-height: 1.45;
}
/* задачи: прямоугольные селекты вместо pill */
.task-status-select,
.task-priority-select { border-radius: var(--radius-xs); width: auto; min-width: 90px; max-width: 140px; }

/* ── read-only просмотр задачи ── */
.task-view-overlay {
    position: fixed; inset: 0; z-index: 1200;
    background: rgba(0,0,0,.35); display: flex;
    align-items: center; justify-content: center;
}
.task-view-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: 480px; max-width: calc(100vw - 32px); max-height: 80vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.task-view-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border); gap: 8px;
}
.task-view-title { font-weight: 600; font-size: 14px; color: var(--text-primary); flex: 1; }
.task-view-body  { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.task-view-desc  {
    font-size: 13px; color: var(--text-secondary); line-height: 1.6;
    white-space: pre-wrap; background: var(--bg-input); border-radius: var(--radius-xs);
    padding: 10px 12px; border: 1px solid var(--border);
}
.task-view-meta  { display: flex; flex-wrap: wrap; gap: 8px; }
.task-view-chip  {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--text-secondary);
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-xs); padding: 3px 8px;
}
.task-auto-badge {
    display: inline-flex; align-items: center;
    margin-left: 5px; color: var(--text-muted); vertical-align: middle;
}
.task-entity-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--text-secondary);
    background: var(--bg-input); padding: 2px 7px; border-radius: var(--radius-xs);
    white-space: nowrap;
}
.task-entity-badge.clickable-name {
    color: var(--accent);
    font-weight: 500;
}
.task-entity-picker {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px;
}
.task-entity-search-wrap {
    position: relative;
}
.task-entity-dropdown {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 240px;
    overflow: auto;
    box-shadow: var(--shadow);
}
.task-entity-search-item {
    cursor: pointer;
}
.task-entity-selected {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 4px 6px;
}
.task-entity-selected-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-primary);
}
.task-entity-selected-meta {
    font-size: 11px;
    color: var(--text-muted);
}
.task-entity-clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 20px;
    height: 20px;
}
.task-entity-clear:hover {
    background: var(--bg-hover);
    color: var(--danger);
}
.task-deadline {
    font-size: 12px; font-weight: 500; padding: 2px 7px; border-radius: var(--radius-xs);
}
.task-deadline--none    { color: var(--text-muted); }
.task-deadline--ok      { color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
.task-deadline--soon    { color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.task-deadline--overdue { color: var(--danger);  background: color-mix(in srgb, var(--danger)  10%, transparent); }
.task-priority { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.task-assignee-cell { white-space: nowrap; }
.task-assignee-name { font-size: 13px; color: var(--text-secondary); margin-left: 4px; }
.task-no-assignee   { color: var(--text-muted); font-size: 12px; }
.table-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    font-size: 10px; font-weight: 600; flex-shrink: 0;
    vertical-align: middle;
}
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: block; }

.notif-row-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 5px;
}

/* Подсветка строки таблицы при переходе из уведомления */
@keyframes notif-row-flash {
    0%   { background: color-mix(in srgb, var(--accent) 18%, transparent); }
    70%  { background: color-mix(in srgb, var(--accent) 18%, transparent); }
    100% { background: transparent; }
}
.notif-row-highlight {
    animation: notif-row-flash 2.5s ease forwards;
}
