:root {
  --bg: #000;
  --surface: #111113;
  --surface-2: #1c1c1f;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --gold: #c9a45c;
  --gold-hi: #e8cf96;
  --gold-grad: linear-gradient(135deg, #f1dca7 0%, #c9a45c 45%, #9c7a37 100%);
  --danger: #ff6b5e;
  --ok: #5fd38d;
  --r-lg: 28px;
  --r-md: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.wrap { max-width: 440px; margin: 0 auto; padding: 28px 20px 48px; }
.wrap.wide { max-width: 760px; }

/* Marque */
.brand { text-align: center; margin: 8px 0 28px; }
.brand .mark { font-size: 13px; letter-spacing: 0.42em; font-weight: 600; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-left: 0.42em; }
.brand .sub { font-size: 11px; letter-spacing: 0.24em; color: var(--muted); margin-top: 6px; text-transform: uppercase; padding-left: 0.24em; }

h1 { font-size: 34px; line-height: 1.08; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 10px; }
h2 { font-size: 22px; letter-spacing: -0.01em; margin: 0 0 6px; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.45; margin: 0 0 28px; }
.gold { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.small { font-size: 13px; color: var(--muted); line-height: 1.45; }
.center { text-align: center; }

/* Champs */
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 4px; }
.input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 17px; outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--gold); }
textarea.input { resize: vertical; min-height: 96px; }

/* Boutons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; border: 0; border-radius: 16px; padding: 17px 20px; font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .12s, opacity .2s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-gold { background: var(--gold-grad); color: #121008; }
.btn-dark { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(255,107,94,.3); }
.stack > * + * { margin-top: 10px; }

/* Carte fidélité */
.loyalty {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 26px 24px 24px;
  background: radial-gradient(120% 80% at 100% 0%, rgba(201,164,92,.22) 0%, rgba(201,164,92,0) 55%), linear-gradient(160deg, #1a1813 0%, #0b0b0c 60%);
  border: 1px solid rgba(201,164,92,.28); box-shadow: 0 30px 80px -30px rgba(201,164,92,.35);
}
.loyalty::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.06) 50%, transparent 60%); pointer-events: none; }
.loyalty-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.loyalty-top .label { font-size: 11px; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; }
.loyalty-top .name { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin-top: 6px; }
.loyalty-top .count { text-align: right; }
.loyalty-top .count b { font-size: 30px; font-weight: 700; }
.loyalty-top .count small { color: var(--muted); font-size: 15px; }

