/* =============================================================================
   DepUtils - Feuille de style principale
   ========================================================================== */

:root {
  --bleu:        #1d4e89;
  --bleu-clair:  #2f7fb5;
  --ambre:       #b45309;
  --ambre-bg:    #fef3c7;
  --vert:        #15803d;
  --vert-bg:     #dcfce7;
  --rouge:       #b91c1c;
  --rouge-bg:    #fee2e2;

  --fond:        #f6f7f9;
  --fond-carte:  #ffffff;
  --bordure:     #e3e6ea;
  --texte:       #16202b;
  --texte-doux:  #5c6b7a;

  --rayon:       10px;
  --ombre:       0 1px 2px rgba(16, 32, 43, .06), 0 4px 14px rgba(16, 32, 43, .05);
  --largeur:     1080px;
  --police:      system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:        ui-monospace, "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bleu:       #74a9d8;
    --bleu-clair: #8fc3e8;
    --ambre:      #fbbf24;
    --ambre-bg:   #3a2c0a;
    --vert:       #6ee7a0;
    --vert-bg:    #0f2e1d;
    --rouge:      #fca5a5;
    --rouge-bg:   #3b1616;

    --fond:       #10161d;
    --fond-carte: #18212b;
    --bordure:    #2a3643;
    --texte:      #e8edf2;
    --texte-doux: #9bacbd;
    --ombre:      0 1px 2px rgba(0, 0, 0, .4);
  }
}

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

html { font-size: 16px; }

body {
  font-family: var(--police);
  background: var(--fond);
  color: var(--texte);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bleu); }
a:hover { color: var(--bleu-clair); }

:focus-visible {
  outline: 3px solid var(--bleu-clair);
  outline-offset: 2px;
  border-radius: 3px;
}

code, pre { font-family: var(--mono); font-size: .92em; }

.conteneur {
  width: 100%;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0 20px;
}

/* -- En-tête --------------------------------------------------------------- */

.entete {
  background: var(--fond-carte);
  border-bottom: 1px solid var(--bordure);
  position: sticky;
  top: 0;
  z-index: 10;
}

.entete-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  flex-wrap: wrap;
}

