/* Page sécurisée du relais — mobile d'abord (la plupart des clients ouvrent le lien sur leur téléphone). */
:root {
  --fond: #f4f5f7; --carte: #ffffff; --texte: #15181d; --doux: #5d6470; --trait: #e3e6eb;
  --accent: #1f4f8f; --accent-texte: #ffffff; --accent-doux: #e8eef7; --ok: #1d7a46; --ok-doux: #e5f4ea;
  --erreur: #b3261e; --erreur-doux: #fbe9e7; --rayon: 14px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --fond: #111418; --carte: #1a1e24; --texte: #eef0f3; --doux: #a3aab5; --trait: #2c323b;
          --accent: #7fb0ff; --accent-texte: #0b1a33; --accent-doux: #1d2a3f; --ok: #6fd39a; --ok-doux: #15291d;
          --erreur: #ff8a80; --erreur-doux: #3a1714; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; min-height: 100dvh;
}
.app {
  max-width: 640px; margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(120px + env(safe-area-inset-bottom, 0px));
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 1.1rem; margin: 0 0 4px; }
p { margin: 0 0 8px; }
.discret { color: var(--doux); font-size: 0.9rem; }
.carte {
  background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 18px 16px; margin-bottom: 14px; min-width: 0;
}
.etat-page { text-align: center; padding: 40px 20px; }
.anneau {
  width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--trait); border-top-color: var(--accent); animation: tourne 0.8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
.cadenas {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--ok);
  background: var(--ok-doux); border-radius: 999px; padding: 3px 10px; margin-bottom: 10px;
}
.entete .cabinet { color: var(--doux); font-weight: 600; font-size: 0.9rem; margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message { white-space: pre-line; overflow-wrap: anywhere; }

/* Questions */
.question { padding: 12px 0; border-top: 1px solid var(--trait); }
.question:first-of-type { border-top: 0; }
.question > label, .question legend { display: block; font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.question .aide { color: var(--doux); font-size: 0.875rem; margin: -2px 0 8px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--texte); background: var(--carte);
  border: 1px solid var(--trait); border-radius: 10px; padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.champ-erreur { border-color: var(--erreur) !important; }
.msg-erreur { color: var(--erreur); font-size: 0.875rem; margin-top: 6px; }
.adresse { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 480px) { .adresse { grid-template-columns: 2fr 1fr; } .adresse .rue { grid-column: 1 / -1; } }

/* Oui / non et choix : de vrais boutons radio, stylés en segments */
.segments { display: flex; flex-wrap: wrap; gap: 8px; }
.segments label {
  position: relative; flex: 1 1 auto; min-width: 88px; min-height: 46px; display: flex;
  align-items: center; justify-content: center; text-align: center; padding: 10px 14px;
  border: 1px solid var(--trait); border-radius: 10px; cursor: pointer; font-weight: 500;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: background-color 120ms var(--ease-out), border-color 120ms var(--ease-out), transform 100ms var(--ease-out);
}
.segments input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segments label:active { transform: scale(0.97); }
.segments label:has(input:checked) { background: var(--accent-doux); border-color: var(--accent); color: var(--accent); }
.segments label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Pièces */
.piece { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--trait); }
.piece:first-of-type { border-top: 0; }
.piece .corps { flex: 1; min-width: 0; }
.piece .titre { font-weight: 600; overflow-wrap: anywhere; }
.piece .pastille {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--trait);
  display: grid; place-items: center; font-size: 0.8rem; margin-top: 2px;
}
.piece.recue .pastille { background: var(--ok); border-color: var(--ok); color: #fff; }
.envois { list-style: none; padding: 0; margin: 6px 0 0; font-size: 0.875rem; color: var(--doux); }
.envois li { display: flex; gap: 8px; align-items: center; min-width: 0; padding: 2px 0; }
.envois .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.envois .etat-ok { color: var(--ok); flex: none; }
.envois .etat-ko { color: var(--erreur); flex: none; }
.barre { height: 4px; background: var(--trait); border-radius: 2px; overflow: hidden; flex: 0 0 64px; }
.barre > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 160ms linear; }
.ajouter { position: relative; display: inline-flex; margin-top: 8px; }
.ajouter input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; font-size: 16px; }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--trait); background: var(--carte);
  color: var(--texte); font: inherit; font-weight: 600; cursor: pointer;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform 100ms var(--ease-out), background-color 120ms var(--ease-out);
}
.bouton:active { transform: scale(0.97); }
.bouton:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bouton.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.bouton[disabled] { opacity: 0.55; cursor: default; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .bouton:hover:not([disabled]) { background: var(--accent-doux); }
  .bouton.principal:hover:not([disabled]) { filter: brightness(1.08); background: var(--accent); }
  .segments label:hover { border-color: var(--accent); }
}
.pied {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--carte); border-top: 1px solid var(--trait);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.pied .contenu { max-width: 640px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.pied .bouton { flex: 1; }
.pied .statut { font-size: 0.8rem; color: var(--doux); flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bandeau { border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 0.925rem; }
.bandeau.ok { background: var(--ok-doux); color: var(--ok); }
.bandeau.erreur { background: var(--erreur-doux); color: var(--erreur); }
.apparait { animation: apparait 220ms var(--ease-out) both; }
@keyframes apparait { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .apparait { animation: fondu 160ms ease-out both; }
  .bouton:active, .segments label:active { transform: none; }
}
@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }
[hidden] { display: none !important; }

/* Lien public : le champ piège à robots, hors de l'écran et des lecteurs d'écran. */
.piege { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
#vous .bouton.principal { width: 100%; margin-top: 12px; }
#vous input:disabled:not([type=radio]), #vous textarea:disabled { opacity: 0.7; }
#vous .segments label:has(input:disabled) { cursor: default; }
