:root {
  --fond: #f6f3ec;
  --surface: #fffdf8;
  --texte: #1f1a17;
  --discret: #6b635b;
  --ligne: #e2dbcd;
  --accent: #5b1a2b;
  --accent-clair: #f3e6e8;
  --accent-texte: #fffdf8;
  --majeur: #b42318;
  --important: #b54708;
  --mineur: #475467;
  --conforme: #067647;
  --ombre: 0 1px 2px rgb(40 30 20 / 6%), 0 4px 16px rgb(40 30 20 / 5%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #1a1614;
    --surface: #24201d;
    --texte: #eee8df;
    --discret: #a89f94;
    --ligne: #3a332e;
    --accent: #d99aa8;
    --accent-clair: #3a2429;
    --accent-texte: #1a1614;
    --majeur: #f97066;
    --important: #fdb022;
    --mineur: #98a2b3;
    --conforme: #47cd89;
    --ombre: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.55 var(--sans);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.barre {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--ligne);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texte); font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.sceau { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-texte); font-size: 1rem; }
nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--discret); font-weight: 500; }
nav a.actif, nav a:hover { color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; }
.etroite, .carte.etroite { max-width: 560px; margin-left: auto; margin-right: auto; }
.carte.etroite { margin-top: 6vh; }
.carte { background: var(--surface); border: 1px solid var(--ligne); border-radius: 12px; padding: 20px 22px; margin: 0 0 18px; box-shadow: var(--ombre); }
.discret { color: var(--discret); }
.petit { font-size: .85rem; }
.entete-page { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.retour { text-decoration: none; font-size: .9rem; }

label { display: block; margin: 0 0 14px; font-weight: 500; font-size: .92rem; }
input[type=text], input:not([type]), input[type=email], input[type=password], textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--ligne); border-radius: 8px; background: var(--fond); color: var(--texte);
  font: 16px/1.4 var(--sans);
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset.choix { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.choix legend { font-weight: 500; font-size: .92rem; margin-bottom: 6px; }
fieldset.choix label, label.case { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0 0 6px; }

button { font: inherit; cursor: pointer; border-radius: 8px; padding: 9px 16px; border: 1px solid transparent; }
button:disabled { opacity: .55; cursor: default; }
.principal { background: var(--accent); color: var(--accent-texte); font-weight: 600; }
.principal:hover:not(:disabled) { filter: brightness(1.1); }
.secondaire { background: transparent; border-color: var(--ligne); color: var(--texte); }
.secondaire:hover { border-color: var(--discret); }
.danger { color: var(--majeur); }
.lien { background: none; border: 0; padding: 0; color: var(--discret); font-weight: 500; }
.lien:hover { color: var(--accent); }
.grand { padding: 13px 26px; font-size: 1.05rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.erreur { color: var(--majeur); font-weight: 500; }
.ok { color: var(--conforme); font-weight: 500; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { background: var(--surface); border: 1px solid var(--ligne); border-radius: 10px; margin-bottom: 10px; }
.liste > li > a, .liste > li > .ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; text-decoration: none; color: var(--texte); flex-wrap: wrap; }
.liste > li > a:hover { background: var(--accent-clair); border-radius: 10px; }
.liste .titre { font-weight: 600; }
.vide { padding: 28px; text-align: center; color: var(--discret); border: 1px dashed var(--ligne); border-radius: 10px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.b-majeur, .b-non_signable_en_l_etat, .b-erreur, .b-manquant, .b-incoherent { color: var(--majeur); }
.b-important, .b-reserves_importantes, .b-perime, .b-a_verifier { color: var(--important); }
.b-mineur, .b-brouillon, .b-en_cours { color: var(--mineur); }
.b-conforme, .b-signable, .b-signable_apres_corrections { color: var(--conforme); }
.b-signable_apres_corrections { color: var(--important); }

.grille-depots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.depot { background: var(--surface); border: 1px solid var(--ligne); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; transition: border-color .15s, background .15s; }
.depot.survol { border-color: var(--accent); background: var(--accent-clair); }
.depot .pieces { list-style: none; padding: 0; margin: 4px 0 12px; flex: 1; }
.depot .pieces li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--ligne); font-size: .88rem; word-break: break-word; }
.depot .pieces li button.retirer { padding: 0 9px; font-size: 1.1rem; line-height: 1.6; flex-shrink: 0; color: var(--discret); }
.deposer { margin: 0; border: 1.5px dashed var(--ligne); border-radius: 10px; padding: 14px; text-align: center; color: var(--accent); cursor: pointer; font-weight: 500; font-size: .9rem; }
.deposer:hover { border-color: var(--accent); }
.deposer input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.deposer.envoi { color: var(--discret); }
details.carte summary { cursor: pointer; font-weight: 600; font-family: var(--serif); font-size: 1.05rem; }
details.carte[open] summary { margin-bottom: 14px; }
.lancer { text-align: center; margin-top: 24px; }

.jauge { height: 10px; border-radius: 99px; background: var(--ligne); overflow: hidden; margin: 14px 0 10px; }
.jauge-remplie { height: 100%; width: 0; background: var(--accent); transition: width .8s ease; }

.avis { border-left: 5px solid var(--accent); }
.avis .niveau { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin: 0 0 8px; }
.telechargements { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 18px; }
.telechargements a { display: block; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--ligne); text-decoration: none; color: var(--texte); }
.telechargements a:hover { border-color: var(--accent); }
.telechargements strong { display: block; color: var(--accent); font-family: var(--serif); font-size: 1.05rem; margin-bottom: 2px; }
.section-resultat h2 { display: flex; align-items: baseline; gap: 10px; }
.section-resultat h2 .compte { font-family: var(--sans); font-size: .85rem; color: var(--discret); font-weight: 500; }
.element { border-top: 1px solid var(--ligne); padding: 14px 0; }
.element:first-of-type { border-top: 0; }
.element .tete { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.element .tete strong { font-weight: 600; }
.comparaison { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.comparaison div { background: var(--fond); border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.comparaison span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--discret); margin-bottom: 3px; }
.proposition { margin: 8px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-clair); font-family: var(--serif); font-style: italic; border-radius: 0 8px 8px 0; }
.correction { margin: 6px 0 0; font-size: .92rem; }
.courrier { white-space: pre-wrap; font-family: var(--serif); background: var(--fond); padding: 16px; border-radius: 8px; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.2rem; background: var(--fond); padding: 10px 14px; border-radius: 8px; user-select: all; }
ul.puces { margin: 0; padding-left: 20px; }
ul.puces li { margin-bottom: 6px; }

@media (max-width: 820px) {
  .grille-depots, .telechargements { grid-template-columns: 1fr; }
  .comparaison { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  main { padding: 20px 16px 48px; }
  .barre { padding: 10px 16px; }
  h1 { font-size: 1.45rem; }
  .carte { padding: 16px; }
}

.centre { text-align: center; }
#bloc-modifier { margin: 8px 0 24px; }
