/* ═══════════════════════════════════════════════
   ARGUS — style.css
   L'IA encadrée pour l'enseignement supérieur
   ARGUS — L'IA encadrée pour l'enseignement supérieur
═══════════════════════════════════════════════ */

:root {
  /* — PALETTE ARGUS — */
  --argus-navy:    #1B2A4E;  /* ancrage de confiance */
  --argus-navy-2:  #243558;
  --argus-navy-3:  #2e4068;
  --argus-red:     #E30613;  /* couleur d'action */
  --argus-cream:   #F5F1E8;  /* clarté, lecture */
  --argus-cream-2: #ECE6D6;
  --argus-cream-3: #DFD7C2;
  --argus-black:   #0A0A0A;

  /* Tokens fonctionnels (dark-first = mode "navy") */
  --red:       var(--argus-red);
  --red-dim:   rgba(227,6,19,.14);
  --red-glow:  rgba(227,6,19,.30);

  --bg:         var(--argus-navy);
  --surface-1:  #213056;
  --surface-2:  #243558;
  --surface-3:  #2C3E63;
  --surface-4:  #36486D;

  --border:        rgba(245,241,232,.10);
  --border-strong: rgba(245,241,232,.20);

  --text-primary:   var(--argus-cream);
  --text-secondary: rgba(245,241,232,.72);
  --text-muted:     rgba(245,241,232,.45);
  --text-faint:     rgba(245,241,232,.30);

  --green: #4ade80;
  --green-dim: rgba(74,222,128,.14);
  --amber: #fbbf24;
  --amber-dim: rgba(251,191,36,.16);

  /* Typo — DA Argus éditoriale
     - display: Fraunces, serif moderne avec une vraie présence
     - body: DM Sans, sobre et très lisible
     - mono: JetBrains Mono pour timers, hashs, données techniques */
  --font-display: 'Fraunces', 'Tiempos Headline', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', 'DM Mono', monospace;

  --sidebar-w: 210px;
  --topbar-h: 52px;
  --ease: cubic-bezier(.16,1,.3,1);
  --tr: 200ms var(--ease);

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-xl: 22px;
}

/* ── MODE CLAIR : palette crème dominante ── */
[data-theme="light"] {
  --bg:         var(--argus-cream);
  --surface-1:  #FFFCF5;
  --surface-2:  var(--argus-cream-2);
  --surface-3:  var(--argus-cream-3);
  --surface-4:  #C9BFA7;

  --border:        rgba(27,42,78,.10);
  --border-strong: rgba(27,42,78,.22);

  --text-primary:   var(--argus-navy);
  --text-secondary: rgba(27,42,78,.72);
  --text-muted:     rgba(27,42,78,.50);
  --text-faint:     rgba(27,42,78,.32);

  --red-dim:   rgba(227,6,19,.10);
  --red-glow:  rgba(227,6,19,.22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--red); }

/* ── TITRES (serif Argus) ── */
h1, h2, h3, .display, .breadcrumb-display { font-family: var(--font-display); letter-spacing: -0.01em; }

/* ── APP ── */
.app { display: flex; flex-direction: column; height: 100dvh; }
.hidden { display: none !important; }

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.top-logo { display: flex; align-items: center; gap: .6rem; }
.top-mark {
  width: 28px; height: 28px;
  background: var(--red); color: #fff;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: .85rem; font-weight: 800;
}
.top-name { font-family: var(--font-display); font-size: .85rem; font-weight: 700; letter-spacing: -.01em; }
.top-sep { width: 1px; height: 18px; background: var(--border-strong); }
.breadcrumb { font-size: .78rem; color: var(--text-secondary); }

.topbar-center { display: flex; align-items: center; }
.integrity-pill {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: .3rem .9rem .3rem .4rem;
}
.ip-bar {
  width: 60px; height: 4px;
  background: var(--surface-4); border-radius: 2px; overflow: hidden;
}
.ip-fill { height: 100%; background: var(--green); border-radius: 2px; transition: width .6s var(--ease); }
.ip-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); }

.topbar-right { display: flex; align-items: center; gap: .75rem; }
.role-toggle {
  display: flex; align-items: center; gap: .4rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .3rem .6rem;
  cursor: pointer; font-size: .78rem;
  transition: border-color var(--tr);
}
.role-toggle:hover { border-color: var(--border-strong); }
.rt-icon svg { width: 14px; height: 14px; color: var(--text-secondary); }
.rt-arrow { font-size: 10px; color: var(--text-muted); }
.top-avatar {
  width: 30px; height: 30px;
  background: var(--red-dim); color: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
  border: 1.5px solid var(--red-glow);
}

/* ── LAYOUT ── */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; flex: 1; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  display: flex; flex-direction: column;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.nav-group { padding: .75rem .5rem; flex-shrink: 0; }
.nav-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: .25rem .625rem .5rem; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .625rem;
  border-radius: var(--r-sm);
  cursor: pointer; color: var(--text-secondary);
  font-size: .82rem; font-weight: 500;
  transition: background var(--tr), color var(--tr);
  position: relative;
}
.nav-item:hover { background: var(--surface-3); color: var(--text-primary); }
.nav-item.active { background: var(--red-dim); color: var(--red); }
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
}
.active-badge { background: var(--green-dim); color: var(--green); }
.ai-badge { background: var(--red-dim); color: var(--red); }
.files-count, .cert-count { background: var(--surface-4); color: var(--text-secondary); }
.prof-badge { background: var(--amber-dim); color: var(--amber); }

.sidebar-bottom { margin-top: auto; padding: .75rem .5rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.theme-row { display: flex; gap: .5rem; margin-bottom: .75rem; }
.theme-btn {
  width: 32px; height: 32px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--tr);
}
.theme-btn svg { width: 14px; height: 14px; color: var(--text-secondary); }
.theme-btn:hover { background: var(--surface-4); }
.lang-toggle {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: var(--font-mono); font-size: 11px;
  font-weight: 500; color: var(--text-secondary);
  transition: background var(--tr);
}
.lang-toggle:hover { background: var(--surface-4); }
.sidebar-user { display: flex; align-items: center; gap: .625rem; }
.su-avatar {
  width: 30px; height: 30px; flex-shrink: 0;
  background: var(--red-dim); color: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
}
.su-info { flex: 1; min-width: 0; }
.su-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-school { font-size: .68rem; color: var(--text-muted); }
.su-integrity { position: relative; width: 30px; height: 30px; flex-shrink: 0; }
.su-integrity svg { width: 30px; height: 30px; }
.su-integrity span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 8px; font-weight: 500; color: var(--red);
}

/* ── MAIN / PAGES ── */
.main { overflow-y: auto; overflow-x: hidden; background: var(--bg); }
.page { display: none; animation: fadeIn .22s var(--ease); }
.page.active { display: block; }
#page-editor.active { display: flex; flex-direction: column; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-pad { padding: 2rem 2.5rem; max-width: 1200px; margin: 0 auto; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap;
}
.ph-eyebrow { font-family: var(--font-mono); font-size: 11px; color: var(--red); letter-spacing: .08em; margin-bottom: .25rem; }
.ph-title { font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -.03em; }
.ph-actions { display: flex; gap: .75rem; align-items: center; flex-shrink: 0; }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem;
  background: var(--text-primary); color: var(--bg);
  border-radius: var(--r-sm); font-size: .82rem; font-weight: 600;
  transition: opacity var(--tr);
}
.btn-primary:hover { opacity: .85; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem;
  background: var(--surface-3); color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: .82rem; font-weight: 500;
  transition: background var(--tr), color var(--tr);
}
.btn-secondary:hover { background: var(--surface-4); color: var(--text-primary); }
.btn-red {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.1rem;
  background: var(--red); color: #fff;
  border-radius: var(--r-sm); font-size: .82rem; font-weight: 600;
  transition: opacity var(--tr);
}
.btn-red:hover { opacity: .88; }
.btn-red.btn-full { width: 100%; justify-content: center; padding: .75rem; }
.btn-ghost {
  padding: .55rem 1rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: .82rem;
  transition: background var(--tr), color var(--tr);
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); }
.btn-ghost-sm { padding: .35rem .75rem; color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: .78rem; transition: background var(--tr); }
.btn-ghost-sm:hover { background: var(--surface-3); }
.btn-red-sm { padding: .35rem .75rem; background: var(--red); color: #fff; border-radius: var(--r-sm); font-size: .78rem; transition: opacity var(--tr); }
.btn-red-sm:hover { opacity: .85; }

/* ── KPI ROW ── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 2rem; }
.kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
}
.kpi-val {
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 700; letter-spacing: -.04em;
  color: var(--text-primary); line-height: 1;
  margin-bottom: .3rem;
}
.kpi-val.red { color: var(--red); }
.kpi-lbl { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.kpi-sub { font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }
.kpi-integrity { border-color: var(--red-glow); background: var(--red-dim); }

/* ── DASHBOARD ── */
.dash-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.5rem; }
.dash-col { display: flex; flex-direction: column; gap: 1rem; }
.section-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: .75rem; }

