:root {
  --bleu: #2563eb;
  --bleu-fonce: #1d4ed8;
  --bleu-clair: #eff6ff;
  --texte: #1f2937;
  --texte-leger: #6b7280;
  --fond: #f9fafb;
  --blanc: #ffffff;
  --bordure: #e5e7eb;
  --succes: #16a34a;
  --succes-fond: #f0fdf4;
  --danger: #dc2626;
  --danger-fond: #fef2f2;
  --avertissement: #d97706;
  --avertissement-fond: #fffbeb;
  --radius: 8px;
  --ombre: 0 1px 3px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texte);
  background: var(--fond);
  margin: 0;
}

/* Navigation */
nav {
  background: var(--bleu);
  color: var(--blanc);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
nav a { color: var(--blanc); text-decoration: none; font-weight: 500; }
nav a:hover { text-decoration: underline; }
nav .titre { font-size: 1.1rem; font-weight: 700; flex: 1; }

/* Conteneur */
.conteneur {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Titres */
h1 { font-size: 1.5rem; margin: 0 0 1.25rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .75rem; }

/* Cartes */
.carte {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--ombre);
  margin-bottom: 1rem;
}

/* Grille formations */
.liste-formations { display: flex; flex-direction: column; gap: .75rem; }
.formation-item {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: border-color .15s;
  overflow: hidden;
}
.formation-item:has(.formation-item-lien:hover) { border-color: var(--bleu); }
.formation-item-lien {
  flex: 1;
  padding: 1rem;
  text-decoration: none;
  color: var(--texte);
  min-width: 0;
  cursor: pointer;
}
.formation-item-lien * { text-decoration: none; }
.formation-item-actions {
  display: flex;
  gap: .4rem;
  padding: .5rem .75rem;
  flex-shrink: 0;
}
.btn-xs { padding: .25rem .55rem; font-size: .75rem; }
.formation-numero { font-size: .7rem; color: var(--texte-leger); font-family: monospace; opacity: .75; }
.formation-titre { font-weight: 600; }
.formation-dates { font-size: .875rem; color: var(--texte-leger); }

/* Formulaires */
.form-groupe {
  margin-bottom: 1rem;
}
label {
  display: block;
  font-weight: 500;
  margin-bottom: .35rem;
  font-size: .9rem;
}
input[type="text"],
input[type="email"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--texte);
  background: var(--blanc);
  transition: border-color .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--bleu);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.mdp-wrapper {
  position: relative;
}
.mdp-wrapper input {
  padding-right: 2.75rem;
}
.mdp-oeil {
  position: absolute;
  right: .65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem;
  color: var(--texte-leger);
  line-height: 1;
}
.mdp-oeil:hover { color: var(--texte); }

