/* ============================================================
   LE RALLYE DES BÂTISSEURS — DESIGN SYSTEM
   Direction : "plaque de chantier" — panneaux boulonnés,
   bande de balisage (hazard stripe), chrono façon compteur
   de chantier. Lisible en plein soleil, gros doigts, gants.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600;700&display=swap');

/* ---------- Tokens ---------- */
:root {
  /* Couleurs — chantier / BTP */
  --color-anthracite: #1E2227;
  --color-anthracite-light: #2A2F37;
  --color-anthracite-lighter: #3A4149;
  --color-yellow: #FFC400;
  --color-yellow-dark: #D9A600;
  --color-white: #FAF9F5;
  --color-off-white: #EDEBE4;
  --color-steel: #8A94A0;
  --color-steel-light: #C7CDD3;
  --color-red: #D6402C;
  --color-red-dark: #A82E1E;
  --color-green: #2E9E5B;
  --color-green-dark: #227A46;

  /* Typographie */
  --font-display: 'Oswald', sans-serif;
  --font-body: 'Public Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Échelle d'espacement */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Rayons / ombres */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-card: 0 4px 12px rgba(30, 34, 39, 0.18);
  --shadow-press: inset 0 2px 4px rgba(0, 0, 0, 0.35);

  /* Bande de balisage (signature) */
  --hazard-stripe: repeating-linear-gradient(
    135deg,
    var(--color-anthracite) 0px,
    var(--color-anthracite) 14px,
    var(--color-yellow) 14px,
    var(--color-yellow) 28px
  );
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--color-off-white);
  color: var(--color-anthracite);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 var(--space-3);
  color: var(--color-anthracite);
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--color-steel); }

p { margin: 0 0 var(--space-3); }

a { color: inherit; }

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; }

/* Icônes (sprite SVG) */
.icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}
.icon--lg { width: 32px; height: 32px; }

/* Accessibilité : focus visible net (utilisation gantée / clavier) */
:focus-visible {
  outline: 3px solid var(--color-yellow);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.screen {
  animation: screen-in 0.25s ease-out;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Transition de sortie déclenchée en JS juste avant une redirection,
   pour un enchaînement plus "app" que le clignotement d'un rechargement. */
body.is-leaving {
  animation: screen-out 0.28s ease-in forwards;
}

@keyframes screen-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}

@media (max-width: 380px) {
  .site-header__title small { display: none; }
  .site-header__title { font-size: 0.82rem; }
}

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--tight { gap: var(--space-2); }

/* ---------- Header commun : "plaque de chantier" ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-anthracite);
  color: var(--color-white);
  padding: var(--space-4);
  position: relative;
}

/* bande de balisage sous le header — signature visuelle */
.site-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 6px;
  background: var(--hazard-stripe);
  background-size: 40px 6px;
}

.site-header__inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex-shrink: 1;
}

.site-header__brand .icon {
  color: var(--color-yellow);
}

.site-header__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header__title small {
  display: block;
  font-family: var(--font-body);
  text-transform: none;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-steel-light);
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header__team {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-yellow);
  background: var(--color-anthracite-light);
  border: 1px solid var(--color-anthracite-lighter);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  flex-shrink: 0;
}

.header-chrono {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-yellow);
  background: var(--color-anthracite-light);
  border: 1px solid var(--color-anthracite-lighter);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  white-space: nowrap;
}

.header-chrono .icon { width: 11px; height: 11px; }

.site-main {
  padding-top: var(--space-5);
}

/* Boulons de coin — variante "plaque" pour cartes importantes */
.plaque {
  position: relative;
}
.plaque::before, .plaque::after,
.plaque .bolt {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #55606B, #14171A 70%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
.plaque::before { top: 8px; left: 8px; }
.plaque::after { top: 8px; right: 8px; }
.plaque .bolt--bl { bottom: 8px; left: 8px; }
.plaque .bolt--br { bottom: 8px; right: 8px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 56px;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(2px); }

.btn-primary {
  background: var(--color-yellow);
  color: var(--color-anthracite);
  box-shadow: 0 4px 0 var(--color-yellow-dark);
}
.btn-primary:active { box-shadow: 0 1px 0 var(--color-yellow-dark); }

.btn-secondary {
  background: var(--color-anthracite);
  color: var(--color-white);
  box-shadow: 0 4px 0 #000;
}
.btn-secondary:active { box-shadow: 0 1px 0 #000; }

.btn-outline {
  background: transparent;
  color: var(--color-anthracite);
  border: 2px solid var(--color-anthracite);
  min-height: 52px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---------- Carte ---------- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,34,39,0.06);
}

.card--dark {
  background: var(--color-anthracite);
  color: var(--color-white);
}

.card--dark h2, .card--dark h1 { color: var(--color-white); }

/* ---------- Barre de progression (façon mètre-ruban) ---------- */
.progress {
  --progress-value: 0%;
}

.progress__label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-steel);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
}

