:root {
  --navy: #1F3864;
  --navy-dark: #14254a;
  --ink: #1E293B;
  --muted: #475569;
  --line: #CBD5E1;
  --bg: #F4F6FA;
  --soft: #E6ECF7;
  --green: #15803D;
  --red: #B91C1C;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
a { color: var(--navy); }
a:hover { color: var(--navy-dark); }
h1 { margin: 0; font-size: 26px; color: var(--navy); }
h2 { margin: 0; font-size: 16px; color: var(--navy); }
label { font-size: 13px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=email], input[type=password], textarea {
  font: inherit; font-size: 15px; width: 100%;
  padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, button:focus-visible { outline: 3px solid #93B4E8; outline-offset: 1px; }
textarea { resize: vertical; line-height: 1.5; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.over { color: var(--red); font-weight: 600; }
.inline { display: inline; margin: 0; }

/* Boutons */
.btn {
  font: inherit; font-size: 15px; font-weight: 600;
  padding: 10px 20px; min-height: 44px; border-radius: 10px;
  cursor: pointer; border: 1px solid var(--navy);
}
.pri { background: var(--navy); color: #fff; }
.pri:hover { background: var(--navy-dark); }
.sec { background: #fff; color: var(--navy); }
.nxt { background: var(--green); border-color: var(--green); color: #fff; margin-left: auto; }
.small-btn { align-self: flex-start; font-size: 14px; }
.linkbtn { font: inherit; background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; padding: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; padding: 8px 14px; min-height: 40px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.chip:hover { border-color: var(--navy); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Barre du haut */
.topbar {
  background: var(--navy); color: #fff;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 24px;
}
.topbar a { color: #fff; }
.brand { font-weight: 700; text-decoration: none; }
.topnav { display: flex; gap: 18px; align-items: center; font-size: 14px; }

/* Pages de connexion */
body.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: #fff; border-radius: 14px; padding: 32px; width: 100%; max-width: 420px; }
.auth-card .muted { margin: 4px 0 20px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { margin-top: 12px; }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.alert-error { background: #FEE2E2; color: #7F1D1D; }
.alert-info { background: #DCFCE7; color: #14532D; }

/* Saisie */
.page { max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 560px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.head p { margin: 4px 0 8px; font-size: 14px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; background: #FEF3C7; color: #78350F; padding: 3px 10px; border-radius: 999px; }
.selectors { display: flex; flex-wrap: wrap; gap: 20px; }
.group, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.glabel { font-size: 13px; color: var(--muted); font-weight: 600; }

.layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.card { background: #fff; border-radius: 14px; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

.students { flex: 1 1 220px; padding: 12px; gap: 2px; }
.students .glabel { padding: 4px 12px 8px; }
.stu {
  font: inherit; font-size: 14px; display: flex; justify-content: space-between; align-items: center;
  width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink); cursor: pointer; text-align: left;
}
.stu:hover { background: var(--bg); }
.stu.cur { background: var(--soft); font-weight: 600; }
.ok { color: var(--green); font-size: 12px; font-weight: 600; }
.todo { color: #64748B; font-size: 12px; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.student-head { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.student-head > div:first-child { display: flex; flex-direction: column; gap: 10px; }
.stu-name { font-size: 22px; font-weight: 700; }
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tile { background: var(--bg); border-radius: 10px; padding: 10px 16px; min-width: 96px; }
.tile-label { font-size: 12px; color: var(--muted); }
.tile-val { font-size: 22px; font-weight: 700; }
.tile-val.main { color: var(--navy); }

.crit-list { display: flex; flex-direction: column; gap: 14px; }
.crit-list.more { border-top: 1px solid #E2E8F0; padding-top: 14px; }
.crit-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crit-label { flex: 0 0 190px; font-size: 14px; font-weight: 600; }

.gen-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gen-label { font-size: 14px; font-weight: 700; color: var(--navy); margin-right: 4px; }
.gen-row .chip { font-weight: 600; }

@media (max-width: 640px) {
  .page { padding: 16px; }
  .crit-label { flex-basis: 100%; }
  .nxt { margin-left: 0; }
}

button:disabled { opacity: .55; cursor: wait; }

/* Étape 3 : classes, import, récapitulatif */
a.btn, a.chip { display: inline-flex; align-items: center; text-decoration: none; }
.danger { background: var(--red); border-color: var(--red); color: #fff; }
.page.narrow-wide { max-width: 920px; }
select { font: inherit; font-size: 15px; padding: 10px 12px; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 14px; color: var(--ink); }
.tri-choix { border: 0; padding: 0; margin: 0 0 4px; display: flex; gap: 16px; flex-wrap: wrap; }
.tri-choix legend { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; padding: 0; }
.alert-warn { background: #FEF3C7; color: #78350F; margin: 0; }
.row.between { justify-content: space-between; }

.classe-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #E2E8F0; }
.classe-row:last-child { border-bottom: 0; }
.classe-nom { font-weight: 700; font-size: 17px; }
.classe-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.suppr summary { cursor: pointer; font-size: 13px; color: var(--red); padding: 8px; }
.suppr[open] { flex-basis: 100%; background: #FEF2F2; border-radius: 10px; padding: 8px 12px; }

.table-box { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th, .tableau td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #E2E8F0; }
.tableau th { color: var(--muted); font-weight: 600; font-size: 13px; }

.recap { gap: 0; }
.recap-row { padding: 14px 0; border-bottom: 1px solid #E2E8F0; display: flex; flex-direction: column; gap: 6px; }
.recap-row:last-child { border-bottom: 0; }
.recap-nom { font-weight: 700; display: flex; gap: 10px; align-items: center; }
.recap-texte { margin: 0; line-height: 1.5; }
.recap-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.copier.fait, #copier.fait { background: var(--green); border-color: var(--green); color: #fff; }

[hidden] { display: none !important; }

/* Mes classes, version claire */
.intro { margin: -4px 0 0; }
.classe-card { gap: 14px; }
.classe-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.progress-line { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 8px; background: #E2E8F0; border-radius: 999px; overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--green); width: 0; }
.progress-bar.w5 { width: 5%; }
.progress-bar.w10 { width: 10%; }
.progress-bar.w15 { width: 15%; }
.progress-bar.w20 { width: 20%; }
.progress-bar.w25 { width: 25%; }
.progress-bar.w30 { width: 30%; }
.progress-bar.w35 { width: 35%; }
.progress-bar.w40 { width: 40%; }
.progress-bar.w45 { width: 45%; }
.progress-bar.w50 { width: 50%; }
.progress-bar.w55 { width: 55%; }
.progress-bar.w60 { width: 60%; }
.progress-bar.w65 { width: 65%; }
.progress-bar.w70 { width: 70%; }
.progress-bar.w75 { width: 75%; }
.progress-bar.w80 { width: 80%; }
.progress-bar.w85 { width: 85%; }
.progress-bar.w90 { width: 90%; }
.progress-bar.w95 { width: 95%; }
.progress-bar.w100 { width: 100%; }
.classe-liens { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; border-top: 1px solid #E2E8F0; padding-top: 10px; }
.classe-liens .suppr summary { padding: 0; }
.classe-liens .suppr[open] { padding: 10px 12px; }
.nouvelle summary { cursor: pointer; font-weight: 700; color: var(--navy); list-style: none; }
.nouvelle summary::-webkit-details-marker { display: none; }
.nouvelle[open] summary { margin-bottom: 8px; }

/* Tableau des notes de la classe */
.titre-classe { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
#notes-dialog { border: 0; border-radius: 14px; padding: 20px 24px; width: min(1000px, 95vw); max-height: 88vh; color: var(--ink); }
#notes-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#notes-dialog .table-box { max-height: 65vh; overflow: auto; }
.notes-table thead th { position: sticky; top: 0; background: #fff; }
.notes-table .num { text-align: center; white-space: nowrap; }
.notes-table .fort { font-weight: 700; }
.notes-table .sous10 { color: var(--red); }
.notes-table .manque { color: #64748B; font-style: italic; }
.notes-table tr.courant td { background: var(--soft); }
.notes-table tfoot td { border-top: 2px solid var(--line); background: var(--bg); }
.lien-eleve { font: inherit; background: none; border: 0; padding: 4px 0; color: var(--navy); text-decoration: underline; cursor: pointer; text-align: left; }

/* Liens présentés comme des boutons : le texte reste lisible au survol et au clic */
a.btn.pri, a.btn.pri:hover, a.btn.pri:focus, a.btn.pri:active, a.btn.pri:visited,
a.chip.on, a.chip.on:hover, a.chip.on:focus, a.chip.on:active, a.chip.on:visited { color: #fff; }
a.btn.sec, a.btn.sec:hover, a.btn.sec:active, a.btn.sec:visited { color: var(--navy); }
a.chip, a.chip:hover, a.chip:active, a.chip:visited { color: var(--ink); }
a.chip.on { color: #fff; }
a.btn:hover, a.btn:active { text-decoration: none; }
