/* ============================================================
   FEASO — Feuille de styles principale
   Extraite de feaso.html lors de la modularisation Phase 3
   ============================================================ */

/* ============================================================
   THÈME — Modifiez ces variables pour changer les couleurs !
   ============================================================
   --accent      = couleur principale (boutons, titres, highlights)
   --accent2     = variante plus foncée de l'accent
   --accent-dim  = version transparente pour les fonds
   --warning     = couleur d'alerte (glucides, warnings)
   --bg          = fond principal
   --surface     = fond des cartes
   --surface2    = fond des inputs et zones secondaires
   --border      = couleur des bordures
   --text        = texte principal
   --text-muted  = texte secondaire
   --text-dim    = texte discret
   Charte : Navy profond + Vert forêt + Blanc épuré
============================================================ */
:root {
  /* ── FEASO Design System — identité feaso.fr ── */
  --feaso-navy:        #0F172A;
  --feaso-green:       #6E7F5F;
  --feaso-green-light: #A4B494;
  --feaso-bg:          #F8FAFC;
  --feaso-card:        #FFFFFF;
  --feaso-border:      #E2E8F0;
  --feaso-text:        #1E293B;
  --feaso-muted:       #64748B;

  /* ── Couleurs primaires — alignées sur feaso.fr ── */
  --navy:        #0F172A;        /* dark navy site vitrine */
  --navy-light:  #1C2B4A;
  --green:       #6E7F5F;        /* sage vert site vitrine */
  --green-light: #A4B494;        /* vert clair site vitrine */
  --green-pale:  #EEF2EA;

  /* ── Système de design ── */
  --accent:      #6E7F5F;        /* sage vert — feaso.fr */
  --accent-rgb:  110,127,95;
  --accent2:     #4A5E40;        /* sage foncé */
  --accent-dim:  rgba(110,127,95,0.10);
  --warning:     #D97706;
  --warning-dim: rgba(217,119,6,0.10);

  /* ── Surfaces & fonds ── */
  --bg:          #F8FAFC;        /* blanc feaso.fr */
  --surface:     #FFFFFF;        /* cartes */
  --surface2:    #F1F5F9;        /* inputs, zones secondaires */
  --surface3:    #E8EDF3;        /* fond séparateurs */

  /* ── Bordures ── */
  --border:      #E2E8F0;
  --border-muted:#EEF2F8;

  /* ── Textes ── */
  --text:        #1E293B;        /* slate-800 — feaso.fr */
  --text-muted:  #64748B;        /* slate-500 — feaso.fr */
  --text-dim:    #94A3B8;        /* slate-400 */

  /* ── Sidebar spécifique ── */
  --sidebar-bg:  #0F172A;        /* dark navy site vitrine */
  --sidebar-text:#A4B494;        /* vert clair site vitrine */
  --sidebar-dim: #4A5E6A;
  --sidebar-active:#6E7F5F;      /* sage vert */

  /* ── Géométrie ── */
  --radius:      14px;
  --radius-sm:   8px;
  --sidebar-w:   72px;

  /* ── Compatibilité anciens noms ── */
  --orange:      #D97706;
  --orange-dim:  rgba(217,119,6,0.10);
  --blue:        #3B82F6;
  --blue-dim:    rgba(59,130,246,0.10);
  --purple:      #7C3AED;
  --purple-dim:  rgba(124,58,237,0.10);
}

/* ============================================================
   THÈME SOMBRE V2 — "Precision Athletic Dark"
   Direction design 2027 — voir FIGMA_DESIGN_SYSTEM_V2.md
   Activer : document.documentElement.setAttribute('data-theme','dark')
   Ou via system preference ci-dessous
============================================================ */
[data-theme="dark"] {
  /* Backgrounds */
  --bg:          #090E0C;
  --surface:     #0F1712;
  --surface2:    #141E18;
  --surface3:    #1A2820;

  /* Accent — Electric Emerald */
  --accent:      #3EFF8A;
  --accent-rgb:  62,255,138;
  --accent2:     #1DB954;
  --accent-dim:  rgba(62,255,138,0.10);
  --accent-glow: rgba(62,255,138,0.04);

  /* Semantic */
  --warning:     #FFB830;
  --warning-dim: rgba(255,184,48,0.12);
  --danger:      #FF6B6B;
  --danger-dim:  rgba(255,107,107,0.12);

  /* Text */
  --text:        #F0EDE8;
  --text-muted:  #8A9E92;
  --text-dim:    #4A6455;

  /* Borders */
  --border:        #243028;
  --border-muted:  #1C2E24;
  --border-focus:  #3EFF8A;

  /* Sidebar */
  --sidebar-bg:    #070C0A;
  --sidebar-text:  #8A9E92;
  --sidebar-dim:   #4A6455;
  --sidebar-active:#3EFF8A;

  /* Macros legacy */
  --blue:        #60A5FA;
  --blue-dim:    rgba(96,165,250,0.12);
  --orange:      #F97316;
  --orange-dim:  rgba(249,115,22,0.12);
  --purple:      #A78BFA;
  --purple-dim:  rgba(167,139,250,0.12);

  /* Macro nutriments — couleurs sémantiques */
  --macro-protein: #60A5FA;
  --macro-carbs:   #FBBF24;
  --macro-fat:     #F97316;
  --macro-fiber:   #4ADE80;

  /* Status sémantiques */
  --status-ok:    #3EFF8A;
  --status-warn:  #FFB830;
  --status-alert: #FF6B6B;

  /* Geometry */
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   18px;
  --sidebar-w:   60px;
}

/* Respect de la préférence système */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #090E0C;
    --surface:     #0F1712;
    --surface2:    #141E18;
    --surface3:    #1A2820;
    --accent:      #3EFF8A;
    --accent2:     #1DB954;
    --accent-dim:  rgba(62,255,138,0.10);
    --accent-glow: rgba(62,255,138,0.04);
    --warning:     #FFB830;
    --warning-dim: rgba(255,184,48,0.12);
    --danger:      #FF6B6B;
    --danger-dim:  rgba(255,107,107,0.12);
    --text:        #F0EDE8;
    --text-muted:  #8A9E92;
    --text-dim:    #4A6455;
    --border:      #243028;
    --border-muted:#1C2E24;
    --sidebar-bg:  #070C0A;
    --sidebar-text:#8A9E92;
    --sidebar-dim: #4A6455;
    --sidebar-active:#3EFF8A;
    --blue:        #60A5FA;
    --blue-dim:    rgba(96,165,250,0.12);
    --orange:      #F97316;
    --orange-dim:  rgba(249,115,22,0.12);
    --purple:      #A78BFA;
    --purple-dim:  rgba(167,139,250,0.12);
    --macro-protein: #60A5FA;
    --macro-carbs:   #FBBF24;
    --macro-fat:     #F97316;
    --macro-fiber:   #4ADE80;
    --status-ok:    #3EFF8A;
    --status-warn:  #FFB830;
    --status-alert: #FF6B6B;
    --radius:      12px;
    --radius-sm:   8px;
    --radius-lg:   18px;
    --sidebar-w:   60px;
  }
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Satoshi', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- ANIMATIONS V2 ---- */
@keyframes fadeInUp {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes streakFire {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  25%       { transform: scaleY(1.06) scaleX(0.97); }
  75%       { transform: scaleY(0.97) scaleX(1.03); }
}
@keyframes macroIncrement {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes goalAchieved {
  0%   { opacity:0; transform: scale(0.6); }
  60%  { opacity:1; transform: scale(1.1); }
  100% { opacity:1; transform: scale(1); }
}

.anim-streak   { animation: streakFire 2.4s ease-in-out infinite; display:inline-block; }
.anim-goal-in  { animation: goalAchieved .4s cubic-bezier(.34,1.56,.64,1) forwards; }
.anim-macro    { animation: macroIncrement .3s ease; }

/* ============================================================
   MODE GUIDÉ — Spotlight (voir gmUpdateGeometry(), guided-mode.js)
   Un seul élément #gm-spotlight-overlay, repositionné en fixed sur le rect
   de la cible (+ targetPadding) à chaque recalcul. L'assombrissement du
   reste de l'interface utilise l'astuce du box-shadow à étalement énorme
   (9999px) : l'élément lui-même reste minuscule (taille de la cible), donc
   pointer-events:none suffit à ne JAMAIS bloquer un clic, y compris sur la
   cible elle-même durant une étape interactive — le box-shadow n'est
   jamais pris en compte par le hit-testing. Couleur alignée sur
   var(--accent) (via color-mix, jamais de vert codé en dur indépendant du
   thème). Position/dimensions : jamais de transition CSS dessus (fixées à
   chaque frame par la boucle RAF), seul le halo pulse en CSS.
   ============================================================ */
#gm-spotlight-overlay {
  position: fixed; z-index: 9150; display: none; pointer-events: none;
  border-radius: 14px;
  animation: gmSpotlightPulse 1.6s ease-in-out infinite;
}
@keyframes gmSpotlightPulse {
  0%, 100% {
    box-shadow:
      0 0 0 2.5px var(--accent),
      0 0 18px 3px color-mix(in srgb, var(--accent) 55%, transparent),
      0 0 0 9999px rgba(0,0,0,.55);
  }
  50% {
    box-shadow:
      0 0 0 2.5px var(--accent),
      0 0 32px 10px color-mix(in srgb, var(--accent) 45%, transparent),
      0 0 0 9999px rgba(0,0,0,.55);
  }
}
/* Étape de type intro (voir layout:'intro', guided-chapters.js) : même
   assombrissement mais sans anneau net ni pulsation — présentation globale
   d'un conteneur, jamais un "élément précis" à pointer du doigt. */
#gm-spotlight-overlay.gm-spotlight-intro {
  animation: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
}

/* Flèche moderne (SVG, voir index.html #gm-spotlight-arrow) pointant vers
   la cible — élément indépendant, positionné en fixed et orienté par
   rotation (guided-mode.js). Le rebond (translateY) est posé sur le SVG
   interne : composé avec la rotation du conteneur, il bondit toujours le
   long de l'axe de pointage, quel que soit le côté (haut/bas/gauche/
   droite). Jamais dessinée dans le composant ciblé. */
#gm-spotlight-arrow {
  position: fixed; z-index: 9250; display: none; pointer-events: none;
  width: 64px; height: 64px;
}
#gm-spotlight-arrow svg {
  display: block; width: 100%; height: 100%;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.45));
  animation: gmArrowBounce 1s ease-in-out infinite;
}
@keyframes gmArrowBounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(8px); }
}
@media (max-width: 480px) {
  #gm-spotlight-arrow { width: 56px; height: 56px; }
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar-bg);        /* navy profond */
  border-right: none;
  box-shadow: 2px 0 12px rgba(28,43,74,0.12);
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0; gap: 2px; z-index: 100;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.sidebar:hover { width: 220px; }

