/* Design system — encre / cuivre / sable (SPEC-03 §4).
   Mobile-first : le collecteur se remplit au pouce, sur smartphone, en 4G. */

:root {
  --encre: #12343B;
  --cuivre: #B05E1E;
  --sable: #F4F1EA;
  --encre-clair: #2C555E;
  --sable-ombre: #E6E0D3;
  --blanc: #FFFFFF;
  --erreur: #8A2B12;
  --succes: #2F6B3A;

  --rayon: 10px;
  --espace: 16px;
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--police);
  font-size: 17px;
  line-height: 1.5;
  color: var(--encre);
  background: var(--sable);
  -webkit-text-size-adjust: 100%;
}

/* --- Structure --- */

.bandeau {
  background: var(--encre);
  color: var(--sable);
  padding: 12px var(--espace);
  padding-top: max(12px, env(safe-area-inset-top));
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--espace);
  padding-bottom: 48px;
}

.carte {
  background: var(--blanc);
  border-radius: var(--rayon);
  padding: 20px var(--espace);
  box-shadow: 0 1px 3px rgba(18, 52, 59, 0.12);
}

.carte--centre { text-align: center; }

h1 { font-size: 1.5rem; margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 28px 0 8px; }

.chapo { margin: 0 0 20px; color: var(--encre-clair); }
.note { font-size: 0.9rem; color: var(--encre-clair); margin: 16px 0 0; }

.bandeau-mode {
  background: var(--sable-ombre);
  border-left: 4px solid var(--cuivre);
  padding: 8px 12px;
  margin: 0 0 16px;
  font-size: 0.9rem;
}

/* --- Formulaires --- */

.formulaire { margin: 0; }
.formulaire.masque, .masque { display: none; }

.section {
  border: 0;
  border-top: 2px solid var(--sable-ombre);
  padding: 16px 0 0;
  margin: 24px 0 0;
}

.section__titre {
  font-weight: 700;
  color: var(--cuivre);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
  padding: 0;
}

.champ { display: block; border: 0; padding: 0; margin: 0 0 20px; }
.champ__libelle { display: block; font-weight: 600; margin-bottom: 6px; }
.champ__aide { margin: 0 0 6px; font-size: 0.85rem; color: var(--encre-clair); }

input[type="text"],
input[type="number"],
input[type="file"],
textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 12px;
  border: 1px solid var(--sable-ombre);
  border-radius: var(--rayon);
  background: var(--blanc);
}

textarea { resize: vertical; min-height: 84px; }

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: 3px solid rgba(176, 94, 30, 0.35);
  border-color: var(--cuivre);
}

.liste-reponses input { margin-bottom: 8px; }

/* --- Échelle 1-5 --- */

.echelle { display: flex; gap: 8px; }

.echelle__cran {
  flex: 1;
  position: relative;
  text-align: center;
}

.echelle__cran input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; }

.echelle__cran span {
  display: block;
  padding: 14px 0;
  border: 1px solid var(--sable-ombre);
  border-radius: var(--rayon);
  font-weight: 600;
}

.echelle__cran input:checked + span {
  background: var(--cuivre);
  border-color: var(--cuivre);
  color: var(--blanc);
}

/* --- Liste de participants --- */

.liste-participants { list-style: none; margin: 0 0 12px; padding: 0; }
.liste-participants li { margin-bottom: 8px; }

.participant {
  display: block;
  position: relative;
  padding: 14px 14px 14px 44px;
  border: 1px solid var(--sable-ombre);
  border-radius: var(--rayon);
  text-decoration: none;
  color: inherit;
}

a.participant { padding-left: 14px; }

.participant input { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.participant__nom { display: block; font-weight: 600; }
.participant__fonction { display: block; font-size: 0.85rem; color: var(--encre-clair); }
.participant:has(input:checked) { border-color: var(--cuivre); background: var(--sable); }
.participant--soumis { opacity: 0.75; }

.jeton {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sable-ombre);
  font-size: 0.75rem;
}

/* --- Consentement --- */

.consentement {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  margin: 20px 0;
  background: var(--sable);
  border-radius: var(--rayon);
  font-size: 0.92rem;
}

.consentement input { margin-top: 4px; flex: 0 0 auto; width: 20px; height: 20px; }

/* --- Boutons --- */

.bouton {
  display: block;
  width: 100%;
  padding: 16px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: 0;
  border-radius: var(--rayon);
  cursor: pointer;
}

.bouton--principal { background: var(--cuivre); color: var(--blanc); }
.bouton--secondaire {
  background: transparent;
  color: var(--encre);
  border: 1px solid var(--encre);
  margin-top: 12px;
}