.activity-feed { display: flex; flex-direction: column; gap: .5rem; }
.activity-item {
  display: flex; align-items: center; gap: .75rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md); padding: .75rem 1rem;
}
.ai-icon {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.act-name { font-size: .82rem; font-weight: 500; }
.act-meta { font-size: .72rem; color: var(--text-muted); }
.act-tag {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
}
.tag-cert { background: var(--green-dim); color: var(--green); }
.tag-txt { background: var(--surface-3); color: var(--text-secondary); }

.empty-state {
  display: flex; align-items: center; gap: .75rem;
  color: var(--text-muted); font-size: .8rem; padding: 1.5rem;
  background: var(--surface-1); border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}
.empty-state svg { width: 20px; height: 20px; flex-shrink: 0; }
.empty-state.tall { padding: 3rem; justify-content: center; flex-direction: column; gap: 1rem; font-size: .9rem; }
.empty-state.tall svg { width: 36px; height: 36px; }

.rules-list { display: flex; flex-direction: column; gap: .4rem; }
.rule-item {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: var(--text-secondary);
}
.rule-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.rule-item.ok .rule-dot { background: var(--green); }
.rule-item.no .rule-dot { background: var(--red); }
.rule-item.ok { color: var(--text-secondary); }
.rule-item.no { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-muted); }

.integrity-log { display: flex; flex-direction: column; gap: .3rem; }
.il-row { display: flex; align-items: center; gap: .75rem; font-size: .75rem; }
.il-time { font-family: var(--font-mono); color: var(--text-muted); min-width: 40px; }
.il-event { flex: 1; color: var(--text-secondary); }
.il-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.il-tag.ok { background: var(--green-dim); color: var(--green); }
.il-tag.warn { background: var(--amber-dim); color: var(--amber); }
.il-tag.bad { background: var(--red-dim); color: var(--red); }

/* ── EDITOR ── */
#page-editor { display: none; }
#page-editor.active { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-h)); }
.editor-layout { display: flex; flex-direction: column; height: 100%; }

.editor-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem 1.5rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.et-left { display: flex; align-items: center; gap: .25rem; }
.doc-title-input {
  background: transparent; border: none; outline: none;
  font-family: var(--font-display); font-size: .95rem; font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1.5px solid transparent;
  transition: border-color var(--tr);
}
.doc-title-input:focus { border-bottom-color: var(--red); }
.doc-ext { font-size: .78rem; color: var(--text-muted); }
.et-center { display: flex; align-items: center; gap: .5rem; }
.et-right { display: flex; align-items: center; gap: .5rem; }

.security-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--font-mono); font-size: .68rem; font-weight: 500;
  padding: .2rem .6rem; border-radius: 99px;
}
.security-chip svg { width: 11px; height: 11px; }
.security-chip.blocked { background: var(--red-dim); color: var(--red); }
.security-chip.allowed { background: var(--green-dim); color: var(--green); }
.cert-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--font-mono); font-size: .68rem; font-weight: 500;
  padding: .2rem .6rem; border-radius: 99px;
  background: var(--amber-dim); color: var(--amber);
}
.cert-chip svg { width: 11px; height: 11px; }
.cert-chip.certified { background: var(--green-dim); color: var(--green); }

.editor-toolbar {
  display: flex; align-items: center; gap: .25rem; flex-wrap: wrap;
  padding: .375rem 1.5rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tb-sel {
  height: 28px; padding: 0 .5rem;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: .75rem; color: var(--text-primary); cursor: pointer;
}
.tb-sel-sm { width: 60px; }
.tb-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 .125rem; }
.tb-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--text-secondary); font-size: .82rem;
  transition: background var(--tr), color var(--tr);
}
.tb-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.tb-btn.active { background: var(--red-dim); color: var(--red); }
.tb-btn svg { width: 13px; height: 13px; }
.tb-stat { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); padding: 0 .25rem; }

.editor-body {
  flex: 1; overflow-y: auto;
  background: var(--surface-2);
}
#editor-area {
  min-height: 100%;
  padding: 3rem clamp(1.5rem, 10vw, 6rem);
  outline: none; caret-color: var(--red);
  font-size: 1rem; line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
}
#editor-area:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted); pointer-events: none;
  font-style: italic;
}

/* ── AI ── */
#page-ai { display: none; }
#page-ai.active { display: block; height: calc(100dvh - var(--topbar-h)); }
.ai-layout { display: grid; grid-template-columns: 1fr 280px; height: 100%; }

.ai-main { display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.ai-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  flex-shrink: 0;
}
.ai-identity { display: flex; align-items: center; gap: .75rem; }
.ai-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34,197,94,.6);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); }
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.ai-name { font-family: var(--font-display); font-size: .9rem; font-weight: 700; }
.ai-meta { font-size: .72rem; color: var(--text-muted); }
.ai-mode-badge {
  font-family: var(--font-mono); font-size: 11px;
  padding: .25rem .75rem; border-radius: 99px;
  background: var(--surface-3); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.ai-rule-banner {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem 1.5rem;
  background: var(--red-dim);
  border-bottom: 1px solid var(--red-glow);
  font-size: .75rem; color: var(--red);
  flex-shrink: 0;
}
.ai-rule-banner svg { width: 13px; height: 13px; flex-shrink: 0; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.msg-wrap { display: flex; flex-direction: column; }
.msg-wrap.user { align-items: flex-end; }
.msg-label-txt {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: .3rem;
}
.msg-bubble {
  padding: .75rem 1rem;
  border-radius: 12px;
  font-size: .85rem; line-height: 1.65;
  max-width: 85%;
}
.msg-bubble.ai {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
}
.msg-bubble.user {
  background: var(--red);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.msg-bubble.typing { opacity: .6; }
.msg-bubble strong { color: inherit; }
.msg-bubble ul, .msg-bubble ol { padding-left: 1.2em; margin: .3em 0; }

.chat-composer {
  display: flex; gap: .75rem;
  padding: .875rem 1.5rem;
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: .625rem .875rem;
  font-size: .85rem; color: var(--text-primary);
  resize: none; outline: none;
  transition: border-color var(--tr);
}
#chat-input:focus { border-color: var(--red); }
.send-btn {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; align-self: flex-end;
  transition: opacity var(--tr);
}
.send-btn svg { width: 15px; height: 15px; }
.send-btn:hover { opacity: .85; }
.send-btn:disabled { opacity: .4; pointer-events: none; }

.ai-sidebar {
  display: flex; flex-direction: column; gap: 0;
  overflow-y: auto;
  background: var(--surface-1);
}
.ais-card {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.ais-title {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: .75rem;
}
.ais-log { display: flex; flex-direction: column; gap: .3rem; }
.ais-empty { font-size: .75rem; color: var(--text-muted); font-style: italic; }
.ais-log-item {
  display: flex; gap: .5rem;
  font-size: .72rem; color: var(--text-secondary);
  padding: .3rem .5rem; background: var(--surface-3);
  border-radius: var(--r-sm);
}
.ais-log-time { font-family: var(--font-mono); color: var(--text-muted); flex-shrink: 0; }
.ais-rules { display: flex; flex-direction: column; gap: .35rem; }
.ais-rule {
  font-size: .78rem; color: var(--text-secondary);
  padding-left: 1rem; position: relative;
}
.ais-rule::before {
  content: ''; position: absolute; left: 0; top: .4em;
  width: 6px; height: 6px; border-radius: 50%;
}
.ais-rule.ok::before { background: var(--green); }
.ais-rule.no::before { background: var(--red); }
.ais-rule.no { text-decoration: line-through; color: var(--text-muted); }

.ais-prompt-box {
  font-family: var(--font-mono); font-size: .68rem; color: var(--text-secondary);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .625rem;
  line-height: 1.7; max-height: 160px; overflow-y: auto;
  white-space: pre-wrap;
}

/* ── FILES ── */
.files-table-wrap { overflow-x: auto; }
.files-table {
  width: 100%; border-collapse: collapse;
  font-size: .82rem;
}
.files-table thead tr {
  border-bottom: 1px solid var(--border);
}
.files-table th {
  padding: .625rem 1rem; text-align: left;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  background: var(--surface-1);
}
.files-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.files-table tbody tr:hover td { background: var(--surface-1); }
.files-empty-row td { text-align: center; color: var(--text-muted); padding: 2.5rem; font-style: italic; }
.file-name { font-weight: 500; color: var(--text-primary); }
.status-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
}
.status-cert { background: var(--green-dim); color: var(--green); }
.status-draft { background: var(--surface-3); color: var(--text-secondary); }

/* ── CERTIFICATES ── */
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.cert-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.25rem;
}
.cert-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .875rem; }
.cert-shield {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: var(--green-dim);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cert-shield svg { width: 18px; height: 18px; color: var(--green); }
.cert-doc-name { font-weight: 600; font-size: .85rem; }
.cert-date { font-size: .72rem; color: var(--text-muted); }
.cert-hash {
  font-family: var(--font-mono); font-size: .65rem; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: .375rem .625rem;
  word-break: break-all; line-height: 1.5;
}
.verify-row { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
#verify-input, #verify-doc-input {
  flex: 1; min-width: 240px;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: .625rem .875rem;
  font-family: var(--font-mono); font-size: .78rem;
  color: var(--text-primary); resize: none; outline: none;
}
#verify-input:focus, #verify-doc-input:focus { border-color: var(--red); }
/* Focus du chat IA en mode examen (remplace l'ancien onfocus inline, interdit par la CSP) */
#sex-chat-input:focus { border-color: var(--red) !important; }
#verify-result { font-size: .82rem; padding: .75rem 1rem; border-radius: var(--r-md); }
.verify-ok { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,.2); }
.verify-fail { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-glow); }

