/* ================================================================
   YASSINE — Système de design
   Inspiré du gabarit d'administration « Conca » : fond sombre,
   accent violet, cartes arrondies, barre latérale rétractable.
   Thème sombre par défaut, thème clair via [data-theme="light"].
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── Accents (identiques dans les deux thèmes) ── */
    --violet:       #7367f0;
    --violet-clair: #8f85f3;
    --violet-dim:   rgba(115, 103, 240, .16);
    --vert:         #28c76f;
    --vert-dim:     rgba(40, 199, 111, .16);
    --orange:       #ff9f43;
    --orange-dim:   rgba(255, 159, 67, .16);
    --rouge:        #ea5455;
    --rouge-dim:    rgba(234, 84, 85, .16);
    --bleu:         #00cfe8;
    --bleu-dim:     rgba(0, 207, 232, .16);
    --jaune:        #f2c94c;
    --jaune-dim:    rgba(242, 201, 76, .16);

    /* ── Thème sombre (défaut) ── */
    --fond:     #16161e;
    --fond-2:   #1e1e29;
    --fond-3:   #272733;
    --barre:    #1e1e29;
    --bordure:  rgba(255, 255, 255, .07);
    --texte:    #e5e5f0;
    --texte-2:  #a2a2b8;
    --texte-3:  #6e6e86;
    --ombre:    0 4px 24px rgba(0, 0, 0, .30);
    --ombre-sm: 0 2px 8px rgba(0, 0, 0, .22);
    --violet-ombre: 0 4px 14px rgba(115, 103, 240, .35);

    /* ── Géométrie ── */
    --r-s: 8px;
    --r-m: 12px;
    --r-l: 16px;
    --trans: .18s ease;
    --sb-l: 250px;   /* barre latérale déployée */
    --sb-c: 76px;    /* barre latérale rétractée */
    --topbar-h: 62px;

    --police:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --police-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Courier New', monospace;
    --suivi: .06em;
}

[data-theme="light"] {
    --fond:     #f4f5fa;
    --fond-2:   #ffffff;
    --fond-3:   #f1f2f7;
    --barre:    #ffffff;
    --bordure:  rgba(47, 43, 61, .11);
    --texte:    #2f2b3d;
    --texte-2:  #6f6b7d;
    --texte-3:  #a5a3ae;
    --ombre:    0 4px 18px rgba(47, 43, 61, .10);
    --ombre-sm: 0 2px 8px rgba(47, 43, 61, .08);
}

/* ── Base ─────────────────────────────────────────────────────── */
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--police);
    background: var(--fond);
    color: var(--texte);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--violet); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--violet-clair); }

.icone { flex-shrink: 0; display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fond-3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--texte-3); }

/* ── Charpente ────────────────────────────────────────────────── */
.contenu {
    margin-left: var(--sb-l);
    min-height: 100vh;
    transition: margin-left var(--trans);
}
html.sb-reduite .contenu { margin-left: var(--sb-c); }

.page { padding: 1.5rem 1.75rem 3rem; max-width: 1500px; }

/* ── Barre latérale ───────────────────────────────────────────── */
.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sb-l);
    display: flex; flex-direction: column;
    background: var(--barre);
    border-right: 1px solid var(--bordure);
    z-index: 200;
    transition: width var(--trans), transform var(--trans);
}
html.sb-reduite .sidebar { width: var(--sb-c); }

.sb-tete {
    display: flex; align-items: center; gap: .7rem;
    height: var(--topbar-h); padding: 0 1.1rem; flex-shrink: 0;
}
.sb-marque {
    display: flex; align-items: center; gap: .7rem;
    color: var(--texte); font-weight: 700; font-size: 1.05rem;
    letter-spacing: -.01em; white-space: nowrap; overflow: hidden;
}
.sb-marque:hover { color: var(--texte); }
.sb-logo {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--violet), var(--violet-clair));
    color: #fff; font-weight: 800; font-size: .78rem;
    box-shadow: var(--violet-ombre);
}
.sb-reduire {
    margin-left: auto; background: none; border: none; cursor: pointer;
    color: var(--texte-3); padding: .3rem; border-radius: var(--r-s);
    display: flex; transition: color var(--trans), background var(--trans);
}
.sb-reduire:hover { color: var(--violet); background: var(--violet-dim); }
.sb-reduire .icone { transition: transform var(--trans); }
/* Réduite : la marque s'efface pour laisser la place au bouton, qui reste
   visible et pointe désormais vers la droite — c'est lui qui redéploie. */
html.sb-reduite .sb-marque { display: none; }
html.sb-reduite .sb-tete { padding: 0 1.2rem; justify-content: center; }
html.sb-reduite .sb-reduire { margin-left: 0; }
html.sb-reduite .sb-reduire .icone { transform: rotate(180deg); }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: .5rem .75rem 1.5rem; }

