:root {
    --primary: #f26b21; /* Logo Orange */
    --primary-hover: #db5c18;
    --navy: #1a2e40; /* Logo Navy */
    --navy-hover: #12212e;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #ffffff;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: #ffffff;
    --sidebar-active: #fff7ed; /* Subtle orange tint for active items */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --card-radius: 0.75rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

h1, h2, h3, .logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* --- Login Split Layout --- */
.login-container {
    height: 100vh;
    display: flex;
    background: white;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: linear-gradient(135deg, var(--navy) 0%, #0d1721 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.login-form-side::after {
    content: "";
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(242, 107, 33, 0.06) 0%, rgba(255,255,255,0) 70%);
    top: -50%;
    left: -50%;
    pointer-events: none;
}

.login-box {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
}

.login-header {
    margin-bottom: 3rem;
}

.login-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

.login-card {
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: var(--text);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(242, 107, 33, 0.12);
}

/* --- Login Specific Inputs (Dark Mode) --- */
.login-form-side .form-group label {
    color: rgba(255, 255, 255, 0.9);
}

.login-form-side .form-group input {
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
}

.login-form-side .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-form-side .form-group input:focus {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(242, 107, 33, 0.2);
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.25rem;
    font-size: 0.875rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
}

.forgot-password {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.forgot-password:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 6px 18px rgba(242, 107, 33, 0.22);
}

.btn-login:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(242, 107, 33, 0.32);
}

.login-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.875rem;
}

.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.login-separator:not(:empty)::before {
    margin-right: 1rem;
}

.login-separator:not(:empty)::after {
    margin-left: 1rem;
}

.btn-microsoft {
    width: 100%;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.btn-microsoft:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-microsoft i {
    color: #00a4ef; /* Microsoft logo blue */
}

.login-footer-text {
    margin-top: 4rem;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

.login-brand-side {
    flex: 1.2;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--navy);
    position: relative;
    overflow: hidden;
}

.top-right-app-name {
    position: absolute;
    top: 2.5rem;
    right: 3.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: 0.5px;
    pointer-events: none;
    opacity: 0.95;
}

.brand-content {
    width: 100%;
    max-width: 460px;
    text-align: center;
    z-index: 2;
}

.brand-logo-container {
    margin-bottom: 2.5rem;
    animation: floatLogo 6s ease-in-out infinite;
}

.brand-logo-img {
    width: 100%;
    max-width: 380px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 12px 32px rgba(26, 46, 64, 0.12));
}

.brand-message h3 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--navy);
}

