/* =============================================================================
   Gestion RP — feuille de style (reprend la maquette validée)
   Polices système uniquement : aucun appel à un service externe (RGPD).
   ============================================================================= */
:root {
    --bleu-nuit: #293955;
    --bleu-nuit-clair: #8494B0;
    --fond: #F3F5F8;
    --carte: #FFFFFF;
    --bordure: #DDE3EC;
    --texte: #1C2433;
    --texte-doux: #4A5568;
    --lien: #1F5FA8;
    --rouge-fond: #FDE2E1; --rouge-texte: #7F1414; --rouge-plein: #9B1C1C;
    --orange-fond: #FFEBC7; --orange-texte: #6E3B00;
    --vert-fond: #DFF2E5; --vert-texte: #1D5631;
}

html, body { margin: 0; background: var(--fond); color: var(--texte);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif; font-size: 15px; }
a { color: var(--lien); } a:hover { color: #163F70; }
h1 { font-size: 28px; margin: 0 0 4px; } h2 { font-size: 19px; margin: 16px 0 8px; } h3 { font-size: 20px; }
h1:focus { outline: none; }
.sous-titre { color: var(--texte-doux); margin: 0 0 16px; }

/* --- Barre du haut ---------------------------------------------------------- */
.barre { background: var(--bleu-nuit); color: #FFF; padding: 10px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.barre .marque { display: flex; flex-direction: column; flex: 1 1 260px; }
.barre .marque strong { font-size: 18px; }
.barre .marque span { font-size: 13px; color: #C9D3E3; }
.barre .utilisateur { display: flex; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; }
.barre .role { background: rgba(255,255,255,.12); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.bouton-clair { background: transparent; color: #FFF; border: 1px solid var(--bleu-nuit-clair); border-radius: 6px; padding: 8px 12px; min-height: 40px; cursor: pointer; font: inherit; }

/* --- Disposition menu + contenu ------------------------------------------------- */
.page { display: flex; flex-wrap: wrap; gap: 24px; padding: 24px; max-width: 1760px; margin: 0 auto; box-sizing: border-box; }
.menu { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 4px; }
.menu a { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--texte); border-radius: 6px; padding: 12px; min-height: 20px; }
.menu a:hover { background: #E6EAF0; }
.menu a.active { background: var(--bleu-nuit); color: #FFF; font-weight: 600; }
.menu .titre-groupe { margin-top: 22px; padding: 12px 12px 4px; border-top: 1px solid #D5DAE3; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: #5B6678; }
.menu .a-venir { padding: 8px 12px; color: #5B6678; }
.contenu { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* --- Composants ------------------------------------------------------------------ */
.carte { background: var(--carte); border: 1px solid var(--bordure); border-radius: 8px; padding: 16px; }
.grille-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .grille-4, .grille-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grille-4, .grille-2 { grid-template-columns: minmax(0, 1fr); } .menu { max-width: none; } }
.chiffre { font-size: 30px; font-weight: 700; }
.chiffre.rouge { color: var(--rouge-plein); } .chiffre.orange { color: #8A4B00; } .chiffre.bleu { color: var(--lien); }
.ligne-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.filtres { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filtres label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--texte-doux); flex: 1 1 200px; }
.filtres label.case { flex-direction: row; align-items: center; gap: 8px; font-size: 15px; color: var(--texte); flex: 0 0 auto; min-height: 44px; }

input:not([type]), input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea, .form-control {
    font: inherit; padding: 10px 12px; border: 1px solid #B8C2D1; border-radius: 6px; min-height: 44px; box-sizing: border-box; background: #FFF; color: var(--texte); width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; }
button, .btn { font: inherit; cursor: pointer; border-radius: 6px; padding: 10px 16px; min-height: 44px; font-weight: 600; border: 1px solid var(--bleu-nuit); background: #FFF; color: var(--bleu-nuit); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary, button.primaire, .btn.primaire { background: var(--bleu-nuit); color: #FFF; border-color: var(--bleu-nuit); }
.btn-danger, button.danger { color: var(--rouge-texte); border-color: #C9A3A3; background: #FFF; }
.btn-link { border: none; background: none; color: var(--lien); padding: 0; min-height: 0; font-weight: 600; }
.w-100 { width: 100%; } .mb-3 { margin-bottom: 12px; } .text-danger { color: var(--rouge-plein); }
.form-floating { display: flex; flex-direction: column-reverse; gap: 4px; }
.form-floating label { font-size: 13px; color: var(--texte-doux); }
.alert { border-radius: 6px; padding: 10px 12px; margin: 8px 0; }
.alert-success { background: var(--vert-fond); color: var(--vert-texte); }
.alert-danger, .alert-warning { background: #FFF6E5; color: #5C3300; }
.alert-info { background: #E3ECF8; color: #163F70; }
kbd { background: #EEF2F7; border: 1px solid var(--bordure); border-radius: 4px; padding: 2px 6px; font-family: ui-monospace, Consolas, monospace; }

/* Tableaux en grille (défilement horizontal sur petit écran) */
.tableau { background: var(--carte); border: 1px solid var(--bordure); border-radius: 8px; overflow-x: auto; }
.tableau table { width: 100%; border-collapse: collapse; min-width: 980px; }
.tableau th { background: var(--bleu-nuit); color: #FFF; font-weight: 600; font-size: 14px; text-align: left; padding: 12px 10px; }
.tableau td { padding: 10px; border-bottom: 1px solid #E6EAF0; vertical-align: middle; }
.tableau tr:hover td { background: #F7F9FC; }

/* Badges d'échéance */
.badge { padding: 2px 8px; border-radius: 4px; white-space: nowrap; font-size: 14px; display: inline-block; }
.badge.afaire { background: var(--rouge-plein); color: #FFF; font-weight: 700; }
.badge.depassee { background: var(--rouge-fond); color: var(--rouge-texte); font-weight: 700; }
.badge.proche { background: var(--orange-fond); color: var(--orange-texte); font-weight: 700; }
.badge.ajour { background: var(--vert-fond); color: var(--vert-texte); }
.badge.nc { color: #5B6678; font-style: italic; }
.pastille { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.pastille.rouge { background: #B4232A; } .pastille.orange { background: #C77700; } .pastille.vert { background: #2E7D4A; }
.legende { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--texte-doux); }

/* Pages de compte (connexion, double authentification) */
.page-compte { max-width: 460px; margin: 48px auto; background: var(--carte); border: 1px solid var(--bordure); border-radius: 10px; padding: 32px; }
.page-compte ol.list { padding-left: 20px; }
.row, .col-md-4, .col-md-6, .col-xl-6, .col-lg-6 { display: block; width: 100%; }

/* Validation et erreurs Blazor */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Une erreur est survenue."; }

/* Zone de dépôt sur le nom d'un agent (pendant le glisser-déposer) */
.zone-depot { position: absolute; inset: 2px; border-radius: 6px; display: flex; align-items: center; padding: 0 8px;
    font-weight: 600; font-size: 13px; pointer-events: none; opacity: 0; transition: opacity .1s; }
/* Seul le nom survolé par le fichier est mis en évidence */
.zone-depot.survol { opacity: 1; border: 2px dashed var(--lien); background: #E3ECF8; color: #163F70; }

/* Grande zone de dépôt : le champ fichier invisible couvre toute la zone (clic ou glisser-déposer) */
.grande-zone { position: relative; background: #FFF; border: 2px dashed var(--bleu-nuit-clair); border-radius: 10px; padding: 40px 24px;
    display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.grande-zone:hover, .grande-zone:focus-within { border-color: var(--lien); background: #F5F8FD; }
.grande-zone.occupee { opacity: .7; }
.grande-zone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.compteur { background: #B4232A; color: #FFF; border-radius: 999px; padding: 1px 8px; font-size: 13px; font-weight: 700; }

/* Échéance dépassée : rouge clignotant (fixe si l'utilisateur a demandé moins d'animations) */
.alerte-expiree { color: var(--rouge-plein); font-weight: 700; background: var(--rouge-fond); border-left: 4px solid var(--rouge-plein); padding: 4px 8px; border-radius: 4px; }
.alerte-proche { color: var(--orange-texte); font-weight: 700; background: var(--orange-fond); border-left: 4px solid #C77700; padding: 4px 8px; border-radius: 4px; }
.clignotant { animation: clignote 1s step-end infinite; }
@keyframes clignote { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .clignotant { animation: none; } }

/* Boutons d'action compacts dans un tableau (une seule ligne) */
.actions-compactes { display: flex; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.actions-compactes button, .actions-compactes .btn { min-height: 34px; padding: 5px 12px; font-size: 14px; white-space: nowrap; }
.actions-compactes label.btn { position: relative; overflow: hidden; }
.actions-compactes label.btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Anomalie pour information (gris) */
.alerte-info { color: #2D3748; background: #EEF2F7; border-left: 4px solid #8494B0; padding: 4px 8px; border-radius: 4px; }

/* Fiche : liste libellé / valeur */
.fiche-dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 0; }
.fiche-dl dt { color: var(--texte-doux); }
.fiche-dl dd { margin: 0; }

/* Suivi des formations individuelles : demande → réunion → décision → réalisation → classement */
.etapes { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; counter-reset: etape; }
.etapes li { flex: 1 1 130px; display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 6px; background: #F1F3F7; border-top: 4px solid #C9D0DC; color: var(--texte-doux); }
.etapes li span { font-weight: 600; }
.etapes li small { font-size: 13px; }
.etapes li.faite { background: var(--vert-fond); border-top-color: var(--vert-texte); color: var(--vert-texte); }
.etapes li.refus { background: var(--rouge-fond); border-top-color: var(--rouge-plein); color: var(--rouge-plein); }

/* Impression des listes (habilitations…) : seul le contenu est imprimé */
@media print {
    .barre, .menu, .pas-imprimer { display: none !important; }
    .page { padding: 0; }
    .tableau { border: none; overflow: visible; }
}

/* Rubriques de la fiche agent : chaque bloc est encadré et repérable par sa couleur */
.rubrique { background: var(--carte); border: 1px solid var(--bordure); border-left: 6px solid #8494B0; border-radius: 8px; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.rubrique-entete { margin: 0 -16px; padding: 10px 16px; border-bottom: 1px solid var(--bordure); border-radius: 0 8px 0 0; }
.rubrique-entete h2 { margin: 0; }
.rubrique-dm { border-left-color: #2B6CB0; } .rubrique-dm > .rubrique-entete { background: #EAF2FB; }
.rubrique-fi { border-left-color: #6B46C1; } .rubrique-fi > .rubrique-entete { background: #F1ECFB; }
.rubrique-docs { border-left-color: #4A5568; } .rubrique-docs > .rubrique-entete { background: #EEF1F5; }
.rubrique .carte { background: #FAFBFD; }
.rubrique .tableau { margin: 0; }
.demande-formation { display: flex; flex-direction: column; gap: 10px; border-left: 4px solid #B9A6E6; }
.rubrique-vide { padding: 12px; border: 1px dashed var(--bordure); border-radius: 6px; color: var(--texte-doux); background: #FAFBFD; }
.titre-rubrique { margin-top: 8px; }

/* Un lien-bouton (Ouvrir) a exactement la taille d'un bouton voisin */
a.btn, button { box-sizing: border-box; line-height: 1.2; vertical-align: middle; }
.actions-compactes { align-items: center; }

/* Mon compte : onglets et contenu */
.compte-onglets { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 2px solid var(--bordure); padding-bottom: 0; }
.compte-onglets a { padding: 8px 14px; border-radius: 6px 6px 0 0; text-decoration: none; color: var(--bleu-nuit); font-weight: 600; border: 1px solid transparent; margin-bottom: -2px; }
.compte-onglets a:hover { background: #EEF2F7; }
.compte-onglets a.active { background: var(--carte); border-color: var(--bordure); border-bottom: 2px solid var(--carte); }
.compte-contenu { border-top-left-radius: 0; }
.compte-contenu h2:first-of-type { margin-top: 0; }
.codes-secours { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-width: 640px; }
.codes-secours code { font-size: 16px; padding: 6px 10px; background: #F1F3F7; border-radius: 4px; text-align: center; }
.alert-warning { background: var(--orange-fond); color: var(--orange-texte); }
.alert-danger { background: var(--rouge-fond); color: var(--rouge-texte); }

/* Formations en ligne : cellules à pastille */
.pastille.gris { background: #A0AAB8; }
.cellule-formation { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.cellule-formation .etat { display: flex; align-items: flex-start; gap: 6px; }
.cellule-formation .etat .pastille { margin-top: 5px; }
.cellule-formation .actions-compactes { justify-content: flex-start; flex-wrap: wrap; }
.etat-service { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; }
.historique-formations td { font-size: 13px; background: #FAFBFD; }

/* Liste du personnel : tout le tableau lisible d'un coup d'œil, sans ascenseur horizontal */
.tableau table.tableau-personnel { min-width: 0; }
.tableau-personnel th { padding: 8px 6px; font-size: 13px; line-height: 1.25; }
.tableau-personnel td { padding: 6px; font-size: 14px; }
.tableau-personnel .badge { font-size: 13px; padding: 2px 6px; }
.tableau-personnel .badge.nc { font-size: 12.5px; padding: 2px 0; }
.tableau-personnel .col-email { max-width: 190px; font-size: 13px; overflow-wrap: anywhere; }
.tableau-personnel .col-email .btn-link { text-align: left; overflow-wrap: anywhere; }

/* Dosimétrie */
.pastille.violet { background: #6B46C1; }
.badge.examiner { background: #F1ECFB; color: #4C2A99; font-weight: 700; }
.zone-crp { border: 2px solid #6B46C1; border-radius: 8px; padding: 12px 16px; background: #FBFAFE; }
.valeur-dose { font-variant-numeric: tabular-nums; white-space: nowrap; }
.valeur-dose.alerte { color: #4C2A99; font-weight: 700; }

/* Boutons d'actions compacts : tous à la même taille (bouton, lien, et étiquette « Déposer » qui contient le choix de fichier) */
.actions-compactes > button, .actions-compactes > .btn, .actions-compactes > label.btn, .actions-compactes > a.btn {
    box-sizing: border-box; height: 34px; min-height: 34px; padding: 0 12px; line-height: 1; font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; margin: 0;
}

/* Message d'action toujours visible (page Formations) */
.message-flottant { position: sticky; top: 8px; z-index: 50; display: flex; align-items: flex-start; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.fermer-message { margin-left: auto; border: none; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; padding: 0 4px; }
