/* ========================================
   GRH Pro - Gestion du Personnel
   Styles Principaux
   ======================================== */

:root {
    --primary: #0f2d5c;
    --primary-light: #1a4a8a;
    --primary-dark: #091c3a;
    --accent: #f57c00;
    --accent-light: #ff9800;
    --accent-dark: #e65100;
    --success: #1b8a5a;
    --danger: #c0392b;
    --warning: #d4820a;
    --info: #1976d2;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1a2332;
    --text-muted: #6b7a8d;
    --border: #dde3eb;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(15,45,92,0.08);
    --shadow-hover: 0 6px 24px rgba(15,45,92,0.14);
    --transition: all 0.25s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--primary);
    position: fixed;
    left: 0; top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar.collapsed { width: 72px; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    min-height: 74px;
}

.logo-icon {
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.logo-text { overflow: hidden; }
.logo-name { display: block; font-size: 1.1rem; font-weight: 700; color: white; white-space: nowrap; }
.logo-sub { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.6); white-space: nowrap; }

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .badge,
.sidebar.collapsed .user-details { display: none; }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1.2px;
    padding: 16px 18px 6px;
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left-color: rgba(245,124,0,0.5);
}

.nav-item.active {
    background: rgba(245,124,0,0.15);
    color: white;
    border-left-color: var(--accent);
}

.nav-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.badge {
    margin-left: auto;
    background: var(--info);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

.badge.warning { background: var(--warning); }
.badge.danger { background: var(--danger); }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-name { display: block; font-size: 0.82rem; font-weight: 600; color: white; }
.user-role { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.55); }

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

.main-wrapper.expanded { margin-left: 72px; }

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-h);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.menu-toggle {
    width: 36px; height: 36px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.menu-toggle:hover { background: var(--border); color: var(--text); }

.page-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.topbar-date {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-notif {
    width: 36px; height: 36px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    position: relative;
    transition: var(--transition);
}

.btn-notif:hover { background: var(--border); }
.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

/* ===== CONTENT ===== */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; }

/* ===== KPI CARDS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid;
}

.kpi-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.kpi-card.blue { border-color: var(--primary); }
.kpi-card.orange { border-color: var(--accent); }
.kpi-card.green { border-color: var(--success); }
.kpi-card.red { border-color: var(--danger); }

.kpi-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.kpi-card.blue .kpi-icon { background: rgba(15,45,92,0.1); color: var(--primary); }
.kpi-card.orange .kpi-icon { background: rgba(245,124,0,0.12); color: var(--accent); }
.kpi-card.green .kpi-icon { background: rgba(27,138,90,0.1); color: var(--success); }
.kpi-card.red .kpi-icon { background: rgba(192,57,43,0.1); color: var(--danger); }

.kpi-value { display: block; font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1; }
.kpi-label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--accent); }

.card-body { padding: 16px 20px; max-height: 340px; overflow-y: auto; }

/* ===== ALERT ITEMS ===== */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.83rem;
}

.alert-item:last-child { margin-bottom: 0; }
.alert-item.warning { background: rgba(212,130,10,0.08); border-left: 3px solid var(--warning); }
.alert-item.danger { background: rgba(192,57,43,0.08); border-left: 3px solid var(--danger); }
.alert-item.info { background: rgba(25,118,210,0.08); border-left: 3px solid var(--info); }

.alert-item i { font-size: 0.95rem; margin-top: 2px; }
.alert-item.warning i { color: var(--warning); }
.alert-item.danger i { color: var(--danger); }
.alert-item.info i { color: var(--info); }

.alert-text strong { display: block; font-weight: 600; }
.alert-text span { color: var(--text-muted); }

/* ===== SITE PRESENCE ===== */
.site-presence-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.site-presence-item:last-child { border-bottom: none; }

.site-name { font-weight: 600; font-size: 0.88rem; }
.site-stats { display: flex; gap: 8px; align-items: center; }

.site-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.site-badge.present { background: rgba(27,138,90,0.12); color: var(--success); }
.site-badge.absent { background: rgba(192,57,43,0.12); color: var(--danger); }

/* ===== PAGE ACTIONS ===== */
.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.search-box i { color: var(--text-muted); }
.search-box input {
    border: none;
    outline: none;
    font-size: 0.88rem;
    background: transparent;
    width: 100%;
    font-family: inherit;
}

.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-group label {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

select, input[type="date"], input[type="time"] {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    background: white;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
}

select:focus, input[type="date"]:focus, input[type="time"]:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(15,45,92,0.08);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 12px rgba(15,45,92,0.25); }

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--bg); color: var(--text); }

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover { background: var(--accent-dark); }

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover { opacity: 0.85; }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
}

