/* ATHARAN Fidélité
   Espace des commerçants : thème clair (papier, encre, ocre).
   Pages du client (classe « nuit ») : fond sombre teinté aux couleurs du commerce. */
@font-face { font-family: 'Marcellus'; src: url('/fonts/marcellus.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Jost'; src: url('/fonts/jost.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --nuit: #f4f2ed;            /* fond de page */
  --panneau: #ffffff;         /* blocs */
  --champ: #ffffff;           /* champs de saisie */
  --sable: #17150f;           /* texte */
  --doux: #6a655b;            /* texte secondaire */
  --trait: rgba(23, 21, 15, .12);
  --ocre: #a8680c;            /* accent (liens, repères) */
  --ocre-vif: #d39a2c;
  --teinte: rgba(211, 154, 44, .14);
  --bouton: #17150f; --sur-bouton: #ffffff;
  --ebene: #1c1a17;
  --vert: #1e7a40; --rouge: #bd3f27;
  --ombre: 0 1px 2px rgba(23, 21, 15, .05), 0 10px 28px rgba(23, 21, 15, .07);
  --ombre-forte: 0 18px 44px rgba(23, 21, 15, .2);
  --f-titre: 'Marcellus', Georgia, serif; --f-texte: 'Jost', 'Segoe UI', system-ui, sans-serif;
  --rayon: 18px;
  color-scheme: light;
}
.nuit {
  --nuit: #26221c; --panneau: rgba(255, 255, 255, .11); --champ: rgba(255, 255, 255, .1);
  --sable: #f7f2e9; --doux: rgba(247, 242, 233, .8); --trait: rgba(255, 255, 255, .2);
  --ocre: #e0a83a; --teinte: rgba(255, 255, 255, .12);
  --bouton: #d39a2c; --sur-bouton: #1c1a17;
  --vert: #8fd19b; --rouge: #f0957f;
  --ombre: 0 14px 34px rgba(0, 0, 0, .3); --ombre-forte: 0 22px 54px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--nuit); color: var(--sable);
  font: 400 16px/1.5 var(--f-texte); -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
h1, h2, h3 { font-family: var(--f-titre); font-weight: 400; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: 1.4rem; }
h3 { font: 600 1.02rem/1.3 var(--f-texte); }
p { margin: 0; }
a { color: var(--ocre); }
img, svg, video { max-width: 100%; }
[hidden] { display: none !important; }
.doux { color: var(--doux); }
.petit { font-size: .86rem; }
.chiffres { font-variant-numeric: tabular-nums; }

/* Mise en page */
.cadre { width: min(1180px, 100% - 32px); margin-inline: auto; }
.etroit { width: min(440px, 100% - 32px); margin-inline: auto; }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--trait); }
.marque { display: flex; align-items: center; gap: 10px; color: var(--sable); text-decoration: none; font-family: var(--f-titre); font-size: 1.12rem; letter-spacing: .04em; min-width: 0; }
.marque img { width: 26px; height: 28px; flex: none; }
.marque span { color: var(--ocre); }
.pile { display: grid; gap: 16px; }
.rangee { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.entre { justify-content: space-between; }

.panneau { background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 22px; box-shadow: var(--ombre); }
.nuit .panneau { box-shadow: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.chiffre { position: relative; background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); display: grid; gap: 4px; }
.chiffre svg { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--teinte); color: var(--ocre); margin-bottom: 6px; }
.chiffre b { display: block; font: 400 2.1rem/1.05 var(--f-titre); color: var(--sable); font-variant-numeric: tabular-nums; }
.chiffre span { color: var(--doux); font-size: .9rem; line-height: 1.3; }
.chiffre.fort { background: var(--ebene); border-color: var(--ebene); }
.chiffre.fort b { color: #f3eee4; } .chiffre.fort span { color: rgba(243, 238, 228, .7); }
.chiffre.fort svg { background: rgba(211, 154, 44, .2); color: var(--ocre-vif); }

/* Formulaires */
label { display: grid; gap: 6px; font-size: .9rem; color: var(--doux); }
input, select, textarea {
  font: inherit; font-size: max(16px, 1rem); color: var(--sable); background: var(--champ); border: 1px solid var(--trait);
  border-radius: 12px; padding: 11px 13px; width: 100%; min-height: 48px; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--sable) 30%, transparent); }
