/* TEF Canada — Préparation. Polices système (hors ligne), thème clair et sombre. */
:root {
  --fond: #eef1f5; --papier: #ffffff; --encre: #17212e; --doux: #5a6778; --trait: #d6dce5;
  --bleu: #1d4f9e; --bleu-fort: #163d7a; --bleu-pale: #e4ebf7; --rouge: #b7342a; --rouge-pale: #f9e3e0;
  --vert: #1c7a49; --vert-pale: #e0f2e7; --ambre: #9a6400; --ambre-pale: #fbf0d9;
  --nav: #13233d; --nav-texte: #c9d4e6; --nav-actif: #ffffff;
  --c-ce: #1d4f9e; --c-co: #0f7c7a; --c-ee: #a3541b; --c-eo: #7a3fa0;
  --titre: "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
  --texte: "Segoe UI", system-ui, -apple-system, sans-serif;
  --lecture: Georgia, "Times New Roman", serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #10151c; --papier: #19202a; --encre: #e5eaf0; --doux: #9aa6b5; --trait: #2c3644;
    --bleu: #7fa7ee; --bleu-fort: #a8c3f3; --bleu-pale: #1d2b44; --rouge: #ef7f73; --rouge-pale: #3a1d1a;
    --vert: #5ec58d; --vert-pale: #153226; --ambre: #e3aa3c; --ambre-pale: #3a2c10;
    --nav: #0b121c; --nav-texte: #9fb0c8;
    --c-ce: #7fa7ee; --c-co: #4fc4c1; --c-ee: #e3955a; --c-eo: #c08be0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--texte); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { font-family: var(--titre); margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }

/* Cadre : barre latérale + contenu */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.nav { background: var(--nav); color: var(--nav-texte); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .marque { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--nav-actif); font-family: var(--titre); font-size: 1.05rem; line-height: 1.2; }
.nav .marque img { width: 34px; height: 34px; border-radius: 8px; }
.nav .marque small { display: block; font-family: var(--texte); font-size: .75rem; color: var(--nav-texte); font-weight: 400; }
.nav button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: .95rem; color: var(--nav-texte); }
.nav button:hover { background: rgba(255,255,255,.07); color: var(--nav-actif); }
.nav button.actif { background: rgba(255,255,255,.12); color: var(--nav-actif); font-family: var(--titre); }
.nav button:focus-visible { outline: 2px solid var(--nav-actif); }
.nav button[disabled] { opacity: .35; cursor: not-allowed; }
.nav .pastille { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 10px 6px; }
.nav .pied { margin-top: auto; font-size: .78rem; padding: 10px; color: var(--nav-texte); }
.vue { padding: 28px 32px 80px; display: flex; flex-direction: column; gap: 18px; max-width: 1180px; width: 100%; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 10px 12px; }
  .nav .marque, .nav .sep, .nav .pied { display: none; }
  .nav button { white-space: nowrap; }
  .vue { padding: 18px 16px 60px; }
}

/* Éléments communs */
.surtitre { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--bleu); font-weight: 700; }
.doux { color: var(--doux); } .petit { font-size: .88rem; }
.carte { background: var(--papier); border: 1px solid var(--trait); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ligne.espace { justify-content: space-between; }
.grille2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grille3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.grille4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
button, .bouton { font: inherit; font-family: var(--titre); font-size: .95rem; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--bleu); background: var(--bleu); color: #fff; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button.second { background: transparent; color: var(--bleu); }
button.danger { background: var(--rouge); border-color: var(--rouge); }
button.petit-btn { padding: 5px 10px; font-size: .85rem; }
button:disabled { opacity: .4; cursor: not-allowed; filter: none; }
button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible, .choix:focus-within { outline: 3px solid var(--bleu); outline-offset: 2px; }
input[type=text], input[type=password], input[type=date], input[type=number], select { font: inherit; padding: 8px 10px; border: 1px solid var(--trait); border-radius: 8px; background: var(--fond); color: var(--encre); }
.badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--bleu-pale); color: var(--bleu); white-space: nowrap; }
.badge.ok { background: var(--vert-pale); color: var(--vert); }
.badge.ko { background: var(--rouge-pale); color: var(--rouge); }
.badge.att { background: var(--ambre-pale); color: var(--ambre); }
.bandeau { padding: 10px 14px; border-radius: 8px; background: var(--ambre-pale); color: var(--ambre); }
.bandeau.info { background: var(--bleu-pale); color: var(--bleu); }
.bandeau.ok { background: var(--vert-pale); color: var(--vert); }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--nav); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 360px; z-index: 50; }
.barre { height: 8px; background: var(--trait); border-radius: 99px; overflow: hidden; }
.barre i { display: block; height: 100%; background: var(--bleu); border-radius: 99px; }

/* Tableau de bord */
.kpi { border-radius: 12px; padding: 16px; background: var(--papier); border: 1px solid var(--trait); display: flex; flex-direction: column; gap: 6px; border-top: 4px solid var(--c, var(--bleu)); }
.kpi .nom { font-family: var(--titre); font-size: .9rem; }
.kpi .val { font-family: var(--titre); font-size: 2rem; line-height: 1; }
.kpi .val small { font-size: .9rem; color: var(--doux); font-family: var(--texte); }
.objectif { font-size: .8rem; color: var(--doux); }
.graph svg { width: 100%; height: auto; display: block; }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; }
.legende span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }

