:root {
  --navy:    #0d2050;
  --teal:    #00c49f;
  --teal-bg: #e8faf6;
  --bg:      #f2f5f8;
  --white:   #ffffff;
  --border:  #dce3ed;
  --text:    #18243e;
  --muted:   #6b7a99;
  --light:   #a0aec0;
  --r:       12px;
  --r-sm:    8px;
  --r-xs:    6px;
  --sh:      0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --sh-md:   0 8px 32px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font-family: 'Plus Jakarta Sans', sans-serif; cursor: pointer; border: none; background: none; }

/* ── Header ──────────────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--navy); height: 58px;
}
.header-inner {
  height: 100%; max-width: 920px; margin: 0 auto;
  padding: 0 20px; display: flex; align-items: center; gap: 8px;
}
.header-logo { height: 24px; flex-shrink: 0; filter: brightness(0) invert(1); opacity: .9; }
.header-nav { display: flex; align-items: center; gap: 2px; margin-left: 20px; flex: 1; }
@media (max-width: 640px) { .header-nav { display: none; } }
.hn-btn {
  padding: 7px 14px; border-radius: var(--r-xs);
  font-size: 13.5px; font-weight: 600; color: rgba(255,255,255,.6);
  transition: color .15s, background .15s;
}
.hn-btn:hover  { color: #fff; background: rgba(255,255,255,.08); }
.hn-btn.active { color: #fff; background: rgba(255,255,255,.12); }
.header-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.hu-name {
  font-size: 13px; color: rgba(255,255,255,.65);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}
@media (max-width: 480px) { .hu-name { display: none; } }
.btn-logout {
  font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.7);
  padding: 5px 12px; border-radius: var(--r-xs);
  border: 1px solid rgba(255,255,255,.18);
  transition: background .15s, color .15s; white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── Layout ──────────────────────────────────────────────── */
.main-wrap { padding-top: 58px; padding-bottom: 70px; min-height: 100dvh; }
@media (min-width: 641px) { .main-wrap { padding-bottom: 32px; } }
.page-inner { max-width: 700px; margin: 0 auto; padding: 28px 16px; }

/* ── Bottom nav ──────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--white); border-top: 1px solid var(--border);
  display: flex; height: 62px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 641px) { .bottom-nav { display: none; } }
.bn-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--light); transition: color .15s; padding: 8px 4px;
}
.bn-btn.active { color: var(--teal); }
.bn-icon  { display: flex; align-items: center; }
.bn-label { font-size: 10.5px; font-weight: 600; }

/* ── Dashboard greeting ──────────────────────────────────── */
.dash-greeting {
  font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px;
}

/* ── NFC Card 3D ─────────────────────────────────────────── */
.card-scene {
  perspective: 1200px;
  width: min(100%, 380px);
  margin: 0 auto 24px;
  aspect-ratio: 1.586;
  -webkit-tap-highlight-color: transparent;
  container-type: inline-size;
}
.card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}
.card-face {
  position: absolute; inset: 0; border-radius: 16px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden;
}

/* ── Card front (PNG background) ────────────────────────── */
.card-front {
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 24px 60px rgba(0,0,0,.22), 0 8px 24px rgba(0,0,0,.16);
}
.card-shine {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
}

/* Bottom info strip — two columns */
.card-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 5.5% 7%;
}
.card-info-left  { /* solde */ }
.card-info-right { text-align: right; }

/* Prefixe cov- (card overlay) pour éviter collision avec credit-item ci-* */
.cov-label {
  font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.8px;
  line-height: 1; margin-bottom: 3px; display: block;
}
.cov-amount {
  font-size: 22px; font-weight: 800; line-height: 1;
  letter-spacing: -0.5px; font-variant-numeric: tabular-nums;
  display: block;
}
@media (max-width: 360px) { .cov-amount { font-size: 18px; } }

.cov-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px; font-weight: 700; letter-spacing: 2px;
  display: block; line-height: 1; margin-bottom: 4px;
}
@media (max-width: 360px) { .cov-code { font-size: 11px; letter-spacing: 1px; } }

.cov-flip {
  font-size: 10px; font-weight: 600; margin-top: 2px;
  display: inline-flex; align-items: center; gap: 3px;
  opacity: .7; transition: opacity .15s; padding: 0;
}
.cov-flip:hover { opacity: 1; }

