/* =============================================================================
   Suivi de projet 2GIK - système visuel commun (socle et modules).
   Charte 2GIK : bleu #3B4970 (principal), orange #FFAF23 (accent, toujours
   avec un texte bleu foncé), fond clair #F9F9F9. Police Inter (locale, OFL).
   Thème : clair / sombre selon l'appareil, ou forcé par data-theme sur <html>.
   Aucun style en ligne n'est permis (CSP) : tout est ici ou dans
   public/css/<module>.css.
   ========================================================================== */

/* --- Polices Inter (public/fonts, licence OFL) --------------------------- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/inter-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/fonts/inter-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/inter-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/fonts/inter-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/inter-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/fonts/inter-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/inter-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/fonts/inter-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* --- Jetons : thème clair (défaut) ----------------------------------------- */
:root {
  color-scheme: light;
  --marque: #3B4970;
  --marque-fonce: #2C3757;
  --accent: #FFAF23;
  --on-accent: #1F2A44;

  --bg-app: #F9F9F9;
  --surface: #FFFFFF;
  --surface-2: #F2F3F6;
  --surface-3: #E8EAF0;
  --text: #1E2433;
  --text-2: #3D4559;
  --muted: #667085;
  --border: #D9DCE3;
  --border-leger: #ECEEF2;
  --border-champ: #C5CAD4;
  --lien: #2F4B8C;
  --action: #3B4970;
  --action-hover: #2C3757;
  --on-action: #FFFFFF;
  --action-texte: #3B4970;
  --topbar: #3B4970;
  --topbar-texte: #FFFFFF;
  --fond-public: #3B4970;
  --ligne-alt: #FAFAFB;
  --ligne-survol: #F3F5FA;
  --selection: rgba(59, 73, 112, 0.08);

  --ok: #1F8A4C; --ok-bg: #E5F4EB; --ok-tx: #14532D;
  --err: #C0392B; --err-bg: #FCEBEA; --err-tx: #8E1F16;
  --warn: #B26B00; --warn-bg: #FFF3DC; --warn-tx: #6B4200;
  --info: #2F6FB0; --info-bg: #E6EFF9; --info-tx: #1D4A7A;
  --neu: #6B7280; --neu-bg: #EEF0F3; --neu-tx: #374151;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --ombre-douce: 0 1px 2px rgba(20, 28, 48, 0.06), 0 1px 3px rgba(20, 28, 48, 0.04);
  --ombre-carte: 0 10px 30px rgba(15, 22, 40, 0.18);
  --police: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --police-mono: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --hauteur-barre: 56px;
  --largeur-nav: 232px;
}