.logo {
  width: 40px; height: 40px; border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo img { width: 40px; height: 40px; object-fit: contain; display: block; }
.logo-text {
  font-family: 'Clash Display', 'DM Sans', system-ui, sans-serif;
  font-weight: 700; font-size: 18px;
  color: #FFFFFF; white-space: nowrap; opacity: 0; transition: opacity .2s;
  margin-left: 10px; letter-spacing: -.03em;
}
.logo-row { display: flex; align-items: center; width: 100%; padding: 0 15px; margin-bottom: 12px; }
.sidebar:hover .logo-text { opacity: 1; }

.nav-item {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 15px; cursor: pointer; border: none; background: none;
  color: var(--sidebar-dim); font-family: 'Satoshi', sans-serif; font-size: 13px; font-weight: 500;
  text-align: left; transition: color .15s, background .15s; border-radius: 8px;
  white-space: nowrap; overflow: hidden; position: relative;
}
.nav-item:hover {
  color: var(--sidebar-text);
  background: rgba(255,255,255,.06);
}
.nav-item.active {
  color: #FFFFFF;
  background: var(--accent);           /* vert forêt sur fond navy */
}
.nav-item .icon { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { opacity: 0; transition: opacity .15s; font-size: 13px; }
.sidebar:hover .nav-label { opacity: 1; }
.nav-sep {
  width: calc(100% - 30px); height: 1px;
  background: rgba(255,255,255,.08);
  margin: 6px 0; flex-shrink: 0;
}

/* ---- MAIN ---- */
/* Pas de z-index explicite ici : "position:relative;z-index:1" créait un
   stacking context qui piégeait toute modale (.modal-overlay, z-index
   élevé) placée à l'intérieur d'une .page — bottom-nav et widgets flottants
   passaient alors AU-DESSUS d'elle malgré leur z-index plus faible. Sans
   z-index explicite, .main ne crée plus ce plafond ; le survol du .sidebar
   (z-index:100) au-dessus du contenu reste inchangé (100 > auto). */
.main { margin-left:var(--sidebar-w); min-height:100vh; padding:32px 36px; position:relative; }
.page { display:none; animation:fadeIn .25s ease; max-width:1200px; }
.page.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
@keyframes spin    { to { transform: rotate(360deg); } }

/* ================================================================
   MODULE RECETTES PRO — styles complets
   Inspiré de Foodvisor : photo persistante, cards ingrédients,
   tableau nutrition coloré, steps visuels clairs.
   ================================================================ */

/* ---- Step indicator ---- */
.rp-step-bar { display:flex; align-items:center; justify-content:center; gap:0; margin-bottom:8px; }
.rp-step-item { display:flex; flex-direction:column; align-items:center; gap:6px; flex:1; max-width:90px; }
.rp-step-dot {
  width:32px; height:32px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:700;
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: background .25s, border-color .25s, color .25s;
  position:relative; z-index:1;
}
.rp-step-dot.done    { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.rp-step-dot.current { background: var(--accent);     border-color: var(--accent); color: var(--bg); }
.rp-step-label { font-size:10px; color:var(--text-dim); font-weight:500; text-align:center; white-space:nowrap; }
.rp-step-label.done    { color:var(--accent); }
.rp-step-label.current { color:var(--text);   font-weight:700; }
.rp-step-line { flex:1; height:2px; background:var(--border); margin-bottom:18px; transition:background .25s; }
.rp-step-line.done { background:var(--accent); }

/* ---- Zone d'upload ---- */
.rp-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.rp-upload-zone:hover { border-color: var(--accent); background: var(--accent-dim); }
.rp-upload-zone.drag-over { border-color: var(--accent); background: var(--accent-dim); }

/* ---- Vignette photo contexte (Foodvisor-style) ---- */
.rp-photo-context {
  display:none;
  border-radius:12px;
  overflow:hidden;
  margin-bottom:14px;
  border:1px solid var(--border);
  position:relative;
}
.rp-photo-context img { width:100%; max-height:200px; object-fit:cover; display:block; }
.rp-photo-context .rp-photo-badge {
  position:absolute; bottom:8px; right:8px;
  background:rgba(0,0,0,.65); backdrop-filter:blur(6px);
  color:#fff; font-size:11px; font-weight:600;
  padding:4px 10px; border-radius:20px;
}

/* ---- Ligne ingrédient ---- */
.rp-ing-card {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.rp-ing-card:hover { border-color: var(--accent); }
.rp-ing-conf {
  width:38px; height:38px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:10px; font-weight:800;
  border: 2px solid;
}
.rp-ing-conf.high   { border-color:var(--accent); color:var(--accent); background:var(--accent-dim); }
.rp-ing-conf.medium { border-color:var(--orange);  color:var(--orange);  background:rgba(255,140,66,.1); }
.rp-ing-conf.low    { border-color:#f87171;         color:#f87171;        background:rgba(248,113,113,.1); }
.rp-ing-info { flex:1; min-width:0; }
.rp-ing-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rp-ing-macros { font-size:11px; color:var(--text-dim); margin-top:2px; }
.rp-ing-ai { font-size:10px; background:rgba(255,140,66,.2); color:var(--orange); border-radius:4px; padding:1px 5px; margin-left:5px; vertical-align:middle; }
.rp-ing-qty { width:66px; padding:6px 8px; border:1px solid var(--border); border-radius:7px; background:var(--surface); color:var(--text); font-size:13px; text-align:right; font-family:inherit; }
.rp-ing-qty:focus { outline:none; border-color:var(--accent); }
.rp-ing-unit { font-size:12px; color:var(--text-muted); min-width:14px; }
.rp-ing-del { background:none; border:none; color:var(--text-dim); font-size:17px; cursor:pointer; padding:4px 6px; border-radius:6px; transition:color .15s; line-height:1; }
.rp-ing-del:hover { color:#f87171; }

/* ---- Autocomplete suggestions ---- */
.rp-suggestions {
  position:absolute; top:calc(100% + 2px); left:0; right:0;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:8px;
  z-index:300;
  max-height:220px; overflow-y:auto;
  box-shadow:0 8px 24px rgba(0,0,0,.5);
  display:none;
}
.rp-suggest-item {
  padding:9px 12px; cursor:pointer; font-size:13px;
  border-bottom:1px solid var(--border);
  display:flex; justify-content:space-between; align-items:center;
  transition:background .1s;
}
.rp-suggest-item:last-child { border-bottom:none; }
.rp-suggest-item:hover { background:var(--surface2); }
.rp-suggest-macro { font-size:11px; color:var(--text-dim); white-space:nowrap; margin-left:8px; }

/* ---- Tableau nutrition ---- */
.rp-nut-table { width:100%; border-collapse:collapse; font-size:13px; margin-top:2px; }
.rp-nut-table thead th {
  padding:7px 10px; text-align:left; font-size:11px; font-weight:600;
  color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em;
  border-bottom:1px solid var(--border);
}
.rp-nut-table thead th:not(:first-child) { text-align:right; }
.rp-nut-table tbody td {
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
}
.rp-nut-table tbody td:not(:first-child) { text-align:right; }
.rp-nut-table tbody tr:last-child td { border-bottom:none; }
.rp-nut-icon { margin-right:4px; }
.rp-nut-val-total { color:var(--text-muted); font-size:12px; }
.rp-nut-val-portion { font-weight:700; color:var(--accent); }
.rp-nut-val-portion.orange { color:var(--orange); }
.rp-nut-val-portion.purple { color:var(--purple); }

/* ---- Résumé mini-macros ---- */
.rp-macro-pill {
  display:inline-flex; align-items:center; gap:4px;
  padding:4px 10px; border-radius:20px; font-size:12px; font-weight:600;
  background:var(--surface2); border:1px solid var(--border);
}

/* ---- Form inputs dans le module ---- */
.rp-form-field { display:flex; flex-direction:column; gap:4px; }
.rp-form-label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; }
.rp-form-input {
  padding:9px 11px; border:1px solid var(--border); border-radius:8px;
  background:var(--surface); color:var(--text); font-size:13px;
  font-family:inherit; width:100%; box-sizing:border-box;
  transition:border-color .15s;
}
.rp-form-input:focus { outline:none; border-color:var(--accent); }
.rp-form-select {
  padding:9px 11px; border:1px solid var(--border); border-radius:8px;
  background:var(--surface); color:var(--text); font-size:13px;
  font-family:inherit; width:100%; box-sizing:border-box;
  cursor:pointer; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 10px center;
  padding-right:30px;
}
.rp-form-textarea {
  padding:9px 11px; border:1px solid var(--border); border-radius:8px;
  background:var(--surface); color:var(--text); font-size:13px;
  font-family:inherit; width:100%; box-sizing:border-box; resize:vertical;
}

/* ---- Preview finale (step 4) ---- */
.rp-preview-header { text-align:center; padding:16px 0 12px; }
.rp-preview-emoji  { font-size:52px; display:block; margin-bottom:8px; }
.rp-preview-name   { font-family:'Clash Display',sans-serif; font-size:18px; font-weight:700; }
.rp-preview-badges { display:flex; flex-wrap:wrap; justify-content:center; gap:6px; margin-top:8px; }
.rp-warning-banner {
  background:rgba(255,140,66,.12); border:1px solid rgba(255,140,66,.35);
  border-radius:10px; padding:12px 14px; font-size:12.5px; color:var(--text-muted);
  margin-bottom:14px;
}

/* ---- States responsive ---- */
@media (max-width:480px) {
  .rp-ing-card { flex-wrap:wrap; }
  .rp-ing-qty  { width:56px; }
  .rp-form-row { flex-direction:column; }
}

/* ---- TYPOGRAPHY ---- */
.page-title {
  font-family:'Clash Display',sans-serif; font-size:42px; font-weight:700;
  color:var(--text); line-height:1; margin:0;
  letter-spacing:-.03em;
}
.page-sub {
  color:var(--text-muted); font-size:14px; margin-top:8px; line-height:1.5;
}
.page-eyebrow {
  font-size:10.5px; font-weight:700; letter-spacing:.16em;
  text-transform:uppercase; color:var(--accent); margin-bottom:10px;
}
.section-header { display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.section-header.mb20 { margin-bottom:28px; }
.section-header.mb24 { margin-bottom:36px; }

/* ---- CARDS V2 ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .18s cubic-bezier(.4,0,.2,1), box-shadow .18s cubic-bezier(.4,0,.2,1), border-color .18s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  border-color: color-mix(in srgb, var(--border) 60%, var(--accent) 40%);
}
/* Le survol doit indiquer "cet élément est cliquable" — un .card qui n'est
   qu'un conteneur pour des boutons individuellement cliquables (ex. les
   cartes "Sous-objectif nutritionnel") ne doit pas lui-même réagir au
   survol, seuls les boutons à l'intérieur le doivent. */
.card-no-hover:hover {
  transform: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border-color: var(--border);
}
.sub-obj-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.card-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 16px; font-weight: 700;
  margin-bottom: 2px; letter-spacing: -.01em;
  color: var(--text);
}
.card-sub { color: var(--text-dim); font-size: 12px; margin-bottom: 16px; }

/* ---- BENTO GRID V2 ---- */
.g2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.g3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
.g4 { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }

/* Bento asymétrique : large (2 col) + small (1 col) */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.bento .card-2x1 { grid-column: span 2; }
.bento .card-2x2 { grid-column: span 2; grid-row: span 2; }
.bento .card-4x1 { grid-column: span 4; }
@media (max-width: 900px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .bento .card-4x1 { grid-column: span 2; }
}
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; }
  .bento .card-2x1,
  .bento .card-2x2,
  .bento .card-4x1 { grid-column: span 1; grid-row: span 1; }
}

/* ---- STAT HERO — grands chiffres V2 ---- */
.stat-pill {
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; padding:16px 18px;
  display:flex; flex-direction:column; gap:4px;
  transition: border-color .18s;
}
.stat-pill:hover { border-color: color-mix(in srgb, var(--border) 50%, var(--accent) 50%); }
.stat-label { font-size:10.5px; color:var(--text-dim); text-transform:uppercase; letter-spacing:.08em; font-weight:600; }
.stat-value { font-family:'Clash Display',sans-serif; font-size:26px; font-weight:700; line-height:1.1; }
.stat-value.hero { font-size:56px; letter-spacing:-.03em; line-height:1; }
.stat-value.xl   { font-size:40px; letter-spacing:-.025em; }
.c-accent { color:var(--accent); }
.c-orange { color:var(--orange); }
.c-blue   { color:var(--blue); }
.c-purple { color:var(--purple); }
.stat-sub { font-size:11px; color:var(--text-dim); }
.stat-trend-up   { color: var(--accent); font-size:11px; font-weight:600; }
.stat-trend-down { color: var(--warning); font-size:11px; font-weight:600; }

/* ---- AMBIENT PROGRESS RING ---- */
.ring-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.ring-label { font-size:10px; color:var(--text-dim); text-transform:uppercase; letter-spacing:.08em; font-weight:600; text-align:center; }
.ring-value { font-family:'JetBrains Mono', monospace; font-size:13px; font-weight:600; color:var(--text); }
.ring-svg { transform: rotate(-90deg); }
.ring-bg   { fill:none; stroke:var(--border); stroke-width:5; }
.ring-fill { fill:none; stroke-width:5; stroke-linecap:round; transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1), stroke .3s; }
.ring-fill.ok   { stroke: var(--accent); }
.ring-fill.warn { stroke: var(--warning); }
.ring-fill.over { stroke: var(--danger, #FF6B6B); }

/* ---- STREAK CARD ---- */
.streak-dots { display:flex; gap:6px; align-items:center; }
.streak-dot {
  width:10px; height:10px; border-radius:50%;
  background: var(--border);
  transition: background .2s;
}
.streak-dot.done { background: var(--accent); }
.streak-dot.today { background: var(--accent); box-shadow: 0 0 8px rgba(62,255,138,0.4); }

/* ---- QUICK ADD FAB ---- */
.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--bg-base, #090E0C);
  border: none; cursor: pointer; font-size: 22px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(62,255,138,0.35);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(62,255,138,0.45); }
.fab:active { transform: scale(0.94); }

/* ---- COMMAND PALETTE ---- */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.cmd-overlay.open { opacity: 1; pointer-events: auto; }
.cmd-palette {
  width: 100%; max-width: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 18px);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  transform: translateY(-8px);
  transition: transform .18s cubic-bezier(.4,0,.2,1);
}
.cmd-overlay.open .cmd-palette { transform: translateY(0); }
.cmd-input {
  width: 100%; padding: 16px 20px;
  background: transparent; border: none; outline: none;
  font-family: 'Satoshi', sans-serif; font-size: 16px; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.cmd-input::placeholder { color: var(--text-dim); }
.cmd-section-label {
  padding: 8px 16px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim);
}
.cmd-item {
  padding: 10px 16px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; transition: background .1s;
}
.cmd-item:hover, .cmd-item.selected { background: var(--surface2); }
.cmd-item-macros { font-size: 11px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

/* ---- BOTTOM NAV MOBILE ---- */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-items {
  display: flex; height: 64px; align-items: center;
  padding: 0 10px; gap: 6px;
}
.bnav-brand { display: flex; align-items: center; justify-content: center; width: 32px; flex-shrink: 0; }
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; border: none; background: none;
  color: var(--text-dim); font-family: 'Satoshi', sans-serif;
  font-size: 10px; font-weight: 500; padding: 0;
  transition: color .15s;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item .bnav-icon { font-size: 20px; }
.bottom-nav-item.bnav-add .bnav-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: var(--bg-base, #090E0C);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 300;
  box-shadow: 0 2px 12px rgba(62,255,138,0.3);
}
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: calc(20px + env(safe-area-inset-top)) 20px calc(80px + env(safe-area-inset-bottom)); }
  .fab { display: none; }
}

/* ---- DRAWER NAVIGATION MOBILE ---- */
.mobile-drawer-overlay {
  position: fixed; inset: 0; z-index: 9600;
  background: rgba(0,0,0,.6);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.mobile-drawer-overlay.open {
  opacity: 1; visibility: visible;
  transition: opacity .25s ease;
}
.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(84vw, 340px);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 9601;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 30px rgba(0,0,0,.35);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-drawer.open { transform: translateX(0); }
body.drawer-open { overflow: hidden; }
.mobile-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.mobile-drawer-brand {
  font-family: 'Clash Display', 'DM Sans', system-ui, sans-serif;
  font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -.02em;
}
.mobile-drawer-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 4px; }

/* Zone 1 — Identité (photo/initiales + prénom, jamais le rôle) */
.mobile-drawer-identity {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.drawer-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.drawer-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drawer-avatar.drawer-avatar-fallback { background: var(--surface2); color: var(--text-dim); }
.drawer-avatar.drawer-avatar-fallback svg { width: 22px; height: 22px; }
.drawer-identity-name { font-size: 15px; font-weight: 600; color: var(--text); }

/* Zones 2+3 partagent un seul conteneur défilant : le contenu garde sa hauteur
   naturelle (pas d'étirement des boutons), seul l'espace restant éventuel se
   retrouve sous "Compte" plutôt qu'au milieu de la navigation. */
.mobile-drawer-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
}
.mobile-drawer-nav {
  display: flex; flex-direction: column; flex-shrink: 0;
  padding: 4px 10px; gap: 2px;
}
#mobile-drawer-nav { padding-top: 8px; }
#mobile-drawer-account { padding-bottom: 6px; }

/* .nav-item / .nav-label sont pensés pour la sidebar sombre (icônes seules,
   libellé révélé au survol) — dans le drawer (fond clair, toujours ouvert),
   le libellé doit rester visible et les couleurs s'adapter au fond clair. */
.mobile-drawer-nav .nav-item { color: var(--text-muted); }
.mobile-drawer-nav .nav-item:hover { color: var(--text); background: var(--surface2); }
.mobile-drawer-nav .nav-label { opacity: 1; }

/* Zone 3 — étiquette de groupe ("Compte") */
.mobile-drawer-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-dim); padding: 10px 20px 4px; flex-shrink: 0;
}

