/* ========== STYLES PRINCIPAUX ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #c00000;
    --primary-dark: #9b0000;
    --secondary: #1e3a8a;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}
body { font-family: 'Segoe UI', 'Calibri', 'Roboto', sans-serif; background: var(--gray-100); color: var(--gray-800); }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; }
.login-container { background: white; border-radius: 24px; display: flex; max-width: 1200px; width: 90%; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.login-left { background: var(--primary); color: white; padding: 3rem; flex: 1; }
.login-left h1 { font-size: 2rem; margin-bottom: 2rem; }
.login-left h1 span { display: block; font-size: 1rem; font-weight: normal; opacity: 0.9; margin-top: 0.5rem; }
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 2rem; }
.feature-item { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.feature-icon { width: 32px; height: 32px; background: rgba(255, 255, 255, 0.2); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.login-right { padding: 3rem; flex: 1; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h2 { font-size: 1.75rem; color: var(--gray-800); }
.logo-upload-container { display: flex; justify-content: center; margin-bottom: 1.5rem; position: relative; gap: 10px; align-items: center; }
.logo-preview { width: 80px; height: 80px; background: var(--gray-100); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--gray-400); overflow: hidden; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-btn { position: relative; overflow: hidden; cursor: pointer; padding: 0.5rem 1rem; background: var(--gray-100); border-radius: 8px; }
.upload-btn input { position: absolute; top: 0; left: 0; opacity: 0; cursor: pointer; }

/* Main Layout */
.main-layout { display: none; }
.sidebar { width: 280px; background: white; border-right: 1px solid var(--gray-200); position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto; z-index: 100; transition: transform 0.3s ease; }
.sidebar-header { padding: 1.5rem; text-align: center; border-bottom: 1px solid var(--gray-200); }
.company-logo-sidebar { width: 60px; height: 60px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; color: white; font-size: 1.5rem; overflow: hidden; }
.company-logo-sidebar img { width: 100%; height: 100%; object-fit: cover; }
.company-name-sidebar { font-weight: bold; font-size: 1rem; }
.company-ifu-sidebar { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.25rem; }
.menu-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.5rem; color: var(--gray-600); cursor: pointer; transition: all 0.2s; }
.menu-item:hover { background: var(--gray-100); color: var(--primary); }
.menu-item.active { background: var(--primary); color: white; }
.menu-item.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.menu-divider { height: 1px; background: var(--gray-200); margin: 0.5rem 0; }
.main-content { margin-left: 280px; min-height: 100vh; }
.top-bar { background: white; padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 99; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--gray-600); }
.page-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 600; }
.user-info { display: flex; align-items: center; gap: 1rem; }
.user-details { text-align: right; }
.user-name { font-weight: 600; }
.user-role { font-size: 0.75rem; color: var(--gray-500); }
.user-avatar { width: 40px; height: 40px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.role-badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 20px; font-size: 0.7rem; font-weight: 500; margin-left: 0.5rem; }
.role-badge.admin { background: var(--primary); color: white; }
.role-badge.manager { background: #1e3a8a; color: white; }
.role-badge.user { background: var(--gray-200); color: var(--gray-700); }

/* Sections */
.section { display: none; padding: 2rem; }
.section.active { display: block; }

/* Cards */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.card { background: white; border-radius: 16px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-title { font-weight: 600; color: var(--gray-500); }
.card-icon { font-size: 1.5rem; color: var(--primary); }
.card-value { font-size: 2rem; font-weight: bold; margin-bottom: 0.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 1rem; }
.stat-item { text-align: center; }
.stat-label { font-size: 0.7rem; color: var(--gray-500); }
.stat-value { font-size: 1rem; font-weight: 600; }
.progress-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; margin: 1rem 0; }
.progress-fill { height: 100%; background: var(--success); transition: width 0.3s; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; }
.form-control { width: 100%; padding: 0.625rem 0.75rem; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 0.875rem; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); ring: 2px solid var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.2s; border: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { background: var(--gray-100); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-success { background: var(--success); color: white; }
.btn-secondary { background: white; color: #991b1b; border: 2px solid #fecaca; }
.btn-secondary:hover { background: #fef2f2; border-color: #f87171; transform: translateY(-1px); }

/* Tables */
.table-container { overflow-x: auto; background: white; border-radius: 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-200); }
th { background: var(--gray-50); font-weight: 600; color: var(--gray-600); }
tr:hover { background: var(--gray-50); }

/* Invoice Items Table */
.invoice-items-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.invoice-items-table th, .invoice-items-table td { border: 1px solid var(--gray-300); padding: 0.5rem; text-align: left; }
.invoice-items-table th { background: var(--gray-100); }
.remove-item-btn { color: var(--danger); cursor: pointer; background: none; border: none; font-size: 1rem; }
.add-item-btn { margin-top: 0.5rem; }

/* Filter Bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; align-items: flex-end; }
.date-range { display: flex; gap: 1rem; }
.date-input-group { display: flex; flex-direction: column; gap: 0.25rem; }
.date-input-group label { font-size: 0.75rem; color: var(--gray-500); }

/* Badges */
.badge { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 20px; font-size: 0.7rem; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fed7aa; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-pending { background: #fef3c7; color: #b45309; }

/* Vehicle Status */
.vehicle-status { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 20px; font-size: 0.7rem; }
.vehicle-status.available { background: #d1fae5; color: #065f46; }
.vehicle-status.rented { background: #fed7aa; color: #92400e; }
.vehicle-status.maintenance { background: #fee2e2; color: #991b1b; }

/* Warning Badges */
.warning-badges { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.warning-badges .badge { font-size: 10px; padding: 3px 6px; cursor: help; }
.expiry-warning { animation: pulse 1s ease-in-out; background-color: #fff3cd !important; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

/* ==================== MODALS PROFESSIONNELS CENTRÉS VERTICALEMENT ==================== */

/* Overlay modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Conteneur principal du modal - CENTRÉ VERTICALEMENT */
.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    max-width: 95%;
    width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(192, 0, 0, 0.15);
    /* Centrage vertical et horizontal */
    margin: auto;
    top: 50%;
    transform: translateY(-50%);
}

/* Alternative avec flexbox pour un centrage parfait */
.modal.show {
    display: flex;
}

.modal.show .modal-content {
    margin: 0 auto;
}

/* Tailles de modals */
.modal-sm .modal-content { max-width: 450px; width: 95%; }
.modal-lg .modal-content { max-width: 900px; width: 95%; }
.modal-xl .modal-content { max-width: 1200px; width: 95%; }

/* Animation d'entrée - centrée */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-48%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Version simplifiée avec flexbox (recommandée) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    max-width: 95%;
    width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(192, 0, 0, 0.15);
}

/* Animation centrée */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header du modal - Style professionnel */
.modal-header {
    padding: 1.25rem 1.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
    border-bottom: 2px solid #c00000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    border-radius: 20px 20px 0 0;
}

.modal-title {
    font-weight: 700;
    font-size: 1.25rem;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.modal-title i {
    color: #c00000;
    font-size: 1.35rem;
}

/* Bouton de fermeture */
.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f1f5f9;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-btn:hover {
    background: #fee2e2;
    color: #c00000;
    transform: rotate(90deg);
}

/* Body du modal */
.modal-body {
    padding: 1.75rem;
    background: #ffffff;
}

/* Footer du modal */
.modal-footer {
    padding: 1rem 1.75rem 1.75rem 1.75rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #fafbfc;
    border-radius: 0 0 20px 20px;
}

/* ==================== FORMULAIRES DANS MODAL ==================== */
.modal .form-group {
    margin-bottom: 1.25rem;
}

.modal .form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal .form-label .required {
    color: #dc2626;
    margin-left: 0.25rem;
}

.modal .form-control,
.modal select,
.modal textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #ffffff;
    font-family: inherit;
    color: #1e293b;
}

.modal .form-control:focus,
.modal select:focus,
.modal textarea:focus {
    outline: none;
    border-color: #c00000;
    box-shadow: 0 0 0 3px rgba(192, 0, 0, 0.1);
}

.modal .form-control:hover,
.modal select:hover,
.modal textarea:hover {
    border-color: #cbd5e1;
}

/* Form row */
.modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0;
}

/* ==================== RADIO GROUP PROFESSIONNEL ==================== */
.modal .radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem 0;
}

.modal .radio-option {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal .radio-option:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateX(4px);
}

.modal .radio-option.selected {
    background: #fef2f2;
    border-color: #c00000;
    box-shadow: 0 2px 8px rgba(192, 0, 0, 0.1);
}

.modal .radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #c00000;
    flex-shrink: 0;
}

.modal .radio-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
}

.modal .radio-title {
    font-weight: 600;
    color: #334155;
}

.modal .radio-description {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
}

/* Radio group horizontal */
.modal .radio-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.5rem 0 1rem 0;
}

.modal .radio-group-horizontal .radio-option {
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.modal .radio-group-horizontal .radio-option .radio-label {
    text-align: center;
}

/* ==================== CHECKBOX GROUP ==================== */
.modal .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 0.5rem 0 1rem 0;
}

.modal .checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
}

.modal .checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #c00000;
    margin: 0;
}

.modal .checkbox-label {
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
    font-weight: 500;
}

/* ==================== SECTIONS DANS MODAL ==================== */
.modal-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #c00000;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-section-title i {
    font-size: 1rem;
    color: #c00000;
}