.progress__track {
  position: relative;
  height: 14px;
  background: var(--color-anthracite-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 10%);
}

.progress__fill {
  height: 100%;
  width: var(--progress-value);
  background: var(--color-yellow);
  border-radius: var(--radius-sm);
  transition: width 0.4s ease;
}

/* ---------- Chrono (compteur digital de chantier) ---------- */
.chrono {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.chrono__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-steel);
}

.chrono__value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 2.4rem;
  letter-spacing: 0.03em;
  color: var(--color-yellow);
  background: var(--color-anthracite);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  text-shadow: 0 0 12px rgba(255, 196, 0, 0.45);
  border: 2px solid var(--color-anthracite-lighter);
}

.chrono--compact .chrono__value {
  font-size: 1rem;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

/* ---------- Badge de statut ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
}

.badge-neutral { background: var(--color-steel-light); color: var(--color-anthracite); }
.badge-pending { background: #FFE8A8; color: #7A5900; }
.badge-success { background: #CDEBD9; color: var(--color-green-dark); }
.badge-error   { background: #F6D2CC; color: var(--color-red-dark); }
.badge-active  { background: var(--color-yellow); color: var(--color-anthracite); }

.badge__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

/* ---------- Hazard divider (utilitaire) ---------- */
.hazard-divider {
  height: 6px;
  background: var(--hazard-stripe);
  background-size: 40px 6px;
  border-radius: 3px;
  margin: var(--space-5) 0;
}

/* ---------- Barrière de chantier (verrou d'appareil, session-reprise.php) ---------- */
.barriere-chantier {
  position: relative;
  width: 100%;
  max-width: 260px;
  margin: 0 auto var(--space-2);
  padding-top: 26px;
}
.barriere-chantier__poteau {
  position: absolute;
  top: 18px;
  bottom: -8px;
  width: 10px;
  background: var(--color-steel);
  border-radius: 3px;
}
.barriere-chantier__poteau--gauche { left: 22px; }
.barriere-chantier__poteau--droite { right: 22px; }
.barriere-chantier__lumiere {
  position: absolute;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-yellow-dark);
  box-shadow: 0 0 14px rgba(217, 166, 0, 0.55);
}
.barriere-chantier__lumiere--gauche { left: 12px; }
.barriere-chantier__lumiere--droite { right: 12px; }
.barriere-chantier__planche {
  position: relative;
  height: 34px;
  background: var(--hazard-stripe);
  border: 2px solid var(--color-anthracite);
  border-radius: 4px;
  margin-bottom: 10px;
}
.barriere-chantier__planche:last-child { margin-bottom: 0; }

/* ---------- Champ de formulaire ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-steel);
}

.field input[type="text"],
.field input[type="password"] {
  min-height: 52px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-steel-light);
  background: var(--color-white);
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-anthracite);
}

.field input[type="text"]:focus,
.field input[type="password"]:focus {
  border-color: var(--color-yellow);
  outline: none;
}

.field input[type="text"]::placeholder,
.field input[type="password"]::placeholder {
  color: var(--color-steel-light);
  font-weight: 500;
}

/* ---------- Checklist des membres ---------- */
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checklist__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-white);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.checklist__item.is-present {
  border-color: var(--color-green);
  background: #F1FBF5;
}

.checklist__checkbox-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  margin: calc(-1 * var(--space-2));
  flex-shrink: 0;
  cursor: pointer;
}

.checklist__checkbox {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  accent-color: var(--color-green);
  cursor: pointer;
  pointer-events: none;
}

