/* Gestevaluation - theme applique par-dessus Bootstrap 5.
   Couleur d'accent et degrade du logo : injectes par /brand.js (generes depuis BRAND_NAME). */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --border: #e2e5ef;
  --text: #171a2c;
  --muted: #62687f;
  --accent: #6d33d6;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --brand-from: #3b0764;
  --brand-to: #7c3aed;
  --brand-gold: #f5b83d;
  --ok: #12804a;
  --ok-soft: #e3f6ec;
  --warn: #9a5b00;
  --warn-soft: #fff4de;
  --danger: #c4283a;
  --danger-soft: #fde8ea;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23, 26, 44, .05), 0 6px 20px rgba(23, 26, 44, .06);
  --shadow-lg: 0 20px 50px rgba(23, 26, 44, .16);
  --mono: ui-monospace, 'Cascadia Code', Consolas, monospace;
  --font: 'Inter Variable', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --bs-body-font-family: var(--font);
  --bs-border-radius: var(--radius-sm);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1018;
  --surface: #161924;
  --surface-2: #1e2230;
  --border: #2a2f40;
  --text: #e8eaf3;
  --muted: #979db4;
  --accent: #b69cff;
  --accent-ink: #120a24;
  --ok: #4fd08f;
  --ok-soft: #13301f;
  --warn: #f2b35a;
  --warn-soft: #36270f;
  --danger: #ff7a88;
  --danger-soft: #3a171d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* Pied de page colle en bas meme quand la page est courte */
  display: flex;
  flex-direction: column;
}
body > * { flex-shrink: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h2 .bi, h3 .bi { color: var(--accent); margin-right: 4px; }
.muted { color: var(--muted) !important; }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
::selection { background: var(--accent-soft); }

/* ------------------------------------------------------------ Mise en page */
.container { width: 100%; max-width: 1680px; margin: 0 auto; padding: 28px 18px 64px; }
.narrow { width: 100%; max-width: 480px; margin: 0 auto; padding: 40px 16px; }
.hrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hrow.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.page-title { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }

/* ------------------------------------------------------------ Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar::before {
  content: ''; display: block; height: 3px;
  background: linear-gradient(90deg, var(--brand-from), var(--brand-to) 60%, var(--brand-gold));
}
.topbar .inner { max-width: 1680px; margin: 0 auto; padding: 10px 18px; display: flex; gap: 10px; align-items: center; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); min-width: 0; }
.brand:hover { color: var(--text); }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; flex: none; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand-to) 30%, transparent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-app { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.crumb { color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumb .bi { font-size: .8rem; opacity: .6; }
.user-chip {
  align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent); cursor: default;
}
.user-chip.admin { background: var(--danger-soft); color: var(--danger); }
@media (max-width: 600px) {
  .brand-text { display: none; }
  .topbar .inner { padding: 8px 12px; gap: 6px; }
}

/* ------------------------------------------------------------ Cartes */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; color: var(--text);
  display: block;
}
.card.flat { box-shadow: none; }
.card > h2:first-child { margin-bottom: 4px; }
.stat { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 16px 18px; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.3rem;
}
.stat .v { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: .82rem; font-weight: 500; }

/* ------------------------------------------------------------ Formulaires */
label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background-color: var(--surface); color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 13px 10px;
}
textarea { min-height: 90px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13.5px; line-height: 1.55; min-height: 220px; tab-size: 4; white-space: pre; background: var(--surface-2); }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; margin: 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=radio], input[type=checkbox] { accent-color: var(--accent); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > input { padding-left: 40px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--text); }

/* ------------------------------------------------------------ Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; line-height: 1.3;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s, filter .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.btn:active { transform: translateY(1px); }
/* Les clics sur une icone doivent cibler le bouton (e.target) */
.btn .bi, .btn > span { pointer-events: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--brand-from)));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 32%, transparent);
}
:root[data-theme="dark"] .btn.primary { color: var(--accent-ink); background: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
:root[data-theme="dark"] .btn.primary:hover { color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 11px; font-size: .83rem; border-radius: 8px; }
.btn.lg { padding: 13px 20px; font-size: 1rem; }
.btn.block { width: 100%; padding: 12px; }
.btn.icon-sm { width: 32px; height: 32px; padding: 0; }
.icon-btn { width: 38px; height: 38px; padding: 0; font-size: 1.05rem; }

/* ------------------------------------------------------------ Messages */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 0; border: 1px solid transparent; }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.info { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px;
  font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--muted); line-height: 1.5;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------ Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; color: var(--text); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
