/* ══ Variables palette sécurité ══════════════════════════ */
    :root {
        --bleu:          #002654;
        --bleu-fonce:    #001534;
        --bleu-mid:      #1a4a8a;
        --bleu-clair:    #e8eef8;
        --vert:          #198754;
        --vert-clair:    #eefbf4;
        --rouge:         #c82333;
        --rouge-clair:   #fff5f5;
        --orange:        #b8860b;
        --orange-clair:  #fdf8ee;
        --gris-fond:     #f3f5f9;
        --gris-bordure:  #cfd7e8;
        --gris-texte:    #5a6474;
        --texte:         #1a1e2a;
        --blanc:         #ffffff;
        --ombre:         0 2px 8px rgba(0,38,84,0.09);
        --ombre-card:    0 4px 14px rgba(0,38,84,0.11);
        --rayon:         6px;
    }

    /* ══ Reset ════════════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; }

    /* body: sticky footer ci-dessous */

    /* ══ Navigation (identique à consulter-fichiers-police) ══ */
    .nav-cerpeg {
        background: var(--blanc);
        border-bottom: 2px solid var(--gris-bordure);
        padding: 10px 24px;
        box-shadow: 0 2px 6px rgba(0,38,84,0.07);
    }
    .nav-inner {
        max-width: 960px; margin: 0 auto;
        display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    }
    .nav-btn {
        display: inline-flex; align-items: center; gap: 7px;
        border-radius: var(--rayon); padding: 8px 15px;
        font-family: inherit; font-size: 13px; font-weight: 700;
        cursor: pointer; text-decoration: none;
        transition: background 0.2s, color 0.2s;
        border: 1px solid var(--gris-bordure);
        background: var(--bleu-clair); color: var(--bleu);
        white-space: nowrap;
    }
    .nav-btn:hover { background: var(--bleu); color: var(--blanc); border-color: var(--bleu); }
    .nav-badge {
        margin-left: auto;
        background: var(--bleu-clair); border: 1px solid var(--bleu-mid); color: var(--bleu);
        padding: 3px 11px; border-radius: 20px;
        font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    }

    /* ══ Wrapper principal ════════════════════════════════════ */
    .main-wrapper {
        max-width: 960px;
        margin: 0 auto;
        padding: 20px 20px 48px;
    }

    /* ══ En-tête page ( card-header) ═════════════ */
    .page-titre {
        background: var(--bleu); border-radius: var(--rayon);
        padding: 18px 24px; margin-bottom: 24px;
        display: flex; align-items: center; gap: 16px;
        box-shadow: var(--ombre-card);
    }
    .page-titre-icon {
        width: 48px; height: 48px;
        background: rgba(255,255,255,0.18); border-radius: 10px;
        display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .page-titre-text h1 {
        color: var(--blanc); font-size: 17px; font-weight: 700;
        text-transform: uppercase; letter-spacing: 0.03em; margin: 0;
    }
    .page-titre-text p { color: rgba(255,255,255,0.75); font-size: 12px; margin: 3px 0 0; font-style: italic; }

    /* ══ Titres de section ( .section-title) ══════ */
    h2 {
        color: var(--bleu);
        font-size: 14px; font-weight: 700;
        text-transform: uppercase; letter-spacing: 0.06em;
        margin: 24px 0 14px; padding-bottom: 8px;
        border-bottom: 2px solid var(--bleu-clair);
        display: flex; align-items: center; gap: 8px;
    }
    h3 { color: var(--bleu); font-size: 13px; font-weight: 700; margin-bottom: 10px;  margin-left: 10px;}

    /* ══ Cartes de section ( .card) ═══════════════ */
    .form-section {
        background: var(--blanc);
        border: 1px solid var(--gris-bordure);
        border-radius: var(--rayon);
        box-shadow: var(--ombre);
        margin-bottom: 16px;
        overflow: hidden;
    }

    .form-section-header {
        background: var(--bleu-clair);
        border-bottom: 1px solid var(--gris-bordure);
        padding: 10px 18px;
        font-size: 12px; font-weight: 700; color: var(--bleu);
        text-transform: uppercase; letter-spacing: 0.05em;
        display: flex; align-items: center; gap: 8px;
    }

    .form-section-body { padding: 16px 18px;}

    /* ══ Grille formulaire ════════════════════════════════════ */
    .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        margin: 10px 10px 10px 10px;
    }
    .full-width { grid-column: 1 / -1; }

    /* ══ Champs════════════════════════════════ */
    label {
        font-size: 13px; font-weight: 700;
        color: var(--gris-texte); display: block; margin-bottom: 4px;
        margin: 10px 10px 10px 10px;
       
    }
    input, select, textarea {
        width: 100%; padding: 9px 12px;
        border: 1.5px solid var(--gris-bordure); border-radius: var(--rayon);
        font-family: inherit; font-size: 14px;
        color: var(--texte); background: var(--blanc);
        transition: border-color 0.18s; box-sizing: border-box;
    }
    input:focus, select:focus, textarea:focus {
        outline: none; border-color: var(--bleu);
        box-shadow: 0 0 0 3px rgba(0,38,84,0.10);
    }
    input::placeholder { color: var(--gris-texte); opacity: 0.6; }
    textarea { resize: vertical; min-height: 80px; }

    /* ══ Boutons () ═══════════════════════════════ */
    .btn-group { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
    .action-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

    .btn {
        display: inline-flex; align-items: center; justify-content: center; gap: 8px;
        padding: 10px 20px; border-radius: var(--rayon);
        font-size: 13px; font-weight: 700; cursor: pointer;
        border: none; transition: all 0.2s; font-family: inherit;
        text-transform: uppercase; letter-spacing: 0.04em; flex: 1;
    }
    .btn { background: var(--bleu); color: var(--blanc); }
    .btn:hover { background: var(--bleu-fonce); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,38,84,0.22); }
    .btn:disabled { background: var(--gris-bordure); color: var(--gris-texte); cursor: not-allowed; transform: none; box-shadow: none; }

    .btn-add {
        display: inline-flex; align-items: center; gap: 6px;
        background: var(--bleu-mid); color: var(--blanc); border: none;
        padding: 7px 14px; font-size: 12px; border-radius: var(--rayon);
        cursor: pointer; font-family: inherit; font-weight: 700; transition: background 0.2s;
    }
    .btn-add:hover { background: var(--bleu-fonce); }

    .btn-delete {
        display: inline-flex; align-items: center; gap: 6px;
        background: var(--rouge-clair); color: var(--rouge);
        border: 1.5px solid var(--rouge);
        padding: 7px 14px; font-size: 12px; border-radius: var(--rayon);
        cursor: pointer; font-family: inherit; font-weight: 700; transition: background 0.2s, color 0.2s;
    }
    .btn-delete:hover { background: var(--rouge); color: var(--blanc); }

    .btn-copy {
        background: var(--gris-texte); color: var(--blanc); border: none;
        padding: 9px 14px; border-radius: var(--rayon);
        cursor: pointer; font-weight: 700; font-family: inherit; margin-top: 12px;
        display: inline-flex; align-items: center; gap: 6px; font-size: 13px; transition: background 0.2s;
    }
    .btn-copy:hover { background: var(--texte); }

    /* ══ États de validation () ═══════════════════ */
    .hidden { display: none !important; }

    .champ-obligatoire.champ-invalide {
        border: 2px solid var(--rouge) !important;
        background: var(--rouge-clair);
    }
    .champ-obligatoire.champ-valide {
        border: 2px solid var(--vert) !important;
        background: var(--vert-clair);
    }
    .champ-obligatoire.champ-invalide:focus { box-shadow: 0 0 0 3px rgba(200,35,51,0.15) !important; }
    .champ-obligatoire.champ-valide:focus   { box-shadow: 0 0 0 3px rgba(25,135,84,0.15) !important; }

    /* ══ Zone résultat ════════════════════════════════════════ */
    #zone-resultat { display: none; margin-top: 24px; }
    pre {
        white-space: pre-wrap; font-family: 'Segoe UI', Arial, sans-serif;
        font-size: 13px; background: var(--gris-fond);
        padding: 16px; border-radius: var(--rayon);
        border: 1px solid var(--gris-bordure); margin: 0; color: var(--texte);
    }
    .info-rgpd { font-size: 10px; color: var(--rouge); font-style: italic; margin-bottom: 16px; text-align: center; font-weight: 700; }

    /* ══ Boutons icônes impression ════════════════════════════ */
    .btn-icon-action {
        background: var(--blanc); border: 2px solid currentColor;
        padding: 7px 9px; border-radius: var(--rayon); cursor: pointer;
        display: inline-flex; align-items: center; justify-content: center;
        margin-top: 12px; margin-left: 8px;
        transition: background 0.18s, color 0.18s; line-height: 1; vertical-align: middle;
    }
    .btn-icon-copy  { color: var(--gris-texte); }
    .btn-icon-copy:hover  { background: var(--gris-texte); color: var(--blanc); }
    .btn-icon-print { color: var(--bleu); }
    .btn-icon-print:hover { background: var(--bleu); color: var(--blanc); }
    .conseil-pdf { margin: 8px 0 0; font-size: 10px; color: var(--gris-texte); font-style: italic; display: none; }

    /* ══ Système de modales () ═══════════════════ */
    .modal-overlay {
        position: fixed; inset: 0; background: rgba(0,0,0,0.52);
        display: flex; align-items: center; justify-content: center;
        z-index: 9000; animation: overlayIn 0.15s ease;
    }
    .modal-overlay.hidden { display: none !important; }
    @keyframes overlayIn { from{opacity:0} to{opacity:1} }

    .modal-box {
        background: var(--blanc); border-radius: 8px; padding: 26px 28px 22px;
        width: 420px; max-width: 95vw;
        box-shadow: 0 12px 40px rgba(0,0,0,0.20);
        animation: boxIn 0.18s ease;
    }
    @keyframes boxIn {
        from{opacity:0;transform:translateY(-12px) scale(0.97)}
        to{opacity:1;transform:translateY(0) scale(1)}
    }
    .modal-box h3 {
        color: var(--bleu); margin: 0 0 16px;
        font-size: 14px; font-weight: 700;
        border-bottom: 2px solid var(--bleu-clair); padding-bottom: 8px;
        text-transform: uppercase; letter-spacing: 0.04em;
       
    }
    .modal-box label { font-weight: 700; display: block; margin: 10px 0 3px; color: var(--gris-texte); font-size: 12px; }
    .modal-box input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--gris-bordure); border-radius: var(--rayon); box-sizing: border-box; font-family: inherit; font-size: 14px; }
    .modal-box input:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(0,38,84,0.10); }
    .modal-actions { display: flex; gap: 10px; margin-top: 18px; }
    .modal-actions button { flex: 1; padding: 10px; border: none; border-radius: var(--rayon); font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; transition: background 0.15s; }

    #modal-identite  { z-index: 9200; }
    #modal-alerte    { z-index: 9500; }
    .modal-alerte-box { text-align: center; }
    .modal-alerte-icone { display: flex; justify-content: center; margin-bottom: 14px; }
    .modal-alerte-titre { font-size: 13px; font-weight: 700; color: var(--bleu); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
    .modal-alerte-message { font-size: 13px; color: var(--gris-texte); line-height: 1.55; margin: 0 0 20px; }
    .btn-alerte-ok { background: var(--bleu); color: var(--blanc); border: none; padding: 10px 38px; border-radius: var(--rayon); font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; transition: background 0.15s; display: block; margin: 0 auto; }
    .btn-alerte-ok:hover         { background: var(--bleu-fonce); }
    .btn-alerte-ok.rouge         { background: var(--rouge); }
    .btn-alerte-ok.rouge:hover   { background: #a01929; }
    .btn-alerte-ok.orange        { background: var(--orange); }
    .btn-alerte-ok.orange:hover  { background: #8f6a08; }

    /* ══ Identification agent ════════════════════════════════ */
    #modal-identite-agent { z-index: 9200; }
    #modal-identite-agent .modal-box h3 { color: var(--bleu); border-bottom: 2px solid var(--bleu-clair); }
    .modal-id-actions { display: flex; gap: 10px; margin-top: 18px; }
    .modal-id-actions button { flex: 1; padding: 10px; border: none; border-radius: var(--rayon); font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; transition: background 0.15s; }
    .btn-id-confirmer { background: var(--bleu); color: var(--blanc); }
    .btn-id-confirmer:hover { background: var(--bleu-fonce); }

    /* ══ Toast ═══════════════════════════════════════════════ */
    #toast-notif {
        position: fixed; bottom: 26px; right: 26px;
        background: #1b3d1b; color: var(--blanc);
        padding: 12px 18px; border-radius: var(--rayon);
        font-size: 13px; font-weight: 700;
        display: flex; align-items: center; gap: 10px;
        box-shadow: 0 6px 20px rgba(0,0,0,0.26); z-index: 9999;
        max-width: 340px; animation: toastIn 0.22s ease;
    }
    #toast-notif.hidden { display: none !important; }
    #toast-notif.toast-erreur { background: #6b1520; }
    @keyframes toastIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
    .toast-icone { flex-shrink: 0; }

    /* ══ Footer () ════════════════════════════════ */
    
    

    /* ══ Responsive ══════════════════════════════════════════ */
    @media (max-width: 768px) {
        .btn-group { flex-direction: column; }
        .form-grid { grid-template-columns: 1fr; }
        .main-wrapper { padding: 14px 14px 32px; }
        .page-titre { flex-wrap: wrap; }
    }
    @media (max-width: 600px) {
        
        .nav-badge { display: none; }
        .nav-cerpeg { padding: 10px 12px; }
    }

/* ══════════════════════════════════════════════════════════════
           DOCUMENT IMPRIMABLE — styles appliqués via @media print
        ══════════════════════════════════════════════════════════════ */
        #zone-impression {
            display: none;
            font-family: Arial, sans-serif;
            font-size: 9pt;
            color: #000;
            line-height: 1.4;
            background: #fff;
            box-sizing: border-box;
        }

        /* ── Bandeau supérieur ── */
        .imp-bandeau {
            background: #002654;
            color: #fff;
            text-align: center;
            padding: 3pt 8pt;
            font-size: 7pt;
            font-weight: bold;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            margin-bottom: 6pt;
        }

        /* ── En-tête tri-colonnes ── */
        .imp-entete {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            border-top: 2pt solid #002654;
            border-bottom: 2pt solid #002654;
            padding: 6pt 0;
            margin-bottom: 7pt;
            gap: 8pt;
        }

        .imp-entete-gauche {
            font-size: 7.5pt;
            color: #333;
            line-height: 1.6;
            min-width: 100pt;
        }

        .imp-entete-gauche .imp-service {
            font-size: 9pt;
            font-weight: bold;
            color: #002654;
            text-transform: uppercase;
            display: block;
            margin-bottom: 2pt;
        }

        .imp-titre-central {
            text-align: center;
            flex: 1;
        }

        .imp-titre-doc {
            font-size: 13pt;
            font-weight: bold;
            color: #002654;
            text-transform: uppercase;
            letter-spacing: 1px;
            display: block;
            line-height: 1.25;
        }

        .imp-ref {
            font-size: 7pt;
            color: #666;
            display: block;
            margin-top: 3pt;
            letter-spacing: 0.3px;
        }

        .imp-entete-droite {
            font-size: 7.5pt;
            text-align: right;
            color: #333;
            line-height: 1.6;
            min-width: 100pt;
        }

        .imp-classif {
            border: 1pt solid #002654;
            padding: 2pt 5pt;
            font-weight: bold;
            font-size: 6.5pt;
            color: #002654;
            text-align: center;
            display: inline-block;
            margin-bottom: 4pt;
            letter-spacing: 0.8px;
            text-transform: uppercase;
        }

        /* ── Sections encadrées ── */
        .imp-section {
            border: 1pt solid #002654;
            margin-bottom: 5pt;
        }

        .imp-section-titre {
            background: #002654;
            color: #fff;
            font-weight: bold;
            font-size: 7.5pt;
            padding: 2.5pt 6pt;
            text-transform: uppercase;
            letter-spacing: 0.8px;
        }

        .imp-section-corps {
            padding: 4pt 7pt;
        }

        .imp-row {
            display: flex;
            gap: 4pt;
            margin-bottom: 2pt;
            align-items: baseline;
        }

        .imp-label {
            font-weight: bold;
            color: #002654;
            font-size: 7.5pt;
            min-width: 85pt;
            flex-shrink: 0;
        }

        .imp-val {
            font-size: 8.5pt;
            flex: 1;
        }

        /* ── Intervenants ── */
        .imp-int-row {
            display: flex;
            align-items: baseline;
            gap: 8pt;
            padding: 2pt 0;
            border-bottom: 0.5pt solid #dee2e6;
            font-size: 8.5pt;
        }

        .imp-int-row:last-child { border-bottom: none; }

        .imp-int-num {
            font-weight: bold;
            color: #002654;
            min-width: 14pt;
            font-size: 8pt;
        }

        .imp-int-grade { font-style: italic; min-width: 70pt; }
        .imp-int-nom   { font-weight: bold; min-width: 90pt; }

        .imp-int-badge {
            font-size: 7pt;
            color: #555;
            border: 0.5pt solid #aaa;
            padding: 0 3pt;
            border-radius: 2pt;
            margin-left: 2pt;
        }

        /* ── Individus ── */
        .imp-individu {
            padding: 3pt 0;
            border-bottom: 0.5pt solid #dee2e6;
        }

        .imp-individu:last-child { border-bottom: none; }

        .imp-individu-titre {
            font-weight: bold;
            font-size: 7.5pt;
            color: #002654;
            background: #f0f4fa;
            padding: 1.5pt 4pt;
            margin-bottom: 2pt;
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }

        /* ── Zone signature ── */
        .imp-signature {
            display: flex;
            gap: 8pt;
            margin-top: 8pt;
            margin-bottom: 6pt;
        }

        .imp-signature-bloc {
            flex: 1;
            border: 1pt solid #aaa;
            padding: 4pt 6pt;
            min-height: 38pt;
        }

        .imp-signature-label {
            font-size: 7pt;
            font-weight: bold;
            color: #002654;
            margin-bottom: 10pt;
        }

        .imp-signature-ligne {
            border-bottom: 0.5pt solid #999;
            margin-top: 4pt;
        }

        .imp-signature-nom {
            font-size: 7pt;
            color: #555;
            margin-top: 2pt;
            text-align: center;
        }

        /* ── Pied de page ── */
        .imp-pied {
            border-top: 1pt solid #002654;
            padding-top: 3pt;
            margin-top: 4pt;
            display: flex;
            justify-content: space-between;
            font-size: 6.5pt;
            color: #555;
        }

        .imp-pied-gauche { font-style: italic; }
        .imp-pied-droite { text-align: right; font-weight: bold; color: #002654; }

        /* ── @media print : masque tout sauf #zone-impression ── */
        @media print {
            @page { size: A4 portrait; margin: 1cm 1.2cm 1.4cm; }
            body > * { display: none !important; }
            #zone-impression { display: block !important; }
        }
    
    /* ══ Body sticky footer ══════════════════════════════════ */
    html { height: 100%; }
    body {
        font-family: 'Segoe UI', Arial, sans-serif;
        font-size: 14px;
        color: var(--texte);
        background: var(--gris-fond);
        min-height: 100vh;
        margin: 0; padding: 0;
        display: flex;
        flex-direction: column;
    }
    .nav-cerpeg { flex-shrink: 0; }
    .main-wrapper { flex: 1; }

    /* ══ Footer gris sobre identique sur les 3 fichiers ═════ */
    .main-footer, footer.main-footer {
        background: #eaecf2;
        color: #8a96a8;
        text-align: center;
        padding: 10px 24px;
        font-size: 11px;
        line-height: 1.6;
        border-top: 1px solid #d0d8e8;
        flex-shrink: 0;
        margin-top: 0;
    }
    .main-footer strong { color: #6a7280; font-weight: 600; }

    
    /* ══ Grilles denses — intervenants et individus ══════════ */
    .intervenant-block .form-grid { grid-template-columns: 1fr 1fr 1fr; }
    .individu-block .form-grid    { grid-template-columns: 1fr 1fr 1fr; }

    /* ══ Marges externes champs ══════════════════════════════ */
    .form-section { margin-bottom: 18px; }
    .form-section-body { padding: 16px 20px 18px; }
    .form-grid { gap: 14px 18px; }

    /* ══ Responsive grilles ══════════════════════════════════ */
    @media (max-width: 768px) {
        .intervenant-block .form-grid,
        .individu-block .form-grid { grid-template-columns: 1fr 1fr; }
    }
    @media (max-width: 480px) {
        .intervenant-block .form-grid,
        .individu-block .form-grid { grid-template-columns: 1fr; }
    }
/* ══ Selects auto-dimensionnés — ne pas forcer 100% ══════════ */
.select-statut,
.select-document,
.select-service {
    width: auto;
    max-width: 100%;
}

/* ══ Résumé — hint compteur de mots ═════════════════════════ */
.label-obligatoire {
    color: var(--rouge);
    font-weight: 700;
    margin-left: 2px;
}
.resume-hint {
    display: block;
    margin-top: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gris-texte);
    transition: color 0.2s;
}
.resume-hint.resume-hint-warn { color: var(--orange); }
.resume-hint.resume-hint-ok   { color: var(--vert);   }

