:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2030;
  --muted: #6a7084;
  --border: #e2e5ee;
  --accent: #3b5bdb;
  --accent-soft: #e7ecff;
  --student: #3b5bdb;
  --student-text: #ffffff;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --surface: #1b1e29;
    --text: #e8eaf2;
    --muted: #9298ad;
    --border: #2c3040;
    --accent: #7c93ff;
    --accent-soft: #252c4a;
    --student: #3b5bdb;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; }
.tag { font-weight: 500; font-size: 12px; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; margin-left: 6px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 16px; }

/* Connexion */
.login-form { display: flex; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.login-form input {
  flex: 1; min-width: 200px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; letter-spacing: .05em; text-transform: uppercase;
}
.login-form .btn.primary { margin-left: 0; }
.error-text { color: #d64545; margin: 4px 0; }
.notice { font-size: 13px; color: var(--muted); margin-top: 24px; }
.muted { color: var(--muted); margin-top: 0; }

/* Avis */
.feedback-dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(460px, calc(100vw - 32px)); padding: 20px;
}
.feedback-dialog::backdrop { background: rgb(0 0 0 / .45); }
.feedback-dialog h2 { margin: 0 0 4px; }
.feedback-dialog fieldset { border: none; padding: 0; margin: 12px 0; }
.feedback-dialog legend { font-weight: 600; margin-bottom: 6px; }
.stars button { background: none; border: none; font-size: 30px; cursor: pointer; color: var(--border); padding: 0 2px; }
.stars button.on { color: #f5b301; }
.choices { display: flex; gap: 16px; }
.comment-label { display: block; font-weight: 600; margin: 12px 0 6px; }
.feedback-dialog textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.dialog-actions .btn.primary { margin-left: 0; }

/* Choix de l'exercice */
.picker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chapter-title { font-size: 17px; margin: 24px 0 10px; color: var(--muted); font-weight: 600; }
.picker { max-width: 720px; margin: 0 auto; padding: 24px 16px; width: 100%; }
.picker h1 { margin: 0 0 4px; }
.chapter { color: var(--muted); margin: 0 0 20px; }
.exercise-list { display: grid; gap: 12px; }
.exercise-card {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; color: inherit; font: inherit;
}
.exercise-card:hover { border-color: var(--accent); }
.exercise-card strong { display: block; margin-bottom: 4px; }
.difficulty { color: var(--muted); font-size: 14px; }

/* Khôlle */
.kholle { flex: 1; display: grid; grid-template-columns: minmax(280px, 2fr) 3fr; min-height: 0; }
.enonce-panel { overflow-y: auto; padding: 16px; border-right: 1px solid var(--border); background: var(--surface); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel-head h2 { margin: 0 0 12px; font-size: 20px; }
.chat-panel { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* flex-shrink: 0 : sinon, quand il y a beaucoup de messages, la colonne les écrase au lieu de défiler. */
.msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius); overflow-x: auto; flex-shrink: 0; }
.msg.kholleur { background: var(--surface); border: 1px solid var(--border); align-self: flex-start; }
.msg.eleve { background: var(--student); color: var(--student-text); align-self: flex-end; }
.msg.eleve .katex { color: inherit; }
.msg.saved { align-self: center; background: #e3f6e8; color: #1f6b35; font-weight: 600; }
@media (prefers-color-scheme: dark) { .msg.saved { background: #173a24; color: #8fe0a8; } }

/* Prochaine khôlle conseillée */
.reco { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0 8px; }
.reco-label { font-size: 13px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.reco-body { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.reco-body strong { font-size: 17px; }
.reco-chapter { font-size: 13px; color: var(--muted); }
.reco-reason { margin-top: 4px; }
.reco .btn.primary { margin-left: 0; }

/* Chapitres dépliables, groupés par matière */
.subject-title { font-size: 20px; margin: 28px 0 10px; }
.chapter-box { background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; margin-bottom: 8px; }
.chapter-box.status-red { border-left-color: #d64545; }
.chapter-box.status-orange { border-left-color: #e8930c; }
.chapter-box.status-green { border-left-color: #2f9e55; }
.chapter-box > summary { padding: 10px 12px; cursor: pointer; list-style: none; }
.chapter-box > summary::-webkit-details-marker { display: none; }
.chapter-box > summary .progress-top strong::after { content: " ▸"; color: var(--muted); font-weight: 400; }
.chapter-box[open] > summary .progress-top strong::after { content: " ▾"; }
.chapter-box > .exercise-list { padding: 0 12px 12px; }

/* Onglets par matière */
.tabs { display: flex; gap: 6px; margin: 28px 0 12px; border-bottom: 1px solid var(--border); }
.tab {
  font: inherit; font-size: 16px; font-weight: 600; color: var(--muted); background: none; cursor: pointer;
  border: 1px solid transparent; border-bottom: none; border-radius: 10px 10px 0 0; padding: 8px 14px; margin-bottom: -1px;
}
.tab.on { color: var(--text); background: var(--surface); border-color: var(--border); }
.tab-count { font-size: 12px; font-weight: 400; color: var(--muted); }

/* Deux sections par chapitre : questions de cours et exercices */
.section-title { font-size: 14px; margin: 4px 12px 8px; }
.chapter-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 12px 8px; }
.section-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.cours-card .cours-question { font-size: 14px; line-height: 1.45; }
.cours-card .cours-question p { margin: 0; }
.chapter-box .exercise-card { background: var(--bg); }
.progress-top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.status-label { font-size: 13px; color: var(--muted); }
.progress-details { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 99px; }
.bar.good > div { background: #2f9e55; }
.bar.mid > div { background: #e8930c; }
.bar.low > div { background: #d64545; }

/* Détail d'une khôlle */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 12px 0; }
.detail-head h1 { margin: 0 0 4px; font-size: 24px; }
.detail-note { font-size: 34px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.criteria { display: grid; gap: 10px; margin-bottom: 10px; }
.criterion-top { display: flex; justify-content: space-between; font-size: 14px; }
.criterion .bar { margin-top: 4px; }
.detail-actions { margin: 14px 0; }
.detail-actions .btn.primary { margin-left: 0; }
.detail-messages { overflow: visible; padding: 0; }

/* Historique */
.history-item {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; width: 100%; text-align: left;
  background: none; border: none; color: inherit; font: inherit; padding: 0; cursor: pointer;
}
.history-list li:hover { border-color: var(--accent); }
.history { margin-bottom: 8px; }
.history-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; align-items: baseline; }
.model-table { flex-basis: 100%; border-collapse: collapse; font-size: 14px; margin-top: 4px; }
.model-table th, .model-table td { border: 1px solid var(--border); padding: 4px 10px; text-align: left; }
.model-table th { color: var(--muted); font-weight: 600; }

/* Choix du modèle (admin) */
.model-picker { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0 4px; font-size: 14px; }
.model-picker-label { color: var(--muted); }
.model-options { display: flex; gap: 4px; }
.model-option { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 4px 12px; cursor: pointer; font: inherit; }
.model-option.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.panel-head .tag { align-self: center; }
.history-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.history-list li {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.h-note { font-weight: 700; min-width: 56px; color: var(--accent); }
.h-title { flex: 1; }
.h-meta { font-size: 13px; color: var(--muted); }
.open-badge { display: block; width: fit-content; margin: 2px 0 4px; font-size: 12px; font-weight: 600; color: #8a5cf6; background: rgb(138 92 246 / .12); padding: 2px 8px; border-radius: 99px; }
.done-badge { display: block; margin-top: 6px; font-size: 13px; color: #2f9e55; font-weight: 600; }

.msg.error { background: #fde8e8; color: #9b1c1c; align-self: center; }
.msg img { max-width: 220px; border-radius: 8px; display: block; margin-bottom: 6px; }
.msg.pending::after { content: "▍"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md table { border-collapse: collapse; margin: 8px 0; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 10px; }
.md h2 { font-size: 18px; margin: 4px 0 8px; }
.md ol, .md ul { padding-left: 22px; margin: 4px 0 8px; }

.preview { display: flex; gap: 8px; padding: 8px 16px 0; flex-wrap: wrap; }
.preview figure { margin: 0; position: relative; }
.preview img { height: 64px; border-radius: 8px; border: 1px solid var(--border); }
.preview button { position: absolute; top: -6px; right: -6px; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; }

.composer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.composer textarea {
  width: 100%; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.symbols { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.sym {
  min-width: 34px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px; cursor: pointer;
}
.sym:hover { border-color: var(--accent); }
.formula-btn { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.formula-editor { border: 1px solid var(--accent); border-radius: 10px; padding: 8px; margin-bottom: 8px; background: var(--bg); }
.formula-editor math-field {
  display: block; width: 100%; font-size: 22px; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.formula-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.formula-actions .btn.primary { margin-left: 0; }
.formula-hint { font-size: 12px; color: var(--muted); margin-right: auto; }

.live-preview {
  margin-top: 6px; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--border);
  font-size: 15px; overflow-x: auto;
}
.live-preview::before { content: "Aperçu"; display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }

.actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.btn { border-radius: 10px; padding: 8px 14px; font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); margin-left: auto; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.armed { background: #d64545; border-color: #d64545; color: #fff; }
.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.cost { font-size: 12px; color: var(--muted); padding: 0 16px 8px; background: var(--surface); text-align: right; }

@media (max-width: 760px) {
  .kholle { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .enonce-panel { max-height: 35vh; border-right: none; border-bottom: 1px solid var(--border); }
  .msg { max-width: 95%; }
}

/* Corrigé rédigé */
.corrige-dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
}
.corrige-dialog::backdrop { background: rgb(0 0 0 / .5); }
.corrige-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.corrige-head h2 { margin: 0; font-size: 18px; }
.corrige-body { padding: 8px 20px 20px; line-height: 1.6; }
.corrige-body h2 { font-size: 17px; margin: 20px 0 8px; color: var(--accent); }
.corrige-body .katex-display { overflow-x: auto; overflow-y: hidden; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Flashcards */
.cards-entry {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 8px 0;
}
.cards-entry .muted { margin: 2px 0 0; font-size: 14px; }
.cards-entry .btn.primary { margin-left: 0; }
.cards-summary {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 16px;
}
.cards-summary .muted { font-size: 13px; margin-top: 2px; }
.cards-summary .btn.primary { margin-left: 0; }
.cards-chapters { display: grid; gap: 8px; }
.cards-row {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.cards-row-info { flex: 1; min-width: 200px; }
.cards-row-actions { display: flex; gap: 6px; }
.cards-row-actions .btn.primary { margin-left: 0; }
.due-count { color: var(--accent); font-weight: 600; }

/* Cartes personnelles */
.cards-summary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cards-summary-actions .btn.primary { margin-left: 0; }
.custom-count { color: var(--muted); }
.card-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.card-dialog select {
  width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.card-dialog code { font-size: 12px; }
.card-preview { margin-top: 6px; padding: 8px 12px; border: 1px dashed var(--border); border-radius: 10px; font-size: 14px; }
.card-dialog .dialog-actions { flex-wrap: wrap; }
.btn.danger { color: #d33; border-color: #d33; margin-right: auto; }
.card-badges { display: flex; align-items: center; gap: 10px; }
.card-badges:has(> :not([hidden])) { margin-bottom: 8px; }
.card-badges .card-new { margin-bottom: 0; }
.card-mine { color: var(--muted); }
.card-tools { margin-left: auto; position: relative; }
.icon-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 6px 8px;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { border-color: var(--accent); }
.card-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .25); padding: 6px; display: grid; gap: 2px;
}
.card-menu[hidden] { display: none; }
.card-menu button {
  background: none; border: none; border-radius: 6px; color: var(--text); cursor: pointer;
  font: inherit; font-size: 14px; padding: 8px 10px; text-align: left;
}
.card-menu button:hover { background: var(--bg); }
.card-menu .danger-text { color: #d33; }
.study-top-right { display: flex; align-items: center; gap: 14px; }
#study-undo { font-size: 14px; }
.exo-cours-item { display: grid; gap: 6px; align-content: start; }
.exo-cours-item .exercise-card { height: auto; }
.btn.add-result { font-size: 13px; padding: 6px 10px; justify-self: start; }
.study-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.study-actions .study-keys { margin: 0; }
.mycards-list { display: grid; gap: 8px; }
.mycard { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.mycard .md { flex: 1; min-width: 0; }

.study-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.study-top .tag { margin-left: 0; font-size: 13px; }
.study-top .muted { font-size: 14px; }
.flashcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 20px; margin: 16px 0; min-height: 180px; font-size: 18px; line-height: 1.55; overflow-x: auto;
}
.card-new { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.card-q { font-weight: 600; }
.card-a { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }
.btn.card-show { display: block; width: 100%; margin: 0; padding: 12px; }
kbd { font: 12px ui-monospace, monospace; border: 1px solid rgb(255 255 255 / .5); border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: 10px 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.grade span { font-size: 12px; font-weight: 400; color: var(--muted); }
.grade.g1 { border-color: #d64545; color: #d64545; }
.grade.g2 { border-color: #e8930c; color: #c27606; }
.grade.g3 { border-color: #2f9e55; color: #2f9e55; }
.grade.g4 { border-color: var(--accent); color: var(--accent); }
.grade:hover { background: var(--bg); }
.study-keys { font-size: 13px; margin-top: 12px; text-align: center; }
.study-end { text-align: center; padding: 24px 0; }
.study-end .btn.primary { margin-left: 0; }
@media (max-width: 520px) {
  .grades { grid-template-columns: repeat(2, 1fr); }
  .flashcard { font-size: 16px; padding: 18px 14px; }
}

/* Figures : molécules (blocs ```smiles) et schémas (public/figures/*.svg) */
.md figure { margin: 12px 0; text-align: center; }
.md .molecules { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 4px 20px; margin: 12px 0; }
.md .molecules figure { margin: 0; flex: 0 1 170px; }
.md figure.molecule svg { width: 170px; max-width: 100%; height: auto; }
.md figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.md img[src*="figures/"] { display: block; max-width: min(100%, 460px); height: auto; margin: 12px auto; }
/* Les schémas sont tracés en noir : en thème sombre, on les inverse. */
@media (prefers-color-scheme: dark) { .md img[src*="figures/"] { filter: invert(1) hue-rotate(180deg); } }
/* Schémas de réaction des cartes « Bilan » : pas de réduction sous 520 px de large (la carte défile horizontalement). */
.md img[src*="figures/bilan-"] { max-width: 100%; }
@media (max-width: 520px) { .md img[src*="figures/bilan-"] { max-width: none; margin-left: 0; } }

/* Accueil, création de compte, connexion */
.onboard { max-width: 640px; }
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: clamp(24px, 6vw, 32px); line-height: 1.2; margin: 8px 0 10px; }
.hero-sub { color: var(--muted); margin: 0 0 12px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.onboard-step { margin-top: 24px; }
.onboard-step h2 { font-size: 17px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.step-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 13px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
  padding: 10px 16px; border-radius: 99px; cursor: pointer; min-height: 44px;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip small { display: block; font-size: 12px; font-weight: 400; opacity: .8; }
.onboard-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 28px; }
.onboard-actions .btn.primary { margin-left: 0; }
.btn.big { padding: 12px 22px; font-weight: 600; }
.profile-recap { color: var(--muted); margin: 0 0 16px; }
.profile-recap b { color: var(--text); }
.account-form { display: grid; gap: 12px; margin: 8px 0; }
.account-form label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.account-form input {
  padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 400;
}
.account-form .btn.primary { margin-left: 0; justify-self: start; }
.field-hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.offer-box { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); }
.offer-box p { margin: 4px 0 0; font-size: 14px; }
.code-login { margin-top: 16px; }
.code-login summary { cursor: pointer; color: var(--muted); font-size: 14px; }

/* Offre gratuite dans l'appli */
.free-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 16px 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.free-banner-text { font-size: 14px; color: var(--muted); }
.free-banner .btn.primary { margin-left: 0; }
.exercise-card.locked, .chapter-box.locked > summary { opacity: .6; }
.exercise-card.locked { cursor: pointer; }
.lock-note { display: block; font-size: 13px; color: var(--muted); }
.sub-list { padding-left: 20px; margin: 8px 0; }
.sub-list li { margin: 4px 0; }
.sub-soon { font-size: 14px; font-weight: 600; }
.sub-offres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.sub-offre { display: grid; gap: 2px; text-align: left; padding: 12px 14px; }
.sub-offre strong { font-size: 17px; }
.sub-offre small { color: var(--muted); }
.sub-offre.best { border-color: var(--accent); }
.pay-notice { margin: 12px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); }
.pay-notice.err { background: #fde8e8; color: #9b1c1c; }
.head-links { display: inline-flex; gap: 12px; flex-wrap: wrap; }

/* Liens vers les pages légales et cases d'acceptation */
.legal-links { margin-top: 32px; font-size: 13px; color: var(--muted); text-align: center; }
.legal-links a { color: var(--muted); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
label.check input { margin-top: 3px; flex-shrink: 0; width: 18px; height: 18px; }
label.check a { color: var(--accent); }
.sub-dialog label.check { margin: 12px 0; }
