/* =====================================================================
   GEVA3 : feuille de style unique (palette bleue)
   Pages : connexion, formulaire enseignant, admin, eleves, mot de passe,
   impression. Les blocs propres a une page sont regroupes en fin de fichier.
   ===================================================================== */

:root {
    --bleu: #2563eb;
    --bleu-fonce: #1d4ed8;
    --bleu-clair: #dbeafe;
    --texte: #1f2937;
    --texte-doux: #6b7280;
    --fond: #f3f4f6;
    --blanc: #ffffff;
    --bord: #e5e7eb;
    --bord-fort: #d1d5db;
    --rouge: #dc2626;
    --rouge-clair: #fee2e2;
    --vert: #10b981;
    --vert-clair: #d1fae5;
    --orange: #f59e0b;
    --jaune-clair: #fffacd;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--fond);
    color: var(--texte);
    padding: 20px;
    font-size: 14px;
    line-height: 1.4;
}

a { color: var(--bleu); }

/* --- Conteneur pleine largeur (regle : jamais de colonne etroite sauf connexion) --- */
.conteneur {
    background: var(--blanc);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 30px;
}

/* --- En-tete de page --- */
.retour {
    display: inline-block;
    margin-bottom: 18px;
    padding: 8px 16px;
    background-color: var(--texte-doux);
    color: var(--blanc);
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}
.retour:hover { background-color: #4b5563; }

.entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--bord);
    padding-bottom: 18px;
}
.entete h1 { font-size: 24px; color: var(--texte); }
.entete .sous-titre { color: var(--texte-doux); margin-top: 4px; }
.entete-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Boutons --- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--blanc);
    background-color: var(--texte-doux);
    transition: background-color 0.2s;
    font-family: inherit;
}
.btn:hover { background-color: #4b5563; }
.btn-principal { background-color: var(--bleu); }
.btn-principal:hover { background-color: var(--bleu-fonce); }
.btn-succes { background-color: var(--vert); }
.btn-succes:hover { background-color: #059669; }
.btn-attention { background-color: var(--orange); }
.btn-attention:hover { background-color: #d97706; }
.btn-danger { background-color: var(--rouge); }
.btn-danger:hover { background-color: #b91c1c; }
.btn-discret { background-color: var(--bord); color: var(--texte); }
.btn-discret:hover { background-color: var(--bord-fort); }
.btn-petit { padding: 7px 12px; font-size: 13px; }
.btn[disabled], .btn:disabled { background-color: var(--bord); color: #9ca3af; cursor: not-allowed; }
.btn-large { width: 100%; padding: 12px; font-size: 16px; font-weight: 600; }

/* --- Messages --- */
.message { padding: 12px 15px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.message.erreur { background-color: var(--rouge-clair); color: #991b1b; border: 1px solid #fca5a5; }
.message.succes { background-color: var(--vert-clair); color: #065f46; border: 1px solid #6ee7b7; }
.message.info { background-color: var(--bleu-clair); color: #1e40af; border-left: 4px solid var(--bleu); }

/* --- Formulaires --- */
.champ { margin-bottom: 18px; }
.champ label { display: block; font-weight: 600; color: #374151; margin-bottom: 6px; font-size: 14px; }
.champ input[type="text"], .champ input[type="password"], .champ select, .champ textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bord-fort);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--blanc);
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
    outline: none;
    border-color: var(--bleu);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.champ .aide { color: #9ca3af; font-size: 12px; margin-top: 4px; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.ligne-champ { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ligne-champ .champ { margin-bottom: 0; }
.ligne-champ input[type="text"] { min-width: 240px; }

/* --- Sections, statistiques, tableaux --- */
.section { margin-bottom: 30px; }
.titre-section { font-size: 20px; font-weight: 600; margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid var(--bord); }
.aide-section { color: var(--texte-doux); font-size: 13px; margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 30px; }
.stat { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: var(--blanc); padding: 20px; border-radius: 8px; text-align: center; }
.stat.vert { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat.violet { background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%); }
.stat.gris { background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%); }
.stat-valeur { font-size: 32px; font-weight: bold; margin-bottom: 5px; }
.stat-libelle { font-size: 14px; opacity: 0.9; }

table.liste { width: 100%; border-collapse: collapse; font-size: 14px; }
table.liste thead { background-color: var(--fond); }
table.liste th { padding: 12px; text-align: left; font-weight: 600; color: #374151; border-bottom: 2px solid var(--bord-fort); }
table.liste td { padding: 12px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
table.liste tbody tr:hover { background-color: #f9fafb; }
table.liste tr.inactif td { color: #9ca3af; }
.actions-cellule form { display: inline; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-actif { background: var(--vert-clair); color: #065f46; }
.badge-inactif { background: var(--fond); color: var(--texte-doux); }

.groupe-eleve { margin-bottom: 25px; border: 1px solid var(--bord); border-radius: 8px; overflow: hidden; }
.entete-eleve { background-color: var(--fond); padding: 12px 15px; font-weight: 600; border-bottom: 1px solid var(--bord); }

.vide { text-align: center; padding: 40px; color: var(--texte-doux); }
.vide .icone { font-size: 48px; margin-bottom: 15px; }

/* --- Modales --- */
.modale {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.modale.ouverte { display: flex; }
.modale-contenu {
    background: var(--blanc);
    border-radius: 10px;
    padding: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overscroll-behavior: contain;
}
.modale-contenu.large { max-width: 1000px; }
.modale-contenu h2 { font-size: 20px; margin-bottom: 15px; }
.modale-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* --- Pied de page --- */
.pied { text-align: center; color: #9ca3af; font-size: 12px; margin-top: 25px; }

/* =====================================================================
   Page de connexion (seule page en colonne centree)
   ===================================================================== */
body.page-connexion { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.carte-connexion { background: var(--blanc); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15); width: 100%; max-width: 420px; padding: 40px; }
.carte-connexion .logo { text-align: center; margin-bottom: 28px; }
.carte-connexion .logo .icone { font-size: 48px; }
.carte-connexion .logo h1 { font-size: 28px; }
.carte-connexion .logo p { color: var(--texte-doux); font-size: 14px; }

/* =====================================================================
   Formulaire enseignant
   ===================================================================== */
.legende { background-color: var(--bleu-clair); border-left: 4px solid var(--bleu); padding: 15px; border-radius: 6px; margin-bottom: 20px; }
.legende h3 { font-size: 14px; margin-bottom: 8px; }
.legende p { margin: 4px 0; font-size: 13px; }
.legende p.obligatoire { color: var(--rouge); font-weight: 600; }

table.grille-activites { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 13px; }
table.grille-activites th, table.grille-activites td { border: 1px solid #ccc; padding: 10px; text-align: left; vertical-align: top; }
table.grille-activites th { background-color: #e8e8e8; font-weight: bold; }
table.grille-activites tbody tr:nth-child(even) { background-color: #fafafa; }
td.activite { font-weight: 500; width: 20%; }
td.choix { text-align: center; width: 4%; vertical-align: middle; }
td.choix input[type="radio"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--bleu); }
td.commentaire { width: 32%; }
textarea.commentaire-champ { width: 100%; min-height: 50px; font-size: 12px; resize: vertical; padding: 6px; font-family: inherit; border: 1px solid #ccc; border-radius: 4px; }
textarea.commentaire-champ.obligatoire-vide { background-color: var(--jaune-clair) !important; border: 2px solid #ffcc00 !important; }
.evolutions { margin-bottom: 15px; }
.evolutions label { display: block; font-weight: bold; margin-bottom: 6px; }
.evolutions textarea { width: 100%; min-height: 80px; padding: 8px; font-family: inherit; font-size: 13px; border: 1px solid #ccc; border-radius: 4px; }
.actions-formulaire { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--bord); }
.actions-formulaire .btn { padding: 12px 24px; font-size: 15px; }

/* Modale d'instructions */
.instructions { text-align: left; font-size: 14px; line-height: 1.7; }
.instructions h3 { color: var(--bleu); margin-top: 12px; font-size: 15px; }
.instructions h3.rgpd { color: var(--rouge); border-top: 2px solid var(--rouge); padding-top: 10px; }
.instructions .important { color: var(--rouge); font-weight: bold; }
.instructions .encadre { background: #fff3cd; padding: 12px 15px; border-left: 4px solid #ff6b6b; margin: 6px 0; }
.instructions .encadre-rgpd { background: var(--rouge-clair); padding: 10px 15px; border-left: 4px solid var(--rouge); color: #7f1d1d; margin: 6px 0; }
.instructions ul { margin-left: 18px; }
.instructions .niveaux { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 15px; margin: 6px 0; }
.instructions .attestation { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13px; padding: 12px; border-radius: 6px; margin-top: 10px; }
.instructions .attestation.rgpd { background: var(--rouge-clair); color: #7f1d1d; }
.instructions .attestation.lu { background: #f0f9ff; color: var(--texte); }
.instructions .attestation input { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }

/* Tablette et telephone : le tableau devient une liste de cartes */
@media screen and (max-width: 900px) {
    body { padding: 8px; }
    .conteneur { padding: 14px; }
    .entete h1 { font-size: 18px; }
    .entete-actions { width: 100%; justify-content: flex-end; }
    .grille-2 { grid-template-columns: 1fr; }
    .instructions .niveaux { grid-template-columns: 1fr; }
    .modale { padding: 8px; }
    .modale-contenu { padding: 16px; max-height: 94vh; }

    table.grille-activites, table.grille-activites tbody, table.grille-activites tr, table.grille-activites td { display: block; width: 100%; }
    table.grille-activites thead { display: none; }
    table.grille-activites tr { border: 1px solid #ccc; border-radius: 6px; margin-bottom: 14px; padding: 10px; background: var(--blanc) !important; }
    table.grille-activites td { border: none; padding: 6px 0; width: auto; }
    td.activite { font-weight: bold; font-size: 15px; color: var(--bleu); border-bottom: 1px solid var(--bord); padding-bottom: 8px; margin-bottom: 4px; }
    td.choix { display: inline-flex; align-items: center; gap: 6px; width: 24%; text-align: left; font-weight: bold; font-size: 15px; }
    td.choix::before { content: attr(data-libelle); }
    td.choix input[type="radio"] { width: 22px; height: 22px; }
    td.commentaire { width: 100%; }
    td.commentaire::before { content: attr(data-libelle); display: block; font-size: 12px; color: #555; margin: 8px 0 4px; }
    textarea.commentaire-champ { min-height: 60px; font-size: 14px; }
    .actions-formulaire { flex-direction: column; }
    .actions-formulaire .btn { width: 100%; }

    table.liste th:nth-child(4), table.liste td:nth-child(4) { display: none; }
    .actions-cellule form { display: block; margin-bottom: 6px; }
    .actions-cellule .btn { width: 100%; }
}

/* =====================================================================
   Impression des formulaires : une fiche A4 par formulaire
   (a l'ecran, chaque fiche est affichee comme une feuille)
   ===================================================================== */
body.page-impression { background: #d9dde3; padding: 0 0 30px; }
body.modale-ouverte { overflow: hidden; }
.bandeau-impression { text-align: center; padding: 16px; background: var(--blanc); margin-bottom: 24px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); position: sticky; top: 0; z-index: 10; }
.bandeau-impression h2 { font-size: 18px; }
.bandeau-impression p { color: var(--texte-doux); font-size: 13px; }
.bandeau-impression .btn { margin: 10px 6px 0; }

.fiche {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 24px;
    padding: 14mm 15mm 12mm;
    background: var(--blanc);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    font-size: 11pt;
    color: #111;
    display: flex;
    flex-direction: column;
    break-after: page;
    page-break-after: always;
}
.fiche:last-child { break-after: auto; page-break-after: auto; }

.fiche .bandeau-fiche { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid var(--bleu); padding-bottom: 6px; margin-bottom: 12px; }
.fiche .bandeau-fiche h1 { font-size: 16pt; color: var(--bleu); letter-spacing: 0.5px; }
.fiche .bandeau-fiche .sous { font-size: 9pt; color: #555; }
.fiche .bandeau-fiche .etab { font-size: 9pt; color: #555; text-align: right; }

.fiche .identite { display: grid; grid-template-columns: 1.2fr 1fr 1fr 0.8fr; gap: 8px 14px; margin-bottom: 12px; }
.fiche .identite div { background: #f3f6fb; border-radius: 4px; padding: 6px 10px; }
.fiche .identite label { display: block; font-size: 7.5pt; color: #666; text-transform: uppercase; letter-spacing: 0.4px; }
.fiche .identite .valeur { font-size: 12pt; font-weight: bold; margin-top: 2px; }
.fiche .identite .valeur.eleve { color: var(--bleu); font-size: 14pt; }

.fiche .resume-niveaux { display: flex; gap: 6px; align-items: center; font-size: 8.5pt; color: #555; margin-bottom: 8px; }
.fiche .resume-niveaux .puce { font-size: 8.5pt; min-width: 30px; padding: 1px 6px; }

.fiche table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-bottom: 8px; }
.fiche thead th { background: var(--bleu); color: var(--blanc); padding: 6px 7px; text-align: left; font-size: 8.5pt; border: 1px solid var(--bleu); }
.fiche thead th.niv { text-align: center; width: 9mm; }
.fiche td { padding: 5px 7px; border: 1px solid #bfc5ce; vertical-align: top; }
.fiche tbody tr:nth-child(even) td { background: #f7f8fa; }
.fiche tr { break-inside: avoid; page-break-inside: avoid; }
.fiche td.activite { width: 62mm; font-weight: 600; }
.fiche td.niveau { text-align: center; font-size: 12pt; line-height: 1; }
.fiche td.niveau .coche { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--bleu); color: var(--blanc); font-size: 9pt; line-height: 14px; }
.fiche td.niveau.C .coche { background: var(--orange); }
.fiche td.niveau.D .coche { background: var(--rouge); }
.fiche td.notes { font-size: 8.5pt; line-height: 1.35; }
.fiche td.notes strong { color: #333; }

.fiche .legende-fiche { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; font-size: 8pt; color: #444; margin-bottom: 10px; padding: 6px 8px; background: #f3f6fb; border-radius: 4px; }

.fiche .evolutions-fiche { border: 1px solid #bfc5ce; border-radius: 4px; padding: 8px 10px; min-height: 22mm; }
.fiche .evolutions-fiche .titre { font-weight: bold; font-size: 9pt; color: var(--bleu); margin-bottom: 4px; }
.fiche .evolutions-fiche .texte { font-size: 9.5pt; line-height: 1.4; white-space: pre-wrap; }

.fiche .pied-fiche { margin-top: auto; padding-top: 8px; border-top: 1px solid #bfc5ce; font-size: 7.5pt; color: #777; display: flex; justify-content: space-between; }

/* A l impression : la feuille est geree par le navigateur (marges de page), la fiche
   redevient un bloc fluide sans hauteur figee pour fragmenter proprement */
/* Pas de format impose : Edge affiche des pages qui se chevauchent dans son apercu quand
   le format CSS differe du papier choisi ; la mise en page fluide s adapte a A4 comme a Letter */
@page { margin: 9mm 11mm; }
@media print {
    body.page-impression { background: var(--blanc); padding: 0; }
    .bandeau-impression, .btn { display: none !important; }
    .fiche { display: block; width: auto; min-height: 0; height: auto; margin: 0; padding: 0; box-shadow: none; break-after: page; page-break-after: always; }
    .fiche:last-of-type { break-after: auto; page-break-after: auto; }
    .fiche .pied-fiche { margin-top: 10mm; }
    .fiche thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fiche .identite div, .fiche .legende-fiche, .fiche tbody tr:nth-child(even) td, .fiche .coche, .fiche .puce { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* =====================================================================
   Tableau de bord : resume des niveaux par formulaire et apercu
   ===================================================================== */
.niveaux-resume { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.puce { display: inline-block; min-width: 34px; text-align: center; padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--blanc); }
.puce.A { background: var(--vert); }
.puce.B { background: #3b82f6; }
.puce.C { background: var(--orange); }
.puce.D { background: var(--rouge); }
/* Compte a zero : contour de la couleur du niveau sur fond blanc, reste lisible */
.puce.vide { background: var(--blanc); border: 1px solid currentColor; font-weight: 600; }
.puce.A.vide { color: #059669; }
.puce.B.vide { color: #2563eb; }
.puce.C.vide { color: #d97706; }
.puce.D.vide { color: var(--rouge); }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background-color: var(--bleu-clair); }

.apercu .en-tete-apercu { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 20px; margin-bottom: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--bord); }
.apercu .en-tete-apercu label { display: block; font-size: 11px; color: var(--texte-doux); text-transform: uppercase; }
.apercu .en-tete-apercu .valeur { font-size: 15px; font-weight: 600; }
.apercu table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 15px; }
.apercu th { text-align: left; padding: 8px; background: var(--fond); border-bottom: 2px solid var(--bord-fort); font-size: 12px; }
.apercu td { padding: 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.apercu td.niveau { text-align: center; width: 60px; }
.apercu .commentaires { font-size: 12px; color: #374151; }
.apercu .commentaires strong { color: var(--texte); }
.apercu .evolutions-apercu { background: var(--fond); padding: 12px; border-radius: 6px; font-size: 13px; white-space: pre-wrap; }
.apercu .legende-apercu { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11px; color: var(--texte-doux); margin-bottom: 12px; }

/* Tableau de bord : une zone par eleve, en grille extensible */
.filtre-eleves { max-width: 360px; margin-bottom: 18px; }
.grille-eleves { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 20px; }
.grille-eleves .groupe-eleve { margin-bottom: 0; display: flex; flex-direction: column; }
.grille-eleves .entete-eleve { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 16px; }
.grille-eleves .entete-eleve .compte { font-size: 12px; font-weight: 500; color: var(--texte-doux); }
.grille-eleves .sans-formulaire { padding: 24px; color: var(--texte-doux); text-align: center; font-size: 13px; }
.grille-eleves table.liste { font-size: 13px; }
.grille-eleves table.liste th, .grille-eleves table.liste td { padding: 8px 10px; }
@media screen and (max-width: 700px) { .grille-eleves { grid-template-columns: 1fr; } }

/* Carte eleve : mode selection pour l'impression */
.groupe-eleve .selection { display: none; }
.groupe-eleve.mode-selection .selection { display: table-cell; }
.groupe-eleve.mode-selection .barre-selection { display: flex; }
.groupe-eleve.mode-selection .hors-selection { display: none; }
.groupe-eleve.mode-selection tr.cliquable:hover td { background-color: var(--vert-clair); }
.barre-selection { align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 15px; background: var(--vert-clair); border-bottom: 1px solid var(--bord); font-size: 13px; }
.barre-selection label { cursor: pointer; font-weight: 600; }
.barre-selection .compte-selection { color: var(--texte-doux); }
.barre-selection .imprimer-selection { margin-left: auto; }
.grille-eleves .entete-eleve { flex-wrap: wrap; }

/* Page de garde d'un eleve (impression) */
.fiche.garde .garde-eleve { text-align: center; margin: 4mm 0 6mm; padding: 6mm; background: #f3f6fb; border-radius: 6px; }
.fiche.garde .garde-eleve .etiquette { font-size: 8pt; color: #666; text-transform: uppercase; letter-spacing: 1px; }
.fiche.garde .garde-eleve .nom { font-size: 26pt; font-weight: bold; color: var(--bleu); }
.fiche.garde .identite { grid-template-columns: repeat(4, 1fr); }
.fiche.garde .identite .valeur.petit { font-size: 10pt; }
.fiche .titre-garde { font-size: 10.5pt; color: var(--bleu); border-bottom: 1px solid var(--bleu); padding-bottom: 3px; margin: 6mm 0 3mm; }
.fiche .synthese { display: grid; gap: 4px; margin-bottom: 6px; }
.fiche .niveau-synthese { display: grid; grid-template-columns: 34px 1fr 70px; align-items: center; gap: 8px; font-size: 9.5pt; }
.fiche .niveau-synthese .puce { text-align: center; }
.fiche .barre { height: 11px; background: #edf0f4; border-radius: 6px; overflow: hidden; }
.fiche .remplissage { height: 100%; border-radius: 6px; }
.fiche .remplissage.A { background: var(--vert); }
.fiche .remplissage.B { background: #3b82f6; }
.fiche .remplissage.C { background: var(--orange); }
.fiche .remplissage.D { background: var(--rouge); }
.fiche .niveau-synthese .chiffre { font-weight: bold; text-align: right; }
.fiche .niveau-synthese .chiffre small { font-weight: normal; color: #666; }
.fiche table.par-activite td.chiffre-niveau { font-size: 9.5pt; color: #888; }
.fiche table.par-activite td.fort { font-weight: bold; color: #111; }
.fiche table.par-activite td.fort.A { background: var(--vert-clair) !important; }
.fiche table.par-activite td.fort.B { background: var(--bleu-clair) !important; }
.fiche table.par-activite td.fort.C { background: #fef3c7 !important; }
.fiche table.par-activite td.fort.D { background: var(--rouge-clair) !important; }
.fiche table.sommaire td { font-size: 9pt; }
.fiche table.sommaire .puce { font-size: 8pt; min-width: 26px; padding: 1px 5px; }
@media print {
    .fiche .barre, .fiche .remplissage, .fiche table.par-activite td.fort, .fiche .garde-eleve { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Page de garde : densite pour tenir sur une page A4 ; tendance mixte */
.puce.mixte { background: #9ca3af; }
.fiche td.activite { color: #111; }
.fiche.garde .garde-eleve { margin: 2mm 0 4mm; padding: 3mm; }
.fiche.garde .garde-eleve .nom { font-size: 22pt; }
.fiche.garde .identite { margin-bottom: 4mm; }
.fiche.garde .identite div { padding: 4px 8px; }
.fiche.garde .titre-garde { margin: 4mm 0 2mm; font-size: 10pt; }
.fiche.garde .synthese { gap: 2px; }
.fiche.garde .niveau-synthese { font-size: 9pt; }
.fiche.garde .barre { height: 9px; }
.fiche.garde table { font-size: 9pt; margin-bottom: 4px; }
.fiche.garde thead th { padding: 4px 6px; font-size: 8pt; }
.fiche.garde td { padding: 2px 6px; }
.fiche.garde table.par-activite td.activite { font-weight: 600; font-size: 8.5pt; }
.fiche.garde table.par-activite td.niveau { font-size: 9pt; line-height: 1.3; }
.fiche.garde table.par-activite .puce, .fiche.garde table.sommaire .puce { font-size: 7.5pt; min-width: 24px; padding: 0 5px; }
.fiche.garde table.sommaire td { font-size: 8.5pt; }
.fiche.garde .pied-fiche { margin-top: 4mm; }
/* Ajustement fin : la zone utile imprimee (A4 moins les marges de page) fait 275 mm */
.fiche.garde .garde-eleve { margin: 1mm 0 3mm; padding: 2mm; }
.fiche.garde .garde-eleve .nom { font-size: 20pt; }
.fiche.garde .identite { margin-bottom: 3mm; }
.fiche.garde .identite .valeur { font-size: 11pt; }
.fiche.garde .titre-garde { margin: 3mm 0 1.5mm; }
.fiche.garde .barre { height: 8px; }
.fiche.garde td { padding: 1px 6px; }
.fiche.garde thead th { padding: 3px 6px; }
.fiche.garde .pied-fiche { margin-top: 3mm; padding-top: 4px; }

/* Fiches : marge de securite pour tenir dans la zone utile d'une page (279 mm),
   meme avec des commentaires sur deux lignes */
.fiche:not(.garde) .bandeau-fiche { margin-bottom: 8px; padding-bottom: 4px; }
.fiche:not(.garde) .identite { margin-bottom: 8px; }
.fiche:not(.garde) .identite div { padding: 4px 8px; }
.fiche:not(.garde) .identite .valeur { font-size: 11pt; }
.fiche:not(.garde) .identite .valeur.eleve { font-size: 13pt; }
.fiche:not(.garde) table { font-size: 9pt; }
.fiche:not(.garde) thead th { padding: 4px 6px; }
.fiche:not(.garde) td { padding: 3px 6px; }
.fiche:not(.garde) td.notes { font-size: 8pt; line-height: 1.3; }
.fiche:not(.garde) .legende-fiche { margin-bottom: 6px; padding: 4px 8px; }
.fiche:not(.garde) .evolutions-fiche { min-height: 16mm; padding: 6px 8px; }
.fiche:not(.garde) .pied-fiche { margin-top: 8px; padding-top: 5px; }
@media print { .fiche:not(.garde) .pied-fiche { margin-top: 6mm; } }
.fiche .ref-fiche { text-align: right; font-size: 8pt; color: #777; margin-bottom: 6px; }

/* Page de garde : sommaire compact sur deux colonnes, detail par activite serre */
.fiche.garde .sommaire-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 14px; font-size: 8pt; }
.fiche.garde .ligne-sommaire { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-bottom: 1px solid #e5e7eb; }
.fiche.garde .ligne-sommaire .date { width: 52px; color: #555; }
.fiche.garde .ligne-sommaire .qui { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fiche.garde .ligne-sommaire .nb { width: 34px; color: #777; text-align: right; }
.fiche.garde .ligne-sommaire .puces { display: inline-flex; gap: 2px; }
.fiche.garde .ligne-sommaire .puce { font-size: 7pt; min-width: 22px; padding: 0 4px; }
.fiche.garde table.par-activite { font-size: 8.5pt; }
.fiche.garde table.par-activite td { padding: 0 6px; line-height: 1.5; }
.fiche.garde table.par-activite td.activite { font-size: 8pt; }
.fiche.garde table.par-activite .puce { font-size: 7pt; min-width: 22px; padding: 0 4px; }
.fiche.garde .garde-eleve .nom { font-size: 18pt; }
.fiche.garde .synthese .barre { height: 7px; }

/* Logo de l'application (etoile a cinq) */
.logo-app { width: 34px; height: 34px; vertical-align: middle; margin-right: 8px; flex: none; }
.entete h1 { display: flex; align-items: center; gap: 10px; }
.carte-connexion .logo .icone img { width: 72px; height: 72px; }
.fiche .bandeau-fiche h1 { display: flex; align-items: center; gap: 8px; }
.fiche .bandeau-fiche .logo-app { width: 26px; height: 26px; margin: 0; }

/* Fenetre d'accueil du formulaire : ton calme, texte court */
.instructions h2 { color: var(--bleu); margin-bottom: 14px; }
.instructions .bloc { margin-bottom: 16px; }
.instructions .bloc h3 { margin: 0 0 6px; font-size: 14px; color: var(--texte); border-bottom: 1px solid var(--bord); padding-bottom: 4px; }
.instructions .bloc ul { margin: 0 0 0 18px; line-height: 1.55; }
.instructions .bloc li { margin-bottom: 4px; }
.instructions .bloc li.regle { color: var(--rouge); }
.instructions .mention { background: var(--fond); border-radius: 6px; padding: 10px 12px; }
.instructions .mention h3 { border: none; padding: 0; }
.instructions .mention p { font-size: 13px; line-height: 1.55; color: #374151; }

/* =====================================================================
   Formulaire enseignant : etapes en cartes, pastilles de niveau, barre d'action
   ===================================================================== */
.carte-etape { border: 1px solid var(--bord); border-radius: 8px; padding: 18px 20px; margin-bottom: 18px; background: var(--blanc); }
.etape-titre { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin-bottom: 14px; flex-wrap: wrap; }
.etape-titre .numero { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bleu); color: var(--blanc); font-size: 14px; flex: none; }
.etape-titre .etape-sous { font-weight: normal; font-size: 13px; color: var(--texte-doux); }
.obligatoire { color: var(--rouge); font-weight: 700; }
.aide-obligatoire { font-size: 12px; color: var(--texte-doux); margin-top: 4px; }
.carte-etape .champ textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--bord-fort); border-radius: 6px; font-size: 14px; font-family: inherit; }

/* Legende des niveaux : une pastille par niveau */
.legende-niveaux { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 20px; margin-bottom: 14px; font-size: 13px; }
.niveau-legende { display: flex; align-items: center; gap: 8px; }
.niveau-legende .regle { color: var(--rouge); font-style: normal; font-weight: 600; }
.pastille { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: var(--blanc); font-weight: 700; font-size: 13px; flex: none; }
.pastille.A { background: var(--vert); }
.pastille.B { background: #3b82f6; }
.pastille.C { background: var(--orange); }
.pastille.D { background: var(--rouge); }

/* Grille : en-tete bleu, pastilles cliquables */
table.grille-activites th, table.grille-activites td { border: 1px solid var(--bord); }
table.grille-activites thead th { background: var(--bleu); color: var(--blanc); border-color: var(--bleu); font-size: 12px; padding: 9px 10px; }
table.grille-activites th.col-activite { width: 22%; }
table.grille-activites th.col-niveaux { width: 200px; text-align: center; }
table.grille-activites tbody tr:nth-child(even) { background-color: var(--blanc); }
table.grille-activites tbody tr:hover { background-color: #f9fafb; }
table.grille-activites tr.evaluee td.activite { color: var(--bleu); }
td.activite { font-weight: 600; font-size: 13px; vertical-align: middle; }
td.choix { width: 200px; vertical-align: middle; }
.pastilles { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pastille-choix { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--bord-fort); background: var(--blanc); color: var(--texte-doux); font-weight: 700; font-size: 14px; cursor: pointer; user-select: none; transition: transform 0.1s, background-color 0.15s, color 0.15s, border-color 0.15s; }
.pastille-choix input { position: absolute; opacity: 0; width: 0; height: 0; }
.pastille-choix:hover { transform: scale(1.08); }
.pastille-choix.A:hover { border-color: var(--vert); color: var(--vert); }
.pastille-choix.B:hover { border-color: #3b82f6; color: #3b82f6; }
.pastille-choix.C:hover { border-color: var(--orange); color: var(--orange); }
.pastille-choix.D:hover { border-color: var(--rouge); color: var(--rouge); }
.pastille-choix:has(input:checked) { color: var(--blanc); }
.pastille-choix.A:has(input:checked) { background: var(--vert); border-color: var(--vert); }
.pastille-choix.B:has(input:checked) { background: #3b82f6; border-color: #3b82f6; }
.pastille-choix.C:has(input:checked) { background: var(--orange); border-color: var(--orange); }
.pastille-choix.D:has(input:checked) { background: var(--rouge); border-color: var(--rouge); }
.pastille-choix:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35); }
.effacer-niveau { width: 22px; height: 22px; border-radius: 50%; border: none; background: var(--bord); color: var(--texte-doux); font-size: 14px; line-height: 1; cursor: pointer; margin-left: 2px; }
.effacer-niveau:hover { background: var(--bord-fort); color: var(--texte); }
textarea.commentaire-champ { min-height: 46px; font-size: 13px; padding: 7px 9px; border-radius: 6px; border-color: var(--bord-fort); }
textarea.commentaire-champ:focus { outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

/* Barre d'action : resume de la saisie et bouton Enregistrer */
.barre-action { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; padding: 12px 18px; margin: 0 -30px -30px; background: var(--blanc); border-top: 2px solid var(--bord); border-radius: 0 0 8px 8px; box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06); }
.etat-formulaire { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.etat-formulaire .puce { font-size: 11px; }
.indication { color: var(--texte-doux); font-size: 12px; }
.indication.alerte { color: var(--rouge); font-weight: 600; }
.barre-action .btn-principal { padding: 12px 26px; font-size: 15px; }

@media screen and (max-width: 900px) {
    .carte-etape { padding: 12px; }
    td.choix { width: auto; }
    td.choix::before { display: none; }
    .pastilles { justify-content: flex-start; padding: 4px 0; }
    .pastille-choix { width: 40px; height: 40px; font-size: 16px; }
    .barre-action { margin: 0 -14px -14px; padding: 10px 14px; }
    .barre-action .entete-actions { width: 100%; }
    .barre-action .btn { flex: 1; }
}

/* Fenetre d'accueil : case « J'ai compris » */
.instructions .case-compris { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 4px 0 12px; cursor: pointer; }
.instructions .case-compris input { width: 18px; height: 18px; cursor: pointer; }

/* Regle bloquante C/D : le reste de la grille est inerte tant que le cadre 2 manque */
table.grille-activites.verrouillee tr:not(.ligne-bloquante) td { opacity: 0.4; }
table.grille-activites.verrouillee tr:not(.ligne-bloquante) .pastille-choix { cursor: not-allowed; }
table.grille-activites tr.ligne-bloquante td { background-color: #fff8e1 !important; }
table.grille-activites tr.ligne-bloquante td.activite { color: var(--rouge); }
table.grille-activites tr.ligne-bloquante textarea.obligatoire-vide { border-color: var(--rouge) !important; background-color: var(--blanc) !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2); }

/* Grille : nom de l'activite et pastilles centres verticalement (priorite sur la regle generale vertical-align: top) */
table.grille-activites td.activite, table.grille-activites td.choix { vertical-align: middle; }

/* Journal : badges d'evenements */
.badge-attention { background: #fef3c7; color: #92400e; }
.badge-danger { background: var(--rouge-clair); color: #991b1b; }
table.liste code { font-size: 12px; background: var(--fond); padding: 2px 6px; border-radius: 4px; }

/* Tableaux condenses (journal) */
table.liste.compacte { font-size: 12.5px; }
table.liste.compacte th { padding: 7px 8px; font-size: 12px; }
table.liste.compacte td { padding: 4px 8px; line-height: 1.3; }
table.liste.compacte td.date { white-space: nowrap; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
table.liste.compacte .badge { padding: 1px 8px; font-size: 11px; }
table.liste.compacte code { font-size: 11px; padding: 1px 5px; }
table.liste.compacte tbody tr:nth-child(even) { background-color: #fafafa; }

/* Confirmation d'enregistrement : rappel de l'enseignant en cours */
.continuer-en-tant-que { margin-top: 14px; padding: 10px 12px; background: var(--bleu-clair); border-radius: 6px; font-size: 13px; }

/* Avertissement (doublon de formulaire) */
.message.attention { background-color: #fef3c7; color: #92400e; border: 1px solid #fcd34d; margin: 12px 0 0; }
