/* Styles communs de la plateforme (extraits de base.html, mis en cache par le navigateur) */
        /* Variables CSS - Charte Graphique UGB */
        :root {
            --marron-cuivre: #A05A2C;
            --beige-clair: #E8DCBF;
            --gris-argente: #B3B3B3;
            --blanc: #FFFFFF;
            --noir: #333333;
            --beige-fonce: #C9B385;
            --gris-fonce: #555555;
            --beige-tres-clair: #F5F2E9;
            --success: #28a745;
            --danger: #dc3545;
            --warning: #ffc107;
            --info: #17a2b8;
        }

        /* Reset et base */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Open Sans', sans-serif;
            line-height: 1.6;
            color: var(--noir);
            background-color: var(--blanc);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* Conteneur principal */
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }

        .container-fluid {
            width: 100%;
            padding: 0 20px;
        }

        /* Typographie */
        h1, h2, h3, h4, h5, h6 {
            font-family: Georgia, serif;
            color: var(--marron-cuivre);
            margin-bottom: 15px;
            font-weight: 700;
        }

        h1 { font-size: 32px; }
        h2 { font-size: 26px; }
        h3 { font-size: 22px; }
        h4 { font-size: 18px; }
        h5 { font-size: 16px; }
        h6 { font-size: 14px; }

        p {
            margin-bottom: 15px;
            line-height: 1.7;
        }

        /* Header */
        header {
            background: var(--blanc);
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            position: fixed;
            width: 100%;
            top: 0;
            z-index: 1000;
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
        }

        .logo {
            display: flex;
            align-items: center;
            text-decoration: none;
        }

        .logo-emblem {
            width: 60px;
            height: 60px;
            background: var(--marron-cuivre);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--blanc);
            font-weight: bold;
            font-size: 24px;
            transition: transform 0.3s ease;
        }

        .logo:hover .logo-emblem {
            transform: scale(1.05);
        }

        .logo-text h1 {
            font-family: Georgia, serif;
            font-size: 18px;
            color: var(--marron-cuivre);
            line-height: 1.2;
            margin-bottom: 2px;
        }

        .logo-text p {
            font-size: 12px;
            color: var(--gris-fonce);
            font-style: italic;
            font-family: Georgia, serif;
            margin-bottom: 0;
        }

        /* Navigation */
        .nav-menu {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .nav-links {
            display: flex;
            list-style: none;
            gap: 12px;
            margin: 0;
            align-items: center;
        }

        .nav-links a {
            font-family: Georgia, serif;
            color: var(--marron-cuivre);
            text-decoration: none;
            font-size: 14px;
            transition: all 0.3s ease;
            position: relative;
            white-space: nowrap;
        }

        /* Empêche .nav-links a d'écraser la couleur des boutons */
        .nav-links a.btn-primary,
        .nav-links a.btn-primary:hover {
            color: var(--blanc) !important;
        }

        .nav-links a.btn-secondary {
            color: var(--marron-cuivre) !important;
            border: 2px solid var(--marron-cuivre) !important;
            background: transparent !important;
        }

        .nav-links a.btn-secondary:hover {
            color: var(--blanc) !important;
            background: var(--marron-cuivre) !important;
        }

        .nav-links a.btn-outline-primary {
            color: var(--marron-cuivre) !important;
        }

        .nav-links a:hover {
            color: var(--beige-fonce);
        }

        .nav-links a::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 0;
            height: 2px;
            background: var(--marron-cuivre);
            transition: width 0.3s ease;
        }

        .nav-links a:hover::after {
            width: 100%;
        }

        /* Pas de soulignement sur les boutons dans la nav */
        .nav-links a.btn::after,
        .nav-links a.btn:hover::after {
            display: none;
        }

        .nav-links a.active {
            color: var(--marron-cuivre);
            font-weight: 600;
        }

        .nav-links a.active::after {
            width: 100%;
        }

        /* Boutons */
        .btn {
            display: inline-block;
            padding: 12px 24px;
            border-radius: 4px;
            text-decoration: none;
            font-weight: 600;
            transition: all 0.3s ease;
            border: none;
            cursor: pointer;
            font-size: 14px;
            text-align: center;
        }

        .btn-primary {
            background: var(--marron-cuivre);
            color: var(--blanc);
        }

        .btn-primary:hover {
            background: #8B4A24;
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }

        .btn-secondary {
            background: transparent;
            color: var(--marron-cuivre);
            border: 2px solid var(--marron-cuivre);
        }

        .btn-secondary:hover {
            background: var(--marron-cuivre);
            color: var(--blanc);
        }

        .btn-outline {
            background: transparent;
            color: var(--gris-fonce);
            border: 1px solid var(--gris-argente);
        }

        .btn-outline:hover {
            background: var(--beige-tres-clair);
            border-color: var(--marron-cuivre);
        }

        .btn-success {
            background: var(--success);
            color: var(--blanc);
        }

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

        .btn-warning {
            background: var(--warning);
            color: var(--noir);
        }

        .btn-info {
            background: var(--info);
            color: var(--blanc);
        }

        .btn-sm {
            padding: 8px 16px;
            font-size: 13px;
        }

        .btn-lg {
            padding: 16px 32px;
            font-size: 16px;
        }

        /* Formulaires */
        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            font-weight: 600;
            color: var(--gris-fonce);
            margin-bottom: 8px;
            font-size: 14px;
        }

        .form-control {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid var(--gris-argente);
            border-radius: 4px;
            font-size: 14px;
            transition: border-color 0.3s ease, box-shadow 0.3s ease;
            background: var(--blanc);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--marron-cuivre);
            box-shadow: 0 0 0 3px rgba(160, 90, 44, 0.1);
        }

        .form-control:invalid {
            border-color: var(--danger);
        }

        .form-select {
            appearance: none;
            background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
            background-position: right 12px center;
            background-repeat: no-repeat;
            background-size: 16px;
            padding-right: 40px;
        }

        .form-check {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 10px;
        }

        .form-check-input {
            width: auto;
        }

        /* Alertes */
        .alert {
            padding: 15px 20px;
            margin-bottom: 20px;
            border-radius: 4px;
            border: 1px solid transparent;
        }

        .alert-success {
            background: #d4edda;
            border-color: #c3e6cb;
            color: #155724;
        }

        .alert-danger {
            background: #f8d7da;
            border-color: #f5c6cb;
            color: #721c24;
        }

        .alert-warning {
            background: #fff3cd;
            border-color: #ffeaa7;
            color: #856404;
        }

        .alert-info {
            background: #d1ecf1;
            border-color: #bee5eb;
            color: #0c5460;
        }

        /* Cards */
        .card {
            background: var(--blanc);
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            overflow: hidden;
            margin-bottom: 20px;
        }

        .card-header {
            background: var(--beige-tres-clair);
            padding: 20px;
            border-bottom: 1px solid var(--gris-argente);
        }

        .card-body {
            padding: 20px;
        }

        .card-footer {
            background: var(--beige-tres-clair);
            padding: 15px 20px;
            border-top: 1px solid var(--gris-argente);
        }

        .card-title {
            margin-bottom: 10px;
            color: var(--marron-cuivre);
        }

        /* Main content - uniquement le main direct de body */
        body > main {
            flex: 1;
            padding-top: 85px;
        }

        /* Les main imbriqués (dans les pages) ne reçoivent pas de padding supplémentaire */
        main main {
            padding-top: 0;
        }

        .main-content {
            min-height: calc(100vh - 200px);
            padding: 16px 0 40px;
        }

        /* Sections */
        .section {
            padding: 60px 0;
        }

        .section-title {
            text-align: center;
            margin-bottom: 50px;
        }

        .section-title h2 {
            font-size: 36px;
            margin-bottom: 15px;
        }

        .section-title .subtitle {
            font-size: 18px;
            color: var(--gris-fonce);
            max-width: 600px;
            margin: 0 auto;
        }

        /* Grille */
        .row {
            display: flex;
            flex-wrap: wrap;
            margin: 0 -15px;
        }

        .col {
            flex: 1;
            padding: 0 15px;
        }

        .col-md-6 {
            flex: 0 0 50%;
            max-width: 50%;
            padding: 0 15px;
        }

        .col-md-4 {
            flex: 0 0 33.333333%;
            max-width: 33.333333%;
            padding: 0 15px;
        }

        .col-md-3 {
            flex: 0 0 25%;
            max-width: 25%;
            padding: 0 15px;
        }

        /* Utilities */
        .text-center { text-align: center; }
        .text-left { text-align: left; }
        .text-right { text-align: right; }

        .mb-0 { margin-bottom: 0; }
        .mb-1 { margin-bottom: 10px; }
        .mb-2 { margin-bottom: 20px; }
        .mb-3 { margin-bottom: 30px; }
        .mb-4 { margin-bottom: 40px; }
        .mb-5 { margin-bottom: 60px; }

        .mt-0 { margin-top: 0; }
        .mt-1 { margin-top: 10px; }
        .mt-2 { margin-top: 20px; }
        .mt-3 { margin-top: 30px; }
        .mt-4 { margin-top: 40px; }
        .mt-5 { margin-top: 60px; }

        .d-none { display: none; }
        .d-block { display: block; }
        .d-flex { display: flex; }
        .d-grid { display: grid; }

        /* Footer */
        footer {
            background: var(--noir);
            color: var(--gris-argente);
            padding: 50px 0 20px;
            margin-top: auto;
        }

        .footer-main {
            display: flex;
            flex-direction: column;
        }

        .footer-logo {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 20px;
        }

        .footer-logo img {
            width: 60px;
            height: 60px;
            object-fit: contain;
        }

        .footer-university h1 {
            font-family: Georgia, serif;
            font-size: 18px;
            color: var(--beige-clair);
            margin-bottom: 5px;
        }

        .footer-university p {
            font-size: 14px;
            color: var(--gris-argente);
            font-style: italic;
        }

        .footer-description {
            color: var(--gris-argente);
            line-height: 1.6;
            margin-bottom: 20px;
            font-size: 14px;
            max-width: 640px;
        }

        .footer-contact {
            color: var(--gris-argente);
            font-size: 14px;
        }

        .footer-contact p {
            margin-bottom: 8px;
        }

        .footer-contact strong {
            color: var(--beige-clair);
        }

        .footer-contact i {
            color: var(--marron-cuivre);
            margin-right: 8px;
            width: 16px;
        }

        .footer-bottom {
            text-align: center;
            padding-top: 20px;
            margin-top: 30px;
            border-top: 1px solid var(--gris-fonce);
            color: var(--gris-argente);
            font-size: 13px;
        }

        .footer-bottom p {
            margin-bottom: 5px;
        }

        .footer-copyright {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 20px;
            flex-wrap: wrap;
            margin-top: 10px;
        }

        .footer-copyright span {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .footer-copyright a {
            color: var(--gris-argente);
            text-decoration: none;
        }

        .footer-copyright a:hover {
            color: var(--beige-clair);
        }

        @media (max-width: 768px) {
            .footer-logo {
                justify-content: center;
                text-align: left;
            }
        }

        /* Menu mobile */
        .mobile-menu-toggle {
            display: none;
            background: none;
            border: none;
            color: var(--marron-cuivre);
            font-size: 24px;
            cursor: pointer;
        }

        /* Responsive */
        @media (max-width: 768px) {
            .header-content {
                flex-wrap: wrap;
                gap: 15px;
            }

            .logo-text h1 {
                font-size: 16px;
            }

            .logo-text p {
                font-size: 11px;
            }

            .nav-menu {
                order: 3;
                width: 100%;
                flex-direction: column;
                display: none;
            }

            .nav-menu.active {
                display: flex;
            }

            .mobile-menu-toggle {
                display: block;
            }

            .nav-links {
                flex-direction: column;
                width: 100%;
                gap: 15px;
                margin-top: 20px;
            }

            .nav-links a {
                padding: 10px 0;
                border-bottom: 1px solid var(--gris-argente);
            }

            main {
                padding-top: 120px;
            }

            .col-md-6, .col-md-4, .col-md-3 {
                flex: 0 0 100%;
                max-width: 100%;
                margin-bottom: 20px;
            }

            .section-title h2 {
                font-size: 28px;
            }

            h1 { font-size: 26px; }
            h2 { font-size: 22px; }
            h3 { font-size: 18px; }
        }

        @media (max-width: 480px) {
            .container {
                padding: 0 15px;
            }

            .btn {
                width: 100%;
                margin-bottom: 10px;
            }

            .form-control {
                font-size: 16px; /* Évite le zoom sur iOS */
            }
        }

        /* Tableaux : défilement horizontal contenu au lieu de casser la mise en page */
        .table-responsive {
            width: 100%;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        /* Dropdown menu */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 1000;
    margin-top: 5px;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--noir);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 13px;
}