.stamps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 1.5px dashed rgba(201,164,92,.35); display: grid; place-items: center; color: transparent; }
.stamp svg { width: 46%; height: 46%; }
.stamp.on { background: var(--gold-grad); border: 0; color: #15120a; box-shadow: 0 6px 18px -6px rgba(201,164,92,.6); }
.stamp.gift { border-style: solid; border-color: var(--gold); color: var(--gold); }
.stamp.on.gift { color: #15120a; }
.stamp.pop { animation: pop .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }

.progress-txt { margin: 22px 0 0; font-size: 15px; color: #d6d6db; }
.progress-txt b { color: var(--gold-hi); }

.reward { margin-top: 20px; border-radius: var(--r-md); padding: 16px 18px; background: var(--gold-grad); color: #15120a; font-weight: 600; display: flex; gap: 12px; align-items: center; }
.reward .big { font-size: 17px; }
.reward .s { font-size: 13px; font-weight: 500; opacity: .75; }

/* QR */
.qr-tile { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; text-align: center; }
.qr-box { background: #fff; border-radius: 18px; padding: 14px; width: 210px; height: 210px; margin: 0 auto 14px; }
.qr-box svg { width: 100%; height: 100%; display: block; }

.row-list { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
.row + .row { border-top: 1px solid var(--line); }
.row .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--gold); flex: none; }
.row .ic svg { width: 18px; height: 18px; }
.row .t { flex: 1; font-size: 16px; }
.row .t small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.row .chev { color: #48484a; }
.row .ok { color: var(--ok); font-size: 14px; }

.hint { margin-top: 18px; padding: 16px 18px; border-radius: var(--r-md); background: rgba(201,164,92,.08); border: 1px solid rgba(201,164,92,.25); font-size: 14px; line-height: 1.5; color: #e6dcc4; }
.hint b { color: var(--gold-hi); }
.hint .share { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; }

.foot { margin-top: 28px; text-align: center; font-size: 12px; color: #5a5a5e; }
.demo-badge { position: fixed; top: calc(env(safe-area-inset-top) + 10px); right: 12px; font-size: 11px; letter-spacing: .08em; background: #2c2c2e; color: var(--gold-hi); padding: 5px 9px; border-radius: 999px; z-index: 50; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 20px); background: rgba(44,44,46,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: #fff; padding: 13px 18px; border-radius: 14px; font-size: 15px; opacity: 0; pointer-events: none; transition: all .3s; max-width: 90vw; z-index: 100; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: rgba(120,30,25,.95); }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(201,164,92,.2); border-top-color: var(--gold); animation: spin .8s linear infinite; margin: 80px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Espace salon ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.topbar .brand { margin: 0; text-align: left; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 15px; cursor: pointer; padding: 8px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.hl b { color: var(--gold-hi); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 3px; margin-bottom: 20px; }
.seg button { border: 0; background: none; padding: 10px; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: #3a3a3c; color: #fff; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
#reader { width: 100%; border-radius: 18px; overflow: hidden; background: #0a0a0a; min-height: 260px; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
#reader video { border-radius: 18px; }

.client-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); }
.client-row:last-child { border-bottom: 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--gold); flex: none; }
.client-row .t { flex: 1; min-width: 0; }
.client-row .t b { display: block; font-size: 16px; }
.client-row .t small { color: var(--muted); font-size: 13px; }
.mini { display: flex; gap: 3px; margin-top: 6px; }
.mini i { width: 12px; height: 4px; border-radius: 2px; background: #3a3a3c; }
.mini i.on { background: var(--gold); }
.pill { font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 999px; background: var(--gold-grad); color: #15120a; white-space: nowrap; }
.bell { color: var(--muted); }
.bell.on { color: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 8px 13px; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--gold); }

/* Fiche client (bottom sheet) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 80; }
.sheet-bg.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: #161618; border-radius: 28px 28px 0 0; padding: 12px 22px calc(env(safe-area-inset-bottom) + 22px); transform: translateY(105%); transition: transform .35s cubic-bezier(.2,.9,.3,1); z-index: 90; border-top: 1px solid var(--line); }
.sheet.show { transform: translateY(0); }
.grab { width: 38px; height: 5px; border-radius: 3px; background: #3a3a3c; margin: 0 auto 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.sheet-head h2 { font-size: 28px; margin: 0; }
.sheet-head .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.sheet .stamps { gap: 10px; margin-bottom: 20px; }

/* Affiche QR */
@media print {
  .no-print { display: none !important; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Bouton Wallet */
.btn-wallet { margin-top: 18px; background: #000; color: #fff; border: 1px solid #3a3a3c; border-radius: 999px; gap: 12px; }
.gw-mark { width: 22px; height: 16px; border-radius: 4px; background: linear-gradient(180deg, #ea4335 0 25%, #fbbc04 25% 50%, #34a853 50% 75%, #4285f4 75% 100%); }
.aw-mark { width: 22px; height: 16px; border-radius: 4px; background: linear-gradient(180deg, #ff9500 0 25%, #34c759 25% 50%, #0a84ff 50% 75%, #ff3b30 75% 100%); }
.name-edit { display: flex; gap: 8px; margin-bottom: 14px; }
.name-edit .input { padding: 12px 14px; font-size: 16px; }
.name-edit .btn { width: auto; padding: 12px 16px; font-size: 15px; }
