:root {
  --navy: #0f2a43;
  --navy-clair: #1c4066;
  --accent: #e8a33d;
  --rouge: #c0392b;
  --orange: #e07b39;
  --ambre: #e8a33d;
  --vert: #2e7d5b;
  --fond: #eef1f5;
  --carte: #ffffff;
  --bord: #dde3ea;
  --texte: #1a222c;
  --sourdine: #5b6875;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-clair); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- navigation */

nav.principale {
  background: var(--navy);
  color: #fff;
  padding: 0 26px;
  display: flex; align-items: center; gap: 28px;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(15,42,67,.2);
}
nav.principale .marque {
  font-size: 13px; letter-spacing: .16em; text-transform: uppercase;
  padding: 16px 0; color: var(--accent); font-weight: 700; white-space: nowrap;
}
nav.principale .marque span { color: rgba(255,255,255,.55); font-weight: 400; }
nav.principale a.lien {
  color: rgba(255,255,255,.78); padding: 18px 2px; font-size: 14.5px;
  border-bottom: 2px solid transparent;
}
nav.principale a.lien:hover { color: #fff; text-decoration: none; }
nav.principale a.lien.actif { color: #fff; border-bottom-color: var(--accent); }
nav.principale .droite { margin-left: auto; display: flex; align-items: center; gap: 16px;
  font-size: 13.5px; color: rgba(255,255,255,.65); }

main { max-width: 1120px; margin: 0 auto; padding: 30px 26px 70px; }

h1.titre { font-size: 26px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }
p.chapeau { color: var(--sourdine); margin: 0 0 26px; max-width: 68ch; }

/* ----------------------------------------------------------------- cartes */

.grille { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: 1.6fr 1fr; }

.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: 4px;
  padding: 18px 20px;
}
.carte h2 {
  font-size: 11.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--sourdine); font-weight: 700; margin: 0 0 12px;
}
.indicateur .valeur {
  font-size: 27px; font-weight: 660; color: var(--navy); letter-spacing: -.02em;
  line-height: 1.15;
}
.indicateur .note { font-size: 13px; color: var(--sourdine); margin-top: 4px; }

.barre { height: 7px; border-radius: 4px; background: #e9edf2; overflow: hidden; margin-top: 12px; }
.barre span { display: block; height: 100%; background: var(--navy); border-radius: 4px; }

/* --------------------------------------------------------------- tableaux */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--bord); text-align: left; }
thead th {
  font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--sourdine); font-weight: 700; border-bottom: 1.5px solid var(--navy);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #fafbfc; }
table.compacte td, table.compacte th { padding: 8px 10px; }

/* --------------------------------------------------------------- étiquettes */