.marque { text-decoration: none; color: inherit; display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.marque-logo { flex: none; display: block; }
.marque-texte { display: flex; flex-direction: column; }
.marque-nom { font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; color: var(--bleu); }
.marque-sous { font-size: .78rem; color: var(--texte-doux); }

.nav-espaces { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-espaces a {
  padding: 7px 13px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--texte-doux);
  font-size: .92rem;
  font-weight: 500;
}
.nav-espaces a:hover { background: var(--fond); color: var(--texte); }
.nav-espaces a.actif { background: var(--bleu); color: #fff; }

/* -- Bandeaux -------------------------------------------------------------- */

.bandeau {
  padding: 12px 20px;
  font-size: .93rem;
  border-radius: var(--rayon);
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.bandeau-test {
  background: var(--ambre-bg);
  color: var(--ambre);
  border-color: currentColor;
  border-radius: 0;
  margin-bottom: 0;
  text-align: center;
}

.bandeau-local  { background: var(--vert-bg);  color: var(--vert);  border-color: currentColor; }
.bandeau-erreur { background: var(--rouge-bg); color: var(--rouge); border-color: currentColor; }
.bandeau-succes { background: var(--vert-bg);  color: var(--vert);  border-color: currentColor; }
.bandeau-alerte { background: var(--ambre-bg); color: var(--ambre); border-color: currentColor; }

/* -- Contenu --------------------------------------------------------------- */

main { flex: 1; padding: 28px 20px 56px; }

.fil { font-size: .85rem; color: var(--texte-doux); margin-bottom: 20px; }
.fil a { text-decoration: none; }
.fil a:hover { text-decoration: underline; }
.fil-sep { margin: 0 7px; opacity: .6; }

.hero { margin-bottom: 28px; }
.hero h1 { font-size: 1.85rem; letter-spacing: -.02em; line-height: 1.25; }
.hero-texte { color: var(--texte-doux); margin-top: 8px; max-width: 100%; }
.titre-section { font-size: 1.1rem; margin: 28px 0 12px; }

.lien-aide { font-size: .92rem; font-weight: 500; }

.vide {
  color: var(--texte-doux);
  background: var(--fond-carte);
  border: 1px dashed var(--bordure);
  border-radius: var(--rayon);
  padding: 28px;
  text-align: center;
}

/* -- Grilles et cartes ----------------------------------------------------- */

.grille { display: grid; gap: 16px; }
.grille-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grille-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.carte {
  display: block;
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 20px;
  box-shadow: var(--ombre);
  text-decoration: none;
  color: inherit;
  transition: border-color .12s, transform .12s;
}
.carte:hover { border-color: var(--bleu); transform: translateY(-1px); color: inherit; }
.carte h2 { font-size: 1.15rem; margin-bottom: 6px; color: var(--bleu); }
.carte h3 { font-size: 1.03rem; margin-bottom: 6px; color: var(--bleu); }
.carte p { color: var(--texte-doux); font-size: .92rem; }
.carte-meta { margin-top: 12px; font-size: .82rem; display: flex; gap: 6px; flex-wrap: wrap; }

.etiquette {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--fond);
  border: 1px solid var(--bordure);
  color: var(--texte-doux);
  font-size: .78rem;
}
.etiquette-local { background: var(--vert-bg);  color: var(--vert);  border-color: transparent; }
.etiquette-test  { background: var(--ambre-bg); color: var(--ambre); border-color: transparent; }
/* Statut d'un fichier à déposer : requis, requis selon le sondage, facultatif (neutre). */
.etiquette-requis { color: var(--bleu); border-color: var(--bleu); font-weight: 600; }
.etiquette-selon  { color: var(--ambre); border-color: var(--ambre); }
.champ-entete > .etiquette { font-size: .72rem; padding: 0 7px; }
.legende-fichiers { margin: -6px 0 12px; font-size: .78rem; color: var(--texte-doux); }
.legende-fichiers > summary { cursor: pointer; width: max-content; }
.legende-fichiers > p { margin: 4px 0 0 14px; line-height: 1.9; }
.legende-fichiers .etiquette { font-size: .7rem; padding: 0 6px; }

/* -- Panneau (corps d'un outil) -------------------------------------------- */

.panneau {
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 24px;
  box-shadow: var(--ombre);
}

/* -- Fil des étapes -------------------------------------------------------- */

.etapes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  list-style: none;
  margin-bottom: 20px;
}
.etapes li { display: flex; align-items: center; gap: 9px; font-size: .9rem; color: var(--texte-doux); }
.etape-num {
  display: grid;
  place-items: center;
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: .8rem;
  font-weight: 600;
  flex-shrink: 0;
}
.etapes li.courante { color: var(--bleu); font-weight: 600; }
.etapes li.courante .etape-num { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.etapes li.faite { color: var(--vert); }
.etapes li.faite .etape-num { background: var(--vert); border-color: var(--vert); color: var(--fond-carte); }

/* -- Blocs d'un outil --------------------------------------------------------
   Un outil se lit de haut en bas : déposer, régler, contrôler, télécharger.
   Chaque temps est un bloc numéroté, et un bloc n'apparaît que lorsque le
   précédent est renseigné - c'est ce qui évite la page entière d'un coup. */

.bloc-outil { border-top: 1px solid var(--bordure); margin-top: 26px; padding-top: 22px; }
.bloc-outil:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.bloc-outil[hidden] { display: none; }

.bloc-titre {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.08rem;
  margin-bottom: 14px;
}
.bloc-num {
  display: grid;
  place-items: center;
  width: 25px; height: 25px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bleu);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
}
.bloc-attente {
  color: var(--texte-doux);
  font-size: .9rem;
  border: 1px dashed var(--bordure);
  border-radius: var(--rayon);
  padding: 14px 16px;
}

/* Champs d'un même fichier, ou d'un même sujet, tenus ensemble. */
.groupe-champs { margin-bottom: 22px; }
.groupe-champs > h4 {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--texte-doux);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bordure);
}

/* Contenu long (un tableau de vérification) que l'on déplie à la demande. */
.pliant {
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: var(--fond);
}
.pliant > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.pliant > summary::-webkit-details-marker { display: none; }
.pliant > summary::marker { content: ''; }
.pliant > summary.a-survol { cursor: pointer; }
.pliant > summary::before { content: '\25B8'; color: var(--texte-doux); font-size: .8rem; }
.pliant[open] > summary::before { content: '\25BE'; }
.pliant[open] > summary { border-bottom: 1px solid var(--bordure); }
.pliant-corps { padding: 4px 14px 14px; background: var(--fond-carte); border-radius: 0 0 var(--rayon) var(--rayon); }

/* -- Bulle d'aide ------------------------------------------------------------
   L'aide d'un champ tient en une pastille "?" que l'on ouvre au clic :
   affichée en permanence, elle noyait les champs eux-mêmes. En <details>,
   donc sans JavaScript : le clavier et les lecteurs d'écran la trouvent. */

.aide { position: relative; display: inline-block; vertical-align: middle; line-height: 1; }

