@charset "UTF-8";
/* =====================================================================
   GEDAR — Système de design
   Gestion des Données de l'Administration de la Recherche
   MESRS — République de Côte d'Ivoire
   ---------------------------------------------------------------------
   Feuille de style unique partagée par toutes les pages.
   Elle remplace les ~250 lignes de CSS dupliquées dans chaque fichier.
   Organisation :
     1. Jetons (couleurs, typographie, espacements)
     2. Réinitialisation
     3. Structure applicative (barre latérale, en-tête, contenu)
     4. Composants (cartes, tuiles, tableaux, badges, boutons…)
     5. Formulaires
     6. Visualisation de données
     7. Réactivité & impression
   ===================================================================== */

/* =====================================================================
   1. JETONS DE DESIGN
   ===================================================================== */
:root {
  /* --- Identité institutionnelle ---------------------------------- */
  /* Bleu nuit administratif pour le châssis, orange et vert de Côte
     d'Ivoire en accents : sobre en usage prolongé, identitaire au premier
     coup d'œil. */
  --brand-900: #0A2540;
  --brand-800: #0E3255;
  --brand-700: #123F6B;
  --brand-600: #1A5488;
  --brand-500: #2A78D6;
  --brand-100: #E8F1FB;

  --ci-orange:     #E87722;
  --ci-orange-600: #C25F12;
  --ci-orange-100: #FDF0E4;
  --ci-green:      #0F8A5F;
  --ci-green-600:  #0B6D4B;
  --ci-green-100:  #E4F5EE;

  /* --- Surfaces ---------------------------------------------------- */
  --surface:      #FFFFFF;   /* cartes, tableaux */
  --surface-sunk: #F5F7FA;   /* plan de page */
  --surface-alt:  #FAFBFC;   /* lignes alternées, en-têtes de tableau */

  /* --- Encre ------------------------------------------------------- */
  --ink:        #0F172A;
  --ink-soft:   #475569;
  --ink-muted:  #7C8797;
  --ink-invert: #FFFFFF;

  /* --- Traits ------------------------------------------------------ */
  --line:        #E3E8EF;
  --line-strong: #CBD5E1;
  --focus-ring:  0 0 0 3px rgba(42, 120, 214, 0.28);

  /* --- Élévation --------------------------------------------------- */
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 2px 8px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-3: 0 12px 28px rgba(15, 23, 42, 0.12);

  /* --- États (réservés : jamais utilisés comme couleur de série) ---- */
  --st-good:     #0CA30C;
  --st-good-bg:  #E7F7E7;
  --st-good-ink: #056105;

  --st-warn:     #FAB219;
  --st-warn-bg:  #FEF6E0;
  --st-warn-ink: #7A5200;

  --st-serious:     #EC835A;
  --st-serious-bg:  #FDEEE7;
  --st-serious-ink: #8A3D18;

  --st-crit:     #D03B3B;
  --st-crit-bg:  #FBE9E9;
  --st-crit-ink: #8A1F1F;

  --st-info:     #2A78D6;
  --st-info-bg:  #E8F1FB;
  --st-info-ink: #14447F;

  --st-idle:     #94A3B8;
  --st-idle-bg:  #F1F5F9;
  --st-idle-ink: #475569;

  /* --- Palette de séries (validée : bande de clarté, plancher de
         chroma, séparation daltonisme ΔE 9.1, vision normale ΔE 19.6) --- */
  --series-1: #2A78D6;   /* bleu    */
  --series-2: #EB6834;   /* orange  */
  --series-3: #1BAF7A;   /* aqua    */
  --series-4: #EDA100;   /* jaune   */
  --series-5: #E87BA4;   /* magenta */
  --series-6: #008300;   /* vert    */

  /* Rampe séquentielle (bleu, clair → foncé) pour les magnitudes */
  --seq-100: #CDE2FB;
  --seq-250: #86B6EF;
  --seq-400: #3987E5;
  --seq-550: #1C5CAB;
  --seq-700: #0D366B;

  /* --- Chrome de graphique ---------------------------------------- */
  --grid:     #E9EDF3;
  --axis:     #CBD5E1;

  /* --- Typographie -------------------------------------------------- */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* --- Géométrie ---------------------------------------------------- */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --sidebar-w: 264px;
  --topbar-h: 60px;
}

/* =====================================================================
   2. RÉINITIALISATION
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface-sunk);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

/* Accessibilité : lien d'évitement vers le contenu principal */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand-900); color: #fff;
  padding: 10px 18px; border-radius: 0 0 var(--r-md) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =====================================================================
   3. STRUCTURE APPLICATIVE
   ===================================================================== */