/* ── PROFESSOR PAGES ── */
.student-table-wrap { overflow-x: auto; }
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.config-col { display: flex; flex-direction: column; gap: 1rem; }
.config-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.25rem 1.5rem;
}
.config-card-mono .prompt-preview { font-family: var(--font-mono); }
.cc-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}
.cc-live {
  font-size: 9px; background: var(--red-dim); color: var(--red);
  padding: 1px 5px; border-radius: 99px;
}
.field-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .875rem; }
.field-group:last-child { margin-bottom: 0; }
.field-group label { font-size: .75rem; color: var(--text-secondary); font-weight: 500; }
.field-group input, .field-group select, .field-group textarea {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .5rem .75rem;
  font-size: .82rem; color: var(--text-primary); outline: none;
  transition: border-color var(--tr);
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus { border-color: var(--red); }
.field-group textarea { resize: none; line-height: 1.6; }

.toggle-list { display: flex; flex-direction: column; gap: .875rem; }
.toggle-row { display: flex; align-items: center; gap: .875rem; cursor: pointer; }
.tgl { display: none; }
.tgl-track {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--surface-4);
  position: relative; flex-shrink: 0;
  transition: background var(--tr);
}
.tgl:checked + .tgl-track { background: var(--red); }
.tgl-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  position: absolute; top: 3px; left: 3px;
  transition: transform var(--tr);
}
.tgl:checked + .tgl-track .tgl-thumb { transform: translateX(16px); }
.tgl-name { font-size: .82rem; font-weight: 500; }
.tgl-desc { font-size: .72rem; color: var(--text-muted); }

.prompt-preview {
  font-size: .72rem; color: var(--text-secondary); line-height: 1.7;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: .75rem;
  max-height: 220px; overflow-y: auto;
  white-space: pre-wrap;
}
.deploy-confirm {
  display: flex; align-items: center; gap: .625rem;
  font-size: .82rem; color: var(--green);
  background: var(--green-dim); border: 1px solid rgba(34,197,94,.2);
  border-radius: var(--r-md); padding: .75rem 1rem;
}
.deploy-confirm svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── LOGS ── */
.logs-feed { display: flex; flex-direction: column; gap: .35rem; }
.log-entry {
  display: flex; align-items: center; gap: 1rem;
  padding: .5rem .875rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: .78rem;
}
.le-time { font-family: var(--font-mono); color: var(--text-muted); min-width: 45px; flex-shrink: 0; }
.le-event { flex: 1; color: var(--text-secondary); }
.le-tag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.le-tag.ok { background: var(--green-dim); color: var(--green); }
.le-tag.warn { background: var(--amber-dim); color: var(--amber); }
.le-tag.bad { background: var(--red-dim); color: var(--red); }
.le-tag.sys { background: var(--surface-3); color: var(--text-secondary); }

/* ── EXAM ── */
.exam-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 2.5rem;
  max-width: 560px; display: flex; flex-direction: column; gap: 2rem;
}
.exam-status {
  display: inline-flex; align-items: center; gap: .625rem;
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
}
.exam-status.off .exam-dot { background: var(--text-muted); }
.exam-status.on .exam-dot { background: var(--red); animation: pulse-red 1s ease infinite; }
.exam-dot { width: 8px; height: 8px; border-radius: 50%; }
@keyframes pulse-red {
  0%, 100% { opacity: 1; } 50% { opacity: .4; }
}
.exam-timer {
  font-family: var(--font-mono);
  font-size: 3.5rem; font-weight: 300; letter-spacing: .05em;
  color: var(--text-primary);
}
.exam-controls { display: flex; flex-direction: column; gap: 1rem; }
.exam-restrictions { border: 1px solid var(--border); border-radius: var(--r-md); padding: 1rem; }
.er-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: .75rem; }
.er-list { display: flex; flex-direction: column; gap: .4rem; }
.er-item { display: flex; align-items: center; gap: .5rem; font-size: .8rem; }
.er-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.er-item.locked .er-dot { background: var(--red); }
.er-item.locked { color: var(--text-secondary); }
.er-item.open .er-dot { background: var(--green); }
.er-item.open { color: var(--text-muted); }

/* ── MODALS ── */
.overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2rem;
  width: 440px; max-width: 95vw;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
  text-align: center;
}
.modal-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.modal-icon.red { background: var(--red-dim); }
.modal-icon.red svg { color: var(--red); }
.modal-icon.green { background: var(--green-dim); }
.modal-icon.green svg { color: var(--green); }
.modal-icon svg { width: 24px; height: 24px; }
.modal-card h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }
.modal-card p { font-size: .85rem; color: var(--text-secondary); line-height: 1.6; max-width: 340px; }
.cert-key-box {
  width: 100%;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: .875rem;
  font-family: var(--font-mono); font-size: .7rem;
  color: var(--red); line-height: 1.7; word-break: break-all;
  text-align: left;
}
.modal-actions { display: flex; gap: .625rem; flex-wrap: wrap; justify-content: center; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: .75rem 1.25rem;
  font-size: .82rem; display: flex; align-items: center; gap: .625rem;
  z-index: 600; opacity: 0; transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none; box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: none; }
.toast svg { width: 14px; height: 14px; color: var(--green); flex-shrink: 0; }

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .dash-grid, .config-grid, .ai-layout { grid-template-columns: 1fr; }
  .ai-sidebar { display: none; }
  .page-pad { padding: 1.25rem; }
}

/* ── STUDENT EXAM OVERLAY ── */
#student-exam-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.sex-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1.5rem;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sex-title {
  display: flex; align-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  letter-spacing: -.01em; flex: 1;
}
.sex-timer {
  font-family: var(--font-mono); font-size: 1.5rem; font-weight: 300;
  letter-spacing: .05em; color: var(--text-primary);
}
.sex-body {
  flex: 1; overflow: hidden;
  display: flex;
}
.sex-editor-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  border-right: 1px solid var(--border);
}
#sex-editor {
  flex: 1; overflow-y: auto;
  white-space: pre-wrap;
}
#sex-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted); pointer-events: none; font-style: italic;
}
.sex-split .sex-editor-panel { flex: 1.4; }
.sex-ai-panel {
  width: 340px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--surface-1); overflow: hidden;
}
.sex-ai-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .82rem; font-weight: 600;
  flex-shrink: 0;
}
.sex-ai-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  background: var(--green-dim); color: var(--green);
}

/* ── STUDENT TABLE (rendus) ── */
.student-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
.student-table th {
  text-align: left; padding: .6rem 1rem;
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.student-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.student-table tr:hover td { background: var(--surface-2); }

/* ── ARCHIVES ── */
.archive-folder {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: .75rem;
  overflow: hidden;
}
.archive-folder-header {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; padding: 1rem 1.25rem;
  cursor: pointer; text-align: left;
  background: none; border: none; color: inherit;
  transition: background var(--tr);
}
.archive-folder-header:hover { background: var(--surface-2); }
.archive-folder-header > svg { width: 16px; height: 16px; color: var(--amber); flex-shrink: 0; }
.af-name { flex: 1; font-weight: 600; font-size: .88rem; }
.af-count {
  font-size: .75rem; color: var(--text-muted);
  background: var(--surface-3); padding: 2px 8px; border-radius: 99px;
}
.af-chevron {
  width: 14px !important; height: 14px !important;
  color: var(--text-muted) !important;
  transition: transform var(--tr);
}
.archive-folder.open .af-chevron { transform: rotate(180deg); }
.archive-folder-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.archive-folder.open .archive-folder-body { display: block; }

/* ── SUBJECT PICKER ── */
/* Subject picker pages : layout éditorial left-aligned + centrage horizontal du conteneur */
#page-prof-subjects, #page-stu-subjects { display: none; }
#page-prof-subjects.active, #page-stu-subjects.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;       /* plus de centrage vertical : on scroll si besoin */
  width: 100%;
  padding: 3.5rem 2.5rem 4rem;   /* espace généreux haut/bas pour l'air éditorial */
}