input[type=color] { padding: 4px; height: 48px; cursor: pointer; }
input[type=range] { padding: 0; min-height: 32px; border: 0; background: none; accent-color: var(--ocre); }
textarea { resize: vertical; min-height: 92px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, label:has(input:focus-visible) {
  outline: 2px solid var(--ocre); outline-offset: 2px;
}
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 10px 22px; border-radius: 999px; border: 1px solid var(--bouton); background: var(--bouton); color: var(--sur-bouton);
  font: 600 1rem var(--f-texte); text-decoration: none; cursor: pointer; transition: transform .15s, opacity .15s, background .15s;
}
.bouton:hover { opacity: .9; }
.bouton:active { transform: scale(.97); }
.bouton[disabled] { opacity: .5; cursor: default; }
.bouton.creux { background: transparent; color: var(--sable); border-color: var(--trait); }
.bouton.creux:hover { background: var(--teinte); opacity: 1; }
.bouton.mini { min-height: 38px; padding: 6px 15px; font-size: .88rem; }
.bouton.large { width: 100%; }
.bouton.danger { background: transparent; border-color: color-mix(in srgb, var(--rouge) 45%, transparent); color: var(--rouge); }
.bouton svg { width: 20px; height: 20px; flex: none; }
.champs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.alerte { border-radius: 12px; padding: 11px 14px; font-size: .93rem; background: color-mix(in srgb, var(--rouge) 10%, transparent); color: var(--rouge); border: 1px solid color-mix(in srgb, var(--rouge) 28%, transparent); }
.alerte.ok { background: color-mix(in srgb, var(--vert) 11%, transparent); color: var(--vert); border-color: color-mix(in srgb, var(--vert) 30%, transparent); }