.aide > summary {
  display: grid;
  place-items: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  border: 1px solid var(--bordure);
  background: var(--fond);
  color: var(--texte-doux);
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.aide > summary::-webkit-details-marker { display: none; }
.aide > summary::marker { content: ''; }
.aide > summary:hover { border-color: var(--bleu); color: var(--bleu); }
.aide[open] > summary { background: var(--bleu); border-color: var(--bleu); color: #fff; }

.aide-bulle {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  left: 0;
  display: block;
  width: max-content;
  max-width: min(360px, 74vw);
  padding: 10px 13px;
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  box-shadow: var(--ombre);
  color: var(--texte);
  font-size: .86rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
}
.aide-bulle code { background: var(--fond); padding: 1px 5px; border-radius: 4px; }

/* Sur un écran étroit, une bulle ancrée sur la pastille déborderait à droite :
   elle s'ancre alors sur la ligne entière et en prend toute la largeur. */
@media (max-width: 560px) {
  .aide { position: static; }
  .champ-entete, .bloc-titre { position: relative; }
  .aide-bulle { left: 0; right: 0; width: auto; max-width: none; }
}

/* -- Formulaires ----------------------------------------------------------- */

.champ { margin-bottom: 20px; }
.champ > label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 6px; }
.aide-champ { display: block; font-weight: 400; color: var(--texte-doux); font-size: .86rem; margin-top: 2px; }

/* Libellé et bulle d'aide sur une même ligne, au-dessus du champ. */
.champ-entete { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.champ-entete > label { margin-bottom: 0; }

input[type="text"], input[type="number"], input[type="file"], select, textarea {
  width: 100%;
  max-width: 460px;
  padding: 9px 11px;
  border: 1px solid var(--bordure);
  border-radius: 7px;
  background: var(--fond);
  color: var(--texte);
  font: inherit;
  font-size: .94rem;
}
input[type="file"] { padding: 8px; cursor: pointer; }

.bouton {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--bleu);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: .94rem;
  cursor: pointer;
  text-decoration: none;
}
.bouton:hover { background: var(--bleu-clair); color: #fff; }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.bouton-secondaire { background: transparent; color: var(--bleu); border-color: var(--bordure); }
.bouton-secondaire:hover { background: var(--fond); color: var(--bleu); }

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

/* -- Tableaux -------------------------------------------------------------- */

.tableau-enveloppe { overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 7px 11px; border-bottom: 1px solid var(--bordure); }
th { font-weight: 600; color: var(--texte-doux); font-size: .84rem; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--fond); }

/* Un tableau de vérification se parcourt en entier : il défile sur place plutôt
   que de repousser les boutons de téléchargement hors de l'écran. */
.tableau-defile { max-height: 440px; overflow: auto; }
.tableau-defile thead th { position: sticky; top: 0; background: var(--fond-carte); z-index: 1; }

tbody tr.ligne-attention td { background: var(--ambre-bg); }
tbody tr.ligne-probleme  td { background: var(--rouge-bg); }

/* -- Indicateurs de contrôle -------------------------------------------------
   Les compteurs que l'on relit avant de valider un import : effectifs,
   moyennes, lignes non appariées. */

.metriques {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.metrique {
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 10px 13px;
  background: var(--fond);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metrique-valeur { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.metrique-libelle { font-size: .74rem; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .04em; }
.metrique-detail { font-size: .78rem; color: var(--texte-doux); }

.metrique-alerte  { border-color: var(--ambre); }

/* Ligne de tableau à regarder : groupe plein, étudiant à reprendre. */
tr.ligne-alerte > td { background: color-mix(in srgb, var(--ambre) 10%, transparent); }

/* Une valeur ou un en-tête qui s'explique au survol (attribut title). */
.a-survol { cursor: help; }
th.a-survol, td.a-survol, .metrique.a-survol .metrique-libelle {
  text-decoration: underline dotted var(--texte-doux);
  text-underline-offset: 3px;
}
.metrique-alerte .metrique-valeur { color: var(--ambre); }
.metrique-probleme { border-color: var(--rouge); }
.metrique-probleme .metrique-valeur { color: var(--rouge); }

/* -- Prose (documentation) ------------------------------------------------- */

.prose { max-width: 100%; }
.prose h2 { font-size: 1.3rem; margin: 26px 0 10px; }
.prose h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.prose h4 { font-size: .97rem; margin: 18px 0 8px; color: var(--texte-doux); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin-bottom: 13px; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin-bottom: 4px; }
.prose code { background: var(--fond); padding: 1px 5px; border-radius: 4px; }
.prose pre {
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: 7px;
  padding: 13px 15px;
  overflow-x: auto;
  margin-bottom: 13px;
}
.prose pre code { background: none; padding: 0; }
.prose blockquote {
  border-left: 3px solid var(--bleu);
  padding-left: 14px;
  color: var(--texte-doux);
  margin-bottom: 13px;
}
.prose hr { border: 0; border-top: 1px solid var(--bordure); margin: 22px 0; }

/* -- Pied ------------------------------------------------------------------ */

.pied {
  border-top: 1px solid var(--bordure);
  padding: 20px 0;
  font-size: .84rem;
  color: var(--texte-doux);
  background: var(--fond-carte);
}
.pied p { max-width: 100% }

/* -- Impression ------------------------------------------------------------ */

@media print {
  .entete, .pied, .fil, .etapes, .actions { display: none; }
  body { background: #fff; }
  .panneau, .carte { box-shadow: none; border-color: #ccc; }
}