/* --- Jetons : thème sombre --------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    color-scheme: dark;
    --bg-app: #12151C;
    --surface: #1A1F2A;
    --surface-2: #222836;
    --surface-3: #2B3243;
    --text: #E7E9EF;
    --text-2: #C4C9D4;
    --muted: #9AA2B2;
    --border: #323A4B;
    --border-leger: #272E3C;
    --border-champ: #404A5F;
    --lien: #A9BDF0;
    --action: #52649C;
    --action-hover: #6376AE;
    --on-action: #FFFFFF;
    --action-texte: #B7C6F2;
    --topbar: #222B42;
    --fond-public: #1C2336;
    --ligne-alt: #1D2330;
    --ligne-survol: #252C3B;
    --selection: rgba(169, 189, 240, 0.10);
    --ok: #4CC381; --ok-bg: #173325; --ok-tx: #A7E8C3;
    --err: #F07167; --err-bg: #3A1D1D; --err-tx: #F8B4AE;
    --warn: #F0B04A; --warn-bg: #3A2C12; --warn-tx: #F7D79B;
    --info: #6FA8E8; --info-bg: #182B42; --info-tx: #AFCDF2;
    --neu: #9AA2B2; --neu-bg: #262C39; --neu-tx: #C9CED8;
    --ombre-douce: 0 1px 2px rgba(0, 0, 0, 0.4);
    --ombre-carte: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="sombre"] {
  color-scheme: dark;
  --bg-app: #12151C;
  --surface: #1A1F2A;
  --surface-2: #222836;
  --surface-3: #2B3243;
  --text: #E7E9EF;
  --text-2: #C4C9D4;
  --muted: #9AA2B2;
  --border: #323A4B;
  --border-leger: #272E3C;
  --border-champ: #404A5F;
  --lien: #A9BDF0;
  --action: #52649C;
  --action-hover: #6376AE;
  --on-action: #FFFFFF;
  --action-texte: #B7C6F2;
  --topbar: #222B42;
  --fond-public: #1C2336;
  --ligne-alt: #1D2330;
  --ligne-survol: #252C3B;
  --selection: rgba(169, 189, 240, 0.10);
  --ok: #4CC381; --ok-bg: #173325; --ok-tx: #A7E8C3;
  --err: #F07167; --err-bg: #3A1D1D; --err-tx: #F8B4AE;
  --warn: #F0B04A; --warn-bg: #3A2C12; --warn-tx: #F7D79B;
  --info: #6FA8E8; --info-bg: #182B42; --info-tx: #AFCDF2;
  --neu: #9AA2B2; --neu-bg: #262C39; --neu-tx: #C9CED8;
  --ombre-douce: 0 1px 2px rgba(0, 0, 0, 0.4);
  --ombre-carte: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* --- Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-app);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); margin: 0 0 0.6em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; margin-top: 1.4em; }
p { margin: 0 0 0.8em; }
a { color: var(--lien); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
code, kbd, pre { font-family: var(--police-mono); font-size: 0.9em; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.visuellement-cache {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.lien-evitement { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 8px 14px;
  background: var(--accent); color: var(--on-accent); border-radius: var(--radius-md); font-weight: 600; }
.lien-evitement:focus { top: 8px; }
.meta { color: var(--muted); font-size: 0.85rem; }
.aide { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.vide { color: var(--muted); text-align: center; }
.nombre { text-align: right; font-variant-numeric: tabular-nums; }
.sans-retour { white-space: nowrap; }
.texte-coupe { max-width: 340px; overflow-wrap: anywhere; }
.details-json { font-family: var(--police-mono); font-size: 0.78rem; max-width: 380px; overflow-wrap: anywhere; color: var(--text-2); }
.en-ligne { display: inline; }
.texte-courant { max-width: 780px; }
.texte-courant p, .texte-courant li { line-height: 1.65; }
.js .sans-js { display: none; }
.js-seulement { display: none !important; }
.js .js-seulement { display: inline-flex !important; }

/* --- Barre du haut ------------------------------------------------------------ */
.barre-haut {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px;
  min-height: var(--hauteur-barre); padding: 8px 20px;
  background: var(--topbar); color: var(--topbar-texte);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.barre-marque { display: flex; align-items: center; gap: 10px; color: var(--topbar-texte); text-decoration: none; }
.barre-marque:hover .barre-titre { color: var(--accent); }
.barre-logo { height: 32px; width: auto; display: block; }
.barre-titre { font-weight: 600; font-size: 1.05rem; letter-spacing: 0.01em; }
.barre-recherche { flex: 1 1 240px; max-width: 440px; margin-left: auto; }
.barre-haut .barre-recherche input {
  width: 100%; padding: 7px 12px; font: inherit; font-size: 0.92rem;
  color: var(--topbar-texte); background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: var(--radius-md);
}
.barre-haut .barre-recherche input::placeholder { color: rgba(255, 255, 255, 0.78); }
.barre-haut .barre-recherche input:focus { background: #FFFFFF; color: #1E2433; outline: 3px solid var(--accent); outline-offset: 0; }
.barre-utilisateur { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.barre-recherche + .barre-utilisateur { margin-left: 0; }
.barre-nom { color: var(--topbar-texte); text-decoration: none; font-weight: 500; font-size: 0.92rem; }
.barre-nom:hover { color: var(--accent); }
.btn-barre {
  font: inherit; font-size: 0.88rem; font-weight: 500; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius-md);
  color: var(--topbar-texte); background: transparent; border: 1px solid rgba(255, 255, 255, 0.45);
}
.btn-barre:hover { border-color: var(--accent); color: var(--accent); }

/* --- Mise en page : navigation latérale (bureau) / bande (téléphone) --------- */
.mise-en-page { display: block; }
.navigation {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 6px 12px; display: flex; gap: 4px; overflow-x: auto; white-space: nowrap;
  scrollbar-width: thin;
}
.nav-liste { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.nav-titre { display: none; }
.navigation a {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-md);
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 0.92rem;
}
.navigation a:hover { background: var(--surface-2); color: var(--text); }
.navigation a[aria-current="page"] {
  background: var(--selection); color: var(--action-texte); font-weight: 600;
  box-shadow: inset 0 -3px 0 var(--accent);
}
.nav-admin { border-left: 1px solid var(--border); padding-left: 6px; margin-left: 4px; }
.nav-secondaire { border-left: 1px solid var(--border); padding-left: 6px; margin-left: 4px; }
.principal { padding: 20px 16px 32px; min-width: 0; max-width: 1320px; }

@media (min-width: 960px) {
  .mise-en-page { display: grid; grid-template-columns: var(--largeur-nav) minmax(0, 1fr); }
  .navigation {
    position: sticky; top: var(--hauteur-barre); align-self: start;
    height: calc(100vh - var(--hauteur-barre)); overflow-y: auto;
    flex-direction: column; white-space: normal; gap: 0;
    padding: 16px 12px; border-bottom: 0; border-right: 1px solid var(--border);
  }
  .nav-liste { flex-direction: column; }
  .nav-titre {
    display: block; margin: 18px 12px 6px; font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  }
  .nav-admin, .nav-secondaire { border-left: 0; padding-left: 0; margin-left: 0; }
  .nav-secondaire { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
  .navigation a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); }
  .principal { padding: 28px 32px 40px; }
}
@media (max-width: 640px) {
  .barre-haut { padding: 8px 16px; }
  .barre-titre { display: none; }
  .barre-nom { display: none; }
  .barre-recherche { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .barre-recherche + .barre-utilisateur { margin-left: auto; }
  .principal { padding: 16px 16px 28px; }
}

/* --- Pied de page --------------------------------------------------------------- */
.pied {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center;
  padding: 18px 16px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border);
}
.pied a { color: var(--muted); }

/* --- En-têtes de page, fil d'Ariane ------------------------------------------- */
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.entete-page h1 { margin: 0; }
.entete-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.entete-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.fil-ariane { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.fil-ariane a { color: var(--muted); }

/* --- Boutons ------------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; min-height: 40px; border-radius: var(--radius-md);
  font: inherit; font-size: 0.93rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-plein { background: var(--action); color: var(--on-action); }
.btn-plein:hover { background: var(--action-hover); color: var(--on-action); text-decoration: none; }
.btn-secondaire { background: var(--surface); color: var(--text); border-color: var(--border-champ); }
.btn-secondaire:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(0.95); color: var(--on-accent); text-decoration: none; }
.btn-danger { background: var(--err); color: #FFFFFF; }
.btn-danger:hover { filter: brightness(0.92); color: #FFFFFF; text-decoration: none; }
.btn-lien { background: none; color: var(--lien); padding-left: 6px; padding-right: 6px; font-weight: 500; text-decoration: underline; }
.btn-petit { padding: 5px 10px; min-height: 32px; font-size: 0.85rem; }
.groupe-boutons { display: flex; flex-wrap: wrap; gap: 8px; }
.pile-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 16px; }
.zone-danger { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); }

/* --- Formulaires ------------------------------------------------------------------- */
.formulaire { display: grid; gap: 14px; max-width: 580px; }
.formulaire-grille { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-width: none; align-items: end; }
.formulaire-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.formulaire-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.champ > label, .champ-libelle { font-weight: 500; font-size: 0.9rem; color: var(--text-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="url"], input[type="tel"], input[type="file"],
input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-champ); border-radius: var(--radius-md);
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select { cursor: pointer; }
.formulaire-ligne select, .formulaire-ligne input { width: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--action); outline: 3px solid var(--accent); outline-offset: 0; }
input[readonly] { background: var(--surface-2); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--action); margin: 0; flex: none; }
.champ-case { flex-direction: row; align-items: center; gap: 10px; }
.champ-case label { font-weight: 400; }
.champ-erreur input, .champ-erreur select, .champ-erreur textarea { border-color: var(--err); }
.groupe-choix { border: 0; padding: 0; margin: 0 0 6px; display: grid; gap: 8px; }
.groupe-choix legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choix { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; }
.champ-code { font-size: 1.35rem; letter-spacing: 0.18em; text-align: center; font-variant-numeric: tabular-nums; }
.champ-lien { font-family: var(--police-mono); font-size: 0.85rem; }

