/* Espace client et back-office — s'appuie sur les jetons du site. */

.espace-page { max-width: 900px; margin: 0 auto; padding: calc(var(--hdr-h, 72px) + var(--space-6)) var(--gutter) var(--space-8); }

.espace-etiquette { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: var(--w-med); }

.espace-entete { display: flex; flex-wrap: wrap; gap: var(--space-4);
  align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
.espace-entete h1 { font-family: var(--font-display); font-weight: var(--w-med);
  font-size: var(--fs-d2); line-height: 1.1; color: var(--ink); }

.espace-carte { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: clamp(1.3rem, 3vw, 2.2rem); margin-bottom: var(--space-6); }
.espace-carte h1, .espace-carte h2 { font-family: var(--font-display); font-weight: var(--w-med);
  font-size: var(--fs-h3); color: var(--ink); margin-bottom: var(--space-4); }
.espace-carte p { color: var(--ink-soft); font-size: var(--fs-sm); line-height: 1.6; }

.espace-form { margin-top: var(--space-5); display: grid; gap: var(--space-4); max-width: 420px; }
.espace-form-large { max-width: none; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.espace-form .field { display: grid; gap: .35rem; }
.espace-form label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: var(--w-med); }
.espace-form input, .espace-form select { width: 100%; min-height: 46px;
  padding: .7em .9em; font: inherit; color: var(--ink); background: var(--cream);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.espace-form input:focus-visible, .espace-form select:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; }

.espace-erreur, .espace-succes { padding: .8em 1em; border-radius: var(--r-sm);
  font-size: var(--fs-sm); margin-bottom: var(--space-4); }
.espace-erreur { background: #F4DCD6; color: var(--brand-deep); }
.espace-succes { background: #E2E6DA; color: var(--brand-deep); }

.espace-revele { border-color: var(--brand); background: var(--brand-tint); }
.espace-mdp { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: .06em; color: var(--brand-dark); font-variant-numeric: tabular-nums;
  margin: var(--space-3) 0; }
.espace-note { font-size: .8rem; color: var(--ink-faint); }
.espace-modele { width: 100%; margin-top: .4rem; padding: .8em; font: inherit; font-size: .85rem;
  line-height: 1.5; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); resize: vertical; }

.espace-liste { display: grid; gap: var(--space-4); }
.espace-ligne { display: flex; flex-wrap: wrap; gap: var(--space-4);
  align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: var(--space-5); }
.espace-ligne h3 { font-family: var(--font-display); font-weight: var(--w-med);
  font-size: 1.35rem; color: var(--ink); }
.espace-meta { font-size: .8rem; color: var(--ink-faint); margin-top: .2rem; }
.espace-compteurs { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .5rem; }
.espace-compteurs span { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.espace-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.espace-actions .btn { padding: .55em 1.1em; font-size: .75rem; }
.btn-danger { background: transparent; color: var(--brand-deep); border: 1px solid #D8B5A8; }
.btn-danger:hover { background: #F4DCD6; }

.espace-vide { text-align: center; color: var(--ink-faint); font-style: italic;
  padding: var(--space-7) 0; }

@media (max-width: 560px) {
  .espace-ligne { flex-direction: column; align-items: flex-start; }
  .espace-actions { width: 100%; }
  .espace-actions form, .espace-actions .btn { width: 100%; }
}

/* Afficher / masquer un mot de passe */
.champ-mdp { position: relative; }
.champ-mdp input { padding-right: 3rem; }
.bascule-mdp { position: absolute; right: 1px; bottom: 1px; width: 44px; height: 44px;
  display: grid; place-items: center; background: transparent; border: 0;
  color: var(--ink-faint); cursor: pointer; border-radius: var(--r-sm);
  transition: color var(--t-fast); }
.bascule-mdp svg { width: 20px; height: 20px; }
.bascule-mdp:hover { color: var(--brand); }
.bascule-mdp:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* Dépôt de photos */
.depot-zone { margin-top: var(--space-5); padding: var(--space-6);
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-md);
  background: var(--cream); text-align: center; transition: border-color var(--t-fast), background var(--t-fast); }
.depot-zone.survol { border-color: var(--brand); background: var(--brand-tint); }
.depot-champ { position: absolute; left: -9999px; width: 1px; height: 1px; }
.depot-etiquette { display: grid; gap: .6rem; justify-items: center; cursor: pointer; }
.depot-champ:focus-visible + .depot-etiquette .btn { outline: 2px solid var(--brand); outline-offset: 3px; }
.depot-aide { font-size: .8rem; color: var(--ink-faint); }
.depot-etat { margin-top: var(--space-4); font-size: .85rem; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; min-height: 1.2em; }
.depot-etat.depot-succes { color: var(--brand-dark); font-weight: var(--w-med); }
.depot-etat.depot-echec { color: var(--brand-deep); }

.depot-grille { margin-top: var(--space-5); display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.depot-vignette { position: relative; background: var(--cream);
  border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.depot-vignette img { display: block; width: 100%; height: auto; aspect-ratio: 1;
  object-fit: cover; }
.depot-vignette figcaption { padding: .35rem .45rem; font-size: .64rem; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.depot-vignette.est-favori { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.depot-etoile { position: absolute; top: .3rem; left: .3rem; background: var(--sage);
  color: var(--ink); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: var(--w-med); padding: .25em .5em; border-radius: var(--r-pill); }
.depot-retirer { position: absolute; top: .3rem; right: .3rem; }
.depot-retirer button { width: 26px; height: 26px; display: grid; place-items: center;
  font-size: 1rem; line-height: 1; color: var(--surface); background: rgba(43,39,36,.68);
  border: 0; border-radius: 50%; cursor: pointer; transition: background var(--t-fast); }
.depot-retirer button:hover { background: var(--brand-deep); }
.depot-retirer button:focus-visible { outline: 2px solid var(--surface); outline-offset: 1px; }

/* Galerie du client */
.client-grille { margin-top: var(--space-5); display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
@media (min-width: 620px) {
  .client-grille { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
}
.client-photo { position: relative; border-radius: var(--r-sm); overflow: hidden;
  background: var(--cream); border: 1px solid var(--line);
  transition: box-shadow var(--t-fast), border-color var(--t-fast); }
.client-photo img { display: block; width: 100%; height: auto; aspect-ratio: 1;
  object-fit: cover; transition: transform var(--t-slow); }
.client-voir { display: block; }
.client-numero { position: absolute; top: .45rem; left: .45rem; min-width: 1.55rem; padding: .15em .35em;
  font-size: .7rem; font-weight: var(--w-med); font-variant-numeric: tabular-nums; text-align: center;
  color: var(--surface); background: rgba(43,39,36,.6); border-radius: var(--r-sm); }
.client-voir:hover img { transform: scale(1.04); }
.client-photo.choisie { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }

/* Le choix se marque d'une coche, pas d'un bandeau : la photo reste le sujet. */
.client-choix { position: absolute; top: .45rem; right: .45rem; width: 38px; height: 38px;
  display: grid; place-items: center; padding: 0; background: rgba(43,39,36,.42);
  border: 1.5px solid rgba(246,240,231,.85); border-radius: 50%; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast); }
.client-choix:hover { background: rgba(43,39,36,.62); }
.client-coche { width: 14px; height: 8px; border-left: 2px solid var(--cream);
  border-bottom: 2px solid var(--cream); transform: rotate(-45deg) translate(1px, -2px); }
.client-photo.choisie .client-choix { background: var(--brand); border-color: var(--brand);
  transform: scale(1.06); }
.client-choix:focus-visible, .client-voir:focus-visible { outline: 2px solid var(--brand);
  outline-offset: 2px; }
.client-choix-echec { background: #B4654A !important; }

.client-bilan { margin-top: var(--space-4); display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-4) var(--space-5); }
.client-compteur { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.client-compteur strong { font-family: var(--font-display); font-size: 1.4rem;
  color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.client-livraison { margin: 0; }
.client-livraison:not([hidden]) { display: block; }
.client-aide { margin-top: var(--space-4); }

/* Papier de fête, posé le temps de l'animation puis retiré */
.client-confetti { position: fixed; z-index: 400; width: 9px; height: 13px; border-radius: 1px;
  pointer-events: none; will-change: transform; }

/* Visionneuse */
.client-visionneuse { position: fixed; inset: 0; z-index: 300; place-items: center;
  padding: var(--space-5); background: rgba(43,39,36,.93); }
/* Le « display » ne vaut qu'ouverte : posé sans condition, il masquerait
   l'attribut « hidden » et le voile resterait affiché en permanence. */
.client-visionneuse:not([hidden]) { display: grid; }
.client-visionneuse img { max-width: 100%; max-height: 90vh; width: auto; height: auto;
  border-radius: var(--r-sm); }
.client-fermer { position: absolute; top: var(--space-4); right: var(--space-4);
  width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.8rem; line-height: 1;
  color: var(--cream); background: transparent; border: 0; cursor: pointer; }
.client-precedente, .client-suivante { position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 64px; display: grid; place-items: center; font-size: 2.4rem; line-height: 1;
  color: var(--cream); background: rgba(43,39,36,.45); border: 0; border-radius: var(--r-sm);
  cursor: pointer; }
.client-precedente { left: var(--space-4); }
.client-suivante { right: var(--space-4); }
.client-precedente[disabled], .client-suivante[disabled] { opacity: .25; cursor: default; }
.client-legende { position: absolute; left: 0; right: 0; bottom: calc(var(--space-4) + 2.4rem);
  margin: 0; font-size: .8rem; letter-spacing: .08em; text-align: center; color: var(--cream); }
.client-pleine { position: absolute; left: 50%; bottom: var(--space-4); transform: translateX(-50%);
  padding: .5em 1.1em; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: var(--w-med); color: var(--cream); text-decoration: none;
  border: 1px solid rgba(246,240,231,.45); border-radius: var(--r-pill); }
.client-pleine:hover { background: rgba(246,240,231,.14); }
.client-pleine:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
.client-fermer:focus-visible, .client-precedente:focus-visible,
.client-suivante:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .client-voir:hover img { transform: none; }
}

/* Accès du client, côté back-office */
.espace-acces { flex: 1 1 260px; padding: var(--space-4); background: var(--cream);
  border: 1px solid var(--line); border-radius: var(--r-sm); }
.espace-lien { font-size: .85rem; color: var(--ink-soft); margin: .25rem 0 .6rem; }
.espace-lien a { color: var(--brand-dark); text-decoration: underline; }
.espace-lien strong { font-variant-numeric: tabular-nums; letter-spacing: .12em;
  color: var(--brand-dark); }
.espace-envoi { display: flex; flex-wrap: wrap; gap: .4rem; }
.espace-envoi input { flex: 1 1 150px; min-height: 40px; padding: .5em .7em; font: inherit;
  font-size: .85rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.espace-envoi input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.espace-envoi .btn { padding: .5em 1em; font-size: .72rem; }
.espace-visuellement-cache { position: absolute !important; left: -9999px; width: 1px; height: 1px; }

/* Page de vérification des e-mails */
.espace-releve { display: grid; grid-template-columns: auto 1fr; gap: .3rem var(--space-4);
  margin: 0; font-size: .85rem; }
.espace-releve dt { color: var(--ink-faint); }
.espace-releve dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.espace-journal { margin: 0; padding: 0; list-style: none; font-size: .8rem;
  color: var(--ink-soft); }
.espace-journal li { padding: .35rem 0; border-top: 1px solid var(--line);
  overflow-wrap: anywhere; }
.espace-journal li:first-child { border-top: 0; }
.espace-dialogue { margin-top: .3rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .74rem; }
.espace-hors-ligne { margin: 0 0 var(--space-4); padding: .7em 1em; font-size: .85rem;
  color: var(--ink); background: #F6E7C8; border: 1px solid #D9B877;
  border-radius: var(--r-sm); }
.espace-hors-ligne a { color: var(--brand-deep); }
.espace-porte { margin: var(--space-4) 0 0; padding-top: var(--space-4); font-size: .8rem;
  color: var(--ink-faint); border-top: 1px solid var(--line); }
.espace-porte a { color: var(--brand-dark); text-decoration: underline; }

/* Mots laissés par les clients */
.espace-alerte { margin: .4rem 0 0; font-size: .8rem; font-weight: var(--w-med);
  color: var(--brand-deep); }
.espace-alerte a { color: inherit; }
.espace-mot { margin: 0 0 var(--space-4); padding: var(--space-4); background: var(--cream);
  border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--r-sm); }
.espace-mot:last-of-type { margin-bottom: 0; }
.espace-mot.non-lu { border-left-color: var(--brand-deep); background: #FBF5EA; }
.espace-mot p { margin: .3rem 0 0; white-space: pre-wrap; }
.espace-mot time { font-size: .78rem; color: var(--ink-faint); }
.espace-terme { font-weight: var(--w-med); color: #B4654A; }
.client-quota { color: var(--ink-faint); }
.client-plein { flex-basis: 100%; margin: 0; font-size: .85rem; color: #B4654A; }
.client-grille.complete .client-photo:not(.choisie) .client-choix { opacity: .35; }

/* Validation de la sélection */
.client-valide { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--brand-deep); }
.client-photo.acquise .client-choix { cursor: default; }
.client-acquise { position: absolute; left: .45rem; bottom: .45rem; padding: .2em .5em;
  font-size: .65rem; letter-spacing: .08em; text-transform: uppercase;
  font-weight: var(--w-med); color: var(--surface); background: var(--brand-deep);
  border-radius: var(--r-sm); }
.client-confirmation { max-width: 32rem; padding: var(--space-5); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.client-confirmation::backdrop { background: rgba(43,39,36,.6); }
.client-confirmation h2 { margin-top: 0; }
.client-confirmation p { font-size: .9rem; }
.client-avertit { padding: .7em .9em; background: var(--cream);
  border-left: 3px solid #B4654A; border-radius: var(--r-sm); }
.client-confirmation-actions { display: flex; flex-wrap: wrap; gap: var(--space-4);
  margin-top: var(--space-4); }
.espace-bascule { display: flex; align-items: center; gap: .5rem; margin-bottom: var(--space-4);
  font-size: .9rem; }
.espace-bascule input { width: 20px; height: 20px; accent-color: var(--brand); }

.espace-formule { margin: .4rem 0 0; font-size: .82rem; color: var(--ink-soft); }
.espace-formule strong { color: var(--brand-deep); }
.espace-formule a { color: var(--brand-dark); text-decoration: underline; }
.espace-choix { margin: 0 0 var(--space-4); padding: 0; border: 0; }
.espace-choix legend { padding: 0 0 .5rem; font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint); }
.espace-choix label { display: flex; align-items: center; gap: .55rem; padding: .3rem 0;
  font-size: .95rem; cursor: pointer; }
.espace-choix input[type="radio"] { width: 20px; height: 20px; accent-color: var(--brand); }
.espace-choix input[type="number"] { width: 5.5rem; min-height: 40px; margin: 0 .3rem;
  padding: .3em .5em; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