.mobile-drawer-footer {
  flex-shrink: 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
/* Le bouton Déconnexion réutilise .nav-item/.nav-label mais vit dans le
   footer, hors de .mobile-drawer-nav. Sans cette surcharge, son libellé
   hérite de l'opacité 0 prévue pour la sidebar desktop repliée. */
.mobile-drawer-footer .nav-label { opacity: 1; }
.drawer-install-section { display: flex; flex-direction: column; gap: 8px; }
.drawer-install-title { font-family: 'Clash Display', sans-serif; font-size: 15px; font-weight: 700; }
.drawer-install-text, .drawer-install-status { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin: 0; }
.drawer-install-status { color: var(--text-muted); font-weight: 600; }

/* Zone 5 — "À propos" : reprend le motif titre/sous-titre/chevron déjà
   utilisé pour les lignes de réglage (ex: "Couleurs & thème" dans Paramètres). */
.drawer-info-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer;
  padding: 8px 4px; text-align: left; font-family: 'Satoshi', sans-serif;
}
.drawer-info-row-text { display: flex; flex-direction: column; gap: 2px; }
.drawer-info-row-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.drawer-info-row-sub { font-size: 11.5px; color: var(--text-muted); }
.drawer-info-row-chevron { color: var(--text-dim); font-size: 18px; }

