/* =========================================================================
   Portail strn.cloud — systeme de design
   =========================================================================
   Toutes les valeurs vivent dans :root. Une application qui rejoint le
   portail reprend ce fichier et n'invente aucune couleur, aucun rayon,
   aucune ombre.

   Trois regles qui tiennent l'ensemble :

   1. LA COULEUR D'ETAT NE DIT QUE L'ETAT. Vert, ambre et rouge sont reserves
      a « c'est bon », « attention », « en echec ». Le bleu ne dit que
      l'action. Les degrades des tuiles ne disent rien du tout : ils
      distinguent, ils ne signalent pas.
   2. L'ETAT NE REPOSE JAMAIS SUR LA SEULE COULEUR : toujours double d'un mot.
   3. Les ombres ont un DECALAGE et un flou, jamais un halo centre — une ombre
      centree ne ressemble a aucune lumiere reelle et fait « bouton des annees
      2000 ».

   Le logo Sterne est un JPEG sur fond blanc, sans transparence : il ne doit
   etre pose que sur une surface claire. D'ou l'en-tete blanche.
   ========================================================================= */

:root {
  /* --- surfaces --- */
  --fond:          #f1f2f7;
  --fond-haut:     #e9ebf5;
  --carte:         #ffffff;
  --bordure:       #e6e7f0;
  --bordure-forte: #d5d7e5;

  /* --- encres --- */
  --encre:        #14161f;
  --encre-douce:  #5b6076;
  --encre-tenue:  #8d92a8;

  /* --- action --- */
  --accent:       #2563eb;
  --accent-fonce: #1d4ed8;
  --accent-pale:  #eff6ff;
  --accent-voile: rgba(37, 99, 235, .10);

  /* --- etats (et rien d'autre) --- */
  --succes:       #067a4e;
  --succes-pale:  #e7f6ef;
  --alerte:       #c02617;
  --alerte-pale:  #fdeceb;
  --attention:    #9a5b06;
  --attention-pale:#fdf3e4;

  /* --- degrades des tuiles : distinguer, pas signaler --- */
  --degrade-1: linear-gradient(140deg, #3b82f6, #1d4ed8);
  --degrade-2: linear-gradient(140deg, #f472b6, #db2777);
  --degrade-3: linear-gradient(140deg, #2dd4bf, #0f766e);
  --degrade-4: linear-gradient(140deg, #34d399, #047857);
  --degrade-5: linear-gradient(140deg, #fbbf24, #d97706);
  --degrade-6: linear-gradient(140deg, #a78bfa, #6d28d9);
  --degrade-7: linear-gradient(140deg, #2f7a52, #123d27);   /* vert sapin : Moyens d'acces */

  /* --- rayons --- */
  --r-xs: 8px;  --r-s: 12px;  --r-m: 16px;  --r-l: 22px;  --r-xl: 30px;

  /* --- ombres --- */
  --ombre-1: 0 1px 2px rgba(20,22,31,.04), 0 4px 12px rgba(20,22,31,.05);
  --ombre-2: 0 2px 4px rgba(20,22,31,.05), 0 14px 34px rgba(20,22,31,.10);
  --ombre-3: 0 4px 8px rgba(20,22,31,.06), 0 24px 56px rgba(20,22,31,.13);
  --ombre-accent: 0 3px 10px rgba(37,99,235,.28);

  /* --- voiles : deux lavis colores, et rien de plus ---
     Ils etaient ecrits en dur dans .scene et dans le survol de ligne. Les
     sortir de :root revenait a laisser trois endroits ou changer l'accent :
     un changement de teinte en oubliait fatalement un. */
  --voile-scene-1: rgba(59, 130, 246, .17);
  --voile-scene-2: rgba(45, 212, 191, .15);
  --voile-ligne:   rgba(37, 99, 235, .03);

  /* --- espacements --- */
  --e1: 4px; --e2: 8px; --e3: 12px; --e4: 16px; --e5: 24px;
  --e6: 32px; --e7: 44px; --e8: 64px;

  /* --- typographie --- */
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
  --police-chiffres: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* --- tailles de texte : six roles, pas un de plus (DESIGN.md §3) ---
     Aucun font-size ne s'ecrit en pixels hors d'ici : la recette le refuse.
     C'est ainsi qu'on etait arrive a seize tailles, dont 14 et 14,5 px. */
  --t-titre:       27px;   /* titre de page, grands chiffres, cases du code */
  --t-titre-large: 32px;   /* le titre de page, a partir de 768 px          */
  --t-section:     17px;   /* titre de carte ou de section                  */
  --t-texte:       16px;   /* texte courant -- jamais moins dans un champ   */
  --t-second:      14px;   /* etiquettes, descriptions, tableaux            */
  --t-mention:     13px;   /* mentions, aide                                */
  --t-micro:       12px;   /* en-tete de tableau, badge                     */

  /* --- cible tactile minimale (exigence produit, pas une preference) --- */
  --touche: 44px;

  --transition: 180ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--police);
  font-size: var(--t-texte);              /* < 16px fait zoomer iOS a la mise au point */
  line-height: 1.5;
  color: var(--encre);
  background: var(--fond);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

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

/* Surfaces du navigateur : thematisees, jamais laissees par defaut. */
::selection { background: var(--accent-voile); color: var(--encre); }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
:where(input, button, select, textarea) { font: inherit; color: inherit; }

/* =========================================================================
   Ecrans d'authentification — carte centree sur fond degrade
   ========================================================================= */

.scene {
  min-height: 100dvh;           /* dvh : la barre d'URL mobile ne coupe plus */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--e5) var(--e4);
  background:
    radial-gradient(1100px 620px at 12% -8%,  var(--voile-scene-1), transparent 60%),
    radial-gradient(900px  560px at 92% 108%, var(--voile-scene-2), transparent 62%),
    linear-gradient(180deg, var(--fond-haut), var(--fond));
}

.carte-auth {
  width: 100%;
  max-width: 420px;
  background: var(--carte);
  border-radius: var(--r-xl);
  box-shadow: var(--ombre-3);
  padding: var(--e6) var(--e5) var(--e5);
  animation: arrivee 420ms cubic-bezier(.2, .7, .3, 1) both;
}

@keyframes arrivee {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.marque { text-align: center; margin-bottom: var(--e5); }
.marque img { width: 148px; height: auto; display: inline-block; }

.titre {
  margin: 0 0 var(--e2);
  font-size: var(--t-titre);
  font-weight: 650;
  letter-spacing: -.02em;
  text-align: center;
}
.sous-titre {
  margin: 0 0 var(--e5);
  color: var(--encre-douce);
  font-size: var(--t-texte);
  text-align: center;
  line-height: 1.5;
}
.sous-titre strong { color: var(--encre); font-weight: 600; }

/* =========================================================================
   Formulaires
   ========================================================================= */

.champ-groupe { margin-bottom: var(--e4); }

.etiquette {
  display: block;
  margin-bottom: var(--e2);
  font-size: var(--t-second);
  font-weight: 600;
  color: var(--encre-douce);
}

.champ {
  width: 100%;
  min-height: var(--touche);
  padding: 12px 14px;
  border: 1.5px solid var(--bordure-forte);
  border-radius: var(--r-s);
  background: var(--carte);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.champ::placeholder { color: var(--encre-tenue); }
.champ:hover { border-color: #c2c5d8; }
.champ:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-voile);
}
.champ[aria-invalid="true"] { border-color: var(--alerte); }

select.champ {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%235b6076' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* =========================================================================
   Boutons
   ========================================================================= */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--e2);
  width: 100%;
  min-height: var(--touche);
  padding: 12px 20px;
  border: none;
  border-radius: var(--r-s);
  font-size: var(--t-texte);
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--ombre-accent);
  transition: background var(--transition), transform var(--transition),
              box-shadow var(--transition), opacity var(--transition);
}
.bouton:hover:not(:disabled) { background: var(--accent-fonce); }
.bouton:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.bouton:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.bouton--discret {
  background: transparent;
  color: var(--encre-douce);
  box-shadow: none;
  font-weight: 550;
}
.bouton--discret:hover:not(:disabled) { background: var(--fond); color: var(--encre); }

/* Le bouton occupe : on montre l'attente plutot que de laisser croire
   que le clic n'a rien fait. */
.bouton.occupe { pointer-events: none; opacity: .75; }
.bouton.occupe::after {
  content: "";
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rotation 640ms linear infinite;
}
@keyframes rotation { to { transform: rotate(360deg); } }

/* =========================================================================
   Saisie du code — 6 cases
   ========================================================================= */

.cases-code {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--e2);
  margin-bottom: var(--e4);
}

.case-code {
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 52px;
  padding: 0;
  text-align: center;
  font-family: var(--police-chiffres);
  font-size: var(--t-titre);
  font-weight: 600;
  border: 1.5px solid var(--bordure-forte);
  border-radius: var(--r-s);
  background: var(--carte);
  transition: border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
}
.case-code:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-voile);
  transform: translateY(-1px);
}
.case-code.remplie { border-color: var(--accent); background: var(--accent-pale); }
.cases-code.fausse { animation: secousse 380ms ease; }
@keyframes secousse {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(4px); }
  50%      { transform: translateX(-4px); }
}

/* =========================================================================
   Messages — jamais la couleur seule, toujours une icone et un mot
   ========================================================================= */

.message {
  display: flex;
  align-items: flex-start;
  gap: var(--e3);
  padding: var(--e3) var(--e4);
  border-radius: var(--r-s);
  font-size: var(--t-second);
  line-height: 1.45;
  margin-bottom: var(--e4);
}
.message svg { flex: none; margin-top: 1px; }
.message--erreur    { background: var(--alerte-pale);    color: var(--alerte); }
.message--succes    { background: var(--succes-pale);    color: var(--succes); }
.message--attention { background: var(--attention-pale); color: var(--attention); }
.message--info      { background: var(--accent-pale);    color: var(--accent-fonce); }

/* =========================================================================
   Case a cocher
   ========================================================================= */

.coche {
  display: flex;
  align-items: center;
  gap: var(--e3);
  min-height: var(--touche);
  cursor: pointer;
  font-size: var(--t-second);
  color: var(--encre-douce);
  user-select: none;
}
.coche input {
  appearance: none;
  flex: none;
  width: 22px; height: 22px;
  border: 1.5px solid var(--bordure-forte);
  border-radius: 7px;
  background: var(--carte);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.coche input:checked {
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 10.5l3.6 3.6L15.5 6.5'/%3E%3C/svg%3E") center / 15px no-repeat;
  border-color: var(--accent);
}

/* =========================================================================
   Pied de carte
   ========================================================================= */

.pied-carte {
  margin-top: var(--e5);
  padding-top: var(--e4);
  border-top: 1px solid var(--bordure);
  text-align: center;
  font-size: var(--t-mention);
  color: var(--encre-tenue);
}
.pied-carte .bouton { width: auto; }
/* Encre douce et non tenue : c'est une consigne a lire, pas une mention. */
.pied-carte__aide { margin: 0 0 var(--e2); color: var(--encre-douce); line-height: 1.45; }

/* =========================================================================
   Coquille applicative — en-tete et page
   ========================================================================= */

.entete {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--e4);
  padding: var(--e3) var(--e4);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--bordure);
}
.entete__marque { display: flex; align-items: center; flex: none; }
.entete__marque img { width: 104px; height: auto; display: block; }
.entete__espace { flex: 1; }