/* --- Filtres ------------------------------------------------------------------------- */
.filtres {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px; margin-bottom: 16px;
}
.filtres .champ { flex: 1 1 160px; }
.filtres .champ > label { font-size: 0.8rem; }
.filtres input, .filtres select { padding: 7px 10px; font-size: 0.9rem; }
.filtres-actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) {
  /* Deux filtres par ligne sur téléphone : la liste reste visible sans défiler un écran entier. */
  .filtres { gap: 10px; padding: 12px; }
  .filtres .champ { flex: 1 1 130px; }
}

/* --- Cartes et grilles ----------------------------------------------------------- */
.carte {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 20px; box-shadow: var(--ombre-douce); min-width: 0;
}
.carte > h2:first-child, .carte-entete h2 { margin-top: 0; }
.carte-entete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.carte-entete h2 { margin: 0; }
.carte.vide { text-align: center; padding: 32px 20px; }
.grille-2, .grille-3 { display: grid; gap: 20px; }
.grille-2 > .carte, .grille-3 > .carte { margin-bottom: 0; }
.grille-2, .grille-3 { margin-bottom: 20px; }
@media (min-width: 900px) {
  .grille-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grille-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.liste-definitions { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 0; }
.liste-definitions dt { color: var(--muted); font-size: 0.88rem; }
.liste-definitions dd { margin: 0; }
.liste-simple { list-style: none; margin: 0; padding: 0; }
.liste-simple li { padding: 8px 0; border-bottom: 1px solid var(--border-leger); }
.liste-simple li:last-child { border-bottom: 0; }
.liste-membres { list-style: none; margin: 0; padding: 0; }
.liste-membres li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border-leger); }
.liste-membres li > div { display: flex; flex-direction: column; gap: 2px; }
.niveaux-resume { flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: 4px !important; }