.brand-message p {
    font-size: 1.125rem;
    opacity: 1;
    color: var(--text-muted);
    font-weight: 400;
    max-width: 360px;
    margin: 0 auto;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@media (max-width: 1024px) {
    .login-brand-side { display: none; }
    .login-form-side { flex: 1; }
}


/* --- Layout --- */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-collapsed {
    grid-template-columns: 70px 1fr;
}

/* --- Sidebar --- */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-collapsed .sidebar {
    padding: 0.75rem 0.35rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0 1.5rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0 0.5rem 0;
    margin-bottom: 0.5rem;
}

.sidebar-collapsed .logo img {
    max-width: 36px;
    height: auto;
}

#sidebar-toggle {
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img {
    height: 42px;
    width: auto;
    display: block;
    object-fit: contain;
    transition: all 0.3s ease;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.nav-item i {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item:hover, .nav-item.active {
    background: var(--sidebar-active);
    color: var(--primary);
}

/* Collapsed nav item styles */
.sidebar-collapsed .sidebar-nav {
    gap: 2px;
}

.sidebar-collapsed .nav-item {
    padding: 0.35rem 0;
    min-height: 32px;
    height: 32px;
    justify-content: center;
    gap: 0;
    border-radius: 0.375rem;
}

.sidebar-collapsed .nav-item i {
    width: 18px;
    height: 18px;
    font-size: 1rem;
}

.sidebar-collapsed .nav-item .nav-text {
    display: none;
}

.nav-separator {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 1.25rem 0 0.5rem 1rem;
    transition: all 0.3s ease;
}

.sidebar-collapsed .nav-separator {
    font-size: 0;
    text-align: center;
    margin: 0.35rem 0.25rem;
    height: 1px;
    background: var(--border);
    padding: 0;
    border: none;
}

.sidebar-collapsed .nav-separator::before {
    display: none;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border);
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.sidebar-user:hover, .sidebar-user.active {
    background: var(--sidebar-active);
}

.sidebar-user .user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
}

.sidebar-user .user-info .user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.sidebar-user .user-info .user-link {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-collapsed .sidebar-user {
    justify-content: center;
    padding: 0.5rem 0;
}

.sidebar-collapsed .sidebar-user .user-info {
    display: none;
}

.sidebar-footer {
    padding-top: 0.25rem;
}

/* --- Main Content --- */
.main-content {
    position: relative;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--background);
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-layout.sidebar-collapsed .main-content {
    padding: 2rem; /* No extra padding needed since sidebar is still visible */
}

/* Hide toggle reopen button completely since sidebar toggle button is always accessible */
.app-layout.sidebar-collapsed #sidebar-reopen {
    display: none !important;
}

/* Sidebar Reopen Button (visible only when collapsed) */
.toggle-sidebar-btn {
    display: none; /* hidden by default */
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 999;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--text-muted);
    transition: all 0.2s;
}

.toggle-sidebar-btn:hover {
    background: var(--sidebar-active);
    color: var(--primary);
}

.app-layout.sidebar-collapsed .toggle-sidebar-btn {
    display: none; /* Keep hidden now since sidebar toggle inside sidebar is always visible */
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-right: 3.5rem;
}

.header-title h1 {
    font-size: 1.875rem;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-muted);
}

.card {
    background: var(--surface);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    border: 1px solid var(--border);
}

/* --- Views --- */
.view {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Tables --- */
.table-container {
    overflow-x: auto;
}

.planning-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.planning-table th {
    padding: 1rem;
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.planning-table td {
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    vertical-align: middle;
}

.planning-table td:last-child {
    white-space: nowrap;
}

/* Custom column compression and expansion */
#planning-table th:nth-child(1), #planning-table td:nth-child(1) { width: 35px; min-width: 35px; padding: 0.5rem 0.1rem; text-align: center; } /* Selection */
#planning-table th:nth-child(2), #planning-table td:nth-child(2) { width: 30px; min-width: 30px; padding: 0.5rem 0.1rem; text-align: center; } /* Cognito */
#planning-table th:nth-child(3), #planning-table td:nth-child(3) { width: 8.5%; min-width: 85px; } /* Contrat */
#planning-table th:nth-child(4), #planning-table td:nth-child(4) { width: 110px; min-width: 110px; max-width: 115px; padding: 0.5rem 0.25rem; } /* Camion */
#planning-table th:nth-child(5), #planning-table td:nth-child(5) { width: 85px; min-width: 85px; max-width: 95px; padding: 0.5rem 0.25rem; } /* Remorque */
#planning-table th:nth-child(6), #planning-table td:nth-child(6) { width: 175px; min-width: 175px; max-width: 190px; padding: 0.5rem 0.25rem; } /* Chauffeur */
#planning-table th:nth-child(7), #planning-table td:nth-child(7) { width: 15%; min-width: 140px; } /* Lieu Chargement */
#planning-table th:nth-child(8), #planning-table td:nth-child(8) { width: 8%; min-width: 80px; max-width: 100px; } /* Produit */
#planning-table th:nth-child(9), #planning-table td:nth-child(9) { width: 25%; min-width: 240px; } /* Lieu Travaux */
#planning-table th:nth-child(10), #planning-table td:nth-child(10) { width: 65px; min-width: 65px; } /* Heure */
#planning-table th:nth-child(11), #planning-table td:nth-child(11) { width: 75px; min-width: 75px; text-align: center; } /* Statut */
#planning-table th:last-child, #planning-table td:last-child { width: 70px; min-width: 70px; } /* Actions */

/* Expanded columns when sidebar is collapsed */
.app-layout.sidebar-collapsed #planning-table th:nth-child(6),
.app-layout.sidebar-collapsed #planning-table td:nth-child(6) {
    width: 250px;
    min-width: 250px;
    max-width: 270px;
} /* Chauffeur expands */
.app-layout.sidebar-collapsed #planning-table th:nth-child(7),
.app-layout.sidebar-collapsed #planning-table td:nth-child(7) {
    width: 20%;
    min-width: 200px;
} /* Lieu Chargement expands */
.app-layout.sidebar-collapsed #planning-table th:nth-child(9),
.app-layout.sidebar-collapsed #planning-table td:nth-child(9) {
    width: 35%;
    min-width: 350px;
} /* Lieu Travaux expands */