/* ---- BUTTONS ---- */
.btn {
  display:inline-flex; align-items:center; gap:6px;
  padding:8px 16px; border-radius:8px;
  font-family:'Satoshi',sans-serif; font-size:13px; font-weight:600;
  cursor:pointer; border:none; transition:all .15s; white-space:nowrap;
  letter-spacing:.01em;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.btn-danger {
  background: transparent;
  color: #DC2626;
  border: 1px solid rgba(220,38,38,.25);
}
.btn-danger:hover { background: rgba(220,38,38,.06); }
.btn-sm { padding: 5px 11px; font-size: 11.5px; border-radius: 6px; }

/* ---- TABS — underline editorial style ---- */
.tabs {
  display:flex; gap:0; overflow-x:auto;
  border-bottom:1.5px solid var(--border);
  padding:0; background:none; border-radius:0; margin-bottom:28px;
}
.tab {
  flex:0; padding:10px 22px; font-size:13px; font-weight:600;
  color:var(--text-dim); background:none; border:none;
  border-bottom:2.5px solid transparent; margin-bottom:-1.5px;
  cursor:pointer; white-space:nowrap; letter-spacing:.01em;
  border-radius:0; transition:color .15s, border-color .15s;
  box-shadow:none; text-align:left;
}
.tab:hover { color:var(--text-muted); background:none; }
.tab.active {
  color:var(--accent); border-bottom-color:var(--accent);
  background:none; box-shadow:none;
}

/* ---- PROGRESS / MACRO BAR ---- */
.macro-row { display:flex; flex-direction:column; gap:9px; }
.macro-item { display:flex; flex-direction:column; gap:5px; }
.macro-head { display:flex; justify-content:space-between; font-size:12px; }
.macro-name { color:var(--text-dim); }
.macro-val { font-weight:600; }
.macro-bar { height:4px; background:var(--surface2); border-radius:2px; overflow:hidden; }
.macro-fill { height:100%; border-radius:2px; transition:width .6s cubic-bezier(.4,0,.2,1); }
.f-accent  { background:var(--accent); }
.f-orange  { background:var(--orange); }
.f-blue    { background:var(--blue); }
.f-purple  { background:var(--purple); }

/* ---- BADGE ---- */
.badge { display:inline-flex; align-items:center; gap:4px; padding:2px 9px; border-radius:20px; font-size:11px; font-weight:600; letter-spacing:.02em; }
.badge-accent { background:var(--accent-dim); color:var(--accent); }
.badge-orange { background:var(--orange-dim); color:var(--orange); }
.badge-blue   { background:var(--blue-dim); color:var(--blue); }
.badge-red    { background:rgba(255,80,80,0.10); color:#ff5050; }
.badge-gray   { background:var(--surface2); color:var(--text-dim); }

/* ---- INPUTS ---- */
.field { display:flex; flex-direction:column; gap:5px; }
.field label { font-size:12px; color:var(--text-dim); font-weight:500; letter-spacing:.02em; }
.field input, .field select, .field textarea {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:8px; padding:9px 12px;
  color:var(--text); font-family:'Satoshi',sans-serif; font-size:13px;
  outline:none; transition:border-color .15s; -webkit-appearance:none;
  width:100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field select option { background: var(--surface2); color: var(--text); }
.field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.field input::placeholder { color: var(--text-dim); }

/* ---- ALIMENTS ---- */
.aliment-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; max-height:420px; overflow-y:auto; }
.aliment-card {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:14px 12px;
  cursor:pointer; transition:all .18s; position:relative; overflow:hidden; text-align:center;
}
.aliment-card:hover { border-color:var(--accent); transform:translateY(-2px); }
.aliment-card.selected { border-color:var(--accent); background:var(--accent-dim); }
.aliment-card .food-emoji { font-size:28px; margin-bottom:6px; display:block; }
.aliment-card .food-name { font-size:12px; font-weight:600; margin-bottom:3px; line-height:1.3; }
.aliment-card .food-cal { font-size:10.5px; color:var(--text-muted); }
.aliment-card .check { position:absolute; top:7px; right:7px; width:18px; height:18px; border-radius:50%; background:var(--accent); color:var(--bg); display:none; align-items:center; justify-content:center; font-size:10px; font-weight:700; }
.aliment-card.selected .check { display:flex; }

/* ---- RECETTES ---- */
.recette-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; transition:all .2s; cursor:pointer; }
.recette-card:hover { border-color:var(--accent); transform:translateY(-3px); box-shadow:0 12px 40px rgba(0,0,0,.4); }
.recette-thumb { height:130px; display:flex; align-items:center; justify-content:center; font-size:52px; position:relative; }
.recette-body { padding:14px; }
.recette-name { font-family:'Clash Display',sans-serif; font-size:15px; font-weight:600; margin-bottom:6px; line-height:1.3; }
.recette-macros { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:8px; }
.rtag { font-size:10.5px; padding:2px 7px; border-radius:5px; font-weight:500; }
.tag-price { background:rgba(22,163,74,.11); color:var(--green); border:1px solid rgba(22,163,74,.18); }
.recipe-price-detail { background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:12px 14px; margin:-4px 0 16px; }
.recipe-price-title { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.07em; font-weight:700; margin-bottom:7px; }
.recipe-price-values { display:flex; align-items:baseline; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.recipe-price-values strong { color:var(--green); font-family:'Clash Display',sans-serif; font-size:17px; }
.recipe-price-values span { color:var(--text); font-size:13px; font-weight:600; }
.recipe-price-coverage, .recipe-price-note, .recipe-price-warning { font-size:11px; color:var(--text-dim); margin-top:6px; line-height:1.45; }
.recipe-price-warning { color:var(--orange); font-weight:600; }

/* ---- Abonnement Sportif ---- */
.subscription-current-card { display:grid; grid-template-columns:minmax(220px,.8fr) minmax(260px,1.2fr); gap:24px; align-items:center; padding:22px; margin-bottom:24px; border-radius:var(--radius); color:#fff; background:linear-gradient(135deg,var(--navy),#1C2B4A); box-shadow:0 12px 32px rgba(15,23,42,.16); }
.subscription-eyebrow { color:var(--green-light); font-size:10px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; margin-bottom:5px; }
.subscription-current-name { font-family:'Clash Display',sans-serif; font-size:24px; font-weight:800; }
.subscription-current-price { color:var(--green-light); font-size:16px; font-weight:700; margin-top:3px; }
.subscription-selected-at { color:rgba(255,255,255,.55); font-size:11px; margin-top:7px; }
.subscription-current-features { display:flex; flex-direction:column; gap:8px; }
.payment-feature-list { display:flex; flex-direction:column; gap:8px; margin-bottom:20px; flex:1; }
.payment-feature-row { display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text); }
.payment-feature-row > span:first-child { flex-shrink:0; font-size:14px; font-weight:700; }
.payment-feature-row.is-included > span:first-child { color:var(--accent); }
.payment-feature-row.is-excluded { color:var(--text-dim); }
.subscription-current-card .payment-feature-row { color:rgba(255,255,255,.88); }
.subscription-current-card .payment-feature-row.is-included > span:first-child { color:var(--green-light); }
.subscription-comparison { margin-bottom:20px; padding:0; overflow:hidden; }
.subscription-comparison summary { cursor:pointer; list-style:none; padding:16px 18px; font-family:'Clash Display',sans-serif; font-size:15px; font-weight:700; display:flex; justify-content:space-between; align-items:center; }
.subscription-comparison summary::-webkit-details-marker { display:none; }
.subscription-comparison summary::after { content:'+'; color:var(--accent); font-size:20px; font-family:'Satoshi',sans-serif; }
.subscription-comparison[open] summary::after { content:'−'; }
.subscription-comparison-grid { display:grid; grid-template-columns:minmax(180px,1.4fr) repeat(3,minmax(110px,1fr)); border-top:1px solid var(--border); }
.subscription-comparison-grid > div { padding:10px 12px; border-bottom:1px solid var(--border); }
.comparison-head { color:var(--text-muted); background:var(--surface2); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; text-align:center; }
.comparison-head:first-child { text-align:left; }
.comparison-feature { font-size:12.5px; font-weight:600; }
.comparison-value { text-align:center; color:var(--text-dim); font-size:12.5px; }
.comparison-value.is-positive { color:var(--accent); font-weight:800; }
.subscription-info-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.subscription-info-grid .card { margin:0; }
.subscription-prepay-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.subscription-prepay-option { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px; }
.subscription-prepay-head { display:flex; align-items:center; justify-content:space-between; gap:6px; font-size:12px; }
.subscription-prepay-head span { color:#fff; border-radius:20px; padding:2px 7px; font-size:9px; font-weight:700; white-space:nowrap; }
.subscription-prepay-head span.is-standard { color:var(--text-dim); background:transparent; padding:0; font-weight:500; }
.subscription-prepay-price { color:var(--accent); font-family:'Clash Display',sans-serif; font-size:18px; font-weight:800; margin-top:10px; }
.subscription-prepay-price small { color:var(--text-muted); font-family:'Satoshi',sans-serif; font-size:10px; font-weight:500; }
.subscription-prepay-total { color:var(--text-muted); font-size:11px; margin-top:5px; }
.subscription-prepay-saving { color:#16a34a; font-size:10px; font-weight:700; margin-top:3px; }

@media (max-width: 768px) {
  .subscription-current-card { grid-template-columns:1fr; gap:16px; }
  .subscription-prepay-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 640px) {
  .subscription-comparison-grid { display:block; padding:0 14px 12px; }
  .subscription-comparison-grid .comparison-head { display:none; }
  .subscription-comparison-grid .comparison-feature { padding:13px 0 7px; border-bottom:none; }
  .subscription-comparison-grid .comparison-value { display:flex; align-items:center; justify-content:space-between; padding:5px 0; border-bottom:1px solid var(--border); text-align:right; }
  .subscription-comparison-grid .comparison-value::before { content:attr(data-plan); color:var(--text-muted); font-weight:500; }
  .subscription-info-grid, .subscription-prepay-grid { grid-template-columns:1fr; }
}
.tag-kcal { background:var(--orange-dim); color:var(--orange); }
.tag-p    { background:var(--accent-dim); color:var(--accent); }
.tag-g    { background:var(--blue-dim); color:var(--blue); }
.tag-l    { background:var(--purple-dim); color:var(--purple); }
.tag-moment { background:var(--surface2); color:var(--text-muted); border:1px solid var(--border); }
.recette-time { font-size:11.5px; color:var(--text-dim); }
.recette-edit-btn { position:absolute; top:8px; right:8px; background:rgba(0,0,0,.5); border:none; color:var(--text); height:26px; padding:0 10px; border-radius:7px; cursor:pointer; font-size:11px; font-weight:600; display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .2s; white-space:nowrap; }
.recette-card:hover .recette-edit-btn { opacity:1; }

/* ---- COLLATIONS ---- */
.collation-card { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px; display:flex; gap:14px; transition:border-color .2s; }
.collation-card:hover { border-color:var(--orange); }

/* ---- PLANNING ---- */
.week-grid { display:grid; grid-template-columns:80px repeat(7,1fr); gap:1px; background:var(--border); border-radius:var(--radius); overflow:hidden; min-width:700px; }
.wg-cell { background:var(--surface); padding:10px; font-size:11.5px; min-width:0; }
.wg-head { background:var(--surface2); font-family:'Clash Display',sans-serif; font-size:12px; font-weight:600; color:var(--accent); text-align:center; padding:10px 6px; }
.wg-label { background:var(--surface2); color:var(--text-muted); font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; display:flex; align-items:center; padding:10px; }
.wg-meal { cursor:pointer; transition:background .15s; color:var(--text-muted); line-height:1.4; }
.wg-meal:hover { background:var(--accent-dim); color:var(--accent); }
.wg-meal.wg-meal-locked { background:var(--surface); }
.wg-meal.wg-meal-locked:hover { background:var(--surface2); color:var(--text-muted); }
.wg-meal .m-name { font-weight:600; color:var(--text); font-size:11px; }
.wg-meal .m-kcal { font-size:10px; color:var(--text-dim); margin-top:2px; }
.wg-plan-paywalled { position:relative; min-height:54px; cursor:pointer; overflow:hidden; background:var(--surface2); }
.wg-plan-paywalled:hover { background:var(--accent-dim); }
.wg-plan-blur { position:absolute; inset:7px; border-radius:7px; background:repeating-linear-gradient(180deg,var(--text-dim) 0 5px,transparent 5px 12px); filter:blur(3px); opacity:.28; }
.wg-plan-lock { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:16px; filter:none; opacity:.95; }
.wg-plan-paywalled-head { opacity:.72; }
.wg-plan-paywall-lock { position:absolute;top:2px;right:2px;background:none;border:none;cursor:pointer;font-size:11px;padding:2px;line-height:1;color:inherit; }

/* Empêche la sélection de texte et le menu contextuel natif iOS (loupe/
   "Copier") pendant l'appui long qui ouvre le menu d'actions — sans ça,
   le geste déclenchait parfois la sélection de texte du navigateur au lieu
   du menu FEASO. S'applique aussi à la grille coach (.cpm-meal-cell). */
.wg-meal, .cpm-meal-cell {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---- PLANNING — glisser-déposer d'un repas vers un autre créneau ---- */
.wg-meal[draggable="true"] { cursor:grab; }
.wg-meal.wg-dragging { opacity:.4; }
.wg-meal.wg-drop-target { outline:2px dashed var(--accent); outline-offset:-2px; background:var(--accent-dim); }

/* ---- PLANNING — cases vides : 3 micro-actions discrètes ---- */
.wg-empty-actions { display:flex; flex-direction:column; align-items:center; }
.wg-empty-actions > div { padding:3px 4px; }
/* Cibles tactiles un peu plus généreuses sur mobile (les 3 liens empilés
   sont sinon trop serrés pour un doigt) */
@media (max-width: 768px) {
  .wg-empty-actions > div { padding:6px 4px; min-height:20px; }
}

/* ---- PLANNING — case sélectionnée (sélection multiple) ---- */
.wg-cell-selected, .cpm-meal-cell.wg-cell-selected { outline:2px solid var(--accent); outline-offset:-2px; background:var(--accent-dim); }

/* ---- PLANNING — badge de verrouillage ---- */
.wg-lock-badge { position:absolute; top:3px; left:3px; font-size:10px; opacity:.75; line-height:1; }

/* ---- PLANNING — badge de contexte (LOT 4, docs/lot4-plan.md) ---- */
.wg-context-badge { position:absolute; bottom:3px; right:3px; font-size:11px; opacity:.85; line-height:1; }

/* ---- PLANNING — menu d'actions générique (repas / journée / glisser-déposer) ---- */
.planning-menu {
  position:fixed; z-index:9700; min-width:190px; max-width:260px;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm);
  box-shadow:0 8px 28px rgba(0,0,0,.28); padding:6px; display:flex; flex-direction:column; gap:1px;
}
.planning-menu-item {
  display:block; width:100%; text-align:left; background:none; border:none; cursor:pointer;
  padding:8px 10px; border-radius:7px; font-family:'Satoshi',sans-serif; font-size:13px; color:var(--text);
  transition:background .12s;
}
.planning-menu-item:hover:not(.disabled) { background:var(--surface2); }
.planning-menu-item.danger { color:#f87171; }
.planning-menu-item.disabled { opacity:.4; cursor:not-allowed; }
.planning-menu-sep { height:1px; background:var(--border); margin:4px 2px; }

/* ---- PLANNING — barre flottante de sélection multiple ---- */
.plan-selection-bar {
  position:fixed; left:50%; bottom:24px; transform:translateX(-50%); z-index:500;
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm);
  box-shadow:0 8px 24px rgba(0,0,0,.25); padding:10px 14px;
}
.plan-selection-bar .plan-sel-count { font-size:12.5px; color:var(--text-muted); font-weight:600; white-space:nowrap; }

/* ---- PLANNING — bibliothèque de repas (presse-papiers persistant) ---- */
.meal-library-item {
  display:flex; align-items:center; gap:10px; padding:8px 10px;
  background:var(--surface2); border:1px solid var(--border); border-radius:8px; cursor:grab;
}
.meal-library-item-name { flex:1; font-size:12.5px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.meal-library-item-kcal { font-size:11px; color:var(--text-dim); flex-shrink:0; }
.meal-library-item-remove { background:none; border:none; color:var(--text-dim); cursor:pointer; font-size:11px; padding:2px 4px; flex-shrink:0; }
.meal-library-item-remove:hover { color:#f87171; }

/* ---- COURSES ---- */
.course-cat { margin-bottom:18px; }
.course-cat-title { font-family:'Clash Display',sans-serif; font-size:13px; font-weight:600; color:var(--accent); margin-bottom:8px; text-transform:uppercase; letter-spacing:.07em; }
.course-item { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--border); }
.course-check { width:19px; height:19px; border:2px solid var(--border); border-radius:5px; cursor:pointer; flex-shrink:0; transition:all .18s; display:flex; align-items:center; justify-content:center; }
.course-check.done { background:var(--accent); border-color:var(--accent); }
.course-check.done::after { content:'✓'; font-size:10px; color:var(--bg); font-weight:700; }

/* ---- MODAL ---- */
/* z-index:9500 (et non 200) : doit passer au-dessus des widgets flottants
   (chat Kracotte, "Signaler un problème", recette épinglée — z-index:9000)
   sinon ils recouvrent la modale et bloquent les taps sur mobile. */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.75); display:none; align-items:center; justify-content:center; z-index:9500; padding:20px; backdrop-filter:blur(4px); }
.modal-overlay.open { display:flex; }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:26px; width:100%; max-width:580px; max-height:85vh; overflow-y:auto; }
.modal-title { font-family:'Clash Display',sans-serif; font-size:21px; font-weight:700; margin-bottom:3px; }
.modal-close { float:right; background:none; border:none; color:var(--text-muted); font-size:20px; cursor:pointer; line-height:1; }

/* L'éditeur de repas dépasse souvent 85vh (ingrédients + boissons + contexte) —
   sans ceci, le bouton fermer (float:right, donc dans le flux normal) scrolle
   avec le contenu et disparaît, ne laissant que "Enregistrer" pour quitter. */
#meal-editor-modal .modal { position:relative; }
#meal-editor-modal .modal-close { position:absolute; top:14px; right:14px; z-index:2; float:none; width:30px; height:30px; display:grid; place-items:center; border-radius:50%; background:var(--surface2); }

/* ---- DIVIDER ---- */
.divider { height:1px; background:var(--border); margin:18px 0; }

/* ---- SEARCH ---- */
.search-bar { display:flex; gap:10px; align-items:center; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:9px 14px; margin-bottom:16px; }
.search-bar input { flex:1; background:none; border:none; outline:none; color:var(--text); font-family:'Satoshi',sans-serif; font-size:13.5px; }

/* ---- TOAST ---- */
.toast { position:fixed; bottom:28px; right:28px; background:var(--surface); border:1px solid var(--accent); border-radius:var(--radius-sm); padding:12px 18px; font-size:13.5px; color:var(--accent); transform:translateY(80px); opacity:0; transition:all .28s cubic-bezier(.4,0,.2,1); z-index:999; pointer-events:none; }
.toast.show { transform:none; opacity:1; }

/* ---- NAP TABLE ---- */
.nap-table { width:100%; border-collapse:collapse; font-size:13px; }
.nap-table th { background:var(--surface2); padding:10px 14px; text-align:left; font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.07em; font-weight:600; }
.nap-table td { padding:10px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
.nap-table tr.active-row td { background:var(--accent-dim); }
.nap-table tr.active-row td:first-child { border-left:3px solid var(--accent); }
.nap-row-label { font-weight:600; color:var(--text); }
.nap-row-desc  { color:var(--text-muted); font-size:12px; line-height:1.4; }
.nap-val { font-family:'Clash Display',sans-serif; font-size:16px; font-weight:700; color:var(--accent); }

/* ---- THEME PICKER ---- */
.theme-swatch { width:32px; height:32px; border-radius:50%; cursor:pointer; border:3px solid transparent; transition:all .18s; flex-shrink:0; }
.theme-swatch.active { border-color:var(--text); transform:scale(1.15); }
.theme-swatch:hover { transform:scale(1.1); }

/* ---- MISC & UTILITIES ---- */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
.progress { height:7px; background:var(--surface2); border-radius:4px; overflow:hidden; margin-top:5px; }
.progress-fill { height:100%; border-radius:4px; transition:width .7s cubic-bezier(.4,0,.2,1); }
.section-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.mb16 { margin-bottom:16px; }
.mb20 { margin-bottom:20px; }
.mb24 { margin-bottom:24px; }
.gap8  { gap:8px; }
.gap12 { gap:12px; }
.gap16 { gap:16px; }
.flex  { display:flex; }
.flex-col { flex-direction:column; }
.items-center { align-items:center; }
.justify-between { justify-content:space-between; }
.w100 { width:100%; }
.text-center { text-align:center; }

@media(max-width:1000px){.g3{grid-template-columns:1fr 1fr;}.g4{grid-template-columns:1fr 1fr;} #cdb-main-grid{grid-template-columns:1fr!important;}}
/* .g4 reste en 2×2 sur mobile — mieux que 4×1 pour stat-pills et champs nutriments */
@media(max-width:650px){.g2,.g3{grid-template-columns:1fr;}.g4{grid-template-columns:1fr 1fr;} #cdb-main-grid{grid-template-columns:1fr!important;}}

/* ============================================================
   RESPONSIVE MOBILE FIRST — Compléments (≤768px déjà géré)
   ============================================================ */

/* ---- Bottom-nav : icônes SVG ---- */
.bottom-nav-item .bnav-icon svg { width:22px; height:22px; }

/* ---- Fix padding-bottom : préserver 80px pour la bottom-nav ---- */
/* Marges latérales un peu plus généreuses que le strict minimum (16/14px)
   pour que le contenu ne colle pas au contour arrondi de l'écran.
   safe-area-inset-top/bottom : avec viewport-fit=cover (index.html), le
   contenu s'étend sous l'encoche/la barre d'état et sous la zone de la
   poignée d'accueil iOS si on ne les ajoute pas explicitement — sans ça,
   le titre de page passe sous l'heure/l'encoche en haut, et le bas du
   contenu peut se retrouver masqué par la bottom-nav sur les appareils
   avec une zone de sécurité basse plus grande (poignée d'accueil). */
@media (max-width: 768px) {
  .main { padding: calc(20px + env(safe-area-inset-top)) 20px calc(88px + env(safe-area-inset-bottom)); }
}
@media (max-width: 650px) {
  .main { padding: calc(16px + env(safe-area-inset-top)) 18px calc(88px + env(safe-area-inset-bottom)); }
}

/* ---- Toast au-dessus de la bottom-nav sur mobile ---- */
/* + env(safe-area-inset-bottom) : la bottom-nav occupe réellement
   64px + env(safe-area-inset-bottom) en bas de l'écran (voir .bottom-nav
   ci-dessus et .main juste au-dessus) — sans cette marge, le toast chevauche
   visuellement la bottom-nav sur les appareils avec une zone de sécurité
   basse (poignée d'accueil iOS). Même pattern déjà utilisé par
   .plan-selection-bar juste en dessous. */
@media (max-width: 768px) {
  .toast { bottom: calc(64px + 16px + env(safe-area-inset-bottom)); right: 16px; max-width: calc(100vw - 32px); }
}

/* ---- Barre de sélection planning au-dessus de la bottom-nav sur mobile
   (sinon elle masque les dernières lignes du tableau et/ou la bottom-nav) ---- */
@media (max-width: 768px) {
  .plan-selection-bar {
    left:16px; right:16px; transform:none; bottom:calc(64px + 16px + env(safe-area-inset-bottom));
    max-width:calc(100vw - 32px); justify-content:center;
  }
}

/* ---- Typographie responsive ---- */
@media (max-width: 640px) {
  .page-title { font-size: 26px; }
  .stat-value.hero { font-size: 38px; }
  .stat-value.xl   { font-size: 28px; }
}

/* ---- Cartes : padding réduit sur mobile ---- */
@media (max-width: 640px) {
  .card { padding: 16px 14px; }
}

/* ---- Modal : full-width sur mobile ---- */
@media (max-width: 640px) {
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal {
    padding: 18px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    max-width: 100%;
    max-height: 90vh;
  }
}

/* ---- Grille planning : cellules plus compactes sur mobile ---- */
@media (max-width: 768px) {
  .week-grid { grid-template-columns: 55px repeat(7, minmax(62px, 1fr)); min-width: 490px; }
  .wg-cell  { padding: 6px 4px; }
  .wg-head  { padding: 7px 3px; font-size: 10px; }
  .wg-label { padding: 6px 5px; font-size: 9px; }
  .wg-meal .m-name { font-size: 10px; }
  .wg-meal .m-kcal { font-size: 9px; }
}

/* ---- Aliments grid : 2 colonnes minimum sur mobile ---- */
@media (max-width: 480px) {
  .aliment-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ---- NutriBot panel : largeur contrainte sur mobile ---- */
@media (max-width: 480px) {
  #nb-panel { width: calc(100vw - 32px) !important; right: 16px !important; max-height: 50vh; }
}

/* ---- Section headers : pas de wrap bizarre sur mobile ---- */
@media (max-width: 480px) {
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* ---- Boutons : padding confort tactile sur mobile ---- */
@media (max-width: 640px) {
  .btn { padding: 9px 14px; min-height: 40px; }
  .btn-sm { padding: 7px 12px; min-height: 34px; }
}

/* ---- Tablettes : sidebar toujours visible, bottom-nav/drawer masqués ---- */
@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .sidebar    { display: flex !important; }
  .mobile-drawer-overlay, .mobile-drawer { display: none !important; }
}

/* ---- Login : role cards empilées sur mobile ---- */
@media (max-width: 480px) {
  .role-card { min-width: 100%; max-width: 100%; }
  .role-cards { flex-direction: column; }
}

/* ============================================================
   DASHBOARD — Responsive mobile
   ============================================================ */

/* Stat-pills : valeurs et padding réduits sur mobile */
@media (max-width: 640px) {
  .stat-value { font-size: 22px; }
  .stat-pill  { padding: 12px 14px; }
}

/* Section header : côté droit ne déborde pas sur mobile */
/* !important nécessaire pour override les styles inline de updateDashboard() */
@media (max-width: 640px) {
  #page-dashboard .section-header > div:last-child {
    flex-shrink: 1 !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  #dash-obj-encart > div,
  #dash-countdown-wrap > div {
    min-width: 0 !important;
    box-sizing: border-box;
    max-width: 100%;
  }
}

/* Sur très petit écran : obj-encart prend toute la largeur */
@media (max-width: 480px) {
  #page-dashboard .section-header > div:last-child {
    align-items: flex-start !important;
    width: 100% !important;
  }
  #dash-obj-encart > div,
  #dash-countdown-wrap > div {
    text-align: left;
    width: 100%;
  }
  /* dash-obj-encart-wrap : depuis la revue UX 2026-09-02, l'encart objectif
     n'est plus un item de la colonne flex du header (qui le forçait en
     pleine largeur via align-items ci-dessus / experience.css ≤768px) mais
     vit seul en bas de page — display:block reproduit le même effet pleine
     largeur pour la règle #dash-obj-encart > div juste au-dessus. */
  #dash-obj-encart-wrap { display: block !important; }
}

/* Activités du jour : items lisibles sur mobile */
@media (max-width: 480px) {
  #dash-activities-list > div { flex-wrap: wrap; gap: 4px; }
}

/* Assiette FEASO : tableau ratios compact sur très petit écran */
@media (max-width: 360px) {
  #assiette-content { font-size: 11px; }
}

/* ============================================================
   PLANNING — Responsive mobile
   ============================================================ */

/* Stat-pills planning en 2×2 sur mobile */
@media (max-width: 650px) {
  #page-planning .g4 { grid-template-columns: 1fr 1fr !important; }
}

/* Section header planning : boutons wrappent sur mobile */
@media (max-width: 480px) {
  #page-planning .section-header > div:last-child { flex-wrap: wrap; }
}

/* Scroll container : touch fluide, padding réduit */
@media (max-width: 768px) {
  #planning-grid-card {
    padding: 4px;
    -webkit-overflow-scrolling: touch;
  }
}

/* Fix chevauchement boutons absolus sur cellules repas mobiles.
   padding-right:26px inline est overridé : les boutons passent en bas-droite */
@media (max-width: 768px) {
  .wg-meal > div:first-child { padding-right: 0 !important; }
  .wg-meal > button:first-of-type {
    top: auto !important;
    bottom: 2px !important;
    right: 18px !important;
    font-size: 12px !important;
    opacity: 0.6;
  }
  .wg-meal > button:last-of-type {
    top: auto !important;
    bottom: 2px !important;
    right: 2px !important;
    font-size: 12px !important;
    opacity: 0.6;
  }
}

/* Total row : compact sur mobile via classe .wg-total ajoutée en JS */
@media (max-width: 768px) {
  .wg-total { padding: 4px 3px !important; }
}
@media (max-width: 480px) {
  /* Grille encore plus compacte sur très petit écran */
  .week-grid {
    grid-template-columns: 44px repeat(7, minmax(52px, 1fr));
    min-width: 412px;
  }
  .wg-head  { padding: 6px 2px; font-size: 9px; }
  .wg-label { padding: 5px 3px; font-size: 8px; }
  .wg-meal .m-name { font-size: 9px; }
  .wg-meal .m-kcal { font-size: 8px; }
}

/* ============================================================
   FORMULAIRES — Responsive mobile
   ============================================================ */

/* Onglets : touch target confortable sur mobile */
@media (max-width: 640px) {
  .tab { padding: 10px 14px; font-size: 12px; }
}

/* Modal séance — bottom-sheet sur mobile (comme les autres modals) */
@media (max-width: 640px) {
  #modal-add-workout {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #modal-add-workout > div {
    border-radius: var(--radius) var(--radius) 0 0 !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    padding: 20px 16px !important;
  }
}

/* Intensité séance : 4 boutons confortables même sur 320px */
@media (max-width: 380px) {
  .wo-intensity-btn { font-size: 11px !important; padding: 8px 2px !important; }
}

/* Recettes : filtres wrappent en colonne sur mobile */
@media (max-width: 640px) {
  #page-recettes .section-header > div:last-child { width: 100%; }
  #recette-mealtype-filter-btn, #recette-restriction-filter-btn { min-width: 0 !important; width: 100%; }
  #recette-mealtype-filter-dropdown, #recette-restriction-filter-dropdown { min-width: 0 !important; width: 100%; }
}

/* Profil : code partage — espacement réduit sur petit écran */
@media (max-width: 480px) {
  #profil-share-code { font-size: 20px !important; letter-spacing: 3px !important; }
}

/* NAP table : font légèrement réduite (scroll horizontal déjà présent) */
@media (max-width: 640px) {
  .nap-table { font-size: 12px; }
  .nap-table th, .nap-table td { padding: 8px 10px; }
}

/* ============================================================
   TABLEAUX — Responsive mobile
   ============================================================ */

/* NAP table : min-width pour que les 5 colonnes restent lisibles.
   L'overflow-x:auto du wrapper HTML assure le scroll horizontal. */
.nap-table { min-width: 580px; }

/* Admin recettes : 9 colonnes. Scroll déjà géré par overflow-x:auto en JS. */
#admin-tab-content table { min-width: 700px; }

/* Abonnement / prépaiement : 5-6 colonnes selon le rôle. */
#page-abonnement table { min-width: 480px; }

/* Polices réduites sur mobile pour maximiser le contenu visible dans la fenêtre */
@media (max-width: 768px) {
  #admin-tab-content table           { font-size: 12px; }
  #admin-tab-content table th,
  #admin-tab-content table td        { padding: 6px 7px; }

  #page-abonnement table             { font-size: 12px; }
  #page-abonnement table th,
  #page-abonnement table td          { padding: 8px 10px; }
}

/* ============================================================
   PERFORMANCE & NETTOYAGE — Responsive Step 8
   ============================================================ */

/* ---- AI Chat : colonne latérale suggestions collapse sur mobile ---- */
@media (max-width: 768px) {
  #ai-layout-grid {
    grid-template-columns: 1fr !important;
    height: auto !important;
    min-height: 0;
  }
  #ai-chat-messages { min-height: 300px; }
}