/* --- menu utilisateur --- */
.menu { position: relative; flex: none; }

.menu__declencheur {
  display: flex;
  align-items: center;
  gap: var(--e3);
  min-height: var(--touche);
  padding: 6px 10px 6px 6px;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background var(--transition);
}
.menu__declencheur:hover { background: var(--fond); }
.menu__declencheur[aria-expanded="true"] { background: var(--fond); }

.pastille-initiales {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--degrade-1);
  color: #fff;
  font-size: var(--t-mention);
  font-weight: 650;
  letter-spacing: .02em;
}

.menu__identite { text-align: left; line-height: 1.25; }
/* `display: block` : sans lui, les deux <span> se suivent sur une seule
   ligne et l'en-tete s'etire jusqu'a manger la page. */
.menu__nom  { display: block; font-size: var(--t-second); font-weight: 600; }
.menu__role { display: block; font-size: var(--t-mention); color: var(--encre-tenue); }

/* Sous 640 px, l'identite disparait : la pastille suffit et l'en-tete
   respire. Le nom complet reste dans le menu ouvert. */
@media (max-width: 640px) { .menu__identite { display: none; } }

.menu__panneau {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 232px;
  padding: var(--e2);
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-m);
  box-shadow: var(--ombre-3);
  animation: arrivee 160ms cubic-bezier(.2, .7, .3, 1) both;
}
.menu__entete {
  padding: var(--e3) var(--e3) var(--e2);
  border-bottom: 1px solid var(--bordure);
  margin-bottom: var(--e2);
}
.menu__entete .nom { font-size: var(--t-second); font-weight: 600; }
.menu__entete .detail { font-size: var(--t-mention); color: var(--encre-tenue); margin-top: 2px; }

