:root {
  --fond: #F5F7FB;
  --surface: #FFFFFF;
  --encre: #14171F;
  --encre-2: #374151;
  --discret: #4B5563;
  --bord: #E3E7EF;
  --bord-fort: #CBD2DE;
  --accent: #1D4ED8;
  --accent-fonce: #1E3A8A;
  --accent-clair: #DBEAFE;
  --ok: #0F766E;
  --ok-fonce: #115E59;
  --ok-clair: #F0FDFA;
  --attention: #9A3412;
  --attention-fonce: #7C2D12;
  --attention-clair: #FFEDD5;
  --danger: #B91C1C;
  --nuit: #14171F;
  --rayon: 14px;
  --police: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --titres: 'Space Grotesk', Inter, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--police); font-size: 16px; line-height: 1.5; }
h1, h2 { font-family: var(--titres); line-height: 1.15; margin: 0; }
h1 { font-size: 28px; }
h1:focus { outline: none; }
h2 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-fonce); }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.discret { color: var(--discret); }
.petit { font-size: 13px; }
.centre { text-align: center; }
.pile { display: flex; flex-direction: column; gap: 16px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--bord-fort);
  background: var(--surface); color: var(--encre); font: 600 15px var(--police); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #94A3B8; color: var(--encre); }
.btn:focus-visible, .puce:focus-visible, .onglet:focus-visible, .menu-lien:focus-visible { outline: 3px solid #93C5FD; outline-offset: 2px; }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.btn-primaire { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn-primaire:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); color: #FFFFFF; }
.btn-secondaire { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { color: #FFFFFF; background: #991B1B; }
.btn-large { min-height: 52px; font-size: 16px; width: 100%; }
.btn-lien { border: none; background: none; padding: 0 4px; color: var(--accent); min-height: 40px; }
.btn-lien.danger { color: var(--danger); }
.btn-icone { padding: 0; width: 44px; border-color: transparent; background: transparent; color: var(--encre-2); }
.btn-icone:hover { background: var(--fond); }
.retour { align-self: flex-start; }

/* Champs */
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label, .label { font-size: 14px; font-weight: 600; }
input, select, textarea {
  font: 16px var(--police); color: var(--encre); background: var(--surface);
  border: 1px solid var(--bord-fort); border-radius: 10px; padding: 0 12px; min-height: 48px; width: 100%;
}
textarea { padding: 12px; min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 3px solid #BFDBFE; border-color: var(--accent); }
input.grand { font-size: 20px; min-height: 56px; }
.aide { font-size: 13px; color: var(--discret); }
.valeur-fixe { min-height: 48px; display: flex; align-items: center; font-weight: 600; }

/* Cartes */
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 18px; padding: 20px; }
.carte-accent { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-size: 16px; font-weight: 500; }
.alerte { background: var(--attention-clair); border: none; color: var(--attention-fonce); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.alerte a { color: var(--attention-fonce); font-weight: 700; }
.vide { color: var(--discret); font-size: 15px; padding: 8px 0; }
.pastille { display: inline-block; font: 700 12px var(--police); padding: 4px 10px; border-radius: 999px; background: var(--accent-clair); color: var(--accent-fonce); white-space: nowrap; }
.pastille-ok { background: var(--ok-clair); color: var(--ok-fonce); }
.pastille-attente { background: var(--attention-clair); color: var(--attention-fonce); }

.bandeau-demo { background: var(--nuit); color: #F3F4F6; font-size: 13px; padding: 8px 16px; text-align: center; }

/* Pages étroites (téléphone, élève, connexion) */
.page-etroite { max-width: 460px; margin: 0 auto; padding: 28px 20px 40px; display: flex; flex-direction: column; gap: 18px; }
.logo-bloc { display: flex; flex-direction: column; gap: 6px; padding-top: 24px; }
.logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #FFFFFF; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.onglets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; background: var(--bord); border-radius: 12px; padding: 4px; }
.onglet { min-height: 44px; border: none; border-radius: 9px; background: transparent; color: var(--encre-2); font: 600 15px var(--police); cursor: pointer; }
.onglet.actif { background: var(--surface); color: var(--encre); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.progression { display: flex; gap: 6px; }
.progression span { flex: 1; height: 6px; border-radius: 3px; background: var(--bord-fort); }
.progression span.faite { background: var(--accent); }
.reconnu { display: flex; gap: 10px; align-items: flex-start; background: var(--ok-clair); color: var(--ok-fonce); border: 1px solid #99F6E4; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.reconnu svg { flex-shrink: 0; margin-top: 2px; }
.regles { list-style: none; margin: -6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--discret); }
.regles li { display: flex; gap: 6px; align-items: center; }
.regles li.ok { color: var(--ok); }
.bienvenue { align-items: center; text-align: center; padding: 28px 22px; }
.bienvenue-icone { width: 68px; height: 68px; border-radius: 34px; background: var(--ok-clair); color: var(--ok); display: flex; align-items: center; justify-content: center; }
.bienvenue-nom { font-family: var(--titres); font-size: 22px; font-weight: 700; }
.bienvenue-message { font-size: 18px; line-height: 1.5; font-weight: 500; color: var(--accent-fonce); }
.entete-eleve { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tuile-bientot { display: flex; gap: 14px; align-items: center; }
.tuile-bientot > svg { color: var(--accent); flex-shrink: 0; }
.tuile-bientot > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tuile-bientot p { font-size: 14px; }

/* Coque enseignant */
.coque { display: flex; flex-wrap: wrap; min-height: 100vh; }
.menu { flex: 1 1 230px; max-width: 100%; background: var(--nuit); color: #FFFFFF; padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; }
.menu-marque { font: 700 22px var(--titres); color: #FFFFFF; text-decoration: none; padding: 0 10px 14px; }
.menu-marque:hover { color: #FFFFFF; }
.menu-liens { display: flex; flex-direction: column; gap: 4px; }
.menu-lien { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #D1D5DB; text-decoration: none; font: 500 15px var(--police); background: none; border: none; cursor: pointer; text-align: left; }
.menu-lien:hover { background: #1F2937; color: #FFFFFF; }
.menu-lien.actif { background: var(--accent); color: #FFFFFF; }
.menu-lien.inactif { color: #9CA3AF; cursor: default; }
.menu-lien.inactif:hover { background: none; color: #9CA3AF; }
.menu-lien small { margin-left: auto; font-size: 11px; border: 1px solid #4B5563; border-radius: 999px; padding: 1px 7px; }
.menu-sortie { margin-top: auto; }
.contenu { flex: 999 1 560px; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 20px; max-width: 1100px; }
.entete { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.titre-section { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.titre-section a { font-size: 14px; font-weight: 600; }

/* Tableau de bord */
.etapes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.etapes li { display: flex; gap: 10px; align-items: center; border: 1px solid var(--bord); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 15px; }
.etapes li.faite { background: var(--ok-clair); border-color: #99F6E4; }
.etapes li.faite a { color: var(--ok-fonce); }
.etape-num { width: 28px; height: 28px; border-radius: 14px; background: var(--accent-clair); color: var(--accent-fonce); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.etapes li.faite .etape-num { background: var(--ok); color: #FFFFFF; }
.grille-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-lib { font-size: 14px; color: var(--discret); }
.kpi-val { font: 700 34px var(--titres); }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.ligne-classe, .ligne-activite { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid #EEF1F6; text-decoration: none; color: var(--encre); }
.ligne-classe > div, .ligne-activite > div { display: flex; flex-direction: column; gap: 2px; }
.ligne-classe:hover strong { color: var(--accent); }
.ligne-classe .barre { width: 120px; flex-shrink: 0; }
.barre { display: block; height: 8px; border-radius: 4px; background: var(--bord); overflow: hidden; }
.barre > span { display: block; height: 8px; border-radius: 4px; background: var(--ok); }
.note-version { font-size: 14px; color: var(--encre-2); background: var(--accent-clair); border-color: #BFDBFE; }

/* Formulaires enseignant */
.grille-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.apercu { background: var(--fond); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.actions-bas { display: flex; justify-content: flex-end; }
.actions-bas .btn-large { width: auto; padding: 0 28px; }

/* Classes */
.grille-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.carte-classe { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--encre); }
.carte-classe:hover { border-color: var(--accent); color: var(--encre); }
.surtitre { font-size: 12px; font-weight: 700; color: var(--accent-fonce); text-transform: uppercase; letter-spacing: 0.06em; }
.nom-classe { font: 700 21px var(--titres); }
.ligne-gen { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ligne-gen .champ { width: 140px; }
.ligne-gen .btn { min-height: 48px; }
.filtres { display: flex; gap: 8px; flex-wrap: wrap; }
.puce { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--bord-fort); background: var(--surface); font: 600 13px var(--police); color: var(--encre); cursor: pointer; }
.puce.active { background: var(--nuit); border-color: var(--nuit); color: #FFFFFF; }
.liste-matricules { display: flex; flex-direction: column; }
.ligne-mat { display: grid; grid-template-columns: 44px minmax(150px, 1.2fr) 110px minmax(150px, 1.6fr) 96px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid #EEF1F6; font-size: 15px; }
.entete-mat { font-size: 13px; font-weight: 700; color: var(--encre-2); border-top: none; }
.code-mat { font-weight: 600; }
.actions-mat { display: flex; justify-content: flex-end; }
.zone-danger { display: flex; justify-content: flex-end; }

/* Fenêtre de confirmation et notifications */
.modal-fond { position: fixed; inset: 0; background: rgba(20, 23, 31, 0.5); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 18px; padding: 22px; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 440px); }
.toast { background: var(--nuit); color: #FFFFFF; padding: 12px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 8px 24px rgba(0,0,0,0.18); transition: opacity 0.3s, transform 0.3s; }
.toast-ok { background: var(--ok-fonce); }
.toast-erreur { background: var(--danger); }
.toast.sortie { opacity: 0; transform: translateY(8px); }

/* Téléphone */
@media (max-width: 760px) {
  h1 { font-size: 24px; }
  .menu { flex-basis: 100%; padding: 12px 10px 8px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  .menu-marque { padding: 0 8px; font-size: 19px; }
  .menu-liens { flex-direction: row; overflow-x: auto; flex-basis: 100%; order: 3; gap: 4px; padding-bottom: 4px; }
  .menu-lien { white-space: nowrap; min-height: 40px; padding: 0 10px; font-size: 14px; }
  .menu-lien.inactif { display: none; }
  .menu-sortie { margin: 0 0 0 auto; }
  .menu-sortie span { display: none; }
  .contenu { padding: 18px 16px 32px; gap: 16px; }
  .carte { padding: 16px; }
  .ligne-mat { grid-template-columns: 30px 1fr auto; grid-template-areas: 'n code etat' 'n eleve actions'; row-gap: 4px; padding: 10px 0; }
  .ligne-mat > :nth-child(1) { grid-area: n; }
  .ligne-mat > :nth-child(2) { grid-area: code; }
  .ligne-mat > :nth-child(3) { grid-area: etat; justify-self: end; }
  .ligne-mat > :nth-child(4) { grid-area: eleve; }
  .ligne-mat > :nth-child(5) { grid-area: actions; }
  .entete-mat { display: none; }
  .ligne-classe .barre { width: 80px; }
}

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- Cours ---------- */
.boutons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.champ-classe select { min-width: 180px; }
.appel { background: var(--accent-clair); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; color: var(--accent-fonce); }
.chapitres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.chapitre { border-top: 1px solid #EEF1F6; padding: 10px 0; }
.chapitre-tete { display: flex; align-items: center; gap: 10px; }
.chapitre-num { font: 600 13px var(--mono); color: var(--discret); width: 26px; flex-shrink: 0; }
.chapitre-titre { flex: 1; font-size: 15px; }
.chapitre-actions { display: flex; gap: 2px; flex-shrink: 0; }
.chapitre-actions .btn-icone { width: 38px; min-height: 38px; font-size: 16px; }
.chapitre-actions .btn-icone[disabled] { opacity: 0.3; cursor: default; }
.chapitre-cours { padding-left: 36px; display: flex; flex-direction: column; align-items: flex-start; }
.ligne-cours { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; margin: 2px 0; border-radius: 10px; background: var(--fond); text-decoration: none; color: var(--encre); }
.ligne-cours:hover { background: var(--accent-clair); color: var(--encre); }
.ligne-cours-titre { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.ligne-cours-titre svg { color: var(--accent); flex-shrink: 0; }
.ligne-cours-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.groupe-cours { display: flex; flex-direction: column; gap: 2px; }
.barre-outils { display: flex; gap: 6px; flex-wrap: wrap; position: sticky; top: 0; background: var(--surface); padding: 4px 0; z-index: 2; }
.outil { min-height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--bord-fort); background: var(--fond); font: 600 13px var(--police); color: var(--encre); cursor: pointer; }
.outil:hover { background: var(--accent-clair); border-color: var(--accent); }
#contenu { font-family: var(--mono); font-size: 14px; min-height: 280px; }
.apercu-lecon { border: 1px dashed var(--bord-fort); border-radius: 12px; padding: 16px; min-height: 200px; }
.lecon { display: flex; flex-direction: column; gap: 12px; font-size: 16px; line-height: 1.65; }
.lecon h2 { font-size: 21px; margin-top: 8px; }
.lecon h3 { font: 700 17px var(--titres); margin: 4px 0 0; }
.lecon ul, .lecon ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.lecon code { font-family: var(--mono); font-size: 0.92em; background: #EEF1F6; padding: 1px 6px; border-radius: 5px; }
.lecon pre { margin: 0; background: #111827; color: #F9FAFB; border-radius: 12px; padding: 14px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.lecon pre code { background: none; padding: 0; color: inherit; }
.video { display: flex; flex-direction: column; gap: 6px; }
.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; }
.liste-fichiers { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fichier { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border: 1px solid var(--bord); border-radius: 10px; }
.cache { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.choix-groupe { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.choix-groupe legend { font: 700 18px var(--titres); margin-bottom: 10px; }
.choix { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--bord); border-radius: 12px; cursor: pointer; }
.choix:has(input:checked) { border-color: var(--accent); background: var(--accent-clair); }
.choix input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.page-lecture { max-width: 760px; margin: 0 auto; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 14px; }
.image-cours { max-width: 100%; border-radius: 12px; border: 1px solid var(--bord); }
@media (max-width: 760px) {
  .chapitre-cours { padding-left: 0; }
  .chapitre-tete { flex-wrap: wrap; }
  .chapitre-actions { width: 100%; justify-content: flex-end; }
  .ligne-cours { flex-direction: column; align-items: flex-start; }
}

/* ---------- Devoirs ---------- */
.pastille-nuit { background: var(--nuit); color: #FFFFFF; }
.btn-nuit { background: var(--nuit); border-color: var(--nuit); color: #FFFFFF; }
.btn-nuit:hover { background: #000000; color: #FFFFFF; }
.carte-devoir { display: flex; flex-direction: column; gap: 10px; }
.carte-devoir-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.carte-devoir-tete > div { display: flex; flex-direction: column; gap: 2px; }
.carte-devoir-pied { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid #EEF1F6; padding-top: 10px; }
.carte-question { border: 1px solid var(--bord); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.carte-question .chapitre-tete { flex-wrap: wrap; }
.champ-points { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.petit-champ { width: 76px; min-height: 40px; }
.ligne-choix { display: flex; align-items: center; gap: 10px; }
.ligne-choix input[type=radio] { width: 22px; height: 22px; min-height: 0; flex-shrink: 0; accent-color: var(--ok); }
.case { display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 500; min-height: 44px; cursor: pointer; }
.case input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; }
.grille-regles { display: grid; grid-template-columns: auto 100px 1fr; gap: 10px 12px; align-items: center; font-size: 15px; }
.grille-regles input { min-height: 42px; }
.grille-copies { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.grille-copies > .carte { flex: 1 1 260px; padding: 8px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.detail-copie { flex: 999 1 460px; min-width: 0; }
.liste-copies { display: flex; flex-direction: column; gap: 2px; }
.ligne-copie { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: 10px; border: none; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--encre); width: 100%; }
.ligne-copie:hover { background: var(--fond); }
.ligne-copie.active { background: var(--accent-clair); }
.ligne-copie-nom { display: flex; flex-direction: column; gap: 2px; }
.ligne-copie-note { font: 700 16px var(--titres); }
.journal { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.choix-correction { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.choix-correction li.bonne { color: var(--ok-fonce); font-weight: 700; }
.choix-correction li.choisie:not(.bonne) { color: var(--danger); font-weight: 600; }
.code-rendu, .texte-rendu { margin: 0; white-space: pre-wrap; border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.55; }
.code-rendu { background: #111827; color: #F9FAFB; font-family: var(--mono); overflow-x: auto; }
.texte-rendu { background: var(--fond); font-family: var(--police); }
.tableau-defilant { overflow-x: auto; }
table.carnet { border-collapse: collapse; width: 100%; font-size: 15px; }
table.carnet th, table.carnet td { border-bottom: 1px solid #EEF1F6; padding: 10px 12px; text-align: center; white-space: nowrap; }
table.carnet th[scope=row] { text-align: left; font-weight: 600; }
table.carnet thead th { font-size: 13px; color: var(--encre-2); }
table.carnet td.moyenne { font-weight: 700; background: var(--accent-clair); }
.regles-devoir { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.bienvenue-icone.bloque { background: var(--nuit); color: #FFFFFF; }
.note-grande { font: 700 34px var(--titres); }

/* Écran de travail de l'élève */
.page-travail { -webkit-user-select: none; user-select: none; }
.page-travail textarea, .page-travail input { -webkit-user-select: text; user-select: text; }
.barre-travail { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 10px 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.surveillance { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ok-fonce); }
.chrono { font: 600 14px var(--mono); background: var(--nuit); color: #FFFFFF; border-radius: 999px; padding: 4px 12px; }
.chrono:empty { display: none; }
.enonce { font-size: 16px; font-weight: 500; white-space: pre-wrap; }
.choix-qcm { display: flex; flex-direction: column; gap: 8px; }
.editeur-code { border: 1px solid #1F2937; border-radius: 14px; overflow: hidden; background: #111827; }
.editeur-entete { background: #1F2937; color: #D1D5DB; font-size: 12px; padding: 6px 12px; }
.barre-structures { display: flex; gap: 6px; overflow-x: auto; padding: 8px; background: #1F2937; position: sticky; top: 0; scrollbar-width: thin; }
.structure { flex-shrink: 0; min-height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid #374151; background: #111827; color: #F9FAFB; font: 600 13px var(--mono); cursor: pointer; }
.structure:active { background: var(--accent); }
.code-zone { display: block; width: 100%; min-height: 220px; border: none; border-radius: 0; background: #111827; color: #F9FAFB; font: 14px/1.6 var(--mono); padding: 12px; resize: vertical; tab-size: 4; }
.code-zone:focus { outline: 2px solid #3B82F6; outline-offset: -2px; }
@media (max-width: 760px) {
  .grille-regles { grid-template-columns: auto 80px; }
  .grille-regles span { grid-column: 1 / -1; margin-top: -6px; color: var(--discret); font-size: 13px; }
  .grille-copies > .carte { position: static; max-height: none; }
}

/* ---------- Espace élève (maquette) ---------- */
.page-eleve { padding-bottom: 110px; }
.pile-serree { display: flex; flex-direction: column; gap: 10px; }
.encre { color: var(--encre); }
.encre-2 { color: var(--encre-2); }
.cloche { position: relative; border: 1px solid var(--bord); background: var(--surface); border-radius: 22px; }
.point-rouge { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 5px; background: #C2410C; border: 2px solid #FFFFFF; }
.carte-eval { background: var(--accent); color: #FFFFFF; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.carte-eval-sur { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.carte-eval-titre { font: 700 21px var(--titres); }
.carte-eval-pied { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.carte-eval-compte { font-weight: 600; font-size: 15px; }
.btn-blanc { background: #FFFFFF; color: var(--accent); border-color: #FFFFFF; }
.btn-blanc:hover { color: var(--accent-fonce); }
.btn-blanc.inactif { opacity: 0.85; cursor: default; }
.ligne-devoir { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--encre); }
.ligne-devoir:hover { border-color: var(--accent); color: var(--encre); }
.badge-type { width: 44px; height: 40px; border-radius: 12px; background: #EEF2FF; color: var(--accent-fonce); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ligne-devoir-texte { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.liste-notes { padding: 4px 16px; }
.ligne-note { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #EEF1F6; text-decoration: none; color: var(--encre); }
.ligne-note:last-child { border-bottom: none; }
.note-moyenne { font: 700 18px var(--titres); white-space: nowrap; }
.nav-bas { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--bord); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); }
.nav-bas-lien { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--discret); text-decoration: none; padding: 6px 0; min-height: 52px; }
.nav-bas-lien.actif { color: var(--accent); font-weight: 700; }
.nav-bas-icone { position: relative; display: inline-flex; }
.nav-bas-icone .point-rouge { top: -3px; right: -6px; }
@media (min-width: 761px) { .nav-bas { max-width: 460px; margin: 0 auto; border-radius: 18px 18px 0 0; border: 1px solid var(--bord); } }

/* Messagerie */
.fil { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 4px; }
.bulle { max-width: 82%; padding: 10px 14px; border-radius: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.bulle-moi { align-self: flex-end; background: var(--accent); color: #FFFFFF; border-bottom-right-radius: 4px; }
.bulle-autre { align-self: flex-start; background: #EEF1F6; border-bottom-left-radius: 4px; }
.bulle-heure { font-size: 11px; opacity: 0.8; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 52px; flex: 1; }
.messagerie { display: flex; flex-wrap: wrap; gap: 14px; }
.messagerie-liste { flex: 1 1 200px; max-height: 420px; overflow-y: auto; border-right: 1px solid #EEF1F6; padding-right: 8px; }
.messagerie > .pile, .messagerie > .vide { flex: 999 1 280px; min-width: 0; }
.titre-fil { font: 700 16px var(--titres); margin: 0; }
.apercu-notif { background: var(--nuit); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; color: #FFFFFF; font-size: 14px; }
.apercu-notif-titre { font-weight: 700; font-size: 13px; color: #D1D5DB; }
.petit-legende { font: 600 14px var(--police) !important; margin-bottom: 4px !important; }

/* Tableau de bord */
.kpi-lien { text-decoration: none; color: var(--encre); }
.kpi-lien:hover { border-color: var(--accent); color: var(--encre); }
table.agenda { border-collapse: collapse; width: 100%; font-size: 14px; }
table.agenda td, table.agenda th { border-top: 1px solid #EEF1F6; padding: 10px 8px; text-align: left; vertical-align: middle; }
table.agenda thead th { border-top: none; font-size: 13px; color: var(--encre-2); }
.agenda-quand { font-weight: 600; white-space: nowrap; }

/* Surveillance en direct */
.surveille { display: flex; align-items: center; gap: 8px; color: var(--ok-fonce); }
.point-direct { width: 10px; height: 10px; border-radius: 5px; background: var(--ok); box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.5); animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(15,118,110,0.5); } 70% { box-shadow: 0 0 0 8px rgba(15,118,110,0); } 100% { box-shadow: 0 0 0 0 rgba(15,118,110,0); } }
.compteur { min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: #FFFFFF; border: 1px solid var(--bord); }
.c-sorti, .t-sorti { background: #FFEDD5; color: #7C2D12; border-color: #FDBA74; }
.c-bloque, .t-bloque { background: var(--nuit); color: #FFFFFF; border-color: var(--nuit); }
.c-horsligne, .t-horsligne { background: #F0FDFA; color: #115E59; border-color: #99F6E4; }
.c-soumis, .t-soumis { background: #DBEAFE; color: #1E3A8A; border-color: #93C5FD; }
.grille-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tuile { min-height: 64px; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border: 2px solid var(--bord); background: #FFFFFF; color: var(--encre); text-decoration: none; font-size: 13px; }
.tuile strong { font-size: 14px; }
.t-absent { opacity: 0.7; }
@media (prefers-reduced-motion: reduce) { .point-direct { animation: none; } }

/* Comptes */
.mesure-titre { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 15px; }
.mesure-titre svg { color: var(--ok); flex-shrink: 0; }
.alerte-bloc { background: var(--attention-clair); border-color: #FDBA74; color: var(--attention-fonce); }
.petit-btn { min-height: 38px; padding: 0 10px; font-size: 13px; }
.danger-texte { color: var(--danger); }
table.comptes td { white-space: nowrap; }
body:has(.nav-bas) .toasts { bottom: 96px; }

/* ---------- Exercices interactifs ---------- */
.grille-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.carte-type { text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 84px; padding: 12px 14px; border: 2px solid var(--bord); border-radius: 12px; background: var(--surface); font: inherit; color: var(--encre); cursor: pointer; }
.carte-type:hover { border-color: var(--accent); background: var(--accent-clair); }
.carte-type strong { font-size: 15px; }
.carte-type span { font-size: 13px; color: var(--encre-2); line-height: 1.4; }
.console { margin: 0; min-height: 44px; background: #0B1220; color: #E5E7EB; font: 13px/1.55 var(--mono); padding: 10px 12px; border-radius: 10px; white-space: pre-wrap; }
.console:empty { display: none; }
.console.erreur { color: #FCA5A5; }
.ligne-execution { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ligne-execution input { flex: 1 1 160px; min-height: 44px; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #FFFFFF; }
.btn-ok:hover { background: var(--ok-fonce); color: #FFFFFF; }
.trace { display: flex; flex-direction: column; gap: 8px; }
.trace:empty { display: none; }
.trace-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.trace-action { font: 600 14px var(--mono); background: var(--accent-clair); color: var(--accent-fonce); padding: 8px 10px; border-radius: 8px; }
table.resultat-sql { border-collapse: collapse; font: 13px var(--mono); width: 100%; background: #FFFFFF; }
table.resultat-sql th, table.resultat-sql td { border: 1px solid var(--bord); padding: 6px 10px; text-align: left; }
table.resultat-sql th { background: #EEF1F6; font-family: var(--police); font-size: 12px; }
.schema-base { background: var(--fond); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.ok-texte { color: var(--ok-fonce); font-weight: 600; }
.ko-texte { color: var(--danger); font-weight: 600; }
.onglets-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.apercu-web { width: 100%; height: 340px; border: 1px solid var(--bord-fort); border-radius: 12px; background: #FFFFFF; }
.resultats-tests { border: 1px solid #FDBA74; background: var(--attention-clair); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.resultats-tests.tous-ok { border-color: #99F6E4; background: var(--ok-clair); }
.resultats-tests ul { margin: 6px 0 0; padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.resultats-tests li.ok { color: var(--ok-fonce); }
.resultats-tests li.ko { color: var(--attention-fonce); }
.onglet-titre { font-size: 13px; font-weight: 700; color: var(--encre-2); text-transform: uppercase; letter-spacing: 0.04em; }
/* MCD */
.mcd-schema { display: flex; flex-direction: column; gap: 10px; background: #FFFFFF; border: 1px dashed var(--bord-fort); border-radius: 12px; padding: 12px; }
.mcd-entites { display: flex; flex-wrap: wrap; gap: 10px; }
.mcd-entite { border: 2px solid var(--accent); border-radius: 8px; min-width: 140px; overflow: hidden; }
.mcd-entite-nom { background: var(--accent); color: #FFFFFF; font-weight: 700; font-size: 13px; padding: 5px 10px; }
.mcd-attributs { padding: 6px 10px; display: flex; flex-direction: column; font-size: 13px; }
.mcd-ligne { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.mcd-ref { font-weight: 700; color: var(--accent-fonce); }
.mcd-card { font: 600 12px var(--mono); }
.mcd-trait { flex: 0 0 18px; height: 2px; background: var(--encre); }
.mcd-asso { border: 2px solid var(--ok); background: var(--ok-clair); color: var(--ok-fonce); border-radius: 999px; padding: 4px 12px; font-weight: 700; display: flex; flex-direction: column; align-items: center; }
.mcd-asso small { font-weight: 500; }
.mcd-form { display: grid; grid-template-columns: 1fr 1.6fr 1fr 44px; gap: 6px; align-items: center; }
.mcd-form-asso { grid-template-columns: 1fr 76px 1fr 76px 1fr 1fr 44px; }
.mcd-form input, .mcd-form select { min-height: 40px; font-size: 14px; padding: 0 8px; }
/* Réseau */
.reseau-toile { position: relative; height: 340px; border: 1px solid var(--bord); border-radius: 12px; background: #FFFFFF radial-gradient(#E3E7EF 1px, transparent 1px); background-size: 16px 16px; overflow: hidden; touch-action: none; }
.reseau-cables { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.reseau-cables line { stroke: var(--encre); stroke-width: 2.5; }
.reseau-app { position: absolute; width: 64px; height: 52px; border-radius: 10px; border: 2px solid var(--accent-fonce); background: #FFFFFF; color: var(--accent-fonce); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font: 600 12px var(--police); cursor: grab; padding: 0; touch-action: none; }
.reseau-app .reseau-type { font-size: 9px; letter-spacing: 0.04em; }
.app-routeur { border-color: var(--nuit); color: var(--nuit); }
.app-switch { border-color: var(--ok-fonce); color: var(--ok-fonce); }
.reseau-app.choisi { background: var(--accent); border-color: var(--accent); color: #FFFFFF; box-shadow: 0 0 0 3px #BFDBFE; }
.reseau-app.origine { box-shadow: 0 0 0 4px #FDBA74; }
.reseau-outils .actif { background: var(--attention-clair); border-color: #FDBA74; }
.reseau-panneau { background: var(--fond); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.reseau-champ { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; }
.reseau-champ input { min-height: 40px; font-size: 14px; }
@media (max-width: 760px) {
  .mcd-form, .mcd-form-asso { grid-template-columns: 1fr 1fr; }
}

/* Barre de chargement en haut de l'écran pendant qu'un écran se prépare */
body.chargement::before { content: ''; position: fixed; top: 0; left: 0; height: 3px; width: 40%; z-index: 100; background: var(--accent); animation: charge 1s ease-in-out infinite; }
body.chargement { cursor: progress; }
@keyframes charge { 0% { left: -40%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { body.chargement::before { animation: none; width: 100%; opacity: 0.6; } }
