/*
   Feuille de style principale.
   Objectif : interface moderne, lisible et responsive sans dépendance externe.
*/
/* Variables communes : couleurs, bordures et ombre reutilisees dans les composants. */
:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #132238;
    --muted: #667085;
    --primary: #1f6feb;
    --primary-dark: #174ea6;
    --danger: #c0392b;
    --success: #0f8a5f;
    --border: #d8dee9;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

/* Inclure padding et bordures dans les dimensions pour simplifier les mises en page. */
* { box-sizing: border-box; }
/* Typographie et couleurs de fond par defaut. */
body {
    margin: 0;
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Structure generale : menu lateral et contenu principal. */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}
/* Navigation laterale sombre avec liens et pied de session. */
.sidebar {
    background: #0f172a;
    color: #e5e7eb;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}
/* Identite de marque et monogramme partages entre les pages. */
.brand { display: flex; align-items: center; gap: 12px; }
.brand.center { justify-content: center; }
.statistic-link { color: inherit; text-decoration: underline; text-underline-offset: 4px; }
.statistic-link:hover { color: var(--primary); }
.statistic-link:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 3px; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 14px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #1f6feb, #0f8a5f);
    color: #fff; font-weight: 800;
}
.brand small { display: block; color: #a7b0c0; margin-top: 3px; }
/* Organisation et retour visuel des liens de navigation. */
.nav { display: grid; gap: 8px; }
.nav a {
    color: #dbe4f0;
    padding: 12px 14px;
    border-radius: 12px;
}
.nav a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
/* Placer les informations de session au bas du menu. */
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; color: #a7b0c0; }
.logout { color: #fff; }

/* Espacement du contenu et presentation de l en-tete. */
.main { padding: 28px; overflow-x: hidden; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.topbar h1 { margin: 0; font-size: clamp(1.5rem, 2vw, 2.2rem); }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.topbar { flex-wrap: wrap; }
.connected-user { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; max-width: 100%; min-width: 0; }
.connected-user svg { width: 28px; height: 28px; flex-shrink: 0; color: var(--muted); }
.connected-user div { min-width: 0; overflow-wrap: anywhere; }
.connected-user strong, .connected-user span { display: block; }
.connected-user strong { margin: 3px 0; }
.connected-user span { color: var(--muted); font-size: 12px; }
.sidebar-footer { flex-wrap: wrap; }
.user-profile-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.user-profile-link:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.other-menu { min-width: 0; }
.other-menu summary { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; color: #dce4ee; border-radius: 8px; list-style: none; }
.other-menu summary::-webkit-details-marker { display: none; }
.other-menu summary::after { content: '▾'; margin-left: auto; }
.other-menu[open] summary::after { content: '▴'; }
.other-menu summary:hover, .other-menu[open] summary { background: #ffffff12; }
.other-menu summary:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.other-menu summary svg { width: 20px; height: 20px; flex-shrink: 0; }
.other-menu-items { max-height: 340px; overflow-y: auto; padding-left: 12px; }
.nav .other-menu-items a { font-size: 12px; padding: 9px 12px; white-space: normal; }
.other-tables-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.other-tables-grid .btn { white-space: normal; text-align: left; justify-content: flex-start; }

/* Grilles pour les compteurs et les repartitions statistiques. */
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
/* Aspect commun des blocs blancs : bordure, coins arrondis et ombre. */
.card, .panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
}
.card { padding: 22px; }
.card span { color: var(--muted); display: block; margin-bottom: 10px; }
.card strong { font-size: 2.1rem; }
.panel { padding: 22px; margin-bottom: 16px; }
.panel h2 { margin-top: 0; }

/* Aligner la recherche et les actions en haut des listes. */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search-form { display: flex; gap: 8px; flex: 1; }
.search-form input { max-width: 420px; }

/* Style commun des boutons ; la variante primary souligne l action principale. */
.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}
.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn.primary:hover { background: var(--primary-dark); text-decoration: none; }

/* Messages temporaires : vert pour le succes, rouge pour les erreurs. */
.alert { padding: 12px 14px; border-radius: 14px; margin-bottom: 16px; }
.alert.success { background: #e8fff5; color: var(--success); border: 1px solid #a7f3d0; }
.alert.error { background: #fff1f0; color: var(--danger); border: 1px solid #fecaca; }
.muted { color: var(--muted); }
.required { color: var(--danger); }

/* Conteneur defilant pour conserver les tableaux lisibles sur mobile. */
.table-responsive { width: 100%; overflow-x: auto; }
/* Presentation des tableaux, en-tetes et cellules. */
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: .04em; }
/* Regrouper les actions par dossier et autoriser leur retour a la ligne. */
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }
.link-danger { border: 0; background: transparent; color: var(--danger); cursor: pointer; padding: 0; font: inherit; }

/* Formulaires sur deux colonnes, avec titres et actions sur toute la largeur. */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.form-grid h2, .form-actions, .checkbox { grid-column: 1 / -1; }
/* Etiquettes et champs de saisie communs aux formulaires. */
label { display: grid; gap: 6px; font-weight: 700; color: #263549; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

/* Presentation des informations sur les fiches detaillees. */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.detail-grid p {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fafc;
}
.detail-grid span { display: block; color: var(--muted); margin-bottom: 5px; }
/* Aligner libelles et valeurs dans les syntheses statistiques. */
.bar-row, .chart-list div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}

/* Cadre commun des pages publiques de connexion et d installation. */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, #dbeafe, #f4f7fb 40%, #eef2ff);
}
/* Carte de formulaire public avec largeur limitee. */
.auth-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.auth-card h1 { margin-bottom: 8px; }
.form-stack { display: grid; gap: 14px; }

/* Adapter les pages de gestion aux petits ecrans en empilant les colonnes. */
@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .cards, .two-cols, .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search-form { flex-direction: column; }
}

/* Boite de confirmation integree : dimensions et apparence sans titre visible. */
.confirmation-dialog {
    width: min(420px, calc(100% - 32px));
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow);
}
/* Assombrir le contenu situe derriere la confirmation modale. */
.confirmation-dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
.confirmation-dialog p { margin: 0 0 24px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; max-height: 60dvh; overflow-y: auto; }
.confirmation-actions { display: flex; justify-content: flex-end; gap: 10px; }
.matricule-warning, .confirmation-danger p { color: #ff0000; font-weight: 700; }
.confirmation-dialog.confirmation-danger { border: 2px solid #ff0000; }
.confirmation-danger button[value="confirm"] { background: #ff0000; border-color: #ff0000; color: #fff; }

/* Page de connexion */
/* Fond et marges de la page. */
.login-page { background: #edf1f5; padding: 40px; }
/* Carte principale : deux colonnes, largeur limitee, arrondis et ombre. */
.login-shell { width: min(1080px, 100%); display: grid; grid-template-columns: 1fr 1fr; min-height: 650px; background: #fff; border: 1px solid #dde3eb; border-radius: 28px; overflow: hidden; box-shadow: 0 28px 80px rgba(19, 34, 56, .12); }
/* Volet sombre avec disposition verticale et fond colore. */
.login-intro { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; color: #fff; background: radial-gradient(ellipse at 0% 100%, #174b60 0, transparent 65%), #101f36; }
/* Cercles decoratifs qui ne capturent pas les clics. */
.login-intro::after { content: ''; position: absolute; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; right: -240px; top: 120px; box-shadow: 0 0 0 65px rgba(255,255,255,.025), 0 0 0 130px rgba(255,255,255,.02); pointer-events: none; }
/* Logo au-dessus du decor et typographie de la marque. */
.login-brand { position: relative; z-index: 1; }
.login-brand strong { font-size: 21px; letter-spacing: .08em; }
.login-brand small { color: #b7c8da; font-size: 12px; }
.brand-logo, 
/* .login-brand-logo { display: block; width: 44px; height: 44px; object-fit: contain; flex-shrink: 0;border-radius: 12px; } */
.login-brand-logo {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.login-brand-logo:hover {
    transform: scale(1.18);
    filter: brightness(1.15) contrast(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.login-textes-button { margin-left: auto; flex-shrink: 0; padding: 9px 10px; border: 1px solid #ffffff50; border-radius: 8px; background: #ffffff12; color: #fff; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.login-textes-button:hover { background: #ffffff26; }
.login-textes-button:focus-visible { outline: 2px solid #8dd9c8; outline-offset: 3px; }
.login-textes-dialog { width: min(760px, calc(100% - 32px)); max-height: 85vh; margin: auto; padding: 24px; border: 0; border-radius: 16px; background: #fff; color: #334155; box-shadow: 0 24px 80px #00000040; overflow-y: auto; }
.login-textes-dialog::backdrop { background: #0f172ab3; }
.login-textes-header { display: flex; align-items: flex-start; gap: 16px; border-bottom: 1px solid #e2e8f0; padding-bottom: 16px; }
.login-textes-header h2 { flex: 1; margin: 0; font-size: 18px; line-height: 1.5; text-decoration: underline; }
.login-textes-header form { margin: 0; }
.login-textes-close { width: 36px; height: 36px; border: 0; border-radius: 8px; background: #edf2f7; color: #334155; font-size: 26px; cursor: pointer; }
.login-textes-content { font-size: 14px; line-height: 1.7; }
.login-textes-content h3 { margin: 22px 0 12px; font-size: 15px; color: #17677e; }
.login-textes-content p { margin: 0 0 22px; }
@media (max-width: 380px) { .login-brand { gap: 8px; } .login-textes-button { padding: 9px 6px; } .login-textes-dialog { padding: 18px; } }
/* Espacement du contenu et ordre de superposition. */
.login-intro-content { position: relative; z-index: 1; padding: 58px 0; }
/* Petite accroche avec lettres espacees. */
.login-eyebrow { color: #a2c8d7; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
/* Titre fluide : clamp adapte sa taille entre une limite basse et haute. */
.login-intro h1 { margin: 22px 0; font-size: clamp(32px, 3.7vw, 48px); line-height: 1.15; font-weight: 600; letter-spacing: -.04em; }
/* Mettre le mot essentiel en couleur sans italique. */
.login-intro h1 em { font-style: normal; color: #8dd9c8; }
/* Largeur de lecture et interligne du paragraphe. */
.login-intro-content > p { max-width: 340px; color: #c0cfde; font-size: 15px; line-height: 1.8; }
/* Etiquettes des modules avec retour a la ligne. */
.login-modules { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.login-modules span { border: 1px solid #ffffff26; border-radius: 6px; padding: 7px 10px; font-size: 9px; color: #dce7ee; }

/* Signature du volet et point decoratif. */
.login-intro-footer { margin: 0; color: #b9cbd8; font-size: 12px; display: flex; align-items: center; gap: 9px; }
.login-intro-footer span { width: 6px; height: 6px; border-radius: 50%; background: #8dd9c8; }
/* Centrage vertical du formulaire dans le volet blanc. */
.login-panel { display: flex; align-items: center; padding: 52px; min-width: 0; }
/* Largeur du conteneur du formulaire. */
.login-form-wrap { width: 100%; }
/* Alignement du cadenas et du texte introductif. */
.login-access { display: flex; align-items: center; gap: 8px; color: #536579; font-size: 12px; font-weight: 600; }
.login-access svg { width: 20px; height: 20px; color: #2366c5; }
/* Hierarchie visuelle du titre de bienvenue. */
.login-panel h2 { font-size: 36px; letter-spacing: -.04em; margin: 22px 0 10px; }
/* Consigne et espace avant les champs. */
.login-description { color: #667085; line-height: 1.7; font-size: 14px; margin: 0 0 30px; }
/* Espacement des elements et style des etiquettes. */
.login-form { gap: 10px; }
.login-form label { font-size: 13px; font-weight: 600; }
/* Dimensions et fond des champs. */
.login-form input { min-width: 0; height: 50px; border-radius: 9px; background: #fafbfd; font-size: 14px; }
/* Espace supplementaire apres l identifiant. */
.login-form > input { margin-bottom: 12px; }
/* Couleur du texte indicatif. */
.login-form input::placeholder { color: #7a8698; }
/* Contour visible pour la navigation au clavier. */
.login-page :is(input, button, a):focus-visible { outline: 3px solid #80b1fa; outline-offset: 3px; }
/* Reference de positionnement du bouton dans le champ. */
.login-password-field { position: relative; }
/* Reserver une place au bouton seulement s il est visible. */
.login-password-field:has(button:not([hidden])) input { padding-right: 90px; }
/* Position et apparence du bouton Afficher / Masquer. */
.login-password-toggle { position: absolute; right: 6px; top: 5px; height: 40px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: #215aa9; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
/* Retour visuel au survol. */
.login-password-toggle:hover { background: #eaf1fc; }
/* Bouton principal avec fleche alignee a droite. */
.login-form .login-submit { height: 50px; margin-top: 14px; border-radius: 9px; font-size: 14px; justify-content: space-between; padding: 0 18px; box-shadow: 0 5px 12px #1f6feb20; }
/* Taille de la fleche decorative. */
.login-submit span { font-size: 22px; }
/* Rappel discret sous le formulaire. */
.login-restricted { color: #667085; text-align: center; font-size: 11px; margin: 18px 0 30px; }
/* Separation du lien de configuration initiale. */
.login-install { border-top: 1px solid #e8edf3; padding-top: 22px; color: #667085; font-size: 12px; line-height: 1.8; }
.login-install a { font-weight: 600; display: inline-block; }
/* Acces public : bleu profond, accents turquoise et mention de maintenance contrastée. */
.login-public { margin: 18px 0 0; }
.login-public a { display: flex; align-items: center; gap: 12px; width: 100%; box-sizing: border-box; padding: 20px 18px; border-radius: 16px; background: linear-gradient(125deg, #122b46, #075e67); color: #fff; text-decoration: none; border: 1px solid #53cfc1; box-shadow: 0 8px 22px rgba(18, 43, 70, .18); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.login-public a:hover, .login-public a:focus-visible { border-color: #96f0df; box-shadow: 0 12px 28px rgba(7, 94, 103, .25); transform: translateY(-2px); color: #fff; }
.login-public a:focus-visible { outline: 3px solid #087f8c; outline-offset: 4px; }
.login-public-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #b7f5e9; }
.login-public-icon svg { width: 23px; height: 23px; }
.login-public-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; text-align: left; }
.login-public-text strong { color: #fff; font-size: 18px; line-height: 1.4; font-weight: 750; letter-spacing: .1px; }
.login-public-text small { display: inline-block; padding: 4px 8px; border-radius: 7px; background: #d5f5ee; color: #114b49; font-size: 10px; line-height: 1.5; font-weight: 750; letter-spacing: .25px; }
.login-public-arrow { flex-shrink: 0; color: #a5f3e0; font-size: 24px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .login-public a { transition: none; transform: none; } }
/* Tablettes et mobiles : empiler les volets et simplifier la presentation. */
@media (max-width: 800px) {
    .login-page { padding: 24px; }
    .login-shell { grid-template-columns: 1fr; max-width: 520px; min-height: auto; }
    .login-intro { padding: 28px; }
    .login-intro-content { padding: 28px 0 0; }
    .login-intro h1 { font-size: 32px; margin: 12px 0; }
    .login-intro-content > p { margin-bottom: 0; max-width: none; }
    .login-eyebrow, .login-modules, .login-intro-footer { display: none; }
    .login-panel { padding: 32px 28px; }
}
/* Tres petits ecrans : reduire les marges pour garder les champs lisibles. */
@media (max-width: 380px) {
    .login-page { padding: 12px; }
    .login-intro, .login-panel { padding: 24px 20px; }
}

/* Identité commune : navigation, surfaces et contrôles de tous les modules. */
:root {
    --bg: #f2f5f8;
    --text: #192d43;
    --muted: #607185;
    --primary: #087f83;
    --primary-dark: #06666a;
    --border: #dfe7ee;
    --shadow: 0 4px 20px rgba(24, 45, 67, .045);
}
body { line-height: 1.55; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid #149da7; outline-offset: 3px; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 10; padding: 12px 18px; background: white; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.app-shell { grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; padding: 32px 20px 24px; background: radial-gradient(ellipse at bottom left, #164653, transparent 65%), #11263a; gap: 40px; }
.sidebar .brand { padding: 0 6px; }
.brand-mark { flex-shrink: 0; background: linear-gradient(145deg, #139b9f, #17677e); box-shadow: 0 6px 14px #00000012; }
.brand strong { letter-spacing: .09em; }
.sidebar .brand small { font-size: 11px; color: #b1c3d2; }
.nav { gap: 7px; }
.nav a { display: flex; align-items: center; gap: 13px; padding: 13px 15px; font-size: 14px; border: 1px solid transparent; transition: background .18s, color .18s; }
.nav svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav a.active { color: #fff; background: #ffffff12; border-color: #ffffff18; box-shadow: inset 3px 0 #65d6c9; }
.nav a.active svg { color: #85e0d5; }
.nav a.archives-link, .nav a.archives-link svg { color: #ff8585; }
.nav a.archives-link:hover, .nav a.archives-link.active { color: #ffabab; background: #dc26261f; border-color: #ef44444d; }
.nav a.archives-link.active { box-shadow: inset 3px 0 #ff8585; }
.sidebar-footer { padding: 20px 12px 0; border-top: 1px solid #ffffff1c; font-size: 13px; overflow-wrap: anywhere; }
.logout { display: inline-flex; align-items: center; min-height: 44px; color: #d7e7ef; }
.main { min-width: 0; padding: 36px clamp(20px, 3vw, 48px); }
.topbar { margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--border); gap: 16px; }
.page-eyebrow { display: block; margin-bottom: 10px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.topbar h1 { letter-spacing: -.035em; font-weight: 750; }
.topbar p { font-size: 13px; max-width: 650px; }
.grid { gap: 20px; }
.cards, .two-cols { margin-bottom: 24px; }
.card, .panel { border-radius: 16px; }
.card { position: relative; overflow: hidden; padding: 24px; border-top: 3px solid var(--accent, #087f83); }
.card:nth-child(2) { --accent: #5279bb; }
.card:nth-child(3) { --accent: #ad7c32; }
.card:nth-child(4) { --accent: #8365ae; }
.card::after { content: ''; position: absolute; right: -16px; bottom: -24px; width: 85px; height: 85px; border: 16px solid var(--accent, #087f83); border-radius: 50%; opacity: .07; pointer-events: none; }
.card span { font-size: 13px; font-weight: 600; }
.card strong { font-size: clamp(2rem, 3vw, 2.6rem); line-height: 1.2; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.panel { padding: clamp(18px, 2.3vw, 30px); margin-bottom: 24px; min-width: 0; }
.two-cols > .panel { margin-bottom: 0; }
.panel h2 { font-size: 17px; letter-spacing: -.02em; margin-bottom: 20px; }
.toolbar { flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.toolbar p { margin: 0; font-size: 14px; }
.btn, button.btn { min-height: 44px; padding: 10px 17px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 650; transition: background .18s, box-shadow .18s; text-align: center; }
.btn:hover { background: #eef4f6; text-decoration: none; }
.btn.primary { box-shadow: 0 4px 9px #087f831c; }
.btn.primary:hover { background: var(--primary-dark); }
.toolbar > .btn.primary::before { content: '+'; font-size: 20px; font-weight: 400; line-height: 1; }
.search-form { min-width: 0; }
.search-form input { background: #f7f9fb; }
.table-responsive { border: 1px solid var(--border); border-radius: 12px; }
.table-responsive:focus-visible { outline-offset: 4px; }
.audit-table-scroll { max-height: 65vh; max-height: 65dvh; overflow: auto; }
.audit-table-scroll thead th { position: sticky; top: 0; z-index: 2; background: #f4f7fa; box-shadow: inset 0 -1px var(--border); }
@media print {
    .audit-table-scroll { max-height: none; overflow: visible; }
    .audit-table-scroll thead th { position: static; }
}
table { font-size: 13px; }
th { background: #f4f7fa; color: #51667b; font-size: 10px; font-weight: 750; padding: 6px 12px; white-space: nowrap; }
td { padding: 3px 12px; vertical-align: middle; line-height: 1.35; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fbfb; }
td:first-child { font-weight: 650; }
td.actions { display: table-cell; min-width: 180px; }
.actions a, .actions .link-danger { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.actions a:hover { background: #e8f4f3; text-decoration: none; }
.actions .link-danger:hover { background: #fff0ee; }
.form-grid { gap: 22px 28px; }
.form-grid > * { min-width: 0; }
.password-change { grid-column: 1 / -1; margin: 0; padding: 24px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 12px; }
.password-change legend { padding: 0 8px; font-weight: 600; color: var(--primary-dark); }
.password-change p { margin: 0 0 8px; }
.password-change input { width: 100%; max-width: 520px; }
.request-act-description { display: block; font-size: 12px; font-weight: 400; line-height: 1.45; margin-top: 4px; }
.request-table { width: 100%; }
.request-selected-table { min-width: 1050px; }
.request-selected-table input, .request-selected-table textarea { min-width: 160px; width: 100%; }
.request-selected-table select { min-width: 180px; }
.request-selected-table small { display: block; margin-top: 4px; }
#request-workspace > .panel { margin-top: 24px; }
#request-search { flex-wrap: wrap; }
.form-grid h2 { padding-bottom: 14px; border-bottom: 1px solid var(--border); margin: 8px 0 0; color: var(--primary-dark); }
label { font-size: 13px; font-weight: 600; gap: 8px; }
input, select, textarea { min-width: 0; min-height: 46px; border-radius: 9px; color: var(--text); transition: border-color .18s, box-shadow .18s; }
input:hover, select:hover, textarea:hover { border-color: #a8bac8; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #087f8310; }
input[type=checkbox] { min-height: auto; width: 18px; height: 18px; accent-color: var(--primary); }
.form-actions { margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--border); }
.detail-grid { gap: 16px; }
.detail-grid p { background: #f7f9fb; border-color: #e8edf2; overflow-wrap: anywhere; }
.detail-grid span { font-size: 12px; }
.bar-row, .chart-list div { align-items: center; padding: 14px 0; font-size: 14px; }
.bar-row:last-child, .chart-list div:last-child { border-bottom: 0; }
.bar-row strong, .chart-list b { min-width: 38px; padding: 3px 10px; border-radius: 7px; background: #eaf5f3; color: #086a65; text-align: center; font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 36px 20px; color: var(--muted); font-weight: 400; }
.auth-page { background: radial-gradient(ellipse at top left, #dcefeb, transparent 65%), #f1f5f8; }
.auth-card { padding: 36px; border-radius: 20px; box-shadow: 0 18px 60px #1633490d; }
.auth-card h1 { font-size: 26px; line-height: 1.25; letter-spacing: -.03em; margin-top: 28px; }
.auth-card > p { font-size: 14px; margin-bottom: 24px; }
.login-shell { border-color: #dfe7ee; box-shadow: 0 24px 70px #16334914; }
.login-access svg { color: var(--primary); }
.login-password-toggle { color: var(--primary-dark); }
.login-form .login-submit { box-shadow: 0 5px 12px #087f8320; }
@media (min-width: 1600px) { .main { width: 100%; max-width: 1600px; margin-inline: auto; } }
@media (max-width: 1200px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; padding: 20px 24px; gap: 20px; }
    .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .other-menu { grid-column: 1 / -1; }
    .sidebar-footer { margin: 0; padding: 12px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
    .main { padding: 28px 24px; }
    .two-cols, .form-grid, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-form { flex-direction: row; }
    .search-form input { max-width: none; }
}
@media (max-width: 640px) {
    .sidebar { padding: 18px 16px; gap: 16px; }
    .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nav a { font-size: 12px; padding: 10px; gap: 8px; }
    .nav svg { width: 18px; height: 18px; }
    .main { padding: 24px 14px; }
    .topbar { margin-bottom: 22px; padding-bottom: 20px; }
    .topbar h1 { font-size: 26px; }
    .cards { gap: 12px; }
    .card { padding: 17px 14px; }
    .card span { font-size: 12px; }
    .two-cols, .form-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .toolbar { align-items: stretch; }
    .search-form { flex-direction: column; }
    .form-actions { flex-wrap: wrap; }
    .form-actions .btn { flex: 1; }
    .panel { padding: 18px 14px; }
    input, select, textarea, .login-form input { font-size: 16px; }
    .auth-page { padding: 16px; }
    .auth-card { padding: 26px 22px; }
    .confirmation-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* Actions compactes sur ordinateur, cibles agrandies sur écran tactile. */
td.actions { min-width: 120px; white-space: nowrap; }
:is(.actions, td) .action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 4px;
    vertical-align: middle;
    border: 1px solid #d5e9e7;
    border-radius: 9px;
    background: #eff8f7;
    color: var(--primary-dark);
}
:is(.actions, td) .action-icon + .action-icon, :is(.actions, td) .action-icon + form { margin-left: 4px; }
:is(.actions, td) .action-icon svg { width: 15px; height: 15px; flex-shrink: 0; pointer-events: none; }
.actions .link-danger.action-icon { color: var(--danger); background: #fff5f3; border-color: #f4ddd8; }
:is(.actions, td) .action-icon:hover { background: #dcefeb; }
.actions .link-danger.action-icon:hover { background: #ffe5df; }
@media (pointer: coarse), (max-width: 640px) {
    :is(.actions, td) .action-icon { width: 44px; height: 44px; min-height: 44px; }
}

/* Pagination commune aux tableaux, avec retour à la ligne sur mobile. */
.pagination-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 20px; position: sticky; bottom: 0; z-index: 5; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 -6px 20px rgba(24, 45, 67, .12); }
/* clip évite de créer un conteneur de défilement qui bloquerait sticky. */
.main { overflow-x: clip; }
.table-responsive { scrollbar-color: var(--primary) #e2ecef; scrollbar-width: auto; }
.table-responsive::-webkit-scrollbar { height: 14px; }
.table-responsive::-webkit-scrollbar-track { background: #e2ecef; border-radius: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--primary); border: 3px solid #e2ecef; border-radius: 8px; }
.table-responsive::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }
.pagination-footer > p { margin: 0; font-size: 12px; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pagination .btn { min-width: 44px; padding: 8px 12px; }
.pagination .disabled { color: #7b8996; background: #f4f7fa; cursor: default; }
.pagination span.btn { cursor: default; }
.pagination-gap { color: var(--muted); padding: 0 2px; }
.conseil-member { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 8px 0; }
.conseil-member input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.conseil-history { max-height: 65dvh; overflow: auto; }
.conseil-history > section + section { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 24px; }
.collective-matricules-table { max-height: 55dvh; overflow: auto; scrollbar-gutter: stable; }
.collective-matricules-table thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }

/* Recherche fixe et deux zones de défilement indépendantes pour les matricules. */
.main:has(.matricule-workspace) { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.main:has(.matricule-workspace) > .topbar,
.main:has(.matricule-workspace) > .alert { flex: 0 0 auto; }
.matricule-workspace { flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.matricule-workspace > .panel { margin: 0; min-height: 0; padding: 14px 18px; }
.matricule-search p { margin: 0 0 10px; }
.matricule-search .form-grid { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.matricule-search .form-actions { grid-column: auto; margin: 0; }
.matricule-results, .matricule-selection { display: flex; flex-direction: column; overflow: hidden; }
.matricule-scroll { flex: 1; min-height: 0; min-width: 0; overflow: auto; scrollbar-gutter: stable; overscroll-behavior-y: contain; }
.matricule-scroll:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.matricule-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.matricule-results .pagination-footer { position: static; flex: 0 0 auto; margin-top: 8px; padding: 6px; box-shadow: none; }
@media (max-width: 980px), (max-height: 700px) {
    .main:has(.matricule-workspace) { height: auto; overflow: visible; }
    .matricule-workspace { flex: none; height: max(650px, 85dvh); }
}
@media (max-width: 640px) {
    .pagination-footer { flex-direction: column; align-items: flex-start; }
    .pagination { gap: 4px; }
    .pagination .btn { padding-inline: 9px; }
}

/* Hauteur de ligne uniforme pour tous les tableaux (reference : conseils de revision).
   Boutons et champs places dans les cellules sont compactes pour ne pas agrandir les lignes. */
td .btn, td button.btn { min-height: 26px; padding: 2px 10px; border-radius: 6px; font-size: 12px; line-height: 1.35; }
td input:not([type=checkbox]):not([type=radio]), td select { min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
td textarea { min-height: 28px; padding-top: 3px; padding-bottom: 3px; }
td form { display: inline; margin: 0; }
@media (pointer: coarse), (max-width: 640px) {
    td .btn, td button.btn { min-height: 44px; }
}

/* Choix du conseil de révision : filtres District / Année séparés, tri et liste complète. */
.revision-picker { grid-column: 1 / -1; margin: 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; }
.revision-picker legend { padding: 0 8px; font-weight: 600; color: var(--primary-dark); }
.revision-picker label:has([data-revision-select]), .revision-picker [data-revision-empty] { grid-column: 1 / -1; }
.revision-picker [data-revision-empty] { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 0; background: #fff8e6; }
.revision-picker [data-revision-empty][hidden] { display: none; }
@media (max-width: 640px) { .revision-picker { grid-template-columns: 1fr; } }
.revision-picker-actions { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.yes-no { margin: 0; padding: 0; border: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; }
.yes-no legend { width: 100%; padding: 0; margin-bottom: 8px; font-weight: 600; }
.yes-no label { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.yes-no input[type=radio] { width: 18px; height: 18px; min-height: auto; accent-color: var(--primary); }
/* Etat civil en lecture seule (informations de révision) : un seul cadre compact, sans carte par information. */
.detail-grid.detail-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 4px 0; border: 1px solid var(--border); border-radius: 12px; background: #f7f9fb; }
.detail-grid.detail-compact p { padding: 6px 14px; border: 0; border-radius: 0; background: transparent; line-height: 1.3; }
.detail-grid.detail-compact span { margin-bottom: 1px; font-size: 11px; }
.detail-grid.detail-compact strong { font-size: 13px; }
@media (max-width: 980px) { .detail-grid.detail-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .detail-grid.detail-compact { grid-template-columns: minmax(0, 1fr); } }
.trr-picker > .yes-no, .trr-picker > p, .trr-picker > label { grid-column: 1 / -1; margin: 0; }
.trr-picker > label { max-width: 320px; }

/* ==========================================================================
   Densité verticale réduite sur toutes les pages (placée en fin de fichier pour
   primer sur les règles précédentes). Les tailles tactiles restent à 44px.
   ========================================================================== */
.main { padding: 20px clamp(16px, 2.5vw, 40px); }
.topbar { margin-bottom: 16px; padding-bottom: 12px; gap: 10px; }
.topbar p { margin-top: 3px; }
.sidebar { padding: 22px 18px 18px; gap: 22px; }
.nav { gap: 4px; }
.nav a { padding: 9px 14px; }
.sidebar-footer { padding-top: 12px; }
.cards, .two-cols { margin-bottom: 14px; }
.card { padding: 14px 18px; }
.card span { margin-bottom: 6px; }
.panel { padding: clamp(12px, 1.6vw, 20px); margin-bottom: 14px; }
.panel h2 { margin-top: 0; margin-bottom: 10px; }
.panel > p, .panel > section > p { margin: 0 0 8px; }
.toolbar { gap: 10px; margin-bottom: 12px; }
.alert { padding: 8px 12px; margin-bottom: 12px; }
.form-grid { gap: 12px 20px; }
.form-grid h2 { padding-bottom: 6px; margin-top: 4px; }
label { gap: 4px; }
input, select, textarea { min-height: 36px; padding-top: 7px; padding-bottom: 7px; }
textarea { min-height: 70px; }
.btn, button.btn { min-height: 36px; padding-top: 7px; padding-bottom: 7px; }
.form-actions { margin-top: 4px; padding-top: 12px; }
.detail-grid { gap: 10px; }
.detail-grid p { padding: 9px 12px; }
.detail-grid span { margin-bottom: 2px; }
.bar-row, .chart-list div { padding: 8px 0; }
.empty-state { padding: 20px 16px; }
.pagination-footer { margin-top: 12px; padding: 8px 12px; gap: 8px; }
.pagination .btn { min-width: 36px; padding: 5px 10px; }
.password-change { padding: 14px 16px; gap: 8px; }
.revision-picker { padding: 10px 14px; gap: 8px 16px; }
.conseil-member { padding: 4px 0; }
.conseil-history > section + section { margin-top: 14px; padding-top: 14px; }
.auth-card { padding: 24px; }
@media (max-width: 980px) {
    .sidebar { padding: 14px 18px; gap: 12px; }
    .main { padding: 18px 18px; }
}
@media (max-width: 640px) {
    .sidebar { padding: 12px 12px; gap: 10px; }
    .nav a { padding: 8px 10px; }
    .main { padding: 14px 12px; }
    .topbar { margin-bottom: 12px; padding-bottom: 10px; }
    .panel { padding: 12px 12px; }
    .card { padding: 12px 12px; }
}
/* Écrans tactiles : cibles de 44px conservées pour rester faciles à toucher. */
@media (pointer: coarse) {
    .btn, button.btn, input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; }
    .pagination .btn { min-width: 44px; }
}
/* Parametres avances : liste de statut et bouton sur la meme ligne du tableau. */
.status-form { display: flex; align-items: center; gap: 6px; }
.status-form select { width: auto; min-width: 170px; }
/* Menu de gauche (Tableau de bord ... Paramètres avancés) : espacements verticaux resserrés. */
.nav { gap: 1px; }
.nav a, .other-menu summary { padding: 6px 12px; line-height: 1.25; gap: 10px; }
.nav svg, .other-menu summary svg { width: 18px; height: 18px; }
.nav .other-menu-items a { padding: 5px 12px; }
.sidebar { gap: 16px; padding-top: 16px; }
.sidebar-footer { padding-top: 10px; gap: 4px; }
@media (max-width: 640px) { .nav a, .other-menu summary { padding: 6px 8px; } }
/* Écran tactile : liens du menu un peu plus hauts pour rester faciles à toucher. */
@media (pointer: coarse) { .nav a, .other-menu summary { padding-top: 10px; padding-bottom: 10px; } }
/* En-tête de page figé (fil RECREV, titre, description, utilisateur connecté) et resserré. */
.main { padding-top: 0; }
.topbar { position: sticky; top: 0; z-index: 20; margin-bottom: 12px; padding: 10px 0 8px; gap: 8px 16px; align-items: center; background: var(--bg); box-shadow: 0 6px 10px -10px rgba(15, 23, 42, .35); }
.page-eyebrow { margin-bottom: 2px; }
.topbar h1 { font-size: clamp(1.25rem, 1.6vw, 1.6rem); line-height: 1.2; }
.topbar p { margin: 2px 0 0; line-height: 1.3; }
.connected-user { padding: 5px 12px; gap: 8px; border-radius: 10px; }
.connected-user svg { width: 22px; height: 22px; }
.connected-user strong { margin: 1px 0 0; }
.connected-user span { font-size: 11px; line-height: 1.2; }
/* Les ancres (#citoyens-revises, #citoyen-12...) ne passent pas sous l en-tête figé. */
[id] { scroll-margin-top: 110px; }
@media (max-width: 640px) {
    .topbar { padding: 8px 0 6px; }
    .topbar h1 { font-size: 20px; }
    .topbar p { display: none; }
    .connected-user { padding: 4px 10px; }
}
/* Cartes du tableau de bord (6 indicateurs) : autant de colonnes que la largeur le permet. */
.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* Récapitulatif des incorporés (page Citoyens incorporés) : petit tableau + liste de choix du statut. */
.incorporated-summary { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 12px; }
.incorporated-summary table { width: auto; min-width: 360px; border: 1px solid var(--border); border-radius: 10px; }
.incorporated-summary tfoot th { color: var(--text); font-size: 12px; text-transform: none; letter-spacing: 0; border-top: 1px solid var(--border); }
.incorporated-summary tr.is-selected td { background: #eaf5f3; font-weight: 700; }
.incorporated-summary .search-form { flex: 0 1 260px; }
@media (max-width: 640px) { .incorporated-summary table { min-width: 0; width: 100%; } }
/* Tableau de bord : listes longues (tous les districts) défilantes, total en bas, choix corps / affectation. */
.stat-scroll { max-height: 320px; overflow-y: auto; padding-right: 4px; }
.stat-total { font-weight: 700; border-top: 2px solid var(--border); }
.stat-scroll .stat-total { position: sticky; bottom: 0; background: var(--panel); }
.stat-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.stat-heading h2 { margin: 0; }
.stat-heading select { width: auto; }
.bar-row strong:has(.stat-zero) { background: #f1f4f7; color: #8a97a6; }
/* Champs masqués (ex. corps ou affectation selon le type d incorporation) : hidden l emporte sur display: grid. */
label[hidden] { display: none; }
/* Appel des recrues : critères de sélection sur une grille compacte. */
.selection-criteria { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 12px; }
.panel h3 { font-size: 14px; margin: 14px 0 8px; color: var(--primary-dark); }
/* Tableau de bord : contenu des cartes (libellé et nombre) centré. */
.cards .card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
/* Tableau de bord : liste d incorporation masquée (corps / affectation). */
.stat-scroll[hidden] { display: none; }
/* Outils : trois cadres côte à côte (Âge, Date 50 ans, Service effectué), empilés sur petit écran. */
.outils { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.5fr); gap: 16px; align-items: start; }
.outil { margin: 0; padding: 12px 16px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); display: grid; gap: 10px; justify-items: center; }
.outil > legend { padding: 0 8px; font-size: 20px; font-weight: 800; font-style: italic; color: var(--primary-dark); }
.outil label { width: 100%; text-align: center; }
.outil .btn { min-width: 150px; }
.outil-resultat { display: block; width: 100%; min-height: 36px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px; background: #f7f9fb; color: var(--text); font-weight: 700; text-align: center; resize: vertical; }
.outil-groupe { width: 100%; margin: 0; padding: 6px 12px 10px; border: 1px solid var(--border); border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.outil-groupe > legend { padding: 0 6px; font-weight: 700; font-style: italic; color: var(--primary); }
.outil-interruption { grid-template-columns: 1fr; border-color: #a21caf; }
.outil-interruption > legend { color: #a21caf; }
.outil-deux { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
@media (max-width: 1200px) { .outils { grid-template-columns: 1fr 1fr; } .outils > .outil:last-child { grid-column: 1 / -1; } }
@media (max-width: 640px) { .outils { grid-template-columns: 1fr; } .outil-groupe, .outil-deux { grid-template-columns: 1fr; } }
/* Écran CPSN (reprise WinDev) : recherche | état civil + recensement/révision | CPSN à délivrer. */
.cpsn-screen { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: start; }
.cpsn-col { margin: 0; display: grid; gap: 10px; }
.cpsn-search { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: end; }
.cpsn-search input[type="search"] { min-width: 0; width: 100%; }
.cpsn-search .cpsn-search-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; min-width: 40px; height: 40px; padding: 8px; }
.cpsn-search-icon svg { width: 20px; height: 20px; }
.cpsn-search label { grid-column: 1 / -1; }
.cpsn-search input::placeholder { color: #c0392b; font-weight: 600;font-size: 75%; }
.cpsn-results { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.cpsn-results > p { margin: 8px 10px; }
.cpsn-result { display: grid; padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--text); }
.cpsn-result:nth-child(even) { background: #f7f9fb; }
.cpsn-result small { color: var(--muted); }
.cpsn-result:hover, .cpsn-result.is-selected { background: #eaf5f3; text-decoration: none; }
.cpsn-result.is-selected { box-shadow: inset 3px 0 var(--primary); }
.cpsn-block { margin: 0; padding: 8px 12px 10px; border: 1px solid var(--border); border-radius: 12px; display: grid; gap: 4px; }
.cpsn-block > legend { padding: 0 6px; font-size: 16px; font-weight: 800; color: var(--primary); }
.cpsn-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; gap: 8px; }
.cpsn-field span { font-size: 12px; font-weight: 700; color: #51667b; }
.cpsn-field output { min-height: 26px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; background: #f7f9fb; font-size: 13px; overflow-wrap: anywhere; }
.cpsn-big { width: 100%; min-height: 42px; font-size: 15px; }
.cpsn-date { margin: 0; text-align: right; font-size: 18px; color: var(--muted); }
.cpsn-list h2 { text-align: center; text-decoration: underline; color: var(--primary); }
.cpsn-printed { margin: 0; padding-left: 20px; columns: 2; }
@media (max-width: 1200px) { .cpsn-screen { grid-template-columns: 1fr 1fr; } .cpsn-list { grid-column: 1 / -1; } }
@media (max-width: 640px) { .cpsn-screen { grid-template-columns: 1fr; } .cpsn-field { grid-template-columns: 1fr; } .cpsn-printed { columns: 1; } }
/* Petit formulaire placé à côté d un bouton (ex. « Imprimer un autre CPSN »). */
.inline-form { display: inline-block; margin: 0 0 0 6px; }
.alert > p { margin: 0 0 8px; }
/* Carrière : bloc « Service effectué » (classe, durée en lettres, bouton de calcul). */
/* Zone de saisie longue : toute la largeur du formulaire, hauteur confortable et agrandissable. */
.form-grid > .long-text { grid-column: 1 / -1; }
.long-text textarea { min-height: 220px; resize: vertical; white-space: pre-wrap; }
/* Service effectué non totalisé au moment d enregistrer : cadre et bouton mis en évidence. */
.service-effectue.service-missing { border-color: #c0392b; box-shadow: 0 0 0 3px #c0392b22; }
.service-effectue.service-missing [data-service-calc] { border-color: #c0392b; color: #c0392b; font-weight: 600; }
.service-effectue.service-missing [data-service-status] { color: #c0392b; font-weight: 600; }
.service-effectue { grid-column: 1 / -1; margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 8px 16px; align-items: end; }
.service-effectue legend { padding: 0 8px; font-weight: 600; color: var(--primary-dark); }
.service-effectue output { display: block; min-height: 36px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 9px; background: #f7f9fb; font-weight: 700; }
.service-effectue small { grid-column: 1 / -1; }
@media (max-width: 640px) { .service-effectue { grid-template-columns: 1fr; } }
/* Page de connexion : mention du développeur, discrète, sous le lien de configuration. */
/* .login-credit { margin: 14px 0 0; color: #98a2b3; font-size: 8px; text-align: center; letter-spacing: .02em; } */
.login-credit {
    margin: 14px 0 0;
    color: #98a2b3;
    font-size: 8px;
    text-align: center;
    letter-spacing: .02em;
    font-style: italic;
    font-family: "Arial Narrow", Arial, sans-serif;
    transition: all 0.3s ease;
    cursor: default;
}

.login-credit:hover {
    font-size: 11px;
    color: #ffffff;
    font-weight: 600;
    letter-spacing: .05em;
}
/* Recensement : enchaînement vers la révision ou l incorporation ; fiche : liens vers les dossiers de carrière. */
.recensement-suite { grid-column: 1 / -1; margin: 0; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.recensement-suite legend { padding: 0 8px; font-weight: 600; color: var(--primary-dark); }
.recensement-suite p { flex-basis: 100%; margin: 0; }
.career-links { margin: 0 0 8px; padding-left: 20px; }
.brand-title {
    font-family: "Cooper Black", Cooper, serif;
}

.brand-subtitle {
    font-style: italic;
}

/* UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU */

.login-brand {
    position: relative;
}

.login-brand::after {
    content: attr(data-tooltip);

    position: absolute;
    top: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);

    width: 240px;
    padding: 1px 1px;

    background: rgba(17, 24, 39, 0.95);
    color: #fff;

    font-family: "Arial Narrow", Arial, sans-serif;
    font-size: 8px;
    line-height: 1.35;
    text-align: center;
    white-space: pre-line;

    border-radius: 6px;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1000;
}

.login-brand:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.frr-picker { display: grid; gap: 12px; min-width: 0; }
.frr-preview { display: flex; align-items: center; justify-content: center; min-height: 160px; border: 1px dashed #8292a6; background: #f5f7fa; cursor: pointer; padding: 12px; }
.frr-preview img { max-width: 100%; height: 180px; object-fit: contain; }
.frr-preview img[hidden], .frr-preview span[hidden] { display: none; }
.frr-thumbnail { width: 64px; height: 72px; object-fit: contain; border: 1px solid #ccd3dd; border-radius: 4px; }
.frr-dialog { width: min(1100px, 94vw); max-height: 94vh; padding: 20px; border: 0; border-radius: 8px; }
.frr-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.frr-dialog [data-frr-large] { display: block; max-width: 100%; height: auto; margin: auto; }
.frr-cell:has(a) { cursor: pointer; }
.frr-cell a { display: block; }
.frr-dialog [hidden] { display: none !important; }
.date-picker-input[type="date"]::-webkit-calendar-picker-indicator { display:none; }
.date-picker-field { display:flex; align-items:center; gap:6px; width:100%; }
.date-picker-field input { flex:1; min-width:0; }
.date-picker-calendar { display:inline-flex; align-items:center; justify-content:center; flex:none; width:36px; height:36px; padding:7px; border:1px solid var(--border); border-radius:6px; background:var(--panel); color:var(--text); cursor:pointer; }
.date-picker-calendar svg { width:20px; height:20px; }
.date-picker-calendar:hover { background:var(--bg); }
.date-picker-calendar:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
.date-picker-dialog { width:min(480px, calc(100vw - 32px)); padding:24px; border:1px solid #cbd5e1; border-radius:12px; }
.date-picker-dialog::backdrop { background:rgb(0 0 0 / 40%); }
.date-picker-dialog h2 { margin:0 0 18px; font-size:20px; }
.attestation-dialog form { display:grid; gap:12px; }
.attestation-dialog label input, .attestation-dialog label textarea { width:100%; box-sizing:border-box; }
.attestation-dialog .form-actions { margin-top:6px; }
.date-picker-parts { display:grid; grid-template-columns:1fr 1.4fr 1fr; gap:12px; }
.date-picker-parts label { display:flex; flex-direction:column; gap:6px; min-width:0; }
.date-picker-parts input, .date-picker-parts select { width:100%; box-sizing:border-box; }
.date-picker-actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; margin-top:16px; }
.date-picker-error { color:#b91c1c; font-size:14px; }
/* Paramètres avancés > Autorisations par rôle. */
.permission-grid td.permission-cell { text-align:center; white-space:nowrap; }
.permission-grid thead th { text-align:center; white-space:nowrap; }
.permission-grid thead th:first-child, .permission-grid td:first-child { text-align:left; }
.permission-grid tr.permission-module th { text-align:left; background:var(--surface-muted, #f1f5f9); color:var(--primary-dark); }
.permission-grid input[type=checkbox] { width:18px; height:18px; }
/* Fiche du citoyen : champ modifié en rouge ; au survol (ou au focus clavier), ancienne valeur, auteur et rôle. */
.field-changed, .detail-grid .field-changed, .detail-grid.detail-compact .field-changed { position: relative; display: inline; margin: 0; color: #c62828; font-size: inherit; font-weight: 700; cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.field-changed:focus-visible { outline: 2px solid #c62828; outline-offset: 2px; border-radius: 3px; }
/* Fenêtre d historique (field-history.js) : placée dans l écran, défilement si l historique est long. */
.field-history-pop { position: fixed; z-index: 60; width: max-content; max-width: min(420px, calc(100vw - 16px)); overflow-y: auto; overscroll-behavior: contain;
    padding: 10px 12px; border-radius: 8px; background: #1f2937; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.45;
    white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 8px 24px rgba(15, 23, 42, .3); scrollbar-color: #94a3b8 #1f2937; }
.field-history-pop[hidden] { display: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media print { .field-changed { color: inherit; text-decoration: none; } .field-history-pop { display: none !important; } }
/* Autorisations par rôle : ligne des titres figée pendant le défilement vertical du tableau. */
.permission-scroll { max-height: 70vh; max-height: 70dvh; overflow: auto; }
.permission-scroll .permission-grid thead th { position: sticky; top: 0; z-index: 2; background: #f4f7fa; box-shadow: inset 0 -1px var(--border); }
@media print { .permission-scroll { max-height: none; overflow: visible; } }
.permission-custom { color:#b45309; font-size:12px; margin-left:4px; }
.table-export-actions { display:inline-flex; flex-wrap:wrap; align-items:center; gap:8px; }
.table-export-actions small { font-size:12px; }

/* Synchronisation : mot de passe avec bouton Afficher / Masquer sur la même ligne. */
.password-field { display: flex; gap: 8px; align-items: center; }
.password-field input { flex: 1; min-width: 0; }
