/* Vaiggie Soul · Carte fidélité · Styles (mobile d'abord, 390 px de référence, colonne de 430 px max). */

:root {
  --forest: #427028;
  --forest-2: #4C7730;
  --night: #1F3513;
  --cream: #FDF6F0;
  --pistache: #C9D78C;
  --pistache-2: #B0C455;
  --pink: #F684B7;
  --pink-2: #F29DC4;
  --white: #FFFFFF;

  --font-title: "Titan One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-text: Montserrat, "Helvetica Neue", system-ui, sans-serif;

  --radius-card: 24px;
  --radius-field: 16px;
  --shadow-card: 0 10px 24px rgba(66, 112, 40, .16);
  --shadow-button: 0 8px 18px rgba(66, 112, 40, .30);
  --shadow-on-green: 0 8px 20px rgba(31, 53, 19, .45);
  --gutter: 24px;
  --app-max: 430px;

  --motif-size: 1685px 1688px;
  --motif-x: calc(50% + 421px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-text); font-size: 16px; line-height: 1.4; color: var(--forest);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { flex-shrink: 0; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ------------------------------------------------------------------ fonds et motif */
.tone-cream    { background: #FDF6F0; --motif-fg: #427028; --motif-op: .055; color: var(--forest); }
.tone-forest   { background: #427028; --motif-fg: #4C7730; --motif-op: 1; color: var(--cream); }
.tone-night    { background: #1F3513; --motif-fg: #427028; --motif-op: .2; color: var(--cream); }

.vs-motif {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-color: var(--motif-fg); opacity: var(--motif-op);
  -webkit-mask-image: url("/assets/img/motif-fleurs-tuile-miroir.svg"); mask-image: url("/assets/img/motif-fleurs-tuile-miroir.svg");
  -webkit-mask-size: var(--motif-size); mask-size: var(--motif-size);
  -webkit-mask-position: var(--motif-x) top; mask-position: var(--motif-x) top;
  -webkit-mask-repeat: repeat; mask-repeat: repeat;
}
.vs-motif--local { position: absolute; }
.vs-motif--small { --motif-size: 1180px 1182px; --motif-x: calc(50% + 295px); }

/* ------------------------------------------------------------------ mise en page */
.app {
  position: relative; z-index: 1; width: 100%; max-width: var(--app-max); margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: 16px var(--gutter) calc(32px + env(safe-area-inset-bottom));
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-16 { display: flex; flex-direction: column; gap: 16px; }
.stack-20 { display: flex; flex-direction: column; gap: 20px; }
.center-page { align-items: center; text-align: center; justify-content: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.logo-pic { display: contents; } /* l'image reste l'élément mis en page */
.logo-pic source { display: none; } /* sinon <source> devient un élément vide de la ligne et décale le logo */
.logo { width: auto; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(31, 53, 19, .35)); }
.logo--48 { height: 48px; }
.logo--56 { height: 56px; }
.logo--96 { height: 96px; }
.logo--120 { height: 120px; filter: drop-shadow(0 3px 6px rgba(31, 53, 19, .35)); }

.h1 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 28px; line-height: 1.05; text-transform: uppercase; overflow-wrap: anywhere; }
.h1--32 { font-size: 32px; }
.h1--40 { font-size: 40px; line-height: 1; }
.h1--44 { font-size: 44px; line-height: 1; }
.lead { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; }
.p { margin: 0; font-size: 16px; line-height: 1.45; }
.strong { font-weight: 600; }
.title-num { font-family: var(--font-title); font-weight: 400; line-height: 1; white-space: nowrap; }

.eyebrow { display: flex; flex-direction: column; gap: 8px; }
.eyebrow::before { content: ""; width: 40px; height: 3px; border-radius: 2px; background: currentColor; }
.eyebrow > * , .eyebrow { font-size: 16px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin: 0; }
.caps { font-size: 16px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }

/* ------------------------------------------------------------------ boutons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 24px; border: 0; border-radius: 999px;
  background: var(--forest); color: var(--cream); font-size: 18px; font-weight: 600; line-height: 1.2;
  text-align: center; text-decoration: none; box-shadow: var(--shadow-button);
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn--outline { background: transparent; color: var(--forest); border: 2px solid var(--forest); box-shadow: none; }
.btn:disabled {
  background: rgba(66, 112, 40, .08); color: rgba(66, 112, 40, .45);
  border: 2px solid rgba(66, 112, 40, .18); box-shadow: none; cursor: not-allowed;
}
.btn--self-start { align-self: flex-start; }
.pill-action {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 12px;
  border-radius: 999px; border: 2px solid var(--forest); color: var(--forest);
  text-decoration: none; font-size: 16px; font-weight: 600; background: transparent;
}
.link {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  color: inherit; font-size: 16px; font-weight: 600; text-decoration: underline; background: none; border: 0;
}
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-right: 12px;
  color: inherit; text-decoration: none; font-size: 16px; font-weight: 600;
}

/* ------------------------------------------------------------------ champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 16px; font-weight: 600; }
.input {
  width: 100%; height: 56px; padding: 0 18px; border-radius: var(--radius-field);
  border: 2px solid var(--forest); background: var(--cream); color: var(--forest); font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: rgba(66, 112, 40, .55); opacity: 1; }
.input--code { font-size: 20px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.input--code::placeholder { letter-spacing: .14em; }
.input[aria-invalid="true"], .input-wrap[aria-invalid="true"] { border: 3px solid var(--pink); }
.input-wrap {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 0 0 18px;
  border-radius: var(--radius-field); border: 2px solid var(--forest); background: var(--cream);
}
.input-wrap input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; color: var(--forest); font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; }
.input-wrap input::placeholder { color: rgba(66, 112, 40, .55); opacity: 1; }
.input-wrap:focus-within { outline: 3px solid var(--pink); outline-offset: 2px; }
.input-wrap--search { padding-right: 18px; }
.input-wrap--white { background: var(--white); }
.help { display: flex; align-items: flex-start; gap: 8px; font-size: 16px; line-height: 1.4; }
.help .ico { margin-top: 2px; }

/* ------------------------------------------------------------------ encarts */
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; border-radius: 16px;
  background: var(--pink-2); color: var(--night); font-size: 16px; line-height: 1.4;
}
.alert strong, .note strong { font-weight: 600; }
a.alert { text-decoration: none; }
.note {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; border-radius: 16px;
  background: var(--pistache); color: var(--night); font-size: 16px; line-height: 1.4;
}
.note--center { align-items: center; }
.card {
  background: var(--cream); border-radius: var(--radius-card); box-shadow: var(--shadow-card); color: var(--forest);
}

/* ------------------------------------------------------------------ MC1 · créer ma carte */
.mc1-head {
  position: relative; height: 188px; margin: -16px calc(-1 * var(--gutter)) 0;
  border-radius: 0 0 32px 32px; overflow: hidden; background: var(--pistache);
  --motif-fg: #B0C455; --motif-op: .4;
}
.mc1-head .logo { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); }
.mc1-badge { position: absolute; top: 8px; left: 10px; width: 80px; height: 80px; transform: rotate(-12deg); filter: drop-shadow(0 4px 6px rgba(66, 112, 40, .25)); color: var(--night); }
.mc1-badge svg { position: absolute; inset: 0; }
.mc1-badge span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--font-title); font-size: 16px; line-height: 1; text-transform: uppercase; }
.mc1-butterfly { position: absolute; top: 14px; right: 16px; width: 56px; height: 56px; transform: rotate(14deg); filter: drop-shadow(0 3px 4px rgba(66, 112, 40, .28)); }
.mc1-hello {
  position: absolute; top: 76px; left: 0; right: 0; margin: 0;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-title); font-weight: 400; font-size: 32px; line-height: 1; text-transform: uppercase;
}
.mc1-hello span { color: var(--forest); text-shadow: 3px 3px 0 var(--cream); }
.mc1-hello span:nth-child(2) { color: var(--cream); text-shadow: 3px 3px 0 var(--forest); }
.mc1-body { padding-top: 22px; }
.tier-pills { display: flex; flex-direction: column; gap: 8px; }
.tier-pill {
  display: flex; align-items: center; gap: 12px; padding: 6px 20px 6px 6px; border-radius: 999px;
  background: var(--cream); box-shadow: 0 6px 14px rgba(66, 112, 40, .16);
}
.tier-pill .dot { width: 40px; height: 40px; }
.tier-pill .title-num { font-size: 20px; }
.tier-pill .name { font-size: 16px; font-weight: 600; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.dot {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%;
  background: var(--pistache); color: var(--night);
}
/* Paliers : dégradé de valeur, du pistache (plus petit) au rose (plus gros). */
.dot--tier { --tone: 0; background: var(--pistache); background: color-mix(in oklch, var(--pink) calc(var(--tone) * 100%), var(--pistache)); }
.dot--pinkstrong { background: var(--pink); }

/* ------------------------------------------------------------------ MC2 · ma carte */
.qr-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 24px 20px;
  border-radius: var(--radius-card); background: var(--white); box-shadow: 0 10px 24px rgba(66, 112, 40, .18);
  color: var(--forest); text-decoration: none;
}
.qr-card .qr { width: 184px; height: 184px; }
.qr-card .qr svg { width: 100%; height: 100%; }
.code-big { font-size: 22px; font-weight: 600; letter-spacing: .18em; }
.balance-card { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 16px; }
.balance-card .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.balance-card .title-num { font-size: 40px; }
.phrase { font-size: 16px; font-weight: 600; line-height: 1.4; }

