/* ============================================================
   mon-business-ia.com — Espace membre & pages d'auth
   Même identité que la landing : sombre premium, ambre/violet.
   ============================================================ */

:root {
  --bg0: #0c0726; --bg1: #130d36; --bg2: #1a1145; --bg3: #221657;
  --vio: #4c2ba0; --vio2: #7c5cde; --vio3: #a58af0;
  --amber: #f4b942; --amber2: #f8cf6e; --amber-dark: #d99b1d;
  --txt: #f4f2fb; --mut: #b6aed8; --mut2: #8d84b8;
  --line: rgba(140, 110, 230, 0.22); --line2: rgba(140, 110, 230, 0.38);
  --light: #f7f5ff; --ink: #241a52; --ink2: #5a4d8f;
  --ok: #43d9a3; --ok-dark: #1d8a63; --bad: #ff7a7a; --warn: #f4b942;
  --radius: 16px; --radius-sm: 11px;
  --font-title: 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow: 0 10px 40px rgba(5, 2, 20, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.65;
  color: var(--txt); background: var(--bg0);
}
img { max-width: 100%; height: auto; }
a { color: var(--amber2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-title); line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; color: #fff; }
p { margin: 0 0 1em; }
::selection { background: rgba(244, 185, 66, 0.35); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--font-title); font-weight: 700; font-size: 0.98rem;
  padding: 13px 26px; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn-primary { background: linear-gradient(180deg, var(--amber2), var(--amber)); color: #241503; box-shadow: 0 6px 24px rgba(244, 185, 66, 0.25); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { background: rgba(124, 92, 222, 0.10); color: var(--txt); border-color: var(--line2); }
.btn-ghost:hover { border-color: var(--vio3); transform: translateY(-1px); }
.btn-danger { background: rgba(255, 122, 122, 0.12); color: var(--bad); border-color: rgba(255, 122, 122, 0.4); }
.btn-sm { padding: 9px 18px; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* ---------- Formulaires ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 7px; color: var(--txt); }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field select, .field textarea {
  width: 100%; padding: 13px 16px; font: inherit; color: var(--txt);
  background: rgba(12, 7, 38, 0.6); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); outline: none; transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--vio3); }
.field .hint { font-size: 0.82rem; color: var(--mut2); margin-top: 6px; }
.field textarea { min-height: 140px; resize: vertical; }
.check-line { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; color: var(--mut); }
.check-line input { margin-top: 4px; accent-color: var(--amber); }

/* ---------- Alertes ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 0.94rem; margin-bottom: 18px; }
.alert a { text-decoration: underline; }
.alert-ok   { background: rgba(67, 217, 163, 0.10); border: 1px solid rgba(67, 217, 163, 0.35); color: #9df0d3; }
.alert-err  { background: rgba(255, 122, 122, 0.10); border: 1px solid rgba(255, 122, 122, 0.35); color: #ffb3b3; }
.alert-warn { background: rgba(244, 185, 66, 0.10); border: 1px solid rgba(244, 185, 66, 0.35); color: var(--amber2); }
.alert-info { background: rgba(124, 92, 222, 0.12); border: 1px solid var(--line2); color: var(--mut); }

/* ---------- Badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600;
  border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
.pill-ok    { color: #9df0d3; background: rgba(67, 217, 163, 0.12); border: 1px solid rgba(67, 217, 163, 0.3); }
.pill-warn  { color: var(--amber2); background: rgba(244, 185, 66, 0.12); border: 1px solid rgba(244, 185, 66, 0.3); }
.pill-bad   { color: #ffb3b3; background: rgba(255, 122, 122, 0.12); border: 1px solid rgba(255, 122, 122, 0.3); }
.pill-muted { color: var(--mut2); background: rgba(140, 110, 230, 0.10); border: 1px solid var(--line); }
.pill-vio   { color: var(--vio3); background: rgba(124, 92, 222, 0.14); border: 1px solid var(--line); }

/* ============================================================
   PAGES D'AUTHENTIFICATION
   ============================================================ */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(700px 400px at 80% -5%, rgba(124, 92, 222, 0.25), transparent 60%),
    linear-gradient(160deg, var(--bg0) 0%, var(--bg1) 50%, var(--bg2) 100%);
  display: flex; align-items: flex-start; justify-content: center;
}
.auth-wrap { width: 100%; max-width: 460px; padding: 48px 20px 40px; }
.auth-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-title); font-weight: 800; font-size: 1.15rem; color: #fff;
  text-decoration: none !important; margin-bottom: 28px;
}
.auth-logo em { font-style: normal; color: var(--amber); }
.auth-card {
  background: rgba(19, 13, 54, 0.85); border: 1px solid var(--line);
  border-radius: 20px; padding: 34px 30px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.45rem; }