.dropdown-menu a:hover {
    background: var(--beige-tres-clair);
    color: var(--marron-cuivre);
}

.role-switch-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 10px 16px; background: none; border: none; cursor: pointer;
    font: inherit; font-size: 13px; color: var(--noir); text-align: left;
}
.role-switch-item:hover:not([disabled]) { background: var(--beige-tres-clair); color: var(--marron-cuivre); }
.role-switch-item.actif { cursor: default; font-weight: 700; color: var(--marron-cuivre); }
.role-switch-item i { width: 18px; text-align: center; color: var(--marron-cuivre); }

.dropdown-menu i {
    width: 18px;
    text-align: center;
    color: var(--marron-cuivre);
    font-size: 13px;
}

/* Responsive dropdown */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        box-shadow: none;
        background: var(--beige-tres-clair);
        margin-top: 0;
        border-radius: 0;
    }
    
    .dropdown:hover .dropdown-menu {
        display: none;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
}
/* Styles pour les boutons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: #8a4a24;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(160, 90, 44, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--marron-cuivre);
    border: 2px solid var(--marron-cuivre);
}

.btn-outline:hover {
    background: var(--marron-cuivre);
    color: white;
}

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

.btn-success:hover {
    background: #218838;
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--warning);
    color: var(--noir);
}

.btn-warning:hover {
    background: #e0a800;
}

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

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* Variantes « contour » et utilitaires utilisés par les pages (auparavant sans style) */
.btn-outline-secondary, .btn-outline-primary, .btn-outline-danger,
.btn-outline-success, .btn-outline-warning, .btn-light {
    background: white;
    border: 2px solid var(--gris-argente);
    color: var(--gris-fonce);
}
.btn-outline-secondary:hover, .btn-light:hover { background: var(--beige-tres-clair); border-color: var(--gris-fonce); color: var(--noir); }
.btn-outline-primary { border-color: var(--marron-cuivre); color: var(--marron-cuivre); }
.btn-outline-primary:hover { background: var(--marron-cuivre); color: white; }
.btn-outline-danger { border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-outline-success { border-color: var(--success); color: var(--success); }
.btn-outline-success:hover { background: var(--success); color: white; }
.btn-outline-warning { border-color: #e0a800; color: #8a6416; }
.btn-outline-warning:hover { background: var(--warning); color: var(--noir); }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: 3px solid rgba(160, 90, 44, .35); outline-offset: 2px; }

/* Formulaires */
.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--marron-cuivre);
    box-shadow: 0 0 0 3px rgba(160, 90, 44, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--noir);
}