.menu__lien {
  display: flex;
  align-items: center;
  gap: var(--e3);
  min-height: var(--touche);
  padding: 0 var(--e3);
  border-radius: var(--r-xs);
  color: var(--encre);
  font-size: var(--t-second);
  transition: background var(--transition);
}
.menu__lien:hover { background: var(--fond); text-decoration: none; }
.menu__lien svg { color: var(--encre-tenue); flex: none; }

.page {
  max-width: 1060px;
  margin: 0 auto;
  padding: var(--e6) var(--e4) var(--e8);
}

/* Le back-office affiche des tableaux : 1060 px y comprimeraient les colonnes
   au point de tronquer les libelles. La page d'accueil, elle, reste etroite --
   des cartes larges se lisent mal. */
.page--large { max-width: 1300px; }

.page__titre {
  margin: 0 0 var(--e1);
  font-size: var(--t-titre);
  font-weight: 680;
  letter-spacing: -.025em;
}
.page__chapeau { margin: 0 0 var(--e6); color: var(--encre-douce); font-size: var(--t-texte); }

@media (min-width: 768px) {
  .entete { padding: var(--e3) var(--e5); }
  .page   { padding: var(--e7) var(--e5) var(--e8); }
  .page__titre { font-size: var(--t-titre-large); }
}