.subject-picker {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  gap: 3rem;                     /* gros gap entre header et grid */
}

/* HEADER éditorial : left-aligned, eyebrow + titre + lead */
.sp-header {
  text-align: left;
  display: flex; flex-direction: column;
  gap: 0.6rem;
  max-width: 720px;
  align-items: flex-start;
}
.sp-header .eyebrow,
.sp-header .ph-eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0;
}
.sp-header h1, .sp-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.04;
  color: var(--text-primary);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  margin: 0.3rem 0 0.4rem;
}
.sp-header h1 em, .sp-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--text-secondary);
}
.sp-header p, .sp-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 600px;
  margin: 0;
}

/* (Bloc .sp-grid / .sp-card supprimé : anciennes définitions doublonnées avec celles
   de la couche éditoriale plus bas, qui font foi.) */

/* ── TOPBAR BUTTONS (theme + lang) ── */
.topbar-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); cursor: pointer; color: var(--text-primary);
  transition: background var(--tr), border-color var(--tr);
}
.topbar-btn:hover { background: var(--surface-3); border-color: var(--red); }
.topbar-btn svg { width: 16px; height: 16px; }
.lang-topbar {
  width: auto; padding: 0 .65rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .04em;
}

/* ── EXAM ACTIVE TOPBAR BANNER ─────────────────── */
#exam-topbar-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--amber-dim, rgba(245,158,11,.15));
  border-bottom: 1.5px solid var(--amber, #f59e0b);
  padding: .55rem 1.5rem;
}
#exam-topbar-banner.hidden { display: none; }
.exam-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 100%;
}
.exam-banner-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--amber, #f59e0b);
}
.exam-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber, #f59e0b);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.7); }
}
.exam-banner-timer {
  font-family: var(--font-mono, monospace);
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════════
   ÉTUDIANT — PAGES MATIÈRES & ONGLETS
══════════════════════════════════════════════ */

/* Exam items list */
.exams-list { display:flex; flex-direction:column; gap:.75rem; }
.exam-item {
  display:flex; align-items:center; gap:1rem;
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-md); padding:1rem 1.25rem;
}
.exam-item-icon { font-size:1.4rem; flex-shrink:0; }
.exam-item-info { flex:1; }
.exam-item-title { font-weight:600; font-size:.9rem; margin-bottom:.2rem; }
.exam-item-meta  { font-size:.78rem; color:var(--text-muted); }
.exam-item-badge {
  font-size:.7rem; font-weight:700; padding:.25rem .6rem;
  border-radius:999px; text-transform:uppercase; letter-spacing:.04em; flex-shrink:0;
}
.upcoming-badge { background:var(--amber-dim); color:var(--amber); }
.live-badge     { background:var(--red-dim);    color:var(--red);   animation: pulse-dot 1.2s ease-in-out infinite; }
.done-badge     { background:var(--green-dim);  color:var(--green); }

/* Exam actif pour l'étudiant */
.stu-exam-active-card {
  background:var(--amber-dim,rgba(245,158,11,.1));
  border:1.5px solid var(--amber,#f59e0b);
  border-radius:var(--r-md); padding:1.25rem 1.5rem;
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
}
.stu-exam-active-left { display:flex; flex-direction:column; gap:.35rem; }
.stu-exam-active-name { font-weight:700; font-size:1rem; }
.stu-exam-active-meta { font-size:.8rem; color:var(--text-muted); }

/* Devoirs maison list */
.devoirs-list { display:flex; flex-direction:column; gap:1rem; }
.devoir-card {
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-md); padding:1.1rem 1.25rem;
  display:flex; align-items:center; gap:1.25rem;
}
.devoir-card.urgent { border-color:var(--red); }
.devoir-card.done   { opacity:.55; }
.devoir-icon { font-size:1.5rem; flex-shrink:0; }
.devoir-info { flex:1; }
.devoir-title { font-weight:600; font-size:.9rem; margin-bottom:.2rem; }
.devoir-meta  { font-size:.78rem; color:var(--text-muted); display:flex; gap:.75rem; flex-wrap:wrap; }
.devoir-deadline { font-weight:600; }
.devoir-deadline.urgent { color:var(--red); }
.devoir-deadline.soon   { color:var(--amber); }
.devoir-actions { display:flex; gap:.5rem; align-items:center; flex-shrink:0; }

