/* =========================================================
   Espace client — expérience mobile-first
   Empilement vertical, cibles tactiles larges, une action
   principale évidente par écran.
   ========================================================= */

/* Les jetons vivent sur :root — la barre d'application, le rail et la
   navigation basse sont montés hors de `.cx` (dans le layout). */
:root {
  --cx-brand: #f2ba59;
  --cx-brand-dark: #e0a231;
  --cx-brand-ink: #9a6b0f;
  --cx-brand-soft: #fdf6e9;
  --cx-ink: #16162b;
  --cx-muted: #6b7280;
  --cx-faint: #9ca3af;
  --cx-border: #ebedf3;
  --cx-surface: #ffffff;
  --cx-bg: #f6f7fb;
  --cx-radius: 18px;
  --cx-radius-sm: 12px;
  --cx-shadow: 0 1px 2px rgba(16, 24, 48, 0.04), 0 8px 24px rgba(16, 24, 48, 0.05);
  --cx-shadow-lift: 0 12px 30px rgba(16, 24, 48, 0.1);
}

.cx {
  font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
  color: var(--cx-ink);
  background: var(--cx-bg);
  min-height: 100vh;
}

/* Conteneur étroit : lecture confortable, colonne unique */
.cx-wrap {
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
  padding: 20px 16px 40px;
}

.cx-wrap--wide { max-width: 860px; }

.cx-stack { display: flex; flex-direction: column; gap: 14px; }
.cx-stack--tight { gap: 10px; }

/* Tableau de bord : empilement simple par défaut, deux colonnes ≥ 1024px */
.cx-dash,
.cx-dash__side,
.cx-dash__main { display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------
   En-tête de l'application
   --------------------------------------------------------- */
.cx-appbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--cx-border);
}

.cx-appbar__logo img { height: 46px; width: auto; display: block; }
.cx-appbar__spacer { flex: 1; }

.cx-iconbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--cx-border);
  border-radius: 50%;
  background: #fff;
  color: var(--cx-ink);
  font-size: 19px;
  transition: all 0.2s ease;
}

.cx-iconbtn:hover { border-color: var(--cx-brand); color: var(--cx-brand-ink); }

.cx-iconbtn__dot {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--cx-brand);
  color: #16162b;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
}

.cx-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f2ba59, #e0a231);
  color: #16162b;
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

/* ---------------------------------------------------------
   Bloc d'accueil
   --------------------------------------------------------- */
.cx-greeting { padding: 6px 2px 2px; }

.cx-greeting__hello {
  margin: 0;
  font-size: 13px;
  color: var(--cx-muted);
}

.cx-greeting__name {
  margin: 2px 0 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cx-ink);
}

.cx-greeting__sub {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--cx-muted);
}

/* ---------------------------------------------------------
   Carte solde + action principale
   --------------------------------------------------------- */
.cx-balance {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--cx-radius);
  background: linear-gradient(140deg, #1b1b2f 0%, #2c2c52 60%, #3a3a63 100%);
  color: #fff;
  box-shadow: var(--cx-shadow-lift);
}

.cx-balance::after {
  content: '';
  position: absolute;
  inset-inline-end: -60px;
  top: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 186, 89, 0.34), transparent 70%);
}

.cx-balance__label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

.cx-balance__value {
  position: relative;
  margin: 6px 0 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cx-balance__foot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  opacity: 0.8;
}

.cx-balance__foot a { color: var(--cx-brand); font-weight: 600; }

/* ---------------------------------------------------------
   Boutons
   --------------------------------------------------------- */
.cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cx-btn:active { transform: scale(0.985); }