.form-row {
    display: grid;
    gap: 20px;
}

/* Badges de statut */
.badge-status {
    display: inline-block;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.status-approuve, .status-approuve_crisip {
    background: #d4edda;
    color: #155724;
}

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

.status-en_cours {
    background: #d1ecf1;
    color: #0c5460;
}

.status-termine {
    background: #d6d8db;
    color: #383d41;
}

.status-en_preparation {
    background: #e2e3e5;
    color: #383d41;
}

.status-pret {
    background: #bee5eb;
    color: #0c5460;
}

.status-annule {
    background: #f5c6cb;
    color: #721c24;
}

.status-brouillon {
    background: #e9ecef;
    color: #495057;
}

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

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

.status-rejete_modifiable {
    background: #ffe0b2;
    color: #e65100;
}

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

.status-complete {
    background: #d1ecf1;
    color: #0c5460;
}

/* Stat Cards - Design System Réutilisable */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

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

.stat-card-primary::before {
    background: var(--marron-cuivre);
}

.stat-card-success::before {
    background: var(--success);
}

.stat-card-warning::before {
    background: var(--warning);
}

.stat-card-danger::before {
    background: var(--danger);
}

.stat-card-info::before {
    background: var(--info);
}

.stat-card-gray::before {
    background: var(--gris-argente);
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1;
}

.stat-card-primary .stat-number {
    color: var(--marron-cuivre);
}

.stat-card-success .stat-number {
    color: var(--success);
}

.stat-card-warning .stat-number {
    color: var(--warning);
}

.stat-card-danger .stat-number {
    color: var(--danger);
}

.stat-card-info .stat-number {
    color: var(--info);
}

.stat-card-gray .stat-number {
    color: var(--gris-fonce);
}

.stat-label {
    font-size: 14px;
    color: var(--gris-fonce);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 48px;
    opacity: 0.15;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    gap: 20px;
}

.responsive-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.responsive-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.responsive-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Cartes */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    border-bottom: 2px solid var(--beige-clair);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-body {
    padding: 0;
}

.card-footer {
    border-top: 2px solid var(--beige-clair);
    padding-top: 15px;
    margin-top: 20px;
}

/* Alertes */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info);
    color: #0c5460;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--beige-clair);
    color: var(--marron-cuivre);
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