.btn-sm.btn-primary { background: var(--primary); color: white; }
.btn-sm.btn-primary:hover { background: var(--primary-light); }

/* ===== EMPLOYEES GRID ===== */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.employee-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.employee-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

.emp-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.emp-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.emp-name { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.emp-post { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.emp-card-body { font-size: 0.8rem; }

.emp-info-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.emp-info-row i { width: 14px; color: var(--accent); }

.emp-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.emp-actions { display: flex; gap: 6px; }

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
}

.status-actif, .status-present { background: rgba(27,138,90,0.12); color: var(--success); }
.status-actif::before, .status-present::before { background: var(--success); }

.status-inactif, .status-expiré, .status-absent { background: rgba(192,57,43,0.1); color: var(--danger); }
.status-inactif::before, .status-expiré::before, .status-absent::before { background: var(--danger); }

.status-suspendu, .status-retard, .status-en.attente { background: rgba(212,130,10,0.1); color: var(--warning); }
.status-suspendu::before, .status-retard::before { background: var(--warning); }

.status-conge, .status-mission { background: rgba(25,118,210,0.1); color: var(--info); }
.status-conge::before, .status-mission::before { background: var(--info); }

.status-archivé { background: rgba(107,122,141,0.12); color: var(--text-muted); }
.status-archivé::before { background: var(--text-muted); }

.status-manquant { background: rgba(192,57,43,0.08); color: var(--danger); }
.status-manquant::before { background: var(--danger); }

.status-valide { background: rgba(27,138,90,0.12); color: var(--success); }
.status-valide::before { background: var(--success); }

/* ===== TABLE ===== */
.table-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--primary);
    color: white;
}

.data-table th {
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.data-table tbody tr:hover { background: rgba(15,45,92,0.03); }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
    padding: 11px 16px;
    font-size: 0.83rem;
    color: var(--text);
    vertical-align: middle;
}

.text-center { text-align: center; }

/* Employee cell in table */
.emp-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emp-cell-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.emp-cell-name { font-weight: 600; }
.emp-cell-mat { font-size: 0.72rem; color: var(--text-muted); }

/* Contract type badges */
.contract-type {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}