tbody tr { transition: background-color .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
.card > .table-wrap:last-child { border-radius: 0 0 var(--radius) var(--radius); }

/* ------------------------------------------------------------ Onglets */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow: visible; }
.tabs a.tab-link { padding: 10px 14px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.tab-link:hover { color: var(--accent); }
.tabs .tab-sep { align-self: center; width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.tabs button {
  background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------ Modale */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10, 8, 24, .55); backdrop-filter: blur(3px); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 34px 12px; overflow-y: auto;
}
.modal-box { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 900px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal-box header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.modal-box .body { padding: 22px; }

/* ------------------------------------------------------------ Pages de connexion */
.auth-shell {
  flex: 1 0 auto; min-height: calc(100vh - 74px); display: grid; grid-template-columns: minmax(360px, 42%) 1fr;
  background: var(--bg);
}
.auth-shell.single { grid-template-columns: minmax(0, 1fr); }
/* Page etudiant : bandeau de marque plus etroit, formulaire plus large (moins de defilement) */
.auth-shell.wide { grid-template-columns: minmax(280px, 30%) 1fr; }
.auth-shell.wide .auth-side { padding: 40px 36px; gap: 26px; }
.auth-shell.wide .brand-hero-logo { width: 76px; height: 76px; border-radius: 20px; }
.auth-shell.wide .brand-hero-name { font-size: 1.8rem; }
.auth-shell.wide .auth-points { gap: 10px; font-size: .92rem; }
.auth-shell.wide .auth-main { padding: 24px 28px; }
.auth-shell.wide .auth-card { max-width: 860px; padding: 26px 32px; }
.auth-shell.wide .auth-head { margin-bottom: 14px; }
.auth-shell.wide .stack > * + * { margin-top: 12px; }
.auth-shell.wide .rules ul { columns: 2; column-gap: 28px; }
.auth-shell.wide .rules li { break-inside: avoid; margin-bottom: 3px; }
.grid-3-form { display: grid; grid-template-columns: 1.3fr 1fr 1.1fr; gap: 14px; }
@media (max-width: 1100px) { .grid-3-form { grid-template-columns: 1fr 1fr; } .auth-shell.wide .rules ul { columns: 1; } }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 56px 52px;
  display: flex; flex-direction: column; justify-content: center; gap: 36px;
  background:
    radial-gradient(circle at 85% 12%, rgba(255, 255, 255, .14), transparent 38%),
    radial-gradient(circle at 10% 95%, color-mix(in srgb, var(--brand-gold) 30%, transparent), transparent 40%),
    linear-gradient(150deg, var(--brand-from), var(--brand-to));
}
.auth-side::after {
  content: ''; position: absolute; inset: auto -80px -80px auto; width: 260px; height: 260px; border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, .06);
}
.auth-side .brand-hero { text-align: left; }
.auth-side .brand-hero-logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, .3); }
.auth-side .brand-hero-name { color: #fff; font-size: 2.2rem; }
.auth-side .brand-hero-app { color: rgba(255, 255, 255, .78); }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-weight: 500; }
.auth-points li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .92); }
.auth-points .bi {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .14); color: var(--brand-gold); font-size: 1.1rem;
}
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card {
  width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px;
}
.auth-head { margin-bottom: 20px; }
.auth-head h1 { font-size: 1.6rem; font-weight: 800; margin: 6px 0 4px; }
.auth-head p { margin: 0; }
.auth-kicker {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 99px;
}
.auth-foot { margin-top: 18px; text-align: center; }
.back-fab { position: fixed; top: 14px; left: 14px; z-index: 40; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.back-btn { flex: none; }
.theme-fab { position: fixed; top: 14px; right: 14px; z-index: 40; background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.rules { border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); padding: 11px 15px; font-size: .88rem; }
.rules summary { color: var(--warn); }
.rules ul { margin: 8px 0 0; padding-left: 18px; }
@media (max-width: 900px) {
  .auth-shell, .auth-shell.wide { grid-template-columns: minmax(0, 1fr); }
  .grid-3-form { grid-template-columns: 1fr; }
  .auth-side { padding: 34px 22px 30px; gap: 20px; }
  .auth-side .brand-hero { text-align: center; }
  .auth-side .brand-hero-logo { width: 72px; height: 72px; border-radius: 18px; }
  .auth-side .brand-hero-name { font-size: 1.6rem; }
  .auth-points { display: none; }
  .auth-main { padding: 0 14px 30px; margin-top: -18px; }
  .auth-card { padding: 24px 20px; }
  .brand-hero-app { letter-spacing: .05em; font-size: .74rem; }
}

/* Bloc logo + nom (genere par common.js) */
.brand-hero { text-align: center; }
.brand-hero-logo { width: 72px; height: 72px; border-radius: 18px; display: inline-block; box-shadow: 0 10px 28px color-mix(in srgb, var(--brand-to) 35%, transparent); }
.brand-hero-name { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-top: 14px; color: var(--text); }
.brand-hero-app { font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-top: 2px; }
.brand-hero.compact { margin-bottom: 22px; }
.brand-hero.compact .brand-hero-logo { width: 56px; height: 56px; border-radius: 15px; }
.brand-hero.compact .brand-hero-name { font-size: 1.15rem; margin-top: 10px; }

/* ------------------------------------------------------------ Evaluation etudiant */
.exam-bar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.exam-bar .inner { max-width: 920px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 14px; align-items: center; }
.exam-logo { width: 36px; height: 36px; border-radius: 10px; }
.timer { font-family: var(--mono); font-size: 1.25rem; font-weight: 800; padding: 5px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.timer.low { background: var(--danger-soft); color: var(--danger); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .6; } }
.exam-bar .inner > .grow { min-width: 0; }
@media (max-width: 600px) {
  .exam-bar .inner { flex-wrap: wrap; gap: 8px; }
  .exam-bar .inner > .grow { flex-basis: calc(100% - 50px); }
  .timer { font-size: 1.05rem; }
  .exam-bar #submitBtn { margin-left: auto; }
  .topbar .inner { flex-wrap: wrap; }
  .card { padding: 16px; }
}
.exam-progress { height: 4px; background: var(--surface-2); }
.exam-progress > div { height: 100%; background: linear-gradient(90deg, var(--brand-to), var(--brand-gold)); transition: width .3s; }
.exam { width: 100%; max-width: 920px; margin: 0 auto; padding: 24px 16px 80px; }
.question .num { font-size: .78rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.question .prompt { white-space: pre-wrap; font-size: 1.04rem; margin: 6px 0 16px; }
.option {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
  font-weight: 500; transition: border-color .12s, background-color .12s;
}
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.option input { margin-top: 4px; }
.nav-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-dots button {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 700; cursor: pointer;
}
.nav-dots button.done { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.nav-dots button.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.save-state { font-size: .8rem; color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.offline { color: var(--warn); font-weight: 600; }
.no-select { user-select: none; -webkit-user-select: none; }
.no-select textarea, .no-select input { user-select: text; -webkit-user-select: text; }

.overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px 16px; overflow-y: auto;
  background: radial-gradient(circle at 20% 0%, var(--accent-soft), transparent 45%), var(--bg);
}
.overlay-inner { width: 100%; max-width: 560px; margin: auto; }
.overlay-inner .card { padding: 28px; box-shadow: var(--shadow-lg); border-radius: 20px; }
.done-icon {
  width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); font-size: 2.1rem;
}
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 30px; text-align: center; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------ IA */
.ai-option {
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: var(--radius-sm);
  background: var(--accent-soft); padding: 12px 14px;
}
.ai-option .bi { color: var(--accent); }
.btn.ai-btn {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--brand-gold) 14%, var(--surface)));
}
.btn.ai-btn:hover { border-color: var(--accent); color: var(--accent); }
.grid-title { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-title { grid-template-columns: 1fr; } }