/* ── Card back ───────────────────────────────────────────── */
.card-back {
  transform: rotateY(180deg);
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.28), 0 8px 24px rgba(0,0,0,.2);
  border-radius: 16px;
}
/* Back colors set via JS data-carte attribute */
.card-back[data-carte="1"],
.card-back[data-carte="2"] {
  background: linear-gradient(150deg, #081840 0%, #0d2050 100%);
}
.card-back[data-carte="3"] {
  background: linear-gradient(150deg, #2a1c00 0%, #3d2c08 100%);
}

.card-back-stripe {
  height: 42px; flex-shrink: 0;
  background: rgba(0,0,0,.35);
}
.card-back-body {
  flex: 1; padding: 12px 22px 0;
  display: flex; flex-direction: column; justify-content: center;
}
.card-back-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: rgba(255,255,255,.4); margin-bottom: 7px;
}
.card-back-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(18px, 5.5cqi, 28px);
  font-weight: 700; color: #fff; letter-spacing: 4px; margin-bottom: 12px;
}
.card-back-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-back-copy {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 600;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: background .15s;
  /* color/bg set via JS */
}
.card-back-hint { font-size: 11px; color: rgba(255,255,255,.3); }
.card-back-flip {
  padding: 10px 22px 12px; text-align: right; flex-shrink: 0;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.3);
  transition: color .15s;
}
.card-back-flip:hover { color: rgba(255,255,255,.65); }

/* ── Dash stats ──────────────────────────────────────────── */
.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.dash-stat {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh);
  padding: 16px; text-align: center;
}
.dash-stat.clickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dash-stat.clickable:hover { border-color: var(--teal); box-shadow: 0 4px 20px rgba(0,196,159,.1); }
.ds-value { font-size: 24px; font-weight: 700; color: var(--teal); display: flex; align-items: center; justify-content: center; line-height: 1; }
.ds-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-top: 5px; }

/* ── Section title ───────────────────────────────────────── */
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin-bottom: 10px; margin-top: 24px;
}

/* ── CTA link ────────────────────────────────────────────── */
.cta-link {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; text-align: left; width: 100%;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh);
  transition: border-color .15s, box-shadow .15s;
}
.cta-link:hover { border-color: var(--teal); box-shadow: 0 4px 20px rgba(0,196,159,.1); }
.cta-body  { flex: 1; }
.cta-title { font-size: 15px; font-weight: 600; color: var(--text); }
.cta-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cta-arrow { color: var(--light); flex-shrink: 0; transition: color .15s; }
.cta-link:hover .cta-arrow { color: var(--teal); }

/* ── Card generic ────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); }

/* ── Code card (parrainage page) ─────────────────────────── */
.code-card { padding: 22px 24px; margin-bottom: 14px; }
.cc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 10px; }
.cc-value { font-family: 'Courier New', Courier, monospace; font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: 4px; margin-bottom: 16px; }
@media (max-width: 400px) { .cc-value { font-size: 20px; letter-spacing: 2px; } }
.cc-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cc-hint    { font-size: 12.5px; color: var(--muted); }