.cx-btn--primary {
  background: linear-gradient(135deg, #f2ba59, #e0a231);
  color: #16162b;
  box-shadow: 0 10px 22px rgba(242, 186, 89, 0.4);
}

.cx-btn--primary:hover { color: #16162b; box-shadow: 0 14px 28px rgba(242, 186, 89, 0.5); }

.cx-btn--dark {
  background: var(--cx-ink);
  color: #fff;
  box-shadow: 0 10px 22px rgba(22, 22, 43, 0.22);
}

.cx-btn--dark:hover { color: #fff; }

.cx-btn--ghost {
  background: #fff;
  border-color: var(--cx-border);
  color: var(--cx-ink);
}

.cx-btn--ghost:hover { border-color: var(--cx-brand); color: var(--cx-brand-ink); }

.cx-btn--whatsapp {
  background: #25d366;
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 211, 102, 0.32);
}

.cx-btn--whatsapp:hover { background: #1fb955; color: #fff; }
.cx-btn--sm { min-height: 42px; font-size: 13.5px; border-radius: 11px; width: auto; padding: 0 16px; }
.cx-btn--auto { width: auto; }
.cx-btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.cx-btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cx-btn-row > * { flex: 1 1 160px; }

/* ---------------------------------------------------------
   Cartes
   --------------------------------------------------------- */
.cx-card {
  padding: 18px;
  border-radius: var(--cx-radius);
  border: 1px solid var(--cx-border);
  background: var(--cx-surface);
  box-shadow: var(--cx-shadow);
}

.cx-card--flush { padding: 0; overflow: hidden; }

.cx-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 2px 10px;
}

.cx-section-title h2 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--cx-ink);
}

.cx-section-title a {
  font-size: 13px;
  font-weight: 600;
  color: var(--cx-brand-ink);
}

/* ---------------------------------------------------------
   Résumé des commandes (3 compteurs)
   --------------------------------------------------------- */
.cx-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cx-summary__item {
  padding: 16px 12px;
  border-radius: var(--cx-radius-sm);
  border: 1px solid var(--cx-border);
  background: #fff;
  text-align: center;
  transition: all 0.2s ease;
}

.cx-summary__item:hover { border-color: var(--cx-brand); transform: translateY(-2px); }

.cx-summary__value {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--cx-ink);
  line-height: 1.1;
}

.cx-summary__label {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--cx-muted);
}

/* ---------------------------------------------------------
   Carte de commande (verticale)
   --------------------------------------------------------- */
.cx-order {
  display: block;
  padding: 16px;
  border-radius: var(--cx-radius);
  border: 1px solid var(--cx-border);
  background: #fff;
  box-shadow: var(--cx-shadow);
  transition: all 0.2s ease;
}

.cx-order:hover { border-color: var(--cx-brand); }

.cx-order__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.cx-order__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--cx-brand-soft);
  color: var(--cx-brand-ink);
  font-size: 20px;
}

.cx-order__title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--cx-ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cx-order__meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--cx-faint);
}

.cx-order__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--cx-border);
}

.cx-order__price {
  font-family: 'Montserrat', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--cx-ink);
}

.cx-order__cta {
  font-size: 13px;
  font-weight: 700;
  color: var(--cx-brand-ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ---------------------------------------------------------
   Badges de statut
   --------------------------------------------------------- */
.cx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.cx-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.cx-badge--pending    { background: #fff7e8; color: #a76a08; }
.cx-badge--processing { background: #eef4ff; color: #1d4ed8; }
.cx-badge--completed  { background: #eafaf0; color: #15803d; }
.cx-badge--partial    { background: #f5efff; color: #6d28d9; }
.cx-badge--canceled   { background: #f3f4f6; color: #4b5563; }
.cx-badge--failed     { background: #fdecec; color: #b91c1c; }

/* ---------------------------------------------------------
   Actions rapides (grille de 2)
   --------------------------------------------------------- */
.cx-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cx-quick__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border-radius: var(--cx-radius-sm);
  border: 1px solid var(--cx-border);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cx-ink);
  transition: all 0.2s ease;
}

.cx-quick__item:hover {
  border-color: var(--cx-brand);
  color: var(--cx-ink);
  transform: translateY(-2px);
  box-shadow: var(--cx-shadow);
}

.cx-quick__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--cx-brand-soft);
  color: var(--cx-brand-ink);
  font-size: 18px;
}

.cx-quick__item--whatsapp .cx-quick__icon { background: #eafaf0; color: #128c4a; }

/* ---------------------------------------------------------
   Carte « informations nécessaires »
   --------------------------------------------------------- */
.cx-action-card {
  padding: 20px;
  border-radius: var(--cx-radius);
  border: 1px solid #f4dcae;
  background: linear-gradient(140deg, #fffaf0 0%, #fff 70%);
  box-shadow: var(--cx-shadow);
}

.cx-action-card__head { display: flex; align-items: flex-start; gap: 13px; }

.cx-action-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--cx-brand);
  color: #16162b;
  font-size: 21px;
}

.cx-action-card h3 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--cx-ink);
}

.cx-action-card p {
  margin: 5px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--cx-muted);
}

.cx-action-card__list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cx-action-card__list li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--cx-ink);
}