/* Bibliothèque */
.biblio-filters {
  display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1.25rem;
}
.biblio-filter {
  padding:.3rem .9rem; border-radius:999px; font-size:.8rem; font-weight:600;
  background:var(--surface-2); border:1px solid var(--border);
  color:var(--text-secondary); cursor:pointer; transition:all .15s;
}
.biblio-filter:hover  { border-color:var(--text-muted); color:var(--text); }
.biblio-filter.active { background:var(--accent,#6366f1); border-color:var(--accent,#6366f1); color:#fff; }
.biblio-grid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:1rem;
}
.biblio-card {
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-md); padding:1.1rem 1.2rem;
  display:flex; flex-direction:column; gap:.5rem; cursor:pointer;
  transition:border-color .15s, transform .15s;
}
.biblio-card:hover { border-color:var(--accent,#6366f1); transform:translateY(-2px); }
.biblio-card-type {
  font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em;
  padding:.15rem .55rem; border-radius:999px; display:inline-block; width:fit-content;
}
.type-cours   { background:rgba(99,102,241,.15); color:#818cf8; }
.type-td      { background:rgba(34,197,94,.12);  color:var(--green); }
.type-article { background:rgba(245,158,11,.15); color:var(--amber); }
.type-video   { background:var(--red-dim);  color:var(--red); }
.biblio-card-title { font-weight:600; font-size:.88rem; line-height:1.35; }
.biblio-card-meta  { font-size:.75rem; color:var(--text-muted); }
.biblio-card-desc  { font-size:.8rem; color:var(--text-secondary); line-height:1.4; }

/* Dashboard étudiant — DM preview */
.dm-preview-list { display:flex; flex-direction:column; gap:.6rem; }
.dm-preview-item {
  display:flex; align-items:center; gap:.75rem;
  padding:.65rem .9rem; border-radius:8px;
  background:var(--surface-2); border:1px solid var(--border);
  font-size:.82rem;
}
.dm-preview-item .dm-dot {
  width:8px; height:8px; border-radius:50%; flex-shrink:0;
  background:var(--amber,#f59e0b);
}
.dm-preview-item .dm-dot.urgent { background:var(--red,#ef4444); }
.dm-preview-item .dm-dot.done   { background:var(--green,#22c55e); }
.dm-preview-name { flex:1; font-weight:500; }
.dm-preview-date { color:var(--text-muted); font-size:.75rem; }

/* Next exam card dashboard */
.next-exam-card {
  background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--r-md); padding:1rem 1.2rem;
}
.nec-title { font-weight:700; font-size:.95rem; margin-bottom:.35rem; }
.nec-meta  { font-size:.8rem; color:var(--text-muted); }

/* Ressources preview */
.ressources-preview { display:flex; flex-direction:column; gap:.5rem; }
.res-preview-item {
  display:flex; align-items:center; gap:.75rem;
  padding:.55rem .9rem; border-radius:8px;
  background:var(--surface-2); border:1px solid var(--border);
  font-size:.82rem; cursor:pointer; transition:border-color .15s;
}
.res-preview-item:hover { border-color:var(--accent,#6366f1); }
.res-preview-icon { font-size:1rem; flex-shrink:0; }

/* DM editor deadline chip */
.dm-deadline-chip {
  font-size:.75rem; font-weight:600; padding:.2rem .65rem;
  border-radius:999px; background:var(--amber-dim);
  color:var(--amber);
}
/* ── Student Waiting Screen ── */
#student-waiting-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
}
.swait-box {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.5rem; text-align: center;
  padding: 3rem 2rem; max-width: 480px;
}
.swait-dot-row { display: flex; gap: .75rem; }
.swait-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--red);
  animation: swait-bounce 1.2s ease-in-out infinite;
}
.swait-dot:nth-child(2) { animation-delay: .2s; }
.swait-dot:nth-child(3) { animation-delay: .4s; }
@keyframes swait-bounce {
  0%,80%,100% { transform: scale(0.5); opacity: .3; }
  40%          { transform: scale(1.3); opacity: 1; }
}
.swait-title { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.swait-msg   { font-size: 1rem; color: var(--text-muted); line-height: 1.7; }
.swait-sub   { font-size: .82rem; color: var(--text-faint); }

/* ── btn-start-timer ── */
#btn-start-timer {
  display: inline-flex;
  align-items: center; gap: .4rem;
  padding: .55rem 1.25rem;
  background: var(--green); color: #fff;
  border: none; border-radius: var(--r-sm);
  font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: opacity var(--tr);
}
#btn-start-timer:hover { opacity: .85; }

/* ════════════════════════════════════════════════════════════════════
   ARGUS · COUCHE ÉDITORIALE
   v1.3 — refonte stylistique complète
   Direction artistique : éditorial / institutionnel raffiné
═══════════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────
   1. TYPOGRAPHIE — Fraunces optical-sized pour les titres
─────────────────────────────────────────────────────────────────── */

h1, h2, h3,
.display,
.greeting,
.page-title,
.breadcrumb,
.top-name,
.ai-name,
.swait-title,
.le-name,
.le-empty-title,
.dashboard-greeting {
  font-family: var(--font-display);
  font-feature-settings: "ss01", "ss02";
}

h1, .h-display, .display-xl {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  /* Optical sizing pour Fraunces : titres = grande échelle (144) */
  font-variation-settings: "opsz" 144, "SOFT" 50;
}

h2 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }

/* "Eyebrow" labels en small-caps — signature éditoriale Argus */
.eyebrow,
.section-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Numérotation type "01 — TITRE" (signature Argus deck) */
.numbered::before {
  content: attr(data-num) " — ";
  color: var(--red);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8em;
  letter-spacing: 0.05em;
  margin-right: 0.4rem;
}

body {
  font-feature-settings: "kern", "liga", "calt";
  letter-spacing: -0.005em;
}

/* ──────────────────────────────────────────────────────────────────
   2. TOPBAR — Marque Argus institutionnelle
─────────────────────────────────────────────────────────────────── */

.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  padding: 0 1.75rem;
  position: relative;
  z-index: 50;
}

.top-mark {
  width: 30px; height: 30px;
  background: var(--argus-cream) !important;
  color: var(--argus-navy) !important;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.04em;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-variation-settings: "opsz" 144;
}
[data-theme="light"] .top-mark {
  background: var(--argus-navy) !important;
  color: var(--argus-cream) !important;
}

.top-name {
  font-family: var(--font-display) !important;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.18em !important;
  font-variation-settings: "opsz" 144;
  padding-left: 0.6rem;
}

.top-sep {
  background: var(--border-strong);
  width: 1px; height: 20px;
  margin: 0 0.5rem;
}

.breadcrumb {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  font-style: italic;
  font-variation-settings: "opsz" 24;
  color: var(--text-secondary);
  letter-spacing: -0.005em;
}

.topbar-btn {
  width: 34px; height: 34px;
  border-radius: 4px;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--tr), border-color var(--tr), color var(--tr);
}
.topbar-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-primary);
}
.lang-topbar {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.top-avatar {
  width: 34px; height: 34px;
  background: var(--argus-cream);
  color: var(--argus-navy);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
[data-theme="light"] .top-avatar {
  background: var(--argus-navy);
  color: var(--argus-cream);
}

/* ──────────────────────────────────────────────────────────────────
   3. SIDEBAR — Navigation éditoriale
─────────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0.75rem;
  display: flex; flex-direction: column;
  gap: 0.15rem;
}

.nav-section {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 1.5rem 0.75rem 0.5rem;
}
.nav-section:first-child { padding-top: 0.25rem; }

.nav-item {
  display: flex; align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--tr), color var(--tr);
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; opacity: 0.7; transition: opacity var(--tr); }
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--red);
  border-radius: 0 2px 2px 0;
}
.nav-item.active svg { color: var(--red); opacity: 1; }

/* ──────────────────────────────────────────────────────────────────
   4. PAGES & layout
   Note : .main et .layout sont déjà définis plus haut. On ne les
   redéfinit PAS ici pour ne pas casser le scroll.
─────────────────────────────────────────────────────────────────── */

/* Custom scrollbar discrète sur l'élément qui scroll réellement (.main) */
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.main::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Animation d'entrée de page (sans toucher au display géré plus haut) */
.page.active { animation: pageIn 380ms var(--ease) both; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────────────────────────
   5. SUBJECT PICKER — accueil de matière (page-clé éditoriale)
─────────────────────────────────────────────────────────────────── */

/* (.sp-header est défini plus haut avec le bloc subject-picker unifié.) */

.sp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* 3 colonnes desktop = 2 rangées de 3 pour 6 matières */
  gap: 0;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
@media (max-width: 900px) { .sp-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .sp-grid { grid-template-columns: 1fr; } }

/* Cartes matière : look "fiche éditoriale" — bordures internes propres,
   pas d'effet "cadre partagé" approximatif. */
.sp-card {
  background: var(--bg);
  padding: 2.25rem 1.85rem 1.85rem;
  cursor: pointer;
  transition: background var(--tr);
  display: flex; flex-direction: column;
  gap: 0.55rem;
  position: relative;
  min-height: 220px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Sur 3 colonnes (desktop) : retirer border-right sur la 3e colonne (n=3,6,9...) */
.sp-card:nth-child(3n) { border-right: none; }

/* Pour les dernières cartes (rangée du bas) : retirer border-bottom.
   Avec 6 cartes en 3 colonnes = lignes pleines, donc les 3 dernières (n=4,5,6 / last 3). */
.sp-card:nth-last-child(-n+3) { border-bottom: none; }

/* Sur 2 colonnes (tablette ≤ 900px) */
@media (max-width: 900px) {
  .sp-card { border-right: 1px solid var(--border); }
  .sp-card:nth-child(3n) { border-right: 1px solid var(--border); } /* reset */
  .sp-card:nth-child(2n) { border-right: none; }
  .sp-card:nth-last-child(-n+3) { border-bottom: 1px solid var(--border); } /* reset */
  .sp-card:nth-last-child(-n+2) { border-bottom: none; }
}
/* Sur 1 colonne (mobile ≤ 580px) */
@media (max-width: 580px) {
  .sp-card { border-right: none; border-bottom: 1px solid var(--border); }
  .sp-card:last-child { border-bottom: none; }
}

.sp-card:hover { background: var(--surface-2); }
.sp-card:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; z-index: 1; }

/* (.sp-card unifié plus haut. On ne garde ici que les sous-éléments .sp-card-*) */

.sp-card-icon {
  font-size: 1.85rem;
  line-height: 1;
  margin-bottom: 0.6rem;
  /* Filtre subtil pour adoucir les emojis qui peuvent paraître saturés */
  filter: saturate(0.85);
  opacity: 0.9;
}

.sp-card-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--text-primary);
  font-variation-settings: "opsz" 36;
}

.sp-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  flex: 1;
}

.sp-card-arrow {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--tr);
}
.sp-card:hover .sp-card-arrow { color: var(--red); }
.sp-card-arrow::after {
  content: "→";
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: transform var(--tr);
}
.sp-card:hover .sp-card-arrow::after { transform: translateX(3px); }


/* ──────────────────────────────────────────────────────────────────
   6. DASHBOARD — Bienvenue éditoriale
─────────────────────────────────────────────────────────────────── */

.greeting,
.dashboard-greeting {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  margin-bottom: 0.4rem;
}
.greeting em {
  font-style: italic;
  color: var(--text-secondary);
  font-weight: 400;
}

.greeting-sub {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text-secondary);
  font-variation-settings: "opsz" 24;
  margin-bottom: 2.5rem;
}

/* KPI cards — sobres, monospace pour les nombres */
.kpi-row, .kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 2.5rem;
  overflow: hidden;
}
.kpi-card, .kpi {
  background: var(--bg);
  padding: 1.5rem 1.25rem;
  display: flex; flex-direction: column;
  gap: 0.4rem;
}
.kpi-label, .kpi-name {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi-value, .kpi-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.02em;
}
.kpi-trend {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  letter-spacing: 0.02em;
}

/* Activity feed */
.activity-feed {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.activity-item {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--tr);
  cursor: pointer;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--surface-2); }

.act-name {
  font-weight: 500;
  color: var(--text-primary);
}
.act-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.act-tag {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 3px;
}

