/* ===== STAFF TRACKING PAGE ===== */
.st-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.st-view-tabs {
    display: flex;
    gap: 4px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
}

.st-tab {
    padding: 6px 16px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.st-tab.active {
    background: var(--primary);
    color: #fff;
}

.st-tab:hover:not(.active) {
    background: var(--hover-bg);
}

/* ===== LEGEND — badge chips ===== */
.st-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.st-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Legend chips — match cell appearance */
.st-legend-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.st-chip-active {
    background: #dcfce7;
    color: #16a34a;
    border: 1.5px solid #86efac;
}

.st-chip-leave {
    background: #fef9c3;
    color: #a16207;
    border: 1.5px solid #fde047;
}

.st-chip-sick {
    background: #fee2e2;
    color: #dc2626;
    border: 1.5px solid #fca5a5;
}

.st-chip-business {
    background: #ede9fe;
    color: #7c3aed;
    border: 1.5px solid #c4b5fd;
}

.st-chip-dayoff {
    background: #dbeafe;
    color: #2563eb;
    border: 1.5px solid #93c5fd;
}

/* Summary */
.st-summary {
    margin-bottom: 16px;
}

.st-summary-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.85rem;
}

.st-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Grid card */
.st-grid-card {
    padding: 0;
    overflow: hidden;
}

.st-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.st-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 700px;
}

.st-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.st-staff-header {
    text-align: left;
    padding: 10px 12px;
    background: #ffffff;
    border-bottom: 2px solid var(--border);
    border-right: 2px solid var(--border);
    font-weight: 600;
    min-width: 180px;
    position: sticky;
    left: 0;
    z-index: 10;
    color: var(--text-primary);
    box-shadow: 4px 0 8px rgba(0,0,0,0.08);
}

.st-day-header {
    text-align: center;
    padding: 8px 6px;
    background: #ffffff;
    border-bottom: 2px solid var(--border);
    font-weight: 500;
    min-width: 52px;
    color: var(--text-secondary);
}

.st-day-header.st-today {
    background: var(--primary);
    color: #fff;
    border-radius: 0;
}

.st-day-header.st-weekend {
    color: var(--text-muted);
    background: var(--hover-bg);
}

.st-day-header.st-weekend.st-today {
    background: var(--primary);
    color: #fff;
}

.st-day-name {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.st-day-num {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Staff cell */
.st-staff-cell {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    border-right: 2px solid var(--border);
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 5;
    box-shadow: 4px 0 8px rgba(0,0,0,0.08);
}

.st-staff-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-staff-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.st-staff-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.st-staff-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== STATUS CELLS — Colorblind-safe design ===== */
/* Uses DUAL ENCODING: background color + text abbreviation */
/* Palette tested for protanopia, deuteranopia, tritanopia */

.st-cell {
    text-align: center;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
    cursor: default;
    transition: all 0.15s;
    min-width: 52px;
}

.st-cell[onclick] {
    cursor: pointer;
}

.st-cell[onclick]:hover {
    filter: brightness(0.92);
}

/* Status label — text inside each cell */
.st-status-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.st-cell.st-today {
    background: rgba(6, 182, 212, 0.06);
}

.st-cell.st-weekend {
    background: var(--hover-bg);
}

/* ===== Per-status styles — MATCHED to legend chips ===== */

/* Active — subtle green check */
.st-cell.st-status-active .st-status-label {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
    font-size: 0.75rem;
}

/* Leave (Nghỉ phép) — warm yellow */
.st-cell.st-status-leave {
    background: #fefce8 !important;
}
.st-cell.st-status-leave .st-status-label {
    background: #fef08a;
    color: #854d0e;
    border: 1.5px solid #facc15;
}

/* Sick (Bệnh ốm) — strong red */
.st-cell.st-status-sick {
    background: #fef2f2 !important;
}
.st-cell.st-status-sick .st-status-label {
    background: #fecaca;
    color: #dc2626;
    border: 1.5px solid #f87171;
}

/* Business (Công tác) — purple */
.st-cell.st-status-business {
    background: #faf5ff !important;
}
.st-cell.st-status-business .st-status-label {
    background: #ddd6fe;
    color: #6d28d9;
    border: 1.5px solid #a78bfa;
}

/* Dayoff (Nghỉ bù) — blue */
.st-cell.st-status-dayoff {
    background: #eff6ff !important;
}
.st-cell.st-status-dayoff .st-status-label {
    background: #bfdbfe;
    color: #1d4ed8;
    border: 1.5px solid #60a5fa;
}

/* Today column + status combos */
.st-cell.st-today.st-status-leave { background: #fef9c3 !important; }
.st-cell.st-today.st-status-sick { background: #fee2e2 !important; }
.st-cell.st-today.st-status-business { background: #ede9fe !important; }
.st-cell.st-today.st-status-dayoff { background: #dbeafe !important; }

/* Responsive */
@media (max-width: 768px) {
    .st-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .st-legend {
        justify-content: center;
    }
    .st-staff-header {
        min-width: 130px;
    }
    .st-staff-avatar {
        display: none;
    }
    .st-status-label {
        width: 24px;
        height: 18px;
        font-size: 0.6rem;
    }
}