/* ---- Messagerie : liste + chat s'empilent sur mobile ---- */
@media (max-width: 768px) {
  #msg-layout-grid { grid-template-columns: 1fr !important; }
}

/* ---- Studio Créer : 3 modes en 1 colonne sur mobile ---- */
@media (max-width: 650px) {
  #studio-mode-grid { grid-template-columns: 1fr !important; }
}

/* ---- Formulaire inscription : champs prénom/nom et cp/ville en colonne sur petit écran ---- */
@media (max-width: 420px) {
  .ls-form > div[style] { grid-template-columns: 1fr !important; }
}

/* ---- Gaps réduits sur mobile pour gagner de l'espace ---- */
@media (max-width: 650px) {
  .g2, .g3, .g4 { gap: 10px; }
  .mb24 { margin-bottom: 16px; }
  .mb20 { margin-bottom: 14px; }
}

/* ============================================================
   LISTE DE COURSES — Responsive
   ============================================================ */

/* Boutons header courses : colonne sur petit mobile */
@media (max-width: 480px) {
  #page-courses .section-header > div:last-child {
    flex-direction: column;
    width: 100%;
  }
  #page-courses .section-header > div:last-child .btn {
    width: 100%;
    justify-content: center;
  }
}

/* KPI pills budget : empêcher le débordement du texte "XX € – XX €" */
#budget-range {
  font-size: clamp(14px, 4vw, 26px);
  white-space: nowrap;
}