.cx-action-card__list i { color: var(--cx-brand-ink); }
.cx-action-card__actions { margin-top: 16px; display: flex; flex-direction: column; gap: 9px; }

/* ---------------------------------------------------------
   Page de confirmation
   --------------------------------------------------------- */
.cx-success { text-align: center; padding-top: 12px; }

.cx-success__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #eafaf0;
  color: #16a34a;
  font-size: 42px;
  animation: cx-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cx-success h1 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 25px;
  font-weight: 800;
  color: var(--cx-ink);
}

.cx-success p {
  margin: 8px auto 0;
  max-width: 40ch;
  font-size: 14px;
  color: var(--cx-muted);
}

@keyframes cx-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .cx-success__check { animation: none; }
}

/* Ligne clé / valeur */
.cx-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  font-size: 13.5px;
  color: var(--cx-muted);
  border-bottom: 1px solid var(--cx-border);
}

.cx-kv:last-child { border-bottom: none; }
.cx-kv b { color: var(--cx-ink); text-align: end; font-weight: 700; }
.cx-kv--total { padding-top: 14px; font-size: 15px; }
.cx-kv--total b { font-family: 'Montserrat', sans-serif; font-size: 20px; color: var(--cx-brand-ink); }

/* Étapes suivantes */
.cx-steps { display: flex; flex-direction: column; gap: 14px; }

.cx-step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  text-align: start;
}

.cx-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cx-brand-soft);
  color: var(--cx-brand-ink);
  font-size: 12px;
  font-weight: 800;
}

.cx-step--done .cx-step__num { background: #eafaf0; color: #16a34a; }
.cx-step b { display: block; font-size: 13.5px; color: var(--cx-ink); }
.cx-step span { font-size: 12.5px; color: var(--cx-muted); }

/* ---------------------------------------------------------
   Barre d'action collante (panier, checkout)
   --------------------------------------------------------- */
.cx-sticky {
  position: sticky;
  bottom: 0;
  z-index: 55;
  margin: 18px -16px -40px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--cx-border);
}

.cx-sticky__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
  font-size: 13px;
  color: var(--cx-muted);
}

.cx-sticky__total {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--cx-ink);
}

/* Décalage quand la navigation basse est présente */
.cx-has-bottomnav .cx-sticky { bottom: 64px; }

/* ---------------------------------------------------------
   Navigation basse (mobile)
   --------------------------------------------------------- */
.cx-bottomnav {
  position: fixed;
  z-index: 70;
  inset-inline: 0;
  bottom: 0;
  display: none;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--cx-border);
  padding-bottom: env(safe-area-inset-bottom);
}

.cx-bottomnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 64px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--cx-faint);
  transition: color 0.2s ease;
}

/* Un seul mot, jamais de retour à la ligne : la barre garde sa hauteur. */
.cx-bottomnav__item span,
.cx-bottomnav__item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding-inline: 4px;
}