.checklist__name {
  flex: 1;
  min-width: 0;
  border: 2px solid transparent;
  background: var(--color-off-white);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--color-anthracite);
  padding: var(--space-2) var(--space-3);
}

.checklist__name::placeholder {
  color: var(--color-steel);
  font-weight: 500;
}

.checklist__name:focus {
  outline: none;
  border-color: var(--color-yellow);
  background: var(--color-white);
}

.checklist__remove {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-off-white);
  color: var(--color-red-dark);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.checklist__remove:hover { background: #F6D2CC; }

.btn-add-member {
  border: 2px dashed var(--color-steel-light);
  background: transparent;
  color: var(--color-steel);
  min-height: 48px;
}

.btn-add-member:active { transform: translateY(1px); }

/* ---------- Texte d'aide sous un bouton ---------- */
.helper-text {
  font-size: 0.82rem;
  color: var(--color-steel);
  text-align: center;
}

/* ---------- Bannière de confirmation ---------- */
.confirm-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: #F1FBF5;
  border: 2px solid var(--color-green);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  color: var(--color-green-dark);
  font-weight: 600;
  animation: screen-in 0.3s ease-out;
}

.confirm-banner .icon { color: var(--color-green); flex-shrink: 0; }
.confirm-banner strong { display: block; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; }

/* ---------- QCM : options sélectionnables ---------- */
.qcm-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.qcm-meta__position {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-steel);
}

.qcm-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.qcm-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-white);
  border: 2px solid var(--color-steel-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.qcm-option:active { transform: translateY(1px); }

.qcm-option.is-selected {
  border-color: var(--color-yellow);
  background: #FFF7E0;
}

.qcm-option input {
  width: 22px;
  height: 22px;
  accent-color: var(--color-anthracite);
  flex-shrink: 0;
  cursor: pointer;
  pointer-events: none;
}

.qcm-option__text {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--color-anthracite);
}

.qcm-nav {
  display: flex;
  gap: var(--space-3);
}

.qcm-nav .btn { flex: 1; }

.qcm-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.qcm-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-steel-light);
  transition: all 0.2s ease;
}

.qcm-dot.is-active {
  background: var(--color-yellow);
  width: 22px;
  border-radius: 5px;
}

.qcm-dot.is-answered:not(.is-active) { background: var(--color-green); }

.sticky-validate {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--color-off-white) 65%, transparent);
  padding-top: var(--space-5);
  padding-bottom: var(--space-2);
  margin-top: calc(-1 * var(--space-3));
}

/* ---------- Capture photo ---------- */
.camera-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--color-anthracite);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid var(--color-anthracite-lighter);
}

.camera-frame video,
.camera-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-frame__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--color-steel-light);
  text-align: center;
  padding: var(--space-4);
}

.camera-frame__placeholder .icon { color: var(--color-steel); }

.camera-actions {
  display: flex;
  gap: var(--space-3);
}

.camera-actions .btn { flex: 1; }

.camera-error, .alert-erreur {
  background: #F6D2CC;
  border: 2px solid var(--color-red);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  color: var(--color-red-dark);
}

.camera-error h3, .alert-erreur h3 { color: var(--color-red-dark); margin-bottom: 4px; }

.photo-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-green-dark);
}

.photo-status .icon { color: var(--color-green); width: 18px; height: 18px; }

/* ---------- Écran final : hero "certificat" ---------- */
.hero-final {
  position: relative;
  background: linear-gradient(160deg, var(--color-anthracite), #14171A);
  color: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5) var(--space-5);
  text-align: center;
  overflow: hidden;
}

.hero-final::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 6px;
  background: var(--hazard-stripe);
  background-size: 40px 6px;
}

.hero-final__icon {
  color: var(--color-yellow);
  margin: 0 auto var(--space-3);
}

.hero-final__title {
  color: var(--color-white);
  font-size: 1.7rem;
  margin-bottom: var(--space-1);
}

.hero-final__subtitle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-steel-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-final__stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-stat__value {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--color-yellow);
}

.hero-stat__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-steel-light);
}

/* ---------- Récapitulatif par lieu ---------- */
.recap-lieu__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.recap-lieu__title {
  color: var(--color-anthracite);
  font-size: 1.05rem;
  margin: 0;
}

.recap-lieu__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-steel);
  margin-bottom: var(--space-3);
}

.recap-question {
  border-top: 1px solid var(--color-off-white);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}