/* Support de cours (apercu dans l'editeur et page imprimable) */
.course-preview {
  max-height: 460px; overflow-y: auto; padding: 22px 26px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface);
}
.markdown-body { line-height: 1.7; font-size: .97rem; }
.markdown-body h1 { font-size: 1.7rem; font-weight: 800; margin: 0 0 .6em; padding-bottom: .3em; border-bottom: 3px solid var(--accent); }
.markdown-body h2 { font-size: 1.3rem; margin: 1.6em 0 .6em; color: var(--accent); }
.markdown-body h3 { font-size: 1.08rem; margin: 1.3em 0 .5em; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body table, .markdown-body pre, .markdown-body blockquote { margin: 0 0 1em; }
.markdown-body li + li { margin-top: .25em; }
.markdown-body code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
.markdown-body pre { background: #1b1d2a; color: #e8eaf3; padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.markdown-body pre code { background: none; padding: 0; color: inherit; font-size: .86rem; }
.markdown-body blockquote {
  border-left: 4px solid var(--brand-gold); background: color-mix(in srgb, var(--brand-gold) 12%, var(--surface));
  padding: 10px 16px; border-radius: 0 10px 10px 0; color: var(--text);
}
.markdown-body blockquote > :last-child { margin-bottom: 0; }
.markdown-body table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.markdown-body th { text-transform: none; letter-spacing: 0; font-size: .85rem; background: var(--surface-2); color: var(--text); }
.markdown-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }

.ai-context { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.text-primary { color: var(--accent) !important; }

/* ------------------------------------------------------------ Editeur */
.q-card { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 18px; background: var(--surface); }
.q-card + .q-card { margin-top: 14px; }
.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.opt-row input[type=text] { flex: 1; }

.timeline { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
pre.answer { background: var(--surface-2); color: var(--text); padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; font-family: var(--mono); font-size: 13px; margin: 6px 0; max-height: 360px; overflow: auto; border: 1px solid var(--border); }
.app-toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 11px 20px; border-radius: 99px;
  background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ------------------------------------------------------------ Pied de page */
.app-footer { margin-top: auto; border-top: 1px solid var(--border); background: var(--surface); position: relative; }
.app-footer::before {
  content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand-from), var(--brand-to) 60%, var(--brand-gold)); opacity: .7;
}
.app-footer .inner {
  max-width: 1680px; margin: 0 auto; padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 10px 24px;
  align-items: center; justify-content: space-between; font-size: .85rem; color: var(--muted);
}
.app-footer-brand { display: flex; align-items: center; gap: 10px; }
.app-footer-brand strong { display: block; color: var(--text); line-height: 1.2; }
.app-footer-brand span { font-size: .78rem; }
.app-footer-logo { width: 32px; height: 32px; border-radius: 9px; }
.app-footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.app-footer-links a { color: var(--muted); text-decoration: none; font-weight: 500; }
.app-footer-links a:hover { color: var(--accent); }
.app-footer-copy { font-size: .8rem; }
@media (max-width: 700px) { .app-footer .inner { flex-direction: column; text-align: center; } }
@media print { .no-print { display: none !important; } }

/* ------------------------------------------------------------ IA : etat, erreurs, progression */
.ai-status { display: flex; align-items: center; gap: 8px; font-size: .88rem; padding: 9px 13px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); }
.ai-status.ok { background: var(--ok-soft); color: var(--ok); }
.ai-status.alert { display: block; }
.ai-error { display: grid; gap: 6px; }
.ai-error-title { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ai-error-help { color: var(--text); background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 8px; padding: 8px 10px; }
.ai-error-help .bi { color: var(--warn); }
.ai-error-actions { margin-top: 4px; }
.ai-progress { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); display: grid; gap: 8px; }
.ai-progress-bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.ai-progress-bar > div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand-to), var(--brand-gold)); transition: width .6s ease; }
.disabled-block { opacity: .6; pointer-events: none; }

