.profile-doc-compare-panel {
    max-width: 640px;
}

.profile-doc-compare-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.profile-doc-compare-select {
    flex: 1;
}

.profile-doc-compare-results {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    min-height: 72px;
    color: var(--text-secondary);
    background: var(--bg-input);
}

.profile-doc-compare-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 2px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.profile-doc-compare-item:last-child {
    border-bottom: none;
}

.profile-doc-compare-count {
    border: none;
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.profile-doc-compare-count:hover {
    text-decoration: underline;
}

.profile-doc-compare-missing {
    padding: 8px 2px 10px;
    border-bottom: 1px solid var(--border);
}

.profile-doc-compare-missing-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.profile-doc-compare-missing-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.profile-doc-compare-missing-chip {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 3px 7px;
    font-size: 12px;
    color: var(--text-primary);
}
/* ═══════════════════════════════════════════════════════════════════════════
   PROFILE — страница профиля моряка
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Страница профиля ─────────────────────────────────────────────────────── */
#profile-page {
    flex: 1;
    min-height: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 14px 16px;
    animation: fadeInUp var(--motion-base) var(--motion-ease);
}
#profile-page.active { display: flex; }

/* ── Шапка профиля ────────────────────────────────────────────────────────── */
.profile-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    /* 24px = как у .profile-body и отступов .modal-tabs — одна вертикаль с названием и вкладками */
    padding: 12px 24px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.profile-header-left {
    display: flex; align-items: center; gap: 6px; min-width: 0;
}
.profile-header-title-stack {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.profile-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.profile-title-row .profile-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-name {
    margin: 0; font-size: 17px; font-weight: 600;
    letter-spacing: -0.3px; color: var(--text-primary);
}
.profile-page-back {
    display: flex; align-items: center; gap: 4px;
    font-size: 13px; color: var(--text-secondary);
    background: none; border: none; cursor: pointer;
    padding: 4px 6px; border-radius: var(--radius-xs);
    transition: background var(--motion-fast) var(--motion-ease-soft), color var(--motion-fast) var(--motion-ease-soft); white-space: nowrap;
}
.profile-page-back:hover { background: var(--bg-hover); color: var(--text-primary); }

.profile-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Подзаголовок под именем (компания — статус): тот же ритм, что вторичный текст у форм */
.profile-header-title-stack .profile-name {
    line-height: 1.25;
}

/* ── Табы профиля ─────────────────────────────────────────────────────────── */
.modal-tabs {
    display: flex; gap: 0; flex-wrap: wrap;
    background: transparent; padding: 0; border-radius: 0;
    border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
#profile-page .modal-tabs,
#shipowner-profile-page .modal-tabs { margin: 0 24px; margin-bottom: 0; flex-shrink: 0; }

/* ── Карточка судовладельца: сеточные классы форм ────────────────────────── */
.soc-list-wrap              { display: flex; flex-direction: column; gap: 6px; }
.soc-row-grid-contact       { grid-template-columns: 1fr 1fr 1fr 1fr auto; align-items: end; }
.soc-row-grid-matrix        { grid-template-columns: 1fr 1fr 2fr auto; align-items: end; }
.soc-row-grid-employed      { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }

/* Карточка судна во флоте (старые классы — не трогать, могут использоваться) */
.soc-vessel-card            { border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 8px 10px; display: flex; flex-direction: column; gap: 0; }
.soc-row-grid-vessel-1      { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; margin-bottom: 6px !important; }
.soc-row-grid-vessel-2      { grid-template-columns: 0.7fr 0.8fr 1fr 1fr 1.5fr; align-items: end; margin-bottom: 0 !important; }

/* Display-строки для контактов и флота (новый паттерн) */
.soc-display-row            { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.soc-display-row:last-child { border-bottom: none; }
.soc-display-name           { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.soc-display-meta           { font-size: 12px; color: var(--text-muted); flex: 1; }
.soc-vessel-display         { padding: 6px 0; border-bottom: 1px solid var(--border); }
.soc-vessel-display:last-child { border-bottom: none; }
.soc-vessel-display-main    { display: flex; align-items: center; gap: 8px; }
.soc-vessel-type-tag        { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--bg-hover); color: var(--text-secondary); white-space: nowrap; }
.soc-vessel-meta-line       { margin-top: 2px; padding-left: 2px; flex: unset; }

.m-tab {
    padding: 7px 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 400;
    font-size: 12.5px;
    font-family: inherit;
    border-radius: 0;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    gap: 5px;
    box-sizing: border-box;
    transition: color var(--motion-fast) var(--motion-ease-soft);
}
/* Если вкладка сделана кнопкой — сброс UA, как у div в профиле моряка */
button.m-tab {
    font: inherit;
    text-align: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.m-tab:hover        { color: var(--text-primary); background: transparent; }
.m-tab.active {
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--accent);
}
.profile-tabs-divider {
    width: 1px;
    background: var(--border);
    margin: 4px 6px;
}
.ss-tab-btn-inline {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.profile-section                       { display: none; }
.profile-section.active                { display: block; }
.profile-section > .form-row + .form-row { margin-top: 10px; }
.profile-section .section-title        { margin-top: 18px; margin-bottom: 8px; }
.lang-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.lang-row-field { flex: 1; }

/* ── Скроллируемая зона контента ─────────────────────────────────────────── */
.profile-body { flex: 1; overflow-y: auto; padding: 16px 24px 28px; }

/* ── Форма добавления записи в профиле ───────────────────────────────────── */
.profile-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 18px;
}

/* ── Инфо-блок (ready date / signoff) ───────────────────────────────────── */
.profile-info-block {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 14px;
}
.profile-info-block-label { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; }
.profile-info-block-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ── Таблица документов ───────────────────────────────────────────────────── */
.doc-group-header {
    background: var(--table-header);
    color: var(--text-muted);
    font-weight: 600; font-size: 11px;
    letter-spacing: 0.3px; padding: 8px 12px;
}
.doc-traffic-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%; vertical-align: middle;
}

/* ── Файлы ────────────────────────────────────────────────────────────────── */
.files-upload-row    { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.files-section-header{ display: flex; align-items: center; gap: 10px; margin-top: 24px; margin-bottom: 8px; }

.file-dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: 10px; padding: 24px 16px;
    text-align: center; cursor: pointer;
    transition: border-color var(--motion-base) var(--motion-ease-soft), background var(--motion-base) var(--motion-ease-soft);
    background: var(--bg); user-select: none;
}
.file-dropzone:hover       { border-color: var(--accent); background: var(--accent-light); }
.file-dropzone.drag-over   { border-color: var(--accent); background: var(--accent-light-hover); }
.file-dropzone-icon        { font-size: 28px; margin-bottom: 6px; }
.file-dropzone-text        { font-size: 13px; color: var(--text-secondary); }
.file-dropzone-link        { color: var(--accent); font-weight: 600; }
.file-dropzone-hint        { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.file-row-date {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}
.file-row-name { word-break: break-all; }
.file-row-name b { font-size: 13px; }
.file-row-actions-cell {
    text-align: right;
    padding-right: 15px;
}
.file-row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
}

/* ── Документы / Sea Service (минимизация inline-стилей) ─────────────────── */
.doc-name-cell { font-weight: 600; }
.doc-traffic-cell { text-align: center; }
.doc-grade-disabled {
    background: transparent !important;
    border-color: transparent !important;
}

.ss-rank-cell {
    font-weight: 600;
    color: var(--accent);
}
.ss-imo-subtext,
.ss-meta-subtext { color: var(--text-muted); }
.ss-nowrap { white-space: nowrap; }

.ss-summary-wrap {
    padding: 10px 0 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.ss-summary-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: 4px;
}
.ss-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
}
.ss-summary-rank { color: var(--text-primary); }
.ss-summary-dur { color: var(--text-secondary); }

/* ── References / Activity (zero inline styles) ─────────────────────────── */
.ref-date-cell {
    white-space: nowrap;
    color: var(--text-muted);
}
.ref-phone-link { color: var(--accent); }
.ref-status-pill {
    background: var(--status-bg);
    color: var(--status-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
[data-theme="dark"] .ref-status-pill {
    background: var(--status-bg-dark, var(--status-bg));
    color: var(--status-color-dark, var(--status-color));
}
.ref-empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

.activity-empty-cell {
    text-align: center;
    color: var(--text-secondary);
}
.activity-date-cell {
    color: var(--text-secondary);
    white-space: nowrap;
}
.activity-manager-cell { color: var(--text-secondary); }

/* ── Матрица STCW (вкладка карточки судовладельца) ───────────────────────── */
.matrix-vtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.matrix-vtab {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    appearance: none;
    font: inherit;
}
.matrix-vtab:hover { background: var(--bg-hover); color: var(--text-primary); }
.matrix-vtab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.matrix-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.matrix-table th,
.matrix-table td {
    border: 1px solid var(--border);
    padding: 4px 2px;
    font-size: 11px;
    text-align: center;
    vertical-align: middle;
}
.matrix-table thead th {
    background: var(--bg-card);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}
.matrix-table td.matrix-doc-name {
    text-align: left;
    padding: 0;
    border-right: 1px solid var(--border);
}
.matrix-doc-name-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 5px 8px;
}
.matrix-doc-edit { cursor: pointer; flex: 1; font-size: 11.5px; font-weight: 500; }
.matrix-doc-edit:hover { text-decoration: underline; color: var(--accent); }
.matrix-table tbody tr:hover td { background: var(--bg-hover); }
.matrix-table tbody tr:hover td.matrix-cell-x,
.matrix-table tbody tr:hover td.matrix-cell-na { filter: brightness(0.92); }
.matrix-cell-x {
    background: rgba(34,197,94,0.15);
    color: #16a34a;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.matrix-cell-na {
    background: rgba(239,68,68,0.12);
    color: #dc2626;
    font-weight: 600;
    font-size: 9px;
    cursor: pointer;
    user-select: none;
}
/* тёмная тема */
[data-theme="dark"] .matrix-cell-x  { background: rgba(34,197,94,0.2);  color: #4ade80; }
[data-theme="dark"] .matrix-cell-na { background: rgba(239,68,68,0.18); color: #f87171; }

.matrix-doc-actions {
    opacity: 0;
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.matrix-table tbody tr:hover .matrix-doc-actions { opacity: 1; }
.matrix-action-btn {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    border: none;
    color: #fff;
}
.matrix-action-btn.add { background: var(--success, #22c55e); }
.matrix-action-btn.del { background: var(--danger);  }

.matrix-score-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    background: var(--bg-hover);
    transition: background 0.12s;
}
.matrix-score-badge:hover { background: var(--border); }

.matrix-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    gap: 12px;
}
.matrix-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 11px;
    color: var(--text-secondary);
}
.matrix-legend-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 16px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    margin-right: 4px;
}

/* ── Дашборд-бары пайплайна (на вкладке Dashboard) ──────────────────────── */
/* (оставлено здесь потому что используется в profile-подобном контексте) */