.recap-question:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.recap-question__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.recap-question__points {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.recap-question__points--positif { color: var(--color-green-dark); }
.recap-question__points--nul { color: var(--color-steel); }

.recap-question__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.recap-question__icon .icon { width: 13px; height: 13px; }

.recap-question__icon.is-correct { background: var(--color-green); color: var(--color-white); }
.recap-question__icon.is-other { background: var(--color-steel-light); color: var(--color-anthracite); }

.recap-question__text {
  font-weight: 600;
  color: var(--color-anthracite);
  margin: 0;
}

.recap-question__body {
  margin-top: var(--space-2);
  margin-left: calc(22px + var(--space-2));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recap-question__answer {
  font-size: 0.9rem;
}

.recap-question__answer strong { color: var(--color-green-dark); }

.recap-explication {
  font-size: 0.85rem;
  color: var(--color-steel);
}

/* ---------- Message de clôture ---------- */
.closing-card {
  text-align: center;
  background: var(--color-white);
}

.closing-card .icon {
  color: var(--color-yellow);
  margin: 0 auto var(--space-3);
}

/* ============================================================
   INTERFACE ADMIN — variante "gestion de chantier"
   Sidebar sombre façon "bureau de chantier", contenu clair,
   priorité desktop, reste utilisable en tablette.
   ============================================================ */

.admin-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.admin-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-anthracite);
  color: var(--color-white);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 4px solid var(--color-yellow);
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-anthracite-lighter);
}

.admin-sidebar__brand .icon { color: var(--color-yellow); flex-shrink: 0; }

.admin-sidebar__brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.admin-sidebar__brand-text small {
  display: block;
  font-family: var(--font-body);
  text-transform: none;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-steel-light);
}

.admin-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-steel-light);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav__link .icon { width: 20px; height: 20px; flex-shrink: 0; }

.admin-nav__link:hover { background: var(--color-anthracite-light); color: var(--color-white); }

.admin-nav__link.is-active {
  background: var(--color-yellow);
  color: var(--color-anthracite);
}

.admin-nav__link.is-active .icon { color: var(--color-anthracite); }

.admin-sidebar__footer {
  padding: var(--space-4);
  border-top: 1px solid var(--color-anthracite-lighter);
}

.admin-logout {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-steel-light);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-logout:hover { background: var(--color-anthracite-light); color: var(--color-white); }
.admin-logout .icon { width: 18px; height: 18px; }
.admin-logout.is-active { background: var(--color-yellow); color: var(--color-anthracite); }
.admin-logout.is-active .icon { color: var(--color-anthracite); }

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-off-white);
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: var(--color-white);
  border-bottom: 1px solid rgba(30,34,39,0.08);
}

.admin-topbar h1 { margin: 0; }

.admin-topbar__meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-steel);
}

.admin-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1100px;
  width: 100%;
}

/* Grille de cartes KPI (tableau de bord) */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.admin-kpi {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,34,39,0.06);
}

.admin-kpi__value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-anthracite);
}

.admin-kpi__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-steel);
  margin-top: 4px;
}

/* Placeholder de section en construction */
.admin-placeholder {
  border: 2px dashed var(--color-steel-light);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--color-steel);
}

.admin-placeholder .icon { color: var(--color-steel-light); margin: 0 auto var(--space-3); }
.admin-placeholder h2 { color: var(--color-anthracite); }

/* Tablette : sidebar compacte, icônes seules */
@media (max-width: 900px) {
  .admin-sidebar { width: 76px; }
  .admin-sidebar__brand-text,
  .admin-nav__link span,
  .admin-logout span { display: none; }
  .admin-sidebar__brand { justify-content: center; padding: var(--space-4) var(--space-2); }
  .admin-nav__link { justify-content: center; padding: var(--space-3); }
  .admin-logout { justify-content: center; }
  .admin-topbar { padding: var(--space-4); }
  .admin-content { padding: var(--space-4); }
}

/* Mobile : la sidebar devient une barre de navigation fixée en bas de
   l'écran (plus pratique au pouce qu'un rail vertical qui mange la
   largeur déjà limitée), le contenu défile normalement au-dessus. */