.cx-bottomnav__item i { font-size: 21px; }
.cx-bottomnav__item.is-active { color: var(--cx-brand-ink); }
.cx-bottomnav__item:hover { color: var(--cx-brand-ink); }

.cx-bottomnav__badge {
  position: absolute;
  margin-top: -26px;
  margin-inline-start: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--cx-brand);
  color: #16162b;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 16px;
}

@media (max-width: 767px) {
  .cx-bottomnav { display: flex; }
  .cx-has-bottomnav .cx-wrap { padding-bottom: 90px; }
}

/* ---------------------------------------------------------
   États vides et squelettes
   --------------------------------------------------------- */
.cx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 44px 22px;
  text-align: center;
}

.cx-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--cx-brand-soft);
  color: var(--cx-brand-ink);
  font-size: 30px;
}

.cx-empty h3 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--cx-ink);
}

.cx-empty p { margin: 0; max-width: 34ch; font-size: 13.5px; color: var(--cx-muted); }

.cx-skeleton {
  border-radius: var(--cx-radius);
  background: linear-gradient(90deg, #eef0f5 25%, #f7f8fb 50%, #eef0f5 75%);
  background-size: 200% 100%;
  animation: cx-shimmer 1.3s ease-in-out infinite;
}

.cx-skeleton--card { height: 128px; }
.cx-skeleton--line { height: 14px; border-radius: 7px; }

@keyframes cx-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------------------------------------------------------
   Ligne de panier
   --------------------------------------------------------- */
.cx-line {
  display: flex;
  gap: 13px;
  padding: 16px;
  border-radius: var(--cx-radius);
  border: 1px solid var(--cx-border);
  background: #fff;
  box-shadow: var(--cx-shadow);
}

.cx-line__body { flex: 1; min-width: 0; }

.cx-line__name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--cx-ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cx-line__link {
  display: block;
  margin: 4px 0 0;
  font-size: 11.5px;
  color: var(--cx-faint);
  word-break: break-all;
}

.cx-line__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.cx-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--cx-border);
  border-radius: 11px;
  overflow: hidden;
}

.cx-stepper button {
  width: 38px;
  height: 38px;
  border: none;
  background: #fff;
  color: var(--cx-ink);
  font-size: 17px;
  cursor: pointer;
}

.cx-stepper button:hover { background: var(--cx-brand-soft); color: var(--cx-brand-ink); }

.cx-stepper input {
  width: 74px;
  height: 38px;
  border: none;
  border-inline: 1px solid var(--cx-border);
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cx-ink);
  -moz-appearance: textfield;
}

.cx-stepper input::-webkit-outer-spin-button,
.cx-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cx-remove {
  border: none;
  background: none;
  color: var(--cx-faint);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
}

.cx-remove:hover { color: #b91c1c; }

/* ---------------------------------------------------------
   Formulaire
   --------------------------------------------------------- */
.cx-field { display: flex; flex-direction: column; gap: 7px; }

.cx-field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cx-ink);
}

.cx-field input,
.cx-field select,
.cx-field textarea {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  border: 1px solid var(--cx-border);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 15px; /* >= 16px évite le zoom iOS, 15 reste acceptable */
  color: var(--cx-ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cx-field textarea { min-height: 90px; resize: vertical; }

.cx-field input:focus,
.cx-field select:focus,
.cx-field textarea:focus {
  outline: none;
  border-color: var(--cx-brand);
  box-shadow: 0 0 0 4px rgba(242, 186, 89, 0.2);
}

.cx-field__hint { font-size: 11.5px; color: var(--cx-faint); }
.cx-field__ok { font-size: 11.5px; color: #15803d; font-weight: 600; }
.cx-field__err { font-size: 11.5px; color: #b91c1c; font-weight: 600; }
.cx-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cx-alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  border-radius: var(--cx-radius-sm);
  font-size: 13.5px;
  line-height: 1.5;
}

.cx-alert--error { background: #fdecec; color: #991b1b; }
.cx-alert--info { background: var(--cx-brand-soft); color: #7a5409; }
.cx-alert i { font-size: 17px; margin-top: 1px; }

/* ---------------------------------------------------------
   Aide discrète (WhatsApp en assistance, jamais imposé)
   --------------------------------------------------------- */
.cx-help {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  font-size: 13px;
  color: var(--cx-muted);
}

.cx-help a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #128c4a;
}

/* ---------------------------------------------------------
   Menu de compte (barre d'application)
   --------------------------------------------------------- */
.cx-appbar__menu { position: relative; }

.cx-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  min-width: 232px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--cx-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--cx-shadow-lift);
}

.cx-menu__head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--cx-border);
  margin-bottom: 6px;
}