.lien-discret {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 0;
  background: none;
  border: 0;
  font: inherit;
  color: var(--cuivre);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Alertes & état --- */

.alerte { padding: 12px 14px; border-radius: var(--rayon); margin: 0 0 16px; }
/* Une alerte qui porte son propre bouton d'action : les paragraphes ne doivent
   pas doubler les marges déjà données par l'alerte. */
.alerte > p { margin: 0 0 8px; }
.alerte > .formulaire { margin-top: 12px; }
.alerte--erreur { background: #FBEDE9; color: var(--erreur); }
.alerte--succes { background: #EAF3EC; color: var(--succes); }
ul.alerte { padding-left: 32px; }

.etat-sauvegarde {
  position: sticky;
  bottom: 0;
  margin: 12px 0 0;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--encre-clair);
  text-align: center;
  /* Collé en bas et sans fond, il se superposait au texte de la question
     suivante : deux phrases l'une sur l'autre, illisibles. */
  background: var(--blanc);
  border-top: 1px solid var(--sable-ombre);
}

.etat-sauvegarde[data-etat="hors-ligne"] { color: var(--erreur); font-weight: 600; }

.bloc-code {
  background: var(--sable);
  padding: 12px;
  border-radius: var(--rayon);
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Cockpit facilitateur --- */

.compteurs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.compteurs li {
  text-align: center;
  padding: 10px 4px;
  background: var(--sable);
  border-radius: var(--rayon);
}

.compteurs strong { display: block; font-size: 1.6rem; line-height: 1.1; }
.compteurs span { font-size: 0.75rem; color: var(--encre-clair); }

/* Le signal appelle le regard sans crier : le facilitateur balaie l'écran
   entre deux tables, il ne le lit pas. */
.compteur--alerte { background: rgba(176, 94, 30, 0.18); }
.compteur--alerte strong { color: var(--cuivre); }

.participant--signale { border-color: var(--cuivre); border-left-width: 4px; }
.participant__motifs {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--cuivre);
}

/* --- Contrôle qualité --- */

.suggestion {
  border: 1px solid var(--sable-ombre);
  border-radius: var(--rayon);
  padding: 14px;
  margin: 0 0 20px;
}

.suggestion__entete { margin: 0 0 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.suggestion h2 { margin: 0 0 8px; font-size: 1.05rem; }

.suggestion__verbatim {
  margin: 0 0 12px;
  padding-left: 12px;
  border-left: 3px solid var(--sable-ombre);
  font-style: italic;
  color: var(--encre-clair);
}

.decisions { display: flex; gap: 8px; flex-wrap: wrap; }
.decisions .bouton { flex: 1 1 30%; padding: 12px 8px; }

/* Écarter retire l'objet entier : l'action est séparée du bloc de décision
   par champ, et signalée. Rien n'est supprimé pour autant (ERRATA-01 E11). */
.formulaire--ecarter {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--sable-ombre);
}

.formulaire--ecarter input { margin-bottom: 8px; }

.bouton--danger {
  background: transparent;
  color: var(--erreur);
  border: 1px solid var(--erreur);
}

/* --- Dossier de Contexte (écran facilitateur) --- */

.dossier {
  border: 1px solid var(--sable-ombre);
  border-radius: var(--rayon);
  padding: 14px 16px;
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.dossier h1, .dossier h2 { font-size: 1.05rem; margin: 14px 0 6px; }
.dossier h3 { font-size: 0.95rem; margin: 12px 0 4px; }
.dossier ul, .dossier ol { padding-left: 20px; }
.dossier table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dossier th, .dossier td { border: 1px solid var(--sable-ombre); padding: 6px 8px; text-align: left; }

/* La partie B est réservée : elle se distingue au premier coup d'œil, pour qu'on
   ne la projette jamais par inadvertance. */
.dossier--b { border-left: 4px solid var(--erreur); background: #FDF6F4; }

/* --- Relance inline (SPEC-02 B5) --- */

.relance { margin: -8px 0 20px; }

.relance__question {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: var(--sable);
  border-left: 3px solid var(--cuivre);
  border-radius: 0 var(--rayon) var(--rayon) 0;
  font-size: 0.95rem;
}

/* Une relance indisponible ne doit pas ressembler à une question posée. */
.relance__question[data-etat="indisponible"] {
  border-left-color: var(--sable-ombre);
  color: var(--encre-clair);
  font-size: 0.85rem;
}

/* --- Écran large : le collecteur sur ordinateur portable ---
   Beaucoup de participants viennent avec un portable. Le collecteur reste
   mobile-first — c'est la contrainte dure — mais une mise en page pensée pour
   le pouce laisse, sur 1280 px, des champs de récit hauts de trois lignes là
   où les réponses seront justement les plus riches. */

@media (min-width: 1024px) {
  .page {
    max-width: 820px;
    padding: 24px 24px 64px;
  }

  /* Le geste change : on tape au clavier, on écrit plus long, on veut voir ce
     qu'on a écrit sans faire défiler le champ. */
  textarea {
    min-height: 200px;
    padding: 14px 16px;
    line-height: 1.55;
  }

  .champ { margin-bottom: 26px; }
  .section { margin-top: 32px; padding-top: 20px; }

  /* Un bouton de 800 px de large n'est plus un bouton. */
  .formulaire > .bouton,
  .formulaire > .bouton--principal {
    width: auto;
    min-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Les crans de l'échelle 1-5 n'ont pas besoin de la largeur d'un pouce. */
  .echelle { max-width: 520px; }
}

/* --- Sondage des goulets (Acte 3) --- */

.sondage {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 0 12px;
}

.sondage__cran span {
  display: block;
  font-size: 0.78rem;
  color: var(--encre-clair);
  margin-bottom: 4px;
}