.sb-section {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-3);
    padding: 1.1rem .75rem .45rem; white-space: nowrap;
}
html.sb-reduite .sb-section { text-align: center; padding: 1.1rem 0 .45rem; font-size: 0; }
html.sb-reduite .sb-section::after { content: '•••'; font-size: .6rem; letter-spacing: .1em; }

.sb-lien {
    display: flex; align-items: center; gap: .8rem;
    padding: .62rem .75rem; margin-bottom: .18rem;
    border-radius: var(--r-s);
    color: var(--texte-2); font-size: .875rem; font-weight: 500;
    white-space: nowrap; overflow: hidden;
    transition: background var(--trans), color var(--trans);
}
.sb-lien:hover { background: var(--fond-3); color: var(--texte); }
.sb-lien.actif {
    background: linear-gradient(270deg, var(--violet-clair), var(--violet));
    color: #fff; box-shadow: var(--violet-ombre);
}
.sb-lien.actif:hover { color: #fff; }
html.sb-reduite .sb-lien { justify-content: center; padding: .62rem 0; }
html.sb-reduite .sb-lien span { display: none; }

.sb-pied { padding: .75rem; border-top: 1px solid var(--bordure); flex-shrink: 0; }
.sb-utilisateur {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .6rem; border-radius: var(--r-s); overflow: hidden;
}
.sb-utilisateur-nom { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.sb-utilisateur-role { font-size: .72rem; color: var(--texte-3); white-space: nowrap; }
html.sb-reduite .sb-utilisateur { justify-content: center; padding: .5rem 0; }
html.sb-reduite .sb-utilisateur > div { display: none; }

.sb-version {
    margin-top: .4rem; text-align: center;
    font-size: .68rem; font-family: var(--police-mono); color: var(--texte-3);
}

.pastille {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--violet-dim); color: var(--violet);
    font-size: .74rem; font-weight: 700; letter-spacing: .02em;
}

/* ── Barre supérieure ─────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 150;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: .6rem;
    padding: 0 1.75rem;
    background: var(--fond);
    border-bottom: 1px solid var(--bordure);
}
.tb-espace { flex: 1; }

.btn-icone {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    background: none; border: none; cursor: pointer;
    border-radius: var(--r-s); color: var(--texte-2);
    transition: background var(--trans), color var(--trans);
}
.btn-icone:hover { background: var(--violet-dim); color: var(--violet); }
.btn-icone.actif { background: var(--violet-dim); color: var(--violet); }
.btn-icone.danger:hover { background: var(--rouge-dim); color: var(--rouge); }

.tb-burger { display: none; }

/* ── Titres et fil d'Ariane ───────────────────────────────────── */
.entete-page {
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap; margin-bottom: 1.5rem;
}
.titre-page { font-size: 1.4rem; font-weight: 700; letter-spacing: -.015em; }
.fil-ariane { font-size: .78rem; color: var(--texte-3); margin-bottom: .3rem; }
.fil-ariane a { color: var(--texte-2); }
.fil-ariane a:hover { color: var(--violet); }
.sous-titre { font-size: .85rem; color: var(--texte-2); margin-top: .15rem; }

/* ── Boutons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .58rem 1.1rem; border: 1px solid transparent;
    border-radius: var(--r-s); font-family: var(--police);
    font-size: .84rem; font-weight: 600; cursor: pointer;
    white-space: nowrap; line-height: 1.35;
    transition: background var(--trans), color var(--trans), border-color var(--trans), box-shadow var(--trans), transform var(--trans);
}
.btn:active { transform: translateY(1px); }
.btn-primaire {
    background: var(--violet); color: #fff; border-color: var(--violet);
    box-shadow: var(--violet-ombre);
}
.btn-primaire:hover { background: var(--violet-clair); border-color: var(--violet-clair); color: #fff; }
.btn-fantome { background: transparent; color: var(--texte-2); border-color: var(--bordure); }
.btn-fantome:hover { background: var(--fond-3); color: var(--texte); }
.btn-danger { background: transparent; color: var(--rouge); border-color: var(--rouge); }
.btn-danger:hover { background: var(--rouge-dim); color: var(--rouge); }
.btn-pt { padding: .4rem .8rem; font-size: .78rem; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Cartes ───────────────────────────────────────────────────── */
.carte {
    background: var(--fond-2);
    border: 1px solid var(--bordure);
    border-radius: var(--r-l);
    box-shadow: var(--ombre-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.carte-entete {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1.05rem 1.35rem;
    border-bottom: 1px solid var(--bordure);
}
.carte-titre { font-size: .95rem; font-weight: 600; letter-spacing: -.01em; }
.carte-corps { padding: 1.35rem; }
.carte-corps.sans-marge { padding: 0; }

/* ── Tuiles de statistiques ───────────────────────────────────── */
.grille-tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.grille-tuiles.trois { grid-template-columns: repeat(3, 1fr); }

.tuile {
    background: var(--fond-2);
    border: 1px solid var(--bordure);
    border-radius: var(--r-l);
    box-shadow: var(--ombre-sm);
    padding: 1.25rem 1.35rem;
    display: flex; flex-direction: column; gap: .55rem;
}
.tuile-pastille {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--violet-dim); color: var(--violet);
}
.tuile-pastille.vert   { background: var(--vert-dim);   color: var(--vert); }
.tuile-pastille.rouge  { background: var(--rouge-dim);  color: var(--rouge); }
.tuile-pastille.orange { background: var(--orange-dim); color: var(--orange); }
.tuile-pastille.bleu   { background: var(--bleu-dim);   color: var(--bleu); }
.tuile-libelle { font-size: .8rem; color: var(--texte-2); }
.tuile-valeur { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.tuile-valeur.petite { font-size: 1rem; font-family: var(--police-mono); font-weight: 600; }
.tuile-note { font-size: .75rem; color: var(--texte-3); }

/* ── Cartes de module ─────────────────────────────────────────── */
.grille-modules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.carte-module {
    display: flex; flex-direction: column; gap: .7rem;
    padding: 1.5rem; min-height: 176px;
    background: var(--fond-2); border: 1px solid var(--bordure);
    border-radius: var(--r-l); box-shadow: var(--ombre-sm);
    color: var(--texte);
    transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans);
}
.carte-module:hover {
    border-color: var(--violet); box-shadow: var(--ombre); color: var(--texte);
    transform: translateY(-3px);
}
.carte-module-nom { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.carte-module-desc { font-size: .8rem; color: var(--texte-2); line-height: 1.5; flex: 1; }
.carte-module-vide { opacity: .45; border-style: dashed; box-shadow: none; pointer-events: none; }

/* ── État vide (module sans contenu) ──────────────────────────── */
.etat-vide {
    display: flex; flex-direction: column; align-items: center;
    gap: .8rem; text-align: center; padding: 2.5rem 1.5rem;
}
.etat-vide-pastille {
    width: 60px; height: 60px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    background: var(--violet-dim); color: var(--violet);
}
.etat-vide-titre { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.etat-vide-texte { font-size: .85rem; color: var(--texte-2); max-width: 420px; line-height: 1.6; }

/* ── Tableaux ─────────────────────────────────────────────────── */
.table-enveloppe { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: .84rem; }
.tableau th {
    text-align: left; padding: .8rem 1.1rem; white-space: nowrap;
    font-size: .7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-2);
    background: var(--fond-3); border-bottom: 1px solid var(--bordure);
    position: sticky; top: 0; z-index: 5;
}
.tableau td { padding: .8rem 1.1rem; border-bottom: 1px solid var(--bordure); vertical-align: top; }
.tableau tbody tr { transition: background var(--trans); }
.tableau tbody tr:hover { background: var(--fond-3); }
.tableau tbody tr:last-child td { border-bottom: none; }
.td-mono { font-family: var(--police-mono); font-size: .76rem; color: var(--texte-2); white-space: nowrap; }
.td-vide { color: var(--texte-3); }
.td-lien { font-weight: 600; }

/* Ligne entière cliquable : le lien de la ligne reste la cible du clavier. */
.tableau tbody tr[data-lien] { cursor: pointer; }
.tableau tbody tr[data-lien]:has(.td-lien:focus-visible) { background: var(--fond-3); }

/* Variante « feuille de calcul » : quadrillage complet, comme dans Excel. */
.tableau-excel { border: 1px solid var(--bordure); }
.tableau-excel th, .tableau-excel td { border-right: 1px solid var(--bordure); }
.tableau-excel th:last-child, .tableau-excel td:last-child { border-right: none; }
.tableau-excel tbody tr:nth-child(even) { background: var(--fond-3); }
.tableau-excel tbody tr:hover { background: var(--violet-dim); }

/* ── Étiquettes ───────────────────────────────────────────────── */
.etiquette {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .6rem; border-radius: 6px;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.etiquette-violet { background: var(--violet-dim); color: var(--violet); }
.etiquette-vert   { background: var(--vert-dim);   color: var(--vert); }
.etiquette-rouge  { background: var(--rouge-dim);  color: var(--rouge); }
.etiquette-orange { background: var(--orange-dim); color: var(--orange); }
.etiquette-bleu   { background: var(--bleu-dim);   color: var(--bleu); }
.etiquette-jaune  { background: var(--jaune-dim);  color: var(--jaune); }
.etiquette-neutre { background: var(--fond-3);     color: var(--texte-2); }

/* ── Répartition (barre empilée) ──────────────────────────────── */
.repartition { margin-bottom: 1.75rem; }
.repartition-titre { font-size: .8rem; font-weight: 600; color: var(--texte-2); margin-bottom: .65rem; }
.repartition-barre {
    display: flex; height: 22px; gap: 2px;
    background: var(--fond-3); border-radius: 11px; overflow: hidden;
}
.repartition-segment { height: 100%; }
.repartition-legende { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: .65rem; font-size: .78rem; color: var(--texte-2); }
.repartition-legende span { display: inline-flex; align-items: center; gap: .4rem; }
.repartition-legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Classement (barres horizontales) ─────────────────────────── */
.classement { margin-bottom: 1.75rem; }
.classement-ligne { display: flex; align-items: center; gap: .85rem; margin-bottom: .55rem; }
.classement-ligne:last-child { margin-bottom: 0; }
.classement-nom {
    width: 150px; flex-shrink: 0; font-size: .82rem; color: var(--texte-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.classement-piste { flex: 1; height: 14px; background: var(--violet-dim); border-radius: 7px; overflow: hidden; }
.classement-remplissage { height: 100%; background: var(--violet); border-radius: 7px; }
.classement-valeur {
    width: 30px; text-align: right; font-family: var(--police-mono); font-size: .8rem;
    color: var(--texte); font-variant-numeric: tabular-nums;
}

/* ── Jeu du serpent ────────────────────────────────────────────── */
.jeu-serpent {
    display: flex; flex-direction: column; align-items: center; gap: .9rem;
    padding-top: 1.5rem; border-top: 1px solid var(--bordure);
}
.serpent-tableau { position: relative; line-height: 0; }
#serpent-canvas {
    display: block; max-width: 100%; height: auto;
    background: var(--fond); border: 1px solid var(--bordure); border-radius: var(--r-s);
}
.serpent-voile {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: .75rem;
    background: rgba(0, 0, 0, .6); border-radius: var(--r-s); text-align: center; padding: 1rem;
}
.serpent-message { color: #fff; font-size: .85rem; font-weight: 600; max-width: 220px; line-height: 1.5; }
.serpent-pied {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 1.25rem; font-size: .8rem;
}
.serpent-score { font-family: var(--police-mono); font-weight: 600; color: var(--texte); }
.serpent-note { color: var(--texte-3); }

/* ── Calculatrice ─────────────────────────────────────────────── */
.calculatrice { display: flex; flex-direction: column; gap: .75rem; max-width: 300px; margin: 0 auto; scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.calc-affichage {
    background: var(--fond); border: 1px solid var(--bordure); border-radius: var(--r-s);
    padding: .9rem 1rem; text-align: right; font-family: var(--police-mono);
    font-size: 1.7rem; color: var(--texte); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.calc-grille { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.calc-touche {
    padding: .75rem 0; border-radius: var(--r-s); border: 1px solid var(--bordure);
    background: var(--fond-3); color: var(--texte); font-size: 1rem; font-family: var(--police);
    cursor: pointer; transition: background var(--trans), transform var(--trans);
}
.calc-touche:hover { background: var(--fond-2); }
.calc-touche:active { transform: scale(.94); }
.calc-touche-operateur { background: var(--violet-dim); color: var(--violet-clair); font-weight: 600; }
.calc-touche-egal { background: var(--violet); border-color: var(--violet); color: #fff; font-weight: 600; }
.calc-touche-fonction { background: var(--rouge-dim); color: var(--rouge); }
.calc-touche-large { grid-column: span 2; }

/* ── Formulaires ──────────────────────────────────────────────── */
.champ-saisie, .champ-liste, textarea.champ-saisie {
    width: 100%; padding: .58rem .85rem;
    background: var(--fond); border: 1px solid var(--bordure);
    border-radius: var(--r-s); color: var(--texte);
    font-family: var(--police); font-size: .85rem; outline: none;
    transition: border-color var(--trans), box-shadow var(--trans);
}
[data-theme="light"] .champ-saisie,
[data-theme="light"] .champ-liste { background: var(--fond-2); }
.champ-saisie:focus, .champ-liste:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-dim); }
.champ-saisie::placeholder { color: var(--texte-3); }
textarea.champ-saisie { resize: vertical; min-height: 90px; line-height: 1.6; }

.champ-liste {
    appearance: none; padding-right: 2.1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a2a2b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .8rem center;
}

.grille-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.15rem; }
.champ { display: flex; flex-direction: column; gap: .35rem; }
.champ.pleine-largeur { grid-column: 1 / -1; }
.champ label { font-size: .78rem; font-weight: 600; color: var(--texte-2); }
.champ .aide { font-size: .72rem; color: var(--texte-3); }
.actions-form { display: flex; gap: .6rem; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; }

.barre-filtres {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: .85rem;
    margin-bottom: 1.5rem;
}
.champ-filtre { display: flex; flex-direction: column; gap: .35rem; }
.champ-filtre label { font-size: .78rem; font-weight: 600; color: var(--texte-2); }
.barre-filtres .champ-saisie, .barre-filtres .champ-liste { min-width: 190px; }

/* ── Calendrier des audits ────────────────────────────────────── */
.cal-entete { flex-wrap: wrap; gap: .75rem; }
.cal-nav { display: flex; align-items: center; gap: .6rem; }
.cal-titre { min-width: 160px; text-align: center; text-transform: capitalize; }

.cal-jours-entete {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--bordure);
}
.cal-jours-entete div {
    padding: .7rem .5rem; text-align: center;
    font-size: .74rem; font-weight: 600; color: var(--texte-3);
    text-transform: uppercase; letter-spacing: var(--suivi);
}

.cal-grille { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-jour {
    display: flex; flex-direction: column; align-items: stretch; gap: .4rem;
    min-height: 92px; padding: .55rem .5rem; text-align: left;
    background: transparent; border: none;
    border-right: 1px solid var(--bordure); border-bottom: 1px solid var(--bordure);
    font-family: var(--police); color: var(--texte); cursor: default;
    transition: background var(--trans);
}
.cal-grille .cal-jour:nth-child(7n) { border-right: none; }
.cal-jour-numero { font-size: .82rem; font-weight: 600; }
.cal-jour-hors .cal-jour-numero { color: var(--texte-3); }
.cal-jour-aujourdhui .cal-jour-numero {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--violet); color: #fff;
}
.cal-jour-rempli { cursor: pointer; }
.cal-jour-rempli:hover { background: var(--fond-3); }
.cal-jour:disabled { cursor: default; }

.cal-jour-puces { display: flex; flex-direction: column; gap: .25rem; }
.cal-puce {
    display: block; padding: .15rem .45rem; border-radius: 5px;
    font-size: .68rem; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.cal-puce-plus { font-size: .68rem; color: var(--texte-3); padding-left: .15rem; }

/* ── Modale ───────────────────────────────────────────────────── */
.modale-fond {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .55); padding: 1.5rem;
}
.modale-fond[hidden] { display: none; }
.modale {
    width: 100%; max-width: 460px; max-height: 80vh;
    background: var(--fond-2); border: 1px solid var(--bordure);
    border-radius: var(--r-m); box-shadow: var(--ombre);
    display: flex; flex-direction: column; overflow: hidden;
}
.modale-entete {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--bordure);
}
.modale-titre { font-size: .95rem; font-weight: 600; text-transform: capitalize; }
.modale-corps { padding: .6rem; overflow-y: auto; }

.cal-modale-ligne {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem .85rem; border-radius: var(--r-s); color: var(--texte);
    transition: background var(--trans);
}
.cal-modale-ligne:hover { background: var(--fond-3); }
.cal-modale-modele { font-size: .86rem; font-weight: 600; }
.cal-modale-details { font-size: .76rem; color: var(--texte-2); margin-top: .15rem; }

/* ── Messages ─────────────────────────────────────────────────── */
.message {
    display: flex; align-items: center; gap: .6rem;
    padding: .8rem 1.1rem; border-radius: var(--r-s);
    border: 1px solid transparent; font-size: .85rem; margin-bottom: 1.5rem;
}
.message-succes { border-color: var(--vert);  background: var(--vert-dim);  color: var(--vert); }
.message-erreur { border-color: var(--rouge); background: var(--rouge-dim); color: var(--rouge); }

/* ── Fiche : liste de définitions ─────────────────────────────── */
.liste-defs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.15rem 1.75rem; }
.liste-defs .pleine-largeur { grid-column: 1 / -1; }
.def-libelle { font-size: .74rem; font-weight: 600; color: var(--texte-3); margin-bottom: .25rem; }
.def-valeur { font-size: .875rem; line-height: 1.55; }

/* ── Page de connexion ────────────────────────────────────────── */
.page-connexion {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(115,103,240,.20), transparent 60%),
        radial-gradient(700px 450px at 100% 110%, rgba(0,207,232,.12), transparent 60%),
        var(--fond);
}
.bloc-connexion {
    width: 100%; max-width: 400px; padding: 2.4rem 2.1rem;
    background: var(--fond-2); border: 1px solid var(--bordure);
    border-radius: var(--r-l); box-shadow: var(--ombre);
}
.connexion-marque {
    display: flex; align-items: center; justify-content: center; gap: .7rem;
    margin-bottom: 1.3rem;
}
.connexion-logo {
    width: 46px; height: 46px; border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--violet), var(--violet-clair));
    color: #fff; font-weight: 800; font-size: .95rem;
    box-shadow: var(--violet-ombre);
}
.connexion-nom { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.connexion-accroche { font-size: .85rem; color: var(--texte-2); margin-bottom: 1.6rem; text-align: center; }
.champ-connexion { text-align: left; margin-bottom: 1rem; }
.champ-connexion label { display: block; font-size: .78rem; font-weight: 600; color: var(--texte-2); margin-bottom: .35rem; }
.enveloppe-mdp { position: relative; }
.enveloppe-mdp .champ-saisie { padding-right: 2.6rem; }
.bascule-mdp {
    position: absolute; right: .55rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; padding: .25rem; cursor: pointer;
    color: var(--texte-3); border-radius: 6px; display: flex;
    transition: color var(--trans);
}
.bascule-mdp:hover { color: var(--violet); }
.connexion-erreur {
    display: flex; align-items: center; gap: .5rem;
    font-size: .82rem; color: var(--rouge);
    background: var(--rouge-dim); border-radius: var(--r-s);
    padding: .6rem .8rem; margin-bottom: 1rem;
}
.connexion-pied { margin-top: 1.4rem; font-size: .75rem; color: var(--texte-3); text-align: center; }

/* ── Voile mobile ─────────────────────────────────────────────── */
.voile { display: none; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .grille-tuiles, .grille-modules { grid-template-columns: repeat(2, 1fr); }
    .grille-tuiles.trois { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--ombre); }
    html.sb-ouverte .sidebar { transform: translateX(0); }
    /* Sur petit écran la barre s'ouvre par-dessus la page : le repli n'a plus
       de sens, on annule tout ce que la classe impose. */
    html.sb-reduite .sidebar { width: var(--sb-l); }
    html.sb-reduite .sb-marque { display: flex; }
    html.sb-reduite .sb-marque .sb-nom { display: inline; }
    html.sb-reduite .sb-tete { padding: 0 1.1rem; justify-content: flex-start; }
    html.sb-reduite .sb-reduire { margin-left: auto; }
    html.sb-reduite .sb-reduire .icone { transform: none; }
    html.sb-reduite .sb-lien { justify-content: flex-start; padding: .62rem .75rem; }
    html.sb-reduite .sb-lien span { display: inline; }
    html.sb-reduite .sb-section { text-align: left; padding: 1.1rem .75rem .45rem; font-size: .68rem; }
    html.sb-reduite .sb-section::after { content: none; }
    html.sb-reduite .sb-utilisateur { justify-content: flex-start; padding: .5rem .6rem; }
    html.sb-reduite .sb-utilisateur > div { display: block; }
    .contenu, html.sb-reduite .contenu { margin-left: 0; }
    .tb-burger { display: inline-flex; }
    html.sb-ouverte .voile {
        display: block; position: fixed; inset: 0;
        background: rgba(0, 0, 0, .5); z-index: 190;
    }
    .grille-tuiles.trois { grid-template-columns: repeat(2, 1fr); }
    .page { padding: 1.25rem 1.1rem 3rem; }
    .topbar { padding: 0 1.1rem; }
}
@media (max-width: 700px) {
    .grille-form, .liste-defs { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .grille-tuiles, .grille-tuiles.trois, .grille-modules { grid-template-columns: 1fr; }
}

/* ── Module Audit SMI ─────────────────────────────────────────── */

/* Tableau de bord d'un audit : jauge, chapitres, profil de maturité.
   Le même bloc sert à l'accueil et à l'écran de l'audit. */
.smi-deck { display: grid; grid-template-columns: 250px 1fr 300px; gap: 1.25rem; }
.smi-bloc {
    background: var(--fond); border: 1px solid var(--bordure);
    border-radius: var(--r-m); padding: 1rem 1.1rem;
}
[data-theme="light"] .smi-bloc { background: var(--fond-3); }
.smi-bloc-titre {
    font-size: .68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-3); margin-bottom: .9rem;
}

.smi-jauge { text-align: center; margin-bottom: 1.1rem; }
.smi-jauge-valeur { font-size: 2.9rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.smi-jauge-valeur small { font-size: 1.15rem; font-weight: 600; margin-left: .1rem; color: var(--texte-2); }
.smi-jauge-note { font-size: .73rem; color: var(--texte-3); margin-top: .4rem; }

.smi-rails { display: flex; flex-direction: column; gap: .7rem; }
.smi-rail-tete {
    display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
    font-size: .78rem; font-weight: 600; color: var(--texte-2); margin-bottom: .28rem;
}
.smi-rail-tete b { font-family: var(--police-mono); font-size: .75rem; }
.smi-piste { height: 7px; background: var(--fond-3); border-radius: 4px; overflow: hidden; }
[data-theme="light"] .smi-piste { background: var(--fond); }
.smi-piste i { display: block; height: 100%; border-radius: 4px; transition: width var(--trans); }
.smi-avancement { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--bordure); }

.smi-chapitres { display: flex; flex-direction: column; gap: .5rem; }
.smi-chap {
    display: grid; grid-template-columns: 195px 1fr; gap: .9rem; align-items: center;
    padding-bottom: .5rem; border-bottom: 1px solid var(--bordure);
}
.smi-chap:last-child { border-bottom: none; padding-bottom: 0; }
.smi-chap-nom { font-size: .79rem; font-weight: 600; line-height: 1.25; }
.smi-chap-nom em {
    display: block; font-style: normal; font-size: .65rem; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-3); margin-top: .1rem;
}
.smi-chap-barres { display: flex; flex-direction: column; gap: .22rem; }
.smi-barre { display: grid; grid-template-columns: 1fr 32px; gap: .5rem; align-items: center; }
.smi-barre span {
    font-family: var(--police-mono); font-size: .67rem; color: var(--texte-3);
    text-align: right; font-variant-numeric: tabular-nums;
}