@media (max-width: 640px) {
  .admin-shell {
    flex-direction: column;
    min-height: auto;
  }

  .admin-sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 30;
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-top: 4px solid var(--color-yellow);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .admin-sidebar__brand { display: none; }

  .admin-nav {
    flex: 1;
    flex-direction: row;
    padding: var(--space-1);
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-nav__link {
    flex-direction: column;
    gap: 2px;
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    font-size: 0.56rem;
    line-height: 1.1;
    text-align: center;
    flex-shrink: 0;
    min-width: 50px;
  }

  .admin-nav__link span { display: block; white-space: nowrap; }
  .admin-nav__link .icon { width: 18px; height: 18px; }

  .admin-sidebar__footer {
    border-top: none;
    padding: var(--space-1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .admin-logout { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 0.56rem; }
  .admin-logout span { display: block; }

  /* On laisse de la place en bas pour ne pas passer sous la barre fixe. */
  .admin-main { padding-bottom: 88px; }
  .admin-topbar {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-4);
  }
  .admin-topbar .btn { width: 100%; min-width: 0 !important; }
  .admin-content { padding: var(--space-4); }

  .lieu-selector select { width: 100%; min-width: 0; }
  .form-row { flex-direction: column; }
  .bareme-tier { gap: var(--space-2); }
  .bareme-tier input[type="number"] { width: 76px; }

  /* Tableaux larges (dashboard, équipes, lieux) : défilement horizontal
     fluide au doigt plutôt qu'un simple overflow abrupt. */
  .admin-table-wrap { -webkit-overflow-scrolling: touch; }

  #btnAjouterEquipe, #btnAjouterLieu, #btnAjouterQuestion, #btnImprimer {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Le glisser-déposer HTML5 natif ne fonctionne pas au doigt : sur
     mobile on masque la poignée et on ne garde que les flèches ↑ ↓. */
  .dragdrop-item__handle { display: none; }
  .dragdrop-item { padding: var(--space-2) var(--space-3); }
  .dragdrop-item__name { font-size: 0.9rem; }

  /* Page Résultats : trop de données pour une seule ligne sur mobile,
     on passe sur deux lignes (identité en haut, stats en dessous). */
  .resultat-row-header { flex-wrap: wrap; row-gap: var(--space-2); }
  .resultat-row-header > div:first-of-type { min-width: 60%; }
  .resultat-row-header .reponses-cell,
  .resultat-row-header .admin-table__sub { font-size: 0.78rem; }
  .resultat-detail { padding-left: var(--space-4); }
}

/* ---------- Tableaux admin (listes CRUD) ---------- */
.admin-table-wrap {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(30,34,39,0.06);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.admin-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-steel);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--color-off-white);
  white-space: nowrap;
}

.admin-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-off-white);
  vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--color-off-white); }

.admin-table__empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--color-steel);
}

.admin-table__name { font-weight: 700; color: var(--color-anthracite); }
.admin-table__sub { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-steel); }

/* Sélecteur de statut discret, façon badge cliquable */
.status-select {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}
.status-select.statut-a_venir { background: var(--color-steel-light); color: var(--color-anthracite); }
.status-select.statut-en_cours { background: #FFE8A8; color: #7A5900; }
.status-select.statut-terminee { background: #CDEBD9; color: var(--color-green-dark); }

.qr-cell { display: flex; align-items: center; gap: var(--space-3); }
.qr-thumb {
  width: 64px; height: 64px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-steel-light);
  background: var(--color-white);
  padding: 4px;
  flex-shrink: 0;
}
.qr-thumb--clickable { cursor: pointer; transition: border-color 0.15s ease; }
.qr-thumb--clickable:hover { border-color: var(--color-yellow-dark); }

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.icon-badge .icon { width: 18px; height: 18px; }
.icon-badge--on { background: #FBEAE6; color: var(--color-red-dark); }
.icon-badge--off { background: var(--color-off-white); color: var(--color-steel); }

/* ---------- Page Résultats ---------- */
.podium-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--color-off-white);
  color: var(--color-anthracite);
  flex-shrink: 0;
}

.podium-rank--1 { background: var(--color-yellow); color: var(--color-anthracite); }
.podium-rank--2 { background: var(--color-steel-light); color: var(--color-anthracite); }
.podium-rank--3 { background: #D9A15C; color: var(--color-white); }

.resultat-row-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  width: 100%;
}