/* Bandeau tricolore : rappel discret du drapeau ivoirien */
.flag-bar { position: fixed; inset: 0 0 auto 0; height: 3px; display: flex; z-index: 120; }
.flag-bar i { flex: 1; }
.flag-bar i:nth-child(1) { background: var(--ci-orange); }
.flag-bar i:nth-child(2) { background: #FFFFFF; }
.flag-bar i:nth-child(3) { background: var(--ci-green); }

.app { display: flex; min-height: 100vh; padding-top: 3px; }

/* --- Barre latérale ------------------------------------------------ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--brand-900);
  color: #C7D6E6;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 3px; bottom: 0; left: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 3px; }

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.brand-mark {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ci-orange) 0%, var(--ci-green) 100%);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -0.5px;
}
.brand-text strong {
  display: block; color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.2;
}
.brand-text span {
  display: block; font-size: 10.5px; color: #8FA6BF;
  text-transform: uppercase; letter-spacing: 0.6px; margin-top: 1px;
}

/* Encart du centre de rattachement */
.sidebar-centre {
  margin: 14px 14px 4px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
}
.sidebar-centre .lbl {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.8px;
  color: #7D93AD; font-weight: 600;
}
.sidebar-centre .val {
  font-size: 12.5px; font-weight: 600; color: #fff; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav { padding: 10px 0 22px; flex: 1; }
.nav-group {
  padding: 16px 18px 6px;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: #6E86A1;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 18px;
  color: #C7D6E6; font-size: 13.2px; font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav a.is-active {
  background: rgba(232, 119, 34, 0.14);
  border-left-color: var(--ci-orange);
  color: #fff; font-weight: 600;
}
.nav a .ico { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a.is-active .ico { opacity: 1; }
.nav a .count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  color: #E2EAF3;
  font-size: 10.5px; font-weight: 700;
  padding: 1px 7px; border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.nav a.is-active .count { background: var(--ci-orange); color: #fff; }

/* --- Zone principale ----------------------------------------------- */
.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 3px; z-index: 90;
}
.topbar-title { min-width: 0; }
.topbar-title h1 {
  font-size: 16px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-title p { font-size: 12px; color: var(--ink-muted); }
.topbar-spacer { flex: 1; }

.burger {
  display: none;
  background: none; border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 7px; cursor: pointer;
}

/* Menu utilisateur */
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.user-chip:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.user-chip .who { text-align: left; line-height: 1.25; }
.user-chip .who b { display: block; font-size: 12.5px; font-weight: 600; }
.user-chip .who small { display: block; font-size: 10.5px; color: var(--ink-muted); }

.menu {
  position: absolute; right: 24px; top: calc(var(--topbar-h) - 2px);
  min-width: 208px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  padding: 6px; z-index: 95;
}
.menu[hidden] { display: none; }
.menu a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink); font-size: 13px;
}
.menu a:hover { background: var(--surface-sunk); text-decoration: none; }
.menu a.danger { color: var(--st-crit-ink); }
.menu a.danger:hover { background: var(--st-crit-bg); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

.content { padding: 24px; flex: 1; }
.content-wide { max-width: 1480px; }

.page-foot {
  border-top: 1px solid var(--line);
  padding: 16px 24px;
  font-size: 11.5px; color: var(--ink-muted);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* =====================================================================
   4. COMPOSANTS
   ===================================================================== */

/* --- En-tête de page ------------------------------------------------ */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h2 {
  font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--ink);
}
.page-head p { font-size: 13px; color: var(--ink-soft); margin-top: 2px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Fil d'Ariane */
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--ink-muted); margin-bottom: 6px; }
.crumbs a { color: var(--ink-muted); }
.crumbs a:hover { color: var(--brand-600); }

/* --- Carte ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 18px; }
.card-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.card-head p { font-size: 12px; color: var(--ink-muted); margin-top: 1px; }
.card-body { padding: 18px; }
.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* --- Grilles -------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* --- Tuile de statistique ------------------------------------------- */
/* Un chiffre isolé n'est pas un graphique : pas d'axe, pas de légende,
   juste la valeur, son libellé et son évolution. */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--brand-500));
}
.stat .k {
  font-size: 11px; font-weight: 600; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.stat .v {
  font-size: 28px; font-weight: 700; line-height: 1.1; margin-top: 6px;
  letter-spacing: -0.8px; color: var(--ink);
}
.stat .sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 4px; }
.stat .delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; margin-top: 5px; }
.stat .delta.up { color: #006300; }
.stat .delta.down { color: var(--st-crit-ink); }

/* --- Badges d'état --------------------------------------------------- */
/* Toujours pastille + libellé : la couleur ne porte jamais seule le sens. */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-valide    { background: var(--st-good-bg);    color: var(--st-good-ink);    border-color: #BFE7BF; }
.badge-soumis    { background: var(--st-info-bg);    color: var(--st-info-ink);    border-color: #C2DBF5; }
.badge-brouillon { background: var(--st-idle-bg);    color: var(--st-idle-ink);    border-color: #DCE3EB; }
.badge-rejete    { background: var(--st-crit-bg);    color: var(--st-crit-ink);    border-color: #F2C9C9; }
.badge-attente   { background: var(--st-warn-bg);    color: var(--st-warn-ink);    border-color: #F5E0AE; }
.badge-neutre    { background: var(--surface-sunk);  color: var(--ink-soft);       border-color: var(--line); }

/* Badge de rôle */
.role-tag {
  display: inline-block; padding: 2px 9px; border-radius: var(--r-sm);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.role-agent  { background: var(--ci-orange-100); color: #8A420A; }
.role-resp   { background: var(--brand-100);     color: var(--brand-700); }
.role-mesrs  { background: var(--ci-green-100);  color: var(--ci-green-600); }
.role-admin  { background: #EDE9FE;              color: #4C1D95; }
.role-cherch { background: #E0F2FE;              color: #075985; }

/* --- Boutons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-sunk); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.btn-primary  { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover  { background: var(--brand-700); border-color: var(--brand-700); }
.btn-accent   { background: var(--ci-orange); border-color: var(--ci-orange); color: #fff; }
.btn-accent:hover   { background: var(--ci-orange-600); border-color: var(--ci-orange-600); }
.btn-success  { background: var(--ci-green); border-color: var(--ci-green); color: #fff; }
.btn-success:hover  { background: var(--ci-green-600); border-color: var(--ci-green-600); }
.btn-danger   { background: #fff; border-color: #E4B4B4; color: var(--st-crit-ink); }
.btn-danger:hover   { background: var(--st-crit-bg); }
.btn-ghost    { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover    { background: var(--surface-sunk); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* --- Alertes --------------------------------------------------------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid; font-size: 13px; margin-bottom: 16px;
}
.alert .ico { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--st-good-bg); border-color: #BFE7BF; color: var(--st-good-ink); }
.alert-error   { background: var(--st-crit-bg); border-color: #F2C9C9; color: var(--st-crit-ink); }
.alert-warning { background: var(--st-warn-bg); border-color: #F5E0AE; color: var(--st-warn-ink); }
.alert-info    { background: var(--st-info-bg); border-color: #C2DBF5; color: var(--st-info-ink); }

/* --- Tableaux -------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th {
  background: var(--surface-alt);
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-alt); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { text-align: right; white-space: nowrap; }
table.data .strong { font-weight: 600; color: var(--ink); }
table.data .dim { color: var(--ink-muted); font-size: 12px; }

/* --- État vide ------------------------------------------------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--ink-muted); }
.empty .ico { margin: 0 auto 12px; opacity: .35; }
.empty h4 { font-size: 14.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.empty p { font-size: 12.5px; max-width: 42ch; margin: 0 auto 16px; }

/* --- Barre de progression -------------------------------------------- */
.meter { height: 6px; background: var(--surface-sunk); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--brand-500); transition: width .4s ease; }
.meter.is-complete > i { background: var(--ci-green); }
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row .meter { flex: 1; }
.meter-row .pct { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }

/* --- Onglets ---------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 9px 15px; font-size: 13px; font-weight: 600; color: var(--ink-muted);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--brand-600); border-bottom-color: var(--brand-600); }

/* --- Carte de formulaire (grille du tableau de bord agent) ------------ */
.form-tile {
  display: block; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-1);
  color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.form-tile:hover {
  text-decoration: none; border-color: var(--brand-500);
  box-shadow: var(--shadow-2); transform: translateY(-1px);
}
.form-tile .top { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.form-tile .ic {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--tile-bg, var(--brand-100)); color: var(--tile-fg, var(--brand-600));
}
.form-tile h4 { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.form-tile .desc { font-size: 12px; color: var(--ink-muted); margin-bottom: 12px; min-height: 32px; }
.form-tile .foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--ink-muted); }

/* --- Pagination -------------------------------------------------------- */
.pager { display: flex; align-items: center; gap: 4px; justify-content: center; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft); background: var(--surface);
}
.pager a:hover { background: var(--surface-sunk); text-decoration: none; }
.pager .is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pager .gap { border: 0; background: none; }

/* =====================================================================
   5. FORMULAIRES
   ===================================================================== */
.fieldset { border: 0; margin-bottom: 24px; }
.fieldset > legend {
  font-size: 13px; font-weight: 700; color: var(--ink);
  padding: 0 0 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line); width: 100%;
  display: flex; align-items: center; gap: 8px;
}
.fieldset > legend .n {
  width: 21px; height: 21px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-600); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

.field { margin-bottom: 15px; min-width: 0; }
.field > label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 5px;
}
.field .req { color: var(--st-crit); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--ink-muted); margin-top: 4px; }
.field .err  { font-size: 11.5px; color: var(--st-crit-ink); margin-top: 4px; font-weight: 500; }

.input, .select, .textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #A9B6C6; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: var(--focus-ring);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-sunk); color: var(--ink-muted); cursor: not-allowed;
}
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--st-crit); }
.textarea { min-height: 92px; resize: vertical; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237C8797' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 32px;
}

/* Cases à cocher et boutons radio */
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin-bottom: 7px; cursor: pointer; }
.check input { width: 15px; height: 15px; margin-top: 2px; accent-color: var(--brand-600); flex-shrink: 0; }