.smi-legende { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: .9rem; font-size: .7rem; color: var(--texte-3); }
.smi-legende span { display: inline-flex; align-items: center; gap: .35rem; }
.smi-legende i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.smi-radar-boite { display: flex; justify-content: center; }
.smi-radar { width: 100%; max-width: 280px; height: auto; }

/* Grille de cotation */
.smi-chapitre-titre { display: flex; align-items: baseline; gap: .7rem; margin: 1.75rem 0 .75rem; }
.smi-chapitre-titre em {
    font-style: normal; font-family: var(--police-mono); font-size: .69rem;
    letter-spacing: var(--suivi); text-transform: uppercase; color: var(--texte-3);
}
.smi-chapitre-titre b { font-size: .92rem; font-weight: 700; letter-spacing: -.01em; }
.smi-chapitre-titre hr { flex: 1; border: none; border-top: 1px solid var(--bordure); }

.smi-exigence {
    background: var(--fond-2); border: 1px solid var(--bordure);
    border-left: 3px solid var(--texte-3); border-radius: var(--r-m);
    box-shadow: var(--ombre-sm); padding: 1rem 1.15rem; margin-bottom: .8rem;
}
.smi-exigence.n-0 { border-left-color: var(--rouge); }
.smi-exigence.n-1 { border-left-color: var(--orange); }
.smi-exigence.n-2 { border-left-color: var(--jaune); }
.smi-exigence.n-3 { border-left-color: var(--vert); }
.smi-exigence.n-4 { border-left-color: var(--bleu); }
.smi-exigence.n-na { border-left-color: var(--texte-3); }
.smi-exigence.n-acoter { border-left-style: dashed; border-left-color: var(--bordure); }