/* Parcours */
.niveau { display: flex; flex-direction: column; gap: 10px; }
.niveau-tete { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.serie { border: 1px solid var(--trait); border-radius: 10px; padding: 14px; background: var(--papier); display: flex; flex-direction: column; gap: 8px; }
.serie.verrou { opacity: .55; }
.serie .titre { font-family: var(--titre); }
.etoiles { color: var(--ambre); letter-spacing: 2px; }

/* En-tête d'activité */
.entete { position: sticky; top: 0; z-index: 5; background: var(--fond); padding: 10px 0; border-bottom: 1px solid var(--trait); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chrono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.15rem; padding: 4px 12px; border-radius: 6px; background: var(--papier); border: 1px solid var(--trait); }
.chrono.bas { color: var(--rouge); border-color: var(--rouge); }

/* Questions */
.ce { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .ce { grid-template-columns: 1fr; } }
.document { background: var(--papier); border: 1px solid var(--trait); border-radius: 12px; padding: 22px; font-family: var(--lecture); font-size: 1.05rem; line-height: 1.65; display: flex; flex-direction: column; gap: 10px; }
.document .source { font-family: var(--texte); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--doux); }
.document h3 { font-family: var(--lecture); font-size: 1.25rem; }
.question { font-weight: 600; font-size: 1.05rem; }
.choix-liste { display: flex; flex-direction: column; gap: 8px; }
.choix { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 8px; cursor: pointer; background: var(--papier); }
.choix:hover { border-color: var(--bleu); }
.choix input { margin-top: 4px; accent-color: var(--bleu); }
.choix.sel { border-color: var(--bleu); background: var(--bleu-pale); }
.choix.bonne { border-color: var(--vert); background: var(--vert-pale); }
.choix.fausse { border-color: var(--rouge); background: var(--rouge-pale); }
.choix .lettre { font-family: var(--titre); min-width: 1.2em; }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.pastilles button { width: 38px; padding: 6px 0; font-family: var(--mono); font-size: .85rem; background: var(--papier); color: var(--encre); border-color: var(--trait); }
.pastilles button.repondu { background: var(--bleu-pale); border-color: var(--bleu); color: var(--bleu); }
.pastilles button.juste { background: var(--vert-pale); border-color: var(--vert); color: var(--vert); }
.pastilles button.faux { background: var(--rouge-pale); border-color: var(--rouge); color: var(--rouge); }
.pastilles button.courant { outline: 2px solid var(--bleu); }
.retour { border-left: 4px solid var(--trait); padding: 8px 12px; border-radius: 0 6px 6px 0; background: var(--fond); font-size: .93rem; }
.retour.ok { border-color: var(--vert); } .retour.ko { border-color: var(--rouge); }
.citation { font-family: var(--lecture); font-style: italic; color: var(--doux); }
.ecoute { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px; border-radius: 8px; background: var(--bleu-pale); }
.onde { display: flex; gap: 3px; align-items: center; height: 26px; }
.onde i { width: 4px; height: 8px; background: var(--bleu); border-radius: 2px; }
.onde.active i { animation: onde .9s ease-in-out infinite; }
.onde i:nth-child(2) { animation-delay: .1s; } .onde i:nth-child(3) { animation-delay: .2s; } .onde i:nth-child(4) { animation-delay: .3s; } .onde i:nth-child(5) { animation-delay: .4s; }
@keyframes onde { 50% { height: 24px; } }
.transcription { font-family: var(--lecture); font-style: italic; background: var(--fond); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; }
.transcription b { font-style: normal; font-family: var(--texte); font-size: .8rem; color: var(--doux); }