/* --- Tuiles d'indicateurs ----------------------------------------------------------- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tuile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text);
  box-shadow: var(--ombre-douce);
}
a.tuile:hover { border-color: var(--action); text-decoration: none; }
.tuile-valeur { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tuile-libelle { font-size: 0.85rem; color: var(--muted); }
.tuile-detail { font-size: 0.8rem; color: var(--text-2); }
.tuile-attention { border-left: 4px solid var(--accent); }
.tuile-ok { border-left: 4px solid var(--ok); }
.tuile-err { border-left: 4px solid var(--err); }
.tuile-info { border-left: 4px solid var(--info); }

/* --- Tableaux ------------------------------------------------------------------------ */
.tableau-conteneur {
  overflow: auto; max-height: 78vh; margin-bottom: 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.92rem; }
.tableau thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  text-align: left; font-weight: 600; font-size: 0.82rem; white-space: nowrap;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.tableau thead th.nombre { text-align: right; }
.tableau td, .tableau tbody th { padding: 10px 12px; border-bottom: 1px solid var(--border-leger); vertical-align: top; text-align: left; }
.tableau tbody th { font-weight: 500; }
.tableau tbody tr:nth-child(even) > * { background: var(--ligne-alt); }
.tableau tbody tr:hover > * { background: var(--ligne-survol); }
.tableau tbody tr:last-child > * { border-bottom: 0; }
.tableau td.vide { padding: 28px 12px; }
.tableau th a.tri { color: inherit; text-decoration: none; }
.tableau th a.tri[aria-sort] { color: var(--action-texte); }
.densite-compacte .tableau td, .densite-compacte .tableau tbody th, .densite-compacte .tableau thead th { padding: 5px 8px; }
.densite-compacte .tableau { font-size: 0.87rem; }
.ligne-selectionnee > * { background: var(--selection) !important; }