.smi-ex-tete { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.smi-ref {
    font-family: var(--police-mono); font-size: .76rem; font-weight: 600;
    background: var(--fond-3); border-radius: 6px; padding: .2rem .5rem; white-space: nowrap;
}
.smi-ex-intitule { flex: 1; min-width: 240px; font-size: .9rem; font-weight: 500; line-height: 1.4; }
.smi-ex-normes { display: flex; gap: .25rem; flex-wrap: wrap; }
.smi-puce {
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--police-mono); font-size: .64rem; font-weight: 700;
    color: #fff; border-radius: 4px; padding: .2rem .42rem; white-space: nowrap;
}

.smi-criteres {
    margin-top: .75rem; padding: .55rem .8rem;
    background: var(--fond); border-left: 2px solid var(--bordure);
    border-radius: 0 var(--r-s) var(--r-s) 0;
    font-size: .78rem; color: var(--texte-2); line-height: 1.5;
}
[data-theme="light"] .smi-criteres { background: var(--fond-3); }
.smi-criteres b {
    display: block; font-size: .64rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-3); margin-bottom: .22rem;
}

/* Traînée de cotation : des boutons radio déguisés, aucun script. */
.smi-cotation { position: relative; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .9rem; }
.smi-cotation input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.smi-choix {
    display: flex; flex-direction: column; gap: .05rem; min-width: 94px;
    padding: .38rem .6rem; border: 1px solid var(--bordure); border-radius: var(--r-s);
    background: var(--fond-2); cursor: pointer;
    transition: background var(--trans), border-color var(--trans), color var(--trans);
}
.smi-choix span {
    font-family: var(--police-mono); font-size: .61rem; letter-spacing: .04em;
    text-transform: uppercase; color: var(--texte-3);
}
.smi-choix b { font-size: .78rem; font-weight: 600; }
.smi-choix:hover { border-color: var(--texte-3); }
.smi-cotation input:checked + .smi-choix { color: #fff; border-color: transparent; }
.smi-cotation input:checked + .smi-choix span { color: rgba(255, 255, 255, .78); }
.smi-cotation input:checked + .c-rouge   { background: var(--rouge); }
.smi-cotation input:checked + .c-orange  { background: var(--orange); }
.smi-cotation input:checked + .c-jaune   { background: var(--jaune); color: #2f2b3d; }
.smi-cotation input:checked + .c-jaune span { color: rgba(47, 43, 61, .7); }
.smi-cotation input:checked + .c-vert    { background: var(--vert); }
.smi-cotation input:checked + .c-bleu    { background: var(--bleu); color: #16161e; }
.smi-cotation input:checked + .c-bleu span { color: rgba(22, 22, 30, .7); }
.smi-cotation input:checked + .c-na      { background: var(--texte-3); }
.smi-cotation input:checked + .c-acoter  { background: var(--fond-3); color: var(--texte); border-color: var(--bordure); }
.smi-cotation input:checked + .c-acoter span { color: var(--texte-3); }
.smi-cotation input:focus-visible + .smi-choix { outline: 2px solid var(--violet); outline-offset: 2px; }
.smi-cotation input:disabled + .smi-choix { cursor: default; opacity: .6; }

.smi-champs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: .9rem; }
.smi-champs label { display: flex; flex-direction: column; gap: .3rem; }
.smi-champs span {
    font-size: .65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-3);
}
.smi-champs textarea {
    width: 100%; min-height: 62px; padding: .5rem .7rem; resize: vertical;
    background: var(--fond); border: 1px solid var(--bordure); border-radius: var(--r-s);
    color: var(--texte); font-family: var(--police); font-size: .82rem; line-height: 1.5;
    outline: none; transition: border-color var(--trans), box-shadow var(--trans);
}
[data-theme="light"] .smi-champs textarea { background: var(--fond-2); }
.smi-champs textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-dim); }
.smi-champs textarea::placeholder { color: var(--texte-3); }
.smi-champs textarea:disabled { opacity: .7; cursor: default; }
.smi-champ-ecart textarea { border-color: var(--rouge-dim); background: var(--rouge-dim); }