/* Onglets */
.onglets { display: flex; gap: 4px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglets button {
  flex: none; font: 500 .96rem var(--f-texte); color: var(--doux); background: none; border: 1px solid transparent;
  border-radius: 999px; padding: 8px 16px; min-height: 42px; cursor: pointer; transition: background .15s, color .15s;
}
.onglets button:hover { color: var(--sable); background: var(--teinte); }
.onglets button[aria-selected=true] { color: #f3eee4; background: var(--ebene); border-color: var(--ebene); }

/* Tableaux */
.table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.table th { text-align: left; font-weight: 600; color: var(--doux); font-size: .76rem; letter-spacing: .07em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--trait); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.defile { overflow-x: auto; }
.pastille { display: inline-block; font-size: .78rem; font-weight: 500; padding: 3px 11px; border-radius: 999px; background: color-mix(in srgb, var(--sable) 7%, transparent); color: var(--doux); white-space: nowrap; }
.pastille.ok { color: var(--vert); background: color-mix(in srgb, var(--vert) 12%, transparent); }
.pastille.or { color: var(--ocre); background: var(--teinte); }
.pastille.non { color: var(--rouge); background: color-mix(in srgb, var(--rouge) 11%, transparent); }
.vide { text-align: center; color: var(--doux); padding: 28px 12px; }

/* Scanner */
.viseur { position: relative; aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: #000; box-shadow: var(--ombre-forte); }
.viseur video { width: 100%; height: 100%; object-fit: cover; }
.viseur::after { content: ''; position: absolute; inset: 16%; border: 3px solid var(--ocre-vif); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.fiche-prenom { font: 400 2rem/1.1 var(--f-titre); }
.compteur { display: flex; align-items: center; justify-content: center; gap: 18px; }
.compteur button { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--trait); background: var(--nuit); color: var(--sable); font-size: 1.5rem; cursor: pointer; }
.compteur b { font: 400 2.5rem/1 var(--f-titre); min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.succes { text-align: center; padding: 28px 16px; }
.succes .rond { width: 84px; height: 84px; border-radius: 50%; background: var(--vert); color: #fff; display: grid; place-items: center; margin: 0 auto 14px; animation: tampon .5s cubic-bezier(.3, 1.6, .5, 1); }
.succes .rond svg { width: 44px; height: 44px; }
@keyframes tampon { from { transform: scale(.3); } }

/* Accueil du site */
.hero { display: grid; gap: 34px; align-items: center; padding: 48px 0 40px; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.1fr .9fr; padding: 80px 0 64px; } }
.hero .cb { max-width: 420px; margin-inline: auto; width: 100%; transform: rotate(-3deg); }
.surtitre { color: var(--ocre); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.points { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); padding: 0; margin: 0; list-style: none; }
.points li { background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 20px; box-shadow: var(--ombre); }
.points h3 { margin-bottom: 6px; }
.pied { border-top: 1px solid var(--trait); padding: 22px 0 32px; margin-top: 56px; color: var(--doux); font-size: .88rem; }

/* Affiche à imprimer */
.affiche { background: #fff; color: #1c1a17; border: 1px solid var(--trait); border-radius: var(--rayon); padding: 28px 22px; text-align: center; max-width: 380px; margin-inline: auto; box-shadow: var(--ombre); }
.affiche h3 { font: 400 1.5rem/1.15 var(--f-titre); margin-bottom: 4px; }
.affiche .qr { width: 220px; height: 220px; margin: 16px auto; }
.affiche .qr svg { width: 100%; height: 100%; }
@media print {
  body * { visibility: hidden; }
  .affiche, .affiche * { visibility: visible; }
  .affiche { position: fixed; inset: 0; max-width: none; border: 0; border-radius: 0; box-shadow: none; display: grid; place-content: center; }
  .affiche .qr { width: 110mm; height: 110mm; }
  .affiche h3 { font-size: 30pt; }
  .affiche p { font-size: 15pt; }
}

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: #17150f; color: #f3eee4; padding: 11px 20px; border-radius: 999px; font-weight: 500; z-index: 60;
  transition: opacity .25s, transform .25s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--ombre-forte);
}
.nuit .toast { background: #f3eee4; color: #17150f; }
.toast.vu { opacity: 1; transform: translate(-50%, 0); }

.intro { color: var(--doux); max-width: 62ch; }
.etape { display: flex; align-items: center; gap: 10px; }
.etape i { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 600; font-size: .9rem; background: var(--ebene); color: #f3eee4; }
.etape h2 { font-size: 1.25rem; }
.demarrage { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: d; }
.demarrage li { counter-increment: d; display: grid; grid-template-columns: 30px 1fr; gap: 4px 12px; align-items: start; }
.demarrage li::before { content: counter(d); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .9rem; background: var(--teinte); color: var(--ocre); }
.demarrage b { font-weight: 600; color: var(--sable); display: block; }
.demarrage span { color: var(--doux); grid-column: 2; }
.demarrage button, .demarrage a.bouton { grid-column: 2; justify-self: start; margin-top: 4px; }

/* ----- Barre du bas (téléphone) ----- */
.barre {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--panneau) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--trait); padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
}
.nuit .barre { background: rgba(38, 34, 28, .82); }
.barre > * {
  flex: 1 1 0; min-width: 0; min-height: 54px; display: grid; justify-items: center; align-content: center; gap: 3px;
  background: none; border: 0; color: var(--doux); font: 500 .72rem var(--f-texte); text-decoration: none; cursor: pointer; border-radius: 12px;
}
.barre svg { width: 24px; height: 24px; }
.barre [aria-selected=true] { color: var(--ocre); }
.barre .central span.rond { width: 50px; height: 50px; margin-top: -22px; border-radius: 50%; background: var(--bouton); color: var(--sur-bouton); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(23, 21, 15, .3); }
.barre .central b { color: var(--sable); font-weight: 500; }
.avec-barre { padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }

.ligne {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; text-decoration: none; cursor: pointer;
  background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 13px 15px; min-height: 60px;
  color: var(--sable); font: inherit; box-shadow: var(--ombre);
}
.nuit .ligne { box-shadow: none; }
.ligne > svg:first-child { width: 24px; height: 24px; flex: none; color: var(--ocre); }
.ligne > span { flex: 1; min-width: 0; }
.ligne b { display: block; font-weight: 500; }
.ligne small { color: var(--doux); font-size: .86rem; }
.ligne > svg:last-child { flex: none; opacity: .55; }
.rond-action { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; cursor: pointer; background: var(--panneau); border: 1px solid var(--trait); color: var(--sable); }
.rond-action svg { width: 20px; height: 20px; }
.rond-action:active { transform: scale(.94); }

/* ===== La carte de fidélité ===== */
.cartes-bancaires { display: grid; gap: 18px; }
.cb {
  --c-fond: #1c1a17; --c-texte: #ebe3d5; --c-accent: #d39a2c;
  container-type: inline-size; position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 8px;
  width: 100%; aspect-ratio: 1.52; padding: clamp(15px, 5vw, 22px); border-radius: clamp(18px, 6vw, 26px); overflow: hidden;
  text-decoration: none; color: var(--c-texte); font-family: var(--f-texte); text-align: left;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c-accent) 50%, transparent), transparent 60%),
    radial-gradient(90% 80% at 0% 100%, color-mix(in srgb, var(--c-accent) 20%, transparent), transparent 65%),
    linear-gradient(145deg, color-mix(in srgb, var(--c-fond) 84%, #fff), var(--c-fond) 55%, color-mix(in srgb, var(--c-fond) 80%, #000));
  box-shadow: 0 20px 44px rgba(0, 0, 0, .34), 0 2px 6px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 0 0 1px rgba(255, 255, 255, .07);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s;
  animation: cb-monte .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 80ms);
}
.cb.bis {
  background:
    radial-gradient(110% 90% at 0% 0%, color-mix(in srgb, var(--c-accent) 44%, transparent), transparent 60%),
    radial-gradient(90% 80% at 100% 100%, color-mix(in srgb, var(--c-accent) 18%, transparent), transparent 65%),
    linear-gradient(215deg, color-mix(in srgb, var(--c-fond) 84%, #fff), var(--c-fond) 55%, color-mix(in srgb, var(--c-fond) 80%, #000));
}
/* Style « uni » : la couleur seule, nette */
.cb.s-uni { background: var(--c-fond); box-shadow: 0 20px 44px rgba(0, 0, 0, .3), 0 2px 6px rgba(0, 0, 0, .16), inset 0 0 0 1px color-mix(in srgb, var(--c-texte) 14%, transparent); }
/* Style « métal » : des reflets brossés */
.cb.s-metal {
  background:
    linear-gradient(118deg, color-mix(in srgb, var(--c-fond) 72%, #fff) 0%, var(--c-fond) 22%, color-mix(in srgb, var(--c-fond) 80%, #fff) 44%,
      color-mix(in srgb, var(--c-fond) 88%, #000) 62%, color-mix(in srgb, var(--c-fond) 76%, #fff) 82%, color-mix(in srgb, var(--c-fond) 78%, #000) 100%);
}
/* Avec la photo du commerce : la photo en fond, voilée par la couleur de la carte pour que le texte reste lisible */
.cb.avec-photo {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--c-fond) var(--v-haut, 36%), transparent), color-mix(in srgb, var(--c-fond) var(--v-bas, 78%), transparent)),
    var(--photo) center / cover no-repeat, var(--c-fond);
}
.cb.avec-photo .cb-nom, .cb.avec-photo .cb-pied, .cb.avec-photo .cb-compte { text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
/* Reflet qui traverse la carte */
.cb::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .14) 48%, transparent 60%); transform: translateX(-70%); transition: transform .7s ease; }
.cb:hover::after, .cb:active::after { transform: translateX(70%); }
a.cb:hover { transform: translateY(-3px); }
a.cb:active { transform: scale(.975); }

.cb-tete { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cb-logo { width: clamp(34px, 11.5cqw, 48px); aspect-ratio: 1; border-radius: 28%; flex: none; display: grid; place-items: center; overflow: hidden;
  font: 400 clamp(1.1rem, 6cqw, 1.6rem) var(--f-titre); color: var(--c-accent); background: rgba(0, 0, 0, .28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.cb-logo img { width: 100%; height: 100%; object-fit: contain; }
.cb-nom { flex: 1; min-width: 0; font: 400 clamp(.95rem, 5.2cqw, 1.45rem)/1.1 var(--f-titre); letter-spacing: .08em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-compte { flex: none; font: 400 clamp(1.4rem, 8.6cqw, 2.4rem)/.9 var(--f-titre); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-compte small { font-size: .46em; opacity: .72; }

.cb-points { display: grid; grid-template-columns: repeat(var(--col), minmax(0, 1fr)); gap: 2.4cqw; justify-items: center; align-content: center; }
.cb-points i {
  width: min(100%, 11.4cqw); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  border: 1.5px solid color-mix(in srgb, var(--c-texte) 34%, transparent); color: color-mix(in srgb, var(--c-texte) 30%, transparent);
  background: color-mix(in srgb, var(--c-fond) 30%, transparent);
}
.cb-points svg { width: 56%; height: 56%; display: block; }
.cb-points i.plein { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-fond); box-shadow: 0 0 14px color-mix(in srgb, var(--c-accent) 55%, transparent); }
.cb-points i.cadeau:not(.plein) { border-style: dashed; color: color-mix(in srgb, var(--c-accent) 80%, transparent); border-color: color-mix(in srgb, var(--c-accent) 60%, transparent); }
.cb-points i.nouveau { animation: cb-tampon .7s cubic-bezier(.2, 1.6, .4, 1) both; }
.cb-milieu { display: grid; gap: 6px; align-content: center; }
.cb-jauge { height: clamp(10px, 3.6cqw, 16px); border-radius: 99px; background: rgba(0, 0, 0, .32); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.cb-jauge i { display: block; height: 100%; border-radius: 99px; background: var(--c-accent); box-shadow: 0 0 14px color-mix(in srgb, var(--c-accent) 70%, transparent); transition: width .6s; }
.cb-reste { font-size: clamp(.72rem, 3.4cqw, .9rem); opacity: .85; }

.cb-pied { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.cb-titulaire { min-width: 0; display: grid; }
.cb-titulaire small { font-size: clamp(.52rem, 2.4cqw, .66rem); letter-spacing: .14em; text-transform: uppercase; opacity: .68; font-weight: 600; }
.cb-titulaire b { font-weight: 500; font-size: clamp(.86rem, 4.2cqw, 1.08rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-cadeau { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 62%; font-size: clamp(.64rem, 3cqw, .8rem); font-weight: 600; letter-spacing: .03em;
  padding: 5px 10px; border-radius: 99px; background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); text-shadow: none; }
.cb-cadeau span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-cadeau svg { width: 14px; height: 14px; flex: none; color: var(--c-accent); }
.cb-cadeau.pret { background: var(--c-accent); color: var(--c-fond); box-shadow: 0 0 18px color-mix(in srgb, var(--c-accent) 60%, transparent); animation: cb-brille 1.8s ease-in-out infinite; }
.cb-cadeau.pret svg { color: inherit; }
.cb.fantome { animation: cb-pulse 1.2s ease-in-out infinite; box-shadow: none; background: var(--panneau); }
@keyframes cb-monte { from { opacity: 0; transform: translateY(26px) scale(.96); } }
@keyframes cb-pulse { 50% { opacity: .45; } }
@keyframes cb-tampon { from { transform: scale(0) rotate(-40deg); } }
@keyframes cb-brille { 50% { box-shadow: 0 0 4px color-mix(in srgb, var(--c-accent) 40%, transparent); } }
@media (prefers-reduced-motion: reduce) { .cb, .cb-cadeau.pret, .cb-points i.nouveau { animation: none; transition: none; } .cb::after { display: none; } }

/* ===== Écran du client ===== */
.salut { display: flex; align-items: center; gap: 12px; min-width: 0; }
.salut .logo-notif { width: 48px; height: 48px; }
.salut div { min-width: 0; }
.salut h1 { font-size: 1.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.salut p { color: var(--doux); font-size: .92rem; }
.ecran-carte { display: grid; gap: 16px; }
.promesse { text-align: center; color: var(--doux); font-size: .92rem; margin-top: -4px; }
.bloc-code { background: #fff; color: #17150f; border-radius: 24px; padding: 18px; display: grid; gap: 10px; justify-items: center; text-align: center; box-shadow: var(--ombre); }
.bloc-code h2 { font: 600 1.05rem var(--f-texte); }
.bloc-code .qr { width: min(210px, 56vw); aspect-ratio: 1; }
.bloc-code .qr svg { width: 100%; height: 100%; display: block; }
.bloc-code p { font-size: .86rem; color: #5f5a50; max-width: 30ch; }

/* Wallet : boutons et invitation */
.wallet { display: grid; gap: 10px; justify-items: center; text-align: center; }
.wallet-apple {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 10px 20px; border-radius: 14px;
  background: #000; color: #fff; border: 1px solid rgba(255, 255, 255, .28); font: 600 1.05rem var(--f-texte); text-decoration: none; cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35); transition: transform .15s;
}
.wallet-apple:active { transform: scale(.97); }
.wallet-apple svg { width: 28px; height: 28px; flex: none; }
.wallet-ok { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--vert); font-weight: 500; }
.wallet-ok svg { width: 20px; height: 20px; }
.badge-wallet { display: block; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; }
.badge-wallet img { height: 56px; width: auto; max-width: 100%; }
.badge-wallet[disabled] { opacity: .6; }

.feuille { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; background: rgba(0, 0, 0, .62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: feuille-fond .3s both; }
.feuille-corps {
  width: min(480px, 100%); margin-inline: auto; display: grid; gap: 16px; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  background: #17150f; color: #f3eee4; border-radius: 28px 28px 0 0; border: 1px solid rgba(255, 255, 255, .12); border-bottom: 0;
  animation: feuille-monte .45s cubic-bezier(.2, .9, .2, 1) both; max-height: 94dvh; overflow-y: auto;
}
.feuille-corps h2 { font-size: 1.55rem; text-align: center; }
.feuille-corps .cb { max-width: 300px; margin-inline: auto; animation: none; }
.atouts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.atouts li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; color: rgba(243, 238, 228, .86); }
.atouts svg { width: 22px; height: 22px; color: #8fd19b; margin-top: 2px; }
.plus-tard { background: none; border: 0; color: rgba(243, 238, 228, .62); font: inherit; font-size: .92rem; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@keyframes feuille-fond { from { opacity: 0; } }
@keyframes feuille-monte { from { transform: translateY(100%); } }
@media (min-width: 600px) { .feuille { align-items: center; } .feuille-corps { border-radius: 28px; border-bottom: 1px solid rgba(255, 255, 255, .12); } }
@media (prefers-reduced-motion: reduce) { .feuille, .feuille-corps { animation: none; } }

/* Messages du commerce */
.logo-notif { width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center; overflow: hidden; font: 400 1.4rem var(--f-titre); background: var(--ebene); color: var(--ocre-vif); border: 1px solid var(--trait); }
.logo-notif img { width: 100%; height: 100%; object-fit: contain; }
.message { position: relative; display: flex; gap: 12px; align-items: flex-start; background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 40px 14px 14px; animation: cb-monte .4s cubic-bezier(.2, .8, .2, 1) both; }
.message.neuf { border-color: color-mix(in srgb, var(--ocre) 55%, transparent); background: color-mix(in srgb, var(--ocre) 12%, var(--panneau)); }
.message.neuf::before { content: ''; position: absolute; left: -5px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--ocre); }
.message-corps { min-width: 0; flex: 1; display: grid; gap: 3px; }
.message-tete { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--doux); }
.message-tete b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-tete span { flex: none; }
.message h3 { font: 600 1rem var(--f-texte); }
.message p { color: var(--doux); font-size: .95rem; }
.message-fermer { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; background: none; color: var(--doux); font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 50%; }
.message-fermer:hover { color: var(--sable); background: var(--teinte); }
.avec-pastille { position: relative; }
.avec-pastille i { position: absolute; top: -30px; right: -14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #e5533a; color: #fff; font: 700 .7rem/18px var(--f-texte); font-style: normal; text-align: center; }
.reglages summary { cursor: pointer; font-weight: 500; }
.apercu-notif { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 20px; background: #ecebe8; color: #1b1b1b; border: 1px solid var(--trait); box-shadow: var(--ombre); }
.apercu-notif .logo-notif { border: 0; }
.apercu-tete { display: flex; justify-content: space-between; gap: 10px; }
.apercu-tete b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apercu-tete span { flex: none; font-size: .8rem; opacity: .55; }
.apercu-notif p { font-size: .93rem; line-height: 1.35; }
@media (prefers-reduced-motion: reduce) { .message { animation: none; } }

/* ===== Espace du gérant ===== */
.bonjour { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; }
.bonjour h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.duo { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); align-items: start; }
.vitrine { display: grid; gap: 14px; justify-items: center; }
.vitrine .cb { max-width: 400px; animation: none; }

/* Atelier de la carte : l'aperçu reste sous les yeux pendant les réglages */
.atelier { display: grid; gap: 18px; align-items: start; }
.atelier-apercu { display: grid; gap: 10px; justify-items: center; }
.atelier-apercu .cb { max-width: 400px; animation: none; }
.bloc-titre { display: flex; align-items: center; gap: 10px; }
.bloc-titre i { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--teinte); color: var(--ocre); }
.bloc-titre svg { width: 20px; height: 20px; }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.palettes button {
  display: grid; gap: 7px; justify-items: start; padding: 10px; border-radius: 14px; border: 1px solid var(--trait); background: var(--panneau); cursor: pointer;
  font: 500 .8rem var(--f-texte); color: var(--sable); text-align: left; transition: border-color .15s, transform .15s;
}
.palettes button:hover { border-color: var(--sable); }
.palettes button:active { transform: scale(.96); }
.palettes button[aria-pressed=true] { border-color: var(--sable); box-shadow: inset 0 0 0 1px var(--sable); }
.palettes span { display: flex; width: 100%; height: 30px; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.palettes span i { flex: 1; } .palettes span i:first-child { flex: 3; }
.couleurs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.choix.larges { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choix label {
  position: relative; display: grid; gap: 4px; justify-items: center; align-content: center; text-align: center; min-height: 64px; padding: 8px 4px;
  border: 1px solid var(--trait); border-radius: 14px; cursor: pointer; color: var(--sable); font-size: .76rem; background: var(--panneau); transition: border-color .15s, background .15s;
}
.choix label:hover { border-color: var(--sable); }
.choix input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; }
.choix label:has(input:checked) { border-color: var(--sable); background: var(--ebene); color: #f3eee4; }
.choix svg { width: 24px; height: 24px; }
.choix .echantillon { width: 100%; height: 26px; border-radius: 7px; }
.depot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.depot .logo-notif { width: 54px; height: 54px; }
.enregistrer { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px;
  background: var(--ebene); color: #f3eee4; border-radius: 999px; box-shadow: var(--ombre-forte); }
.enregistrer span { font-size: .9rem; opacity: .8; min-width: 0; }
.enregistrer .bouton { background: var(--ocre-vif); border-color: var(--ocre-vif); color: #1c1a17; flex: none; }
.lien-partage { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border: 1px dashed var(--trait); border-radius: 14px; font-size: .9rem; min-width: 0; }
.lien-partage code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; color: var(--doux); }

/* Administration : un commerce par ligne, à ses couleurs */
.pastille-commerce { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; font: 400 1.25rem var(--f-titre); }
.nom-commerce { display: flex; align-items: center; gap: 12px; min-width: 0; }
details.panneau > summary { cursor: pointer; font: 400 1.3rem var(--f-titre); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
details.panneau > summary::-webkit-details-marker { display: none; }
details.panneau > summary::after { content: '+'; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--teinte); color: var(--ocre); font: 400 1.4rem var(--f-texte); }
details.panneau[open] > summary::after { content: '−'; }
details.panneau[open] > summary { margin-bottom: 16px; }
details.reglages > summary::after { display: none; }
details.reglages > summary { font: 500 1rem var(--f-texte); }

@media (min-width: 900px) {
  .espace { display: grid; grid-template-columns: 232px minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .espace > .entete { grid-column: 1 / -1; }
  .espace > .onglets { flex-direction: column; position: sticky; top: 14px; margin-top: 22px; padding: 10px; gap: 4px; overflow: visible;
    background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); }
  .espace > .onglets button { display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 12px; padding: 10px 14px; min-height: 46px; }
  .espace > .onglets svg { width: 20px; height: 20px; flex: none; }
  .espace > main { padding-top: 22px; }
  .espace .barre, .espace [data-vue=plus] { display: none !important; }
}
@media (max-width: 899px) {
  .espace > .onglets { display: none; }
  .espace > main { padding-top: 16px; }
  .espace .entete .bouton { display: none; }
  .enregistrer { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .enregistrer { padding: 6px 6px 6px 16px; }
  .enregistrer span { font-size: .82rem; }
  .enregistrer .bouton { min-height: 42px; padding: 6px 18px; font-size: .94rem; }
}
@media (min-width: 700px) {
  .atelier { grid-template-columns: minmax(260px, 400px) minmax(0, 1fr); gap: 26px; }
  .atelier-apercu { position: sticky; top: 22px; }
}
@media (max-width: 699px) {
  /* Sur téléphone, l'aperçu reste épinglé en haut de l'écran pendant qu'on règle la carte */
  .atelier-apercu { position: sticky; top: 0; z-index: 6; margin-inline: -16px; padding: 10px 16px; background: var(--nuit); border-bottom: 1px solid var(--trait); }
  .atelier-apercu .cb { max-width: min(264px, 72vw); box-shadow: 0 10px 24px rgba(0, 0, 0, .3); }
  .atelier-apercu p { display: none; }
}
@media (max-width: 699px) and (max-height: 640px) { .atelier-apercu { position: static; } }

/* ===== Adaptation aux écrans ===== */
@media (pointer: coarse) {
  .bouton.mini { min-height: 44px; padding: 8px 16px; }
  .compteur button { width: 58px; height: 58px; }
}

/* Téléphone et tablette : les tableaux deviennent des fiches, sans défilement de côté */
@media (max-width: 899px) {
  .panneau.defile { padding: 0; background: none; border: 0; overflow: visible; box-shadow: none; }
  .table, .table tbody { display: block; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table tr { display: grid; gap: 8px; background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--ombre); }
  .table td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 0; border: 0; text-align: right; }
  .table td[data-titre]::before { content: attr(data-titre); flex: none; text-align: left; color: var(--doux); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
  .table td:first-child { font-size: 1.08rem; justify-content: flex-start; text-align: left; }
  .table td:first-child::before { display: none; }
  .table td:empty { display: none; }
  .table td .rangee { justify-content: flex-end; }
  .table td.vide { display: block; text-align: center; }
  .table td.vide::before { display: none; }
  .table td:has(> .bouton), .table td:has(> .rangee) { justify-content: stretch; }
  .table td:has(> .bouton)::before, .table td:has(> .rangee)::before { display: none; }
  .table td > .bouton { width: 100%; }
  .table td > .rangee { width: 100%; }
  .table td > .rangee .bouton { flex: 1; }

  .panneau { padding: 18px; }
  .champs { grid-template-columns: 1fr; }
  .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .chiffre { padding: 14px; }
  .chiffre b { font-size: 1.8rem; }
  .hero { gap: 28px; }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
}

/* Petit téléphone (320 px) */
@media (max-width: 360px) {
  .cadre, .etroit { width: calc(100% - 24px); }
  h1 { font-size: 1.7rem; }
  .barre > * { font-size: .66rem; }
  .entete { flex-wrap: wrap; }
  .couleurs { gap: 6px; }
}

/* Téléphone couché */
@media (orientation: landscape) and (max-height: 500px) {
  .barre > * { min-height: 44px; }
  .viseur { max-height: 62vh; }
  .atelier-apercu { position: static; }
}

/* Tablette et ordinateur : les pages du client s'élargissent */
@media (min-width: 760px) {
  .etroit.large-ecran { width: min(920px, 100% - 48px); }
  .large-ecran .cartes-bancaires { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
  .large-ecran #vueForm { width: min(440px, 100%); margin-inline: auto; }
  /* La barre du bas devient une pastille flottante centrée */
  body > .barre { left: 50%; right: auto; bottom: 20px; transform: translateX(-50%); width: min(420px, 100% - 48px);
    border: 1px solid var(--trait); border-radius: 22px; padding: 6px 8px; box-shadow: var(--ombre-forte); }
  /* Écran de la carte : la carte à gauche, le code et Wallet à droite */
  .large-ecran .ecran-carte { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px 40px; align-items: start; }
  .large-ecran .ecran-carte > .pleine { grid-column: 1 / -1; }
  .large-ecran .ecran-carte .cartes-bancaires { grid-template-columns: 1fr; }
  .large-ecran [data-ecran=infos] { width: min(520px, 100%); margin-inline: auto; }
}
@media (min-width: 1100px) {
  .large-ecran #liste.cartes-bancaires:has(> :nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .etroit.large-ecran:has(#liste.cartes-bancaires > :nth-child(3)) { width: min(1180px, 100% - 64px); }
}

/* Tablette : l'espace du gérant respire, la barre du bas reste à portée de pouce */
@media (min-width: 600px) and (max-width: 899px) {
  .espace .grille { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .espace .barre { left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); width: min(560px, 100% - 40px);
    border: 1px solid var(--trait); border-radius: 22px; box-shadow: var(--ombre-forte); }
  .table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .table tr { margin-bottom: 0; }
  .table tr:has(td.vide) { grid-column: 1 / -1; }
  .champs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 600px) { .viseur { max-width: 460px; margin-inline: auto; } }
/* Petit ordinateur : le tableau des clients garde l'essentiel pour tenir dans la page */
@media (min-width: 900px) {
  [data-vue=clients] .table :is(th, td):nth-child(5),
  [data-vue=clients] .table :is(th, td):nth-child(6) { display: none; }
  .table th, .table td { padding-inline: 8px; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  [data-vue=clients] .table :is(th, td):nth-child(8) { display: none; }
}
@media (min-width: 900px) and (max-width: 1199px) {
  [data-vue=carte] .table td .rangee { flex-direction: column; align-items: stretch; gap: 6px; }
}

@media (min-width: 900px) { .espace #chiffres { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Rien ne force la page à déborder sur le côté */
.grille > *, .duo > *, .pile > *, .atelier > * { min-width: 0; }