/* Téléphone : les tableaux « tableau-cartes » deviennent des cartes empilées. */
@media (max-width: 720px) {
  .tableau-conteneur:has(.tableau-cartes) { overflow: visible; max-height: none; background: transparent; border: 0; }
  .tableau-cartes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tableau-cartes, .tableau-cartes tbody, .tableau-cartes tr { display: block; width: 100%; }
  .tableau-cartes tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    margin-bottom: 10px; padding: 6px 4px;
  }
  .tableau-cartes tbody tr:nth-child(even) > *, .tableau-cartes tbody tr:hover > * { background: transparent; }
  .tableau-cartes td, .tableau-cartes tbody th {
    display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px;
    padding: 6px 10px; border-bottom: 0; text-align: left;
  }
  .tableau-cartes td::before, .tableau-cartes tbody th::before {
    content: attr(data-label); font-weight: 600; font-size: 0.8rem; color: var(--muted);
  }
  .tableau-cartes td:not([data-label])::before, .tableau-cartes tbody th:not([data-label])::before { content: none; }
  .tableau-cartes td:not([data-label]), .tableau-cartes td.vide { display: block; }
  .tableau-cartes td.nombre { text-align: left; }
  /* Badges et boutons gardent leur largeur naturelle dans la cellule. */
  .tableau-cartes td > *, .tableau-cartes tbody th > * { justify-self: start; align-self: center; }
}

/* --- Badges de statut ---------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; line-height: 1.5; white-space: nowrap; vertical-align: middle;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-tx); }
.badge-err { background: var(--err-bg); color: var(--err-tx); }
.badge-warn { background: var(--warn-bg); color: var(--warn-tx); }
.badge-info { background: var(--info-bg); color: var(--info-tx); }
.badge-neu { background: var(--neu-bg); color: var(--neu-tx); }
.badge-attention { background: var(--accent); color: var(--on-accent); }
.compteur-attention {
  display: inline-flex; min-width: 20px; justify-content: center; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 0.74rem; font-weight: 700; line-height: 1.6;
}

/* --- Messages -------------------------------------------------------------------------- */
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { margin: 0 0 10px; padding: 10px 14px; border-radius: var(--radius-md); border-left: 4px solid; font-size: 0.93rem; }
.messages .message { margin: 0; }
.message-ok { background: var(--ok-bg); color: var(--ok-tx); border-color: var(--ok); }
.message-err { background: var(--err-bg); color: var(--err-tx); border-color: var(--err); }
.message-warn { background: var(--warn-bg); color: var(--warn-tx); border-color: var(--warn); }
.message-info { background: var(--info-bg); color: var(--info-tx); border-color: var(--info); }

/* --- Onglets ---------------------------------------------------------------------------- */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.onglet {
  padding: 9px 14px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 0.93rem;
  border: 0; background: none; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
  cursor: pointer; font-family: inherit;
}
.onglet:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--border-champ); }
.onglet[aria-current="page"], .onglet[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }

/* --- Pagination ---------------------------------------------------------------------- */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 20px; font-size: 0.9rem; }
.pagination a, .pagination .inactif { padding: 6px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); text-decoration: none; }
.pagination a { background: var(--surface); color: var(--text); }
.pagination a:hover { border-color: var(--action); }
.pagination .inactif { color: var(--muted); opacity: 0.6; }
.pagination-etat { color: var(--muted); }

