:root {
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --primary: #1e4d8c;
  --primary-hover: #163a6b;
  --border: #d8dee6;
  --ok: #1a7f4b;
  --ko: #b42318;
  --locked: #eef1f5;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ═══════════════════════════════════════════
   ÉCRAN DE CONNEXION
   ═══════════════════════════════════════════ */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2444 0%, #1e4d8c 50%, #163a6b 100%);
  animation: loginFadeIn 0.4s ease;
}
#login-overlay.hidden {
  display: none;
}
@keyframes loginFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2.8rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 380px;
  animation: loginSlideUp 0.4s ease;
}
@keyframes loginSlideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.login-logo-wrap {
  text-align: center;
  margin-bottom: 1rem;
  min-height: 48px;
}
.login-logo {
  max-height: 60px;
  max-width: 180px;
  object-fit: contain;
}
.login-title {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  line-height: 1.25;
}
.login-subtitle {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}
.login-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}
.login-input-wrap {
  position: relative;
  margin-bottom: 1.1rem;
}
.login-input[type="text"],
input[type="search"],
input[type="number"],
input[type="color"],
select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 100%;
}
.login-input {
  width: 100%;
  padding: 0.65rem 2.8rem 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 9px;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: #f9fafc;
}
.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,77,140,0.14);
  background: #fff;
}
.login-input.error {
  border-color: var(--ko);
  box-shadow: 0 0 0 3px rgba(180,35,24,0.12);
  animation: loginShake 0.35s ease;
}
@keyframes loginShake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}
.login-eye {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.login-eye:hover { color: var(--primary); }
.login-btn {
  width: 100%;
  padding: 0.7rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 9px;
  letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.1s;
}
.login-btn:active { transform: scale(0.98); }
.login-error {
  margin: 0.75rem 0 0;
  color: var(--ko);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* Masquer le contenu de l'app tant que le login n'est pas validé */
body:not(.unlocked) > *:not(#login-overlay) {
  visibility: hidden;
  pointer-events: none;
}
body.unlocked #login-overlay {
  display: none;
}
body.unlocked > *:not(#login-overlay) {
  pointer-events: auto !important;
}

/* ═══════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

html.dnb-page:not([data-morant-theme="dark"]) {
  background: var(--bg) !important;
}

html.dnb-page:not([data-morant-theme="dark"]) body {
  background: var(--bg) !important;
}

html.dnb-page:not([data-morant-theme="dark"]) body.tab-saisie-active {
  background:
    radial-gradient(circle at 15% 18%, rgba(211, 245, 224, 0.42), transparent 28rem),
    radial-gradient(circle at 86% 38%, rgba(255, 239, 196, 0.5), transparent 26rem),
    var(--saisie-bg-color, var(--bg)) !important;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.header-text h1 {
  margin: 0;
  font-size: 1.25rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.header-college {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.header-status {
  margin-left: auto;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-locked {
  background: #fde8e8;
  color: #9b1c1c;
}

.badge-ok {
  background: #d3f5e0;
  color: var(--ok);
}

.badge-server {
  background: #dbeafe;
  color: #1e40af;
}

.badge-local {
  background: #f3f4f6;
  color: var(--muted);
}

.badge-error {
  background: #fde8e8;
  color: var(--ko);
}

.header-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.tabs {
  display: flex;
  gap: 0;
  padding: 0 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

main:has(> #panel-eleves.active),
main:has(> #panel-stats.active) {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

#panel-saisie {
  position: relative;
  overflow: hidden;
  z-index: 0;
}

#panel-saisie::before {
  content: "";
  position: absolute;
  inset: -3rem;
  z-index: 0;
  background-color: var(--saisie-bg-color, #f4f6f9);
  background-image: var(--saisie-bg-image);
  background-size: cover;
  background-position: center;
  filter: blur(2px);
  opacity: 0.9;
  transform: scale(1.04);
  pointer-events: none;
}

#panel-saisie > .card {
  position: relative;
  z-index: 1;
}

.card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

#panel-saisie .card {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(2px);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.card-danger {
  border-color: #f5c2c2;
}

.form-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  align-items: end;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.field input,
.field select,
.filters input,
.filters select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  min-width: 160px;
  max-width: 100%;
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e8ecf1;
  color: var(--text);
}

.btn-danger {
  background: var(--ko);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.file-label {
  display: inline-block;
  cursor: pointer;
}

.hint,
.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.feedback {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.feedback-success {
  background: #d3f5e0;
  color: var(--ok);
}

.feedback-error {
  background: #fde8e8;
  color: var(--ko);
}

.notes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.note-chip {
  background: #eef3fa;
  padding: 0.3rem 0.45rem 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.note-chip-value,
.note-chip-action {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
}

.note-chip-value {
  padding: 0;
  font-weight: 700;
}

.note-chip-value:hover,
.note-chip-action:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.note-chip-action {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  opacity: 0.72;
}

.note-chip-action:hover {
  background: rgba(30, 77, 140, 0.1);
  text-decoration: none;
  opacity: 1;
}

.version-badge {
  display: inline-block;
  margin: 0.2rem 0 0.85rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid #bcd2f0;
  border-radius: 6px;
  background: #eef6ff;
  color: #17436f;
  font-size: 0.9rem;
  font-weight: 700;
}

.serie-select {
  min-width: 5.5rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.wallpaper-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.wallpaper-setting {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fbfcfe;
}

.wallpaper-setting .field input {
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
}

.wallpaper-preview {
  width: 86px;
  height: 62px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  filter: blur(0.4px);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.color-field input[type="color"] {
  min-width: 3rem;
  width: 3rem;
  height: 2.45rem;
  padding: 0.15rem;
}

.stats-grid,
.stats-layout {
  display: grid;
  gap: 1rem;
}

#panel-stats .stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#panel-stats .stats-header h2 {
  margin: 0;
}

.stats-switch {
  display: inline-flex;
  background: #e8ecf1;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 1rem;
}

.stat-card,
.stats-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
  text-align: center;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  font-size: 1.8rem;
  color: var(--primary);
}

.stats-layout {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

#panel-stats .stats-layout > .stats-panel {
  grid-column: span 2;
  min-width: 0;
  overflow-x: auto;
}

#panel-stats .stats-layout > .stats-wide {
  grid-column: span 3;
}

#panel-stats .stats-layout > .stats-wide:first-child {
  grid-column: 1 / -1;
}

#panel-stats .histogram {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
}

@media (max-width: 900px) {
  #panel-stats .stats-layout > .stats-panel {
    grid-column: span 3;
  }
}

@media (max-width: 600px) {
  #panel-stats .stats-layout > .stats-panel {
    grid-column: 1 / -1;
  }
  .stats-switch {
    max-width: 100%;
  }
  #panel-stats .stats-switch-btn {
    padding: 0.5rem 0.75rem;
  }
}

.csv-import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin-top: 1rem;
}

.csv-template-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  background: #f3f7ff;
  font-weight: 600;
  text-decoration: none;
}

.csv-template-link:hover {
  background: #e2edff;
}

.csv-file-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.csv-file-field label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.csv-file-field input {
  max-width: 100%;
  color: var(--muted);
  font: inherit;
}

.csv-file-field input::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.csv-file-field input::file-selector-button:hover {
  background: var(--primary-hover);
}

.csv-template-link:focus-visible,
.csv-file-field input:focus-visible,
.stats-switch-btn:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 3px;
}

.stat-bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(90px, 1.2fr) 3rem;
  gap: 0.75rem;
  align-items: center;
  margin: 0.65rem 0;
}

.stat-bar-row span,
.series-list span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-bar {
  height: 0.75rem;
  background: #cbd5e1;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.stat-bar i {
  display: block;
  height: 100%;
  background: #1d4ed8;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

.histogram rect {
  transition: opacity 0.2s ease;
}
.histogram rect:hover {
  opacity: 0.85;
}

.histogram text {
  fill: var(--text);
  font-size: 12px;
}

.pie-chart {
  max-width: 180px;
  display: block;
  margin: 0 auto;
}

.pie-chart circle {
  fill: none;
  stroke-width: 30;
  transform: rotate(-90deg);
  transform-origin: 80px 80px;
}

.pie-ko {
  stroke: #f1c4be;
}

.pie-ok {
  stroke: #35b779;
  stroke-linecap: round;
  path-length: 100;
}

.pie-chart text {
  fill: var(--text);
  font-weight: 700;
}

.series-list {
  display: grid;
  gap: 0.75rem;
}

.stats-table {
  margin-top: 0.5rem;
}

.coef-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.coef-math {
  background: linear-gradient(135deg, #f6faff, #eef4ff);
  border: 1px solid #cfdaf0;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.9rem;
}

.latex-formula {
  margin: 0;
  font-size: 0.98rem;
}

.coef-card {
  background: #f8fbff;
  border: 1px solid #dce7f7;
  border-radius: 10px;
  padding: 0.75rem;
  box-shadow: inset 0 1px 0 #fff;
}

.coef-card label {
  color: #123763;
}

.coef-card input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-weight: 700;
  text-align: center;
}

.locked-block {
  position: relative;
}

.locked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border-radius: var(--radius);
  text-align: center;
  padding: 1rem;
  font-weight: 600;
  color: var(--muted);
}

body.eleves-importes .locked-overlay {
  display: none;
}

#block-filtres .locked-overlay {
  display: none;
}

.cell-pending {
  color: #94a3b8;
  font-style: italic;
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 78vh;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#table-eleves {
  min-width: 1320px;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
}

/* Styles échelle colorimétrique */
.color-scale-legend {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  margin-top: 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.color-scale-legend span {
  flex: 1;
  text-align: center;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

/* Styles switch de série */
.stats-switch-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 1.75rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.stats-switch-btn:hover {
  color: var(--text);
}

.stats-switch-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
}

#table-eleves thead th {
  position: sticky;
  background: #eef3fa;
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 var(--border);
  box-sizing: border-box;
  vertical-align: middle;
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}

#table-eleves thead th.sortable[data-sort="numero"] { min-width: 65px; }
#table-eleves thead th.col-nominal[data-sort="nom"] { min-width: 120px; }
#table-eleves thead th:nth-child(3) { min-width: 120px; } /* Prénom */
#table-eleves thead th.col-nominal[data-sort="classe"] { min-width: 80px; }
#table-eleves thead th:nth-child(5) { min-width: 90px; } /* Série */
#table-eleves thead th.sortable[data-sort="moyenne"] { min-width: 90px; }
#table-eleves thead th:nth-child(9) { min-width: 100px; } /* DNB */
#table-eleves thead th:nth-child(10) { min-width: 95px; } /* Action */

#thead-matieres-row th {
  min-width: 95px;
  font-size: 0.78rem;
  font-weight: 500;
}