/* =========================================================================
   Grille d'applications
   ========================================================================= */

.grille-apps {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--e4);
}
@media (min-width: 640px) { .grille-apps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grille-apps { grid-template-columns: repeat(3, 1fr); } }

.tuile {
  display: flex;
  flex-direction: column;
  gap: var(--e3);
  padding: var(--e5);
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-l);
  box-shadow: var(--ombre-1);
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition),
              border-color var(--transition);
  animation: arrivee 420ms cubic-bezier(.2, .7, .3, 1) both;
}
a.tuile:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--ombre-2);
  border-color: transparent;
}
a.tuile:active { transform: translateY(-1px); }

/* Arrivee en cascade : un seul moment d'animation sur la page. */
.tuile:nth-child(1) { animation-delay: 0ms; }
.tuile:nth-child(2) { animation-delay: 55ms; }
.tuile:nth-child(3) { animation-delay: 110ms; }
.tuile:nth-child(4) { animation-delay: 165ms; }
.tuile:nth-child(5) { animation-delay: 220ms; }
.tuile:nth-child(6) { animation-delay: 275ms; }

.tuile__icone {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: var(--r-m);
  background: var(--degrade-1);
  color: #fff;
  box-shadow: var(--ombre-1);
}
/* La couleur de chaque dessin vient du catalogue (app/icones.py), posee en
   ligne par la macro `vignette` : une seule liste, ici comme dans le
   formulaire d'administration. Les couleurs d'identite (rose des Etiquettes,
   vert sapin des Moyens d'acces, violet de la Carte) y sont commentees. */

/* Image importee : elle remplit la vignette, sur fond de carte au cas ou
   elle serait transparente ; le liseré la detache du fond de page. */
.tuile__icone--image {
  background: var(--carte);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--bordure), var(--ombre-1);
}
.tuile__icone--image img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Tailles reduites : en-tete d'une fiche d'administration, et selecteur. */
.tuile__icone--petite { width: 38px; height: 38px; border-radius: var(--r-s); }
.tuile__icone--mini   { width: 32px; height: 32px; border-radius: var(--r-xs); box-shadow: none; }

.tuile__nom {
  font-size: var(--t-section);
  font-weight: 650;
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: var(--e3);
  flex-wrap: wrap;
}
.tuile__description {
  margin: 0;
  color: var(--encre-douce);
  font-size: var(--t-second);
  line-height: 1.5;
  flex: 1;
}

.etiquette-statut {
  font-size: var(--t-micro);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .045em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--fond);
  color: var(--encre-tenue);
}