/* --- Listes de fichiers -------------------------------------------------------------- */
.liste-fichiers { list-style: none; margin: 0; padding: 0; }
.liste-fichiers li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-leger); }
.liste-fichiers li:last-child { border-bottom: 0; }
.fichier-icone {
  flex: none; width: 40px; height: 40px; border-radius: var(--radius-md); display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
}
.fichier-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fichier-nom { font-weight: 500; overflow-wrap: anywhere; }
.fichier-meta { font-size: 0.82rem; color: var(--muted); }
.fichier-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.zone-depot {
  border: 2px dashed var(--border-champ); border-radius: var(--radius-lg); padding: 20px; text-align: center;
  background: var(--surface-2); color: var(--text-2);
}
.zone-depot.survol { border-color: var(--accent); }

/* --- Fils de commentaires et historique --------------------------------------------- */
.fil { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fil-element { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; background: var(--surface); }
.fil-element.en-attente { border-style: dashed; border-color: var(--accent); }
.fil-element.interne { background: var(--info-bg); }
.fil-entete { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.fil-texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.chronologie { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.chronologie li { position: relative; padding: 0 0 12px 12px; font-size: 0.9rem; }
.chronologie li::before {
  content: ''; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--action);
}

/* --- Graphiques SVG rendus côté serveur ---------------------------------------------- */
.graphique { width: 100%; height: auto; display: block; overflow: visible; }
.graphique text { fill: var(--muted); font-size: 11px; font-family: var(--police); }
.graphique .axe, .graphique .grille { stroke: var(--border); stroke-width: 1; fill: none; }
.graphique .grille { stroke-dasharray: 2 3; }
.graphique .barre, .graphique .serie-1 { fill: var(--action); }
.graphique .serie-2 { fill: var(--accent); }
.graphique .serie-3 { fill: var(--info); }
.graphique .serie-4 { fill: var(--ok); }
.graphique .ligne-serie { fill: none; stroke: var(--action); stroke-width: 2; }
.graphique .ligne-serie-2 { fill: none; stroke: var(--accent); stroke-width: 2; }
.graphique .point-serie { fill: var(--surface); stroke: var(--action); stroke-width: 2; }
.graphique .valeur { fill: var(--text-2); font-weight: 600; }
.graphique .chaleur-0 { fill: var(--surface-2); }
.graphique .chaleur-1 { fill: var(--action); fill-opacity: 0.18; }
.graphique .chaleur-2 { fill: var(--action); fill-opacity: 0.36; }
.graphique .chaleur-3 { fill: var(--action); fill-opacity: 0.55; }
.graphique .chaleur-4 { fill: var(--action); fill-opacity: 0.75; }
.graphique .chaleur-5 { fill: var(--action); fill-opacity: 1; }
.legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.82rem; color: var(--muted); margin: 8px 0 0; padding: 0; list-style: none; }
.legende-pastille { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--action); }
.legende-pastille.serie-2 { background: var(--accent); }
.legende-pastille.serie-3 { background: var(--info); }
.legende-pastille.serie-4 { background: var(--ok); }
.barre-progression { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.barre-progression > span { display: block; height: 100%; background: var(--action); }
.pc-0 { width: 0; } .pc-10 { width: 10%; } .pc-20 { width: 20%; } .pc-30 { width: 30%; } .pc-40 { width: 40%; }
.pc-50 { width: 50%; } .pc-60 { width: 60%; } .pc-70 { width: 70%; } .pc-80 { width: 80%; } .pc-90 { width: 90%; } .pc-100 { width: 100%; }

/* --- Droits d'accès (matrice RBAC) ---------------------------------------------------- */
.niveau {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 0.76rem; font-weight: 600;
  white-space: nowrap; border: 2px solid transparent;
}
.niveau-aucun { background: var(--neu-bg); color: var(--neu-tx); }
.niveau-lecture { background: var(--info-bg); color: var(--info-tx); }
.niveau-contribution { background: var(--ok-bg); color: var(--ok-tx); }
.niveau-derogation { border-color: var(--accent); }
.legende-niveaux { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.legende-niveaux .niveau { margin: 2px 2px 2px 0; }
.aide-droits p { margin-bottom: 6px; }
.matrice-droits .col-case { width: 40px; text-align: center; }
.matrice-droits td, .matrice-droits tbody th { vertical-align: middle; }
.matrice-droits .form-droit { display: flex; align-items: center; gap: 6px; margin: 0; }
.matrice-droits select { width: auto; min-width: 128px; padding: 5px 8px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.cellule-droit select { font-weight: 500; border-width: 2px; width: 100%; min-width: 9rem; text-overflow: ellipsis; }
.cellule-droit.niveau-aucun select { background: var(--neu-bg); color: var(--neu-tx); border-color: var(--neu-bg); }
.cellule-droit.niveau-lecture select { background: var(--info-bg); color: var(--info-tx); border-color: var(--info-bg); }
.cellule-droit.niveau-contribution select { background: var(--ok-bg); color: var(--ok-tx); border-color: var(--ok-bg); }
.cellule-droit.est-derogation select { border-color: var(--accent); font-weight: 700; }
.select-role.sans-role { color: var(--muted); font-style: italic; }
.matrice-droits .en-cours { opacity: 0.55; }
.matrice-droits tr.ligne-enregistree > * { background: var(--ok-bg) !important; transition: background 0.3s; }
.barre-lot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.barre-lot select { width: auto; }
.barre-lot-titre { font-weight: 600; font-size: 0.9rem; }
.statut-droits { min-height: 1.5em; margin: 0 0 8px; font-size: 0.9rem; }
.statut-ok { color: var(--ok-tx); }
.statut-erreur { color: var(--err-tx); font-weight: 600; }
.legende-derogation .niveau { margin-right: 4px; }
@media (max-width: 720px) {
  .matrice-droits select { min-width: 0; width: 100%; }
  .matrice-droits .form-droit { width: 100%; }
}

/* --- Pages publiques (connexion, invitation, double authentification) --------------- */
body.page-publique { background: var(--fond-public); }
.publique-conteneur { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; }
.carte-publique {
  width: 100%; max-width: 430px; background: var(--surface); color: var(--text);
  border-radius: var(--radius-lg); box-shadow: var(--ombre-carte); padding: 32px 28px;
}
.carte-publique-large { max-width: 760px; }
.publique-marque { text-align: center; margin-bottom: 22px; }
.logo { width: 96px; height: auto; }
.logo-sur-sombre { display: none; }
.publique-titre { font-size: 1.35rem; margin: 14px 0 2px; }
.publique-sous-titre { color: var(--muted); margin: 0; font-size: 0.95rem; }
.publique-etape { font-size: 1.1rem; margin: 0 0 10px; }
.publique-pied { color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; margin: 18px 0 0; text-align: center; }
.publique-pied a { color: #FFFFFF; }
.carte-publique .formulaire { max-width: none; }
.carte-publique .btn-plein { width: 100%; }
.carte-publique .aide { margin-top: 14px; }
.etapes { padding-left: 20px; margin: 0 0 12px; }
.qr { text-align: center; margin: 8px 0 12px; }
.qr svg { width: 208px; height: 208px; background: #FFFFFF; padding: 6px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.cle-manuelle { text-align: center; }
.cle-manuelle code { display: inline-block; padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius-sm); letter-spacing: 0.08em; overflow-wrap: anywhere; }
.codes-secours { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.codes-secours code { display: block; text-align: center; padding: 8px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 1rem; letter-spacing: 0.06em; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) .logo-sur-clair { display: none; }
  :root:not([data-theme="clair"]) .logo-sur-sombre { display: inline-block; }
}
:root[data-theme="sombre"] .logo-sur-clair { display: none; }
:root[data-theme="sombre"] .logo-sur-sombre { display: inline-block; }

/* --- Pages d'erreur --------------------------------------------------------------------- */
.erreur-page { max-width: 580px; margin: 40px auto; text-align: center; }

/* --- Mouvement réduit, impression ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .barre-haut, .navigation, .pied, .lien-evitement, .filtres, .pagination, .btn, .barre-lot { display: none !important; }
  body { background: #FFFFFF; color: #000000; }
  .mise-en-page { display: block; }
  .carte, .tableau-conteneur { box-shadow: none; border-color: #BBBBBB; max-height: none; overflow: visible; }
  .tableau thead th { position: static; }
}