#table-eleves thead tr:first-child th {
  top: 0;
  height: 38px;
  z-index: 12;
}

#table-eleves thead tr:nth-child(2) th {
  top: 38px;
  height: 28px;
  z-index: 11;
}

#table-eleves tbody tr:nth-child(even) {
  background-color: #f8fafc;
}

#table-eleves tbody tr:hover {
  background-color: #f1f5f9;
}

.sub-header-matieres th {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Styles pour l'affichage horizontal des matières manquantes */
.bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.stat-card-mini {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.65rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  box-shadow: inset 0 1px 0 #fff;
}

.stat-card-mini-missing {
  background-color: #ffe8cc;
  border-color: #ffa94d;
}

.stat-card-mini-title {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--primary);
}

.stat-card-mini-value {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-card-mini-footer {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.2rem;
}


.note-cell {
  cursor: help;
  text-align: center;
  font-weight: 600;
  background: #f8fafc;
}

.note-cell:hover {
  background: #e0ecff;
}

.note-empty {
  text-align: center;
  color: #854d0e;
  background-color: #fef9c3 !important;
  font-weight: bold;
}

.moyenne {
  font-weight: 700;
  text-align: center;
}

.dnb-ok {
  color: var(--ok);
  font-weight: 600;
}

.dnb-ko {
  color: var(--ko);
  font-weight: 600;
}

.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal form {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-field label {
  margin: 0;
}

.checkbox-field input[type="checkbox"] {
  min-width: auto;
  width: 18px;
  height: 18px;
}

.btn-edit-eleve {
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
}

.hidden {
  display: none !important;
}

.card-settings {
  background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
  border-color: #c5d7f2;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  align-items: end;
}

.modal-eleve {
  max-width: 640px;
  width: 95vw;
}

.modal[open] {
  display: block;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

code {
  background: #eef1f5;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .header-status {
    margin-left: 0;
  }
}

/* En-têtes triables */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem !important;
}
th.sortable:hover {
  background-color: #cbd5e1 !important;
}
th.sortable::after {
  content: " ↕";
  opacity: 0.4;
  font-size: 0.8em;
  position: absolute;
  right: 0.4rem;
}
th.sortable.asc::after {
  content: " ↑";
  opacity: 1;
}
th.sortable.desc::after {
  content: " ↓";
  opacity: 1;
}

/* Barre de progression pour exports volumineux */
.progress-modal {
  text-align: center;
  padding: 1.5rem;
}
.progress-bar-container {
  width: 100%;
  height: 1.25rem;
  background: #cbd5e1;
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.1s ease;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.15);
}