/* PPE Table columns rules */
#planning-table-ppe th:nth-child(1), #planning-table-ppe td:nth-child(1) { width: 35px; min-width: 35px; padding: 0.5rem 0.1rem; text-align: center; } /* Selection */
#planning-table-ppe th:nth-child(2), #planning-table-ppe td:nth-child(2) { width: 30px; min-width: 30px; padding: 0.5rem 0.1rem; text-align: center; } /* Cognito */
#planning-table-ppe th:nth-child(3), #planning-table-ppe td:nth-child(3) { width: 8.5%; min-width: 85px; } /* Contrat */
#planning-table-ppe th:nth-child(4), #planning-table-ppe td:nth-child(4) { width: 95px; min-width: 95px; } /* Tache */
#planning-table-ppe th:nth-child(5), #planning-table-ppe td:nth-child(5) { width: 155px; min-width: 155px; max-width: 170px; padding: 0.5rem 0.25rem; } /* Employe */
#planning-table-ppe th:nth-child(6), #planning-table-ppe td:nth-child(6) { width: 85px; min-width: 85px; max-width: 95px; padding: 0.5rem 0.25rem; } /* Equipement */
#planning-table-ppe th:nth-child(7), #planning-table-ppe td:nth-child(7) { width: 35%; min-width: 320px; } /* Localisation */
#planning-table-ppe th:nth-child(8), #planning-table-ppe td:nth-child(8) { width: 65px; min-width: 65px; } /* Heure */
#planning-table-ppe th:nth-child(9), #planning-table-ppe td:nth-child(9) { width: 75px; min-width: 75px; text-align: center; } /* Statut */
#planning-table-ppe th:last-child, #planning-table-ppe td:last-child { width: 70px; min-width: 70px; } /* Actions */

/* Expanded columns for PPE when sidebar is collapsed */
.app-layout.sidebar-collapsed #planning-table-ppe th:nth-child(5),
.app-layout.sidebar-collapsed #planning-table-ppe td:nth-child(5) {
    width: 200px;
    min-width: 200px;
    max-width: 220px;
} /* Employe expands */
.app-layout.sidebar-collapsed #planning-table-ppe th:nth-child(7),
.app-layout.sidebar-collapsed #planning-table-ppe td:nth-child(7) {
    width: 45%;
    min-width: 420px;
} /* Localisation expands */