.resultat-detail {
  display: none;
  padding: var(--space-4) var(--space-4) var(--space-4) calc(30px + var(--space-3) + var(--space-4));
  background: var(--color-off-white);
}

.resultat-detail.is-open { display: block; }

.resultat-detail__lieu {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(30,34,39,0.08);
  font-size: 0.88rem;
}

.resultat-detail__lieu:last-child { border-bottom: none; }
.resultat-detail__lieu strong { font-family: var(--font-mono); color: var(--color-anthracite); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-steel-light);
  background: var(--color-white);
  color: var(--color-anthracite);
  cursor: pointer;
}
.btn-icon .icon { width: 17px; height: 17px; }
.btn-icon:hover { background: var(--color-off-white); }
.btn-icon.btn-icon--danger { color: var(--color-red-dark); border-color: #F0B8AE; }
.btn-icon.btn-icon--danger:hover { background: #FBEAE6; }

.table-actions { display: flex; gap: var(--space-2); align-items: center; }

.inline-confirm {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 0.85rem; font-weight: 600; color: var(--color-red-dark);
}
.inline-confirm button { font-size: 0.8rem; padding: 6px 10px; min-height: auto; width: auto; }

.btn-link-download {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  color: var(--color-anthracite); text-decoration: none;
  border: 1px solid var(--color-steel-light); border-radius: var(--radius-sm);
  padding: 6px 10px; background: var(--color-white); cursor: pointer;
}
.btn-link-download:hover { background: var(--color-off-white); }
.btn-link-download .icon { width: 14px; height: 14px; }

/* ---------- Formulaire admin (carte d'ajout/édition) ---------- */
.admin-form-card { border: 2px solid var(--color-yellow); }
.admin-form-card .form-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.admin-form-card .form-row .field { flex: 1; min-width: 200px; }
.admin-form-card .form-actions { display: flex; gap: var(--space-3); justify-content: flex-end; }
.admin-form-card .form-actions .btn { width: auto; min-width: 160px; }

.field input[type="number"] {
  min-height: 52px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-steel-light);
  background: var(--color-white);
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-anthracite);
  width: 100%;
}
.field input[type="number"]:focus { border-color: var(--color-yellow); outline: none; }

.field textarea {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-steel-light);
  background: var(--color-white);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-anthracite);
  width: 100%;
  resize: vertical;
  min-height: 80px;
}
.field textarea:focus { border-color: var(--color-yellow); outline: none; }

/* ---------- Interrupteur (toggle) ---------- */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: var(--color-steel-light);
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.toggle__track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--color-white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle__track { background: var(--color-green); }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle__track { outline: 3px solid var(--color-yellow); outline-offset: 2px; }

.toggle__label { font-weight: 600; font-size: 0.92rem; color: var(--color-anthracite); }

/* ---------- Éditeur de questions (admin) ---------- */
.question-card { border: 2px solid var(--color-steel-light); }

.question-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.question-card__title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-steel);
}

.question-card__reorder {
  display: flex;
  gap: 4px;
}

.response-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.response-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--color-green);
  cursor: pointer;
}

.response-row input[type="text"] {
  flex: 1;
  min-height: 46px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-steel-light);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-anthracite);
}

.response-row input[type="text"]:focus { border-color: var(--color-yellow); outline: none; }

.explication-row {
  margin-left: 34px;
  margin-top: -4px;
}

.explication-row input[type="text"] {
  width: 100%;
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--color-steel-light);
  font-size: 0.85rem;
  font-style: italic;
  background: #FFFCF2;
  color: var(--color-anthracite);
}

.explication-row input[type="text"]:focus { border-color: var(--color-yellow); outline: none; }

.question-warning {
  font-size: 0.8rem;
  color: var(--color-red-dark);
  font-weight: 600;
}

/* ---------- Scanner QR (départ / lieu) ---------- */
.qr-scan-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 320px;
  margin: 0 auto;
  background: var(--color-anthracite);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 3px solid var(--color-anthracite-lighter);
}

.qr-scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qr-scan-frame__viseur {
  position: absolute;
  inset: 12%;
  border: 3px solid var(--color-yellow);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 999px rgba(30, 34, 39, 0.45);
  pointer-events: none;
}

