:root {
  --encre: #1c2433;
  --encre-2: #4a5568;
  --encre-3: #718096;
  --papier: #f5f3ee;
  --carte: #ffffff;
  --trait: #dcd8cf;
  --accent: #1f3a5f;
  --accent-2: #2c5282;
  --accent-doux: #e8eef6;
  --ok: #2f6b3a;
  --ok-doux: #e9f3ea;
  --erreur: #9b2c2c;
  --rayon: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.2rem; margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
[hidden] { display: none !important; }

.entete { position: sticky; top: 0; z-index: 5; background: var(--accent); color: #fff; }
.entete-in { max-width: 760px; margin: 0 auto; padding: 0.8rem 16px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sur-titre { margin: 0; font-size: 0.8rem; opacity: 0.8; }
.entete .lien { color: #fff; white-space: nowrap; }
.progression { height: 4px; background: rgba(255, 255, 255, 0.15); }
.progression .barre { height: 100%; width: 0; background: #9ec5ee; transition: width 0.3s ease; }

main { max-width: 760px; margin: 0 auto; padding: 1rem 16px 5rem; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.25rem; margin-bottom: 1rem; }
.connexion { max-width: 460px; margin: 2rem auto; }
.intro ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.intro li { margin-bottom: 0.35rem; }
.affaire-fixe { font: 600 1.05rem Georgia, "Times New Roman", serif; color: var(--accent); background: var(--accent-doux);
  border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0 0 0.75rem; }
.confidentiel { font-weight: 600; color: var(--accent); border-left: 3px solid var(--accent); padding-left: 0.75rem; }
.aide { color: var(--encre-2); margin-top: 0; }
.petit { font-size: 0.85rem; color: var(--encre-3); }

.sommaire ol { margin: 0; padding-left: 1.4rem; columns: 2; column-gap: 2rem; }
.sommaire li { break-inside: avoid; margin-bottom: 0.25rem; }
.sommaire a { color: var(--accent-2); text-decoration: none; }
.sommaire a:hover { text-decoration: underline; }

.num {
  display: inline-grid; place-items: center; min-width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--accent-doux); color: var(--accent); font: 600 0.9rem system-ui, sans-serif;
}
.facultatif { font: italic 0.8rem system-ui, sans-serif; color: var(--encre-3); }

.champ { display: block; border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
.champ:last-child { margin-bottom: 0; }
.champ legend, .champ > label { padding: 0; margin-bottom: 0.35rem; width: 100%; }
.label { display: flex; flex-direction: column; font-weight: 500; }
.label small { font-weight: 400; color: var(--encre-3); font-size: 0.85rem; }
.requis { color: var(--erreur); }
.connexion .champ > span { display: block; font-weight: 500; margin-bottom: 0.35rem; }
input[type="text"], input[type="tel"], input:not([type]), input[inputmode], textarea {
  width: 100%; font: inherit; font-size: 16px; color: inherit; background: #fff;
  border: 1px solid var(--trait); border-radius: 8px; padding: 0.6rem 0.75rem;
}
textarea { resize: vertical; min-height: 3rem; }
input:focus-visible, textarea:focus-visible, .option:focus-within, .bouton:focus-visible, .lien:focus-visible {
  outline: 2px solid var(--accent-2); outline-offset: 2px;
}
.code { letter-spacing: 0.5em; font-size: 1.4rem !important; text-align: center; }
.options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.option {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.75rem; min-height: 44px;
  border: 1px solid var(--trait); border-radius: 8px; cursor: pointer; background: #fff; user-select: none;
}
.option:has(input:checked) { border-color: var(--accent-2); background: var(--accent-doux); }
.option input { margin: 0; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0.6rem 1.2rem;
  border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: 600 1rem system-ui, sans-serif; cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.bouton:hover { background: var(--accent-2); }
.bouton:active { transform: scale(0.98); }
.bouton:disabled { opacity: 0.55; cursor: wait; }
.bouton.secondaire { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.connexion .bouton { width: 100%; margin-top: 0.25rem; }
.lien { background: none; border: 0; padding: 0.25rem 0; color: var(--accent-2); font: inherit; text-decoration: underline; cursor: pointer; }
.lien:disabled { color: var(--encre-3); cursor: default; text-decoration: none; }
.actions-sec { display: flex; justify-content: space-between; gap: 1rem; margin: 0.75rem 0 0; }
.message { color: var(--erreur); min-height: 1.2em; margin: 0.75rem 0 0; }
.message.ok { color: var(--ok); font-weight: 600; }

.piece { border-top: 1px solid var(--trait); padding: 0.9rem 0; }
.piece.ok .num { background: var(--ok-doux); color: var(--ok); }
.piece-tete { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 500; }
.piece-nom { padding-top: 0.15rem; }
.piece-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0 0 2.4rem; }
.fichiers { list-style: none; margin: 0.4rem 0 0 2.4rem; padding: 0; }
.fichiers li { display: flex; gap: 0.75rem; align-items: baseline; font-size: 0.92rem; padding: 0.15rem 0; }
.fichiers .nom { overflow-wrap: anywhere; flex: 1; }
.fichiers .taille { color: var(--encre-3); white-space: nowrap; }
.cache { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.envoi-fichier { height: 4px; background: var(--accent-doux); border-radius: 2px; margin: 0.6rem 0 0 2.4rem; overflow: hidden; }
.envoi-fichier .barre { height: 100%; width: 0; background: var(--accent-2); transition: width 0.2s linear; }

.envoi { border-color: var(--accent-2); }
.etat-envoi { font-weight: 500; }

.statut {
  position: fixed; left: 50%; bottom: 1rem; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--encre); color: #fff; padding: 0.5rem 1rem; border-radius: 999px; font-size: 0.9rem;
  transition: opacity 0.2s ease, transform 0.2s ease; max-width: calc(100% - 32px);
}
.statut.visible { opacity: 0.95; transform: translate(-50%, 0); }
.statut.erreur { background: var(--erreur); pointer-events: auto; }

@media (max-width: 560px) {
  .sommaire ol { columns: 1; }
  .entete-in { padding: 0.6rem 16px; }
  .entete .sur-titre { display: none; }
  h1 { font-size: 1.1rem; }
  .carte { padding: 1rem; }
  .piece-actions, .fichiers, .envoi-fichier { margin-left: 0; }
  .option { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
