/* Audit SI : interface de saisie, pensée d'abord pour le téléphone et la tablette. */
:root {
  --fond: #f3f5f8;
  --carte: #ffffff;
  --encre: #18212b;
  --discret: #5a6675;
  --trait: #d5dae1;
  --accent: #1f4e79;
  --accent-texte: #ffffff;
  --vert: #1a7f4b;   --vert-fond: #e3f4ea;
  --orange: #a85600; --orange-fond: #fdeed9;
  --rouge: #b3261e;  --rouge-fond: #fbe3e1;
  --jaune: #7a6100;  --jaune-fond: #fbf3d0;
  --gris: #5a6675;   --gris-fond: #e9edf2;
  --rayon: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #12171d; --carte: #1b222b; --encre: #e8edf2; --discret: #9eabba; --trait: #323d4a;
    --accent: #7db4e6; --accent-texte: #0d1620;
    --vert: #6fd3a0;   --vert-fond: #173427;
    --orange: #f2b266; --orange-fond: #3a2a14;
    --rouge: #f29a94;  --rouge-fond: #3d1c1a;
    --jaune: #e6cf6a;  --jaune-fond: #353015;
    --gris: #9eabba;   --gris-fond: #27303b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--encre);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 60rem; margin: 0 auto; padding: 1rem 1rem 4rem; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: .75rem 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p { margin: .5rem 0; }
a { color: var(--accent); }
.discret { color: var(--discret); font-size: .9rem; }
[hidden] { display: none !important; }

/* Barre du haut */
.barre {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-texte);
}
.barre a { color: inherit; text-decoration: none; }
.barre .marque { font-weight: 700; }
.barre .fil { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .92; }
.barre .fil::before { content: "› "; }
.barre form { margin-left: auto; }
.barre .lien { color: inherit; }

/* Cartes et alertes */
.carte {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 1rem; margin: 1rem 0;
}
.carte.etroit { max-width: 26rem; margin: 3rem auto; }
.alerte { border-radius: var(--rayon); padding: .75rem 1rem; margin: 1rem 0; border: 1px solid; }
.alerte.vert { background: var(--vert-fond); color: var(--vert); border-color: var(--vert); }
.alerte.orange { background: var(--orange-fond); color: var(--orange); border-color: var(--orange); }
.alerte.rouge { background: var(--rouge-fond); color: var(--rouge); border-color: var(--rouge); }
.alerte pre { white-space: pre-wrap; font-size: .85rem; margin: .5rem 0 0; }