/* ---------- Organisation : etablissement -> classe -> module ---------- */
.hrow.nowrap { flex-wrap: nowrap; }
.hrow.nowrap > select { flex: 1; min-width: 0; }
.structure-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .structure-picker { grid-template-columns: 1fr; } }
.tree { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.tree-est { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tree-est > .tree-head { background: var(--surface-2, rgba(127,127,127,.06)); }
.tree-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
.tree-head .grow { min-width: 140px; }
.tree-cls { border-top: 1px solid var(--border); }
.tree-cls > .tree-head { padding-left: 30px; }
.tree-mods { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px 52px; }
.tree-mod { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 12px; font-size: .9rem; background: var(--surface); }
.tree-mod.active { border-color: var(--accent); background: var(--accent-soft); }
.tree-mod button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.tree-mod .btn.icon-sm { width: 26px; height: 26px; }
.tree-actions { display: inline-flex; gap: 4px; }
.tree-empty { padding: 22px; text-align: center; }
.crumbs { font-size: .82rem; color: var(--muted); }
.crumbs .bi { font-size: .7rem; }

/* Accordeon des etablissements : un seul deplie a la fois */
.tree-est > .tree-body { display: none; }
.tree-est.open > .tree-body { display: block; }
.tree-est:not(.open) > .tree-head { background: var(--surface); }
.tree-toggle { display: inline-flex; align-items: center; gap: 8px; }
.tree-toggle:hover { color: var(--accent) !important; }
.tree-chevron { transition: transform .2s ease; font-size: .85rem; }
.tree-est.open > .tree-head .tree-chevron { transform: rotate(90deg); }

/* Liste des evaluations groupee : etablissement -> classe -> module */
tr.group-row td { border-bottom: 1px solid var(--border); }
tr.group-est td { background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 1rem; padding-top: 12px; padding-bottom: 12px; }
tr.group-cls td { background: var(--surface-2); font-weight: 700; padding-left: 30px; }
tr.group-mod td { font-weight: 600; padding-left: 52px; padding-top: 8px; padding-bottom: 8px; }
tr.group-none td { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
tr.in-group > td:first-child { padding-left: 52px; }

/* Liste des evaluations deroulante par etablissement */
.group-toggle { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-align: left; }
.group-toggle:hover { text-decoration: underline; }
tr.group-row.open .tree-chevron { transform: rotate(90deg); }

/* Classes depliables dans « Mes classes » */
.tree-cls[data-cls] > .tree-mods { display: none; }
.tree-cls[data-cls].open > .tree-mods { display: flex; }
.tree-cls.open > .tree-head .tree-chevron { transform: rotate(90deg); }

/* Journal d'activite : lignes selectionnees */
#activityRows tr.selected td { background: var(--accent-soft); }
#activityRows input[type="checkbox"], #aSelectAll { width: 16px; height: 16px; cursor: pointer; }
#activityRows input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .35; }

/* Liste deroulante generique (onglet Enseignants de l'administration) */
.acc-card { padding: 12px; }
.acc-list { display: flex; flex-direction: column; gap: 10px; }
.acc-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.acc-item.open { border-color: var(--accent); box-shadow: var(--shadow, none); }
.acc-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.acc-item.open > .acc-head { background: var(--accent-soft); }
.acc-toggle { flex: 1; min-width: 180px; display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.acc-toggle:hover strong { color: var(--accent); }
.acc-item.open > .acc-head .tree-chevron { transform: rotate(90deg); }
.acc-body { display: none; padding: 14px 16px 16px; border-top: 1px solid var(--border); }
.acc-item.open > .acc-body { display: block; }
.acc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
@media (max-width: 760px) { .acc-grid { grid-template-columns: 1fr 1fr; } }

/* Abonnements : bloc dans la fiche d'un enseignant, page « Mon abonnement » */
.sub-box { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.sub-banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.sub-banner .grow { flex: 1; min-width: 200px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.plan-card { display: block; position: relative; padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); margin: 0; font-weight: 400; }
.plan-card:hover { border-color: var(--accent); }
.plan-card input { position: absolute; opacity: 0; pointer-events: none; }
.plan-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card .plan-name { font-weight: 700; }
.plan-card .plan-price { font-size: 1.35rem; font-weight: 800; color: var(--accent); margin-top: 4px; }
.pay-number { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; letter-spacing: .03em; }
input.pay-number[readonly] { background: var(--surface-2); cursor: default; color: var(--text); }
.pay-summary { padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-sm); background: var(--accent-soft); }
.pay-amount { font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1.2; }

/* Supervision : etablissement > classe > module de l'evaluation */
.place-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; color: var(--accent); font-weight: 600; font-size: .95rem; }
.place-path .bi { margin-right: 2px; }
.place-path .sep { color: var(--muted); font-size: .75rem; }

/* Notes finales d'un module : boutons « Justifier » / « annuler » d'une absence */
button.excuse-btn { background: none; border: 0; padding: 0 0 0 4px; font: inherit; font-size: .8rem; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
button.excuse-btn.undo { color: var(--muted); }
button.excuse-btn:disabled { opacity: .5; cursor: wait; }

.class-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; background: var(--surface); }
.class-chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
button.chip-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }

/* Apercu de la webcam pendant l'evaluation (rien n'est enregistre) */
.cam-preview { position: fixed; right: 14px; bottom: 14px; width: 132px; height: 99px; object-fit: cover; border-radius: 12px; border: 2px solid var(--accent); box-shadow: var(--shadow-lg); z-index: 40; background: #000; transform: scaleX(-1); }
@media (max-width: 600px) { .cam-preview { width: 96px; height: 72px; } }

/* Supervision : boutons d'une ligne (passent a la ligne plutot que de faire deborder le tableau) */
td.row-actions { text-align: right; }
td.row-actions .btn { margin: 2px 0 2px 4px; white-space: nowrap; }

/* Hub : module retrouve au retour de la supervision */
tr.flash > td { animation: rowflash 2.5s ease-out; }
@keyframes rowflash { 0%, 40% { background: color-mix(in srgb, var(--accent, #7c3aed) 22%, transparent); } 100% { background: transparent; } }

/* Supervision : ecrans des etudiants (TP reseaux avec partage d'ecran) */
.screen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--screen-tile, 200px), 1fr)); gap: 10px; max-height: 72vh; overflow-y: auto; padding: 2px 4px 2px 2px; align-content: start; }
.screen-grid[data-size="small"] { --screen-tile: 170px; }
.screen-grid[data-size="medium"] { --screen-tile: 250px; }
.screen-grid[data-size="large"] { --screen-tile: 360px; }
.screen-grid[data-size="small"] .screen-tile .cap { padding: 5px 7px; font-size: .82rem; }
.screen-grid[data-size="small"] .screen-tile .cap .badge { font-size: .68rem; padding: 2px 6px; }
/* Webcam + camera de la table cote a cote dans une meme vignette */
.cam-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--border); }
.cam-pair > .screen-frame, .cam-pair-big > div { position: relative; }
.cam-tag { position: absolute; left: 6px; top: 6px; z-index: 1; font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; pointer-events: none; }
.screen-grid.with-desk[data-size="small"] { --screen-tile: 420px; }
.screen-grid.with-desk[data-size="medium"] { --screen-tile: 560px; }
.screen-grid.with-desk[data-size="large"] { --screen-tile: 760px; }
.screen-grid.with-desk[data-size="xlarge"] { --screen-tile: 1100px; }
.cam-pair-big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { .cam-pair-big { grid-template-columns: 1fr; } }
.screen-tile.assisting { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 35%, transparent); }
.assist-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.screen-tile { display: block; width: 100%; padding: 0; text-align: left; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: inherit; cursor: zoom-in; transition: box-shadow .15s, border-color .15s; }
.screen-tile:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.screen-tile .cap { padding: 8px 10px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; }
/* Nom lisible meme avec un badge long (« partage interrompu · 21 min ») : le badge passe a la ligne */
.screen-tile .cap > div:first-child { flex: 1 1 110px; overflow-wrap: anywhere; }
.screen-tile .cap > .badge { flex: none; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.screen-frame { position: relative; aspect-ratio: 16 / 9; background: #0b0b12; color: #9aa3b5; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0; }
.screen-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.screen-frame.big { border-radius: 8px; overflow: hidden; }
.screen-box { max-width: min(1500px, 96vw); }

/* TP reseaux : schema d'architecture (image SVG autonome, fond blanc) */
.topo-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; padding: 6px; overflow: auto; }
.topo-wrap svg { display: block; width: 100%; height: auto; min-width: 640px; }
.topo-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

/* Editeur : TP reseaux en etapes */
.lab-editor .lab-step { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.lab-editor .lab-step h3 { font-size: 1.02rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .8rem; font-weight: 700; flex: none; }
.lab-q { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.lab-q .lab-q-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-q .lab-q-head select, .lab-q .lab-q-head input { width: auto; }

/* TP reseaux dans la plateforme : terminaux du lab Docker */
.term-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.term-area { position: relative; height: 460px; background: #0b1020; border-radius: var(--radius-sm); padding: 6px; }
.term-pane { position: absolute; inset: 6px; }
.term-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.term-tile { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.term-tile.big { grid-column: 1 / -1; }
.term-tile .cap { padding: 8px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.term-tile .term-view { position: relative; height: 230px; background: #0b1020; }
.term-tile.big .term-view { height: 520px; }
.term-tile .term-view > div { position: absolute; inset: 4px; }
.term-tile .term-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: .85rem; text-align: center; padding: 10px; }

/* ---------------------------------------------------------------- Suivi de projet (editeur, espace etudiant, supervision) */
.step-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.grid-step { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 8px; }
@media (max-width: 700px) { .grid-step { grid-template-columns: 1fr; } }
.pj-bar { flex: 1; height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; min-width: 60px; }
.pj-bar > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.pj-bar.ok > div { background: var(--ok); }
.pj-bar.danger > div { background: var(--danger); }
.pj-bar.sm { height: 6px; }
.pj-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 960px) { .pj-layout { grid-template-columns: 1fr; } }
.pj-dates { display: flex; gap: 18px; flex-wrap: wrap; }
.pj-dates > div { display: flex; flex-direction: column; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 150px; }
.pj-step.is-blocked { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger) inset; }
.pj-step.is-done .step-num { background: var(--ok); }
.pj-blocked { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 8px 10px; margin: 6px 0; }
.pj-blocked .muted { color: var(--muted); }
.pj-history { margin: 8px 0; }
.pj-history summary { cursor: pointer; color: var(--muted); }
.pj-timeline { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pj-timeline li { border-left: 3px solid var(--border); padding: 6px 10px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); }
.pj-timeline li.pj-upd { border-left-color: var(--accent); }
.pj-timeline li.pj-msg.teacher { border-left-color: var(--ok); background: var(--ok-soft); }
.pj-timeline li.pj-msg.student { border-left-color: var(--warn); }
.pj-file { display: inline-flex; gap: 4px; align-items: center; font-size: .85rem; padding: 2px 8px; border: 1px solid var(--border); border-radius: 99px; text-decoration: none; background: var(--surface); }
.pj-form, .pj-ask { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 8px; }
.pj-ask { display: flex; gap: 8px; align-items: flex-end; }
.pj-ask.hidden { display: none; }
.pj-finish { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; border: 1px dashed var(--accent); }
.pj-report { border: 1px solid var(--ok); }
.pj-grade { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ok-soft); }
/* Supervision : tableau de suivi */
.pj-track td { vertical-align: middle; }
.pj-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.pj-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 26px; padding: 0 6px; border-radius: 6px; font-size: .74rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.pj-chip.in_progress { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pj-chip.submitted { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.pj-chip.validated { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pj-chip.to_redo { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pj-chip.blocked { background: var(--danger); color: #fff; border-color: var(--danger); }
.pj-alerts .pj-alert { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.pj-alerts .pj-alert:first-of-type { border-top: 0; }
.pj-modal-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .pj-modal-grid { grid-template-columns: 1fr; } }

/* Supervision : webcams des etudiants (format 4:3, image entiere : rien n'est coupe, la table reste visible) */
.cam-frame { aspect-ratio: 4 / 3; }
.cam-frame img { object-fit: contain; }
.cam-grid[data-size="small"] { --screen-tile: 240px; }
.cam-grid[data-size="medium"] { --screen-tile: 340px; }
.cam-grid[data-size="large"] { --screen-tile: 480px; }
.cam-grid[data-size="xlarge"] { --screen-tile: 680px; }
/* Video en direct (WebRTC) : remplace l'image de secours tant qu'elle arrive */
.screen-frame > video.live-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: none; }
.screen-frame.is-live > video.live-video { display: block; }
.screen-frame.is-live > img, .screen-frame.is-live > span.small { visibility: hidden; }
.screen-frame.is-live::after { content: '● En direct'; position: absolute; right: 6px; top: 6px; z-index: 1; font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(220, 38, 38, .85); color: #fff; pointer-events: none; }
.screen-frame > .cam-tag { z-index: 2; }
/* Fenetre agrandie : image la plus grande possible dans l'ecran */
.cam-frame.big { max-height: 76vh; margin: 0 auto; }
/* Vignette : image en haut, nom puis etat en dessous (le nom n'est plus ecrase par le badge) */
.cam-grid .screen-tile { display: flex; flex-direction: column; align-self: start; }
.cam-grid .screen-tile .cap { flex-direction: column; align-items: flex-start; gap: 4px; }
.cam-grid .screen-tile .cap > div { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cam-grid .screen-tile .cap .badge { white-space: normal; }

/* Toutes les pages ont la meme largeur (1680 px max., centree) ; les pages « larges » ont juste des marges adaptees a l'ecran */
.page-wide .container,
.page-wide .topbar .inner,
.page-wide .app-footer .inner { max-width: 1680px; padding-left: clamp(14px, 2vw, 36px); padding-right: clamp(14px, 2vw, 36px); }
.page-wide .container { padding-top: 18px; }
/* Mur des webcams : hauteur de l'ecran moins l'en-tete et la barre d'outils */

.page-wide .cam-grid { max-height: max(360px, calc(100vh - 210px)); }

/* Liste des supports de cours (editeur) */
.course-list { display: flex; flex-direction: column; gap: 8px; }
.course-list:empty { display: none; }
.course-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.course-item .course-icon { font-size: 1.3rem; color: var(--accent); flex: none; }
.course-item .course-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-item.editing { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.markdown-body .support-title { margin-top: 1.4em; }
.markdown-body .support-title:first-child { margin-top: 0; }

/* Agenda : emploi du temps de la semaine, partage Telegram */
.week-grid { display: grid; grid-template-columns: repeat(var(--days, 6), minmax(150px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.week-day { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; min-height: 160px; }
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.week-day-head { padding: 2px 4px 6px; border-bottom: 1px solid var(--border); }
.week-empty { text-align: center; padding: 10px 0; }
.week-add { margin-top: auto; align-self: center; }
.slot-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 7px 9px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.slot-card:hover { box-shadow: var(--shadow); }
.slot-card .slot-module { font-weight: 700; line-height: 1.25; }
.slot-card.kind-td, .slot-card.kind-courstd { border-left-color: #0ea5e9; }
.slot-card.kind-tp { border-left-color: #10b981; }
.slot-card.kind-examen { border-left-color: #ef4444; }
.slot-card.kind-autre { border-left-color: #94a3b8; }
.slot-card.cancelled { opacity: .55; }
.slot-card.cancelled .slot-module { text-decoration: line-through; }
.slot-card.live { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 45%, transparent); }
.slot-card button.link, .today-slot button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; margin-top: 2px; }
.small-tabs { margin-bottom: 0; }
.small-tabs button { font-size: .9rem; padding: 6px 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: .88rem; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.share-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.share-est { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.share-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
/* Tableau de bord du jour (page d'accueil enseignant) */
.today-card .today-status { font-size: 1.05rem; font-weight: 700; }
.today-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
@media (max-width: 800px) { .today-cols { grid-template-columns: 1fr; } }
.today-slot { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.today-slot:last-child { border-bottom: 0; }
.today-slot.past { opacity: .55; }
.today-slot.cancelled { opacity: .55; text-decoration: line-through; }
.today-slot.live { font-weight: 600; }

/* Agenda : periodes (annee scolaire, semestres) */
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.period-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .88rem; cursor: pointer; }
.period-chip:hover { border-color: var(--accent); }
.period-chip.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* Page de fin : conseils de revision (note <= 10/20) */
.remediation { text-align: left; margin: 14px 0; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--warn, #b54708) 30%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--warn, #b54708) 6%, var(--surface)); }
.remediation h3 { font-size: 1.05rem; margin: 0 0 6px; }
.rem-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.rem-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.rem-links a { font-size: .8rem; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--text); white-space: nowrap; }
.rem-links a:hover { border-color: var(--accent); color: var(--accent); }
.rem-links a.rem-course { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent); font-weight: 600; }

/* Projet : catalogue de sujets, groupe, rapport a deposer */
.pj-topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pj-topic { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; }
.pj-topic > .btn { align-self: flex-start; margin-top: auto; }
.pj-topic.taken { background: var(--surface-2); position: relative; overflow: hidden; }
.pj-topic-blur { filter: blur(5px); opacity: .55; user-select: none; pointer-events: none; }
.pj-topic-blur h3 { margin: 6px 0; }
.pj-topic-blur p { margin: 0 0 4px; font-size: .85rem; }
.pj-join { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--accent-soft); }
.pj-code { display: flex; flex-direction: column; align-items: center; padding: 6px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.pj-code strong { font-size: 1.35rem; letter-spacing: .12em; color: var(--accent); }
.pj-deposit { border-left: 4px solid var(--warn); }
.pj-deposit.is-done { border-left-color: var(--ok); }
.pj-deadline { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.pj-deadline strong { font-size: 1.05rem; }
.pj-deadline.late { background: var(--danger-soft); color: var(--danger); }
.topic-card.is-taken { border-color: var(--warn); }
.pj-topics-admin summary { cursor: pointer; }
.pj-topics-admin table { width: 100%; }
@media (max-width: 640px) {
  .pj-deadline { align-items: flex-start; }
  .pj-join .hrow { width: 100%; }
  .pj-join input { flex: 1; }
}

/* Enonce structure d'un TD importe : exercice, donnees, question */
.question .prompt.td-prompt, .prompt.td-prompt { white-space: normal; }
.td-prompt .td-ex { font-weight: 700; font-size: .95rem; color: var(--accent); margin-bottom: 6px; }
.td-prompt .td-ctx { white-space: pre-wrap; padding: 10px 12px; margin-bottom: 12px; border-left: 3px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 6px; background: color-mix(in srgb, var(--accent) 6%, var(--surface)); font-size: .97rem; }
.td-prompt .td-q { white-space: pre-wrap; font-weight: 600; }
.td-prompt .td-ql { display: inline-block; margin-right: 4px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 700; vertical-align: 1px; }