/* Checkboxes / radios */
.liste-choix { display: flex; flex-direction: column; gap: .4rem; }
.liste-choix label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: normal;
  cursor: pointer;
  padding: .4rem .5rem;
  border-radius: var(--radius);
}
.liste-choix label:hover { background: var(--bleu-clair); }
.liste-choix input[type="radio"],
.liste-choix input[type="checkbox"] { width: auto; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.btn-primaire { background: var(--bleu); color: var(--blanc); }
.btn-primaire:hover { background: var(--bleu-fonce); }
.btn-secondaire { background: var(--blanc); color: var(--texte); border: 1px solid var(--bordure); }
.btn-secondaire:hover { background: var(--fond); }
.btn-danger { background: var(--danger); color: var(--blanc); }
.btn-danger:hover { background: #b91c1c; }
.btn-succes { background: var(--succes); color: var(--blanc); }
.btn-grand { padding: .85rem 1.75rem; font-size: 1.1rem; }
.btn-plein { width: 100%; justify-content: center; }

/* Actions en ligne */
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* Alertes */
.alerte {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alerte-succes { background: var(--succes-fond); color: var(--succes); border: 1px solid #bbf7d0; }
.alerte-danger  { background: var(--danger-fond); color: var(--danger); border: 1px solid #fecaca; }
.alerte-avertissement { background: var(--avertissement-fond); color: var(--avertissement); border: 1px solid #fde68a; }
.alerte-info { background: var(--bleu-clair); color: var(--bleu-fonce); border: 1px solid #bfdbfe; }

/* Tableau */
.tableau-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  background: var(--fond);
  padding: .6rem .75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--bordure);
  white-space: nowrap;
}
td { padding: .55rem .75rem; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* Badges statut */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-present  { background: var(--succes-fond); color: var(--succes); }
.badge-absent   { background: var(--danger-fond); color: var(--danger); }
.badge-non-prevu { background: var(--avertissement-fond); color: var(--avertissement); }
.badge-matin    { background: #eff6ff; color: #1d4ed8; }
.badge-apres-midi { background: #f5f3ff; color: #6d28d9; }

/* Séparateur sections */
.section { margin-top: 2rem; }
.section-titre {
  font-size: 1rem;
  font-weight: 600;
  color: var(--texte-leger);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--bordure);
}

/* Session card (formateur/admin) */
.sessions-grille { display: flex; flex-direction: column; gap: .6rem; }
.session-card {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.session-date { font-weight: 600; }
.session-qr { text-align: center; }
.session-qr img { display: block; width: 100px; height: 100px; }
.session-qr a { font-size: .75rem; word-break: break-all; color: var(--bleu); }

/* Canvas signature */
.signature-zone {
  border: 2px dashed var(--bordure);
  border-radius: var(--radius);
  background: var(--blanc);
  margin-bottom: .75rem;
  cursor: crosshair;
  touch-action: none;
  display: block;
  width: 100%;
}
.signature-zone.active { border-color: var(--bleu); }
.signature-actions { display: flex; gap: .5rem; margin-bottom: 1rem; }

/* Page émargement */
.page-emargement { max-width: 560px; margin: 0 auto; padding: 1.5rem 1rem; }
.logo-organisme { text-align: center; margin-bottom: 1.5rem; }
.info-session {
  background: var(--bleu-clair);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.info-session .intitule { font-weight: 700; font-size: 1.1rem; }
.info-session .date-creneau { color: var(--bleu-fonce); font-size: .95rem; margin-top: .25rem; }

/* Notice RGPD */
.notice-rgpd {
  background: var(--fond);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  font-size: .8rem;
  color: var(--texte-leger);
  margin-bottom: 1rem;
}
.notice-rgpd strong { display: block; margin-bottom: .25rem; color: var(--texte); }

/* Confirmation */
.confirmation-icon { font-size: 3rem; text-align: center; margin-bottom: 1rem; }
.confirmation-nom { font-size: 1.25rem; font-weight: 700; text-align: center; }

/* QR code page de détail */
.qr-block { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* Responsive */
@media (min-width: 640px) {
  .form-ligne {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* ── Émargement mobile ─────────────────────────────── */

/* Éviter le zoom automatique iOS sur les champs texte */
input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], textarea, select {
  font-size: 1rem; /* 16px minimum */
}

/* Barre de progression */
.etapes-barre {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.75rem;
}
.etape-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  opacity: .3;
  transition: opacity .2s;
}
.etape-item.actif { opacity: 1; }
.etape-item.fait  { opacity: .6; }
.etape-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--bordure);
  color: var(--texte-leger);
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}
.etape-item.actif .etape-num { background: var(--bleu); color: #fff; }
.etape-item.fait .etape-num  { background: var(--succes); color: #fff; }
.etape-label {
  font-size: .65rem;
  color: var(--texte-leger);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.etape-sep {
  flex: 1;
  height: 2px;
  background: var(--bordure);
  border-radius: 1px;
  margin-bottom: 1rem;
}

/* Consigne d'étape */
.etape-consigne {
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 .75rem;
}

/* Cartes de sélection (liste stagiaires) */
.liste-cartes { display: flex; flex-direction: column; gap: .35rem; }

.choix-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 54px;
  padding: .75rem 1rem;
  border: 2px solid var(--bordure);
  border-radius: var(--radius);
  background: var(--blanc);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: border-color .12s, background .12s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.choix-label input[type="radio"],
.choix-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.choix-nom { flex: 1; }
.choix-check {
  color: var(--bleu);
  font-weight: 700;
  font-size: 1.1rem;
  opacity: 0;
  transition: opacity .12s;
  min-width: 1.25rem;
  text-align: right;
}
.choix-label:has(input:checked) {
  border-color: var(--bleu);
  background: var(--bleu-clair);
}
.choix-label:has(input:checked) .choix-check { opacity: 1; }
.choix-desactive {
  opacity: .5;
  cursor: default;
  background: var(--fond);
}
.choix-autre { border-style: dashed; }

/* Saisie manuelle */
.zone-manuel {
  background: var(--fond);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: .75rem;
}

/* Erreur inline */
.erreur-inline {
  background: var(--danger-fond);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  margin-bottom: 1rem;
}

/* Canvas signature */
.signature-zone {
  height: 220px;
}

/* Hint sous le canvas */
.sig-hint {
  font-size: .8rem;
  color: var(--texte-leger);
  flex: 1;
  text-align: right;
}

/* Navigation entre étapes */
.etape-nav {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  align-items: center;
}

/* Récap identité (étape 3) */
.recap-nom {
  background: var(--bleu-clair);
  color: var(--bleu-fonce);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1.5rem;
}

/* Checkbox RGPD */
.rgpd-label {
  border: none;
  border-radius: var(--radius);
  background: var(--fond);
  font-size: .9rem;
  font-weight: normal;
  min-height: auto;
  padding: .875rem 1rem;
}
.rgpd-label input[type="checkbox"] {
  position: static;
  opacity: 1;
  width: auto;
  height: auto;
  pointer-events: auto;
}