/* Barre d'actions collante en pied de formulaire */
.form-actions {
  position: sticky; bottom: 0;
  display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap;
  padding: 14px 18px; margin: 22px -18px -18px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.form-actions .left { margin-right: auto; display: flex; align-items: center; gap: 9px; }

/* Barre de filtres */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  margin-bottom: 18px;
}
.filters .field { margin-bottom: 0; }
.filters .field > label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.filters .grow { flex: 1; min-width: 190px; }

/* =====================================================================
   6. VISUALISATION DE DONNÉES
   ===================================================================== */
.chart { position: relative; }
.chart-title { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.chart-sub   { font-size: 11.5px; color: var(--ink-muted); margin-bottom: 14px; }

/* Légende : présente dès 2 séries, jamais la couleur seule */
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 11.5px; color: var(--ink-soft); }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* Barres horizontales — magnitude, étiquetées directement */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 128px 1fr auto; align-items: center; gap: 11px; }
.bar-row .lbl {
  font-size: 12px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-track { background: var(--surface-sunk); border-radius: 0 4px 4px 0; height: 20px; position: relative; }
.bar-fill {
  height: 100%; border-radius: 0 4px 4px 0;
  background: var(--seq-400); min-width: 2px;
  transition: width .5s ease;
}
.bar-row .val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* Barre empilée — répartition des états, séparateurs de 2px */
.stack { display: flex; height: 22px; border-radius: 4px; overflow: hidden; background: var(--surface-sunk); gap: 2px; }
.stack > span { display: block; min-width: 2px; transition: width .5s ease; }

/* =====================================================================
   7. UTILITAIRES
   ===================================================================== */
.mt-0 { margin-top: 0 } .mt-1 { margin-top: 8px }  .mt-2 { margin-top: 16px } .mt-3 { margin-top: 24px }
.mb-0 { margin-bottom: 0 } .mb-1 { margin-bottom: 8px } .mb-2 { margin-bottom: 16px } .mb-3 { margin-bottom: 24px }
.flex { display: flex } .items-center { align-items: center } .justify-between { justify-content: space-between }
.gap-1 { gap: 8px } .gap-2 { gap: 16px } .wrap { flex-wrap: wrap }
.text-muted { color: var(--ink-muted) } .text-soft { color: var(--ink-soft) }
.text-sm { font-size: 12px } .text-xs { font-size: 11px }
.text-right { text-align: right } .text-center { text-align: center }
.fw-600 { font-weight: 600 } .fw-700 { font-weight: 700 }
.nums { font-variant-numeric: tabular-nums }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

/* Indicateur d'envoi en cours, sur les boutons de formulaire */
.spin { animation: gedar-spin 0.8s linear infinite; }
@keyframes gedar-spin { to { transform: rotate(360deg); } }

/* Jauge de robustesse d'un mot de passe */
.mdp-force { height: 4px; border-radius: 2px; background: var(--surface-sunk); overflow: hidden; margin-top: 6px; }
.mdp-force > i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--st-crit); transition: width .2s ease, background .2s ease; }
.mdp-force-txt { font-size: 11px; color: var(--ink-muted); margin-top: 3px; }

/* =====================================================================
   8. RÉACTIVITÉ
   ===================================================================== */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-3);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .burger { display: inline-flex; }
  .scrim {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
    z-index: 99; border: 0;
  }
  .scrim[hidden] { display: none; }
}
@media (max-width: 680px) {
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .user-chip .who { display: none; }
  .bar-row { grid-template-columns: 96px 1fr auto; }
  .page-head h2 { font-size: 17px; }
  .stat .v { font-size: 24px; }
  .menu { right: 16px; left: 16px; }
}

/* =====================================================================
   9. IMPRESSION — les rapports MESRS sont imprimés et archivés
   ===================================================================== */
@media print {
  .sidebar, .topbar, .page-actions, .form-actions, .filters, .pager, .scrim, .menu { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  body { background: #fff; font-size: 11pt; }
  .card { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  table.data thead { display: table-header-group; }
  table.data tbody tr { break-inside: avoid; }
}

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