/* Disclaimer budget */
#budget-disclaimer {
  padding: 0 2px;
}

/* Liste courses : 2 colonnes → 1 colonne sous 650px */
@media (max-width: 650px) {
  #courses-container {
    grid-template-columns: 1fr !important;
  }
}

/* Items courses : nom + quantité ne débordent pas sur 320px */
@media (max-width: 360px) {
  .course-item { gap: 6px; }
  .course-item span:first-of-type { font-size: 12px; }
}

/* ============================================================
   VALIDATION STEP 9 — Corrections finales
   ============================================================ */

/* ---- Section-header : marges excessives → compactes sur mobile ---- */
/* 36px et 28px sur desktop, réduits à 20px et 12px sur mobile */
@media (max-width: 650px) {
  .section-header.mb24 { margin-bottom: 20px !important; }
  .section-header.mb20 { margin-bottom: 12px !important; }
}

/* ---- Page title : réduction supplémentaire sur très petit écran ---- */
@media (max-width: 360px) {
  .page-title { font-size: 20px; }
  .card { padding: 12px 10px; }
}

/* ---- Profil header : overflow-wrap sur le nom affiché ---- */
@media (max-width: 480px) {
  #profil-name-display { overflow-wrap: break-word; word-break: break-word; min-width: 0; }
}

/* ============================================================
   AUDIT MOBILE 2026-07 — Corrections
   ============================================================ */

/* ---- Zoom automatique iOS Safari : tout input/select/textarea sous
   16px déclenche un zoom au focus qui désaligne le formulaire (Profil,
   inscription, séances, admin...). !important nécessaire pour override
   les font-size inline dispersés dans index.html. ---- */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}

/* ---- Widgets flottants (chat Kracotte, recette épinglée, bouton bug)
   passaient sous la bottom-nav mobile (bottom:24/86px fixes, sans tenir
   compte des 64px de nav + de la safe-area des iPhone à encoche) : le
   bouton chat "K" et "Signaler un problème" chevauchaient la nav et
   pouvaient en masquer le dernier item. ---- */
@media (max-width: 768px) {
  #nb-fab {
    bottom: calc(64px + env(safe-area-inset-bottom) + 12px) !important;
    right: 16px !important;
  }
  #nb-panel {
    bottom: calc(64px + env(safe-area-inset-bottom) + 76px) !important;
    right: 16px !important;
    max-height: 60vh;
  }
  #recipe-pin {
    bottom: calc(64px + env(safe-area-inset-bottom) + 12px) !important;
    right: 16px !important;
    width: calc(100vw - 32px) !important;
    max-height: 60vh !important;
  }
  #report-problem-btn {
    bottom: calc(64px + env(safe-area-inset-bottom) + 68px) !important;
    right: 16px !important;
  }
}

/* ============================================================
   AUDIT MOBILE 2026-07 — Suite (bouton Sauvegarder, modales)
   ============================================================ */

/* ---- Bouton "Sauvegarder le profil" : sur mobile le formulaire est
   long (empilé en 1 colonne) et le bouton, en fin de carte, nécessitait
   un scroll important. Rendu sticky au-dessus de la bottom-nav pour
   rester atteignable pendant la saisie. ---- */
@media (max-width: 768px) {
  #profil-save-btn {
    position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom) + 10px);
    z-index: 5;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    /* Le bouton chat flottant (#nb-fab, 52px + 16px de marge droite) est
       ancré à une hauteur quasi identique (z-index 9000, au-dessus de ce
       bouton sticky) : sans cette marge, son rond couvrait le coin droit
       de "Sauvegarder le profil" et interceptait le tap à sa place. */
    margin-right: 84px;
  }
}

/* ---- Footer d'actions des modales (séance, objectif sportif) : sur
   mobile ces formulaires scrollent dans la modale (max-height:90vh).
   Le footer Annuler/Enregistrer reste collé en bas de la modale plutôt
   que d'exiger un scroll jusqu'au bout — utile en particulier pour
   valider le palier glucides/h (test entraînement digestif). ---- */
@media (max-width: 640px) {
  .modal-footer-actions {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding-top: 10px;
    padding-bottom: 10px;
    margin-top: 8px;
    box-shadow: 0 -8px 12px -4px rgba(0,0,0,.35);
    z-index: 2;
  }
}

/* ---- LOGIN SCREEN — identité feaso.fr ---- */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #FAFAF7;
  /* justify-content:flex-start (pas center) : avec overflow-y:auto, un
     centrage vertical piège la partie du contenu qui dépasse en haut du
     conteneur — flexbox distribue le débordement symétriquement, et
     scrollTop ne peut pas devenir négatif pour l'atteindre. Sur mobile,
     avec le formulaire d'inscription plus haut que l'écran, ça rendait
     les champs Prénom/Nom (en haut) définitivement inaccessibles. */
  display: flex; align-items: center; justify-content: flex-start; flex-direction: column;
  /* + env(safe-area-inset-*) : avec viewport-fit=cover (index.html), sans
     ça le contenu peut se retrouver sous l'encoche/la barre d'état en haut
     ou sous la poignée d'accueil iOS en bas sur les appareils à encoche —
     invisible en test (Chromium ne simule pas ces valeurs), seulement sur
     un vrai iPhone. */
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  /* blobs décoratifs feaso.fr */
  background-image:
    radial-gradient(ellipse 600px 500px at 70% -5%,  rgba(164,180,148,.13) 0%, transparent 70%),
    radial-gradient(ellipse 360px 360px at 95% 90%, rgba(79,125,243,.06)  0%, transparent 70%),
    radial-gradient(ellipse 280px 280px at -5% 55%, rgba(255,122,89,.04)  0%, transparent 70%);
}
/* Centre verticalement l'étape visible (marges auto, pas justify-content:center) :
   quand le contenu tient dans l'écran, les marges auto se répartissent et le
   centrent ; quand il est plus haut que l'écran (long formulaire d'inscription),
   elles retombent à 0 et on retrouve le comportement flex-start ci-dessus
   (scrollable, rien de piégé en haut) — les deux cas restent corrects. */
.login-screen > div { margin-top: auto; margin-bottom: auto; }
.login-screen.hidden { display: none; }

/* Logo */
.login-logo { margin-bottom: 6px; display: flex; justify-content: center; align-items: center; }
.login-logo__img { height: 48px; width: auto; object-fit: contain; display: block; }

/* Sous-titre */
.login-sub {
  color: rgba(15,23,42,0.50);
  font-size: 14px; margin-bottom: 28px; text-align: center;
  font-family: 'Satoshi', system-ui, sans-serif;
}

/* Carte formulaire (step 1, 3, créateur) */
.ls-card {
  background: #FFFFFF;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 4px 24px rgba(15,23,42,0.06);
  width: 100%;
}

/* Formulaire login */
.ls-form { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.ls-field { display: flex; flex-direction: column; gap: 5px; }
.ls-field label {
  font-size: 12.5px; color: rgba(15,23,42,0.65);
  font-weight: 600; letter-spacing: .02em;
}
.ls-field input, .ls-field select {
  background: #FFFFFF;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #0F172A;
  font-family: 'Satoshi', system-ui, sans-serif; font-size: 13.5px;
  outline: none; transition: border-color .15s, box-shadow .15s;
  width: 100%; box-sizing: border-box;
}
.ls-field input::placeholder { color: rgba(15,23,42,0.30); }
.ls-field input:focus, .ls-field select:focus {
  border-color: #6E7F5F;
  box-shadow: 0 0 0 3px rgba(110,127,95,0.12);
}

/* Boutons login — style feaso.fr */
.ls-btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: #0F172A; color: #FFFFFF;
  font-family: 'Satoshi', system-ui, sans-serif; font-size: 14px; font-weight: 600;
  padding: 12px 28px; border-radius: 12px; border: none; cursor: pointer; width: 100%;
  transition: background .15s, transform .15s;
  letter-spacing: .01em;
}
.ls-btn-primary:hover { background: #1E293B; transform: translateY(-1px); }

.ls-btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: #FFFFFF; color: rgba(15,23,42,0.65);
  border: 1px solid rgba(15,23,42,0.12);
  font-family: 'Satoshi', system-ui, sans-serif; font-size: 13px; font-weight: 500;
  padding: 11px 24px; border-radius: 12px; cursor: pointer; width: 100%;
  transition: border-color .15s, color .15s;
}
.ls-btn-ghost:hover { border-color: rgba(15,23,42,0.25); color: #0F172A; }

/* Eyebrow badge feaso.fr */
.ls-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,122,89,0.08);
  border: 1px solid rgba(255,122,89,0.20);
  color: #FF7A59;
  border-radius: 999px; padding: 6px 14px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 10px;
}
.ls-eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: #FF7A59; }