.cx-menu__head strong { display: block; font-size: 13.5px; color: var(--cx-ink); }
.cx-menu__head span { font-size: 11.5px; color: var(--cx-faint); overflow-wrap: anywhere; }

.cx-menu li > a,
.cx-menu li > button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cx-ink);
  text-align: start;
  cursor: pointer;
}

.cx-menu li > a:hover,
.cx-menu li > button:hover { background: var(--cx-brand-soft); color: var(--cx-brand-ink); }
.cx-menu i { font-size: 17px; color: var(--cx-faint); width: 18px; text-align: center; }

/* ---------------------------------------------------------
   Rail latéral — desktop uniquement
   --------------------------------------------------------- */
.cx-rail { display: none; }

/* ---------------------------------------------------------
   Tablette : deux colonnes là où c'est utile
   --------------------------------------------------------- */
@media (min-width: 640px) {
  .cx-wrap { max-width: 680px; padding: 26px 22px 48px; }
  .cx-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cx-btn-row > * { flex: 1 1 200px; }
}

@media (min-width: 768px) {
  .cx-wrap { padding: 32px 24px 60px; }
  .cx-quick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cx-quick__item { flex-direction: column; align-items: flex-start; gap: 10px; }
  .cx-sticky {
    position: static;
    margin: 18px 0 0;
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
  }
  .cx-sticky__row { justify-content: flex-end; }
  .cx-btn { width: auto; min-width: 220px; }
  .cx-btn--block { width: 100%; }
  .cx-btn-row > * { flex: 0 1 auto; }
  .cx-success__check { width: 96px; height: 96px; font-size: 48px; }
  .cx-greeting__name { font-size: 28px; }
}

/* ---------------------------------------------------------
   Desktop : rail permanent + grille à deux colonnes
   --------------------------------------------------------- */
@media (min-width: 1024px) {
  .cx-rail {
    position: fixed;
    z-index: 50;
    inset-block: 66px 0;
    inset-inline-start: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    width: 244px;
    padding: 22px 14px;
    background: #fff;
    border-inline-end: 1px solid var(--cx-border);
    overflow-y: auto;
  }

  .cx-rail__nav { display: flex; flex-direction: column; gap: 4px; }

  .cx-rail__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cx-muted);
    transition: background 0.18s ease, color 0.18s ease;
  }

  .cx-rail__link i { font-size: 19px; width: 20px; text-align: center; }
  .cx-rail__link:hover { background: var(--cx-bg); color: var(--cx-ink); }

  .cx-rail__link.is-active {
    background: var(--cx-brand-soft);
    color: var(--cx-brand-ink);
    font-weight: 700;
  }

  .cx-rail__back {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-top: 8px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--cx-muted);
    transition: background 0.18s ease, color 0.18s ease;
  }

  .cx-rail__back:hover { background: var(--cx-bg); color: var(--cx-ink); }
  .cx-rail__back i { font-size: 16px; width: 20px; text-align: center; }
  [dir='rtl'] .cx-rail__back i { transform: scaleX(-1); }

  .cx-rail__foot .cx-btn {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    padding-inline: 12px;
    font-size: 13.5px;
  }

  /* Le contenu se décale pour le rail. */
  body.cx-app .cx { padding-inline-start: 244px; }
  body.cx-app .cx-appbar { padding-inline: 22px; }

  .cx-wrap { max-width: 940px; padding: 34px 30px 70px; }
  .cx-wrap--narrow { max-width: 620px; }

  /* Tableau de bord : colonne principale + colonne latérale. */
  .cx-dash {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 22px;
    align-items: start;
  }

  /* En lecture verticale le solde vient d'abord ; sur large écran il
     passe en colonne latérale à droite, la commande reste au centre. */
  .cx-dash__main { order: 1; }
  .cx-dash__side {
    order: 2;
    position: sticky;
    top: 86px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .cx-dash__side .cx-section-title:first-child { margin-top: 0; }
  .cx-dash__main > .cx-section-title:first-child { margin-top: 0; }
  .cx-summary { gap: 14px; }
  .cx-summary__value { font-size: 26px; }
}