.tuile--bientot { opacity: .78; box-shadow: none; background: transparent; }
.tuile--bientot .tuile__icone { filter: grayscale(1); opacity: .6; box-shadow: none; }

/* =========================================================================
   Etat vide
   ========================================================================= */

.vide {
  padding: var(--e8) var(--e5);
  text-align: center;
  background: var(--carte);
  border: 1px dashed var(--bordure-forte);
  border-radius: var(--r-l);
}
.vide__icone {
  width: 56px; height: 56px;
  margin: 0 auto var(--e4);
  display: grid; place-items: center;
  border-radius: var(--r-m);
  background: var(--fond);
  color: var(--encre-tenue);
}
.vide__titre { font-size: var(--t-section); font-weight: 620; margin: 0 0 var(--e2); }
.vide__texte { margin: 0 auto; max-width: 380px; color: var(--encre-douce); font-size: var(--t-second); }

/* =========================================================================
   Respect des preferences systeme
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  /* L'etat FINAL devient l'etat par defaut : on retire le mouvement,
     jamais le resultat. */
  *, *::before, *::after {
    animation-duration: .001ms !important;
    /* Le DECALAGE aussi : avec `both`, une tuile restait invisible pendant
       son delai de cascade (jusqu'a 275 ms) avant d'apparaitre d'un coup. */
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .tuile, .carte-auth, .menu__panneau { opacity: 1; transform: none; }
}

/* =========================================================================
   Back-office
   ========================================================================= */

.onglets {
  display: flex;
  gap: var(--e1);
  margin-bottom: var(--e5);
  padding: var(--e1);
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-m);
  overflow-x: auto;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }

.onglet {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--e2);
  min-height: var(--touche);
  padding: 0 var(--e4);
  border-radius: var(--r-xs);
  color: var(--encre-douce);
  font-size: var(--t-second);
  font-weight: 550;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.onglet:hover { background: var(--fond); color: var(--encre); text-decoration: none; }
.onglet[aria-current="page"] { background: var(--accent); color: #fff; }
.onglet[aria-current="page"]:hover { background: var(--accent-fonce); color: #fff; }

/* --- barre de filtres --- */
.filtres {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--e3);
  padding: var(--e4);
  margin-bottom: var(--e4);
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-m);
}
@media (min-width: 768px) {
  .filtres { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
}
.filtres .champ-groupe { margin: 0; }
.filtres .bouton { width: auto; }

/* --- panneau --- */
.panneau {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-l);
  box-shadow: var(--ombre-1);
  overflow: hidden;
}
.panneau__titre {
  margin: 0;
  padding: var(--e4) var(--e5);
  border-bottom: 1px solid var(--bordure);
  font-size: var(--t-section);
  font-weight: 650;
}

/* --- tableau --- */
.tableau { width: 100%; border-collapse: collapse; font-size: var(--t-second); }
.tableau th {
  padding: var(--e3) var(--e4);
  text-align: left;
  font-size: var(--t-micro);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .045em;
  color: var(--encre-tenue);
  background: var(--fond);
  border-bottom: 1px solid var(--bordure);
  white-space: nowrap;
}
.tableau td {
  padding: var(--e3) var(--e4);
  border-bottom: 1px solid var(--bordure);
  vertical-align: middle;
}
.tableau tr:last-child td { border-bottom: none; }
.tableau tbody tr:hover { background: var(--voile-ligne); }

.personne { display: flex; align-items: center; gap: var(--e3); }
.personne__nom { font-weight: 600; }
.personne__mail { font-size: var(--t-mention); color: var(--encre-tenue); }

/* Un select pose directement dans une cellule : discret au repos, il ne
   ressemble a un champ qu'au survol. Sinon un tableau de dix lignes devient
   un mur de bordures. */
.champ--cellule {
  min-height: 36px;
  padding: 6px 30px 6px 10px;
  border-color: transparent;
  background-color: transparent;
  font-size: var(--t-second);
  width: 100%;
  /* Pas de max-width : une liste plus etroite que son contenu affiche
     « Directeur d'expl… », ce qui est pire que pas de valeur du tout. */
}

/* Planchers de largeur par colonne. Sans eux, le tableau comprime les listes
   deroulantes au profit des boutons, et « Responsable d'exploitation » se
   termine en « Responsable d'exploita… » -- un libelle tronque au milieu d'un
   mot n'informe plus, il inquiete. Les valeurs viennent du libelle le plus
   long de chaque colonne, mesure, pas devine. */