/* Cards rôle inscription */
.role-cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 640px; }
.role-card {
  flex: 1; min-width: 200px; max-width: 280px;
  background: #FFFFFF;
  border: 1.5px solid rgba(15,23,42,0.10);
  border-radius: 16px;
  padding: 26px 20px; cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  text-align: center; color: #0F172A;
  box-shadow: 0 2px 8px rgba(15,23,42,0.04);
}
.role-card:hover {
  border-color: #6E7F5F;
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(110,127,95,0.15);
}
.role-card .rc-icon { font-size: 38px; margin-bottom: 10px; display: block; }
.role-card .rc-name {
  font-family: 'Clash Display', system-ui, sans-serif;
  font-size: 16px; font-weight: 700; margin-bottom: 6px; color: #0F172A;
}
.role-card .rc-desc { font-size: 12px; color: rgba(15,23,42,0.50); line-height: 1.55; }

/* Carte "Coach / Diététicien" — reste cliquable, juste visuellement en retrait */
.role-card-soon { position: relative; }
.role-card-soon .rc-icon,
.role-card-soon .rc-name,
.role-card-soon .rc-desc { opacity: .55; filter: grayscale(.3); }
.role-card-soon-badge { position: absolute; top: 12px; right: 12px; }

/* Champs d'erreur & requis */
.ls-req { color: #E85D36; font-weight: 700; }
.ls-error { color: #E85D36; font-size: 12.5px; text-align: center; min-height: 16px; }
.login-error { color: #E85D36; font-size: 12.5px; text-align: center; display: none; }

/* Bloc info (RGPD, coach-code, parrain) */
.ls-info-block {
  background: #F8FAFC;
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 10px;
  padding: 13px;
}

/* ---- ROLE BADGE SIDEBAR ---- */
.role-badge-sidebar {
  margin-top:auto; width:100%; padding:10px 14px;
  display:flex; align-items:center; gap:9px;
  border-top:1px solid var(--border);
}
.role-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.role-dot.createur  { background:#fbbf24; }
.role-dot.dieteticien { background:var(--accent); }
.role-dot.client    { background:var(--blue); }
.role-name-sidebar { font-size:12px; font-weight:600; white-space:nowrap; opacity:0; transition:opacity .2s; }
.sidebar:hover .role-name-sidebar { opacity:1; }
.role-logout { margin-left:auto; background:none; border:none; color:var(--text-dim); cursor:pointer; font-size:14px; opacity:0; transition:opacity .2s; white-space:nowrap; }
.sidebar:hover .role-logout { opacity:1; }

.sidebar-version-row {
  width:100%; padding:6px 14px; margin:0; background:none; border:none; border-top:1px solid var(--border);
  text-align:left; cursor:pointer; color:var(--text-dim); font-size:11px; white-space:nowrap; overflow:hidden;
  opacity:0; transition:opacity .2s;
}
.sidebar:hover .sidebar-version-row { opacity:1; }

/* ---- BARRE MODE TEST CRÉATEUR ---- */
#creator-testbar {
  display:none; position:fixed; top:0; left:0; right:0; z-index:9999;
  background:linear-gradient(90deg,#1a1000,#261800);
  border-bottom:2px solid #fbbf24;
  padding:6px 18px; display:none;
  align-items:center; gap:12px; flex-wrap:wrap;
}
#creator-testbar.active { display:flex; }
.testbar-label { font-size:11px; color:#fbbf24; font-weight:700; text-transform:uppercase; letter-spacing:.08em; white-space:nowrap; }
.testbar-btn { padding:4px 13px; border-radius:20px; border:1px solid rgba(251,191,36,.3); background:transparent; color:#fbbf24; font-size:12px; font-family:Satoshi,sans-serif; cursor:pointer; transition:all .18s; white-space:nowrap; }
.testbar-btn:hover, .testbar-btn.active { background:#fbbf24; color:#0a0a00; font-weight:700; }
.testbar-back { margin-left:auto; padding:4px 14px; border-radius:20px; background:rgba(251,191,36,.15); border:1px solid #fbbf24; color:#fbbf24; font-size:12px; font-family:Satoshi,sans-serif; cursor:pointer; font-weight:700; }
.testbar-back:hover { background:#fbbf24; color:#0a0a00; }
body.testmode-active .main { padding-top: calc(36px + 1.5rem); }
body.testmode-active .sidebar { top: 36px; height: calc(100vh - 36px); }

/* ---- OBJECTIFS SPORTIFS ---- */
#objectifs-list .card { border-left: 3px solid var(--border); transition: border-color .2s; }
#objectifs-list .card:hover { border-left-color: var(--accent); }

/* ---- DASHBOARD COACH ---- */
.coach-client-card {
  display:flex; align-items:center; gap:14px;
  padding:14px 16px; background:var(--surface2); border-radius:var(--radius-sm);
  border:1px solid var(--border); cursor:pointer; transition:all .18s;
}
.coach-client-card:hover { border-color:var(--accent); background:var(--accent-dim); transform:translateX(3px); }
.coach-client-card.selected { border-color:var(--accent); background:var(--accent-dim); }
.coach-client-avatar {
  width:44px; height:44px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-family:'Clash Display',sans-serif; font-size:18px; font-weight:700; color:var(--bg);
}
.coach-stat-mini { display:flex; flex-direction:column; align-items:center; background:var(--surface2); border-radius:8px; padding:10px 14px; min-width:80px; }
.coach-stat-mini .val { font-family:'Clash Display',sans-serif; font-size:22px; font-weight:700; }
.coach-stat-mini .lbl { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; margin-top:2px; }
.cdb-macro-row { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
.cdb-macro-pill { flex:1; min-width:80px; background:var(--surface2); border-radius:8px; padding:8px 10px; text-align:center; border:1px solid var(--border); }
.cdb-macro-pill .mpv { font-size:16px; font-weight:700; font-family:'Clash Display',sans-serif; }
.cdb-macro-pill .mpl { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.05em; }
.cdb-section-title { font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.08em; font-weight:700; margin:16px 0 8px; }
.cdb-meal-row { display:flex; align-items:center; gap:10px; padding:9px 11px; background:var(--surface2); border-radius:8px; border:1px solid var(--border); margin-bottom:6px; }
.cdb-input-adj { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 10px; color:var(--text); font-family:Satoshi,sans-serif; font-size:13px; outline:none; width:100%; box-sizing:border-box; }
.cdb-input-adj:focus { border-color:var(--accent); }

/* ---- APPROBATION PLANNING ---- */
#coach-approval-banner {
  background:linear-gradient(90deg,rgba(251,191,36,.12),rgba(251,191,36,.06));
  border:1px solid rgba(251,191,36,.4); border-radius:var(--radius-sm);
  padding:12px 16px; margin-bottom:18px; display:none;
  align-items:center; gap:14px; flex-wrap:wrap;
}
#coach-approval-banner.active { display:flex; }

/* ---- CUSTOM DROPDOWN RECETTES ---- */
.rfd-opt { padding:9px 14px; font-size:13px; cursor:pointer; color:var(--text); transition:background .15s; white-space:nowrap; }
.rfd-opt:hover, .rfd-opt.active { background:var(--accent-dim); color:var(--accent); }

/* ---- SUIVI ---- */
.client-row { display:flex; align-items:center; gap:12px; padding:13px; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; transition:border-color .18s; }
.client-row:hover { border-color:var(--accent); }
.client-avatar { width:40px; height:40px; border-radius:50%; background:linear-gradient(135deg,var(--accent),var(--accent2)); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.suivi-timeline { display:flex; flex-direction:column; gap:10px; max-height:320px; overflow-y:auto; }
.suivi-entry { display:flex; gap:12px; font-size:12.5px; }
.suivi-dot { width:10px; height:10px; border-radius:50%; background:var(--accent); flex-shrink:0; margin-top:3px; }
.suivi-line { width:1px; background:var(--border); margin:2px 0 0 4px; }

/* ---- MESSAGERIE ---- */
.msg-bubble-sportif { background:var(--accent-dim); color:var(--text); border-radius:12px 12px 4px 12px; margin-left:auto; max-width:75%; padding:9px 13px; font-size:13px; line-height:1.5; }
.msg-bubble-coach   { background:var(--surface2);   color:var(--text); border-radius:12px 12px 12px 4px; max-width:75%; padding:9px 13px; font-size:13px; line-height:1.5; }
.msg-ts { font-size:10px; color:var(--text-dim); margin-top:3px; }
.msg-conv-item { display:flex; gap:10px; align-items:center; padding:10px 12px; border-radius:var(--radius-sm); cursor:pointer; transition:background .15s; border:1px solid var(--border); }
.msg-conv-item:hover { background:var(--surface2); }
.msg-conv-item.active { border-color:var(--accent); background:var(--accent-dim); }
.nav-unread-badge { margin-left:auto; min-width:18px; height:18px; padding:0 5px; align-items:center; justify-content:center; border-radius:20px; background:var(--orange); color:#fff; font-size:10px; font-weight:700; line-height:1; }

/* ---- Profil : suivi du poids ---- */
.weight-measure-form { display:grid; grid-template-columns:1fr 1fr auto; gap:12px; align-items:end; margin-top:14px; }
.weight-measure-form .field { margin:0; }
.weight-chart-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:12px; }
.weight-period-filters { display:flex; gap:6px; flex-wrap:wrap; }
.weight-period-filters .btn.active { background:var(--accent-dim); color:var(--accent); border-color:var(--accent); }
.weight-chart-container { min-height:220px; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.weight-chart-svg { width:100%; height:auto; min-height:220px; overflow:visible; }
.weight-chart-grid { stroke:var(--border); stroke-width:1; }
.weight-chart-label { fill:var(--text-dim); font-size:11px; font-family:'Satoshi',sans-serif; }
.weight-chart-line { fill:none; stroke:var(--accent); stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.weight-chart-point { fill:var(--surface); stroke:var(--accent); stroke-width:3; cursor:pointer; outline:none; }
.weight-chart-point:hover, .weight-chart-point:focus { fill:var(--accent); stroke-width:5; }
.weight-empty-state { width:100%; color:var(--text-dim); font-size:13px; text-align:center; padding:34px 12px; }
.weight-history-list { display:flex; flex-direction:column; gap:7px; margin-top:12px; }
.weight-history-row { display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--surface2); border-radius:var(--radius-sm); padding:10px 12px; }
.weight-history-row > div { display:flex; align-items:baseline; gap:10px; }
.weight-history-row strong { font-family:'Clash Display',sans-serif; font-size:15px; }
.weight-history-row span { color:var(--text-muted); font-size:12px; }

@media (max-width: 640px) {
  .weight-measure-form { grid-template-columns:1fr 1fr; }
  .weight-measure-form .btn { grid-column:1 / -1; justify-content:center; }
  .weight-period-filters { width:100%; }
  .weight-period-filters .btn { flex:1; min-width:68px; justify-content:center; }
  .weight-chart-container { min-height:190px; }
  .weight-chart-svg { min-height:190px; }
}

/* ============================================================
   WIDGET CHAT FLOTTANT — Kracotte persistant toutes pages
   ============================================================ */
#nb-fab {
  position:fixed; bottom:24px; right:24px; z-index:9000;
  width:52px; height:52px; border-radius:50%;
  background:var(--accent); border:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  font-size:22px; box-shadow:0 4px 20px rgba(61,255,160,.35);
  transition:transform .2s, box-shadow .2s;
}
#nb-fab:hover { transform:scale(1.1); box-shadow:0 6px 28px rgba(61,255,160,.5); }
#nb-fab-badge {
  position:absolute; top:-4px; right:-4px;
  background:var(--orange); color:#fff; font-size:10px; font-weight:700;
  border-radius:10px; padding:1px 5px; min-width:16px; text-align:center;
  display:none;
}
#nb-panel {
  position:fixed; bottom:88px; right:24px; z-index:9000;
  width:340px; max-height:520px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:20px; overflow:hidden;
  display:flex; flex-direction:column;
  box-shadow:0 8px 40px rgba(0,0,0,.5);
  transform:translateY(16px) scale(.97); opacity:0;
  pointer-events:none;
  transition:transform .22s cubic-bezier(.4,0,.2,1), opacity .22s;
}
#nb-panel.open {
  transform:translateY(0) scale(1); opacity:1;
  pointer-events:all;
}
#nb-header {
  display:flex; align-items:center; gap:10px;
  padding:12px 14px; background:var(--surface2);
  border-bottom:1px solid var(--border); flex-shrink:0;
}
#nb-header .nb-avatar {
  width:32px; height:32px; border-radius:50%;
  background:var(--accent-dim); border:1px solid var(--accent);
  display:flex; align-items:center; justify-content:center; font-size:16px;
}
#nb-header .nb-title { flex:1; font-family:'Clash Display',sans-serif; font-size:14px; font-weight:600; }
#nb-header .nb-status { font-size:10px; color:var(--text-muted); }
#nb-header button {
  background:none; border:none; color:var(--text-muted); cursor:pointer;
  font-size:16px; padding:2px 6px; border-radius:6px;
}
#nb-header button:hover { background:var(--border); color:var(--text); }
#nb-messages {
  flex:1; overflow-y:auto; padding:12px;
  display:flex; flex-direction:column; gap:10px;
  min-height:200px;
}
#nb-messages::-webkit-scrollbar { width:4px; }
#nb-messages::-webkit-scrollbar-thumb { background:var(--border); border-radius:4px; }
.nb-msg-user {
  align-self:flex-end; max-width:80%;
  background:var(--accent); color:#000;
  border-radius:14px 14px 4px 14px;
  padding:8px 12px; font-size:12.5px; line-height:1.5; white-space:pre-wrap;
}
.nb-msg-bot {
  align-self:flex-start; max-width:85%;
  background:var(--surface2); color:var(--text);
  border-radius:4px 14px 14px 14px; border:1px solid var(--border);
  padding:8px 12px; font-size:12.5px; line-height:1.6; white-space:pre-wrap;
}
.nb-msg-bot strong { color:var(--accent); }
.nb-typing {
  align-self:flex-start;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:4px 14px 14px 14px;
  padding:8px 14px; font-size:12px; color:var(--text-muted);
  display:flex; gap:4px; align-items:center;
}
.nb-typing span { width:6px; height:6px; border-radius:50%; background:var(--accent); animation:nbdot 1.2s infinite; }
.nb-typing span:nth-child(2) { animation-delay:.2s; }
.nb-typing span:nth-child(3) { animation-delay:.4s; }
@keyframes nbdot { 0%,80%,100%{opacity:.25;transform:scale(.8)} 40%{opacity:1;transform:scale(1)} }
#nb-input-row {
  display:flex; gap:8px; padding:10px 12px;
  border-top:1px solid var(--border); background:var(--surface2); flex-shrink:0;
}
#nb-input {
  flex:1; background:var(--bg); border:1px solid var(--border);
  border-radius:10px; padding:8px 11px; color:var(--text);
  font-family:Satoshi,sans-serif; font-size:12.5px; outline:none; resize:none; height:38px; line-height:1.4;
}
#nb-input:focus { border-color:var(--accent); }
#nb-send {
  width:38px; height:38px; border-radius:10px; flex-shrink:0;
  background:var(--accent); border:none; cursor:pointer; font-size:16px;
  display:flex; align-items:center; justify-content:center;
  transition:opacity .15s;
}
#nb-send:disabled { opacity:.4; cursor:default; }

