/* Coque générique : couleurs neutres ; le pack fournit --pack-accent, --pack-sur-accent, --pack-fond (ADR-015-RDX § 3). */
:root {
  --fond: var(--pack-fond, #f4f1ea);
  --surface: #ffffff;
  --texte: #1d232b;
  --discret: #5b6573;
  --accent: var(--pack-accent, #1f3a5f);
  --sur-accent: var(--pack-sur-accent, #ffffff);
  --signature: var(--pack-signature, var(--accent)); /* touche de marque : un élément par écran */
  --repere: var(--signature); /* trait de l'entrée de menu courante */
  --alerte: #a4461f;
  --ok: #2e6b46;
  --bord: #d9d4c8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #14181d; /* le fond du pack ne s'applique qu'en mode clair */
    --surface: #1d232b;
    --texte: #ebe7de;
    --discret: #9aa4b1;
    --accent: var(--pack-accent, #8fb3e0); /* bandeau aux couleurs du pack */
    --sur-accent: var(--pack-sur-accent, #0e1620);
    --signature: var(--pack-signature-sombre, var(--pack-signature, #c9b8a8));
    --repere: var(--signature); /* lisible sur fond sombre : variante sombre de la signature */
    --alerte: #e39a74;
    --ok: #86c39d;
    --bord: #2f3843;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
.bandeau {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 0.6rem;
  padding: calc(0.5rem + env(safe-area-inset-top)) 1rem 0.5rem;
  background: var(--accent); color: var(--sur-accent);
}
.bandeau h1 { flex: 1; margin: 0; font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; min-width: 0; }
.logo { display: block; height: 32px; width: auto; max-width: 100%; }
.bouton-menu {
  min-width: 44px; min-height: 44px;
  border: 0; border-radius: 8px; background: transparent; color: inherit; font-size: 1.4rem;
}
.bouton-menu:focus-visible, .menu a:focus-visible { outline: 3px solid var(--alerte); outline-offset: 2px; }
.pastille {
  padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.8rem; white-space: nowrap;
  background: color-mix(in srgb, var(--sur-accent) 18%, transparent);
}
.pastille[data-etat="hors-ligne"] { background: var(--alerte); color: #fff; }
.pastille[data-etat="a-jour"] { background: color-mix(in srgb, var(--sur-accent) 30%, transparent); }
.scanner-cadre { position: relative; max-width: 100%; }
.scanner-video { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; border-radius: 8px; }
.scanner-video[hidden] { display: none; }
.scanner-reperes { position: absolute; inset: 0; pointer-events: none; }
.scanner-repere { position: absolute; pointer-events: auto; border: 3px solid; border-radius: 6px; background: transparent;
  color: #fff; font-weight: 700; min-width: 44px; min-height: 44px; text-shadow: 0 0 3px #000; }
.scanner-repere-complet { border-color: #2e9d4f; }
.scanner-repere-partiel { border-color: #e0a100; }
.scanner-repere-autre { border-color: #8a8a8a; }
.scanner-fiche { border: 1px solid var(--bord); border-radius: 8px; padding: 0.5rem 0.75rem; margin: 0.5rem 0; }
.scanner-fiche[data-issue="refuse"] { border-color: var(--alerte); }
.scanner-fiche dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.15rem 0.75rem; margin: 0 0 0.5rem; }
.scanner-fiche dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, monospace; }
select.pastille { border: 0; color: inherit; min-height: 44px; font: inherit; font-size: 0.8rem; }
.menu { background: var(--surface); border-bottom: 1px solid var(--bord); }
.menu ul { list-style: none; margin: 0; padding: 0.25rem 0; }
.menu a {
  display: block; padding: 0.8rem 1rem; min-height: 44px;
  color: var(--texte); text-decoration: none;
}
.menu a[aria-current="page"] { font-weight: 600; box-shadow: inset 4px 0 var(--repere); }
.ecran { padding: 1rem; max-width: 48rem; margin: 0 auto; outline: none; }
.ecran h2 { margin-top: 0.5rem; }
.message { color: var(--discret); }
.case { display: flex; align-items: center; gap: 0.4rem; min-height: 44px; }
fieldset { border: 1px solid var(--bord); border-radius: 8px; margin: 0 0 0.9rem; }
.carte-badge { margin: 1rem 0; padding: 1rem; border: 1px solid var(--bord); border-radius: 8px; background: var(--surface); }
.carte-imprimable { text-align: center; }
.carte-nom { font-size: 1.3rem; font-weight: 600; margin: 0; }
.carte-id { font: 600 1.4rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.15em; margin: 0; }
.carte-imprimable .qr { margin: 0.5rem auto; }
@media print {
  /* Seule la carte du badge s'imprime (format carte : 54 × 86 mm) ; le code de secours, jamais. */
  body * { visibility: hidden; }
  .carte-imprimable, .carte-imprimable * { visibility: visible; }
  .carte-imprimable { position: absolute; top: 0; left: 0; width: 54mm; padding: 4mm; color: #000; background: #fff; }
  .carte-imprimable .qr { width: 40mm; }
}
.qr { display: block; width: min(16rem, 70vw); height: auto; background: #fff; margin: 0.5rem 0; }
.code-enrolement {
  font: 600 2.2rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.12em;
  padding: 0.6rem 1rem; border: 2px dashed var(--signature); border-radius: 8px; display: inline-block;
}
.bouton-secondaire {
  min-height: 44px; padding: 0.5rem 1.1rem; font: inherit; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--texte);
}
#enrolement { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--bord); }
.liste-appareils { list-style: none; padding: 0; }
.liste-appareils li { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 0.6rem 0; border-bottom: 1px solid var(--bord); flex-wrap: wrap; }
.champ select {
  min-height: 44px; padding: 0.5rem 0.7rem; font: inherit;
  border: 1px solid var(--bord); border-radius: 8px; background: var(--surface); color: var(--texte);
}
.champ { display: flex; flex-direction: column; gap: 0.25rem; margin: 0 0 0.9rem; }
.champ input {
  min-height: 44px; padding: 0.5rem 0.7rem; font: inherit;
  border: 1px solid var(--bord); border-radius: 8px; background: var(--surface); color: var(--texte);
}
.bouton, .bouton-bandeau {
  min-height: 44px; padding: 0.5rem 1.1rem; font: inherit; border-radius: 8px; cursor: pointer;
}
.bouton { border: 0; background: var(--accent); color: var(--sur-accent); }
.bouton-bandeau { border: 1px solid currentColor; background: transparent; color: inherit; }
.bouton:disabled, .bouton-bandeau:disabled { opacity: 0.6; cursor: wait; }
.champ input:focus-visible, .bouton:focus-visible, .bouton-bandeau:focus-visible {
  outline: 3px solid var(--alerte); outline-offset: 2px;
}
.message-erreur { color: var(--alerte); }
@media (min-width: 900px) {
  .bouton-menu { display: none; }
  body { display: grid; grid-template-columns: 16rem 1fr; grid-template-rows: auto 1fr; }
  .bandeau { grid-column: 1 / -1; }
  .menu { display: block !important; border-bottom: 0; border-right: 1px solid var(--bord); }
}

/* Étape 4.2 : champ pré-rempli depuis le code lu (à vérifier), avertissement, arbre d'emplacements. */
.prerempli { outline: 2px dashed var(--pack-accent, #2f6f6f); outline-offset: 1px; }
.message-attention { color: #8a5a00; }
@media (prefers-color-scheme: dark) { .message-attention { color: #f0c060; } }
.arbre-emplacements { list-style: none; padding-inline-start: 0; }
.arbre-emplacements li { padding-block: 0.25rem; border-block-end: 1px solid rgba(127, 127, 127, 0.2); }
.arbre-emplacements li[data-actif="non"] .emplacement-libelle { text-decoration: line-through; opacity: 0.7; }
.emplacement-infos { opacity: 0.75; }
button.lien { background: none; border: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; text-align: start; }

/* Étape 4.3 : pastille de date (F-050). */
.date-pastille { display: inline-block; padding: 0 0.4rem; border-radius: 0.6rem; font-size: 0.85em; }
.date-pastille[hidden] { display: none; }
.date-depassee { background: #b3261e; color: #fff; }
.date-alerte { background: #f0b429; color: #1a1a1a; }
.date-correcte { background: #2e7d32; color: #fff; }
.date-sans_date { background: rgba(127, 127, 127, 0.25); }
