/* ─────────────────────────────────────────────────────────────────────────────
 * DA Stancz — les 41 tokens du fichier Figma nMbTx5XtLmUNP4ugqOJENO,
 * eux-mêmes relevés dans src/app/globals.css. Aucune couleur inventée.
 * Police DM Sans (--font-refonte de globals.css).
 * ────────────────────────────────────────────────────────────────────────── */

:root {
  --fond: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --texte: #111318;
  --texte-doux: #6b7180;
  --bordure: #e3e5ea;
  --bordure-douce: rgba(17, 19, 24, 0.08);
  --ombre-carte: rgba(17, 19, 24, 0.06);
  --marque: #2d7bff;
  --marque-doux: #ebf2ff;
  --marque-fonce: #1a5be0;
  --marque-tres-fonce: #154cbf;
  --sur-marque: #ffffff;
  --sur-marque-70: rgba(255, 255, 255, 0.75);
  --alerte: #d40924;
  --or: #e0a82e;
  --or-doux: #fdf3dc;
  --info: #008793;
  --info-doux: #e0f1f2;
  --vert: #34d399;
  --voile: rgba(10, 12, 18, 0.38);
  --scene-sol: #9a9ba4;
  --scene-nuit: #232336;
  --pilule-sur-scene: rgba(255, 255, 255, 0.82);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #d8dade;
  color: var(--texte);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  padding: 26px 16px 60px;
  min-height: 100vh;
}

/* ── Cadre téléphone 390 × 844 (la cible de l'app) ───────────────────────── */
.tel {
  width: 390px;
  height: 844px;
  background: var(--fond);
  border-radius: 30px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 22px 60px -18px rgba(17, 19, 24, 0.45), 0 0 0 1px var(--bordure-douce);
  margin: 0 auto;
}

/* ── TopBar 56 (relevée sur 29-editeur-accessoires.png) ─────────────────── */
.top {
  height: 56px; flex: 0 0 56px;
  background: var(--surface);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  position: relative; z-index: 5;
}
.logo {
  width: 34px; height: 34px; border-radius: 12px;
  border: 1px solid var(--bordure);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px; color: var(--marque);
  flex: 0 0 34px;
}
.top-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.top-t b { font-size: 14px; line-height: 18px; font-weight: 700; }
.top-t span { font-size: 11px; line-height: 14px; color: var(--vert); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.top-ico { margin-left: auto; display: flex; gap: 10px; align-items: center; color: var(--texte-doux); }

/* ── Scène ───────────────────────────────────────────────────────────────── */
.scene-wrap {
  position: relative; flex: 1 1 auto; min-height: 168px;
  background: var(--scene-sol); overflow: hidden;
}
.scene-wrap svg { display: block; width: 100%; height: 100%; }
.vues {
  position: absolute; top: 52px; left: 12px;
  background: var(--pilule-sur-scene);
  border-radius: 999px; padding: 5px;
  display: flex; gap: 4px; align-items: center;
  backdrop-filter: blur(6px);
}
.vues button {
  border: 0; background: transparent; font: inherit; cursor: pointer;
  border-radius: 999px; padding: 6px 12px;
  font-size: 13px; font-weight: 600; color: var(--texte-doux);
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; line-height: 1;
}
.vues button svg { width: 14px; height: 14px; flex: 0 0 14px; }
.vues button.on { background: var(--marque); color: var(--sur-marque); }

/* Sélecteur de formation posé sur la scène : indispensable pour tester
   « attribuer à une formation », sinon on ne voit jamais l'effet. */
.fsel {
  position: absolute; top: 12px; right: 12px;
  background: var(--pilule-sur-scene);
  border-radius: 999px; padding: 5px;
  display: flex; gap: 3px; align-items: center;
  backdrop-filter: blur(6px);
}
.fsel button {
  border: 0; background: transparent; font: inherit; cursor: pointer;
  width: 26px; height: 26px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--texte-doux);
}
.fsel button.on { background: var(--marque); color: var(--sur-marque); }
.fsel button:hover:not(.on) { background: var(--surface-2); }