.tableau--utilisateurs td:nth-child(1) { min-width: 232px; }
.tableau--utilisateurs td:nth-child(2) { min-width: 172px; }
.tableau--utilisateurs td:nth-child(3) { min-width: 252px; }  /* « Responsable d'exploitation » */
.tableau--utilisateurs td:last-child   { width: 1%; }

/* Le journal a d'autres colonnes : sans cette distinction, la regle ci-dessus
   ecrasait « Detail » a dix caracteres de large et le JSON s'y empilait
   verticalement, une lettre par ligne. */
.journal td:nth-child(1) { width: 1%; }
.journal td:nth-child(5) { width: auto; min-width: 260px; }
.champ--cellule:hover { border-color: var(--bordure-forte); background-color: var(--carte); }
.champ--cellule:focus { background-color: var(--carte); }

.actions-ligne { display: flex; gap: var(--e2); align-items: center; flex-wrap: wrap; }
.actions-ligne form { display: contents; }

.bouton--petit {
  width: auto;
  white-space: nowrap;     /* « Retirer admin » ne doit pas passer a la ligne */
  min-height: 36px;
  padding: 6px 13px;
  font-size: var(--t-second);
  font-weight: 600;
  border-radius: var(--r-xs);
  box-shadow: none;
  background: var(--fond);
  color: var(--encre-douce);
}
.bouton--petit:hover:not(:disabled) { background: var(--bordure); color: var(--encre); }
.bouton--danger { background: var(--alerte-pale); color: var(--alerte); }
.bouton--danger:hover:not(:disabled) { background: #fbdcda; color: var(--alerte); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--t-micro);
  font-weight: 600;
  background: var(--fond);
  color: var(--encre-douce);
  white-space: nowrap;
}
.badge--actif    { background: var(--succes-pale); color: var(--succes); }
.badge--inactif  { background: var(--alerte-pale); color: var(--alerte); }
.badge--admin    { background: var(--accent-pale); color: var(--accent-fonce); }
.badge--attente  { background: var(--attention-pale); color: var(--attention); }

/* --- journal --- */
.journal { font-size: var(--t-mention); }
.journal td { padding: var(--e2) var(--e4); }
.journal .quand { white-space: nowrap; color: var(--encre-tenue); font-size: var(--t-micro); }
.journal .detail {
  font-family: var(--police-chiffres);
  font-size: var(--t-micro);
  color: var(--encre-tenue);
  word-break: break-word;
}

/* =========================================================================
   Tableaux sur telephone : chaque ligne devient un bloc etiquete.
   Un tableau qui deborde horizontalement sur mobile n'est pas consultable ;
   les etiquettes viennent de data-cle, donc aucune duplication de libelle.
   Seuil 980 (et non 768) : a 820 px -- une tablette en portrait -- le tableau
   des utilisateurs, avec ses listes deroulantes, serait tasse.
   ========================================================================= */
@media (max-width: 979px) {
  .tableau thead { display: none; }
  .tableau, .tableau tbody, .tableau tr, .tableau td { display: block; width: 100%; }
  .tableau tr {
    padding: var(--e3) var(--e4);
    border-bottom: 1px solid var(--bordure);
  }
  .tableau tr:last-child { border-bottom: none; }
  .tableau td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--e4);
    padding: 5px 0;
    border: none;
  }
  .tableau td::before {
    content: attr(data-cle);
    flex: none;
    font-size: var(--t-micro);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--encre-tenue);
  }
  .tableau td:first-child { padding-bottom: var(--e3); }
  .tableau td:first-child::before { display: none; }
  .champ--cellule { max-width: none; border-color: var(--bordure-forte); background: var(--carte);
                    font-size: var(--t-texte); }   /* < 16 px : iOS zoome a la mise au point */
  .journal .detail { text-align: right; }
}

/* =========================================================================
   Referentiel des points — chiffres, zone de depot, jauge d'avancement
   ========================================================================= */

/* Les quatre chiffres de tete. `auto-fit` plutot qu'un nombre de colonnes
   fixe : la rangee se replie d'elle-meme sur telephone sans point de rupture
   supplementaire. */