/* ── Page header ─────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.page-header p  { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-copy {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-sm);
  background: var(--teal-bg); color: var(--teal);
  border: 1px solid rgba(0,196,159,.25);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13px; font-weight: 600;
  transition: background .15s;
}
.btn-copy:hover { background: rgba(0,196,159,.15); }

.btn-submit {
  width: 100%; padding: 13px; background: var(--teal); color: #fff;
  border-radius: var(--r-sm);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; font-weight: 700;
  transition: opacity .15s;
}
.btn-submit:hover   { opacity: .88; }
.btn-submit:active  { opacity: .8; }
.btn-submit:disabled { opacity: .4; cursor: not-allowed; }

.btn-link {
  background: none; color: var(--muted); font-size: 13px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  text-decoration: underline; text-underline-offset: 2px; padding: 0;
}
.btn-link:hover { color: var(--text); }

/* ── Member list ─────────────────────────────────────────── */
.member-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.member-item:last-child { border-bottom: none; }
.mi-avatar {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.mi-info { flex: 1; min-width: 0; }
.mi-name { font-size: 14px; font-weight: 600; color: var(--text); }
.mi-date { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.badge--green  { background: #e8faf6; color: #00916f; }
.badge--yellow { background: #fef9e7; color: #b45309; }
.badge--gray   { background: #f1f5f9; color: #64748b; }
.badge--blue   { background: #eff8ff; color: #2563eb; }

/* ── Credit list ─────────────────────────────────────────── */
.credit-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.credit-item:last-child { border-bottom: none; }
.ci-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; background: var(--teal-bg); color: var(--teal); display: flex; align-items: center; justify-content: center; }
.ci-amount { font-size: 16px; font-weight: 700; color: var(--teal); }
.ci-date   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Boutique categories ─────────────────────────────────── */
.cat-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; margin-top: 4px;
}
.cat-tab {
  padding: 7px 14px; border-radius: 100px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--white); color: var(--muted);
  transition: all .15s; white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.cat-tab:hover  { border-color: var(--teal); color: var(--teal); }
.cat-tab.active { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ── Solde bar (boutique) ────────────────────────────────── */
.solde-bar { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; margin-bottom: 20px; }
.sb-label  { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 6px; }
.sb-amount { font-size: 34px; font-weight: 700; color: var(--navy); line-height: 1; font-variant-numeric: tabular-nums; }
.sb-icon   { color: var(--teal); opacity: .35; }

/* ── Products grid ───────────────────────────────────────── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 14px; }
@media (min-width: 480px) { .products-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.product-card { overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.product-card:hover { border-color: #c5d2e0; box-shadow: var(--sh-md); }
.pc-image { width: 100%; aspect-ratio: 1; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--light); overflow: hidden; }
.pc-image img { width: 100%; height: 100%; object-fit: cover; }
.pc-body  { padding: 14px; }
.pc-name  { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 4px; }
.pc-desc  { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.pc-price { font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.pc-price span { font-size: 11px; color: var(--muted); font-weight: 500; }
.pc-stock { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.pc-btn {
  width: 100%; margin-top: 12px; padding: 9px; border-radius: var(--r-xs);
  background: var(--teal); color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13px; font-weight: 600; transition: opacity .15s;
}
.pc-btn:not(:disabled):hover { opacity: .85; }
.pc-btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }

/* ── Order item ──────────────────────────────────────────── */
.order-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.order-item:last-child { border-bottom: none; }
.oi-icon  { width: 38px; height: 38px; flex-shrink: 0; border-radius: var(--r-xs); background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.oi-name  { font-size: 14px; font-weight: 600; color: var(--text); }
.oi-date  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.oi-price { font-size: 16px; font-weight: 700; color: var(--text); text-align: right; flex-shrink: 0; }

/* ── Inner card ──────────────────────────────────────────── */
.inner-card { padding: 20px 22px; margin-bottom: 14px; }

/* ── Auth ────────────────────────────────────────────────── */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-box  { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-md); padding: 40px 36px; }
@media (max-width: 460px) { .auth-box { padding: 32px 22px; } }
.auth-logo  { text-align: center; margin-bottom: 28px; }
.auth-logo img { height: 34px; margin: auto; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-sub   { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input  {
  width: 100%; padding: 11px 14px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,196,159,.12); }
.form-input::placeholder { color: var(--light); }
.form-input:disabled { background: var(--bg); color: var(--muted); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: 13.5px; line-height: 1.5; margin-bottom: 16px; }
.alert--error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert--ok    { background: #f0fdf8; color: #059669; border: 1px solid #a7f3d0; }
.alert--info  { background: #eff8ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Loading / empty ─────────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 200px; color: var(--muted); font-size: 14px; }
.spinner { width: 18px; height: 18px; flex-shrink: 0; border: 2px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.es-icon { margin-bottom: 12px; opacity: .3; }
.es-text { font-size: 14px; line-height: 1.7; }

/* ── Toast ───────────────────────────────────────────────── */
#toast-wrap { position: fixed; bottom: 78px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
@media (min-width: 641px) { #toast-wrap { bottom: 24px; } }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 500; max-width: 280px; box-shadow: 0 4px 20px rgba(0,0,0,.2); pointer-events: auto; animation: tin .25s ease-out, tout .25s ease-in 2.75s forwards; }
.toast--err { background: #b91c1c; }
@keyframes tin  { from { opacity: 0; transform: translateX(12px); } }
@keyframes tout { to   { opacity: 0; transform: translateX(12px); } }

/* ── Page transition ─────────────────────────────────────── */
.page-enter { animation: pen .22s ease-out; }
@keyframes pen { from { opacity: 0; transform: translateY(8px); } }

/* ── Themed header/nav per carte ─────────────────────────── */
body[data-carte="1"] .header { background: #0d2050; }
body[data-carte="2"] .header { background: #1c2840; }
body[data-carte="3"] .header { background: #2c1a00; }
body[data-carte="3"] .bn-btn.active { color: #d4a84a; }

/* ── Utils ───────────────────────────────────────────────── */
.mt-4       { margin-top: 16px; }
.mb-4       { margin-bottom: 16px; }
.text-sm    { font-size: 13px; }
.text-muted { color: var(--muted); }
.flex       { display: flex; }
.items-center { align-items: center; }
.gap-2      { gap: 8px; }
.flex-1     { flex: 1; }
.min-w-0    { min-width: 0; }