/* Graphique par classe */
.classes-chart-container {
  margin-top: 1.25rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 520px;
  overflow-x: auto;
}

/* ═══════════════════════════════════════════════
   FORMULAIRE DE SAISIE MULTI-CHAMPS
   ═══════════════════════════════════════════════ */
.saisie-flex-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.5rem 0 0.25rem;
}
.saisie-candidat-block {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.saisie-candidat-block > label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.saisie-numero-wrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: border-color 0.2s;
}
.saisie-numero-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30,77,140,0.12);
}
.prefix-display {
  padding: 0.48rem 0.6rem;
  background: #edf2fb;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.88rem;
  border-right: 1.5px solid var(--border);
  white-space: nowrap;
  display: flex;
  align-items: center;
  letter-spacing: 0.02em;
}
.saisie-numero-wrap input {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-width: 70px;
  max-width: 130px;
  padding: 0.48rem 0.6rem;
  font-size: 0.95rem;
}
.form-note-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
}
.note-input-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 88px;
}
.note-input-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}
.note-bareme-badge {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  background: #e8f0fb;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  margin-left: 0.15rem;
}
.note-field {
  min-width: 80px;
  max-width: 110px;
  text-align: center;
  font-size: 0.98rem;
  padding: 0.45rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.note-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(30,77,140,0.12);
  outline: none;
}
.note-field:disabled {
  background: #f4f6f9;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.6;
}
.saisie-actions-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.saisie-absent-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.saisie-absent-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}
.saisie-absent-wrap label { cursor: pointer; margin: 0; }
.saisie-placeholder {
  font-style: italic;
  font-size: 0.9rem;
  margin: 0;
  padding: 0.25rem 0;
  align-self: center;
}

/* Options de paramètres */
.option-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: #f5f8ff;
  border: 1px solid #ccd9f0;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.option-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}
.option-row label {
  font-size: 0.92rem;
  cursor: pointer;
  margin: 0;
  line-height: 1.45;
}

/* ==========================================================================
   CARTE PROFIL & MINI DASHBOARD STATS CORRECTEUR
   ========================================================================== */
.correcteur-profile-card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.25rem;
}

.correcteur-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.correcteur-identity-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.correcteur-avatar-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  flex-shrink: 0;
}

.correcteur-details {
  display: flex;
  flex-direction: column;
}

.correcteur-name-title {
  margin: 0 !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em;
}

.correcteur-meta-sub {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 0.2rem;
}

.correcteur-badge-sso {
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

/* Grille du Mini Dashboard */
.mini-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.mini-stat-card {
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mini-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.mini-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.mini-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}