.chiffres {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--e3);
  margin-bottom: var(--e5);
}
.chiffre {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-l);
  padding: var(--e4) var(--e4) var(--e3);
  text-align: center;
}
.chiffre__valeur {
  display: block;
  font-size: var(--t-titre);
  font-weight: 650;
  color: var(--encre);
  /* Chiffres a chasse fixe : sans cela, « 100 824 » et « 99 415 » n'ont pas
     la meme largeur et la rangee tressaute a chaque import. */
  font-variant-numeric: tabular-nums;
}
.chiffre__libelle {
  display: block;
  margin-top: var(--e1);
  font-size: var(--t-mention);
  color: var(--encre-douce);
}

/* Zone de depot. Le champ « file » natif est illisible et impossible a mettre
   en forme : on le masque et c'est le <label> qui devient la cible. Il reste
   atteignable au clavier parce que le champ est seulement transparent et
   superpose, jamais `display:none`. */
.depot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--e2);
  padding: var(--e6) var(--e4);
  border: 2px dashed var(--bordure-forte);
  border-radius: var(--r-l);
  background: var(--fond);
  color: var(--encre-douce);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
}
.depot:hover,
.depot:focus-within {
  border-color: var(--accent);
  background: var(--accent-pale);
  color: var(--accent);
}
.depot__titre { font-size: var(--t-section); font-weight: 600; color: var(--encre); }
.depot__aide  { font-size: var(--t-mention); }
.depot__entree {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Jauge d'avancement. La couleur est celle de l'ACTION, pas un vert de
   reussite : l'import n'a pas encore abouti. */
.jauge {
  height: 8px;
  border-radius: 999px;
  background: var(--bordure);
  overflow: hidden;
}
.jauge__barre {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 600ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .jauge__barre { transition: none; }
}

/* Les exemples d'anomalies sont des donnees brutes : chasse fixe pour que les
   codes postaux et les coordonnees s'alignent et se comparent d'un coup d'oeil. */
.tableau--anomalies .exemples {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--t-mention);
  color: var(--encre-douce);
  word-break: break-word;
}

/* =========================================================================
   Pied de page : le numero de version, discret, mene aux nouveautes
   ========================================================================= */
/* Le pied de page reste en BAS de la fenetre, meme sur une page courte :
   sans cela, sur l'accueil d'un compte a une seule application, la version
   flottait au milieu de l'ecran. */
.corps-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.corps-app > .page { flex: 1 0 auto; width: 100%; }

.pied-page {
  display: flex;
  justify-content: center;
  /* La page porte deja 64 px de marge basse : on la reprend en partie, sinon
     la version flotte loin sous le contenu. */
  margin-top: calc(-1 * var(--e6));
  padding: 0 var(--e4) calc(var(--e5) + env(safe-area-inset-bottom, 0px));
}
.pied-page__version {
  /* Discret a l'oeil, mais une cible de 44 px au doigt. */
  display: inline-flex;
  align-items: center;
  min-height: var(--touche);
  padding: 0 var(--e3);
  border-radius: var(--r-xs);
  font-size: var(--t-mention);
  color: var(--encre-tenue);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}
.pied-page__version:hover { color: var(--encre-douce); background: var(--carte); }

/* =========================================================================
   Page des nouveautes (lue dans CHANGELOG.md)
   ========================================================================= */
.version {
  display: grid;
  gap: var(--e3);
  padding: var(--e5);
  border-bottom: 1px solid var(--bordure);
}
.version:last-child { border-bottom: none; }
@media (min-width: 768px) {
  .version { grid-template-columns: 200px 1fr; gap: var(--e5); }
}
.version__numero {
  margin: 0;
  font-size: var(--t-section);
  font-weight: 650;
  letter-spacing: -.015em;
}
.version__date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--e2);
  margin: var(--e1) 0 0;
  font-size: var(--t-mention);
  color: var(--encre-tenue);
}
/* Neutre, pas bleu : le bleu ne dit que l'action, et ceci n'en est pas une. */
.version__actuelle {
  padding: 2px var(--e2);
  border-radius: 999px;
  background: var(--fond);
  font-size: var(--t-micro);
  font-weight: 650;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.version__rubrique {
  margin: var(--e4) 0 var(--e2);
  font-size: var(--t-micro);
  font-weight: 650;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: var(--encre-tenue);
}
.version__rubrique:first-child { margin-top: 0; }
.version__liste { margin: 0; padding-left: 1.1em; line-height: 1.55; }
.version__liste li + li { margin-top: var(--e1); }

/* =========================================================================
   Choix de l'icone d'une application (/admin/applications)
   ========================================================================= */
.choix-icone {
  grid-column: 1 / -1;            /* toute la largeur du formulaire */
  border: 1px solid var(--bordure);
  border-radius: var(--r-m);
  background: var(--fond);
}
.choix-icone__resume {
  display: flex;
  align-items: center;
  gap: var(--e3);
  min-height: var(--touche);
  padding: var(--e2) var(--e3);
  font-size: var(--t-second);
  font-weight: 600;
  color: var(--encre-douce);
  cursor: pointer;
  list-style: none;
}
.choix-icone__resume::-webkit-details-marker { display: none; }
.choix-icone__resume::after {
  content: "";
  width: 8px; height: 8px;
  margin-left: auto;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--transition);
}
.choix-icone[open] .choix-icone__resume::after { transform: rotate(-135deg); }

