:root {
  --fond: #f6f7f4; --carte: #ffffff; --texte: #1c2420; --doux: #5b665f; --ligne: #dde3dc;
  --accent: #14532d; --accent-2: #166534; --accent-clair: #e6f2ea;
  --jaune: #92400e; --jaune-fond: #fef3c7; --rouge: #991b1b; --rouge-fond: #fee2e2; --gris-fond: #eceeea;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #101512; --carte: #18201b; --texte: #e8eee9; --doux: #9fb0a5; --ligne: #2b3730;
    --accent: #4ade80; --accent-2: #86efac; --accent-clair: #16301f;
    --jaune: #fcd34d; --jaune-fond: #3a2e10; --rouge: #fca5a5; --rouge-fond: #3b1717; --gris-fond: #222b25;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.entete { background: var(--accent); color: #fff; padding: 14px 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .entete { background: #0e2a18; } }
.marque { max-width: 920px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.logo { width: 36px; height: 36px; color: #0b3a1e; flex: none; }
.marque h1 { margin: 0; font-size: 1.15rem; line-height: 1.2; }
.marque p { margin: 0; font-size: .85rem; opacity: .85; }
main { max-width: 920px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 16px; }
.carte h2 { margin: 0 0 4px; font-size: 1.05rem; }
.aide { margin: 0 0 12px; color: var(--doux); font-size: .9rem; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
label { display: grid; gap: 4px; font-size: .88rem; color: var(--doux); font-weight: 600; }
.facultatif { font-weight: 400; font-size: .78rem; }
input, select { font: inherit; color: var(--texte); background: var(--fond); border: 1px solid var(--ligne); border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
button { font: inherit; font-weight: 600; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button { color: #062010; } }
button.secondaire { background: transparent; color: var(--accent); }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.chiffre { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 14px 16px; }
.chiffre .etiquette { font-size: .8rem; color: var(--doux); }
.chiffre .valeur { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.chiffre.fort { background: var(--accent-clair); border-color: var(--accent); }
.chiffre small { color: var(--doux); }
.tableau-conteneur { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--ligne); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--doux); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { display: block; color: var(--doux); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.verifie { background: var(--accent-clair); color: var(--accent); }
.badge.a_verifier { background: var(--jaune-fond); color: var(--jaune); }
.badge.incertain { background: var(--rouge-fond); color: var(--rouge); }
.badge.declare { background: var(--gris-fond); color: var(--doux); }
.regime { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.regime strong { font-size: 1.1rem; }
ul { margin: 6px 0 0; padding-left: 20px; }
li { margin: 4px 0; }
.liste-ech { list-style: none; padding: 0; display: grid; gap: 6px; }
.liste-ech li { display: flex; gap: 10px; background: var(--fond); border-radius: 8px; padding: 8px 10px; margin: 0; }
.jour { font-weight: 700; min-width: 2.4rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.pied { max-width: 920px; margin: 0 auto; padding: 8px 16px 32px; color: var(--doux); font-size: .82rem; }
.pied a { color: var(--accent-2); }
[hidden] { display: none !important; }
@media (max-width: 520px) { main { padding: 12px; } .carte { padding: 14px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.onglets { max-width: 920px; margin: 12px auto 0; padding: 0 16px; display: flex; gap: 8px; }
.onglet { background: transparent; color: var(--doux); border: 1px solid var(--ligne); min-height: 44px; }
.onglet[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .onglet[aria-selected="true"] { color: #062010; } }
.employes { display: grid; gap: 10px; }
.employe { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; border: 1px solid var(--ligne); border-radius: 10px; padding: 10px; background: var(--fond); }
.employe .retirer { background: transparent; color: var(--rouge); border-color: var(--ligne); min-height: 44px; }
.employe label { font-size: .8rem; }
.employe > *, .grille > *, input, select { min-width: 0; }
.employe { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.grille { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
main { grid-template-columns: minmax(0, 1fr); }
main > *, #resultats, #res-salaires { min-width: 0; }
#res-salaires { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
#resultats { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.puce { margin-left: auto; display: grid; text-align: left; line-height: 1.15; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); color: #fff; padding: 6px 12px; min-height: 44px; border-radius: 10px; font-weight: 600; max-width: 55%; }
.puce span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puce small { font-weight: 400; opacity: .85; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog { border: 1px solid var(--ligne); border-radius: 14px; background: var(--carte); color: var(--texte); max-width: min(560px, calc(100vw - 24px)); width: 100%; padding: 20px; }
dialog::backdrop { background: rgba(8, 20, 12, .55); }
dialog h2 { margin: 0 0 4px; }
dialog h3 { margin: 16px 0 8px; font-size: .95rem; }
.petit { font-size: .8rem; margin-top: 12px; }
.liste-profils { list-style: none; padding: 0; display: grid; gap: 8px; }
.liste-profils li { margin: 0; display: flex; gap: 8px; }
.liste-profils .choix { flex: 1; text-align: left; background: var(--fond); color: var(--texte); border: 1px solid var(--ligne); display: grid; gap: 0; padding: 8px 12px; line-height: 1.25; }
.liste-profils .choix small { color: var(--doux); font-weight: 400; }
.liste-profils .suppr { background: transparent; color: var(--rouge); border: 1px solid var(--ligne); }
.carte-secteur { border-left: 4px solid var(--accent); }
.carte-secteur ul { margin-top: 4px; }
.ligne-compte { display: flex; gap: 10px; justify-content: space-between; align-items: center; background: var(--fond); border-radius: 8px; padding: 6px 6px 6px 12px; margin: 8px 0; font-size: .9rem; word-break: break-all; }
.onglets.interne { padding: 0; margin: 12px 0; }
.onglets.interne .onglet { flex: 1; }
.grille.une { grid-template-columns: minmax(0, 1fr); }
.erreur { color: var(--rouge); background: var(--rouge-fond); border-radius: 8px; padding: 8px 12px; margin: 10px 0 0; font-size: .9rem; }
.lien { background: transparent; border: none; color: var(--accent-2); text-decoration: underline; min-height: 44px; padding: 0 8px; font-weight: 500; }
.info { color: var(--accent); background: var(--accent-clair); border-radius: 8px; padding: 8px 12px; margin: 10px 0 0; font-size: .9rem; }

/* ---------- Académie ---------- */
#academie-contenu { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
progress { width: 100%; height: 12px; border-radius: 999px; overflow: hidden; appearance: none; -webkit-appearance: none; border: none; background: var(--gris-fond); }
progress::-webkit-progress-bar { background: var(--gris-fond); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .4s ease; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.profil-academie .ligne-profil { display: flex; justify-content: space-between; align-items: end; margin-bottom: 8px; }
.gros { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.xp { color: var(--accent); font-weight: 600; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; padding: 0; margin: 8px 0; font-size: .9rem; }
.badges-liste { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0; }
.badges-liste li { background: var(--accent-clair); color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: .82rem; font-weight: 600; margin: 0; }
.avis { background: var(--jaune-fond); color: var(--jaune); border-radius: 8px; padding: 8px 12px; font-size: .88rem; margin: 8px 0; }
.liste-lecons { list-style: none; padding: 0; display: grid; gap: 8px; margin: 8px 0 16px; }
.liste-lecons li { margin: 0; }
.lecon-carte { width: 100%; display: flex; gap: 12px; align-items: center; text-align: left; background: var(--fond); color: var(--texte); border: 1px solid var(--ligne); padding: 10px 12px; min-height: 56px; }
.lecon-carte .coche { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--gris-fond); color: var(--doux); font-weight: 700; }
.lecon-carte .texte { display: grid; gap: 0; line-height: 1.25; }
.lecon-carte small { color: var(--doux); font-weight: 400; }
.entete-lecon { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.points-etapes { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; }
.points-etapes li { flex: 1; height: 6px; border-radius: 3px; background: var(--gris-fond); margin: 0; }
.points-etapes li.fait { background: var(--accent-2); }
.points-etapes li.actuel { background: var(--accent); }
.question-depart { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
.exemple { background: var(--accent-clair); border-radius: 10px; padding: 12px 14px; }
.question { border: 1px solid var(--ligne); border-radius: 10px; margin: 0 0 12px; padding: 10px 12px; }
.question legend { font-weight: 600; padding: 0 6px; }
.choix { display: flex; gap: 10px; align-items: center; padding: 10px 6px; min-height: 44px; font-weight: 400; font-size: 1rem; color: var(--texte); cursor: pointer; border-radius: 8px; }
.choix input { width: 22px; height: 22px; min-height: 0; flex: none; }
.choix:hover { background: var(--fond); }
.corrections { list-style: none; padding: 0; display: grid; gap: 8px; }
.corrections li { border-radius: 8px; padding: 10px 12px; margin: 0; }
.corrections li.juste { background: var(--accent-clair); }
.corrections li.faux { background: var(--rouge-fond); }
.corrections small { display: block; color: var(--doux); margin-top: 4px; }
.score { font-size: 1.2rem; font-weight: 700; }
.gain { display: inline-block; color: var(--accent); background: var(--accent-clair); border-radius: 999px; padding: 2px 10px; margin-left: 6px; animation: gain .6s ease-out; }
@keyframes gain { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.nouveau-badge { background: var(--accent-clair); border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.sources-lecon { list-style: none; padding: 0; }
.sources-lecon small { display: block; color: var(--doux); }
.resultat.echec { border-left: 4px solid var(--jaune); }
.resultat.reussi { border-left: 4px solid var(--accent); }
.cle { display: inline-block; font-size: 1.05rem; letter-spacing: .08em; background: var(--fond); border: 1px dashed var(--ligne); border-radius: 8px; padding: 8px 12px; margin: 8px 0; user-select: all; word-break: break-all; }