/* Champs et boutons */
label { display: block; font-size: .9rem; font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem; font: inherit; font-weight: 400;
  color: var(--encre); background: var(--carte); border: 1px solid var(--trait); border-radius: 8px;
}
input[type=radio], input[type=checkbox] { display: inline-block; width: auto; margin: 0; }
input[type=file] { padding: .4rem; }
textarea { resize: vertical; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, .bouton {
  display: inline-block; padding: .6rem 1rem; font: inherit; font-weight: 600; text-decoration: none;
  color: var(--encre); background: var(--carte); border: 1px solid var(--trait); border-radius: 8px;
  cursor: pointer; min-height: 2.75rem;
}
button:hover, .bouton:hover { border-color: var(--accent); }
.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.danger { color: var(--rouge); border-color: var(--rouge); }
.lien {
  background: none; border: 0; padding: .25rem 0; min-height: 0; color: var(--accent);
  font-weight: 400; text-decoration: underline; cursor: pointer;
}
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.pile > * + * { margin-top: .9rem; }
.ligne { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.ligne > label { flex: 1 1 12rem; }
.coche { display: flex; align-items: center; gap: .4rem; flex: 0 0 auto !important; min-height: 2.75rem; }
.grille-form { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) {
  .grille-form { grid-template-columns: 1fr 1fr; }
  .grille-form .large { grid-column: 1 / -1; }
}
fieldset.bloc { border: 1px solid var(--trait); border-radius: var(--rayon); padding: .9rem; margin: 0; }
fieldset.bloc > label { margin-top: .9rem; }
fieldset.bloc legend { font-weight: 700; padding: 0 .4rem; }

/* Listes cliquables */
.liste, .domaines { list-style: none; margin: 0 0 .75rem; padding: 0; }
.liste li + li, .domaines li + li { border-top: 1px solid var(--trait); }
.liste a { display: block; padding: .7rem .25rem; text-decoration: none; color: inherit; }
.liste a .discret { display: block; }
.domaines a {
  display: grid; grid-template-columns: 2.2rem 1fr auto 3rem; gap: .6rem; align-items: center;
  padding: .7rem .25rem; text-decoration: none; color: inherit;
}
.liste a:hover, .domaines a:hover { background: var(--fond); }
.num { font-variant-numeric: tabular-nums; color: var(--discret); font-weight: 600; }
.avance { color: var(--discret); font-size: .85rem; font-variant-numeric: tabular-nums; }

/* Pastilles de couleur */
.pastille {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700;
  text-align: center; background: var(--gris-fond); color: var(--gris);
}
.pastille.vert { background: var(--vert-fond); color: var(--vert); }
.pastille.orange { background: var(--orange-fond); color: var(--orange); }
.pastille.rouge { background: var(--rouge-fond); color: var(--rouge); }
.pastille.jaune { background: var(--jaune-fond); color: var(--jaune); }

/* Synthèse */
.synthese { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.synthese-texte { flex: 1 1 14rem; }
.note-globale { display: flex; align-items: baseline; gap: .3rem; color: var(--gris); }
.note-globale.vert { color: var(--vert); }
.note-globale.orange { color: var(--orange); }
.note-globale.rouge { color: var(--rouge); }
.note-globale .chiffre { font-size: 3rem; font-weight: 800; line-height: 1; }
progress { width: 100%; height: .6rem; accent-color: var(--accent); }
.tuiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.tuiles a {
  display: block; padding: .9rem; background: var(--carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); text-decoration: none; color: inherit;
}
.tuiles a:hover { border-color: var(--accent); }
.tuiles strong { display: block; color: var(--accent); }
.tuiles span { font-size: .9rem; color: var(--discret); }
.totaux { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.totaux strong { font-size: 1.3rem; }
.constats { margin: 0; padding-left: 1.4rem; }
.constats li { padding: .5rem 0 .5rem .6rem; border-left: 4px solid var(--trait); margin-bottom: .5rem; }
.constats li.rouge { border-left-color: var(--rouge); }
.constats li.orange { border-left-color: var(--orange); }
.constats li.jaune { border-left-color: var(--jaune); }

/* Navigation entre domaines */
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: center; font-size: .9rem; margin: .5rem 0; }
.pagination > :last-child { justify-self: end; text-align: right; }
.entete-section { display: flex; align-items: center; gap: .75rem; justify-content: space-between; }

/* Questions */
.question {
  position: relative; background: var(--carte); border: 1px solid var(--trait); border-left-width: 5px;
  border-radius: var(--rayon); padding: .9rem 1rem; margin: .75rem 0; min-width: 0;
}
.question legend { float: left; width: 100%; padding: 0; font-weight: 600; margin-bottom: .4rem; }
.question legend + * { clear: both; }
.question[data-etat=ok] { border-left-color: var(--vert); }
.question[data-etat=partiel], .question[data-etat=nsp] { border-left-color: var(--orange); }
.question[data-etat=ko] { border-left-color: var(--rouge); }
.question[data-etat=info], .question[data-etat=na] { border-left-color: var(--accent); }
.aide { color: var(--discret); font-size: .9rem; margin: 0 0 .5rem; clear: both; }
.choix { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; clear: both; }
.opt { position: relative; font-weight: 400; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.opt span {
  display: block; padding: .55rem .9rem; min-height: 2.75rem; border: 1px solid var(--trait);
  border-radius: 8px; background: var(--carte);
}
.opt input:checked + span { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); font-weight: 600; }
.opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.conseil {
  display: none; margin-top: .6rem; padding: .6rem .75rem; border-radius: 8px; font-size: .92rem;
  background: var(--orange-fond); color: var(--encre);
}
.question[data-etat=ko] .conseil { display: block; background: var(--rouge-fond); }
.question[data-etat=partiel] .conseil, .question[data-etat=nsp] .conseil { display: block; }
details { margin-top: .5rem; }
summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.etat { display: block; min-height: 1.2rem; font-size: .8rem; color: var(--discret); margin-top: .3rem; }
.etat[data-etat=erreur] { color: var(--rouge); font-weight: 600; }

/* Tableaux */
.defile { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .5rem .6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
th { white-space: nowrap; color: var(--discret); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }

/* Activités, actions, photos */
.activite, .action { padding: .75rem 0; border-top: 1px solid var(--trait); }
.activite:first-of-type, .action:first-of-type { border-top: 0; }
.action.ecartee > p { opacity: .55; text-decoration: line-through; }
.vignettes { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); margin-bottom: 1rem; }
.vignettes figure { margin: 0; }
.vignettes img { width: 100%; height: 8rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--trait); display: block; }
.vignettes figcaption { font-size: .85rem; color: var(--discret); }
