/* Rapports PDF : feuilles A4 (aperçu à l'écran = impression). Une feuille = une page imprimée :
   210 × 297 mm (portrait) ou 297 × 210 mm (paysage), @page { margin: 0 } posé par rapports-feuilles.js.
   Fredoka, couleurs douces à l'impression, aucun élément d'interface imprimé, aucune ligne coupée.
   Seuils : < 50 % (rouge doux), 50–79 % (ambre), ≥ 80 % (vert). Réponses : pastilles D34 (reponses.js). */

.feuilles {
  display: grid;
  justify-content: center;
  gap: 24px;
}

.a4 {
  --r-encre: #1f2933;
  --r-doux: #5b6770;
  --r-trait: #e2e6e9;
  --r-fond: #f4f6f7;
  --r-bas: #fde3df;
  --r-bas-fort: #e2584a;
  --r-bas-texte: #a3261d;
  --r-moyen: #fff6c7;
  --r-moyen-fort: #e2c53c;
  --r-moyen-texte: #665800;
  --r-haut: #e1f3e8;
  --r-haut-fort: #3a9e68;
  --r-haut-texte: #1b6e42;
  --r-absent: #eef1f3;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 210mm;
  height: 297mm;
  padding: 11mm 14mm 9mm;
  overflow: hidden;
  background: #ffffff;
  color: var(--r-encre);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  font-family: 'Fredoka', system-ui, sans-serif;
  font-size: 10pt;
  font-weight: 400;
  line-height: 1.35;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.a4-paysage { width: 297mm; height: 210mm; padding: 9mm 13mm 8mm; }

.a4-tete, .a4-pied {
  display: flex;
  justify-content: space-between;
  gap: 6mm;
  flex: none;
  color: var(--r-doux);
  font-size: 8pt;
}
.a4-tete { padding-bottom: 2.2mm; margin-bottom: 5mm; border-bottom: 0.3mm solid var(--r-trait); }
.a4-pied { padding-top: 2.2mm; margin-top: 3mm; border-top: 0.3mm solid var(--r-trait); }
.tete-gauche { font-weight: 600; color: var(--r-encre); }
.a4-corps { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.a4-contenu { display: flow-root; }
.trop-grand { zoom: 0.85; }
.suite { margin: 0 0 2mm; color: var(--r-doux); font-size: 8.5pt; font-style: italic; }

/* ---------- En-tête du rapport, titres ---------- */

.rapport-entete { margin-bottom: 5mm; padding-left: 4mm; border-left: 1.6mm solid var(--agir); }
.rapport-surtitre { margin: 0; color: var(--r-doux); font-size: 8.5pt; letter-spacing: 0.04em; text-transform: uppercase; }
.rapport-titre { margin: 0.5mm 0 1mm; font-size: 21pt; line-height: 1.15; }
.rapport-sous { margin: 0; color: var(--r-doux); font-size: 10.5pt; }
.rapport-h2 { margin: 6mm 0 2.5mm; font-size: 12.5pt; font-weight: 600; }
.a4-contenu > .rapport-h2:first-child { margin-top: 0; }
.rien, .note-rapport, .a-savoir { margin: 1.5mm 0; }
.rien, .note-rapport { color: var(--r-doux); }
.note-rapport { font-size: 8.5pt; }
.a-savoir strong { font-weight: 600; }

/* ---------- Chiffres clés ---------- */

.chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3mm; }
.chiffre { display: grid; align-content: start; gap: 0.5mm; padding: 3mm 3.5mm; border-radius: 2.5mm; background: var(--r-fond); }
.chiffre-libelle { color: var(--r-doux); font-size: 8.5pt; }
.chiffre-valeur { font-size: 19pt; font-weight: 700; line-height: 1.1; }
.chiffre-detail { color: var(--r-doux); font-size: 8pt; }

/* ---------- Tableaux ---------- */

.rapport-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rapport-table tr { break-inside: avoid; }
.rapport-table th {
  padding: 1.6mm 1.8mm;
  background: var(--r-fond);
  color: var(--r-doux);
  font-size: 8.5pt;
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
}
.rapport-table td { padding: 1.5mm 1.8mm; border-bottom: 0.25mm solid var(--r-trait); vertical-align: middle; }
.rapport-table .col-n { width: 13mm; font-weight: 600; }
.repere { display: inline-grid; line-height: 1.1; }
.repere-q { font-weight: 600; }
.repere-jour, .repere-serie { color: var(--r-doux); font-size: 7pt; font-weight: 400; }
.repere-serie { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.rapport-table .col-nombre { width: 20mm; text-align: center; }
.rapport-table .col-jauge { width: 52mm; }
.rapport-table .col-reussite { width: 18mm; text-align: right; font-weight: 600; }
.table-annexe td { font-size: 8.5pt; }
.table-annexe .col-serie { width: 26mm; }
.table-annexe .col-bonne { width: 42mm; }
.table-ratees .col-bonne, .table-ratees .col-erreur { width: 42mm; }
.table-aider .col-eleve { width: 40mm; }
.nombre-eleves { color: var(--r-doux); font-size: 8.5pt; }

.pastilles { display: inline-flex; gap: 0.6mm; vertical-align: middle; }
.reponse-ecrite { display: inline; }
.reponse-texte { vertical-align: middle; }

.jauge { display: inline-flex; align-items: center; gap: 2mm; width: 100%; }
.jauge-barre { flex: 1; height: 2.6mm; border-radius: 2mm; background: var(--r-absent); overflow: hidden; }
.jauge-rempli { display: block; height: 100%; border-radius: 2mm; background: var(--r-doux); }
.jauge-pct { width: 11mm; text-align: right; font-weight: 600; }
.jauge.niveau-bas .jauge-rempli { background: var(--r-bas-fort); }
.jauge.niveau-moyen .jauge-rempli { background: var(--r-moyen-fort); }
.jauge.niveau-haut .jauge-rempli { background: var(--r-haut-fort); }
.niveau-texte-bas { color: var(--r-bas-texte); }
.niveau-texte-moyen { color: var(--r-moyen-texte); }
.niveau-texte-haut { color: var(--r-haut-texte); }
.niveau-texte-aucun { color: var(--r-doux); }

.legende-rapport { display: flex; flex-wrap: wrap; gap: 1.5mm 5mm; margin: 1.5mm 0 3mm; color: var(--r-doux); font-size: 8.5pt; }
.legende-element { display: inline-flex; align-items: center; gap: 1.5mm; }
.legende-pastille, .legende-case { display: inline-grid; place-items: center; width: 4mm; height: 4mm; border-radius: 1mm; font-size: 7pt; font-weight: 700; }
.legende-pastille.niveau-bas { background: var(--r-bas-fort); }
.legende-pastille.niveau-moyen { background: var(--r-moyen-fort); }
.legende-pastille.niveau-haut { background: var(--r-haut-fort); }
.legende-pastille.niveau-aucun { background: var(--r-absent); }

/* Élèves × questions */
.table-eleves-questions .col-eleve { width: 32mm; }
.table-eleves-questions .col-q, .table-eleves-questions .cq { text-align: center; padding: 1.2mm 0.5mm; }
.table-eleves-questions .col-q .repere { justify-items: center; }
.table-eleves-questions .col-total { width: 17mm; text-align: center; font-weight: 600; }
.table-eleves-questions .col-repondu { font-weight: 400; color: var(--r-doux); }
.cq { position: relative; }
.cq-juste, .legende-case.cq-juste { background: var(--r-haut); box-shadow: inset 0 -0.7mm 0 var(--juste); }
.cq-faux, .legende-case.cq-faux { background: var(--r-bas); box-shadow: inset 0 -0.7mm 0 var(--faux); }
.cq-absent, .legende-case.cq-absent { background: var(--r-absent); color: var(--r-doux); }
.legende-case.cq-neutre { background: #fff; box-shadow: inset 0 0 0 0.25mm var(--r-trait); }
.cq-sure-faux, .legende-case.cq-sure-faux { box-shadow: inset 0 0 0 0.6mm var(--faux); color: var(--faux); }
.marque-sure { position: absolute; top: 0.4mm; right: 0.8mm; color: var(--faux); font-size: 7.5pt; font-weight: 700; }
.tiret { color: var(--r-doux); }
.ligne-pied td { background: var(--r-fond); font-weight: 600; }

/* Élèves × notions */
.table-eleves-notions .col-eleve { width: 32mm; }
.table-eleves-notions th.col-notion { text-align: center; font-size: 8pt; line-height: 1.2; }
.table-eleves-notions .col-total { width: 22mm; text-align: center; }
.case-notion { text-align: center; }
.case-notion.niveau-bas { background: var(--r-bas); color: var(--r-bas-texte); }
.case-notion.niveau-moyen { background: var(--r-moyen); color: var(--r-moyen-texte); }
.case-notion.niveau-haut { background: var(--r-haut); color: var(--r-haut-texte); }
.case-notion.niveau-aucun { background: var(--r-absent); color: var(--r-doux); }
.notion-pct { font-weight: 700; }
.notion-detail { margin-left: 1.5mm; font-size: 7.5pt; opacity: 0.8; }

/* Groupes de besoin */
.groupe { margin: 0 0 2.5mm; break-inside: avoid; }
.groupe-notion { margin: 0 0 1mm; font-size: 10pt; font-weight: 600; }
.puces { display: flex; flex-wrap: wrap; gap: 1.5mm; margin: 0; }
.puce { padding: 0.6mm 2.4mm; border-radius: 3mm; background: var(--r-bas); font-size: 9pt; }

/* ---------- Fiche par élève ---------- */

.fiche-entete { margin-bottom: 4mm; }
.fiche-classe { margin: 0; color: var(--r-doux); font-size: 9pt; }
.fiche-nom { margin: 0.5mm 0 3mm; font-size: 26pt; line-height: 1.1; }
.fiche-bilan { display: flex; align-items: center; gap: 5mm; padding: 3mm 4mm; border-radius: 2.5mm; background: var(--r-fond); }
.fiche-pct { font-size: 26pt; font-weight: 700; line-height: 1; }
.fiche-bilan-texte p { margin: 0; }
.fiche-repondu { color: var(--r-doux); font-size: 9pt; }
.fiche-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-bottom: 5mm; }
.fiche-liste { padding: 2.5mm 3.5mm; border-radius: 2.5mm; break-inside: avoid; }
.liste-reussi { background: var(--r-haut); }
.liste-revoir { background: var(--r-moyen); }
.fiche-liste-titre { margin: 0 0 1mm; font-size: 10.5pt; }
.fiche-liste ul { margin: 0; padding-left: 4.5mm; font-size: 9pt; }
.fiche-liste-vide { margin: 0; color: var(--r-doux); font-size: 9pt; }
.fiche-liste-plus { color: var(--r-doux); list-style: none; }
.table-fiche .col-marque { width: 8mm; text-align: center; font-size: 12pt; font-weight: 700; }
.table-fiche .col-reponse, .table-fiche .col-bonne { width: 46mm; }
.marque-juste { color: var(--juste); }
.marque-faux { color: var(--faux); }
.marque-absent { color: var(--r-doux); }
.ligne-absent td { color: var(--r-doux); }
.pas-de-reponse { color: var(--r-doux); font-style: italic; }
.fiche-certitude { display: inline-block; margin-left: 1.5mm; padding: 0 1.8mm; border-radius: 2mm; background: var(--r-fond); color: var(--r-doux); font-size: 7.5pt; }
.fiche-certitude.sure-faux { background: var(--faux); color: #fff; font-weight: 600; }

/* ---------- Impression : seulement les feuilles ---------- */

@media print {
  html, body.rapports { margin: 0; padding: 0; background: #ffffff; }
  .ecran-seulement { display: none !important; }
  .rapports-page { display: block; padding: 0; }
  .feuilles { display: block; zoom: 1 !important; }
  .a4 { margin: 0; box-shadow: none; break-after: page; }
  .a4:last-child { break-after: auto; }
}