.scene-lab {
  position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2;
  background: var(--pilule-sur-scene); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 5px 6px 5px 10px;
  font-size: 11px; font-weight: 600; color: var(--texte);
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.scene-lab b { font-weight: 700; color: var(--marque-fonce); flex: 0 0 auto; }
/* Le nom de formation s'elide, le compteur JAMAIS : c'est lui qui dit combien
   d'accessoires la formation porte. */
.scene-lab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-lab i {
  margin-left: auto; flex: 0 0 auto; font-style: normal;
  background: var(--marque); color: var(--sur-marque);
  border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}

/* ── Feuille basse ───────────────────────────────────────────────────────── */
.sheet {
  background: var(--fond);
  border-radius: 26px 26px 0 0;
  display: flex; flex-direction: column;
  flex: 0 0 auto;
  box-shadow: 0 -8px 30px -12px rgba(17, 19, 24, 0.2);
  position: relative; z-index: 4;
  min-height: 0;
}
.grip { padding: 10px 0 8px; display: grid; place-items: center; flex: 0 0 auto; cursor: ns-resize; }
.grip i { width: 44px; height: 5px; border-radius: 3px; background: var(--bordure); display: block; }
.shead { display: flex; align-items: center; padding: 0 16px 14px 22px; gap: 10px; flex: 0 0 auto; }
.shead-t { min-width: 0; }
.shead-t h2 { font-size: 23px; line-height: 28px; font-weight: 400; }
.shead-t h2 b { font-weight: 700; }
.shead-t p { font-size: 13px; line-height: 18px; color: var(--texte-doux); }
.xbtn {
  margin-left: auto; flex: 0 0 40px;
  width: 40px; height: 40px; border-radius: 999px;
  background: var(--surface); border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--texte);
}
.sbody { overflow-y: auto; padding: 0 22px 22px; flex: 1 1 auto; min-height: 0; }
.sbody::-webkit-scrollbar { width: 0; }

/* ── TabBar 72 ───────────────────────────────────────────────────────────── */
.tabs {
  height: 72px; flex: 0 0 72px;
  background: var(--surface);
  display: flex; align-items: center; padding: 8px 0 14px;
  position: relative; z-index: 5;
}
.tabs > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tabs .pil { padding: 6px 20px; border-radius: 999px; display: grid; place-items: center; color: var(--texte-doux); }
.tabs .pil.on { background: var(--marque); color: var(--sur-marque); }
.tabs small { font-size: 11px; font-weight: 500; color: var(--texte-doux); }
.tabs .on ~ small, .tabs div:has(.pil.on) small { color: var(--marque); }

/* ── Briques communes ────────────────────────────────────────────────────── */
.sect {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--texte-doux);
  margin: 4px 0 8px; display: block;
}
.ctx {
  background: var(--marque-doux); border-radius: 14px;
  padding: 9px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; color: var(--marque-fonce);
  margin-bottom: 12px;
}
.ctx b { font-weight: 700; }
.card { background: var(--surface); border-radius: 16px; }
.thumb {
  background: var(--surface-2); border-radius: 10px;
  display: grid; place-items: center; flex: 0 0 auto; overflow: hidden;
}
.thumb i { display: block; border-radius: 3px; border: 1px solid rgba(255,255,255,0.55); }
/* Borner width/height, pas seulement flex : un SVG sans dimension CSS prend
   la taille de son conteneur flex. */
.cta svg { width: 13px; height: 13px; flex: 0 0 13px; }
.ibtn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.badge svg { width: 10px; height: 10px; flex: 0 0 10px; }
.menu svg { width: 17px; height: 17px; flex: 0 0 17px; }
.tabs svg { width: 20px; height: 20px; flex: 0 0 20px; }
.ctx svg { width: 15px; height: 15px; flex: 0 0 15px; }
.ibtn {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  border-radius: 999px; display: grid; place-items: center;
  width: 30px; height: 30px; flex: 0 0 30px; color: var(--texte-doux);
}
.ibtn.soft { background: var(--surface-2); color: var(--texte); }
.ibtn.dang { color: var(--alerte); }
.ibtn:hover { background: var(--surface-2); }
.ibtn.dang:hover { background: #fdeaec; }

.cta {
  border: 0; cursor: pointer; font: inherit;
  border-radius: 999px; padding: 8px 12px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
}
.cta.pri { background: var(--marque); color: var(--sur-marque); }
.cta.pri:hover { background: var(--marque-fonce); }
.cta.sec { background: var(--surface-2); color: var(--texte); }
.cta.sec:hover { background: var(--bordure); }

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  border-radius: 999px; padding: 3px 8px;
  font-size: 10px; font-weight: 600;
  background: var(--or-doux); color: var(--or);
}

