/* Nomad Pass Maroc — application client */
:root {
  color-scheme: dark;
  /* Nuit + rose / cyan */
  --bg: #0b0b14;
  --surface: #15131f;
  --surface-2: #1d1a2b;
  --pink: #ff2d9b;
  --cyan: #22e0ff;
  --grad: linear-gradient(90deg, #ff2d9b 0%, #22e0ff 100%);
  --grad-135: linear-gradient(135deg, #ff2d9b 0%, #22e0ff 100%);
  --grad-card: linear-gradient(135deg, #3a1340 0%, #142c44 100%);
  --on-primary: #07070f;
  /* Noms d'origine gardés pour tout le code existant */
  --teal: #22e0ff;
  --teal-dark: #07070f;
  --teal-soft: #102a36;
  --saffron: #ff2d9b;
  --saffron-soft: #2b1428;
  --saffron-ink: #ff9ccf;
  --clay: #ff5577;
  --clay-soft: #2e131c;
  --sand: #0b0b14;
  --line: #272435;
  --field: #3a3450;
  --ink: #ffffff;
  --muted: #a9a3c4;
  --ok: #3be39c;
  --ok-soft: #0f2b22;
  --radius: 14px;
  --font: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  --display: "Plus Jakarta Sans", Inter, system-ui, var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--sand); color: var(--ink); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
[dir="rtl"] body { font-family: "Noto Sans Arabic", Tahoma, var(--font); }
a { color: var(--teal); }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
.hidden { display: none !important; }

#app { max-width: 480px; margin-inline: auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--sand); }
.screen { flex: 1; padding: 24px 20px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.screen.no-nav { padding-bottom: 28px; }

/* En-têtes */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 20px; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--ink); }
.brand .maroc { font-size: 11px; font-weight: 800; letter-spacing: 3px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; display: block; line-height: 1; margin-top: 2px; }
.brand img { width: 40px; height: 40px; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { height: 48px; border: 1px solid var(--field); border-radius: 12px; padding: 0 14px; background: var(--surface-2); color: var(--ink); width: 100%; }
::placeholder { color: #7d7799; }
.field input:focus, .field select:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.field small { font-weight: 400; color: var(--muted); }
.error { color: var(--clay); font-size: 13px; font-weight: 600; }

.btn { height: 52px; border-radius: var(--radius); border: none; background: var(--grad); color: var(--on-primary); font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; padding: 0 18px; width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--field); }
.btn.accent { background: var(--pink); color: var(--on-primary); }
.btn.ghost { background: none; color: var(--cyan); height: 44px; }
.btn.small { height: 40px; font-size: 14px; width: auto; }
.link-center { text-align: center; font-size: 14px; color: var(--muted); }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.balance { background: var(--grad-card); border: 1px solid #3a2a55; color: #fff; border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.balance .label { font-size: 13px; color: #c7c2db; }
.balance .amount { font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1; }
.balance .amount span { font-size: 18px; color: var(--cyan); }
.balance .actions { display: flex; gap: 10px; }
.balance .actions .btn { height: 46px; font-size: 15px; }
.balance .actions .btn.secondary { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; padding: 9px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--grad); border-color: transparent; color: var(--on-primary); font-weight: 700; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head h2 { font-size: 18px; }
.section-head a { font-size: 13px; font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--surface); border-radius: 16px; padding: 12px; display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); border: 2px solid var(--line); width: 100%; text-align: start; }
button.item { cursor: pointer; }
.item.selected { border-color: var(--teal); }
.item .thumb { width: 52px; height: 52px; border-radius: 12px; background: var(--teal-soft); display: flex; align-items: center; justify-content: center; flex: none; color: var(--teal); }
.item .thumb svg { width: 26px; height: 26px; }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .title { font-size: 15px; font-weight: 600; }
.item .sub { font-size: 12px; color: var(--muted); }
.item .end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.badge { padding: 4px 8px; border-radius: 8px; background: var(--saffron-soft); color: var(--saffron-ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--clay-soft); color: #ff9aae; }
.pts { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--teal); white-space: nowrap; }
.strike { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.plus { color: var(--ok); }
.minus { color: var(--clay); }

.summary { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; }
.summary .line span:first-child { color: var(--muted); }
.summary hr { border: none; height: 1px; background: var(--line); margin: 0; width: 100%; }
.summary .total { font-weight: 700; }
.summary .total span:first-child { color: var(--ink); }
.balance .summary .line span:first-child { color: #c7c2db; }
.balance .summary .total span:first-child { color: #fff; }

.amounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.amount-opt { height: 76px; border-radius: 14px; background: var(--surface); border: 1px solid var(--field); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink); }
.amount-opt[aria-pressed="true"] { border: 2px solid var(--teal); }
.amount-opt strong { font-family: var(--display); font-size: 20px; }
.amount-opt small { font-size: 12px; color: var(--saffron-ink); font-weight: 600; }

.radio { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 14px; border: 2px solid var(--line); font-weight: 600; font-size: 15px; }
.radio:has(input:checked) { border-color: var(--teal); }
.radio input { width: 20px; height: 20px; accent-color: var(--teal); }
.radio small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }

/* PIN */
.pin { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pin input { width: 180px; height: 56px; text-align: center; letter-spacing: 18px; font-size: 26px; border-radius: 14px; border: 1px solid var(--field); background: var(--surface-2); color: var(--ink); }

/* Scanner */
.scanner { position: relative; background: #000; border-radius: 20px; overflow: hidden; aspect-ratio: 1; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid var(--saffron); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* Succès */
.success { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding-top: 30px; }
.success .check { width: 96px; height: 96px; border-radius: 48px; background: var(--ok-soft); display: flex; align-items: center; justify-content: center; color: var(--ok); }
.success .check svg { width: 48px; height: 48px; }

/* Navigation basse */
.tabbar { position: fixed; bottom: 0; inset-inline: 0; max-width: 480px; margin-inline: auto; height: calc(72px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(11, 11, 20, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; justify-content: space-around; align-items: center; z-index: 10; }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); text-decoration: none; min-width: 56px; }
.tabbar a[aria-current="page"] { color: var(--teal); font-weight: 600; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar .scan { width: 56px; height: 56px; border-radius: 28px; background: var(--grad-135); color: var(--on-primary); box-shadow: 0 8px 26px -8px rgba(255, 45, 155, .6); justify-content: center; margin-top: -26px; min-width: 0; }

#toast { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom)); inset-inline: 16px; max-width: 448px; margin-inline: auto; background: #ffffff; color: #07070f; font-weight: 600; padding: 12px 16px; border-radius: 12px; font-size: 14px; z-index: 20; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 24px 0; }
.note { font-size: 12px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--teal-soft); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Cadeaux : points de bienvenue / parrainage */
.card.gift, .card.invite-card { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.card.invite-card { flex-direction: column; align-items: stretch; }
.ref-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ref-actions .btn { flex: 1 1 auto; }
.card.gift { background: linear-gradient(135deg, rgba(255, 45, 155, .2) 0%, var(--surface) 70%); border-color: #5a2350; }
.card.invite-card { text-decoration: none; color: var(--ink); background: linear-gradient(135deg, rgba(34, 224, 255, .16) 0%, var(--surface) 70%); border-color: #1f4a5a; }
.gift-ico { flex: none; width: 42px; height: 42px; border-radius: 13px; background: var(--grad-135); color: var(--on-primary); display: flex; align-items: center; justify-content: center; }
.gift-ico svg { width: 22px; height: 22px; }
.ref-link { font-size: 13px; color: #c7c2db; word-break: break-all; background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 8px 10px; }
.kpis-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.steps-list { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #e4e1f0; }

/* Recharges : code à présenter, reçu */
.link-right { margin-inline-start: auto; font-size: 13px; font-weight: 700; color: var(--cyan); text-decoration: none; }
.radio.off { opacity: .55; }
.code-card { text-align: center; align-items: center; gap: 10px; }
.pay-code { font-size: clamp(24px, 7.6vw, 36px); white-space: nowrap; font-weight: 800; letter-spacing: 2px; background: #fff; color: #07070f; border-radius: 16px; padding: 12px 18px; font-variant-numeric: tabular-nums; }
.receipt { background: #ffffff; color: #07070f; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.receipt header { display: flex; align-items: center; gap: 10px; border-bottom: 1px dashed #c9c4dc; padding-bottom: 12px; }
.receipt header img { width: 40px; height: 40px; }
.receipt header div { display: flex; flex-direction: column; flex: 1; }
.receipt header span:not(.badge) { font-size: 13px; color: #4a4560; }
.receipt .badge.ok { background: #d6f7e7; color: #0d6b3f; }
.rc-amount { font-size: 34px; font-weight: 800; text-align: center; padding: 6px 0; }
.rc-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; border-bottom: 1px solid #ece9f5; padding: 7px 0; }
.rc-row span { color: #4a4560; }
.rc-row strong { text-align: end; word-break: break-all; }
.rc-foot { color: #4a4560 !important; font-size: 12px; margin: 6px 0 0; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--cyan); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media print {
  body { background: #fff !important; }
  .no-print, .tabbar, #toast { display: none !important; }
  .receipt { border: 1px solid #ccc; }
}

/* Selfie : caméra dans la page */
.selfie-stage { position: relative; width: min(280px, 80vw); aspect-ratio: 1; margin: 4px auto; border-radius: 50%; overflow: hidden; background: var(--surface); border: 3px solid transparent; background-image: linear-gradient(var(--surface), var(--surface)), var(--grad-135); background-origin: border-box; background-clip: padding-box, border-box; display: flex; align-items: center; justify-content: center; }
.selfie-stage video, .selfie-stage img { width: 100%; height: 100%; object-fit: cover; }
.selfie-stage video { transform: scaleX(-1); }
.selfie-ph svg { width: 90px; height: 90px; color: #4d4766; }
.selfie-ring { position: absolute; inset: 10%; border: 2px dashed rgba(255, 255, 255, .45); border-radius: 50%; pointer-events: none; }
.selfie-actions { display: flex; flex-direction: column; gap: 10px; }
.locked-line { margin-top: 8px; font-size: 13px; font-weight: 700; color: #ffd1e8; background: rgba(255, 45, 155, .16); border: 1px solid rgba(255, 45, 155, .35); border-radius: 10px; padding: 6px 10px; display: inline-block; }
.gift-big { background: var(--grad-135) !important; color: var(--on-primary) !important; }

/* Bouton « Scanner pour payer » de l'accueil */
.btn.scan-cta { background: var(--grad); color: var(--on-primary); gap: 8px; }
.btn.scan-cta svg { width: 20px; height: 20px; flex: none; }
/* --- Commercial : réductions, économies, arguments --- */
.promo { display: flex; gap: 14px; align-items: center; text-decoration: none; color: #fff; border-radius: 22px; padding: 18px; border: 1px solid #5a2350;
  background: radial-gradient(260px 140px at 0% 0%, rgba(255, 45, 155, .45), transparent 70%), radial-gradient(260px 160px at 100% 100%, rgba(34, 224, 255, .3), transparent 70%), var(--surface); }
.promo-big { flex: none; font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.promo-body { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.promo-body strong { color: #fff; font-size: 16px; }
.promo-cta { color: var(--teal); font-weight: 700; font-size: 14px; margin-top: 2px; }
.savings { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--ok-soft); color: var(--ok); font-size: 14px; font-weight: 700; }
.savings svg { width: 20px; height: 20px; flex: none; }
.pitch { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pitch li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.pitch li::before { content: "✓"; flex: none; width: 22px; height: 22px; border-radius: 11px; background: var(--grad-135); color: var(--on-primary); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.deal { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 20px; border: 1px solid #5a2350; background: linear-gradient(135deg, rgba(255, 45, 155, .22) 0%, var(--surface) 75%); }
.deal-big { flex: none; font-size: 28px; font-weight: 800; color: #fff; background: var(--grad); color: var(--on-primary); border-radius: 14px; padding: 8px 10px; }
.deal > span:last-child { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.deal strong { color: #fff; font-size: 15px; }
.ok-text { color: var(--ok); font-weight: 800; }
.saved-pill { margin: 6px 0 0; display: inline-block; padding: 6px 14px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 14px; }