/* Livraisons Table columns rules */
#livraisons-table th:nth-child(1), #livraisons-table td:nth-child(1) { width: 35px; min-width: 35px; padding: 0.5rem 0.1rem; text-align: center; } /* Selection */
#livraisons-table th:nth-child(2), #livraisons-table td:nth-child(2) { width: 50px; min-width: 50px; max-width: 50px; text-align: center; } /* ID */
#livraisons-table th:nth-child(3), #livraisons-table td:nth-child(3) { width: 140px; min-width: 140px; } /* Date requis */
#livraisons-table th:nth-child(4), #livraisons-table td:nth-child(4) { width: 90px; min-width: 90px; } /* Contrat */
#livraisons-table th:nth-child(5), #livraisons-table td:nth-child(5) { width: 180px; min-width: 180px; } /* Chauffeur */
#livraisons-table th:nth-child(6), #livraisons-table td:nth-child(6) { min-width: 250px; } /* Lieu de livraison */
#livraisons-table th:nth-child(7), #livraisons-table td:nth-child(7) { min-width: 150px; } /* Matériels à livrer */
#livraisons-table th:nth-child(8), #livraisons-table td:nth-child(8) { min-width: 150px; } /* Détails / Notes */
#livraisons-table th:nth-child(9), #livraisons-table td:nth-child(9) { width: 50px; min-width: 50px; text-align: center; } /* Statut */
#livraisons-table th:last-child, #livraisons-table td:last-child { width: 120px; min-width: 120px; text-align: center; } /* Actions SMS */

#livraisons-table td input[type="date"] {
    width: 100% !important;
    min-width: 130px !important;
    padding: 0.3rem 0.5rem !important;
    font-size: 0.85rem !important;
}

/* --- Inline Editing --- */
.inline-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text);
    transition: all 0.2s;
    outline: none;
}

.inline-input:hover {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.1);
}

.inline-input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

select.inline-input {
    cursor: pointer;
    appearance: none;
}

/* Tom Select Overrides for Inline Look */
.ts-wrapper.inline-input {
    padding: 0;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}
.ts-wrapper.inline-input .ts-control {
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
    padding: 0.5rem;
    border-radius: 0.25rem;
    min-height: auto;
    font-size: 0.875rem;
    transition: all 0.2s;
    color: var(--text);
}
.ts-wrapper.inline-input:hover .ts-control {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.1);
}
.ts-wrapper.inline-input.focus .ts-control {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}
.ts-wrapper.inline-input .ts-dropdown {
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    font-size: 0.875rem;
    background: white !important;
}

.planning-table tr:hover {
    background: #f1f5f9;
}

/* --- Contract Grouping --- */
.contract-group-row {
    background: #f8fafc;
    transition: background-color 0.2s ease;
}
.contract-group-row:hover td {
    background: #f1f5f9 !important;
}
.contract-group-row td {
    border-top: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
}