.type-CDI { background: rgba(27,138,90,0.12); color: var(--success); }
.type-CDD { background: rgba(25,118,210,0.12); color: var(--info); }
.type-Intérim { background: rgba(212,130,10,0.12); color: var(--warning); }
.type-Stage { background: rgba(156,39,176,0.12); color: #7b1fa2; }
.type-Alternance { background: rgba(0,150,136,0.12); color: #00695c; }

/* Days remaining */
.days-warning { color: var(--warning); font-weight: 600; }
.days-danger { color: var(--danger); font-weight: 700; }
.days-ok { color: var(--success); }

/* ===== POINTAGE ===== */
.pointage-header { margin-bottom: 20px; }

.pointage-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    background: white;
    padding: 14px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ===== SITES GRID ===== */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.site-card {
    background: white;
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-top: 4px solid var(--accent);
}

.site-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.site-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.site-icon {
    width: 46px; height: 46px;
    background: rgba(15,45,92,0.08);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
}

.site-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.site-card-ville { font-size: 0.8rem; color: var(--text-muted); }

.site-stats-row {
    display: flex;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.site-stat {
    text-align: center;
    flex: 1;
}

.site-stat-value { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.site-stat-label { font-size: 0.7rem; color: var(--text-muted); }

.site-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,45,92,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.25s ease;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover { background: var(--danger); color: white; }

.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* ===== FORMS ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    width: 100%;
}

input:focus, textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(15,45,92,0.08);
}

textarea { resize: vertical; min-height: 80px; }

/* ===== EMPLOYEE DETAIL ===== */
.emp-detail-header {
    display: flex;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.emp-detail-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.emp-detail-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.emp-tab {
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-family: inherit;
}

.emp-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.emp-tab-panel { display: none; }
.emp-tab-panel.active { display: block; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item label { color: var(--text-muted); font-weight: 400; font-size: 0.75rem; }
.info-item value { display: block; font-weight: 600; font-size: 0.88rem; margin-top: 2px; }

/* ===== MASSE POINTAGE ===== */
.masse-employee-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.masse-employee-row:last-child { border-bottom: none; }

.masse-emp-name { flex: 1; font-weight: 500; font-size: 0.88rem; }

.masse-employee-row select,
.masse-employee-row input { padding: 6px 10px; font-size: 0.82rem; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--primary);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(15,45,92,0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ===== LOADING ===== */
.loading-spinner {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 16px;
    justify-content: center;
}

/* ===== NO DATA ===== */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-data i { font-size: 2.5rem; display: block; margin-bottom: 12px; opacity: 0.4; }
.no-data p { font-size: 0.9rem; }

/* ===== EXPIRING CONTRACT ===== */
.expiring-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.83rem;
}

.expiring-item:last-child { border-bottom: none; }
.expiring-name { font-weight: 600; }
.expiring-meta { color: var(--text-muted); font-size: 0.75rem; }

/* ===== RECENT EMP ===== */
.recent-emp-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.recent-emp-item:last-child { border-bottom: none; }

/* ===== ACTION BUTTONS IN TABLE ===== */
.action-btns { display: flex; gap: 6px; }

.action-btn {
    width: 30px; height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}

.action-btn.view { background: rgba(25,118,210,0.1); color: var(--info); }
.action-btn.edit { background: rgba(245,124,0,0.1); color: var(--accent); }
.action-btn.delete { background: rgba(192,57,43,0.1); color: var(--danger); }

.action-btn:hover { opacity: 0.8; transform: scale(1.1); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-260px); width: 260px; }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .employees-grid { grid-template-columns: 1fr; }
    .sites-grid { grid-template-columns: 1fr; }
    .pointage-filters { flex-direction: column; align-items: flex-start; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .dossier-grid { grid-template-columns: 1fr; }
    .fiche-docs-grid { grid-template-columns: 1fr; }
    .fiche-topbar { flex-wrap: wrap; gap: 10px; }
}

/* ============================================================
   DOSSIER ADMINISTRATIF — STYLES COMPLETS
   ============================================================ */

/* Stats bar */
.doc-stats-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.doc-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.doc-stat-pill.complete  { background: rgba(27,138,90,0.12); color: var(--success); }
.doc-stat-pill.incomplete { background: rgba(212,130,10,0.12); color: var(--warning); }
.doc-stat-pill.critical  { background: rgba(192,57,43,0.12); color: var(--danger); }

/* ===== GRILLE DOSSIERS LISTE ===== */
.dossier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.dossier-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.dossier-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

.dossier-card-header {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.dossier-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.dossier-emp-name { font-weight: 700; font-size: 0.95rem; }
.dossier-emp-sub  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.dossier-card-body { padding: 14px 18px; }

/* Barre de progression dans la carte */
.dossier-progress-wrap {
    margin-bottom: 12px;
}

.dossier-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.77rem;
    margin-bottom: 6px;
}

.dossier-progress-label span:first-child { color: var(--text-muted); }
.dossier-progress-label span:last-child  { font-weight: 700; }

.progress-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-bar-fill.ok      { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger  { background: var(--danger); }

/* Mini checklist dans la carte */
.dossier-mini-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.mini-doc-chip.fourni    { background: rgba(27,138,90,0.1);  color: var(--success); }
.mini-doc-chip.manquant  { background: rgba(192,57,43,0.1);  color: var(--danger); }
.mini-doc-chip.expiré    { background: rgba(212,130,10,0.1); color: var(--warning); }
.mini-doc-chip.attente   { background: rgba(25,118,210,0.1); color: var(--info); }
.mini-doc-chip.optionnel { background: rgba(107,122,141,0.1); color: var(--text-muted); }

.dossier-card-footer {
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(240,244,248,0.5);
}

/* ===== VUE FICHE DÉTAILLÉE ===== */
.fiche-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

#fiche-emp-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.fiche-emp-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

/* Carte de progression globale */
.fiche-progress-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.fiche-prog-main {
    flex: 1;
    min-width: 260px;
}

.fiche-prog-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fiche-prog-bar-wrap {
    height: 12px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.fiche-prog-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.fiche-prog-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.fiche-prog-stat {
    text-align: center;
    min-width: 80px;
}

.fiche-prog-stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    display: block;
    line-height: 1;
}

.fiche-prog-stat-lab {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ===== GRILLE DES DOCUMENTS DE LA FICHE ===== */
.fiche-docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* Section obligatoire / optionnel */
.fiche-section-title {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 0;
    border-bottom: 2px solid var(--border);
    margin-top: 8px;
}

.fiche-section-title.obligatoire { color: var(--primary); border-color: var(--primary); }
.fiche-section-title.optionnel   { color: var(--text-muted); border-color: var(--border); }

/* Carte document individuelle */
.doc-item-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
    overflow: hidden;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.doc-item-card.fourni    { border-color: rgba(27,138,90,0.35); }
.doc-item-card.manquant  { border-color: rgba(192,57,43,0.35); }
.doc-item-card.expiré    { border-color: rgba(212,130,10,0.35); }
.doc-item-card.attente   { border-color: rgba(25,118,210,0.25); }
.doc-item-card.non-applicable { border-color: var(--border); opacity: 0.75; }

.doc-item-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.doc-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.doc-item-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.doc-item-icon.fourni    { background: rgba(27,138,90,0.12);  color: var(--success); }
.doc-item-icon.manquant  { background: rgba(192,57,43,0.1);   color: var(--danger); }
.doc-item-icon.expiré    { background: rgba(212,130,10,0.1);  color: var(--warning); }
.doc-item-icon.attente   { background: rgba(25,118,210,0.1);  color: var(--info); }
.doc-item-icon.non-applicable { background: var(--bg); color: var(--text-muted); }

.doc-item-title { font-weight: 700; font-size: 0.88rem; line-height: 1.2; }
.doc-item-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.doc-obligatoire-badge {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.doc-obligatoire-badge.req  { background: rgba(192,57,43,0.1);  color: var(--danger); }
.doc-obligatoire-badge.opt  { background: rgba(107,122,141,0.1); color: var(--text-muted); }

.doc-item-body {
    padding: 12px 16px;
}

.doc-item-ref {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    word-break: break-all;
}

.doc-item-ref.empty { color: var(--text-muted); font-style: italic; font-weight: 400; }

.doc-item-dates {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.doc-item-date-val { font-weight: 600; color: var(--text); }

.doc-item-file {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 5px 8px;
    background: rgba(25,118,210,0.06);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--info);
    font-weight: 500;
}

.doc-item-notes {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 4px 8px;
    background: var(--bg);
    border-radius: 6px;
    border-left: 3px solid var(--border);
}

.doc-item-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    background: rgba(240,244,248,0.4);
}

/* Statut badge doc */
.doc-statut-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.73rem;
    font-weight: 700;
}

.doc-statut-badge.fourni          { background: rgba(27,138,90,0.12);  color: var(--success); }
.doc-statut-badge.manquant        { background: rgba(192,57,43,0.1);   color: var(--danger); }
.doc-statut-badge.expiré          { background: rgba(212,130,10,0.1);  color: var(--warning); }
.doc-statut-badge.en-attente      { background: rgba(25,118,210,0.1);  color: var(--info); }
.doc-statut-badge.non-applicable  { background: var(--bg);             color: var(--text-muted); }

/* ===== UPLOAD BOX ===== */
.upload-box {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 6px;
}

.upload-box:hover {
    border-color: var(--primary-light);
    background: rgba(15,45,92,0.03);
    color: var(--primary);
}

.upload-box i { font-size: 1.8rem; opacity: 0.5; }
.upload-box.has-file { border-color: var(--success); background: rgba(27,138,90,0.05); color: var(--success); }
.upload-box small { font-size: 0.72rem; opacity: 0.7; }

/* ===== AFFICHAGE EMPLOYÉ DANS MODAL DOC ===== */
.doc-emp-display {
    background: rgba(15,45,92,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.doc-emp-display .mini-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* ===== IMPRESSION ===== */
.fiche-print-wrap {
    padding: 24px 32px;
    font-family: 'Inter', sans-serif;
}

.fiche-print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 3px solid var(--primary);
    margin-bottom: 20px;
}

.fiche-print-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fiche-print-logo-icon {
    width: 44px; height: 44px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.fiche-print-title { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.fiche-print-sub   { font-size: 0.75rem; color: var(--text-muted); }

.fiche-print-emp {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(15,45,92,0.04);
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.fiche-print-emp-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.fiche-print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.fiche-print-table th {
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    font-size: 0.8rem;
    text-align: left;
}

.fiche-print-table td {
    padding: 9px 14px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.fiche-print-table tr:hover td { background: rgba(15,45,92,0.02); }

.print-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.print-status.fourni   { background: rgba(27,138,90,0.12);  color: var(--success); }
.print-status.manquant { background: rgba(192,57,43,0.1);   color: var(--danger); }
.print-status.expiré   { background: rgba(212,130,10,0.1);  color: var(--warning); }
.print-status.attente  { background: rgba(25,118,210,0.1);  color: var(--info); }
.print-status.na       { background: var(--bg); color: var(--text-muted); }

.fiche-print-signature {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.sign-box {
    text-align: center;
}

.sign-line {
    height: 50px;
    border-bottom: 1px solid var(--text);
    margin-bottom: 6px;
}

.sign-label { font-size: 0.75rem; color: var(--text-muted); }

@media print {
    .sidebar, .topbar, .fiche-topbar, .modal-footer { display: none !important; }
    .fiche-print-wrap { padding: 0; }
}