/* ──────────────────────────────────────────────────────────────────
   7. BOUTONS — un seul accent rouge Argus
─────────────────────────────────────────────────────────────────── */

.btn-primary, .btn-red {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--red);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  border: 1px solid var(--red);     /* border = couleur fond, propre au hover */
  border-radius: 4px;
  cursor: pointer;
  transition: background 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn-primary:hover, .btn-red:hover {
  background: #B70410;             /* version foncée plus chic que le bright red */
  border-color: #B70410;
  transform: translateY(-1px);
}
.btn-primary:active, .btn-red:active {
  transform: translateY(0);
}
.btn-red.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.78rem; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color var(--tr), background var(--tr);
}
.btn-secondary:hover {
  border-color: var(--text-primary);
  background: var(--surface-2);
}

.btn-ghost, .btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color var(--tr), color var(--tr);
}
.btn-ghost-sm { padding: 0.35rem 0.75rem; font-size: 0.72rem; }
.btn-ghost:hover, .btn-ghost-sm:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* ──────────────────────────────────────────────────────────────────
   8. FORMS — inputs sobres
─────────────────────────────────────────────────────────────────── */

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select,
.form-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  border-radius: 4px;
  outline: none;
  transition: border-color var(--tr), background var(--tr);
  width: 100%;
}
input:focus, textarea:focus, select:focus, .form-input:focus {
  border-color: var(--red);
  background: var(--surface-1);
}
textarea { resize: vertical; min-height: 80px; }

label, .form-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: block;
}

/* ──────────────────────────────────────────────────────────────────
   9. TABLES — type éditorial / rapport
─────────────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
th {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-strong);
}
td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }

td[style*="font-mono"], .mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Tags d'état */
.le-tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  white-space: nowrap;
}
.le-tag.ok    { background: var(--green-dim); color: var(--green); }
.le-tag.amber { background: var(--amber-dim); color: var(--amber); }
.le-tag.warn  { background: var(--amber-dim); color: var(--amber); }
.le-tag.red   { background: var(--red-dim); color: var(--red); }
.le-tag::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}


/* ──────────────────────────────────────────────────────────────────
   10. SPLASH — Page d'accueil de choix de rôle
   Direction : monumentale, éditoriale, inoubliable
─────────────────────────────────────────────────────────────────── */

.splash {
  position: fixed; inset: 0;
  z-index: 100000;
  display: flex; align-items: flex-start; justify-content: center;
  background: var(--bg);
  padding: 4rem 2rem 3rem;
  opacity: 1;
  transition: opacity 320ms var(--ease);
  overflow-y: auto;                         /* scrollable si écran court */
  -webkit-overflow-scrolling: touch;
}
.splash.hidden { display: none; }
.splash.splash-leaving { opacity: 0; }

/* Décor : arcs concentriques en bas-droite, signature visuelle Argus */
.splash::before {
  content: "";
  position: absolute;
  right: -300px; bottom: -300px;
  width: 900px; height: 900px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}
.splash::after {
  content: "";
  position: absolute;
  right: -180px; bottom: -180px;
  width: 600px; height: 600px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0.25;
  pointer-events: none;
}

.splash-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: auto 0;             /* centrage vertical si la place le permet */
}

/* Header du splash : logo + tagline en small-caps */
.splash-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 4rem;
  animation: fadeInUp 600ms var(--ease) 100ms both;
}
.splash-mark {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--argus-cream);
  color: var(--argus-navy);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  font-variation-settings: "opsz" 144;
  border-radius: 6px;
  letter-spacing: -0.04em;
}
[data-theme="light"] .splash-mark {
  background: var(--argus-navy);
  color: var(--argus-cream);
}
.splash-brand { display: flex; flex-direction: column; gap: 0.25rem; }
.splash-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-variation-settings: "opsz" 144;
  line-height: 1;
  color: var(--text-primary);
}
.splash-tagline {
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-muted);
}

/* Titre monumental */
.splash-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: var(--text-primary);
  font-variation-settings: "opsz" 144, "SOFT" 30;
  margin-bottom: 0.6rem;
  animation: fadeInUp 700ms var(--ease) 200ms both;
}
.splash-title .accent { color: var(--red); font-style: italic; font-weight: 500; }

.splash-sub {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 400;
  color: var(--text-secondary);
  font-variation-settings: "opsz" 36;
  max-width: 520px;
  line-height: 1.5;
  margin-bottom: 3.5rem;
  animation: fadeInUp 700ms var(--ease) 320ms both;
}

/* Choix : 2 cartes "fiche éditoriale" — bordure interne propre */
.splash-roles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  animation: fadeInUp 700ms var(--ease) 440ms both;
  width: 100%;
}
@media (max-width: 640px) {
  .splash-roles { grid-template-columns: 1fr; }
  .splash-role:first-child { border-bottom: 1px solid var(--border); }
}

.splash-role {
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.55rem;
  padding: 2rem 1.85rem 1.85rem;
  cursor: pointer;
  transition: background var(--tr);
  position: relative;
  border: none;
  font-family: inherit;
}
/* Bordure verticale entre les 2 cartes (desktop) */
.splash-role:first-child {
  border-right: 1px solid var(--border);
}
@media (max-width: 640px) {
  .splash-role:first-child { border-right: none; }
}
.splash-role:hover { background: var(--surface-2); }
.splash-role:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; z-index: 1; }

.splash-role-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--red);
  margin-bottom: 0.4rem;
}

.splash-role-icon {
  width: 36px; height: 36px;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  display: flex; align-items: center; justify-content: center;
  transition: color var(--tr), transform 380ms var(--ease);
}
.splash-role-icon svg { width: 28px; height: 28px; stroke-width: 1.4; }
.splash-role:hover .splash-role-icon { color: var(--red); transform: translateY(-2px); }

.splash-role-label {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text-primary);
  font-variation-settings: "opsz" 72;
}
.splash-role-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-top: 0.3rem;
}
.splash-role-arrow {
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 0.5rem;
  transition: color var(--tr);
}
.splash-role:hover .splash-role-arrow { color: var(--red); }
.splash-role-arrow::after {
  content: "→";
  font-family: var(--font-body);
  transition: transform var(--tr);
}
.splash-role:hover .splash-role-arrow::after { transform: translateX(4px); }

.splash-foot {
  margin-top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  animation: fadeInUp 600ms var(--ease) 600ms both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────────────────────────
   11. WAITING ROOM — sobre, atmosphérique
─────────────────────────────────────────────────────────────────── */

#student-waiting-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: var(--bg) !important;
  padding: 2rem;
  /* arcs déco identiques au splash */
}
#student-waiting-overlay::before {
  content: "";
  position: absolute;
  right: -250px; bottom: -250px;
  width: 700px; height: 700px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  opacity: 0.3;
  pointer-events: none;
}
.swait-box {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 1.5rem; text-align: center;
  padding: 3rem 2rem;
  max-width: 540px;
}
.swait-dot-row { display: flex; gap: 0.6rem; }
.swait-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  animation: swait-bounce 1.4s ease-in-out infinite;
}
.swait-dot:nth-child(2) { animation-delay: 0.2s; }
.swait-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes swait-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.2); opacity: 1; }
}
.swait-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 72;
  color: var(--text-primary);
  margin-top: 0.8rem;
}
.swait-msg {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  font-variation-settings: "opsz" 24;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 440px;
}
.swait-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 0.4rem;
}

/* ──────────────────────────────────────────────────────────────────
   12. EXAM TOPBAR BANNER (côté prof uniquement)
─────────────────────────────────────────────────────────────────── */

#exam-topbar-banner {
  background: var(--red-dim);
  border-bottom: 1px solid var(--red);
  padding: 0.55rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
}
#exam-topbar-banner .banner-left { display: flex; align-items: center; gap: 0.8rem; }
#exam-topbar-banner .banner-pulse {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--red); }
  50%      { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}
#exam-banner-title { font-weight: 600; color: var(--text-primary); }
#exam-banner-timer { font-family: var(--font-mono); color: var(--red); font-weight: 600; }


/* ──────────────────────────────────────────────────────────────────
   13. AI CHAT — sobriété éditoriale
─────────────────────────────────────────────────────────────────── */

.ai-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  height: calc(100vh - var(--topbar-h));
}
.ai-main {
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.ai-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
}
.ai-identity { display: flex; align-items: center; gap: 0.85rem; }
.ai-icon {
  width: 36px; height: 36px;
  background: var(--red-dim);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-radius: 4px;
}
.ai-pulse {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}
.ai-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }
.ai-meta { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.05em; }

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  display: flex; flex-direction: column; gap: 1.2rem;
}
.msg {
  max-width: 80%;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  border-radius: 8px;
}
.msg.user {
  align-self: flex-end;
  background: var(--surface-3);
  color: var(--text-primary);
}
.msg.assistant {
  align-self: flex-start;
  background: transparent;
  border-left: 2px solid var(--red);
  border-radius: 0 8px 8px 0;
  padding-left: 1.1rem;
  color: var(--text-primary);
}