.smi-priorite { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .85rem; }
.smi-priorite > span:first-child {
    font-size: .65rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: var(--suivi); color: var(--texte-3);
}
.smi-priorite .champ-liste { width: auto; min-width: 180px; }

/* Barre d'enregistrement, collée en bas de la fenêtre pendant la saisie */
.smi-barre-action {
    position: sticky; bottom: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin: 1rem 0 0; padding: .8rem 1.1rem;
    background: var(--barre); border: 1px solid var(--bordure);
    border-radius: var(--r-m); box-shadow: var(--ombre);
    font-size: .8rem; color: var(--texte-2);
}

.tableau tbody tr.smi-soldee td { opacity: .55; }

/* ── Cadrage de l'audit : référentiels et méthode recommandée ─────────── */
.smi-cases-normes { display: flex; flex-wrap: wrap; gap: .6rem .9rem; }
.smi-case-norme {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .82rem; color: var(--texte); cursor: pointer;
}
.smi-case-norme input { accent-color: var(--violet); width: 15px; height: 15px; }

.smi-methode {
    margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--bordure);
}
.smi-methode summary {
    cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--texte-2);
    list-style: none;
}
.smi-methode summary::-webkit-details-marker { display: none; }
.smi-methode summary::before { content: '▸ '; color: var(--texte-3); }
.smi-methode[open] summary::before { content: '▾ '; }
.smi-methode ol {
    margin: .75rem 0 0 1.3rem; font-size: .8rem; color: var(--texte-2); line-height: 1.8;
}

