/* Thème Digikart : fond gris ardoise, accents violets. Partagé scan + carte. */
:root {
  --bg: #0f141b;
  --surface: #171f2a;
  --surface-2: #1e2735;
  --border: #2a3645;
  --text: #e7edf5;
  --muted: #93a1b3;
  --blue: #8b5cf6;
  --blue-600: #7c3aed;
  --blue-soft: rgba(139, 92, 246, 0.14);
  --good: #22c55e;
  --warn: #f59e0b;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  /* surchargée en JS par la couleur du commerçant */
  --brand: #7c3aed;
  --brand-ink: #ffffff; /* encre lisible sur --brand, recalculee par render.js */
  /* Socle « tech » partagé (accueil + pages publiques) */
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --grid-line: rgba(148, 163, 184, .07);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-2: 0 2px 10px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
  --reading: #c2cbd6; /* texte de lecture longue (pages légales/doc) */
}

/* Thème clair : activé par la classe `light` sur <html> (clé localStorage
   dk_theme, partagée landing/dashboard). Les pages client (scan, carte) ne
   posent pas la classe : elles restent sombres, rien ne change pour elles. */
html.light {
  /* Jetons de la charte : fond blanc dominant, violet comme seul accent. */
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f8f7fb; --border: #ecebf2;
  --text: #14151c; --muted: #5c6070;
  --blue: #7c3aed; --blue-600: #6d28d9; --blue-soft: #f4efff;
  --shadow: 0 18px 44px rgba(20, 21, 28, .06);
  --grid-line: rgba(20, 21, 28, .05);
  --shadow-1: 0 1px 2px rgba(20, 21, 28, .05);
  --shadow-2: 0 18px 44px rgba(20, 21, 28, .06);
  --reading: #5c6070;
  color-scheme: light;
}
/* Le halo violet du haut de page disparait : la charte ne veut aucun degrade. */
html.light body { background: var(--bg); }

/* Micro-label technique (monospace, chiffres tabulaires) */
.mono-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
}

/* Instrument Sans, police de la charte. Servie depuis nos serveurs et non
   depuis le CDN de Google : le site annonce un hebergement en France, et un
   appel a fonts.gstatic.com transmettrait l'adresse IP de chaque visiteur.
   Fichier unique par jeu de caracteres : c'est une fonte variable, elle porte
   toutes les graisses de 400 a 700. */
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/instrument-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/instrument-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Fond sombre aussi sur <html> : sans lui, le rebond de défilement iOS et les
   zones sûres (encoche, bas d'écran) laissent apparaître des barres blanches. */
html { background: var(--bg); }

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, #1b2533 0%, var(--bg) 55%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 18px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.brandbar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
}
/* Logo Digikart (même dessin que le .mark de l'accueil) : le « D » est posé
   en ::before pour que les pages qui utilisent <span class="dot"></span>
   n'aient pas à changer. */
.brandbar .dot {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(150deg, var(--blue), var(--blue-600));
  box-shadow: var(--shadow-1);
  display: grid; place-items: center;
}
.brandbar .dot::before {
  content: 'D'; color: #fff; font-weight: 900; font-size: 13px; line-height: 1;
}

h1 { font-size: 24px; margin: 6px 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* --- Carte de fidélité (rendu visuel) --- */
.loyalty {
  background: linear-gradient(155deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #000));
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  color: #fff;
}
.loyalty::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 90% -20%, rgba(255,255,255,.25), transparent 60%);
  pointer-events: none;
}
.loyalty .lhead {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px;
}
.loyalty .biz { font-size: 19px; font-weight: 800; }
.loyalty .lbl { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }
.loyalty .reward { font-size: 14px; opacity: .95; margin-top: 2px; }
.loyalty .badge {
  background: rgba(255,255,255,.18);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 700;
  backdrop-filter: blur(4px);
}

/* Pastilles de tampons */
.dots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dots .d {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55);
  display: grid; place-items: center;
  font-size: 13px;
  transition: transform .25s, background .25s;
}
.dots .d.on { background: #fff; color: var(--brand); border-color: #fff; }

/* Présentation des récompenses (page d'installation de la carte) */
.rw-head { font-weight: 700; font-size: 15px; margin-bottom: 10px; }
.rw-earn {
  display: inline-block; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
  border-radius: 999px; padding: 6px 12px; margin-bottom: 12px;
}
.rw-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--border);
}
.rw-chip {
  flex-shrink: 0; min-width: 92px; text-align: center;
  font-weight: 700; font-size: 13px; color: var(--brand-ink, #fff);
  background: var(--brand); border-radius: 10px; padding: 7px 10px;
}
.rw-gift { font-size: 14.5px; font-weight: 600; }

/* En-tête commerce (page carte) : logo + nom */
.m-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 16px; }
.m-logo {
  width: 60px; height: 60px; flex-shrink: 0;
  border-radius: 14px; object-fit: contain;
  background: #fff; padding: 3px; /* cadre blanc réduit : le logo remplit la vignette */
}
.dots .d.pop { animation: pop .45s ease; }
@keyframes pop { 0%{transform:scale(.4)} 60%{transform:scale(1.25)} 100%{transform:scale(1)} }

.progress-line { margin-top: 14px; font-size: 13px; opacity: .9; }

/* --- Cartes UI / panneaux --- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  border: none; border-radius: 14px;
  padding: 15px 18px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s, opacity .12s, background .12s;
}
.btn:active { transform: scale(.98); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-600); }
.btn-dark { background: #000; color: #fff; }
/* Bouton « Ajouter à Google Wallet » : blanc, donc invisible sur le fond clair
   des pages client sans ce contour. */
.btn-light { background: #fff; color: #111; border: 1px solid #d7dee8; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn + .btn { margin-top: 10px; }

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-family: inherit; /* les textarea/select n'héritent pas de la police par défaut */
  margin-bottom: 12px;
}
.input:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }

.banner {
  border-radius: 12px; padding: 12px 14px; font-size: 13px;
  margin-bottom: 14px; line-height: 1.4;
}
.banner-demo { background: var(--blue-soft); border: 1px solid var(--blue); color: #cfe0ff; }
.banner-good { background: rgba(34,197,94,.12); border: 1px solid var(--good); color: #c8f5d6; }

.qr {
  background: #fff; padding: 14px; border-radius: 16px;
  width: fit-content; margin: 8px auto;
}
.qr img { display: block; width: 220px; height: 220px; }

.spacer { flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }
.foot b { color: var(--blue); }

.hidden { display: none !important; }
.fade-in { animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--good); color: #04210f; font-weight: 700;
  padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow);
  animation: fade .3s ease;
}