/* ============================================================
   SPRINT 1 — Icônes SVG sidebar + composants entraînements
   ============================================================ */

/* Alignement vertical SVG dans les nav items */
.nav-item .icon svg {
  display: block;
  margin: 0 auto;
  vertical-align: middle;
}

/* Dashboard sport-first cards */
#dash-next-session-card {
  transition: box-shadow .2s;
}
#dash-next-session-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
}

/* Carte "Aujourd'hui" (niveau Assistant, voir niveau.js) — sépare les lignes
   sans figer de bordure sur la dernière (dépend du nombre de lignes rendues). */
.dash-today-action-line { padding: 9px 0; }
.dash-today-action-line + .dash-today-action-line { border-top: 1px solid var(--border); }

/* Page Connexions — badge "Bientôt" */
.badge-soon {
  background: rgba(217,119,6,.10);
  color: var(--orange);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}

/* Modal ajout séance */
#modal-add-workout { backdrop-filter: blur(4px); }
#modal-add-workout > div { animation: fadeInUp .18s ease; }

/* ============================================================
   STRATÉGIE NUTRITION — Phases & paliers glucides interactifs
   Animations légères uniquement (ouverture de fiche, sélection) —
   réutilise le @keyframes fadeIn déjà défini plus haut.
   ============================================================ */

/* Fiches pédagogiques (phase consultée / palier glucides) */
.ns-detail-card { animation: fadeIn .22s ease; }

/* Cartes de phase — transition douce au survol/sélection, jamais brutale */
.ns-phase-card {
  transition: transform .15s cubic-bezier(.4,0,.2,1), box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}
.ns-phase-card:hover { transform: translateY(-1px); }
.ns-phase-card:active { transform: translateY(0); }

/* Paliers glucides/h — même traitement que les cartes de phase */
.ns-carb-pill {
  transition: transform .15s cubic-bezier(.4,0,.2,1), box-shadow .15s ease, border-color .15s ease, background-color .15s ease;
}
.ns-carb-pill:hover { transform: translateY(-1px); }
.ns-carb-pill:active { transform: translateY(0); }

/* Focus clavier visible — cartes de phase et paliers glucides sont des
   <button> nativement utilisables au Tab/Entrée/Espace ; on renforce
   juste l'anneau de focus pour qu'il soit cohérent avec l'identité FEASO. */
.ns-phase-card:focus-visible,
.ns-carb-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile : cartes de phase confortables au doigt, scroll horizontal fluide */
@media (max-width: 640px) {
  .ns-phase-card { min-height: 78px; }
  .ns-detail-card { padding: 14px !important; }
}

/* ============================================================
   MODE GUIDÉ — HUD flottant persistant (voir docs/prd-mode-guide.md)
   z-index:9200 : au-dessus du spotlight (9150) et de Kracotte (9000), sous
   les modales (.modal-overlay, 9500) — un éditeur de repas ouvert ne doit
   jamais être caché par le HUD.
   Desktop : top/left posés dynamiquement par gmUpdateGeometry()
   (guided-mode.js), qui choisit le côté de la cible avec le plus de place
   et clampe dans le viewport — plus jamais figé en bas-à-gauche. Les
   valeurs ci-dessous ne sont qu'un repli avant le tout premier calcul.
   Mobile (≤768px) : bottom sheet compacte (voir règle dédiée plus bas) —
   c'est alors la seule règle CSS qui positionne le HUD, gmUpdateGeometry()
   n'y touche pas (voir le commentaire dans la media query).
   ============================================================ */
#gm-hud {
  position: fixed; top: auto; bottom: 24px; left: 24px; right: auto; z-index: 9200;
  width: 320px; max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  font-family: Satoshi, sans-serif;
}
#gm-hud:focus { outline: none; }
#gm-hud-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 6px;
}
#gm-hud-close:hover { background: var(--border); color: var(--text); }
#gm-hud-chapitre {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); margin-bottom: 4px; padding-right: 20px;
}
#gm-hud-progress { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
#gm-hud-mission-titre { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
#gm-hud-mission-texte { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }
#gm-hud-continue {
  width: 100%; padding: 9px; border: none; border-radius: 10px;
  background: var(--accent); color: #000; font-weight: 700; font-size: 13px;
  cursor: pointer; transition: opacity .15s;
}
#gm-hud-continue:hover { opacity: .9; }
#gm-hud-skip {
  width: 100%; margin-top: 6px; padding: 6px; border: none; background: none;
  color: var(--text-muted); font-size: 11.5px; cursor: pointer; text-decoration: underline;
}
#gm-hud-skip:hover { color: var(--text); }

/* Cible introuvable après le délai d'attente (voir gmWaitForTarget(),
   guided-mode.js) — jamais un abandon silencieux : message clair + reprise
   possible, sans jamais bloquer le chapitre. */
#gm-hud-error {
  background: color-mix(in srgb, var(--orange, #f97316) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--orange, #f97316) 40%, transparent);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px;
}
#gm-hud-error-msg { font-size: 12px; color: var(--text); line-height: 1.5; margin-bottom: 8px; }
#gm-hud-retry {
  width: 100%; padding: 7px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2); color: var(--text); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: border-color .15s;
}
#gm-hud-retry:hover { border-color: var(--accent); }

/* Surbrillance d'abord, texte ensuite (voir gmRenderHud(), guided-mode.js) :
   le corps du HUD s'efface pendant que le spotlight s'installe sur la
   cible, puis réapparaît en fondu — jamais de saut brutal de contenu. */
#gm-hud-body { opacity: 1; transform: translateY(0); transition: opacity .25s ease, transform .25s ease; }
#gm-hud-body.gm-hud-pending { opacity: 0; transform: translateY(4px); }

/* ← Étape précédente / Étape suivante → : relire une explication ou
   revoir une étape déjà réalisée, jamais avancer au-delà de l'étape en
   cours (voir gmGoToNextStep(), guided-mode.js). */
#gm-hud-nav { display: flex; gap: 8px; margin-top: 8px; }
#gm-hud-prev, #gm-hud-next {
  flex: 1; padding: 7px 4px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2); color: var(--text-muted); font-size: 11px;
  cursor: pointer; transition: color .15s, border-color .15s;
}
#gm-hud-prev:hover, #gm-hud-next:hover { color: var(--text); border-color: var(--accent); }

@media (max-width: 768px) {
  /* Bottom sheet compacte : seule règle qui positionne le HUD sur mobile —
     gmUpdateGeometry() (guided-mode.js) détecte cette largeur d'écran et
     n'écrit alors plus aucun top/left en inline, pour laisser cette règle
     (moins spécifique qu'un style inline) faire foi. Hauteur plafonnée à
     46vh avec défilement interne si le texte est long ; safe-area prise en
     compte pour ne jamais passer sous la barre du navigateur. Poignée
     visuelle (::before) pour signaler que c'est une sheet, pas juste une
     carte posée là. */
  #gm-hud {
    top: auto !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    width: 100%; max-width: 100%;
    max-height: 46vh;
    border-radius: 18px 18px 0 0;
    padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(0,0,0,.4);
  }
  #gm-hud::before {
    content: ''; display: block; width: 36px; height: 4px; border-radius: 3px;
    background: var(--border); margin: -6px auto 12px;
  }
}

/* Utilisateurs sensibles au mouvement (voir GUIDED_CHAPTERS, accessibilité) :
   plus de pulsation ni de rebond, transitions quasi instantanées — le
   spotlight et la flèche restent visibles, juste immobiles. */
@media (prefers-reduced-motion: reduce) {
  #gm-spotlight-overlay { animation: none; }
  #gm-spotlight-arrow svg { animation: none; }
  #gm-hud-body { transition-duration: .01ms; }
}