@media (min-width: 1440px) {
  .cx-wrap { max-width: 1120px; }
  .cx-dash { gap: 28px; }
}


/* ---------------------------------------------------------
   Carte portefeuille — action principale intégrée
   --------------------------------------------------------- */
.cx-balance__pending {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #f2ba59;
}

.cx-balance__actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.cx-balance__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.cx-balance__link:hover { color: var(--cx-brand); }
.cx-balance__link i { font-size: 12px; }
.cx-btn--wide { flex: 1 1 200px; min-width: 0; }

/* ---------------------------------------------------------
   Boîte de dialogue (feuille sur mobile, boîte au-dessus)
   --------------------------------------------------------- */
.cx-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.cx-dialog__overlay {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 48, 0.42);
}

.cx-dialog__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 92vh;
  background: var(--cx-surface);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 40px rgba(16, 24, 48, 0.18);
  outline: none;
}

/* Poignée : indique que la feuille se ferme vers le bas. */
.cx-dialog__grip {
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 2px;
  background: var(--cx-border);
}

.cx-dialog__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 12px;
}

.cx-dialog__head h2 {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--cx-ink);
}

.cx-dialog__head p {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: var(--cx-muted);
}

.cx-dialog__close {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--cx-bg);
  color: var(--cx-muted);
  font-size: 17px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.cx-dialog__close:hover { background: var(--cx-brand-soft); color: var(--cx-brand-ink); }

.cx-dialog__body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 20px;
}

.cx-dialog__lead {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--cx-muted);
}

.cx-dialog__foot {
  flex-shrink: 0;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--cx-border);
  background: #fff;
  border-radius: 0 0 22px 22px;
}

.cx-dialog__foot .cx-btn { width: 100%; min-width: 0; }

/* ---------------------------------------------------------
   Sélection de montant
   --------------------------------------------------------- */
.cx-amounts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.cx-amount {
  min-height: 58px;
  border: 1.5px solid var(--cx-border);
  border-radius: var(--cx-radius-sm);
  background: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--cx-ink);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.cx-amount:hover { border-color: var(--cx-brand); }

.cx-amount.is-active {
  border-color: var(--cx-brand-dark);
  background: var(--cx-brand-soft);
  color: var(--cx-brand-ink);
}

/* Séparateur « ou » */
.cx-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--cx-faint);
}

.cx-or::before,
.cx-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--cx-border);
}

/* ---------------------------------------------------------
   Notifications
   --------------------------------------------------------- */
.cx-toasts {
  position: fixed;
  z-index: 130;
  inset-inline: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.cx-toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--cx-border);
  background: #fff;
  box-shadow: var(--cx-shadow-lift);
  pointer-events: auto;
}

.cx-toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  font-size: 17px;
}