/* --- Row States --- */
.row-dispo-asked td { background-color: rgba(245, 158, 11, 0.12); }
.row-conf-asked td { background-color: rgba(99, 102, 241, 0.12); }
.row-ok td { background-color: rgba(16, 185, 129, 0.12); }
.row-empty td { background-color: rgba(239, 68, 68, 0.14); }
.row-concordance-error td { background-color: rgba(239, 68, 68, 0.12) !important; }
.concordance-error-trigger { background-color: rgba(239, 68, 68, 0.08) !important; border-color: #ef4444 !important; color: #ef4444 !important; font-weight: bold; }
.employe-missing-trigger { background-color: rgba(245, 158, 11, 0.06) !important; border-color: rgba(245, 158, 11, 0.5) !important; color: #d97706 !important; }
.row-last-saved td { background-color: rgba(242, 107, 33, 0.25) !important; }

/* --- Buttons --- */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: white;
    border-color: var(--border);
    color: var(--text);
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* --- Modals & Panels --- */
.action-modal {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: white;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.action-modal.active {
    right: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.timeline {
    flex: 1;
    overflow-y: auto;
    margin: 2rem 0;
}

.message {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    max-width: 85%;
    font-size: 0.9rem;
}

.message-out {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message-in {
    background: #f1f5f9;
    color: var(--text);
}

/* --- Import Zone --- */
.import-zone {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.2s;
    cursor: pointer;
    background: white;
    width: 100%;
}

.import-zone:hover {
    border-color: var(--primary);
    background-color: #f0f7ff;
}

/* --- Premium Status Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.status-draft {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.status-dispo-asked {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.status-refused {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.status-available {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.status-conf-asked {
    background: #e0e7ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
}

.status-validated {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* --- Toast --- */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 20000;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    margin-top: 0.5rem;
    font-weight: 500;
    animation: slideInToast 0.3s ease;
}

.toast-error {
    background: #ef4444;
    border-left: 4px solid #b91c1c;
}

.toast-success {
    background: #10b981;
    border-left: 4px solid #047857;
}

@keyframes slideInToast {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Dashboard Styles */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-grid .card {
        grid-column: span 1 !important;
    }
}

.reports-layout-grid {
    grid-template-columns: 350px 1fr;
}
@media (max-width: 1024px) {
    .reports-layout-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 600px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    gap: 1.5rem;
    animation: fadeIn 0.4s ease-out forwards;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.dashboard-list-card {
    padding: 1.5rem;
}

.pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 0.5rem;
}
.pending-item:last-child {
    border-bottom: none;
}
.pending-item:hover {
    background: var(--background);
}

.pending-name {
    font-weight: 600;
    color: var(--text);
}
.pending-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}
.pending-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.busiest-day-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.busiest-day-item:last-child {
    border-bottom: none;
}
.busiest-day-item:hover {
    background-color: var(--sidebar-active);
    padding-left: 0.75rem;
    padding-right: 0.25rem;
}
.busiest-day-item:hover .busiest-date {
    color: var(--primary);
}
.busiest-date {
    font-weight: 500;
    color: var(--text);
}
.busiest-count {
    font-weight: 700;
    color: var(--primary);
}

/* Premium Animations & Progress Bar */
.interactive-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.interactive-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 9999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-container {
    margin-top: 1rem;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Form Fields --- */
input[type="text"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: inherit;
    background-color: white;
    transition: all 0.2s;
    appearance: none;
}

input[type="date"] {
    position: relative;
    padding-right: 2.5rem;
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: #cbd5e1;
    font-size: 0.8rem;
}

.btn-icon-sm.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-icon-sm.active.ok { color: var(--success); }
.btn-icon-sm.active.no { color: var(--danger); }
.btn-icon-sm.active.asked { color: #6366f1; }

.timeline-container {
    position: relative;
    padding-left: 2rem;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid #cbd5e1;
    border-radius: 50%;
    z-index: 1;
}

.timeline-dot.active {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.sms-bubble {
    padding: 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    position: relative;
    max-width: 100%;
}

.sms-bubble-out {
    background: #3b82f6;
    color: white;
}

.sms-bubble-in {
    background: #f1f5f9;
    color: var(--text);
}

.sms-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.btn-status-active {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    font-weight: 700 !important;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* === Premium Edit Modal Overhaul === */
.premium-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 99999;
    align-items: center;
    justify-content: flex-start;
    padding: 3rem 1.5rem;
    overflow-y: auto;
}

.premium-modal-card {
    background: #ffffff;
    border-radius: 1.25rem;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    border: 1px solid rgba(255,255,255,0.1);
    animation: premiumModalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes premiumModalSlideIn {
    from { opacity: 0; transform: translateY(15px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.premium-modal-card .modal-header {
    margin-bottom: 0.25rem;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.premium-modal-title {
    font-family: 'Outfit', sans-serif !important;
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 !important;
    line-height: 1.2;
}

.premium-modal-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1.25rem;
    margin-top: 0.375rem;
    line-height: 1.5;
}
/* Compact Grid Layout */
#edit-fields-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    row-gap: 0.875rem;
}

.premium-modal-card .form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.premium-modal-card .form-group.full-width {
    grid-column: span 2;
}

.premium-modal-card .form-group label {
    font-family: 'Inter', sans-serif;
    font-size: 0.825rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
    display: block;
    text-align: left;
}

.premium-modal-card .form-group input[type="text"],
.premium-modal-card .form-group input[type="tel"],
.premium-modal-card .form-group input[type="number"],
.premium-modal-card .form-group input[type="email"],
.premium-modal-card .form-group input[type="password"],
.premium-modal-card .form-group input[type="date"],
.premium-modal-card .form-group select {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.925rem;
    color: #1e293b;
    transition: all 0.2s ease;
    outline: none;
}

.premium-modal-card .form-group input[type="text"]::placeholder,
.premium-modal-card .form-group input[type="tel"]::placeholder,
.premium-modal-card .form-group input[type="number"]::placeholder {
    color: #94a3b8;
}

/* Theme Colors: Orange Highlight and Ring */
.premium-modal-card .form-group input:focus,
.premium-modal-card .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(242, 107, 33, 0.18);
}

.premium-modal-card .form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.1rem;
    padding-right: 2.75rem;
}

.premium-modal-card .form-group select[multiple] {
    background-image: none;
    padding-right: 1rem;
    height: auto;
    min-height: 90px;
}

.premium-submit-btn {
    width: 100%;
    background: var(--primary) !important;
    color: white !important;
    padding: 0.8rem 1.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    margin-top: 1.75rem !important;
    transition: all 0.2s ease !important;
    font-family: 'Inter', sans-serif !important;
    box-shadow: 0 4px 6px -1px rgba(242, 107, 33, 0.1), 0 2px 4px -1px rgba(242, 107, 33, 0.06) !important;
}

.premium-submit-btn:hover {
    background: var(--primary-hover) !important;
    box-shadow: 0 10px 15px -3px rgba(242, 107, 33, 0.25), 0 4px 6px -2px rgba(242, 107, 33, 0.1) !important;
}

.premium-submit-btn:active {
    transform: translateY(1px) scale(0.99);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #edit-fields-container {
        grid-template-columns: 1fr;
    }
    .premium-modal-card .form-group.full-width {
        grid-column: auto;
    }
}

td.active-dropdown-cell {
    position: relative !important;
    z-index: 9999 !important;
}

/* --- Searchable Custom Select Dropdown Widget --- */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    width: 100%;
    padding: 0.45rem 1.75rem 0.45rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border);
    background: #ffffff;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    display: block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    min-height: 32px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s ease;
}

.custom-select-trigger:focus {
    outline: none;
    border-color: var(--primary);
}

.custom-select-trigger::before {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1.85rem;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 40%);
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    pointer-events: none;
}

.custom-select-trigger::after {
    content: "";
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #64748b;
    pointer-events: none;
}

.custom-select-trigger.no-caret::before,
.custom-select-trigger.no-caret::after {
    display: none !important;
}

.header-status-select {
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www%2Ew3%2Eorg/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    background-size: 0.85rem !important;
    padding-right: 1.75rem !important;
    transition: all 0.2s ease;
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px; /* minimum readable width */
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    z-index: 99999;
    margin-top: 0.25rem;
    padding: 0.5rem;
    font-family: 'Inter', sans-serif;
}

.dropdown-search-box {
    margin-bottom: 0.5rem;
}

.dropdown-search-box input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #cbd5e1;
    font-size: 0.825rem;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s;
}

.dropdown-search-box input:focus {
    border-color: var(--primary);
}

.dropdown-options-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Custom Scrollbar for Dropdown */
.dropdown-options-list::-webkit-scrollbar {
    width: 5px;
}
.dropdown-options-list::-webkit-scrollbar-track {
    background: transparent;
}
.dropdown-options-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.dropdown-option {
    padding: 0.45rem 0.75rem;
    font-size: 0.825rem;
    color: #334155;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.1s ease;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    line-height: 1.4;
}

.dropdown-option:hover,
.dropdown-option.highlighted {
    background-color: #f1f5f9;
    color: #0f172a;
}

.dropdown-option.selected {
    background-color: #fff7ed;
    color: var(--primary);
    font-weight: 600;
}

.dropdown-option.absent-disabled {
    opacity: 0.65;
    color: #d32f2f !important;
    font-style: italic;
    text-decoration: line-through;
}
.dropdown-option.absent-disabled:hover {
    background-color: rgba(211, 47, 47, 0.08) !important;
    color: #c62828 !important;
}

/* --- Availabilities Schedule Board Grid --- */
.availabilities-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    font-size: 0.9rem;
    table-layout: fixed; /* ensures equal columns */
}

.availabilities-table th,
.availabilities-table td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 0.5rem 0.4rem;
    vertical-align: middle;
}