.gauge-pip {
  position: absolute; width: 32px; height: 32px; border-radius: 50%;
  background: var(--cream); border: 2px solid var(--forest); color: var(--forest);
  display: flex; align-items: center; justify-content: center;
}
.gauge { padding-top: 4px; }
.vgauge { position: relative; list-style: none; margin: 0; padding: 18px 0 0; }
/* Les traits passent 4 px sous les ronds (au premier plan) : aucun jour entre un trait et un rond. */
.vgauge::before, .vgauge::after { content: ""; position: absolute; left: 12px; top: 0; width: 8px; height: 22px; border-radius: 4px 4px 0 0; }
.vgauge::before { background: var(--pistache-2); }
.vgauge::after { height: calc(22px * var(--lead)); background: var(--pink); }
.vstep { position: relative; display: flex; align-items: baseline; gap: 12px; min-height: 56px; padding: 5px 0 0 46px; font-size: 16px; line-height: 1.3; }
.vstep .gauge-pip { top: 0; left: 0; }
/* Trait entre deux paliers : fond pistache, rempli en rose selon --fill. */
.vstep:not(.is-last)::before, .vstep:not(.is-last)::after {
  content: ""; position: absolute; left: 12px; top: 28px; bottom: -4px; width: 8px;
}
.vstep:not(.is-last)::before { background: var(--pistache-2); }
.vstep:not(.is-last)::after { bottom: auto; height: calc(4px + (100% - 28px) * var(--fill)); background: var(--pink); }
.vstep .pts { flex-shrink: 0; min-width: 60px; font-weight: 600; }
.vstep .name { min-width: 0; overflow-wrap: anywhere; }
/* Anneau vert clair autour de chaque cadeau à venir ; un cadeau atteint est plein, en rose. */
.vstep .gauge-pip { z-index: 1; box-shadow: 0 0 0 4px var(--pistache-2); }
.vstep.is-on .gauge-pip { background: var(--pink); border-color: var(--pink); color: var(--night); box-shadow: none; }
/* Après le dernier palier affiché : trois tirets qui s'effacent, la suite continue. */
.vstep.is-last { min-height: 66px; }
/* Le premier tiret part de sous l'anneau du cadeau : la suite sort de lui. */
.vtail { position: absolute; z-index: 0; left: 12px; top: 28px; display: flex; flex-direction: column; gap: 4px; }
.vtail i { width: 8px; height: 6px; border-radius: 2px; background: var(--pistache-2); }
.vtail i:first-child { height: 16px; border-radius: 0 0 2px 2px; }
.vtail i:nth-child(2) { opacity: .55; }
.vtail i:nth-child(3) { opacity: .25; }
.vgauge--all .vstep.is-last { min-height: 32px; }
.vgauge-more {
  align-self: flex-start; margin: 0 0 0 46px; padding: 6px 0; border: 0; background: none; color: var(--forest);
  font: inherit; font-size: 16px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.tip { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 20px; background: var(--pistache); color: var(--night); font-size: 16px; line-height: 1.35; }
.tip--pink { background: var(--pink); }
.tip strong { font-weight: 600; }
.history-section { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.empty-box { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 20px; border: 2px dashed var(--forest); font-size: 16px; line-height: 1.4; }
.totals { display: flex; gap: 12px; }
.total { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 20px; background: var(--pistache); color: var(--night); }
.total--pink { background: var(--pink); }
.total .lbl { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; }
.total .title-num { font-size: 28px; }
.hist { padding: 0 16px; }
.hist-row { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px 4px; border-bottom: 2px solid var(--pistache); }
.hist-row:last-child { border-bottom: 0; }
.hist-row .dot { width: 44px; height: 44px; border: 2px solid var(--pistache); }
.hist-row .dot--pinkstrong { border-color: var(--pink); }
.hist-row .dot--dashed { background: transparent; border: 2px dashed var(--forest); color: var(--forest); }
.hist-row .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.hist-row .lbl { font-size: 16px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.hist-row .date { font-size: 16px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-row .title-num { font-size: 20px; }
.hist-row.is-cancelled .title-num, .hist-row.is-cancelled .lbl { text-decoration: line-through; opacity: .55; }
.created { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600; }
.loader { text-align: center; padding: 12px; font-size: 16px; }

.toast-fade { position: fixed; left: 0; right: 0; bottom: 0; height: 170px; z-index: 5; pointer-events: none;
  background: linear-gradient(rgba(253, 246, 240, 0) 0%, rgba(253, 246, 240, .94) 42%, #FDF6F0 100%); }
.toast {
  position: fixed; z-index: 6; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  width: calc(min(100vw, var(--app-max)) - 48px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 14px 20px 14px 14px; border: 0; text-align: left;
  border-radius: 24px; background: var(--pink); color: var(--night); box-shadow: 0 12px 28px rgba(31, 53, 19, .35);
  animation: toast-in .35s ease;
}
.toast .bubble { width: 60px; height: 60px; border-radius: 50%; background: var(--cream); color: var(--forest); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-title); font-size: 24px; line-height: 1; }
.toast .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.35; }
.toast .t1 { font-size: 18px; font-weight: 600; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ------------------------------------------------------------------ MC3 · retrouver ma carte */
.mc3 { padding-top: 12px; }
.or { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: rgba(66, 112, 40, .2); }
.sticker-corner { position: fixed; z-index: 0; bottom: 64px; right: max(36px, calc(50% - var(--app-max) / 2 + 36px)); width: 72px; height: 72px; transform: rotate(12deg); filter: drop-shadow(0 3px 4px rgba(66, 112, 40, .28)); pointer-events: none; }
.sent-icon { align-self: center; margin-top: 28px; width: 112px; height: 112px; border-radius: 50%; background: var(--pistache); color: var(--night); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 24px rgba(66, 112, 40, .18); }
.center-text { text-align: center; }

/* ------------------------------------------------------------------ espace pro : commun */
.btn--caisse {
  min-height: 72px; font-size: 20px; gap: 12px; line-height: 1.15;
  background: var(--cream); color: var(--forest); border: 3px solid var(--cream); box-shadow: var(--shadow-on-green);
}
.btn--caisse.is-pink { background: var(--pink); border-color: var(--pink); color: var(--night); }
.btn--caisse:disabled { background: transparent; color: rgba(253, 246, 240, .6); border: 3px dashed rgba(253, 246, 240, .5); box-shadow: none; }
.btn--caisse.is-pink:disabled { color: var(--pink); border-color: var(--pink); }

/* MP1 · code de la caisse */
.mp1 { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 36px var(--gutter) calc(40px + env(safe-area-inset-bottom)); }
.pin-dots { display: flex; gap: 16px; margin-top: 4px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--cream); }
.pin-dots span.is-on { background: var(--cream); }
.pin-msg { margin: 0; min-height: 28px; display: flex; align-items: center; justify-content: center; }
.pin-msg span { padding: 4px 14px; border-radius: 999px; background: var(--pink); color: var(--night); font-size: 16px; font-weight: 600; line-height: 1.3; }
.pin-msg span:empty { display: none; }
.keypad { width: 100%; max-width: 330px; display: grid; grid-template-columns: repeat(3, 96px); justify-content: space-between; row-gap: 12px; margin-top: auto; }
.key {
  width: 96px; height: 68px; border-radius: 999px; border: 2px solid rgba(253, 246, 240, .55);
  background: rgba(31, 53, 19, .18); color: var(--cream); font-family: var(--font-title); font-size: 30px; line-height: 1;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.key:active { background: rgba(31, 53, 19, .35); }
.key--ghost { border: 0; background: transparent; }
.key--ok { border: 2px solid var(--cream); background: transparent; }
.key--ok:disabled { opacity: .45; cursor: default; }
.key--ok:not(:disabled) { background: var(--cream); color: var(--forest); }

/* MP2 · scanner */
.mp2 { position: relative; z-index: 1; max-width: var(--app-max); margin: 0 auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
/* Vidéo plein écran. html5-qrcode écrit position: relative sur #reader : c'est son parent qui est fixe. */
.mp2-video { position: fixed; inset: 0; z-index: 0; }
.mp2-video #reader { width: 100%; height: 100%; }
.mp2-video video { width: 100% !important; height: 100% !important; object-fit: cover; display: block; }
.mp2-video #reader > div { display: none !important; } /* bandeau « Scanner paused » de la librairie */
/* Tablette : caisse.js place la vidéo dans le cadre de visée, la caméra n'occupe que le cadre. */
.viewfinder > .mp2-video { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.mp2-top { position: relative; z-index: 4; padding: 20px 16px 0; }
.mp2-center { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px 24px; min-height: 0; container-type: size; }
/* Le cadre reste carré et rétrécit si la place manque (bandeau « Dernier passage », petit écran). */
.viewfinder { --fit: var(--vf, 270px); position: relative; flex-shrink: 0; width: var(--fit); height: var(--fit); border-radius: 28px; background: rgba(253, 246, 240, .06); }
@supports (width: 1cqh) { .viewfinder { --fit: max(120px, min(var(--vf, 270px), 100cqw, 100cqh - 43px)); } }
/* Liste de résultats ouverte sur petit écran : la consigne s'efface, le cadre prend la hauteur. */
@container (max-height: 190px) { .mp2-hint { display: none; } .viewfinder { --fit: max(120px, min(var(--vf, 270px), 100cqw, 100cqh)); } }
@container (max-height: 110px) { .viewfinder { visibility: hidden; } }
.has-video .viewfinder { background: transparent; box-shadow: 0 0 0 100vmax rgba(31, 53, 19, .55); }
.viewfinder .c1, .viewfinder .c2, .viewfinder .c3, .viewfinder .c4 { position: absolute; width: 56px; height: 56px; border: 0 solid var(--cream); }
.viewfinder .c1 { top: 0; left: 0; border-top-width: 7px; border-left-width: 7px; border-radius: 28px 0 0 0; }
.viewfinder .c2 { top: 0; right: 0; border-top-width: 7px; border-right-width: 7px; border-radius: 0 28px 0 0; }
.viewfinder .c3 { bottom: 0; left: 0; border-bottom-width: 7px; border-left-width: 7px; border-radius: 0 0 0 28px; }
.viewfinder .c4 { bottom: 0; right: 0; border-bottom-width: 7px; border-right-width: 7px; border-radius: 0 0 28px 0; }
.viewfinder .line { position: absolute; top: 50%; left: 28px; right: 28px; height: 3px; margin-top: -1.5px; border-radius: 3px; background: var(--pink); animation: scanline 2.4s ease-in-out infinite alternate; }
@keyframes scanline { from { top: 17%; } to { top: 83%; } }
.viewfinder .cam-off { position: absolute; inset: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; font-size: 16px; font-weight: 600; line-height: 1.4; }
.mp2-hint { position: relative; font-size: 18px; font-weight: 600; text-align: center; } /* au-dessus du voile du cadre */
.mp2-panel {
  position: relative; z-index: 3; flex-shrink: 0; overflow: hidden;
  border-radius: 28px 28px 0 0; background: var(--forest); box-shadow: 0 -12px 30px rgba(31, 53, 19, .35);
  --motif-fg: #4C7730; --motif-op: 1;
}
.mp2-panel .inner { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px var(--gutter) calc(32px + env(safe-area-inset-bottom)); }
.mp2-panel label { font-size: 16px; font-weight: 600; }
.mp2-search { display: flex; gap: 12px; }
.mp2-search input {
  flex: 1; min-width: 0; height: 72px; padding: 0 20px; border-radius: 999px; border: 3px solid var(--cream);
  background: var(--cream); color: var(--forest); font-size: 20px; font-weight: 600; letter-spacing: .06em; outline: none;
  -webkit-appearance: none; appearance: none;
}
.mp2-search input::placeholder { color: rgba(66, 112, 40, .55); opacity: 1; font-size: 16px; letter-spacing: 0; }
.mp2-search input.is-long { font-size: 17px; letter-spacing: 0; }
.mp2-search input:focus { border-color: var(--pink-2); }
.mp2-search input[aria-invalid="true"] { border-color: var(--pink); }
.round-btn { width: 72px; height: 72px; flex-shrink: 0; border-radius: 50%; border: 3px solid var(--cream); background: transparent; color: var(--cream); display: flex; align-items: center; justify-content: center; }
.mp2 .alert { background: var(--pink); align-items: center; padding: 12px 16px; line-height: 1.35; }
.results-count { font-size: 16px; font-weight: 600; }
.results { display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.result {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 16px 0 10px; border-radius: 20px; border: 0;
  background: var(--cream); color: var(--forest); text-align: left; width: 100%;
}
.result .dot, .initial { width: 44px; height: 44px; font-family: var(--font-title); font-size: 20px; }
.result .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.result .nm { font-size: 16px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .cd { font-size: 16px; line-height: 1.25; letter-spacing: .04em; }
.result .title-num { font-size: 20px; }

/* bandeau « Dernier passage » */
.last {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 24px;
  background: var(--cream); color: var(--forest); box-shadow: 0 12px 28px rgba(0, 0, 0, .35); animation: drop-in .3s ease;
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
.last .top { display: flex; align-items: flex-start; gap: 12px; }
.last .check { width: 44px; height: 44px; border-radius: 50%; background: var(--forest); color: var(--cream); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.last .txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.last .big { font-family: var(--font-title); font-size: 22px; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.last .reward { display: flex; align-items: flex-start; gap: 6px; font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.last .reward .ico { margin-top: 2px; }
.last .bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn-undo { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border-radius: 999px; border: 2px solid var(--forest); background: transparent; color: var(--forest); font-size: 16px; font-weight: 600; flex-shrink: 0; }
.undo-bar { height: 4px; border-radius: 4px; background: rgba(66, 112, 40, .18); overflow: hidden; }
.undo-bar div { height: 4px; border-radius: 4px; background: var(--forest); }

/* MP3 · passage */
.mp3 { position: relative; z-index: 1; max-width: var(--app-max); margin: 0 auto; display: flex; flex-direction: column; gap: 20px; padding: 12px var(--gutter) calc(24px + env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; }
.mp3 .back { min-height: 64px; font-size: 18px; }
.mini-card {
  position: relative; height: 132px; border-radius: 24px; overflow: hidden; background: var(--cream); color: var(--forest);
  box-shadow: 0 10px 24px rgba(31, 53, 19, .35); --motif-fg: #427028; --motif-op: .055; flex-shrink: 0;
}
.mini-card .inner { position: relative; height: 100%; padding: 18px 136px 18px 20px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.mini-card .nm { font-family: var(--font-title); font-size: 34px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .cd { font-size: 16px; font-weight: 600; letter-spacing: .06em; white-space: nowrap; }
.disc {
  position: absolute; top: 16px; right: 18px; width: 100px; height: 100px; border-radius: 50%; background: var(--pink); color: var(--night);
  display: flex; align-items: center; justify-content: center; transform: rotate(8deg); box-shadow: 0 6px 14px rgba(31, 53, 19, .22);
}
.disc::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; border: 2px dashed rgba(31, 53, 19, .35); }
.disc .v { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.disc .n { font-family: var(--font-title); font-size: 40px; }
.disc .n.is-long { font-size: 30px; }
.disc .u { font-size: 16px; font-weight: 600; margin-top: 6px; }
.howmany { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.howmany .q { font-size: 18px; font-weight: 600; line-height: 1.3; }
.stepper { display: flex; align-items: flex-start; justify-content: space-between; }
.step-btn { margin-top: 4px; width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--cream); background: transparent; color: var(--cream); display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.step-btn--plus { background: var(--cream); color: var(--forest); }
.step-btn:disabled { opacity: .35; cursor: default; }
.val-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.val-box { position: relative; display: block; cursor: text; }
.val-input {
  display: block; width: 132px; height: 80px; padding: 0; margin: 0; border-radius: 22px; border: 2px dashed rgba(253, 246, 240, .6);
  background: transparent; color: var(--cream); font-family: var(--font-title); font-size: 60px; line-height: 1; text-align: center;
  caret-color: var(--pink); -webkit-appearance: none; appearance: none; -moz-appearance: textfield; outline: none;
}
.val-input::-webkit-outer-spin-button, .val-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.val-input.is-long { font-size: 46px; }
.val-input:focus { border-style: solid; border-color: var(--cream); background: rgba(31, 53, 19, .18); }
.val-input::placeholder { color: rgba(253, 246, 240, .35); opacity: 1; }
.val-kbd { position: absolute; top: -9px; right: -9px; width: 30px; height: 30px; border-radius: 50%; background: var(--cream); color: var(--forest); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.val-unit { font-size: 16px; font-weight: 600; white-space: nowrap; }
.after { align-self: center; font-size: 20px; font-weight: 600; text-align: center; }
.after.is-neg { color: var(--pink); }
.dashed-note { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 20px; border: 2px dashed var(--cream); font-size: 16px; font-weight: 600; line-height: 1.35; }
.rewards { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.rewards .title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.reward-row {
  display: flex; align-items: center; gap: 12px; min-height: 88px; padding: 9px; border-radius: 44px; background: var(--cream);
  border: 3px solid var(--cream); box-shadow: 0 6px 16px rgba(31, 53, 19, .18); color: var(--forest);
}
.reward-row.is-chosen { border-color: var(--pink); }
.reward-row .dot { width: 56px; height: 56px; }
.reward-row .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.reward-row .nm { font-size: 16px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; overflow-wrap: anywhere; }
.reward-row .pt { font-size: 16px; line-height: 1.25; }
.use-btn { height: 64px; padding: 0 22px; border-radius: 999px; border: 0; background: var(--forest); color: var(--cream); font-size: 16px; font-weight: 600; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.reward-row.is-chosen .use-btn { background: var(--pink); color: var(--night); }
.mp3-spacer { flex: 1; }
.mp3-submit { position: sticky; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 2; }
.mp3 .alert { background: var(--pink); }

/* ------------------------------------------------------------------ admin */
.mo0 { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px var(--gutter) calc(32px + env(safe-area-inset-bottom)); }
.badge-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 999px; background: var(--pistache); color: var(--night); font-size: 16px; font-weight: 600; }
.form-card { width: 100%; margin-top: 10px; padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 24px rgba(66, 112, 40, .18); }
.eye-btn { width: 52px; height: 52px; border: 0; border-radius: 14px; background: transparent; color: var(--forest); display: flex; align-items: center; justify-content: center; }
.mo0-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; font-size: 16px; line-height: 1.45; color: var(--forest); text-decoration: none; padding-top: 24px; }
.mo0-foot u { font-weight: 600; }
.stats { padding: 6px 20px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; border-bottom: 2px solid var(--pistache); }
.stat:last-child { border-bottom: 0; }
.stat .l { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.stat .title-num { font-size: 26px; }
.qr-tile { display: flex; align-items: center; gap: 16px; padding: 16px 18px 16px 16px; }
.qr-tile .qrbox { display: flex; padding: 8px; border-radius: 14px; background: var(--white); box-shadow: 0 4px 10px rgba(31, 53, 19, .14); flex-shrink: 0; }
.qr-tile .qrbox svg { width: 80px; height: 80px; }
.mo1-grid, .mo1-chevalet, .mo1-tiles { display: flex; flex-direction: column; gap: 16px; }
.mo1-chevalet { gap: 12px; }
.mo1-tiles { gap: 10px; margin-top: 4px; }
.mo1-logout { margin-top: auto; }
/* Même allure qu'une ligne client (MO2) : fond crème, fine bordure pistache, chevron. */
.tile { display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px 18px 12px 14px; border-radius: 20px; background: var(--cream); border: 2px solid var(--pistache); color: var(--forest); text-decoration: none; }
.tile .circle { width: 48px; height: 48px; border-radius: 50%; background: var(--pistache); color: var(--night); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile .txt { display: flex; flex-direction: column; flex: 1; line-height: 1.3; }
.tile .t { font-size: 18px; font-weight: 600; }
.client-row {
  display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 8px 14px 8px 12px; border-radius: 20px;
  background: var(--cream); border: 2px solid var(--pistache); color: var(--forest); text-decoration: none; overflow: hidden;
}
.initial { border-radius: 50%; background: var(--pistache); color: var(--night); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-title); }
.client-row .txt { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.client-row .nmline { display: flex; align-items: center; gap: 8px; min-width: 0; }
.client-row .nm { font-size: 16px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.client-row .cd { font-size: 16px; line-height: 1.25; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.client-row .title-num { font-size: 20px; line-height: 1.1; }
.client-row .dt { font-size: 16px; line-height: 1.25; white-space: nowrap; }
.gift-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px 3px 8px; border-radius: 999px; background: var(--pink); color: var(--night); font-size: 16px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.identity { display: flex; align-items: center; gap: 14px; }
.identity .initial { width: 64px; height: 64px; font-size: 30px; }
.identity .nm { font-family: var(--font-title); font-size: 34px; line-height: 1; overflow-wrap: anywhere; }
.identity .cd { font-size: 16px; font-weight: 600; letter-spacing: .06em; }
.identity .em { font-size: 16px; overflow-wrap: anywhere; }
.balance-edit { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; }
.balance-edit .ctrl { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.circle-btn { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--forest); background: transparent; color: var(--forest); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.circle-btn--fill { background: var(--forest); color: var(--cream); border: 0; }
.circle-btn:disabled { opacity: .35; cursor: default; }
.num-box { flex: 1; min-width: 0; height: 64px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 16px; border: 2px solid var(--forest); background: var(--white); cursor: text; }
.num-box input { width: 1.6ch; max-width: 70%; height: 56px; border: 0; background: transparent; color: var(--forest); font-family: var(--font-title); font-size: 40px; line-height: 1; text-align: center; padding: 0; outline: none; -moz-appearance: textfield; }
.num-box input::-webkit-outer-spin-button, .num-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-box span { font-size: 18px; font-weight: 600; }
.num-box:focus-within { outline: 3px solid var(--pink); outline-offset: 2px; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(31, 53, 19, .5); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; z-index: 21; left: 50%; bottom: 0; width: 100%; max-width: var(--app-max); transform: translateX(-50%);
  max-height: 92dvh; overflow-y: auto; padding: 12px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0; background: var(--cream); color: var(--forest); box-shadow: 0 -12px 30px rgba(31, 53, 19, .35);
  display: flex; flex-direction: column; gap: 14px; animation: sheet-in .25s ease;
}
@keyframes sheet-in { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.sheet .grab { align-self: center; width: 48px; height: 5px; border-radius: 5px; background: rgba(66, 112, 40, .3); }
.sheet .h2 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 26px; line-height: 1.05; text-transform: uppercase; }
.pick { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 0 14px 0 10px; border-radius: 20px; border: 2px solid var(--pistache); background: var(--white); color: var(--forest); text-align: left; width: 100%; }
.pick[aria-selected="true"] { border: 3px solid var(--forest); }
.pick .txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pick .nm { font-size: 16px; font-weight: 600; line-height: 1.25; }
.pick .cd { font-size: 16px; line-height: 1.25; letter-spacing: .04em; }
.pick .ok { width: 32px; height: 32px; border-radius: 50%; background: var(--forest); color: var(--cream); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pick:disabled { opacity: .5; }

.tier-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 16px 18px; }
.tier-card .top { display: flex; align-items: center; gap: 10px; }
.pts-box { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--forest); background: var(--cream); flex-shrink: 0; }
.pts-box input { width: 48px; height: 48px; border: 0; background: transparent; font-family: var(--font-title); font-size: 22px; color: var(--forest); text-align: right; padding: 0; outline: none; }
.pts-box span { font-size: 16px; font-weight: 600; }
.pts-box:focus-within { outline: 3px solid var(--pink); outline-offset: 2px; }
.pts-box[aria-invalid="true"] { border: 3px solid var(--pink); }
.tier-card .lvl { flex: 1; font-size: 16px; font-weight: 600; }
.trash { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--forest); background: transparent; color: var(--forest); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.trash:disabled { opacity: .35; }
.counter { align-self: flex-end; font-size: 16px; }
.save-bar { position: sticky; bottom: calc(24px + env(safe-area-inset-bottom)); margin-top: 16px; z-index: 2; }
.ok-msg { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 16px; background: var(--pistache); color: var(--night); font-size: 16px; font-weight: 600; }

/* ------------------------------------------------------------------ chevalet K1 */
.k1-page { background: #e9e4de; }
.k1 {
  /* Tailles en cqw (1 cqw = 1/100 de la largeur) : 210 mm à l'impression, réduit à l'écran. */
  position: relative; width: min(210mm, calc(100vw - 32px)); aspect-ratio: 210 / 297; margin: 0 auto 16px; overflow: hidden;
  container-type: inline-size; color: var(--forest); font-size: 16px;
  /* Motif de fleurs sur tout le chevalet, à l'échelle de la maquette (tuile = 3,33 fois la largeur).
     Couleurs pleines, sans masque ni transparence : le PDF s'affiche pareil dans tous les lecteurs. */
  background: var(--pistache) url("/assets/img/motif-fleurs-chevalet.svg") 14.29% 0 / 333.4% auto no-repeat;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.k1 .inner { position: relative; height: 100%; padding: 9.05cqw 10cqw 8.57cqw; display: flex; flex-direction: column; align-items: center; gap: 3.52cqw; text-align: center; }
.k1 .logo { height: 16.19cqw; }
.k1 h1 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 7.81cqw; line-height: 1.02; text-transform: uppercase; color: var(--night); text-shadow: .76cqw .76cqw 0 var(--cream); }
/* Pas d'ombre floue : dans le PDF, elle devient un rectangle foncé dans Aperçu et d'autres lecteurs. */
.k1 .qrframe { display: flex; padding: 4.05cqw; border-radius: 6.05cqw; background: var(--white); }
.k1 .qrframe svg { width: 44.29cqw; height: 44.29cqw; }
.k1 .chips { display: flex; gap: 1.52cqw; }
.k1 .chip { display: flex; align-items: center; gap: 1.52cqw; padding: 1.52cqw 3.52cqw 1.52cqw 2.52cqw; border-radius: 999px; background: var(--cream); color: var(--night); font-size: 4.05cqw; font-weight: 600; }
.k1 .chip .ico { width: 4.52cqw; height: 4.52cqw; }
.k1 .foot { margin-top: auto; font-size: 4.05cqw; font-weight: 600; color: var(--night); }
.k1 .st { position: absolute; filter: drop-shadow(0 .76cqw 1cqw rgba(66, 112, 40, .28)); }
.k1 .st1 { top: 50.48cqw; right: 3.52cqw; width: 15.71cqw; transform: rotate(12deg); }
.k1 .st2 { top: 75.71cqw; left: 3.52cqw; width: 15.24cqw; transform: rotate(-10deg); }
.k1 .st3 { bottom: 14.76cqw; right: 5.52cqw; width: 11.9cqw; transform: rotate(6deg); }
@page { size: A4 portrait; margin: 0; }
@media print { .k1-page { background: none; } .k1 { width: 210mm; margin: 0; } .no-print { display: none !important; } }

/* ------------------------------------------------------------------ mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ tablettes (≥ 720 px)
   Le téléphone (390 px) reste la référence ; sur tablette, les colonnes s'élargissent. */
@media (min-width: 720px) {
  .space-carte { --app-max: 560px; }
  .space-pro { --app-max: 640px; }
  .space-admin { --app-max: 760px; }

  /* Caisse : clavier et cadre de visée plus grands */
  .keypad { max-width: 420px; grid-template-columns: repeat(3, 120px); row-gap: 16px; }
  .key { width: 120px; height: 84px; font-size: 36px; }
  .mp2 { --vf: 340px; }
  .has-video .viewfinder { box-shadow: none; }

  /* Admin : formulaires étroits, contenus sur deux colonnes */
  .space-admin .mo0 { max-width: 520px; }
  .sheet { max-width: 560px; }
  /* Accueil : stats | chevalet. Avec subgrid, les deux cartes partagent une ligne (même haut, même hauteur)
     et « Toutes les statistiques » s'aligne sur le bouton du chevalet. */
  .mo1-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; row-gap: 10px; align-items: start; }
  @supports (grid-template-rows: subgrid) {
    .mo1-grid > * { grid-row: span 3; display: grid; grid-template-rows: subgrid; gap: 10px; }
    .mo1-grid .qr-tile { grid-row: 2; }
    .mo1-grid .qr-tile + .btn { grid-row: 3; }
    .mo1-grid .link { justify-self: center; }
  }
  .mo1-tiles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
  .mo1-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; } /* tuile seule sur sa ligne : pleine largeur */
  #mo2-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
  /* Fiche client : identité, solde et transfert à gauche ; historique à droite.
     La dernière rangée (1fr) absorbe la hauteur de l'historique : la colonne de gauche reste groupée. */
  #mo2-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr; column-gap: 32px; row-gap: 16px; align-items: start; }
  #mo2-card > * { grid-column: 1; }
  #mo2-card > .back { grid-column: 1 / -1; }
  #mo2-card > section:last-child { grid-column: 2; grid-row: 2 / -1; }
  #mo3-tiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
  .save-bar { align-self: center; width: 100%; max-width: 420px; }
  .mo1-logout { margin-top: 24px; }

  /* Caisse : − et + restent près du nombre */
  .stepper { justify-content: center; gap: 56px; }
}

/* ------------------------------------------------------------------ grands écrans (≥ 960 px) */
@media (min-width: 960px) {
  .space-admin { --app-max: 1000px; }

  /* Ma carte : QR et solde à gauche, historique à droite */
  #mc2 { max-width: 1000px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto auto auto 1fr; column-gap: 40px; row-gap: 14px; align-content: start; align-items: start; }
  #mc2 > .row, #mc2 > .stack { grid-column: 1 / -1; }
  #mc2 > .qr-card, #mc2 > .balance-card, #mc2 > #mc2-tip { grid-column: 1; }
  #mc2 > .history-section { grid-column: 2; grid-row: 3 / -1; margin-top: 0; }
}

/* Caisse sur tablette à l'horizontale (ou ordinateur) : code et passage sur deux colonnes ; le scanner garde une colonne */
@media (min-width: 960px) and (orientation: landscape) {
  .mp1 { max-width: 960px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 64px; row-gap: 14px; align-content: center; justify-items: center; }
  .mp1 > * { grid-column: 1; }
  .mp1 > .keypad { grid-column: 2; grid-row: 1 / span 5; margin-top: 0; align-self: center; }

  .mp3 { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto; column-gap: 48px; row-gap: 20px; align-content: start; }
  .mp3 > .back { grid-column: 1 / -1; }
  .mp3 > .mini-card { grid-column: 1; grid-row: 2; }
  .mp3 > #mp3-rewards { grid-column: 1; grid-row: 3 / span 3; }
  .mp3 > .howmany { grid-column: 2; grid-row: 2 / span 2; }
  .mp3 > #mp3-err { grid-column: 2; grid-row: 4; align-self: end; }
  .mp3 > .mp3-spacer { display: none; }
  .mp3 > .mp3-submit { grid-column: 2; grid-row: 5; position: static; }
}

/* Écrans étroits (360 px) */
@media (max-width: 374px) {
  :root { --gutter: 18px; }
  .keypad { grid-template-columns: repeat(3, 88px); }
  .key { width: 88px; }
  .step-btn { width: 64px; height: 64px; }
  .mini-card .inner { padding-right: 124px; }
  .mini-card .nm { font-size: 30px; }
}
