/* ==========================================================================
   Ecrans de connexion ProAdmin : /espace (clients) et /backoffice (personnel).
   Une seule feuille, deux entrees. Tout ce qui les distingue passe par
   body[data-entree="client"] ou body[data-entree="backoffice"] :
     client      clair, panneau vert de l'icone a gauche, formulaire a droite
     backoffice  sombre, bandeau rouge "reserve au personnel", formulaire a
                 gauche, panneau eteint a droite
   ========================================================================== */

@font-face {
  font-family: "Montserrat";
  src: url("/static/assets/fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --citron: #b4f21a;
  --vert: #4cb81a;
  --foret: #12501a;
  --nuit: #0a2410;
  --rouge: #e30b34;
  --papier: #ffffff;
  --encre: #14210f;

  --fond: var(--papier);
  --texte: var(--encre);
  --texte-doux: #55664d;
  --champ-fond: #f4f8ef;
  --champ-bord: #c9d6c0;
  --champ-texte: var(--encre);
  --accent: #2f8a12;
  --bouton-fond: var(--foret);
  --bouton-texte: #ffffff;
  --alerte-fond: #fdeef1;
  --alerte-texte: #a80a28;
}

body[data-entree="backoffice"] {
  --fond: var(--nuit);
  --texte: #eef5e8;
  --texte-doux: #9db592;
  --champ-fond: #10331a;
  --champ-bord: #2d5a35;
  --champ-texte: #ffffff;
  --accent: var(--citron);
  --bouton-fond: var(--citron);
  --bouton-texte: #0a2410;
  --alerte-fond: #3a1119;
  --alerte-texte: #ffb3c0;
}

* { box-sizing: border-box; }

/* La page fait au moins la hauteur de l'écran et GRANDIT avec son contenu : une
   hauteur fixe écrasait le bandeau du téléphone quand le contenu dépassait. */
html { height: 100%; }
body { margin: 0; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--fond);
  color: var(--texte);
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

/* --- Bandeau : n'existe que sur le backoffice ---------------------------- */

.bandeau {
  flex: none;
  margin: 0;
  padding: 9px 20px;
  background: var(--rouge);
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}

/* --- Deux colonnes -------------------------------------------------------- */

.ecran {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}

body[data-entree="backoffice"] .ecran {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
body[data-entree="backoffice"] .scene { order: 2; }

/* --- La scene : le monde de l'icone, en grand ----------------------------- */

.scene {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 48px 32px;
  color: #ffffff;
  background:
    linear-gradient(152deg, rgba(255, 255, 255, 0.14) 0 34%, transparent 34%),
    linear-gradient(332deg, rgba(8, 60, 14, 0.42) 0 28%, transparent 28%),
    radial-gradient(120% 90% at 50% 46%, #a9ef19 0%, #55bd1a 46%, #1f7a17 100%);
}

body[data-entree="backoffice"] .scene {
  background:
    linear-gradient(152deg, rgba(255, 255, 255, 0.04) 0 34%, transparent 34%),
    linear-gradient(332deg, rgba(0, 0, 0, 0.3) 0 28%, transparent 28%),
    radial-gradient(120% 90% at 50% 46%, #1b4a20 0%, #103018 52%, #071a0b 100%);
}

/* Les eclats triangulaires de l'icone, repris a l'echelle de la scene. */
.eclat {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
  clip-path: polygon(0 0, 100% 46%, 12% 100%);
}
.eclat--a { width: 150px; height: 170px; top: 9%; right: 9%; }
.eclat--b { width: 96px; height: 120px; bottom: 12%; left: 8%; transform: rotate(168deg); }
.eclat--c { width: 44px; height: 54px; top: 38%; left: 15%; transform: rotate(205deg); opacity: 0.8; }
.eclat--d { width: 40px; height: 50px; bottom: 30%; right: 14%; transform: rotate(40deg); opacity: 0.7; }

body[data-entree="backoffice"] .eclat { background: rgba(180, 242, 26, 0.09); }

.scene img {
  position: relative;
  width: min(250px, 44%);
  height: auto;
  filter: drop-shadow(0 22px 34px rgba(4, 44, 10, 0.42));
}

.lueur {
  position: relative;
  width: min(220px, 40%);
  height: 3px;
  margin-top: -14px;
  border-radius: 3px;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
  animation: allumage 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
body[data-entree="backoffice"] .lueur {
  background: radial-gradient(closest-side, rgba(180, 242, 26, 0.9), rgba(180, 242, 26, 0));
}

@keyframes allumage {
  from { transform: scaleX(0.05); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

.scene-titre {
  position: relative;
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-align: center;
  text-wrap: balance;
}

/* --- Le formulaire -------------------------------------------------------- */

.entree {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(24px, 7vw, 96px);
}

.entree-corps { width: 100%; max-width: 400px; margin: 0 auto; }

.marque {
  display: inline-block;
  margin-bottom: 40px;
  font-size: 1.375rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--rouge);
  text-decoration: none;
}
.marque b { font-weight: 800; color: var(--texte); }
body[data-entree="backoffice"] .marque { color: #ff6b85; }

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.875rem, 3vw, 2.375rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.chapo { margin: 0 0 32px; color: var(--texte-doux); }

.champ { display: block; margin-bottom: 18px; }

.champ > span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.champ input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--champ-bord);
  border-radius: 10px;
  background: var(--champ-fond);
  color: var(--champ-texte);
  font: inherit;
}
.champ input::placeholder { color: var(--texte-doux); opacity: 0.7; }

.champ input:focus-visible,
.bouton:focus-visible,
.voir:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.secret { position: relative; }
.secret input { padding-right: 96px; }

.voir {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.bouton {
  width: 100%;
  margin-top: 10px;
  padding: 15px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--bouton-fond);
  color: var(--bouton-texte);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms ease;
}
.bouton:hover { filter: brightness(1.12); }
.bouton[disabled] { opacity: 0.6; cursor: progress; }

.message {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--alerte-fond);
  color: var(--alerte-texte);
  font-size: 0.9375rem;
  font-weight: 600;
}
.message[hidden] { display: none; }

.autre {
  margin: 28px 0 0;
  font-size: 0.875rem;
  color: var(--texte-doux);
}
.autre a { color: var(--accent); font-weight: 700; }

/* --- Creation de compte (/inscription) ------------------------------------
   Meme ecran que la connexion client, avec un formulaire plus long : la scene
   reste en place pendant que le formulaire defile. */

.page-longue .scene { position: sticky; top: 0; height: 100vh; }
.page-longue .entree { justify-content: flex-start; padding-top: 56px; padding-bottom: 64px; }
.entree-corps--large { max-width: 520px; }

.paire { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.requis { margin-left: 6px; font-size: 0.75rem; font-weight: 600; color: var(--accent); }

.champ select, .trio-date select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--champ-bord);
  border-radius: 10px;
  background: var(--champ-fond);
  color: var(--champ-texte);
  font: inherit;
}
.champ select:focus-visible, .trio-date select:focus-visible, .case input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.groupe { margin: 0 0 18px; padding: 0; border: 0; }
.groupe legend { margin-bottom: 6px; padding: 0; font-size: 0.875rem; font-weight: 600; }
.trio-date { display: grid; grid-template-columns: 0.8fr 1.4fr 1fr; gap: 12px; }

.case { display: flex; align-items: flex-start; gap: 12px; margin: 6px 0 14px; font-size: 0.9375rem; cursor: pointer; }
.case input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }

/* --- Telephone : la scene devient un en-tete ------------------------------ */

@media (max-width: 820px) {
  .ecran,
  body[data-entree="backoffice"] .ecran { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .scene { min-height: max-content; }
  body[data-entree="backoffice"] .scene { order: 0; }
  .scene { flex-direction: row; gap: 18px; padding: 22px 24px; justify-content: flex-start; }
  .scene img { width: 64px; filter: drop-shadow(0 8px 12px rgba(4, 44, 10, 0.4)); }
  .scene-titre { font-size: 1.25rem; text-align: left; }
  .lueur, .eclat--c, .eclat--d { display: none; }
  .eclat--a { width: 80px; height: 90px; top: -10px; right: 4%; }
  .eclat--b { width: 50px; height: 62px; bottom: -14px; left: auto; right: 30%; }
  .entree { justify-content: flex-start; padding: 36px 24px 48px; }
  .marque { margin-bottom: 28px; }
  .page-longue .scene { position: static; height: auto; }
  .page-longue .entree { padding-top: 36px; padding-bottom: 48px; }
}

@media (max-width: 480px) {
  .paire { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .lueur { animation: none; }
  .bouton { transition: none; }
}

/* --- Comptes : message favorable, mot de passe oublie, confirmation --------- */

/* Un champ retire par l'attribut hidden : .champ et .bouton fixent leur display. */
.entree [hidden] { display: none; }

.message--bon { background: #e6f5dc; color: #1f5c0d; }
body[data-entree="backoffice"] .message--bon { background: #1d4a22; color: #d9f7c4; }

.oubli { margin: -6px 0 18px; font-size: 0.875rem; text-align: right; }
.oubli a { color: var(--accent); font-weight: 600; }

.essai { margin: 10px 0 0; font-weight: 500; font-size: 0.875rem; }
.essai a { color: inherit; font-weight: 700; word-break: break-all; }

.confirmation[hidden] { display: none; }
.confirmation p { margin: 0 0 16px; color: var(--texte-doux); line-height: 1.6; }
.confirmation .essai {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--champ-fond);
  border: 1px dashed var(--champ-bord);
  color: var(--texte);
}

.aide-champ { display: block; margin-top: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--texte-doux); }

/* --- Inscription ouverte depuis le site d'un partenaire (?via=) ------------ */
.via {
  margin: 0 0 22px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--champ-fond);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
}

/* --- Invitation à rejoindre une structure (/activation#invitation=…) -------- */

.inv { margin: 0 0 22px; padding: 18px; border: 1.5px solid var(--champ-bord); border-radius: 14px; background: var(--champ-fond); }
.inv-tete { display: flex; align-items: center; gap: 14px; }
.inv-tete b { display: block; font-size: 1.0625rem; line-height: 1.3; overflow-wrap: anywhere; }
.inv-logo { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--foret); color: #ffffff; font-weight: 800; }
.inv-role { display: inline-block; margin-top: 5px; padding: 2px 10px; border-radius: 999px; background: var(--bouton-fond); color: var(--bouton-texte); font-size: 0.75rem; font-weight: 700; }
.inv-pour { margin: 14px 0 0; font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.inv-voit { margin: 6px 0 0; font-size: 0.875rem; line-height: 1.55; color: var(--texte-doux); }
.inv-qui, .inv-question { margin: 0 0 14px; font-size: 0.9375rem; overflow-wrap: anywhere; }
.inv-choix { display: grid; gap: 8px; }
.inv-aide { margin: -2px 0 6px; font-size: 0.8125rem; color: var(--texte-doux); }
.inv-refus { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 14px; }
.inv-refus-btn { padding: 4px 2px; border: 0; background: none; font: inherit; font-size: 0.8125rem; color: var(--texte-doux); text-decoration: underline; cursor: pointer; }
.inv-refus-btn:hover, .inv-refus-btn:focus-visible { color: var(--texte); }
.inv-refus-btn:disabled { opacity: 0.5; cursor: default; }
.bouton--second { background: transparent; color: var(--texte); border: 1.5px solid var(--champ-bord); }
.bouton--second:hover { filter: none; border-color: var(--accent); }
a.bouton { display: block; text-align: center; text-decoration: none; }

/* --- Jamais de défilement horizontal sur téléphone ----------------------------
   Un long mot (une adresse email) passe à la ligne au lieu d'élargir la page ;
   et la page ne bouge pas de droite à gauche. `clip` ne crée pas de zone de
   défilement (le reste de la mise en page n'est pas touché) ; `hidden` pour les
   navigateurs anciens. */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
.entree, .entree-corps { min-width: 0; }
.chapo, .message, .inv, .inv-qui, .inv-question, .case span, .autre { overflow-wrap: anywhere; }

/* --- Le formulaire de demande d'exercice des droits (/demande) -------------- */
.dm-page .entree-corps--large { max-width: 600px; }
.dm-tete { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.dm-tete h1 { margin: 0; }
.dm-logo { flex: none; width: 52px; height: 52px; border-radius: 12px; object-fit: contain; background: #ffffff; box-shadow: 0 0 0 1px var(--champ-bord); }
.dm-objets { margin: 6px 0 14px; padding: 0; border: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dm-objets legend { margin-bottom: 8px; padding: 0; font-weight: 600; font-size: 0.9375rem; }
.dm-objet { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--champ-bord); border-radius: 12px; background: var(--champ-fond); cursor: pointer; }
.dm-objet input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.dm-objet span { display: grid; gap: 2px; min-width: 0; }
.dm-objet b { font-size: 0.9rem; }
.dm-objet small { color: var(--texte-doux); font-size: 0.78rem; line-height: 1.35; }
.dm-objet:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: #ffffff; }
.dm-page textarea { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--champ-bord); border-radius: 12px; background: var(--champ-fond); color: var(--champ-texte); font: inherit; resize: vertical; }
.dm-page textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dm-etapes { margin: 4px 0 14px; padding: 14px 16px; border-radius: 12px; background: var(--champ-fond); font-size: 0.875rem; }
.dm-etapes h2 { margin: 0 0 8px; font-size: 0.95rem; }
.dm-etapes ol { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.dm-etapes p { margin: 0; color: var(--texte-doux); font-size: 0.8125rem; line-height: 1.5; }
.dm-transmise .bouton { display: inline-flex; text-decoration: none; }
/* Dans un cadre sur le site de la société : le formulaire seul. */
.dm-integre { background: transparent; }
.dm-integre .scene { display: none; }
.dm-integre .ecran { display: block; min-height: 0; }
.dm-integre .entree { min-height: 0; padding: 16px; background: transparent; }
.dm-integre .entree-corps--large { max-width: none; margin: 0; }
@media (max-width: 520px) { .dm-objets { grid-template-columns: minmax(0, 1fr); } }

/* --- La politique de confidentialité publiée (/confidentialite) -------------- */
.cf-page { background: #f4f8ef; }
.cf { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
.cf-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cf-tete .lang-coin { position: static; }
.cf-corps { padding: 28px 32px; border-radius: 16px; background: #ffffff; box-shadow: 0 10px 30px rgba(20, 60, 20, 0.08); }
.cf-societe { margin: 0 0 4px; color: var(--texte-doux); font-weight: 600; }
.cf-corps h1 { margin: 0 0 18px; font-size: clamp(1.5rem, 3vw, 2rem); }
.cf-texte { padding: 0; border: 0; font-size: 0.95rem; line-height: 1.65; }
.cf-texte h2 { margin: 22px 0 8px; font-size: 1.15rem; }
.cf-texte h3 { margin: 16px 0 6px; font-size: 1rem; }
.cf-texte p { margin: 0 0 10px; }
.cf-texte ul, .cf-texte ol { margin: 0 0 10px; padding-left: 22px; }
.cf-texte .md-table { overflow-x: auto; }
.cf-texte table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.cf-texte th, .cf-texte td { padding: 7px 9px; border-bottom: 1px solid #dfe8d6; text-align: left; vertical-align: top; }
.cf-pied { margin-top: 26px; padding-top: 18px; border-top: 1px solid #dfe8d6; color: var(--texte-doux); font-size: 0.875rem; }
.cf-pied .bouton { display: inline-flex; width: auto; margin-bottom: 12px; text-decoration: none; }
.cf-pied p { margin: 0 0 4px; overflow-wrap: anywhere; }
@media (max-width: 600px) { .cf-corps { padding: 20px 18px; } }

/* ---------------------------------------------------------------- ProAdminSSO (autoriser.js) */
.oa h1 { margin: 0 0 6px; font-size: 1.375rem; line-height: 1.3; overflow-wrap: anywhere; }
.oa h2 { margin: 18px 0 8px; font-size: 0.9375rem; }
.oa p { overflow-wrap: anywhere; }
.oa-tete { display: flex; align-items: center; gap: 14px; margin: 8px 0 18px; }
.oa-tete p { margin: 0; color: var(--texte-doux); font-size: 0.875rem; }
.oa-tete a { color: var(--accent); }
.oa-logo { flex: none; width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: var(--champ-fond); }
.oa-logo--vide { display: grid; place-items: center; color: var(--accent); font-size: 1.5rem; font-weight: 700; }
.oa-carte { padding: 4px 18px 14px; border: 1px solid var(--champ-bord); border-radius: 14px; background: var(--champ-fond); }
.oa-liste { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.oa-note { color: var(--texte-doux); font-size: 0.8125rem; }
.oa-boutons { display: grid; gap: 4px; margin-top: 14px; }
.oa-boutons .bouton { margin-top: 6px; text-align: center; text-decoration: none; }
.oa-qui { margin: 16px 0 0; color: var(--texte-doux); font-size: 0.8125rem; text-align: center; }
.oa-lien { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.oa-message h1 { margin-top: 8px; }
.oa-attente { display: flex; align-items: center; gap: 12px; color: var(--texte-doux); }
.oa-rond { width: 18px; height: 18px; border: 2.5px solid var(--champ-bord); border-top-color: var(--accent); border-radius: 50%; animation: oa-tour 0.9s linear infinite; }
@keyframes oa-tour { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .oa-rond { animation: none; } }

/* --- Connexion automatique (appareil de confiance) -------------------------
   Le formulaire cède aussitôt la place à l'animation (assets/js/login.js). */
.entree-corps--auto > :not(.marque):not(.auto) { display: none; }
.auto { display: flex; flex-direction: column; align-items: center; text-align: center; animation: auto-entree 260ms ease-out both; }
.auto .pa-attente { min-height: 0; padding: 8px 0 0; }
.auto .pa-comete { width: 72px; height: 72px; }
.auto .pa-legende { color: var(--texte); font-size: 1.25rem; font-weight: 800; }
.auto-qui { margin: 10px 0 28px; color: var(--texte-doux); overflow-wrap: anywhere; }
.auto-autre { padding: 10px 18px; border: 1.5px solid var(--champ-bord); border-radius: 10px; background: transparent;
  color: var(--texte); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer; }
.auto-autre:hover { border-color: var(--accent); }
@keyframes auto-entree { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .auto { animation: none; } }
.auto-titre { margin: 4px 0 0; font-size: 1.25rem; font-weight: 800; color: var(--texte); }
.auto-code { align-self: stretch; margin: 0 0 22px; text-align: left; }
.auto-code .champ input { letter-spacing: 0.2em; text-align: center; font-size: 1.25rem; }

/* L'accord qui nomme des services : la carte défile, les boutons restent visibles. */
.oa-carte--long { max-height: calc(100vh - 590px); max-height: calc(100dvh - 590px); min-height: 130px; overflow-y: auto; }
.oa-partage { margin: 12px 0 0; font-size: 0.875rem; line-height: 1.4; }