.auth-sub { color: var(--mut); font-size: 0.95rem; margin-bottom: 22px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--mut2); }
.auth-legal { text-align: center; margin-top: 22px; font-size: 0.8rem; color: var(--mut2); }
.auth-legal a { color: var(--mut2); }
@media (max-width: 480px) { .auth-card { padding: 26px 18px; } }

/* ============================================================
   COQUILLE ESPACE MEMBRE
   ============================================================ */
.app-body { background: var(--bg0); }
.app-topbar {
  display: none; position: sticky; top: 0; z-index: 60;
  background: rgba(12, 7, 38, 0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 16px; height: 58px; align-items: center; justify-content: space-between;
}
.app-logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-title); font-weight: 800; font-size: 0.98rem; color: #fff; text-decoration: none !important; white-space: nowrap; }
.app-logo em { font-style: normal; color: var(--amber); }
.app-burger { background: none; border: 0; padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.app-burger span { width: 22px; height: 2px; background: var(--txt); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.app-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.app-burger.open span:nth-child(2) { opacity: 0; }
.app-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.app-side {
  position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 70;
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 16px;
}
.app-side .side-only { margin: 4px 8px 26px; }
.app-nav { display: flex; flex-direction: column; gap: 4px; }
.app-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px; color: var(--mut);
  font-weight: 500; font-size: 0.95rem; text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
}
.app-nav a:hover { background: rgba(124, 92, 222, 0.10); color: #fff; }
.app-nav a.on { background: rgba(124, 92, 222, 0.16); color: #fff; }
.app-nav a.on svg { color: var(--amber); }
.nav-badge {
  margin-left: auto; background: var(--amber); color: #241503;
  font-size: 0.7rem; font-weight: 800; border-radius: 999px; padding: 1px 8px;
}
.side-trial {
  margin-top: auto; padding: 14px; border: 1px solid rgba(244, 185, 66, 0.4);
  border-radius: var(--radius-sm); background: rgba(244, 185, 66, 0.08); text-align: center;
}
.side-trial-day {
  display: block; font-family: var(--font-title); font-weight: 800; font-size: 0.88rem;
  color: var(--amber2); margin-bottom: 10px;
}
.side-trial + .app-side-foot { margin-top: 14px; }
.app-side-foot { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid var(--line); }
.side-user { font-weight: 600; font-size: 0.9rem; color: #fff; margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link { display: block; color: var(--mut2); font-size: 0.86rem; padding: 4px 0; }
.app-overlay { display: none; position: fixed; inset: 0; background: rgba(5, 2, 20, 0.6); z-index: 65; }

.app-main { margin-left: 250px; padding: 38px 40px 70px; max-width: 1060px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head > div { min-width: 0; }
.page-head h1 { font-size: 1.6rem; margin: 0; overflow-wrap: anywhere; }
.page-head .sub { color: var(--mut); font-size: 0.95rem; margin: 4px 0 0; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .app-topbar { display: flex; }
  .app-side { transform: translateX(-105%); transition: transform 0.25s ease; width: 270px; }
  .app-side.open { transform: none; }
  .app-overlay.on { display: block; }
  .app-main { margin-left: 0; padding: 24px 18px 60px; }
}

/* ---------- Cartes génériques ---------- */
.card {
  background: rgba(19, 13, 54, 0.8); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}
.card + .card { margin-top: 18px; }
.card h2 { font-size: 1.15rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

/* ---------- Progression ---------- */
.progressbar { height: 9px; border-radius: 99px; background: rgba(76, 43, 160, 0.25); overflow: hidden; }
.progressbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--vio2), var(--amber)); transition: width 0.4s ease; }
.prog-line { display: flex; align-items: center; gap: 14px; }
.prog-line .progressbar { flex: 1; }
.prog-pct { font-family: var(--font-title); font-weight: 800; color: var(--amber); min-width: 46px; text-align: right; }

/* ---------- Liste de modules (tableau de bord) ---------- */
.mod-card {
  display: flex; align-items: center; gap: 18px;
  background: rgba(19, 13, 54, 0.8); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px;
  color: inherit; text-decoration: none !important; transition: border-color 0.15s, transform 0.15s;
}
.mod-card:hover { border-color: var(--line2); transform: translateX(3px); }
.mod-num {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(160deg, var(--vio), var(--vio2)); color: #fff;
  font-family: var(--font-title); font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.mod-card.gold .mod-num { background: linear-gradient(160deg, var(--amber-dark), var(--amber)); color: #241503; }
.mod-card.done .mod-num { background: rgba(67, 217, 163, 0.18); color: var(--ok); }
.mod-body { flex: 1; min-width: 0; }
.mod-body h3 { font-size: 1.02rem; margin: 0 0 3px; }
.mod-body .mod-meta { font-size: 0.83rem; color: var(--mut2); }
.mod-prog { flex: 0 0 130px; }
.mod-prog .pct { font-size: 0.78rem; color: var(--mut2); text-align: right; margin-top: 4px; }
@media (max-width: 640px) { .mod-prog { flex-basis: 74px; } }

/* ---------- Liste de leçons ---------- */
.lesson-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 10px; color: inherit; text-decoration: none !important;
  background: rgba(19, 13, 54, 0.6); transition: border-color 0.15s;
}
.lesson-row:hover { border-color: var(--line2); }
.lesson-state { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; color: transparent; }
.lesson-row.done .lesson-state { background: var(--ok-dark); border-color: var(--ok-dark); color: #fff; }
.lesson-row .t { flex: 1; min-width: 0; font-weight: 600; color: var(--txt); }
.lesson-row .d { font-size: 0.8rem; color: var(--mut2); white-space: nowrap; }

/* ============================================================
   CONTENU DE LEÇON (HTML riche édité en admin)
   ============================================================ */
.lesson-content { max-width: 760px; font-size: 1.02rem; overflow-wrap: break-word; }
.lesson-content h2 { font-size: 1.45rem; margin: 1.8em 0 0.6em; }
.lesson-content h3 { font-size: 1.15rem; margin: 1.5em 0 0.5em; }
.lesson-content p { color: var(--mut); }
.lesson-content li { color: var(--mut); margin-bottom: 6px; }
.lesson-content strong { color: #fff; }
.lesson-content img { border-radius: var(--radius-sm); border: 1px solid var(--line); }
.lesson-content table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 1.2em 0; }
.lesson-content th, .lesson-content td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; color: var(--mut); }
.lesson-content th { background: rgba(124, 92, 222, 0.12); color: #fff; font-family: var(--font-title); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Étapes numérotées (composant injecté par l'éditeur admin).
   Pastille en position absolue : le contenu du li reste un flux inline normal
   (les li réels mélangent texte nu, <strong> et <em> — pas de flex ici). */
.steps-list { list-style: none; counter-reset: mbi-step; padding: 0; margin: 1.2em 0; }
.steps-list > li {
  counter-increment: mbi-step; position: relative; display: block; min-width: 0;
  padding: 12px 14px 12px 56px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: rgba(19, 13, 54, 0.5);
}
.steps-list > li::before {
  content: counter(mbi-step); position: absolute; left: 14px; top: 13px;
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(160deg, var(--vio), var(--vio2)); color: #fff;
  font-family: var(--font-title); font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}

/* Encadrés pédagogiques */
.box { border-radius: var(--radius-sm); padding: 18px 20px; margin: 1.4em 0; border: 1px solid; font-size: 0.97rem; }
.box p:last-child { margin-bottom: 0; }
.box-tag {
  display: inline-block; font-family: var(--font-title); font-weight: 800; font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase; border-radius: 999px;
  padding: 4px 12px; margin-bottom: 10px;
}
.box-info { background: rgba(124, 92, 222, 0.10); border-color: var(--line2); }
.box-info .box-tag { background: var(--vio2); color: #fff; }
.box-tip { background: rgba(244, 185, 66, 0.07); border-color: rgba(244, 185, 66, 0.35); }
.box-tip .box-tag { background: var(--amber); color: #241503; }
.box-warn { background: rgba(255, 122, 122, 0.07); border-color: rgba(255, 122, 122, 0.35); }
.box-warn .box-tag { background: #e05252; color: #fff; }
.box-good { background: rgba(67, 217, 163, 0.07); border-color: rgba(67, 217, 163, 0.3); }
.box-good .box-tag { background: var(--ok-dark); color: #fff; }

/* « À dire à Claude » : prompt copiable */
.box-prompt { background: var(--light); border: 1.5px dashed #b9a8ec; color: var(--ink); }
.box-prompt .box-tag { background: #5b3bb8; color: #fff; }
.box-prompt .prompt-text {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9rem; line-height: 1.7; color: var(--ink); white-space: pre-wrap; word-break: break-word;
}
.box-prompt .copy-prompt {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px;
  font-family: var(--font-title); font-weight: 700; font-size: 0.85rem;
  padding: 9px 18px; cursor: pointer; transition: transform 0.15s, background 0.15s;
}
.box-prompt .copy-prompt:hover { transform: translateY(-1px); }
.box-prompt .copy-prompt.done { background: var(--ok-dark); }

/* Checklists interactives */
.checklist { list-style: none; padding: 0; margin: 1.2em 0; }
.checklist li.mbi-check {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 8px; color: var(--mut); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.checklist li.mbi-check:hover { border-color: var(--line2); }
.checklist li.mbi-check .ck {
  flex: 0 0 auto; width: 23px; height: 23px; margin-top: 1px; border-radius: 7px;
  border: 2px solid var(--line2); background: rgba(124, 92, 222, 0.08);
  display: flex; align-items: center; justify-content: center; transition: background 0.15s, border-color 0.15s;
}
.checklist li.mbi-check .ck svg { width: 13px; height: 13px; color: #241503; opacity: 0; transform: scale(0.4); transition: opacity 0.15s, transform 0.15s; }
.checklist li.mbi-check.on { color: var(--txt); }
.checklist li.mbi-check.on .ck { background: var(--amber); border-color: var(--amber); }
.checklist li.mbi-check.on .ck svg { opacity: 1; transform: scale(1); }

/* Lexique */
.lexique { margin: 1.2em 0; }
.lexique dt { font-family: var(--font-title); font-weight: 700; color: var(--amber2); margin-top: 14px; }
.lexique dd { margin: 2px 0 0; color: var(--mut); }

/* Navigation bas de leçon */
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; flex-wrap: wrap; }
.lesson-done-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: rgba(124, 92, 222, 0.10); border: 1px solid var(--line2);
  border-radius: var(--radius); padding: 18px 22px; margin-top: 34px;
}
.lesson-done-bar .txt { font-weight: 600; color: var(--txt); }

/* ============================================================
   FORUM
   ============================================================ */
.forum-cat {
  display: flex; align-items: center; gap: 16px;
  background: rgba(19, 13, 54, 0.8); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px;
  color: inherit; text-decoration: none !important; transition: border-color 0.15s;
}
.forum-cat:hover { border-color: var(--line2); }
.forum-cat .ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; background: rgba(124, 92, 222, 0.14); color: var(--vio3); display: flex; align-items: center; justify-content: center; }
.forum-cat .b { flex: 1; min-width: 0; }
.forum-cat h3 { font-size: 1rem; margin: 0 0 2px; }
.forum-cat p { font-size: 0.85rem; color: var(--mut2); margin: 0; }
.forum-cat .n { font-size: 0.8rem; color: var(--mut2); white-space: nowrap; }

.topic-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 9px; background: rgba(19, 13, 54, 0.6);
  color: inherit; text-decoration: none !important; transition: border-color 0.15s;
}
.topic-row:hover { border-color: var(--line2); }
.topic-row .t { flex: 1; min-width: 0; font-weight: 600; color: var(--txt); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-row .meta { font-size: 0.78rem; color: var(--mut2); white-space: nowrap; }
.topic-flags { display: inline-flex; gap: 5px; }

.post {
  background: rgba(19, 13, 54, 0.8); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 14px;
}
.post.solution { border-color: rgba(67, 217, 163, 0.45); }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.85rem; color: var(--mut2); flex-wrap: wrap; }
.post-author { font-weight: 700; color: var(--txt); }
.post-body { color: var(--mut); font-size: 0.97rem; overflow-wrap: anywhere; }
.post-body p { margin-bottom: 0.8em; }
.post-body p:last-child { margin-bottom: 0; }
.post-body .md-pre { background: #0d0a1f; border: 1px solid var(--line); border-radius: 9px; padding: 13px 15px; overflow-x: auto; font-size: 0.85rem; }
.post-body .md-code { background: rgba(124, 92, 222, 0.15); border-radius: 5px; padding: 1px 6px; font-size: 0.88em; }
.post-actions { display: flex; gap: 14px; margin-top: 12px; font-size: 0.82rem; }
.post-actions a, .post-actions button { color: var(--mut2); background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
.post-actions a:hover, .post-actions button:hover { color: var(--amber2); }

/* ============================================================
   TICKETS
   ============================================================ */
.msg { border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px; max-width: 85%; }
.msg-user { background: rgba(124, 92, 222, 0.14); border: 1px solid var(--line2); margin-left: auto; }
.msg-admin { background: rgba(19, 13, 54, 0.85); border: 1px solid var(--line); }
.msg .who { font-size: 0.78rem; color: var(--mut2); margin-bottom: 6px; }
.msg .body { color: var(--txt); font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; }

/* ---------- Tableaux data (facturation…) ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.data-table th, .data-table td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { color: var(--mut2); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.data-table td { color: var(--mut); }
.data-table tr:last-child td { border-bottom: 0; }

/* ---------- Divers ---------- */
.empty {
  text-align: center; color: var(--mut2); padding: 44px 20px;
  border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }

/* Logo personnalisé (uploadé via admin → Réglages) */
.logo-img { display: block; width: auto; max-width: 210px; object-fit: contain; }

/* ============================================================
   MOBILE — anti-débordement horizontal (viewports ≤ 640px)
   ============================================================ */
@media (max-width: 640px) {
  /* Les libellés longs (titres de leçons…) se replient au lieu de pousser la page */
  .btn { white-space: normal; text-align: center; }
  /* Listes forum : le méta passe sous le titre au lieu de déborder */
  .topic-row { flex-wrap: wrap; }
  .topic-row .meta { white-space: normal; }
  /* Listes leçons/tickets : la pastille + date peut se replier */
  .lesson-row { flex-wrap: wrap; }
  .lesson-row .d { white-space: normal; }
  /* Cartes modules (téléchargements) : la pastille cadenas passe à la ligne */
  .mod-card { flex-wrap: wrap; }
  /* Tableaux de leçon : plus compacts pour tenir sans scroll dans la plupart des cas */
  .lesson-content table { font-size: 0.84rem; }
  .lesson-content th, .lesson-content td { padding: 8px 10px; }
  /* Logo personnalisé : ne doit jamais pousser le header */
  .logo-img { max-width: 150px; }
}

/* Badge équipe (posts publiés par l'admin dans le forum) */
.pill-gold { color: #241503; background: var(--amber); border: 1px solid var(--amber); font-weight: 700; }

/* Module verrouillé (déverrouillage progressif J+30) */
.mod-card.locked { opacity: 0.72; cursor: default; }
.mod-card.locked:hover { border-color: var(--line); transform: none; }
.mod-card.locked .mod-num { background: rgba(140, 110, 230, 0.14); color: var(--mut2); }

/* ============================================================
   ASSISTANT PERSONNEL IA (chat)
   ============================================================ */
.ai-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ai-thread {
  flex: 1; min-height: 340px; max-height: calc(100vh - 340px);
  overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px;
  background:
    radial-gradient(600px 300px at 85% -10%, rgba(124, 92, 222, 0.10), transparent 60%),
    transparent;
}
.ai-msg { display: flex; gap: 10px; align-items: flex-end; }
.ai-msg.user { justify-content: flex-end; }
.ai-msg .ai-bubble {
  max-width: min(78%, 640px); padding: 12px 16px; border-radius: 16px;
  font-size: 0.95rem; line-height: 1.6; overflow-wrap: break-word;
}
.ai-msg.user .ai-bubble {
  background: linear-gradient(160deg, var(--vio), var(--vio2)); color: #fff;
  border-bottom-right-radius: 5px;
}
.ai-msg.bot .ai-bubble {
  background: rgba(12, 7, 38, 0.65); border: 1px solid var(--line);
  color: var(--txt); border-bottom-left-radius: 5px;
}
.ai-msg.bot .ai-bubble p { margin: 0 0 0.7em; }
.ai-msg.bot .ai-bubble p:last-child { margin-bottom: 0; }
.ai-msg.bot .ai-bubble ul, .ai-msg.bot .ai-bubble ol { margin: 0.4em 0 0.7em; padding-left: 20px; }
.ai-msg.bot .ai-bubble li { margin-bottom: 4px; color: var(--txt); }
.ai-msg.bot .ai-bubble .md-code { background: rgba(124, 92, 222, 0.18); border-radius: 5px; padding: 1px 6px; font-size: 0.88em; }
.ai-msg.bot .ai-bubble .md-pre { background: #0d0a1f; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; overflow-x: auto; font-size: 0.85rem; margin: 0.5em 0; }
.ai-avatar {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(160deg, var(--amber-dark), var(--amber)); color: #241503;
  display: inline-flex; align-items: center; justify-content: center;
}
.ai-avatar.big { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; display: flex; }
.ai-empty { text-align: center; margin: auto; padding: 30px 10px; color: var(--mut); max-width: 480px; align-self: center; }
.ai-chips { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.ai-chip {
  background: rgba(124, 92, 222, 0.10); border: 1px solid var(--line);
  color: var(--mut); border-radius: 12px; padding: 10px 14px; font: inherit;
  font-size: 0.88rem; cursor: pointer; text-align: left; transition: border-color 0.15s, color 0.15s;
}
.ai-chip:hover { border-color: var(--vio3); color: #fff; }
.ai-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ai-typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--mut2);
  animation: aityping 1.2s infinite ease-in-out;
}
.ai-typing i:nth-child(2) { animation-delay: 0.15s; }
.ai-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes aityping { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-5px); opacity: 1; } }
.ai-err { color: var(--bad); }
.ai-composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 16px; border-top: 1px solid var(--line); background: rgba(19, 13, 54, 0.9);
}
.ai-composer textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 150px;
  padding: 12px 15px; font: inherit; font-size: 0.95rem; color: var(--txt);
  background: rgba(12, 7, 38, 0.6); border: 1.5px solid var(--line);
  border-radius: 14px; outline: none; transition: border-color 0.15s;
}
.ai-composer textarea:focus { border-color: var(--vio3); }
.ai-send {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; border: 0;
  background: linear-gradient(180deg, var(--amber2), var(--amber)); color: #241503;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.ai-send:hover { transform: translateY(-1px); }
.ai-send:disabled { opacity: 0.5; cursor: default; transform: none; }
.ai-note { font-size: 0.76rem; color: var(--mut2); text-align: center; padding: 0 16px 12px; margin: 8px 0 0; }
.ai-note a { color: var(--mut2); text-decoration: underline; }
.ai-soon { text-align: center; padding: 52px 24px; }
.ai-soon-ico {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px;
  background: linear-gradient(160deg, var(--amber-dark), var(--amber)); color: #241503;
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 640px) {
  .ai-thread { padding: 16px 12px; max-height: none; min-height: 300px; }
  .ai-msg .ai-bubble { max-width: 88%; }
}

/* ============ Widget assistant IA flottant (pages module / leçon) ============ */
.aiw-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px; cursor: pointer;
  font: 700 0.92rem var(--font-body); color: #241503;
  background: linear-gradient(180deg, var(--amber2), var(--amber));
  box-shadow: 0 8px 30px rgba(244, 185, 66, 0.35);
  transition: transform 0.15s ease;
}
.aiw-fab:hover { transform: translateY(-2px); }
.aiw-fab.open { opacity: 0; pointer-events: none; }
.aiw-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 70;
  width: min(400px, calc(100vw - 40px));
  height: min(600px, calc(100dvh - 90px));
  display: flex; flex-direction: column;
  background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.aiw-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.aiw-head-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aiw-head-t strong { font: 800 0.95rem var(--font-title); color: var(--txt); }
.aiw-head-t span {
  font-size: 0.74rem; color: var(--mut2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aiw-ico {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--mut); cursor: pointer;
}
.aiw-ico:hover { color: var(--txt); border-color: var(--vio3); }
.aiw-thread { flex: 1; min-height: 0; overflow-y: auto; }
.aiw-panel .ai-empty { padding: 18px 8px; }
.aiw-panel .ai-composer textarea { font-size: 16px; } /* évite le zoom iOS au focus */
@media (max-width: 640px) {
  .aiw-fab { right: 14px; bottom: 14px; padding: 11px 16px; }
  .aiw-panel {
    right: 0; bottom: 0; left: 0;
    width: 100vw; height: min(88dvh, 640px);
    border-radius: var(--radius) var(--radius) 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
  .aiw-panel .aiw-thread { min-height: 0; }
}

/* Panneau : l'attribut hidden doit gagner sur display:flex (croix de fermeture) */
.aiw-panel[hidden] { display: none !important; }

/* Liens internes de l'assistant → pastilles conviviales */
.ai-msg.bot .ai-bubble a { color: var(--amber2); font-weight: 600; }
.ai-msg.bot .ai-bubble a.md-ilink {
  display: inline-block; margin: 3px 2px 3px 0; padding: 3px 12px;
  background: rgba(244, 185, 66, 0.10); border: 1px solid rgba(244, 185, 66, 0.35);
  border-radius: 999px; color: var(--amber2); font-weight: 600; font-size: 0.85em;
  text-decoration: none; line-height: 1.5;
}
.ai-msg.bot .ai-bubble a.md-ilink::after { content: " →"; }
.ai-msg.bot .ai-bubble a.md-ilink:hover { background: rgba(244, 185, 66, 0.22); border-color: var(--amber); }

/* ---------- État « terminé » lisible d'un regard (sobre) ---------- */
/* Rangée de leçon terminée : teinte verte discrète + titre estompé */
.lesson-row.done {
  background: rgba(67, 217, 163, 0.055);
  border-color: rgba(67, 217, 163, 0.26);
}
.lesson-row.done:hover { border-color: rgba(67, 217, 163, 0.48); }
.lesson-row.done .t { color: var(--mut); }
.lesson-row.done .d { color: var(--ok); font-weight: 600; }

/* Carte module 100 % terminé (tableau de bord) : même langage visuel */
.mod-card.done { border-color: rgba(67, 217, 163, 0.30); background: rgba(67, 217, 163, 0.045); }
.mod-card.done:hover { border-color: rgba(67, 217, 163, 0.55); }
.mod-card.done .mod-meta { color: var(--ok); font-weight: 600; }
.mod-card.done .progressbar i { background: var(--ok-dark); }
.mod-card.done .mod-prog .pct { color: var(--ok); }

/* ---------- Tableau de bord : bloc « Bien démarrer » (onboarding) ---------- */
.onboard {
  background: linear-gradient(160deg, rgba(76, 43, 160, 0.20), rgba(19, 13, 54, 0.9));
  border: 1px solid var(--line2); border-left: 3px solid var(--amber);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 30px;
}
.onboard-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.onboard-head > div { flex: 1; }
.onboard-head h2 { font-size: 1.12rem; margin: 0 0 3px; }
.onboard-head .sub { margin: 0; font-size: 0.86rem; color: var(--mut); }
.onboard-hide {
  background: none; border: 0; color: var(--mut2); font-size: 0.78rem;
  cursor: pointer; padding: 4px 6px; white-space: nowrap;
}
.onboard-hide:hover { color: var(--txt); }
.onboard-step {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 8px; color: inherit; text-decoration: none !important;
  background: rgba(12, 7, 38, 0.45); transition: border-color 0.15s;
}
.onboard-step:last-child { margin-bottom: 0; }
.onboard-step:hover { border-color: var(--amber); }
.onboard-step .ob-t { flex: 1; min-width: 0; font-weight: 600; color: var(--txt); font-size: 0.93rem; }
.onboard-step .ob-t small { display: block; font-weight: 400; color: var(--mut2); font-size: 0.8rem; margin-top: 1px; }
.onboard-step .ob-go { color: var(--amber); font-weight: 700; }
.onboard-step.done { background: rgba(67, 217, 163, 0.055); border-color: rgba(67, 217, 163, 0.26); }
.onboard-step.done:hover { border-color: rgba(67, 217, 163, 0.48); }
.onboard-step.done .lesson-state { background: var(--ok-dark); border-color: var(--ok-dark); color: #fff; }
.onboard-step.done .ob-t { color: var(--mut); text-decoration: none; }

/* ---------- Tableau de bord : aperçu forum ---------- */
.dash-forum { margin-top: 34px; }
.dash-forum-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.dash-forum-head h2 { font-size: 1.12rem; margin: 0; }
@media (max-width: 640px) {
  .onboard { padding: 16px; }
  .onboard-step { flex-wrap: nowrap; }
}

/* ---------- Tableau de bord : graphiques membre (anneau + régularité) ---------- */
.dash-charts {
  display: grid; grid-template-columns: 232px 1fr; gap: 14px;
  margin-bottom: 30px;
}
.mchart {
  background: rgba(19, 13, 54, 0.8); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.mchart-title { font-size: 0.98rem; margin: 0 0 10px; }
.mchart-title span { color: var(--mut2); font-weight: 500; font-size: 0.8rem; }
.mchart-ring { display: flex; flex-direction: column; align-items: center; text-align: center; }
.mchart-ring svg { margin: 2px 0 6px; }
.mchart-cap { margin: 0; font-size: 0.83rem; color: var(--mut); }
.mchart-cap strong { color: var(--txt); }
.mchart-sub { margin: -4px 0 12px; font-size: 0.83rem; color: var(--mut); }
.mchart-sub strong { color: var(--txt); }
.mchart-bars svg { display: block; }
.mchart-table { margin-top: 10px; }
.mchart-table summary { font-size: 0.78rem; color: var(--mut2); cursor: pointer; }
.mchart-table table { width: 100%; margin-top: 8px; font-size: 0.8rem; border-collapse: collapse; }
.mchart-table th, .mchart-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); color: var(--mut); text-align: left; }
@media (max-width: 720px) {
  .dash-charts { grid-template-columns: 1fr; }
  .mchart-ring { flex-direction: row; gap: 16px; text-align: left; }
  .mchart-ring h2 { display: none; }
  .mchart-ring svg { flex: 0 0 auto; width: 104px; height: 104px; }
}

/* ---------- Parrainage membre ---------- */
.ref-linkbar { display: flex; gap: 10px; }
.ref-linkbar input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line2); background: rgba(12, 7, 38, 0.6);
  color: var(--amber2); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88rem;
}
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ref-stat { text-align: center; padding: 20px 14px; }
.ref-stat .n { display: block; font-family: var(--font-title); font-weight: 800; font-size: 1.9rem; color: var(--txt); }
.ref-stat .l { font-size: 0.82rem; color: var(--mut2); }
@media (max-width: 640px) {
  .ref-stats { grid-template-columns: 1fr; }
  .ref-linkbar { flex-wrap: wrap; }
}