/* Top row Header Sticky */
.availabilities-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--background);
    color: var(--text);
    font-weight: 600;
    text-align: center;
    padding: 1rem 0.5rem;
    box-shadow: inset 0 -2px 0 var(--border);
}

/* Left Column Contact Name Sticky */
.availabilities-table td:first-child,
.availabilities-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 11;
    background: #ffffff;
    font-weight: 600;
    width: 220px; /* Locked width for name column */
    min-width: 220px;
    text-align: left;
    border-right: 2px solid var(--border);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.02);
}

/* The top-left corner intersection is highest index */
.availabilities-table th:first-child {
    z-index: 12;
    background: var(--background);
}

.availabilities-table tbody tr:hover td {
    background-color: rgba(0,0,0,0.01);
}
.availabilities-table tbody tr:hover td:first-child {
    background-color: #fcfcfc;
}

/* Date headers format */
.hdr-day-name {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.hdr-date {
    font-size: 1.05rem;
    font-weight: 700;
}
.hdr-today {
    background: rgba(242, 107, 33, 0.05) !important;
    color: var(--primary) !important;
}
.hdr-today .hdr-date {
    background: var(--primary);
    color: #ffffff;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.avail-cell-box {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 45px;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 0.375rem;
    width: 100%;
    transition: background-color 0.15s ease;
}
.avail-cell-box:hover {
    background-color: rgba(242, 107, 33, 0.05);
}

/* Availability badges and blocks */
.avail-block {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Automatic Site Block (Soft Blue/Indigo/Cyan) */
.avail-block-chantier {
    background: #eff6ff;
    color: #1d4ed8;
    border-left: 3px solid #3b82f6;
}

/* Manual Absences */
.avail-block-vacation {
    background: #fef2f2;
    color: #b91c1c;
    border-left: 3px solid #ef4444;
}
.avail-block-sick {
    background: #fffbeb;
    color: #b45309;
    border-left: 3px solid #f59e0b;
}
.avail-block-indispo {
    background: #f3f4f6;
    color: #374151;
    border-left: 3px solid #6b7280;
}
.avail-block-autre {
    background: #f5f3ff;
    color: #6d28d9;
    border-left: 3px solid #8b5cf6;
}

.modal-select-search {
    width: 100%;
    margin-bottom: 0.4rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    box-sizing: border-box;
    background-color: #ffffff;
    color: var(--text);
    transition: all 0.15s ease;
}
.modal-select-search:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(242, 107, 33, 0.1);
}

/* --- Top Right User Dropdown Menu --- */
.top-user-menu-container {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
}

.top-user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #047857; /* Emerald/Green as in the user's example */
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.top-user-avatar-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--border), 0 2px 4px rgba(0, 0, 0, 0.15);
}