@media (max-width: 1280px) {
    .smi-deck { grid-template-columns: 1fr 1fr; }
    .smi-deck .smi-bloc:last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
    .smi-deck { grid-template-columns: 1fr; }
    .smi-champs { grid-template-columns: 1fr; }
    .smi-chap { grid-template-columns: 1fr; gap: .4rem; }
}

/* ── Audit Pro : questions de la check-list par département ──────────── */
.audit-pro-question {
    background: var(--fond-2); border: 1px solid var(--bordure);
    border-left: 3px solid var(--texte-3); border-radius: var(--r-m);
    box-shadow: var(--ombre-sm); padding: 1rem 1.15rem; margin-bottom: .8rem;
}
.audit-pro-question.n-nc-majeure  { border-left-color: var(--rouge); }
.audit-pro-question.n-nc-mineure  { border-left-color: var(--orange); }
.audit-pro-question.n-observation { border-left-color: var(--jaune); }
.audit-pro-question.n-opportunite { border-left-color: var(--bleu); }
.audit-pro-question.n-point-fort  { border-left-color: var(--violet); }
.audit-pro-question.n-conforme    { border-left-color: var(--vert); }

.audit-pro-q-tete { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.audit-pro-q-intitule { flex: 1; min-width: 240px; font-size: .9rem; font-weight: 500; line-height: 1.4; }

.audit-pro-q-saisie {
    display: grid; grid-template-columns: 1fr 240px; gap: .75rem;
    margin-top: .85rem; align-items: start;
}
.audit-pro-q-saisie textarea { margin: 0; }
.audit-pro-q-saisie select { margin: 0; }

@media (max-width: 720px) {
    .audit-pro-q-saisie { grid-template-columns: 1fr; }
}