table tr:hover {
    background: var(--beige-tres-clair);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* Messages flash */
.flash-messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.flash-message {
    cursor: pointer;
    position: relative;
    padding: 15px 34px 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease-out;
}

.flash-close {
    position: absolute; top: 8px; right: 12px;
    font-size: 1.2rem; line-height: 1; opacity: .8;
}

@media (max-width: 600px) {
    .flash-messages { left: 16px; right: 16px; max-width: none; }
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-success {
    background: var(--success);
    color: white;
}

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

.flash-warning {
    background: var(--warning);
    color: var(--noir);
}

.flash-info {
    background: var(--info);
    color: white;
}

/* ══════════════════════════════════════
   MODALS - design global
══════════════════════════════════════ */
.modal {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(20, 10, 5, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    padding: 20px;
    animation: modalFadeIn .18s ease;
}
.modal.active { display: flex; }

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%; max-width: 500px;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    animation: modalSlideUp .22s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.modal-content.modal-lg { max-width: 800px; }

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

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--beige-clair);
}
.modal-title {
    font-size: 1.1rem; font-weight: 700; color: var(--marron-cuivre); margin: 0;
}
.modal-header .close {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: var(--beige-tres-clair);
    font-size: 1.1rem; color: var(--gris-fonce); border: none;
    transition: background .15s, color .15s;
    float: none;
}
.modal-header .close:hover { background: #f8d7da; color: #721c24; }

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 14px 24px 20px;
    display: flex; justify-content: flex-end; gap: 10px;
    border-top: 1px solid var(--beige-clair);
}

/* Centred confirmation modal variant */
.modal-content.modal-centered { text-align: center; }
.modal-centered .modal-icon { font-size: 2.8rem; margin: 20px 0 12px; }
.modal-centered .modal-title { justify-content: center; }
.modal-centered .modal-body  { padding-top: 0; }
.modal-centered .modal-text  { color: var(--gris-fonce); font-size: .92rem; line-height: 1.6; }
.modal-centered .modal-footer { justify-content: center; }
.modal-content { max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-header .modal-title { display: flex; align-items: center; gap: 8px; }
.modal-footer .btn { min-width: 110px; justify-content: center; }
body.modal-ouvert { overflow: hidden; }
@media (max-width: 576px) {
    .modal { padding: 12px; align-items: flex-end; }
    .modal-content { border-radius: 16px 16px 12px 12px; }
    .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn, .modal-footer form, .modal-footer form .btn { width: 100%; }
}

/* ══════════════════════════════════════
   PAGINATION DES LISTES (data-paginer)
══════════════════════════════════════ */
.pg-hors-page { display: none !important; }
.pg-barre {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 12px 4px 4px; font-size: .86rem; color: var(--gris-fonce);
}
.pg-pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg-btn {
    min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--beige-clair); background: white; color: var(--noir); font: inherit; font-weight: 600;
}
.pg-btn:hover:not([disabled]) { border-color: var(--marron-cuivre); color: var(--marron-cuivre); }
.pg-btn.actif { background: var(--marron-cuivre); border-color: var(--marron-cuivre); color: white; }
.pg-btn[disabled] { opacity: .4; cursor: default; }
.pg-trous { padding: 0 4px; }
.pg-taille select { padding: 4px 6px; border-radius: 6px; border: 1px solid var(--beige-clair); font: inherit; margin: 0 4px; }
@media (max-width: 576px) { .pg-barre { justify-content: center; } .pg-info, .pg-taille { width: 100%; text-align: center; } }

/* ══════════════════════════════════════
   ERREURS DE FORMULAIRE
══════════════════════════════════════ */
.champ-erreur, .form-control.champ-erreur {
    border-color: var(--danger) !important;
    background-color: #fff8f8;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .12);
}
.champ-erreur-msg {
    display: block; margin-top: 5px;
    color: #b02a37; font-size: .82rem; font-weight: 600;
}
.fichier-conserve {
    margin-top: 6px; padding: 7px 10px; border-radius: 6px;
    background: #edf7ee; border: 1px solid #b7dfba; color: #1e5b24; font-size: .85rem;
}
.fichier-conserve i { margin-right: 4px; }
.fichier-conserve span { color: #4a6b4d; }
.type-demande-fixe {
    display: flex; flex-direction: column; gap: 4px;
    padding: 12px 14px; border-radius: 8px;
    background: #f5f2e9; border: 1px solid #e3d9c3;
}
.type-demande-fixe strong { color: var(--marron-cuivre); }
.type-demande-fixe span { font-size: .88rem; color: var(--gris-fonce); }
.type-demande-aide { margin: 8px 0 0 18px; padding: 0; font-size: .86rem; color: var(--gris-fonce); }
.form-errors {
    border: 1px solid #f1aeb5; border-left: 5px solid var(--danger);
    background: #fff5f5; color: #58151c;
    border-radius: 10px; padding: 16px 20px; margin-bottom: 24px;
}
.form-errors h3 { color: #b02a37; font-size: 1.02rem; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.form-errors p { margin: 0 0 8px; font-size: .9rem; }
.form-errors ul { margin: 0; padding-left: 20px; }
.form-errors li { margin: 3px 0; font-size: .9rem; }
.form-errors a { color: #b02a37; font-weight: 600; text-decoration: underline; cursor: pointer; }
.form-errors a:hover { color: var(--marron-cuivre); }
    

/* ══════════════════════════════════════
   TÉLÉPHONE ET TABLETTE
   Beaucoup de pages sont mises en page par des styles en ligne (grilles, en-têtes en flex) :
   ces règles les adaptent aux petits écrans sans toucher à l'affichage sur ordinateur.
══════════════════════════════════════ */
@media (max-width: 900px) {
    .main-content canvas, .main-content img, .main-content video { max-width: 100% !important; }
    .main-content select, .main-content input, .main-content textarea { max-width: 100%; }
    /* En-têtes « titre à gauche, boutons à droite » : passage à la ligne */
    .main-content [style*="justify-content: space-between"],
    .main-content [style*="justify-content:space-between"] { flex-wrap: wrap; gap: 12px; }
    /* Grilles à colonnes fixes : 3 colonnes au plus pour les cartes de chiffres, une seule pour
       les mises en page « contenu + colonne latérale » ou en deux moitiés */
    .main-content [style*="grid-template-columns: repeat(4"], .main-content [style*="grid-template-columns:repeat(4"],
    .main-content [style*="grid-template-columns: repeat(5"], .main-content [style*="grid-template-columns:repeat(5"],
    .main-content [style*="grid-template-columns: repeat(6"], .main-content [style*="grid-template-columns:repeat(6"] {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    .main-content [style*="grid-template-columns: 1fr 1fr"], .main-content [style*="grid-template-columns:1fr 1fr"],
    .main-content [style*="grid-template-columns: repeat(2"], .main-content [style*="grid-template-columns:repeat(2"],
    .main-content [style*="grid-template-columns: 2fr"], .main-content [style*="grid-template-columns:2fr"],
    .main-content [style*="grid-template-columns: 1fr 3"], .main-content [style*="grid-template-columns:1fr 3"],
    .main-content [style*="grid-template-columns: 1fr 2"], .main-content [style*="grid-template-columns:1fr 2"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .main-content [style*="grid-template-columns"] > * { min-width: 0; overflow-wrap: anywhere; }
    .main-content h1, .main-content h2 { overflow-wrap: anywhere; }
}
@media (max-width: 576px) {
    .main-content [style*="grid-template-columns: repeat(3"], .main-content [style*="grid-template-columns:repeat(3"],
    .main-content [style*="grid-template-columns: repeat(4"], .main-content [style*="grid-template-columns:repeat(4"],
    .main-content [style*="grid-template-columns: repeat(5"], .main-content [style*="grid-template-columns:repeat(5"],
    .main-content [style*="grid-template-columns: repeat(6"], .main-content [style*="grid-template-columns:repeat(6"] {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    .main-content [style*="grid-template-columns: 1fr 380px"], .main-content [style*="grid-template-columns:1fr 380px"],
    .main-content [style*="grid-template-columns: 1fr 350px"], .main-content [style*="grid-template-columns: 1fr 360px"],
    .main-content [style*="grid-template-columns: 1fr 320px"], .main-content [style*="grid-template-columns: 1fr 300px"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .main-content [style*="grid-template-columns: 120px"], .main-content [style*="grid-template-columns:120px"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    /* Groupes de boutons et de filtres en ligne : passage à la ligne quand la place manque */
    .main-content [style*="display: flex"], .main-content [style*="display:flex"] { flex-wrap: wrap; }
    .main-content select { min-width: 0; width: 100%; }
    .main-content h1 { font-size: 1.5rem; }
}