.qr-scan-frame__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--color-steel-light);
  text-align: center;
  padding: var(--space-4);
}

.qr-scan-frame__placeholder .icon { color: var(--color-steel); }

.qr-scan-status {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-steel);
}

.qr-scan-status.is-ok { color: var(--color-green-dark); font-weight: 700; }
.qr-scan-status.is-erreur { color: var(--color-red-dark); font-weight: 700; }

/* ---------- Écran "direction le prochain lieu" ---------- */
.prochain-lieu-card {
  text-align: center;
  background: linear-gradient(160deg, var(--color-anthracite), #14171A);
  color: var(--color-white);
  position: relative;
  overflow: hidden;
}

.prochain-lieu-card::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 6px;
  background: var(--hazard-stripe);
  background-size: 40px 6px;
}

.prochain-lieu-card__icon { color: var(--color-yellow); margin: 0 auto var(--space-3); }
.prochain-lieu-card__label { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-steel-light); }
.prochain-lieu-card__nom { color: var(--color-white); font-size: 1.6rem; margin: var(--space-2) 0; }
.prochain-lieu-card__adresse { color: var(--color-steel-light); font-size: 0.9rem; }

/* ---------- Écran des règles (barème expliqué simplement) ---------- */
.regle-ligne {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-white);
  border: 2px solid var(--color-off-white);
}

.regle-ligne__icone {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.regle-ligne__icone--bonne { background: #CDEBD9; color: var(--color-green-dark); }
.regle-ligne__icone--mauvaise { background: #F6D2CC; color: var(--color-red-dark); }
.regle-ligne__icone--info { background: var(--color-yellow); color: var(--color-anthracite); }

.regle-ligne__texte strong { display: block; color: var(--color-anthracite); }
.regle-ligne__texte span { font-size: 0.85rem; color: var(--color-steel); }


.lieu-selector {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.lieu-selector select {
  min-height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-steel-light);
  background: var(--color-white);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--color-anthracite);
  min-width: 260px;
}

.lieu-selector select:focus { border-color: var(--color-yellow); outline: none; }

/* Accordéon des questions : replié par défaut, un clic sur l'en-tête déplie */
.question-card__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.question-card__chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--color-steel);
  transition: transform 0.15s ease;
}

.question-card__chevron.is-open { transform: rotate(180deg); }

.question-card__apercu {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-anthracite);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.question-card__body {
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-off-white);
}

/* Aperçu joueur (réutilise les classes qcm-* de /player/lieu.html) */
.player-preview {
  background: var(--color-off-white);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 2px dashed var(--color-steel-light);
}

.player-preview__frame {
  max-width: 380px;
  margin: 0 auto;
}

/* ---------- Glisser-déposer (parcours par équipe) ---------- */
.dragdrop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dragdrop-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-white);
  border: 2px solid var(--color-steel-light);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.dragdrop-item.is-dragging { opacity: 0.35; }
.dragdrop-item.is-dragover { border-color: var(--color-yellow); transform: translateY(-1px); }

.dragdrop-item__handle {
  color: var(--color-steel);
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}
.dragdrop-item__handle:active { cursor: grabbing; }
.dragdrop-item__handle .icon { width: 20px; height: 20px; }

.dragdrop-item__position {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-anthracite);
  background: var(--color-yellow);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dragdrop-item__name { font-weight: 600; flex: 1; color: var(--color-anthracite); }

.dragdrop-item__moves {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Tableau récapitulatif des parcours */
.parcours-chemin {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-anthracite);
  line-height: 1.6;
}

.parcours-chemin .step-sep { color: var(--color-steel); margin: 0 4px; }

/* ---------- Aperçu de calcul (barème) ---------- */
.calc-breakdown {
  display: flex;
  flex-direction: column;
}

.calc-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-off-white);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-anthracite);
}

.calc-line span:last-child { font-weight: 700; }

.calc-line--bonus span:last-child { color: var(--color-green-dark); }
.calc-line--malus span:last-child { color: var(--color-red-dark); }

.calc-line--total {
  border-bottom: none;
  border-top: 2px solid var(--color-anthracite);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  font-size: 1.1rem;
}

.calc-line--total span:last-child { color: var(--color-yellow-dark); }