.etiquette {
  display: inline-block; padding: 2px 9px; border-radius: 100px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.e-critique { background: #fbeae8; color: var(--rouge); border-color: #f3cfca; }
.e-eleve    { background: #fdf1e7; color: #b4601f; border-color: #f5d9bf; }
.e-modere   { background: #fdf6e8; color: #93700f; border-color: #f2e2b8; }
.e-faible   { background: #eaf5ef; color: var(--vert); border-color: #cbe6d8; }
.e-neutre   { background: #eef1f5; color: var(--sourdine); border-color: var(--bord); }

/* ------------------------------------------------------------------ formes */

form.bloc { display: grid; gap: 14px; }
.champs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.champ { display: flex; flex-direction: column; gap: 5px; }
.champ label { font-size: 12.5px; font-weight: 600; color: var(--sourdine); }
.champ .aide { font-size: 12px; color: #8a95a1; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--bord);
  border-radius: 3px; background: #fff; color: var(--texte); width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(28,64,102,.25); outline-offset: 1px; border-color: var(--navy-clair);
}
textarea { min-height: 84px; resize: vertical; }

/* La règle « display » des boutons l'emporte sinon sur le display:none que le
   navigateur applique à [hidden] : un bouton masqué resterait visible. */
[hidden] { display: none !important; }

button, .bouton {
  font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 3px;
  border: 1px solid var(--navy); background: var(--navy); color: #fff;
  cursor: pointer; display: inline-block;
}
button:hover, .bouton:hover { background: var(--navy-clair); text-decoration: none; }
button.secondaire, .bouton.secondaire {
  background: #fff; color: var(--navy); border-color: var(--bord);
}
button.secondaire:hover, .bouton.secondaire:hover { background: #f6f8fa; }
button.discret {
  background: none; border: none; color: var(--navy-clair); padding: 2px 4px;
  font-weight: 600; font-size: 13px;
}
button.discret:hover { text-decoration: underline; background: none; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ divers */

.entete-page {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin-bottom: 24px;
}
.encadre {
  background: #f7f9fb; border-left: 3px solid var(--navy); padding: 14px 18px;
  border-radius: 0 3px 3px 0; font-size: 14px; color: var(--sourdine);
}
.encadre strong { color: var(--texte); }
.alerte-config {
  background: #fbeae8; border-left: 3px solid var(--rouge); color: #7d2b21;
  padding: 14px 18px; border-radius: 0 3px 3px 0; margin-bottom: 20px; font-size: 14px;
}
.vide { color: var(--sourdine); padding: 22px; text-align: center; }
.pied { margin-top: 40px; font-size: 12.5px; color: #8a95a1; }

.echeance { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.echeance .quand { font-variant-numeric: tabular-nums; white-space: nowrap; }
.faite { color: #8a95a1; text-decoration: line-through; }

.filtres { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filtres select { width: auto; }

@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3, .g2 { grid-template-columns: 1fr; }
  .champs { grid-template-columns: 1fr; }
  nav.principale { flex-wrap: wrap; gap: 16px; padding: 0 16px; }
  main { padding: 22px 16px 60px; }
}

/* ------------------------------------------- sélection multiple cherchable */
/* Soixante-huit domaines dans une liste déroulante de huit lignes : l'agent
   fait défiler à l'aveugle, et un clic sans Ctrl efface tout ce qu'il avait
   déjà coché. La liste native reste dans la page — elle porte la valeur et
   fonctionne sans script — mais elle est masquée dès que l'amélioration
   s'applique. La cartouche ne montre alors que ce qui est choisi. */

.multi { position: relative; }
.multi-boite {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  border: 1px solid var(--bord); border-radius: 3px; background: #fff;
  padding: 5px 6px; min-height: 38px; cursor: text;
}
.multi-boite.ouvert, .multi-boite:focus-within {
  outline: 2px solid rgba(28,64,102,.25); outline-offset: 1px;
  border-color: var(--navy-clair);
}
.multi-boite.invalide { border-color: var(--rouge); }

.multi-q {
  flex: 1 1 9ch; min-width: 9ch; width: auto; border: none; padding: 3px 2px;
  background: none;
}
.multi-q:focus { outline: none; }

.jeton {
  display: inline-flex; align-items: center; gap: 6px; font: inherit;
  font-size: 13px; font-weight: 600; padding: 3px 6px 3px 9px; border-radius: 3px;
  background: #eef1f5; color: var(--navy); border: 1px solid var(--bord);
  cursor: pointer;
}
.jeton:hover { background: #fbeae8; border-color: #f3cfca; color: var(--rouge); }
.jeton .croix { font-size: 14px; line-height: 1; opacity: .65; }
.jeton:hover .croix { opacity: 1; }

.multi-panneau {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--bord); border-radius: 3px;
  box-shadow: 0 6px 20px rgba(15,42,67,.13); max-height: 292px; overflow-y: auto;
}
.multi-liste { list-style: none; margin: 0; padding: 4px; }
.multi-liste li {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 3px; cursor: pointer; font-size: 14px;
}
.multi-liste li:hover, .multi-liste li.actif { background: #eef1f5; }
.multi-liste li[aria-selected="true"] { color: var(--navy); font-weight: 600; }
.multi-liste .coche {
  width: 15px; height: 15px; border: 1px solid var(--bord); border-radius: 2px;
  flex: 0 0 auto; position: relative; background: #fff;
}
.multi-liste li[aria-selected="true"] .coche {
  background: var(--navy); border-color: var(--navy);
}
.multi-liste li[aria-selected="true"] .coche::after {
  content: "✓"; color: #fff; font-size: 11px; line-height: 15px;
  position: absolute; inset: 0; text-align: center;
}
.multi-liste mark { background: #fdf0d8; color: inherit; border-radius: 2px; }
.multi-rien { padding: 12px; margin: 0; font-size: 13px; color: var(--sourdine); }

.multi-etat {
  margin: 5px 0 0; font-size: 12px; color: var(--sourdine);
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.multi-etat .erreur { color: var(--rouge); font-weight: 600; }

/* ------------------------------------------------- tableaux sur écran étroit */
/* Un tableau de sept colonnes ne tient pas sous 900 px. Sans conteneur qui
   défile, c'est la PAGE qui s'élargit : la navigation part hors champ, la
   dernière colonne est coupée, et l'agent ne sait pas qu'il manque quelque
   chose. Le défilement est donc rendu à la carte qui porte le tableau, jamais
   au document. */
.carte:has(table) { overflow-x: auto; }

/* Repli pour un navigateur sans :has(). La carte reste alors scrollable, au
   prix d'un débordement possible sur les cartes sans tableau — moins grave
   que la page entière qui glisse. */
@supports not selector(:has(table)) {
  .carte { overflow-x: auto; }
}

/* Sans largeur minimale, le moteur comprime les colonnes jusqu'à l'illisible
   au lieu de laisser le conteneur défiler. */
.carte table { min-width: 640px; }

/* ------------------------------------------- retours d'enregistrement */
/* « .aide » et « .erreur » n'existaient que portées par un parent (.champ,
   .multi-etat) : hors de ce contexte elles ne peignaient rien. Versions
   autonomes, sans toucher aux règles existantes qui restent plus spécifiques. */
p.succes { color: var(--vert, #1c7c4a); font-weight: 600; margin: 0 0 12px; }
p.erreur { color: var(--rouge); font-weight: 600; margin: 0 0 12px; }
p.aide   { font-size: 12px; color: #8a95a1; margin: 6px 0 14px; max-width: 62ch; }
