/* ── Панель "Состав работников" ─────────────────────────────────────────────── */

/* Фильтры */
.sp-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
}

body.dark-theme .sp-filters {
    background: rgba(255, 255, 255, 0.04);
}

.sp-filter-input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    outline: none;
    background: #fff;
    min-width: 150px;
    font-family: inherit;
    color: #1a1a2e;
    transition: border-color 0.15s;
}

body.dark-theme .sp-filter-input {
    background: #2d3238;
    border-color: #444;
    color: #e0e0e0;
}

.sp-filter-input:focus {
    border-color: #00c2f1;
    box-shadow: 0 0 0 2px rgba(0, 194, 241, 0.15);
}

/* Обёртка таблицы */
.sp-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

/* Таблица */
.sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 580px;
}

/* Заголовки */
.sp-table thead th {
    background: linear-gradient(135deg, #00e7f7, #00c2f1);
    color: #fff;
    padding: 10px 8px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.sp-table thead th:hover {
    background: linear-gradient(135deg, #00c2f1, #008dbf);
}

/* Иконки сортировки */
.sp-sort-icon::after  { content: ' ↕'; opacity: 0.45; font-size: 11px; }
.sp-sort-asc  .sp-sort-icon::after { content: ' ↑'; opacity: 1; }
.sp-sort-desc .sp-sort-icon::after { content: ' ↓'; opacity: 1; }

/* Строки */
.sp-table td {
    padding: 8px 8px;
    border-bottom: 1px solid #e8eaed;
    vertical-align: middle;
}

body.dark-theme .sp-table td {
    border-bottom-color: #383e47;
    color: #d0d0d0;
}

.sp-table tbody tr:hover td {
    background: rgba(0, 194, 241, 0.06);
}

body.dark-theme .sp-table tbody tr:hover td {
    background: rgba(0, 194, 241, 0.09);
}

/* Ячейка с именем */
.sp-name-cell {
    white-space: nowrap;
}

/* Кнопка раскрытия ветки */
.sp-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: #00c2f1;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.12s;
    vertical-align: middle;
    padding: 0;
}

.sp-toggle:hover {
    background: rgba(0, 194, 241, 0.15);
}

/* Маркер листового узла */
.sp-leaf {
    display: inline-block;
    width: 18px;
    text-align: center;
    color: #bbb;
    font-size: 9px;
    vertical-align: middle;
}

/* Бейдж статуса */
.sp-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.sp-status-ok    { background: #d1fae5; color: #065f46; }
.sp-status-trip  { background: #dbeafe; color: #1e40af; }
.sp-status-sick  { background: #fee2e2; color: #991b1b; }
.sp-status-leave { background: #fef3c7; color: #92400e; }

body.dark-theme .sp-status-ok    { background: #064e3b; color: #6ee7b7; }
body.dark-theme .sp-status-trip  { background: #1e3a5f; color: #93c5fd; }
body.dark-theme .sp-status-sick  { background: #4c1111; color: #fca5a5; }
body.dark-theme .sp-status-leave { background: #4c3800; color: #fcd34d; }

/* Ячейка «Текущее дело» */
.sp-task-cell {
    max-width: 120px;
    width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Полосы усталости / стресса */
.sp-bar-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 64px;
}

.sp-bar-wrap span {
    font-size: 11px;
    color: #888;
    width: 20px;
    text-align: right;
    flex-shrink: 0;
}

.sp-bar {
    height: 8px;
    border-radius: 4px;
    flex: 1;
    min-width: 4px;
    max-width: 80px;
    transition: width 0.3s;
}

.sp-bar-fatigue { background: linear-gradient(90deg, #fbbf24, #ef4444); }
.sp-bar-stress  { background: linear-gradient(90deg, #818cf8, #c026d3); }

/* Полоса занятости */
.sp-workload-wrap {
    min-width: 90px;
}

.sp-workload-track {
    position: relative;
    height: 13px;
    border: 1px solid #bbb;
    border-radius: 3px;
    background: transparent;
    overflow: hidden;
}

body.dark-theme .sp-workload-track {
    border-color: #555;
}

.sp-workload-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, #43e97b, #00c2f1);
    transition: width 0.3s;
}

.sp-workload-fill.sp-overload {
    background: linear-gradient(90deg, #ff9800, #f44336);
}

.sp-workload-pct {
    font-size: 11px;
    color: #888;
    margin-top: 3px;
    text-align: right;
}