.cx-toast--success .cx-toast__icon { background: #eafaf0; color: #15803d; }
.cx-toast--error .cx-toast__icon { background: #fdecec; color: #b91c1c; }
.cx-toast--info .cx-toast__icon { background: #eef4ff; color: #1d4ed8; }
.cx-toast--wallet .cx-toast__icon { background: var(--cx-brand-soft); color: var(--cx-brand-ink); }

.cx-toast__body { flex: 1; min-width: 0; }
.cx-toast__body strong { display: block; font-size: 13.5px; color: var(--cx-ink); }
.cx-toast__body span { display: block; margin-top: 2px; font-size: 12.5px; color: var(--cx-muted); }

.cx-toast__close {
  border: none;
  background: none;
  color: var(--cx-faint);
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
  align-self: center;
}

.cx-toast__close:hover { color: var(--cx-ink); }

/* ---------------------------------------------------------
   ≥ 640px : la feuille redevient une boîte centrée
   --------------------------------------------------------- */
@media (min-width: 640px) {
  .cx-dialog { align-items: center; padding: 24px; }

  .cx-dialog__panel {
    max-width: 460px;
    max-height: 86vh;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(16, 24, 48, 0.24);
  }

  .cx-dialog__grip { display: none; }
  .cx-dialog__head { padding-top: 20px; }
  .cx-dialog__foot { border-radius: 0 0 22px 22px; }

  .cx-amounts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cx-amount { min-height: 54px; font-size: 15px; }

  .cx-toasts {
    inset-inline: auto 20px;
    bottom: 20px;
    width: 360px;
    max-width: calc(100vw - 40px);
  }
}

/* ---------------------------------------------------------
   Bonus de recharge — annoncé avant validation
   --------------------------------------------------------- */
.cx-bonus {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: var(--cx-radius-sm);
  border: 1px dashed var(--cx-border);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--cx-muted);
}

.cx-bonus i { flex-shrink: 0; font-size: 16px; color: var(--cx-faint); }
.cx-bonus b { margin-inline-start: auto; white-space: nowrap; }

.cx-bonus.is-earned {
  border-style: solid;
  border-color: #bbf0cf;
  background: #f2fcf6;
  color: #15803d;
  font-weight: 600;
}

.cx-bonus.is-earned i { color: #15803d; }

/* ---------------------------------------------------------------------
   Moyens de paiement (recharge du portefeuille)

   La liste est administrée depuis le back-office : le nombre d'entrées
   et la longueur des libellés sont inconnus à l'écriture de ces règles.
   Rien n'est donc dimensionné en dur — les coordonnées peuvent revenir
   à la ligne, et un RIB de 24 chiffres ne pousse jamais la carte hors
   de l'écran.
--------------------------------------------------------------------- */
.cx-paysection {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--cx-border);
}

.cx-paysection__title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 14px;
  color: var(--cx-ink);
}

.cx-topup__hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--cx-muted);
}

.cx-paylist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cx-paylist__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--cx-border);
  border-radius: var(--cx-radius-sm);
  background: var(--cx-surface);
}

.cx-paylist__icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--cx-faint);
  overflow: hidden;
}

.cx-paylist__icon img { object-fit: contain; }

.cx-paylist__initials {
  font-size: 12px;
  font-weight: 700;
  color: var(--cx-brand-ink);
}

/* `min-width: 0` : sans lui, un RIB sans espace refuse de se couper et
   élargit la ligne au-delà de la boîte de dialogue. */
.cx-paylist__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cx-paylist__name {
  font-weight: 700;
  font-size: 14px;
  color: var(--cx-ink);
}

.cx-paylist__value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px dashed var(--cx-border);
  border-radius: 8px;
  background: var(--cx-bg);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}

.cx-paylist__value:hover,
.cx-paylist__value:focus-visible {
  border-color: var(--cx-brand);
  background: var(--cx-brand-soft);
}

.cx-paylist__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--cx-muted);
}

.cx-paylist__number {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cx-ink);
  word-break: break-all;
}

.cx-paylist__copy {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--cx-brand-ink);
}

.cx-paylist__note {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--cx-muted);
}