.bareme-tier {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.bareme-tier__label {
  flex: 1;
  min-width: 220px;
  font-weight: 600;
  color: var(--color-anthracite);
}

.bareme-tier input[type="number"] {
  width: 90px;
  min-height: 44px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-steel-light);
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
}

.bareme-tier input[type="number"]:focus { border-color: var(--color-yellow); outline: none; }

/* ---------- Tableau de bord temps réel ---------- */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-steel);
}

.live-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-green);
  animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(46, 158, 91, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(46, 158, 91, 0); }
}

.filter-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.filter-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  border: 2px solid var(--color-steel-light);
  background: var(--color-white);
  color: var(--color-anthracite);
  cursor: pointer;
}

.filter-chip.is-active {
  background: var(--color-anthracite);
  border-color: var(--color-anthracite);
  color: var(--color-yellow);
}

.progress-mini {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 110px;
}

.progress-mini__track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--color-off-white);
  overflow: hidden;
}

.progress-mini__fill {
  height: 100%;
  background: var(--color-yellow);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-mini__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-steel);
  white-space: nowrap;
}

.dashboard-row--a_venir { opacity: 0.6; }

.reponses-cell {
  display: flex;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.reponses-cell .ok { color: var(--color-green-dark); }
.reponses-cell .ko { color: var(--color-red-dark); }

/* ---------- Page d'impression des QR codes ---------- */
.qr-category-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.qr-category-title .icon { color: var(--color-yellow); }

.qr-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--space-4);
}

.qr-print-card {
  background: var(--color-white);
  border: 2px solid var(--color-steel-light);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.qr-print-card img {
  width: 140px;
  height: 140px;
  margin: 0 auto;
}

.qr-print-card__label {
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--color-anthracite);
}

.qr-print-card__meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-steel);
}

@media print {
  /* Portée à .page-impression-qr (voir le <body> de admin/qrcodes.php) —
     "body * { visibility: hidden }" sans cette portée cachait TOUT à
     l'impression sur n'importe quelle AUTRE page chargeant ce même
     style.css (chargé partout), y compris /admin/fiche-qr.php qui n'a pas
     de .qr-print-area pour restaurer la visibilité : la fiche s'imprimait
     entièrement blanche. Bug réel corrigé ici. */
  body.page-impression-qr * { visibility: hidden; }
  body.page-impression-qr .qr-print-area,
  body.page-impression-qr .qr-print-area * { visibility: visible; }
  body.page-impression-qr .qr-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .no-print { display: none !important; }
  .qr-print-card { break-inside: avoid; box-shadow: none; }
  .qr-category-block { break-before: auto; }
  @page { size: A4; margin: 12mm; }
}

/* ---------- Galerie photos admin ---------- */
.photo-lieu-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.photo-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.photo-carte {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--color-steel-light);
  background: var(--color-white);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.photo-carte:hover { transform: translateY(-2px); border-color: var(--color-yellow); }

.photo-carte img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.photo-carte__legende {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-anthracite);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(30, 34, 39, 0.92);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.photo-lightbox img {
  max-width: 90vw;
  max-height: 78vh;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.photo-lightbox__legende {
  color: var(--color-white);
  font-family: var(--font-mono);
  margin-top: var(--space-4);
  text-align: center;
}

.photo-lightbox__fermer {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  background: var(--color-anthracite-light);
  color: var(--color-white);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Utilitaires texte ---------- */
.text-muted { color: var(--color-steel); }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }

/* Garde-fou : l'attribut hidden doit TOUJOURS masquer l'élément, même si
   une classe du même élément déclare un display flex/grid/block explicite
   (ex. .photo-lightbox). Sans cette règle, un élément peut rester visible
   et cliquable malgré .hidden = true en JS. */
[hidden] { display: none !important; }

/* ---------- Bandeau mode démo ---------- */
/* Rendu par PHP uniquement quand DEMO_MODE=true (jamais présent dans le DOM
   sinon, voir config/app.php) — rappel visuel pour ne pas l'oublier activé
   le jour J. */
.demo-mode-banner {
  background: var(--color-anthracite);
  color: var(--color-yellow);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px var(--space-3);
  border-bottom: 3px solid var(--color-yellow);
}
.demo-mode-banner strong {
  background: var(--color-yellow);
  color: var(--color-anthracite);
  padding: 1px 8px;
  border-radius: 999px;
}