.top-user-avatar-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1001;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-dropdown-menu.active {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-user-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background-color: #fafafa;
    border-bottom: 1px solid var(--border);
}

.dropdown-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #047857; /* Emerald/Green as in the user's example */
    color: white;
    font-weight: 600;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dropdown-user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-menu-list {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.dropdown-menu-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropdown-menu-list li i {
    width: 16px;
    color: var(--text-muted);
    font-size: 1rem;
}

.dropdown-menu-list li:hover {
    background-color: #f3f4f6;
    color: var(--primary);
}

.dropdown-menu-list li:hover i {
    color: var(--primary);
}

.dropdown-menu-list li.logout-item {
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
}

/* --- Footer Copyright --- */
.main-footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.825rem;
}

/* --- Hors Service Tooltip --- */
.hs-badge-container {
    position: relative;
    display: block;
    width: 100%;
}

.hs-badge-container::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    height: 25px;
    display: none;
    z-index: 999;
}

.hs-badge-container:hover::after {
    display: block;
}

.hs-tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 340px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.75rem;
    font-size: 0.8rem;
    color: var(--text);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.hs-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--surface) transparent transparent transparent;
}

.hs-tooltip::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -7px;
    border-width: 7px;
    border-style: solid;
    border-color: var(--border) transparent transparent transparent;
    z-index: -1;
}