/* ==================== TABLEAUX DANS MODAL ==================== */
.modal .table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin: 1rem 0;
}

.modal table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.modal th,
.modal td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.modal th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal tr:hover {
    background: #fef2f2;
}

/* ==================== BOUTONS DANS MODAL ==================== */
.modal .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.modal .btn-primary {
    background: #c00000;
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.modal .btn-primary:hover {
    background: #9b0000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 0, 0, 0.25);
}

.modal .btn-outline {
    background: transparent;
    border: 1.5px solid #e2e8f0;
    color: #475569;
}

.modal .btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.modal .btn-danger {
    background: #dc2626;
    color: white;
}

.modal .btn-danger:hover {
    background: #b91c1c;
}

.modal .btn-success {
    background: #059669;
    color: white;
}

.modal .btn-success:hover {
    background: #047857;
}

.modal .btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.75rem;
}

/* ==================== TOTALS PREVIEW ==================== */
.modal .totals-preview {
    background: #f8fafc;
    border-radius: 16px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
}

.modal .totals-preview h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #c00000;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal .totals-preview .form-row {
    gap: 0.75rem;
}

.modal .totals-preview .form-group {
    margin-bottom: 0;
}

.modal .totals-preview input {
    background: white;
    font-weight: 600;
    text-align: right;
}