.chat-input-wrap {
  padding: 1rem 1.75rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem;
}
.chat-input-wrap textarea, #chat-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  resize: none;
  font-size: 0.9rem;
  padding: 0.7rem 0.95rem;
  border-radius: 4px;
  min-height: 44px; max-height: 200px;
  font-family: var(--font-body);
}

.ai-sidebar {
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
}
.ais-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.ais-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}

.ai-rule-banner {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ──────────────────────────────────────────────────────────────────
   14. EDITOR (rédaction) — éditorial, focus lecture
─────────────────────────────────────────────────────────────────── */

.editor-toolbar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px 4px 0 0;
  border-bottom: none;
}
.toolbar-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--tr);
  font-size: 0.85rem;
}
.toolbar-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.toolbar-btn.active { background: var(--red-dim); color: var(--red); border-color: var(--red-glow); }

.editor-area, [contenteditable="true"] {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-top: none;
  padding: 1.75rem 2.25rem;
  min-height: 60vh;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
  font-variation-settings: "opsz" 14;
  outline: none;
  border-radius: 0 0 4px 4px;
}
.editor-area:focus, [contenteditable="true"]:focus { border-color: var(--border-strong); }

.editor-meta {
  display: flex; gap: 1.5rem;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ──────────────────────────────────────────────────────────────────
   15. MODALES — éditoriales
─────────────────────────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0;
  z-index: 99000;
  background: rgba(10, 18, 38, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  animation: fadeIn 220ms var(--ease);
}
[data-theme="light"] .overlay {
  background: rgba(245, 241, 232, 0.78);
}
.overlay.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 2.25rem 2rem 1.75rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  animation: modalIn 320ms var(--ease);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.modal-icon.red   { background: var(--red-dim);   color: var(--red); }
.modal-icon.green { background: var(--green-dim); color: var(--green); }
.modal-icon.amber { background: var(--amber-dim); color: var(--amber); }
.modal-icon svg { width: 22px; height: 22px; }

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 36;
  color: var(--text-primary);
  margin: 0.2rem 0 0;
}
.modal-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 360px;
}

.modal-actions {
  display: flex; gap: 0.6rem;
  margin-top: 0.6rem;
}

.cert-key-box {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: 4px;
  color: var(--red);
  word-break: break-all;
  letter-spacing: 0.02em;
  width: 100%;
}

/* ──────────────────────────────────────────────────────────────────
   16. TOAST
─────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  display: flex; align-items: center; gap: 0.6rem;
  z-index: 100001;
  opacity: 0;
  transition: transform 320ms var(--ease), opacity 320ms var(--ease);
  pointer-events: none;
  max-width: 90vw;
}
.toast svg { width: 16px; height: 16px; color: var(--green); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.warn { border-color: var(--amber); }
.toast.warn svg { color: var(--amber); }
.toast.err  { border-color: var(--red); }
.toast.err svg { color: var(--red); }

/* ──────────────────────────────────────────────────────────────────
   17. UTILS
─────────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

::selection {
  background: var(--red);
  color: #fff;
}

/* Scrollbar custom partout */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ══════════════════════════════════════════════════
   CONSOLE ÉCOLE (ecole.html) + AUTH partagé
   Réutilise les tokens de la DA Argus.
══════════════════════════════════════════════════ */
.ecole-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background:
    radial-gradient(1000px 600px at 80% -10%, var(--red-dim), transparent 60%),
    var(--bg);
}
.ecole-auth-card {
  width: 100%; max-width: 420px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 2rem; box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.ecole-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.ecole-mark {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--argus-cream); color: var(--argus-navy);
  font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; border-radius: 10px;
}
.ecole-mark.sm { width: 34px; height: 34px; font-size: 1.15rem; border-radius: 8px; }
.ecole-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: .12em; color: var(--text-primary); }
.ecole-brand-sub { font-size: .78rem; color: var(--text-muted); letter-spacing: .04em; }
.ecole-tabs { display: flex; gap: .25rem; background: var(--surface-3); border-radius: var(--r-md); padding: .25rem; margin-bottom: 1.25rem; }
.ecole-tab {
  flex: 1; padding: .5rem; border: none; background: transparent; cursor: pointer;
  color: var(--text-secondary); font: inherit; font-size: .82rem; font-weight: 600; border-radius: var(--r-sm); transition: all var(--tr);
}
.ecole-tab.active { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.ecole-form { display: flex; flex-direction: column; gap: .875rem; }
.ecole-field { display: flex; flex-direction: column; gap: .35rem; }
.ecole-field > span { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.ecole-field input, .ecole-inline-form input, .ecole-inline-form select,
.ecole-res-form input, .ecole-res-form select {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: .6rem .75rem; font: inherit; font-size: .9rem; color: var(--text-primary); outline: none; transition: border-color var(--tr);
}
.ecole-field input:focus, .ecole-inline-form input:focus, .ecole-res-form input:focus,
.ecole-inline-form select:focus, .ecole-res-form select:focus { border-color: var(--red); }
.ecole-hint { font-size: .82rem; color: var(--text-muted); line-height: 1.5; margin-bottom: .25rem; }
.ecole-error {
  margin-top: 1rem; padding: .625rem .875rem; border-radius: var(--r-md);
  background: var(--red-dim); color: #ff6b6b; font-size: .82rem; border: 1px solid rgba(227,6,19,.25);
}
.ecole-api-config, .ecole-back-link {
  display: inline-block; margin-top: 1.25rem; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font: inherit; font-size: .78rem; text-decoration: none;
}
.ecole-back-link { float: right; }
.ecole-api-config:hover, .ecole-back-link:hover { color: var(--text-secondary); }

/* Console */
.ecole-app { min-height: 100vh; background: var(--bg); }
.ecole-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface-1);
  position: sticky; top: 0; z-index: 10;
}
.ecole-topbar-left { display: flex; align-items: center; gap: .75rem; }
.ecole-top-title { font-weight: 700; font-size: .95rem; color: var(--text-primary); }
.ecole-top-school { font-size: .78rem; color: var(--text-muted); }
.ecole-topbar-right { display: flex; align-items: center; gap: .75rem; }
.ecole-admin-badge { font-family: var(--font-mono); font-size: .72rem; color: var(--text-secondary); background: var(--surface-3); padding: .25rem .5rem; border-radius: var(--r-sm); }
.ecole-nav { display: flex; gap: .25rem; padding: .75rem 1.5rem 0; border-bottom: 1px solid var(--border); background: var(--surface-1); }
.ecole-nav-item {
  padding: .6rem 1rem; border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer;
  color: var(--text-secondary); font: inherit; font-size: .85rem; font-weight: 600; transition: all var(--tr);
}
.ecole-nav-item.active { color: var(--text-primary); border-bottom-color: var(--red); }
.ecole-main { max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.ecole-section { display: none; }
.ecole-section.active { display: block; animation: fadeUp .3s ease; }
.ecole-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.ecole-section-head h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.ecole-section-head p { font-size: .84rem; color: var(--text-muted); max-width: 560px; margin-top: .35rem; line-height: 1.5; }
.ecole-inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ecole-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.25rem; margin-bottom: 1rem; }
.ecole-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: .88rem; background: var(--surface-1); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); }
.ecole-muted { color: var(--text-muted); font-size: .82rem; }

.ecole-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.ecole-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: .4rem .75rem; font-size: .85rem; color: var(--text-primary); }
.ecole-chip-ico { font-size: 1rem; }
.ecole-chip code { font-family: var(--font-mono); font-size: .68rem; color: var(--text-muted); }