.hs-badge-container:hover .hs-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.hs-tooltip-item {
    padding: 0.4rem 0.5rem;
    border-radius: 0.35rem;
    transition: background-color 0.15s;
}

.hs-tooltip-item:hover {
    background-color: var(--sidebar-active);
}

/* Contact widgets as buttons and filter active state */
.contact-widget-card {
    cursor: pointer;
    transition: all 0.2s ease-in-out !important;
}
.contact-widget-card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md) !important;
}
.contact-widget-card.active {
    transform: translateY(-2px) scale(1.02);
}

/* Tooltip Downward positioning */
.hs-tooltip.tooltip-down {
    bottom: auto;
    top: 100%;
    transform: translateX(-50%) translateY(0);
}
.hs-badge-container:hover .hs-tooltip.tooltip-down {
    transform: translateX(-50%) translateY(0);
}
.hs-tooltip.tooltip-down::after {
    top: auto;
    bottom: 100%;
    margin-bottom: 0;
    border-width: 6px;
    border-color: transparent transparent var(--surface) transparent;
}
.hs-tooltip.tooltip-down::before {
    top: auto;
    bottom: 100%;
    margin-bottom: 0;
    border-width: 7px;
    border-color: transparent transparent var(--border) transparent;
}

/* Weather Forecast scrollbar styles */
#weather-forecast-list::-webkit-scrollbar {
    height: 4px;
}
#weather-forecast-list::-webkit-scrollbar-track {
    background: transparent;
}
#weather-forecast-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}
#weather-forecast-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Bulk Action Button States */
.bulk-btn-active-attente { background: #fef3c7 !important; border-color: #fde68a !important; color: #b45309 !important; }
.bulk-btn-active-attente i { color: #b45309 !important; }

.bulk-btn-active-encours { background: #ffedd5 !important; border-color: #fed7aa !important; color: #c2410c !important; }
.bulk-btn-active-encours i { color: #c2410c !important; }

.bulk-btn-active-livre { background: #dcfce7 !important; border-color: #bbf7d0 !important; color: #15803d !important; }
.bulk-btn-active-livre i { color: #15803d !important; }

.bulk-btn-active-sms-chauffeur { background: #eff6ff !important; border-color: #bfdbfe !important; color: #1d4ed8 !important; }
.bulk-btn-active-sms-chauffeur i { color: #1d4ed8 !important; }

.bulk-btn-active-sms-conf { background: #f3e8ff !important; border-color: #e9d5ff !important; color: #7e22ce !important; }
.bulk-btn-active-sms-conf i { color: #7e22ce !important; }

.bulk-btn-active-sms-encours { background: #fef9c3 !important; border-color: #fde047 !important; color: #a16207 !important; }
.bulk-btn-active-sms-encours i { color: #a16207 !important; }

.bulk-btn-active-sms-livre { background: #ecfdf5 !important; border-color: #a7f3d0 !important; color: #047857 !important; }
.bulk-btn-active-sms-livre i { color: #047857 !important; }

.bulk-btn-active-archive { background: #ede9fe !important; border-color: #ddd6fe !important; color: #6d28d9 !important; }
.bulk-btn-active-archive i { color: #6d28d9 !important; }

.bulk-btn-active-duplicate { background: #e0f2fe !important; border-color: #bae6fd !important; color: #0369a1 !important; }
.bulk-btn-active-duplicate i { color: #0369a1 !important; }

.bulk-btn-active-delete { background: #fee2e2 !important; border-color: #fca5a5 !important; color: #b91c1c !important; }
.bulk-btn-active-delete i { color: #b91c1c !important; }

/* Custom Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
input:checked + .slider {
    background-color: var(--primary);
}
input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}
input:checked + .slider:before {
    transform: translateX(20px);
}