/* ==================== SCROLLBAR PERSONNALISÉE ==================== */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #c00000;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    .modal-title i {
        font-size: 1.1rem;
    }
    
    .modal .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .modal .radio-group-horizontal {
        flex-direction: column;
    }
    
    .modal .radio-group-horizontal .radio-option {
        min-width: auto;
    }
    
    .modal .checkbox-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==================== ÉTAT DE CHARGEMENT ==================== */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 20;
}

.modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #fee2e2;
    border-top-color: #c00000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== ALERTES DANS MODAL ==================== */
.modal .alert {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.85rem;
}

.modal .alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.modal .alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.modal .alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.modal .alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* ==================== BADGES DANS MODAL ==================== */
.modal .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.modal .badge-primary {
    background: #fef2f2;
    color: #c00000;
}

.modal .badge-success {
    background: #d1fae5;
    color: #065f46;
}

.modal .badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ==================== INPUT GROUP AVEC ICÔNE ==================== */
.modal .input-group {
    position: relative;
}

.modal .input-group .form-control {
    padding-left: 2.5rem;
}

.modal .input-group .input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #c00000;
    font-size: 1rem;
    pointer-events: none;
}

/* ==================== SELECT CUSTOM ==================== */
.modal 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='%23991b1b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* ==================== TEXTAREA ==================== */
.modal textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ==================== OUTLINE FOCUS ACCESSIBILITÉ ==================== */
.modal .radio-option:focus-within,
.modal .checkbox-option:focus-within {
    outline: 2px solid #c00000;
    outline-offset: 2px;
    border-radius: 12px;
}/* Toast */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 1100; }
.toast { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; animation: slideIn 0.3s ease; }
.toast.success { background: #d1fae5; color: #065f46; }
.toast.error { background: #fee2e2; color: #991b1b; }
.toast.info { background: #dbeafe; color: #1e40af; }
.toast.warning { background: #fed7aa; color: #92400e; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Tabs */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--gray-200); }
.tab { padding: 0.5rem 1rem; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 500; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Checkbox Group */
.checkbox-group { display: flex; align-items: center; gap: 0.5rem; margin: 1rem 0; }

/* Access Rights */
.access-rights { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.5rem; margin-top: 1rem; }
.access-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: var(--gray-50); border-radius: 8px; }

/* Bill Counting */
.bill-counting { margin: 1rem 0; padding: 1rem; background: var(--gray-50); border-radius: 8px; }
.bill-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }

/* Journal Entries */
.journal-entries { max-height: 400px; overflow-y: auto; }
.journal-entry { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border-bottom: 1px solid var(--gray-200); }
.journal-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.journal-icon.revenue { background: #d1fae5; color: #059669; }
.journal-icon.expense { background: #fee2e2; color: #dc2626; }
.journal-details { flex: 1; }
.journal-title { font-weight: 500; }
.journal-meta { font-size: 0.75rem; color: var(--gray-500); }
.journal-amount { font-weight: 600; }
.journal-amount.revenue { color: #059669; }
.journal-amount.expense { color: #dc2626; }

/* Validation Badge */
.validation-badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 20px; font-size: 0.7rem; }
.validation-badge.pending { background: #fef3c7; color: #b45309; }
.validation-badge.approved { background: #d1fae5; color: #065f46; }
.validation-badge.rejected { background: #fee2e2; color: #991b1b; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .login-container { flex-direction: column; }
    .filter-bar { flex-direction: column; }
    .date-range { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
}

/* Expiry Stats */
.expiry-stats { margin-top: 15px; padding: 10px; background-color: #f8f9fa; border-radius: 5px; }
.stat-card { text-align: center; padding: 10px; background-color: white; border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.stat-card small { display: block; color: #666; font-size: 11px; }
.stat-card strong { display: block; font-size: 18px; color: #333; margin-top: 5px; }

/* Quick Filters */
.quick-filters { display: inline-flex; gap: 10px; margin-left: auto; }
.quick-filters select, .quick-filters input { width: auto; }

/* Categories */
.category-item { display: flex; justify-content: space-between; padding: 0.5rem; border-bottom: 1px solid var(--gray-200); }

/* Validation Modal */
.validation-message { margin: 1rem 0; padding: 1rem; background: var(--gray-100); border-radius: 8px; }
.validation-message h4 { margin-bottom: 0.5rem; }

/* ===================== MODE IMPRESSION A4 OPTIMISÉ ===================== */
@page {
    size: A4;
    margin: 8mm;
}

@media print {
    body {
        background: white !important;
        margin: 0;
        padding: 0;
        font-size: 11px;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar,
    .top-bar,
    .btn,
    .modal,
    .toast-container,
    .filter-bar,
    .tabs,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-print {
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
    }
    
    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }
}

/* ===================== ZONE FACTURE ===================== */
.invoice-print {
    width: 210mm;
    margin: auto;
    background: white;
    padding: 6mm;
    box-sizing: border-box;
}

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

.invoice-print th,
.invoice-print td {
    border: 1px solid #ddd;
    padding: 5px;
    font-size: 11px;
}

/* ===================== BLOCS NON COUPABLES ===================== */
.no-break {
    page-break-inside: avoid;
}

/* ===================== FOOTER ===================== */
.invoice-footer {
    margin-top: 10px;
    font-size: 10px;
    text-align: center;
    border-top: 1px solid #ddd;
    padding-top: 6px;
}

/* ===================== MODE PLEIN ÉCRAN ===================== */
.fullscreen {
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* ===================== OPTIMISATION VISUELLE ===================== */
.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.invoice-title {
    font-size: 16px;
    font-weight: bold;
    color: #c00000;
}

.invoice-section {
    margin-bottom: 6px;
}

.invoice-box {
    border: 1px solid #ddd;
    padding: 6px;
    border-radius: 5px;
}

/* Responsive facture */
@media screen and (max-width: 768px) {
    .invoice-print {
        width: 100%;
        padding: 10px;
    }

    .invoice-header {
        flex-direction: column;
        gap: 10px;
    }

    .invoice-print th,
    .invoice-print td {
        font-size: 9px;
    }
}

/* Missing payment */
.missing-payment {
    background-color: #fff3cd !important;
    color: #856404;
}

/* Styles pour la gestion des accès modules */
.access-rights-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.access-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.access-table thead {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.access-table th {
    padding: 12px 10px;
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
}

.access-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.access-table tr:hover {
    background-color: #f9f9f9;
}

.module-col {
    text-align: left;
    width: 40%;
}

.action-col {
    text-align: center;
    width: 20%;
}

.module-name {
    text-align: left;
    font-weight: 500;
}

.module-name i {
    width: 20px;
    margin-right: 10px;
    color: #4a6cf7;
}

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

.action-cell input[type="radio"] {
    transform: scale(1.1);
    cursor: pointer;
    accent-color: #4a6cf7;
}

/* Responsive access table */
@media (max-width: 768px) {
    .access-table th,
    .access-table td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .module-name i {
        margin-right: 5px;
    }
}

/* ==================== GESTION DES DROITS D'ACCÈS ==================== */
.access-rights-container {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.access-rights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.access-rights-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
}

.access-rights-title i {
    color: #c00000;
    margin-right: 8px;
}

.access-rights-actions {
    display: flex;
    gap: 10px;
}

.btn-check-all, .btn-check-none {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-check-all {
    background: #10b981;
    color: white;
}

.btn-check-all:hover {
    background: #059669;
}

.btn-check-none {
    background: #ef4444;
    color: white;
}

.btn-check-none:hover {
    background: #dc2626;
}

.access-rights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px;
    background: #e2e8f0;
    max-height: 500px;
    overflow-y: auto;
}

.access-card {
    background: white;
    padding: 12px 15px;
    transition: all 0.2s;
}

.access-card:hover {
    background: #faf5ff;
}

.access-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.access-card-header i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 8px;
    color: #c00000;
    font-size: 0.9rem;
}

.access-module-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
}

.access-card-body {
    display: flex;
    gap: 15px;
    padding-left: 38px;
}

.access-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 20px;
    transition: all 0.2s;
}

.access-option-read {
    background: #eff6ff;
    color: #2563eb;
}

.access-option-read:hover {
    background: #dbeafe;
}

.access-option-write {
    background: #fef2f2;
    color: #dc2626;
}

.access-option-write:hover {
    background: #fee2e2;
}

.access-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
    accent-color: #c00000;
}

.access-option-text {
    display: flex;
    align-items: center;
    gap: 4px;
}

.access-option-text i {
    font-size: 0.7rem;
}

/* Responsive access rights */
@media (max-width: 768px) {
    .access-rights-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .access-rights-actions {
        justify-content: center;
    }
    
    .access-rights-grid {
        grid-template-columns: 1fr;
    }
    
    .access-card-body {
        padding-left: 0;
    }
}

/* ==================== MODAL AMÉLIORÉ AVEC RADIO BUTTONS ALIGNÉS ==================== */
/* Radio Group Styles */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem 0;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateX(4px);
}

.radio-option.selected {
    background: #fef2f2;
    border-color: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.1);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #dc2626;
    flex-shrink: 0;
}

.radio-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.radio-title {
    font-weight: 600;
    color: #334155;
}

.radio-description {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
}

/* Radio Group Horizontal */
.radio-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.5rem 0 1rem 0;
}

.radio-group-horizontal .radio-option {
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.radio-group-horizontal .radio-option .radio-label {
    text-align: center;
}

/* Checkbox Group Styles */
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    cursor: pointer;
}

.checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #dc2626;
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
    font-weight: 500;
}

/* Checkbox Group Horizontal */
.checkbox-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 0.5rem 0 1rem 0;
}

.checkbox-group-horizontal .checkbox-option {
    padding: 0;
}

/* Form Row avec radios */
.modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal .form-row .form-group {
    margin-bottom: 0;
}

/* Section dans modal */
.modal-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #fee2e2;
}

.modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #991b1b;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-section-title i {
    font-size: 1rem;
}

/* Select personnalisé */
.modal 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='%23991b1b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Textarea */
.modal textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* Modal sizes */
.modal-sm .modal-content {
    max-width: 400px;
}

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

.modal-xl .modal-content {
    max-width: 1100px;
}

/* Modal fullscreen sur mobile */
@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .radio-group-horizontal {
        flex-direction: column;
    }
    
    .radio-group-horizontal .radio-option {
        min-width: auto;
    }
    
    .checkbox-group-horizontal {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* Animation d'entrée pour le modal */
.modal.show {
    display: flex;
}

.modal.show .modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

/* Loading state dans modal */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    z-index: 10;
}

.modal-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #fee2e2;
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Input group avec icône */
.input-group {
    position: relative;
}

.input-group .form-control {
    padding-left: 2.5rem;
}

.input-group .input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #991b1b;
    font-size: 1rem;
    pointer-events: none;
}

/* Radio group inline pour les petites options */
.radio-group-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    margin: 0.5rem 0 1rem 0;
}

.radio-group-inline .radio-option {
    padding: 0.5rem 0;
    background: transparent;
    border: none;
}

.radio-group-inline .radio-option:hover {
    background: transparent;
    transform: none;
}

.radio-group-inline .radio-option.selected {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Tooltip pour les radios */
.radio-option[data-tooltip] {
    position: relative;
}

.radio-option[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 1000;
}

/* Focus visible pour accessibilité */
.radio-option:focus-within {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

.checkbox-option:focus-within {
    outline: 2px solid #dc2626;
    outline-offset: 2px;
}

/* Styles pour les boutons d'action */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 5px 8px;
    margin: 0;
    font-size: 12px;
}

.action-buttons .btn i {
    margin-right: 0;
}

/* Badges pour les rôles */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: #cce5ff;
    color: #004085;
}

/* Tableau responsive */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #4a5568;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* Styles pour les cartes du dashboard */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
}

.card-icon {
    width: 36px;
    height: 36px;
    background: rgba(192, 0, 0, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: 10px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.progress-bar {
    background: var(--gray-200);
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    border-radius: 20px;
    transition: width 0.3s ease;
}

/* Bouton "Voir tout" */
.view-all-btn {
    width: 100%;
    margin-top: 0.75rem;
    font-size: 0.75rem;
}

/* Journal entries */
.journal-entries {
    max-height: 300px;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card-value {
        font-size: 1.4rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==================== DASHBOARD AMÉLIORÉ ==================== */

/* Sections */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.section-title i {
    font-size: 1.25rem;
    color: var(--primary, #c00000);
}

.section-title h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.title-badge {
    background: #e2e8f0;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #475569;
}

/* KPIs Cards */
.kpi-card {
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.kpi-card[data-color="primary"]::before { background: #c00000; }
.kpi-card[data-color="success"]::before { background: #059669; }
.kpi-card[data-color="info"]::before { background: #3b82f6; }
.kpi-card[data-color="warning"]::before { background: #d97706; }

.trend-indicator {
    text-align: right;
    margin-bottom: 0.75rem;
    font-size: 0.7rem;
}

.trend-up { color: #059669; }
.trend-down { color: #dc2626; }

.card-footer {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.65rem;
    color: #94a3b8;
}

/* Vehicle status bars */
.vehicle-status-bars {
    display: flex;
    height: 4px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.status-bar.available { background: #059669; }
.status-bar.rented { background: #dc2626; }
.status-bar.maintenance { background: #d97706; }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-dot.available { background: #059669; }
.status-dot.rented { background: #dc2626; }
.status-dot.maintenance { background: #d97706; }

/* Cash flow */
.cash-flow {
    display: flex;
    justify-content: space-between;
    margin: 0.75rem 0;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
}

.cash-in { color: #059669; }
.cash-out { color: #dc2626; }

.cash-in i, .cash-out i {
    font-size: 0.7rem;
    margin-right: 4px;
}

/* Large values */
.card-value-large {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.5rem 0;
}

/* Stats grids */
.stats-grid-2cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 0.75rem 0;
}

/* Status pills */
.status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.pill {
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.pill.pending { background: #fef3c7; color: #d97706; }
.pill.confirmed { background: #d1fae5; color: #059669; }
.pill.completed { background: #dbeafe; color: #3b82f6; }

.pill span { font-weight: 700; margin-right: 4px; }

/* Reservation revenue */
.reservation-revenue {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 0.5rem;
}

.reservation-revenue strong {
    font-size: 1.1rem;
    color: #059669;
}

/* Invoice stats */
.invoice-stats {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.invoice-stat {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 8px;
}

.invoice-stat.paid { background: #d1fae5; }
.invoice-stat.unpaid { background: #fee2e2; }
.invoice-stat.partial { background: #fef3c7; }

.invoice-stat strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
}

.amount-due {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-top: 1px solid #e2e8f0;
}

.text-danger { color: #dc2626; }

/* Progress bar small */
.progress-bar.small {
    height: 4px;
    margin-top: 0.5rem;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-top: 0.5rem;
}

/* Alert message */
.alert-message {
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: #fef3c7;
    border-radius: 8px;
    font-size: 0.7rem;
    color: #d97706;
}

/* Charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    padding: 1rem;
}

.chart-container {
    position: relative;
    min-height: 220px;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: #c00000;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.7rem;
}

/* Full width card */
.full-width-card {
    grid-column: 1 / -1;
}

/* Activities grid */
.activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.activity-card {
    padding: 0;
}

.activity-list {
    max-height: 350px;
    overflow-y: auto;
}

/* Table wrapper */
.table-wrapper {
    overflow-x: auto;
    max-height: 300px;
}

/* Period selector */
.period-selector {
    display: flex;
    gap: 0.25rem;
}

.period-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn.active {
    background: #c00000;
    color: white;
    border-color: #c00000;
}

/* Time range buttons */
.time-range-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Chart summary */
.chart-summary {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    justify-content: space-around;
    font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .activities-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid-2cols {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .invoice-stats {
        flex-direction: column;
    }
    
    .status-pills {
        justify-content: center;
    }
    
    .section-title {
        flex-wrap: wrap;
    }
    
    .period-selector {
        order: 3;
        width: 100%;
        justify-content: center;
    }

/* Styles pour les onglets RH */
.rh-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}

.rh-tab-btn {
    padding: 10px 20px;
    border-radius: 8px 8px 0 0;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    color: #4b5563;
    font-weight: 500;
    transition: all 0.2s;
}

.rh-tab-btn:hover {
    background: #e5e7eb;
    color: #c00000;
}

.rh-tab-btn.active {
    background: #c00000;
    color: white;
    border-color: #c00000;
}

.rh-tab-content {
    display: none;
}

.rh-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }

}
/* Style pour la surbrillance de recherche */
.search-highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 500;
}

/* Animation pour le conteneur de filtre */
.filter-container {
    animation: slideDown 0.3s ease;
}

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

/* Style responsive pour mobile */
@media (max-width: 768px) {
    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-container > div {
        width: 100%;
    }
    
    .filter-container button {
        width: 100%;
    }
}
/* ==================== STYLES POUR LE FILTRE CLIENTS ==================== */

/* Conteneur du filtre */
.filter-container {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

/* Groupe de recherche */
.filter-container > div:first-child {
    flex: 1;
    min-width: 280px;
    position: relative;
}

/* Icône de recherche */
.filter-container .fa-search {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

/* Champ de recherche */
#clientSearchFilter {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.25s ease;
    background: white;
    outline: none;
}

#clientSearchFilter:focus {
    border-color: #c00000;
    box-shadow: 0 0 0 3px rgba(192, 0, 0, 0.1);
}

#clientSearchFilter::placeholder {
    color: #94a3b8;
    font-size: 13px;
}

/* Bouton Effacer */
.filter-container .btn-secondary {
    background: #64748b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-container .btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

.filter-container .btn-secondary:active {
    transform: translateY(0);
}

/* Compteur de résultats */
#filterResultCount {
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

/* Animation d'apparition */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-container {
    animation: slideDown 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

/* Surbrillance des mots recherchés */
.search-highlight {
    background: linear-gradient(120deg, #fef9c3 0%, #fde047 100%);
    color: #854d0e;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
    display: inline-block;
}

/* Message "Aucun résultat" stylisé */
#clientsList td[colspan="7"] {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    font-style: italic;
    background: #f8fafc;
}

/* Adaptation responsive */
@media (max-width: 768px) {
    .filter-container {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        gap: 10px;
    }
    
    .filter-container > div:first-child {
        width: 100%;
    }
    
    .filter-container .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    #filterResultCount {
        text-align: center;
        width: 100%;
    }
}

/* Animation lors du filtrage */
#clientsList tr {
    transition: all 0.2s ease;
}

#clientsList tr:hover {
    background-color: #fef3c7 !important;
}

/* Styles pour les en-têtes triables */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: rgba(192, 0, 0, 0.05);
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.4;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.sort-icon.active {
    opacity: 1;
    color: #c00000;
}

.sort-icon.fa-sort-up,
.sort-icon.fa-sort-down {
    opacity: 1;
    color: #c00000;
}

/* Badges pour les types de clients */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.badge-primary {
    background: linear-gradient(135deg, #c00000 0%, #8b0000 100%);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #17a2b8 0%, #0f6674 100%);
    color: white;
}

/* Champ optionnel */
.optional-field {
    opacity: 0.9;
}

.optional-field .form-label {
    color: #666;
}

/* Style pour la barre de recherche */
.search-filter {
    flex: 1;
    max-width: 300px;
}

.search-filter .form-control {
    border-radius: 20px;
    padding-left: 15px;
    border: 1px solid #ddd;
}

.search-filter .form-control:focus {
    border-color: #c00000;
    outline: none;
    box-shadow: 0 0 0 2px rgba(192, 0, 0, 0.1);
}

/* Animation pour le rafraîchissement */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#clientsList tr {
    animation: fadeIn 0.2s ease;
}

/* Style pour le tableau */
.data-table th {
    padding: 12px 8px;
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.data-table td {
    padding: 10px 8px;
    vertical-align: middle;
}

/* Dans votre fichier CSS */
#manualItemsSection {
    display: block !important;
}

.manual-items-table-container {
    display: block;
}
/* Styles pour l'autocomplete */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    width: 100%;
    left: 0;
    top: 100%;
    margin-top: 2px;
}

.autocomplete-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: all 0.2s ease;
}

.autocomplete-suggestion:hover {
    background-color: #f5f5f5;
}

.autocomplete-suggestion.selected {
    background-color: #e3f2fd;
}

.autocomplete-suggestion .suggestion-main {
    font-weight: 600;
    color: #333;
}

.autocomplete-suggestion .suggestion-detail {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.autocomplete-suggestion .suggestion-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
}

.autocomplete-suggestion .status-badge {
    display: inline-block;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 5px;
}

.status-badge.available {
    background: #d4edda;
    color: #155724;
}

.status-badge.rented {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.maintenance {
    background: #fff3cd;
    color: #856404;
}

/* Styles pour l'autocomplétion proforma */
#proformaClientAutocompleteContainer .autocomplete-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#proformaClientAutocompleteContainer .autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    z-index: 10000;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#proformaClientAutocompleteContainer .autocomplete-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

#proformaClientAutocompleteContainer .autocomplete-item:hover {
    background: #e3f2fd;
}

#proformaClientAutocompleteContainer .autocomplete-item strong {
    color: #c00000;
}

#proformaClientAutocompleteContainer .autocomplete-item small {
    color: #666;
    font-size: 11px;
}

/* Forcer les styles des modales */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1050 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.modal.show {
    display: block !important;
    background-color: rgba(0,0,0,0.5) !important;
}

.modal-content {
    position: relative !important;
    background-color: #fff !important;
    margin: 10% auto !important;
    max-width: 600px !important;
    border-radius: 8px !important;
    box-shadow: 0 3px 9px rgba(0,0,0,0.5) !important;
}

#clientModal {
    z-index: 9999 !important;
}

#proformaModal {
    z-index: 1050 !important;
}

.modal-backdrop {
    z-index: 1040 !important;
}

.signature-section {
    display: flex;
    justify-content: flex-end;
    margin: 20px 0 15px 0;
    padding-top: 10px;
}
.signature-card {
    text-align: center;
    width: 250px;
    border-top: 1px dashed #ddd;
    padding-top: 10px;
}
.signature-image img {
    max-width: 180px;
    max-height: 60px;
    object-fit: contain;
}
/* STYLE POUR L'EN-TÊTE AVEC LOGO À GAUCHE ET TITRES À DROITE */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #c00000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    flex-shrink: 0;
}

.header-logo img {
    max-width: 100px;
    max-height: 70px;
    object-fit: contain;
}

.header-company h2 {
    color: #c00000;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 2px;
}

.header-title {
    text-align: right;
}

.header-title h1 {
    color: #c00000;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 5px;
}

.header-title div {
    font-size: 12px;
    color: #666;
}
/* SUPPRIMER LES EN-TÊTES ET PIEDS DE PAGE DU NAVIGATEUR */
@page {
    size: A4;
    margin: 10mm 8mm;
    /* Masquer tous les en-têtes et pieds de page */
    @top-center {
        content: none;
    }
    @top-left {
        content: none;
    }
    @top-right {
        content: none;
    }
    @bottom-center {
        content: none;
    }
    @bottom-left {
        content: none;
    }
    @bottom-right {
        content: none;
    }
}

/* Version alternative plus agressive pour Chrome */
@media print {
    @page {
        margin: 0;
    }
    body {
        margin: 1cm;
    }
    /* Masquer l'URL et la date */
    a[href]:after {
        display: none;
        content: none !important;
    }
    header, footer {
        display: none;
    }
    /* Éviter about:blank */
    title {
        display: none;
    }
}

/* Ajoutez ce CSS à votre feuille de style */
.mecef-security-section .card {
    border: 2px solid #28a745;
    border-radius: 8px;
    margin: 15px 0;
}

.mecef-security-section .card-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 12px 15px;
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mecef-security-section .badge-success {
    background: rgba(255,255,255,0.2);
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
}

.security-item {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    border-left: 3px solid #28a745;
}

.security-item label {
    display: block;
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: bold;
}

.security-value {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    font-family: 'Courier New', monospace;
}

.security-loaded {
    animation: highlight 2s ease-in-out;
}

@keyframes highlight {
    0% { background-color: #d4edda; }
    100% { background-color: transparent; }
}

.qr-section {
    text-align: center;
    padding: 15px;
    border-top: 1px solid #dee2e6;
    margin-top: 15px;
}

.qr-section small {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #6c757d;
    margin-top: 10px;
    word-break: break-all;
}

/* Styles pour l'autocomplétion */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.autocomplete-suggestion {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.autocomplete-suggestion:hover {
    background: #f5f5f5;
}

.autocomplete-suggestion.active {
    background: #f0f0f0;
}

.autocomplete-suggestion .suggestion-main {
    font-weight: 500;
    color: #333;
}

.autocomplete-suggestion .suggestion-detail {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.autocomplete-suggestion .suggestion-badge {
    display: inline-block;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
    color: #666;
}