/* Catalogue 3 colonnes */
.cat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.cat button {
  position: relative; border: 1px solid var(--bordure); background: var(--surface);
  border-radius: 14px; overflow: hidden; cursor: pointer; font: inherit;
  text-align: left; padding: 0;
  box-shadow: 0 1px 2px rgba(23,32,60,0.04), 0 6px 16px -10px rgba(23,32,60,0.16);
  transition: transform 0.12s, border-color 0.12s;
}
.cat button:hover { border-color: var(--marque); }
.cat button:active { transform: scale(0.97); }
.cat .vig { height: 58px; display: grid; place-items: center; }
.cat .vig i { display: block; border-radius: 3px; border: 1px solid rgba(255,255,255,0.55); }
.cat .lab { padding: 2px 8px 7px; }
.cat .lab b { display: block; font-size: 12px; line-height: 16px; font-weight: 800; }
.cat .lab span { display: block; font-size: 9.5px; line-height: 13px; color: var(--texte-doux); font-weight: 500; }
.cat .plus {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--marque); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.hint { font-size: 11px; line-height: 14px; color: var(--texte-doux); text-align: center; font-weight: 500; padding-top: 10px; }

/* Toast */
.toast {
  position: absolute; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: 88px; z-index: 30;
  background: var(--texte); color: #fff;
  border-radius: 999px; padding: 9px 16px;
  font-size: 12.5px; font-weight: 600;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; white-space: nowrap;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Voile + feuille modale (réglages) */
.voile {
  position: absolute; inset: 0; background: var(--voile); z-index: 20;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.voile.on { opacity: 1; pointer-events: auto; }
.modal {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21;
  background: var(--fond); border-radius: 26px 26px 0 0;
  transform: translateY(100%); transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 78%; display: flex; flex-direction: column;
}
.modal.on { transform: translateY(0); }

/* Curseurs (échelle / rotation) */
.slider { background: var(--surface); border-radius: 16px; padding: 12px 14px 13px; margin-bottom: 10px; }
.slider .l { display: flex; align-items: center; margin-bottom: 8px; }
.slider .l b { margin-left: auto; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.slider input[type=range] { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--surface-2); outline: 0; }
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 999px;
  background: var(--surface); border: 2.5px solid var(--marque); cursor: pointer;
}
.slider .ech { display: flex; justify-content: space-between; font-size: 9px; color: var(--texte-doux); margin-top: 5px; }

/* Rangées d'un menu (retirer / supprimer) */
.menu { background: var(--surface); border-radius: 16px; overflow: hidden; }
.menu button {
  width: 100%; border: 0; background: transparent; font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; text-align: left;
}
.menu button + button { border-top: 1px solid var(--bordure); }
.menu button:hover { background: var(--surface-2); }
.menu .tx { flex: 1; min-width: 0; }
.menu .tx b { display: block; font-size: 14px; line-height: 18px; font-weight: 700; }
.menu .tx span { display: block; font-size: 11px; line-height: 14px; color: var(--texte-doux); }
.menu button.dang .tx b { color: var(--alerte); }

/* ── Mode « cadre seul » (?embed=1) ──────────────────────────────────────────
 * Le banc CDP tourne dans un viewport de 390 x 844 : avec l'en-tete et le pied,
 * le telephone commence a y ~200 et sa moitie basse sort de l'ecran. Les taps
 * partaient alors dans le vide et le banc accusait le code a tort. */
body.embed { padding: 0; background: var(--fond); min-height: 0; height: 844px; overflow: hidden; }
body.embed .entete, body.embed .pied { display: none; }
body.embed .tel { border-radius: 0; box-shadow: none; }

/* ── Légende de la maquette (hors téléphone) ────────────────────────────── */
.entete { max-width: 1220px; margin: 0 auto 24px; }
.entete .fil { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7180; }
.entete h1 { font-size: 27px; line-height: 33px; font-weight: 700; margin: 4px 0 8px; }
.entete p { font-size: 14.5px; line-height: 21px; color: #4a4f5c; max-width: 760px; }
.entete .liens { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.entete .liens a {
  text-decoration: none; font-size: 12.5px; font-weight: 600;
  background: #fff; color: var(--texte); border: 1px solid var(--bordure);
  border-radius: 999px; padding: 7px 13px;
}
.entete .liens a.on { background: var(--marque); color: #fff; border-color: var(--marque); }
.entete .liens a:hover:not(.on) { border-color: var(--marque); color: var(--marque); }

.pied { max-width: 1220px; margin: 26px auto 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.pied section { background: #fff; border-radius: 16px; padding: 15px 17px; }
.pied h3 { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--texte-doux); margin-bottom: 9px; }
.pied li { font-size: 12.5px; line-height: 18px; margin-left: 15px; margin-bottom: 6px; }
.pied code { background: var(--surface-2); border-radius: 4px; padding: 1px 4px; font-size: 11.5px; }