.ecole-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .875rem; }
.ecole-group-head h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.ecole-count { font-size: .75rem; color: var(--text-muted); background: var(--surface-3); padding: .2rem .5rem; border-radius: var(--r-sm); }
.ecole-sublabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .5rem; }
.ecole-subtoggles { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.ecole-subtoggle {
  padding: .35rem .7rem; border: 1px solid var(--border); background: var(--surface-3); cursor: pointer;
  border-radius: 999px; font: inherit; font-size: .78rem; color: var(--text-secondary); transition: all var(--tr);
}
.ecole-subtoggle.on { background: var(--red); border-color: var(--red); color: #fff; }
.ecole-members { width: 100%; border-collapse: collapse; margin-bottom: .875rem; }
.ecole-members th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.ecole-members td { padding: .5rem; font-size: .84rem; color: var(--text-primary); border-bottom: 1px solid var(--border); vertical-align: middle; }
.ecole-members code { font-family: var(--font-mono); font-size: .76rem; color: var(--text-secondary); }
.ecole-role { font-size: .72rem; padding: .15rem .5rem; border-radius: var(--r-sm); }
.ecole-role.student { background: var(--surface-3); color: var(--text-secondary); }
.ecole-role.professor { background: var(--amber-dim); color: var(--amber); }
.ecole-status { font-size: .72rem; padding: .15rem .5rem; border-radius: var(--r-sm); }
.ecole-status.invited { background: var(--amber-dim); color: var(--amber); }
.ecole-status.active { background: var(--green-dim); color: var(--green); }
.ecole-status.disabled { background: var(--red-dim); color: #ff6b6b; }
.ecole-row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.ecole-add-member input, .ecole-add-member select { font-size: .82rem; padding: .45rem .6rem; }
.ecole-add-member .mem-name { flex: 1; min-width: 130px; }
.ecole-add-member .mem-login { flex: 1; min-width: 130px; }

.ecole-res-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.ecole-res-form input { flex: 1; min-width: 130px; }
.ecole-res-list { margin-top: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.ecole-res-item { display: flex; align-items: center; gap: .75rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md); padding: .625rem .875rem; }
.ecole-res-main { flex: 1; }
.ecole-res-title { font-size: .88rem; font-weight: 600; color: var(--text-primary); }
.ecole-res-meta { font-size: .74rem; color: var(--text-muted); }
.ecole-res-type { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; padding: .2rem .5rem; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-secondary); }

.btn-ghost-xs, .btn-red-xs {
  font: inherit; font-size: .74rem; padding: .3rem .6rem; border-radius: var(--r-sm); cursor: pointer; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--text-secondary); transition: all var(--tr);
}
.btn-ghost-xs:hover { color: var(--text-primary); border-color: var(--border-strong); }
.btn-ghost-xs.danger:hover { color: #ff6b6b; border-color: rgba(227,6,19,.4); }
.btn-red-xs { background: var(--red); border-color: var(--red); color: #fff; }
.btn-red-xs:hover { filter: brightness(1.08); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ══════════════════════════════════════════════════
   CONNEXION (index) + ACCUEIL GLOBAL
══════════════════════════════════════════════════ */
.login-inner { max-width: 440px; }
.login-form { display: flex; flex-direction: column; gap: .875rem; margin-top: 1.5rem; text-align: left; }
.login-field { display: flex; flex-direction: column; gap: .35rem; }
.login-field > span { font-size: .78rem; font-weight: 600; color: var(--text-secondary); }
.login-field input {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: .7rem .85rem; font: inherit; font-size: .95rem; color: var(--text-primary); outline: none; transition: border-color var(--tr);
}
.login-field input:focus { border-color: var(--red); }
.login-error { padding: .6rem .85rem; border-radius: var(--r-md); background: var(--red-dim); color: #ff6b6b; font-size: .82rem; border: 1px solid rgba(227,6,19,.25); }
.login-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; }
.login-link { background: none; border: none; cursor: pointer; color: var(--text-muted); font: inherit; font-size: .82rem; text-decoration: none; transition: color var(--tr); }
.login-link:hover { color: var(--text-secondary); }

/* Accueil global : barre latérale matières + résumé */
#page-home { padding: 0; }
.home-shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.home-rail {
  background: var(--surface-1); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1.25rem 1rem; gap: .25rem;
  position: sticky; top: 0; height: 100vh;
}
.home-rail-brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1rem; }
.home-rail-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--argus-cream); color: var(--argus-navy); font-family: var(--font-display); font-weight: 800; border-radius: 8px; }
.home-rail-brand span { font-family: var(--font-display); font-weight: 700; letter-spacing: .14em; color: var(--text-primary); }
.home-rail-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); padding: .5rem .5rem .35rem; }
.home-rail-list { display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; flex: 1; }
.home-rail-item {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .625rem; border: none; background: none; cursor: pointer;
  border-radius: var(--r-md); font: inherit; font-size: .9rem; color: var(--text-secondary); text-align: left; transition: all var(--tr); width: 100%;
}
.home-rail-item:hover { background: var(--surface-3); color: var(--text-primary); }
.home-rail-ico { font-size: 1.1rem; width: 1.4rem; text-align: center; }
.home-rail-name { flex: 1; }
.home-rail-badge { background: var(--amber); color: #1a1200; font-size: .68rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; }
.home-rail-empty { padding: 1rem .5rem; color: var(--text-muted); font-size: .82rem; }
.home-rail-foot { border-top: 1px solid var(--border); padding-top: .875rem; margin-top: .5rem; }
.home-user { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.home-user-av { width: 34px; height: 34px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex-shrink: 0; }
.home-user-name { font-size: .84rem; font-weight: 600; color: var(--text-primary); }
.home-user-school { font-size: .72rem; color: var(--text-muted); }
.home-rail-actions { display: flex; align-items: center; gap: .4rem; }
.home-logout { flex: 1; padding: .45rem; border: 1px solid var(--border); background: var(--surface-3); border-radius: var(--r-md); cursor: pointer; font: inherit; font-size: .8rem; color: var(--text-secondary); transition: all var(--tr); }
.home-logout:hover { color: #ff6b6b; border-color: rgba(227,6,19,.4); }

.home-content { padding: 2.25rem clamp(1.25rem, 4vw, 3rem); max-width: 1100px; }
.home-eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--red); font-weight: 700; }
.home-greeting { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; color: var(--text-primary); margin-top: .35rem; }
.home-sub { color: var(--text-muted); font-size: .92rem; margin-top: .5rem; max-width: 560px; }
.home-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1.75rem 0; }
.home-kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.25rem; }
.home-kpi-val { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.home-kpi-val.amber { color: var(--amber); }
.home-kpi-val.red { color: var(--red); }
.home-kpi-lbl { font-size: .82rem; color: var(--text-muted); margin-top: .25rem; }
.home-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; margin-top: .5rem; }
.home-col { min-width: 0; }
.home-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .75rem; }
.home-item {
  display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: .75rem .875rem; cursor: pointer; font: inherit; transition: all var(--tr);
}
button.home-item:hover { border-color: var(--border-strong); transform: translateX(2px); }
.home-item-ico { font-size: 1.2rem; width: 1.6rem; text-align: center; flex-shrink: 0; }
.home-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-item-title { font-size: .9rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-item-meta { font-size: .76rem; color: var(--text-muted); }
.home-item-tag { font-size: .74rem; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.home-item-tag.soon { color: var(--amber); }
.home-item-tag.urgent { color: var(--red); }
.home-empty { padding: 1.25rem; text-align: center; color: var(--text-muted); font-size: .86rem; background: var(--surface-1); border: 1px dashed var(--border-strong); border-radius: var(--r-md); margin-top: .75rem; }

@media (max-width: 860px) {
  .home-shell { grid-template-columns: 1fr; }
  .home-rail { position: static; height: auto; flex-direction: column; border-right: none; border-bottom: 1px solid var(--border); }
  .home-rail-list { max-height: 40vh; }
  .home-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ══ Console École : autoriser le défilement (surcharge html,body overflow:hidden) ══ */
html.ecole-html, html.ecole-html body.ecole-body { height: auto; overflow-x: hidden; overflow-y: auto; }

/* ══ « Voir le mot de passe » ══ */
.pwd-wrap { position: relative; display: flex; align-items: center; }
.pwd-wrap input { flex: 1; width: 100%; padding-right: 4.5rem !important; }
.pwd-toggle {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font: inherit; font-size: .72rem; font-weight: 600;
  color: var(--text-muted); padding: .28rem .45rem; border-radius: var(--r-sm); transition: color var(--tr), background var(--tr);
}
.pwd-toggle:hover { color: var(--text-secondary); background: var(--surface-3); }
.pwd-toggle.on { color: var(--red); }

/* Bouton suppression discret dans l'en-tête de groupe / chip matière */
.ecole-group-head { gap: .5rem; }
.ecole-del-btn {
  background: none; border: 1px solid var(--border); cursor: pointer; font: inherit; font-size: .74rem;
  color: var(--text-muted); padding: .28rem .55rem; border-radius: var(--r-sm); transition: all var(--tr);
}
.ecole-del-btn:hover { color: #ff6b6b; border-color: rgba(227,6,19,.4); }
.ecole-chip { position: relative; }
.ecole-chip-del {
  background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: .9rem; line-height: 1;
  padding: 0 0 0 .15rem; margin-left: .15rem;
}
.ecole-chip-del:hover { color: #ff6b6b; }

.ecole-group-head h3 { flex: 1; }
.ecole-group-head .ecole-del-btn { margin-left: auto; }
