/* Les pages de compte (connexion, inscription, mot de passe, double vérification, sécurité, désinscription) et le bandeau de l'adresse à confirmer :
   un seul jeu de briques, lié dans les deux coques (src/vitrine/skin.ts, src/web/layout.ts) et rendu par src/web/compte.ts.
   Les feuilles des espaces posent des règles sur `.esp input`, `.esp button`, `.esp h2` (et des plus lourdes pour l'administration) : les sélecteurs d'ici
   répètent `.compte` là où il faut passer devant, et la feuille est chargée après elles. Palette et polices : celles du site (variables de boost.css ou d'app.css). */

.compte { --c-texte: var(--text-font, Jost, system-ui, sans-serif); --c-titre: var(--display, 'EB Garamond', Georgia, serif); --c-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink); font: 500 17px/1.5 var(--c-texte); }
.compte-etroit, .compte-large, .compte-ample { width: 100%; margin-inline: auto; }
.compte-etroit { max-width: 440px; }
.compte-large { max-width: 560px; }
.compte-ample { max-width: 720px; margin-inline: 0; }
.compte p { margin: 0 0 .8em; }
.compte a:not(.c-btn) { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.compte :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.compte [hidden] { display: none !important; }
.c-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Le haut de page : le titre se centre avec la carte (sans le site, le h1 de la coque d'origine) */
.esp:has([data-centre]) .esp-hero .phero-in { text-align: center; }
.esp:has([data-centre]) .esp-hero h1 { margin-inline: auto; }
.esp:has([data-centre]) .esp-hero .eyebrow { justify-content: center; }
main:has(> [data-centre]) > h1 { text-align: center; }

/* Carte */
.compte .c-carte { margin: 0 0 18px; padding: clamp(20px, 5vw, 34px); border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgba(37, 36, 63, .05), 0 12px 32px rgba(37, 36, 63, .06); }
.compte .c-carte > :last-child { margin-bottom: 0; }
.compte h2.c-titre { margin: 0 0 6px; font: 700 clamp(24px, 3vw, 29px)/1.15 var(--c-titre); letter-spacing: -.005em; }
.compte h3.c-sous-titre { margin: 22px 0 6px; font: 700 21px/1.2 var(--c-titre); }
.compte .c-sous { margin: 0 0 22px; color: var(--muted); }
.compte .c-entete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 8px; }
.compte .c-entete h2.c-titre { margin: 0; }
.compte .c-badge { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 99px; background: var(--sand); color: var(--muted); font: 700 12.5px/1 var(--c-texte); letter-spacing: .08em; text-transform: uppercase; }
.compte .c-badge.c-actif { background: #e3f1e9; color: #145c38; }
.compte .c-pied { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: 16px; }
.compte .c-pied a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
/* Page de connexion (retour d'Adrien du 25/11) : « Première visite ? Créer mon compte » en pavé visible sous le formulaire, plus en petite ligne grise */
.compte .c-premiere { margin: 20px 0 0; padding: clamp(16px, 4vw, 22px); text-align: center; }
.compte .c-premiere-q { margin: 0 0 12px; font: 700 clamp(21px, 2.6vw, 24px)/1.15 var(--c-titre); color: var(--ink); }

/* Alerte (info, succès, erreur, avertissement) : l'icône est dessinée par la feuille, le rôle ARIA est posé par src/web/compte.ts */
.compte .c-alerte { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 18px; padding: 14px 16px; border: 1px solid; border-radius: 4px; font-size: 16px; line-height: 1.45; }
.compte .c-alerte::before { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; color: #fff; font: 700 14px/1 var(--c-texte); }
.compte .c-alerte-corps { flex: 1 1 0; min-width: 0; }
.compte .c-alerte-corps > :last-child { margin-bottom: 0; }
.compte .c-info { border-color: #c5cbe3; background: #eef0f7; }
.compte .c-ok { border-color: #b4d8c2; background: #e8f3ec; }
.compte .c-erreur { border-color: #ebb9b5; background: #fbedec; }
.compte .c-attention { border-color: #e3d58a; background: #fbf6dc; }
.compte .c-alerte.c-info::before { content: "i"; background: var(--ink); }
.compte .c-alerte.c-ok::before { content: "\2713"; background: var(--ok); }
.compte .c-alerte.c-erreur::before { content: "!"; background: var(--warn); }
.compte .c-alerte.c-attention::before { content: "!"; background: #7a5c00; }
/* Le bandeau de l'adresse à confirmer : le message, puis le bouton à sa droite (dessous sur téléphone) */
.compte .c-bandeau { align-items: center; flex-wrap: wrap; }
.compte .c-bandeau .c-alerte-corps { flex-basis: 320px; }
.compte .c-bandeau form { margin: 0; }

/* État d'une page de résultat : adresse confirmée, lien périmé, trop de tentatives... */
.compte .c-etat { text-align: center; }
.compte .c-pastille { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; color: #fff; font: 700 28px/1 var(--c-texte); }
.compte .c-etat.c-info .c-pastille { background: var(--ink); }
.compte .c-etat.c-ok .c-pastille { background: var(--ok); }
.compte .c-etat.c-erreur .c-pastille { background: var(--warn); }
.compte .c-etat.c-attention .c-pastille { background: #7a5c00; }
.compte .c-etat.c-info .c-pastille::before { content: "i"; }
.compte .c-etat.c-ok .c-pastille::before { content: "\2713"; }
.compte .c-etat.c-erreur .c-pastille::before, .compte .c-etat.c-attention .c-pastille::before { content: "!"; }
.compte .c-etat-texte { margin: 0 0 22px; font-size: 18px; }
.compte .c-etat-texte p { margin: 0 0 .5em; }
.compte .c-actions { display: grid; gap: 10px; }
.compte .c-actions form { margin: 0; }

/* Champ : libellé, saisie, erreur liée au champ (aria-describedby), aide */
.compte .c-champ { margin: 0 0 18px; }
.compte .c-label { display: block; margin: 0 0 6px; font: 600 16px/1.3 var(--c-texte); }
.compte .c-aide { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.compte form > p.c-aide { margin-bottom: 18px; }
.compte .c-aide.c-regle-ok { color: #145c38; }
.compte .c-aide.c-regle-ok::before { content: "\2713\00a0"; font-weight: 700; }
.compte .c-err { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; color: var(--warn); font-size: 15.5px; font-weight: 600; line-height: 1.4; }
.compte .c-err::before { content: "!"; flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--warn); color: #fff; font: 700 12px/1 var(--c-texte); }
.compte.compte.compte input.c-input { display: block; width: 100%; min-height: 52px; margin: 0; padding: 12px 14px; border: 1px solid var(--line-strong, rgba(37, 36, 63, .55)); border-radius: 4px; background: #fff; color: var(--ink); font: 500 17px/1.4 var(--c-texte); letter-spacing: 0; text-transform: none; box-shadow: none; transition: border-color .2s; }
.compte.compte.compte input.c-input:hover { border-color: var(--ink); }
.compte.compte.compte input.c-input:focus { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 2px; }
.compte.compte.compte input.c-input[aria-invalid="true"] { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
/* Le mot de passe : le bouton « Afficher » est posé dans le champ par public/compte.js */
.compte .c-mdp { position: relative; display: block; }
.compte.compte.compte .c-mdp input.c-input { padding-right: 104px; }
.compte.compte button.c-oeil { position: absolute; top: 4px; right: 4px; bottom: 4px; display: flex; align-items: center; min-height: 0; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--ink); transform: none; font: 600 15px/1 var(--c-texte); letter-spacing: 0; text-transform: none; text-decoration: underline; text-underline-offset: 3px; }
.compte.compte button.c-oeil:hover { background: var(--sand); transform: none; }
/* La saisie d'un code : grande, chiffres espacés */
.compte.compte.compte input.c-input.c-code { min-height: 64px; padding: 12px 14px 12px calc(14px + .3em); font: 600 clamp(26px, 7vw, 32px)/1.2 var(--c-mono); letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.compte.compte.compte input.c-input.c-code.c-secours { font-size: 22px; letter-spacing: .1em; }
/* Le même code, une case par chiffre (public/compte.js les pose) : la saisie reste par-dessus, transparente, pour le collage, la saisie automatique et les lecteurs d'écran */
.compte .c-otp { position: relative; display: flex; gap: 8px; }
.compte .c-otp-case { position: relative; flex: 1 1 0; min-width: 0; display: grid; place-items: center; height: 60px; border: 1px solid var(--line-strong, rgba(37, 36, 63, .55)); border-radius: 4px; background: #fff; color: var(--ink); font: 600 28px/1 var(--c-mono); font-variant-numeric: tabular-nums; transition: border-color .15s; }
.compte .c-otp-case:nth-child(3) { margin-right: 10px; }
.compte .c-otp-plein { border-color: var(--ink); }
.compte .c-otp:focus-within .c-otp-actif { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; }
.compte .c-otp:focus-within .c-otp-actif:empty::after { content: ""; width: 2px; height: 28px; background: var(--ink); animation: c-otp-curseur 1.1s steps(1) infinite; }
.compte .c-otp-err .c-otp-case { border-color: var(--warn); }
.compte.compte.compte .c-otp input.c-input.c-otp-saisie { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: 0; color: transparent; -webkit-text-fill-color: transparent; caret-color: transparent; font-size: 24px; letter-spacing: 0; }
.compte .c-otp-saisie::selection { background: transparent; }
/* Envoi automatique au sixième chiffre : les cases s'estompent pendant la vérification, le texte dessous le dit */
.compte .c-otp-attente .c-otp-case { opacity: .55; }
.compte .c-attente-texte { margin: 12px 0 0; text-align: center; color: var(--muted, var(--ink)); font-size: 15px; }
.compte .c-attente-texte:empty { display: none; }
@keyframes c-otp-curseur { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .compte .c-otp:focus-within .c-otp-actif:empty::after { animation: none; } }

/* Boutons : lime plein pour l'action, filet indigo pour le reste (comme .btn du site) */
.compte.compte :is(button, a).c-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; box-sizing: border-box; min-height: 48px; max-width: 100%; padding: 12px 22px; border: 1px solid var(--ink); border-radius: 4px; background: #fff; color: var(--ink); font: 700 14px/1.25 var(--c-texte); letter-spacing: .1em; text-transform: uppercase; text-align: center; text-decoration: none; cursor: pointer; transform: none; transition: background .2s, box-shadow .2s; }
.compte.compte :is(button, a).c-btn:hover { background: var(--sand); transform: none; }
.compte.compte :is(button, a).c-btn.c-principal { border-color: var(--lime); background: var(--lime); }
.compte.compte :is(button, a).c-btn.c-principal:hover { background: var(--lime); box-shadow: inset 0 0 0 2px var(--ink); }
.compte.compte :is(button, a).c-btn.c-danger { border-color: var(--warn); color: var(--warn); }
.compte.compte :is(button, a).c-btn.c-danger:hover { background: #fbedec; }
.compte.compte :is(button, a).c-btn.c-lien { min-height: 44px; padding: 8px 4px; border-color: transparent; background: transparent; font-weight: 600; font-size: 16px; letter-spacing: 0; text-transform: none; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.compte.compte :is(button, a).c-btn.c-lien:hover { background: transparent; text-decoration-thickness: 2px; }
.compte.compte :is(button, a).c-btn.c-plein { width: 100%; }
.compte.compte :is(button, a).c-btn:disabled, .compte.compte a.c-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; box-shadow: none; }
/* Envoi en cours (public/compte.js) : le bouton se grise et tourne, un second clic n'envoie rien */
.compte.compte button.c-btn.c-attente:disabled { opacity: .85; cursor: progress; }
.compte button.c-btn.c-attente::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: c-tourne .8s linear infinite; }
@keyframes c-tourne { to { transform: rotate(360deg); } }
.compte .c-ligne { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 12px; }
.compte .c-ligne .c-champ { flex: 1 1 200px; margin: 0; }
.compte .c-aide + .c-ligne { margin-top: 14px; }
.compte .c-rang { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.compte .c-oubli { margin: -6px 0 18px; text-align: right; font-size: 15.5px; }
.compte .c-oubli a { display: inline-flex; align-items: center; min-height: 44px; }

/* Choix d'un profil et case à cocher : une carte entière se touche */
.compte fieldset.c-groupe { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.compte fieldset.c-groupe > legend { padding: 0; margin: 0 0 8px; font: 600 16px/1.3 var(--c-texte); }
.compte label.c-choix, .compte label.c-case { display: flex; align-items: flex-start; gap: 12px; box-sizing: border-box; margin: 0 0 10px; padding: 13px 16px; min-height: 44px; border: 1px solid var(--line-strong, rgba(37, 36, 63, .55)); border-radius: 4px; background: #fff; cursor: pointer; font: 500 17px/1.35 var(--c-texte); letter-spacing: 0; text-transform: none; }
.compte label.c-choix:hover, .compte label.c-case:hover { border-color: var(--ink); }
.compte label.c-choix:has(input:checked), .compte label.c-case:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.compte label.c-choix:has(input:focus-visible), .compte label.c-case:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.compte label.c-choix input, .compte label.c-case input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); }
.compte label.c-choix strong { display: block; font-weight: 600; }
.compte label.c-choix small { display: block; margin-top: 2px; color: var(--muted); font-size: 15px; font-weight: 500; }
.compte fieldset.c-cadre { min-width: 0; margin: 0 0 18px; padding: 16px 18px 2px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.compte fieldset.c-cadre > legend { padding: 0 8px; font: 700 13px/1.3 var(--c-texte); letter-spacing: .1em; text-transform: uppercase; color: var(--acc-d, var(--acc)); }

/* Pas à pas numéroté (mise en place de la double vérification) */
.compte ol.c-pas { margin: 0; padding: 0; list-style: none; counter-reset: pas; }
.compte ol.c-pas > li { position: relative; margin: 0; padding: 0 0 28px 52px; counter-increment: pas; }
.compte ol.c-pas > li:last-child { padding-bottom: 0; }
.compte ol.c-pas > li::before { content: counter(pas); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; font: 700 16px/1 var(--c-texte); }
.compte ol.c-pas > li:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 42px; bottom: 8px; width: 2px; background: var(--line); }
.compte .c-pas h2.c-pas-titre { margin: 3px 0 6px; font: 700 22px/1.2 var(--c-titre); }
.compte .c-qr { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; margin: 14px 0 18px; }
.compte .c-qr-image { flex: none; box-sizing: border-box; width: 212px; height: 212px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.compte .c-qr-image svg { display: block; width: 100%; height: 100%; }
.compte .c-qr-texte { flex: 1 1 160px; min-width: 0; }
.compte .c-qr-texte p { margin: 0 0 .6em; }
.compte .c-valeur { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 8px; }
.compte code.c-cle { flex: 0 1 auto; box-sizing: border-box; max-width: min(100%, 14em); padding: 12px 14px; border: 1px dashed var(--line-strong, rgba(37, 36, 63, .55)); border-radius: 4px; background: var(--sand); color: var(--ink); font: 600 18px/1.6 var(--c-mono); letter-spacing: .05em; user-select: all; overflow-wrap: anywhere; }

/* Codes de secours : deux colonnes en chasse fixe */
.compte ul.c-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 0 0 18px; padding: 14px; list-style: none; border: 1px solid var(--line); border-radius: 4px; background: var(--sand); }
.compte ul.c-codes li { margin: 0; padding: 10px 6px; border: 1px solid var(--line); border-radius: 3px; background: #fff; text-align: center; }
.compte ul.c-codes code { font: 600 18px/1.3 var(--c-mono); letter-spacing: .06em; white-space: nowrap; user-select: all; color: var(--ink); }

/* Zone sensible repliée : retirer la protection */
.compte details.c-zone { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.compte details.c-zone > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--warn); font-weight: 600; }
.compte details.c-zone[open] > summary { margin-bottom: 10px; }

@media (max-width: 600px) {
  .compte.compte :is(button, a).c-btn.c-principal { width: 100%; }
  .compte .c-rang > .c-btn, .compte .c-rang > form { flex: 1 1 auto; }
  .compte .c-rang > form > .c-btn { width: 100%; }
  .compte .c-ligne > .c-btn, .compte .c-ligne > form > .c-btn { width: 100%; }
  .compte .c-ligne > form { width: 100%; }
}
@media (max-width: 480px) {
  .compte ol.c-pas > li { padding-left: 44px; }
  .compte .c-qr { justify-content: center; }
  .compte .c-qr-texte { flex-basis: 100%; text-align: center; }
  .compte code.c-cle { font-size: 16.5px; }
  .compte ul.c-codes { gap: 8px; padding: 8px; }
  .compte ul.c-codes li { padding: 9px 2px; }
  .compte ul.c-codes code { font-size: 14px; letter-spacing: 0; }
}

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

/* Sur papier : les codes de secours seuls, sans boutons ni messages */
@media print {
  .compte .c-alerte, .compte .c-noprint, .compte .c-pied, .compte .c-premiere { display: none !important; }
  .compte .c-carte { padding: 0; border: 0; box-shadow: none; }
  .compte ul.c-codes { background: #fff; border-color: #000; }
}
