/* ---- Base ---- */
html, body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { margin: 0; -webkit-font-smoothing: antialiased; }

/* Focus toujours visible (accessibilité clavier). */
:focus-visible { outline: 3px solid var(--mud-palette-primary); outline-offset: 2px; border-radius: 4px; }
.mud-input-control :focus-visible { outline: none; }

/* ---- Écran de démarrage ---- */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: #F7F7FB; color: #374151; }
.boot-logo { width: 56px; height: 56px; border-radius: 14px; background: #4F46E5; color: #fff; font-weight: 700; font-size: 28px; display: flex; align-items: center; justify-content: center; }
.boot-texte { font-size: 15px; }
.boot-barre { width: 160px; height: 4px; background: #E5E7EB; border-radius: 2px; overflow: hidden; }
.boot-barre span { display: block; width: 40%; height: 100%; background: #4F46E5; animation: boot 1.2s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-color-scheme: dark) { .boot { background: #0F1117; color: #E5E7EB; } .boot-barre { background: #262A36; } }

#blazor-error-ui { background: #FEF3C7; color: #78350F; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .75rem 1.25rem; position: fixed; width: 100%; z-index: 2000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; background: none; border: 0; font-size: 1rem; }

/* ---- Mise en page ---- */
.contenu { padding: 24px; max-width: 1400px; margin: 0 auto; }
.contenu-etroit { max-width: 880px; }
@media (max-width: 599px) { .contenu { padding: 16px 12px 96px; } }

.entete { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.entete h1 { margin: 0; }
.entete-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Bandeau de supervision (superadmin dans une organisation) */
.bandeau-supervision { background: repeating-linear-gradient(45deg, #B45309, #B45309 12px, #92400E 12px, #92400E 24px); color: #fff; padding: 6px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 14px; }

/* Barre de navigation mobile (en bas) */
.nav-bas { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1300; display: flex; justify-content: space-around; background: var(--mud-palette-surface); border-top: 1px solid var(--mud-palette-lines-default); padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); }
.nav-bas a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; font-weight: 500; color: var(--mud-palette-text-secondary); text-decoration: none; min-height: 48px; justify-content: center; }
.nav-bas a.active { color: var(--mud-palette-primary); }
.nav-bas a .mud-icon-root { font-size: 24px; }

/* Panneau latéral (détail à côté de la liste) */
.liste-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }
.liste-detail .panneau { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
@media (max-width: 1099px) { .liste-detail { grid-template-columns: 1fr; } .liste-detail .panneau { position: static; max-height: none; } }

.ligne-cliquable { cursor: pointer; }
.ligne-selectionnee td { background: var(--mud-palette-action-default-hover) !important; }

/* ---- Planning hebdomadaire ---- */
.planning { display: grid; grid-template-columns: 56px repeat(var(--jours), minmax(140px, 1fr)); border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; overflow: auto; background: var(--mud-palette-surface); }
.planning-entete { position: sticky; top: 0; background: var(--mud-palette-background-gray); font-weight: 600; font-size: 13px; padding: 8px; text-align: center; border-bottom: 1px solid var(--mud-palette-lines-default); z-index: 2; }
.planning-heures { position: relative; border-right: 1px solid var(--mud-palette-lines-default); }
.planning-heure { position: absolute; right: 6px; font-size: 11px; color: var(--mud-palette-text-secondary); transform: translateY(-50%); }
.planning-jour { position: relative; border-right: 1px solid var(--mud-palette-lines-default); }
.planning-ligne { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--mud-palette-lines-default); }
.planning-bloc { position: absolute; border-radius: 6px; padding: 4px 6px; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; border-left: 4px solid var(--mud-palette-primary); background: var(--mud-palette-primary-lighten); color: var(--mud-palette-text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.planning-bloc:hover { z-index: 5; box-shadow: 0 4px 12px rgba(0,0,0,.18); overflow: visible; }
.planning-bloc.conflit { border-left-color: var(--mud-palette-error); background: color-mix(in srgb, var(--mud-palette-error) 14%, var(--mud-palette-surface)); outline: 2px solid var(--mud-palette-error); }
.planning-bloc.surpeuple { border-left-color: var(--mud-palette-error); }
.planning-bloc .titre { font-weight: 600; }

/* ---- Agenda semaine ---- */
.agenda-semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.agenda-jour { background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; min-height: 140px; padding: 8px; }
.agenda-jour.aujourdhui { border-color: var(--mud-palette-primary); box-shadow: 0 0 0 1px var(--mud-palette-primary); }
.agenda-jour-titre { font-size: 12px; font-weight: 600; color: var(--mud-palette-text-secondary); text-transform: capitalize; margin-bottom: 6px; }
.seance { border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; background: color-mix(in srgb, var(--mud-palette-primary) 10%, var(--mud-palette-surface)); border-left: 3px solid var(--mud-palette-primary); font-size: 13px; }
.seance.annulee { background: var(--mud-palette-background-gray); border-left-color: var(--mud-palette-text-disabled); color: var(--mud-palette-text-secondary); }
.seance.annulee .seance-titre, .seance.annulee .seance-heure { text-decoration: line-through; }
.seance.reportee { border-left-color: var(--mud-palette-warning); background: color-mix(in srgb, var(--mud-palette-warning) 12%, var(--mud-palette-surface)); }
.seance-titre { font-weight: 600; }
.seance-heure { color: var(--mud-palette-text-secondary); font-size: 12px; }

/* ---- Grille de notes (type tableur) ---- */
.grille-notes { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 14px; }
.grille-notes th, .grille-notes td { border-bottom: 1px solid var(--mud-palette-lines-default); border-right: 1px solid var(--mud-palette-lines-default); padding: 0; }
.grille-notes th { background: var(--mud-palette-background-gray); font-weight: 600; padding: 6px 8px; text-align: center; position: sticky; top: 0; z-index: 2; vertical-align: bottom; }
.grille-notes th.eleve, .grille-notes td.eleve { position: sticky; left: 0; background: var(--mud-palette-surface); z-index: 3; text-align: left; padding: 6px 12px; min-width: 180px; }
.grille-notes th.eleve { z-index: 4; background: var(--mud-palette-background-gray); }
.grille-notes td.moyenne { background: color-mix(in srgb, var(--mud-palette-primary) 8%, var(--mud-palette-surface)); font-weight: 600; text-align: center; padding: 6px 10px; min-width: 72px; }
.grille-notes input.note { width: 72px; height: 36px; border: 0; background: transparent; text-align: center; font: inherit; color: inherit; }
.grille-notes input.note:focus { outline: 2px solid var(--mud-palette-primary); outline-offset: -2px; background: color-mix(in srgb, var(--mud-palette-primary) 6%, var(--mud-palette-surface)); }
.grille-notes input.note.erreur { outline: 2px solid var(--mud-palette-error); outline-offset: -2px; }
.grille-notes input.note.enregistre { animation: flash 900ms ease-out; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--mud-palette-success) 30%, transparent); } 100% { background: transparent; } }
.grille-notes .eval-titre { font-size: 12px; line-height: 1.2; max-width: 110px; white-space: normal; }
.grille-notes .eval-meta { font-size: 11px; font-weight: 400; color: var(--mud-palette-text-secondary); }
.grille-conteneur { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; }

/* ---- Appel ---- */
.appel-eleve { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--mud-palette-lines-default); min-height: 64px; cursor: pointer; user-select: none; }
.appel-eleve.absent { background: color-mix(in srgb, var(--mud-palette-error) 10%, var(--mud-palette-surface)); }
.appel-eleve .nom { font-size: 16px; font-weight: 500; }

/* ---- Chiffres clés ---- */
.chiffre { font-size: 28px; font-weight: 700; line-height: 1.1; }
.chiffre-libelle { font-size: 13px; color: var(--mud-palette-text-secondary); }
.chiffre-cle { border-left: 4px solid var(--mud-palette-primary); }
.chiffre-cle.alerte { border-left-color: var(--mud-palette-warning); }
.chiffre-cle.succes { border-left-color: var(--mud-palette-success); }

/* ---- Semaines du calendrier ---- */
.semaines { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.semaine { border: 1px solid var(--mud-palette-lines-default); border-radius: 6px; padding: 6px 8px; font-size: 12px; cursor: pointer; background: var(--mud-palette-surface); text-align: left; color: inherit; font: inherit; }
.semaine.off { background: var(--mud-palette-background-gray); color: var(--mud-palette-text-secondary); text-decoration: line-through; border-style: dashed; }
.semaine .num { font-weight: 600; font-size: 11px; color: var(--mud-palette-text-secondary); }

.texte-secondaire { color: var(--mud-palette-text-secondary); }
.pre-ligne { white-space: pre-line; }
.w-100 { width: 100%; }
.gap-2 { gap: 8px; }
.nowrap { white-space: nowrap; }

@media print {
    .mud-appbar, .mud-drawer, .nav-bas, .no-print { display: none !important; }
    .mud-main-content { padding: 0 !important; }
}

/* Texte réservé aux lecteurs d'écran */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