.choix-icone__grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--touche), 1fr));
  gap: var(--e2);
  padding: var(--e2) var(--e3) var(--e3);
}
/* Le bouton radio reste dans le flux (clavier, lecteur d'ecran), invisible ;
   c'est la vignette qui montre la selection. */
.choix-icone__option {
  position: relative;
  display: grid;
  place-items: center;
  min-height: var(--touche);
  border-radius: var(--r-s);
  cursor: pointer;
}
.choix-icone__option input {
  position: absolute; inset: 0;
  margin: 0; opacity: 0; cursor: pointer;
}
.choix-icone__option:hover { background: var(--carte); }
/* Selecteur de voisin et non :has() : compris par tous les navigateurs. */
.choix-icone__option input:checked + .tuile__icone {
  box-shadow: 0 0 0 2px var(--fond), 0 0 0 4px var(--accent);
}
.choix-icone__option input:focus-visible + .tuile__icone {
  box-shadow: 0 0 0 2px var(--fond), 0 0 0 4px var(--accent), 0 0 0 8px var(--accent-voile);
}

.choix-icone__import {
  display: grid;
  gap: var(--e1);
  padding: var(--e3);
  border-top: 1px solid var(--bordure);
}
.choix-icone__import input { font-size: var(--t-second); max-width: 100%; }
.choix-icone__aide { font-size: var(--t-mention); color: var(--encre-tenue); }

/* Texte reserve aux lecteurs d'ecran. */
.masque-visuel {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================================
   Postes (/admin/postes)
   ========================================================================= */
.postes__note {
  display: flex;
  gap: var(--e2);
  align-items: flex-start;
  margin: 0 0 var(--e5);
  font-size: var(--t-mention);
}
.postes__note svg { flex: none; margin-top: 2px; }

.poste { margin-bottom: var(--e5); padding: var(--e5); }
.poste__entete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--e2) var(--e3);
  margin-bottom: var(--e4);
}
.poste__titre {
  margin: 0;
  font-size: var(--t-section);
  font-weight: 650;
  letter-spacing: -.015em;
}
.poste__effectif { margin-left: auto; font-size: var(--t-mention); color: var(--encre-tenue); }

.poste__champs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 var(--e3);
}
@media (min-width: 768px) {
  .poste__champs { grid-template-columns: 1fr 2fr 110px; }
}

/* Les permissions, une colonne par application. */
.poste__permissions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--e3);
  margin-top: var(--e4);
}
.groupe-permissions {
  margin: 0;
  padding: var(--e3) var(--e4) var(--e2);
  border: 1px solid var(--bordure);
  border-radius: var(--r-m);
  background: var(--fond);
}
.groupe-permissions__titre {
  padding: 0 var(--e1);
  font-size: var(--t-micro);
  font-weight: 650;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: var(--encre-tenue);
}
/* Une case avec son explication : la case s'aligne sur la premiere ligne. */
.coche--detail { align-items: flex-start; }
.coche--detail input { margin-top: 1px; }
.coche__aide {
  display: block;
  margin-top: 2px;
  font-size: var(--t-mention);
  color: var(--encre-tenue);
  line-height: 1.4;
}

.poste__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--e3);
  margin-top: var(--e4);
}
.poste__actions .bouton { width: auto; }
.poste__garde { font-size: var(--t-mention); color: var(--encre-tenue); }