/* Production écrite / orale */
textarea { width: 100%; min-height: 280px; font: inherit; font-family: var(--lecture); font-size: 1.02rem; line-height: 1.6; color: var(--encre); background: var(--fond); border: 1px solid var(--trait); border-radius: 8px; padding: 12px; resize: vertical; }
.sujet { font-family: var(--lecture); background: var(--bleu-pale); border-radius: 8px; padding: 12px 14px; white-space: pre-line; }
.annonce { font-family: var(--lecture); border: 2px dashed var(--bleu); border-radius: 10px; padding: 16px; white-space: pre-line; font-size: 1.05rem; }
.compteur { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .9rem; }
.compteur.insuffisant { color: var(--ambre); } .compteur.suffisant { color: var(--vert); }
.enreg { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--rouge); }
.enreg::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--rouge); animation: clignote 1s infinite; }
@keyframes clignote { 50% { opacity: .2; } }
.objections { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.objections li { padding: 10px 12px; border-radius: 8px; background: var(--fond); border-left: 4px solid var(--trait); }
.objections li.nouvelle { border-left-color: var(--rouge); background: var(--rouge-pale); }
.provisoire { color: var(--doux); font-style: italic; min-height: 1.4em; }

/* Évaluation */
.critere { display: grid; grid-template-columns: minmax(0, 1fr) 70px; gap: 4px 14px; padding: 10px 0; border-bottom: 1px solid var(--trait); }
.critere:last-child { border-bottom: 0; }
.critere .note { font-family: var(--mono); font-size: 1.1rem; text-align: right; }
.critere .com { grid-column: 1 / -1; font-size: .92rem; color: var(--doux); }
.texte-annote { font-family: var(--lecture); line-height: 1.8; white-space: pre-wrap; background: var(--fond); border-radius: 8px; padding: 14px; }
.texte-annote mark { background: var(--rouge-pale); color: inherit; border-bottom: 2px solid var(--rouge); padding: 0 1px; border-radius: 2px; cursor: help; }
.erreur { border-left: 4px solid var(--rouge); padding: 8px 12px; background: var(--fond); border-radius: 0 6px 6px 0; font-size: .93rem; }
.grand-nclc { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.grand-nclc .n { font-family: var(--titre); font-size: 3.2rem; line-height: 1; color: var(--bleu); }
.chargement { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--trait); border-top-color: var(--bleu); border-radius: 50%; animation: tourne .8s linear infinite; vertical-align: -3px; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* Tableaux */
.tableau { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--trait); vertical-align: top; }
th { font-family: var(--titre); color: var(--doux); font-weight: 600; }
details summary { cursor: pointer; font-family: var(--titre); }
.item { border: 1px solid var(--trait); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; font-size: .94rem; }
.item.ok { border-left: 4px solid var(--vert); } .item.ko { border-left: 4px solid var(--rouge); }
.stat { display: grid; grid-template-columns: minmax(0, 1fr) 60px 120px; gap: 10px; align-items: center; font-size: .92rem; }
/* Comptes */
.app.sans-nav { grid-template-columns: 1fr; }
.app.sans-nav .nav { display: none; }
.accueil-comptes { max-width: 720px; margin: 40px auto 0; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.marque-grande { display: flex; align-items: center; gap: 16px; }
.marque-grande img { width: 64px; height: 64px; border-radius: 14px; }
.liste-comptes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.compte { all: unset; box-sizing: border-box; display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--trait); border-radius: 10px; cursor: pointer; background: var(--fond); }
.compte:hover, .compte:focus-visible { border-color: var(--bleu); background: var(--bleu-pale); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bleu); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--titre); font-size: 1.1rem; flex: none; }
.avatar.petit-av { width: 28px; height: 28px; font-size: .85rem; }
.champ { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--doux); flex: 1; min-width: 200px; }
.champ input { color: var(--encre); }
.utilisateur { display: flex; align-items: center; gap: 8px; color: var(--nav-actif); font-family: var(--titre); margin-bottom: 6px; }
.nav .lien, .lien { all: unset; cursor: pointer; text-decoration: underline; color: var(--nav-texte); font-size: .8rem; padding: 0; }
.nav .lien:hover { color: var(--nav-actif); background: none; }

/* Niveau global */
.grille-niveau { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.niveau-global { border-top: 4px solid var(--bleu); gap: 6px; }
.niveau-global .grand { font-family: var(--titre); font-size: 3rem; line-height: 1; color: var(--bleu); }

/* Questions sans document (phrases à compléter) */
.seul { max-width: 760px; width: 100%; }
.trou { display: inline-block; min-width: 90px; border-bottom: 2px solid var(--bleu); color: transparent; margin: 0 2px; }

/* Ressources */
.ressource { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--trait); border-radius: 12px; background: var(--papier); color: var(--encre); text-decoration: none; }
.ressource:hover { border-color: var(--bleu); }
.doc-ico { flex: none; width: 46px; height: 56px; border-radius: 6px; background: var(--rouge); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--titre); font-size: .8rem; }

/* Réglages des voix */
.reglages-voix { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; align-items: end; }
.reglages-voix label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--doux); }
.reglages-voix select, .reglages-voix input[type=range] { width: 100%; }

/* Cours */
.programme { display: flex; flex-direction: column; gap: 8px; }
.prog-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--trait); border-radius: 10px; background: var(--fond); }
.prog-item.fait { opacity: .7; }
.prog-num { width: 30px; height: 30px; border-radius: 50%; background: var(--vert); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--titre); }
.prog-texte { min-width: 0; }
.cours-contenu { font-size: 1.02rem; line-height: 1.65; max-width: 860px; }
.cours-contenu h3 { margin-top: 8px; color: var(--bleu); }
.cours-contenu ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.exemple { border-left: 4px solid var(--bleu); background: var(--bleu-pale); padding: 12px 14px; border-radius: 0 8px 8px 0; font-family: var(--lecture); }
.exemple b { font-family: var(--titre); display: block; margin-bottom: 4px; }
.astuce { border-left: 4px solid var(--ambre); background: var(--ambre-pale); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.astuce b { color: var(--ambre); margin-right: 4px; }
.quiz-q { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--trait); }
.cours-conseils { border-left: 4px solid var(--vert); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
