/* ============================================
   GET-SKILLS 2 - Main Stylesheet
   Mobile-first, responsive, Safari-compatible
   ============================================ */

:root {
  /* ───── Identité Getskills2 (conservée) ───── */
  --primary: #cf1578;
  --primary-light: #e84da0;
  --primary-dark: #a01060;
  --secondary: #30b0f3;
  --secondary-light: #5ac0f6;
  --secondary-dark: #188bc9;
  --accent: #f29100;
  --accent-light: #f5a733;
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-dark: #0b3e66;
  --bg-sidebar: #0d2137;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-light: #999999;
  --text-inverse: #ffffff;
  --border: #dde1e7;

  /* ───── Échelle primary (nuances pour fonds doux et états) ───── */
  --primary-50:  #fdf2f8;
  --primary-100: #fce7f3;
  --primary-200: #fbcfe8;
  --primary-500: #cf1578;
  --primary-600: #a01060;
  --primary-700: #770b48;

  /* ───── Échelle de gris standardisée (remplace les hex codes) ───── */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* ───── États sémantiques (fond + premier plan) ───── */
  --success: #10b981;
  --success-bg: #d1fae5;
  --success-fg: #065f46;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-fg: #92400e;
  --error:   #ef4444;
  --error-bg: #fee2e2;
  --error-fg: #991b1b;
  --info:    #0ea5e9;
  --info-bg: #e0f2fe;
  --info-fg: #075985;

  /* ───── Échelle d'espacement ───── */
  --sp-0: 0;       --sp-1: 4px;    --sp-2: 8px;    --sp-3: 12px;
  --sp-4: 16px;    --sp-5: 20px;   --sp-6: 24px;   --sp-8: 32px;
  --sp-10: 40px;   --sp-12: 48px;  --sp-16: 64px;  --sp-20: 80px;

  /* ───── Rayons de bordure ───── */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;
  /* Compat ascendante (anciennes utilisations) */
  --radius: var(--radius-md);

  /* ───── Élévation ───── */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:  0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:  0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl:  0 24px 64px rgba(0, 0, 0, 0.16);
  /* Ombres colorées pour cards d'alerte / call-to-action */
  --shadow-primary: 0 4px 14px rgba(207, 21, 120, 0.18);
  --shadow-error:   0 4px 14px rgba(239, 68, 68, 0.18);
  --shadow-success: 0 4px 14px rgba(16, 185, 129, 0.18);
  --shadow-warning: 0 4px 14px rgba(245, 158, 11, 0.18);
  /* Compat ascendante */
  --shadow: var(--shadow-sm);

  /* ───── Motion ───── */
  --duration-fast:  120ms;
  --duration-base:  200ms;
  --duration-slow:  320ms;
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:    cubic-bezier(0.45, 0, 0.55, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ───── Anneaux de focus accessibles (WCAG 2.1) ───── */
  --ring-primary:   0 0 0 3px rgba(207, 21, 120, 0.30);
  --ring-secondary: 0 0 0 3px rgba(48, 176, 243, 0.30);
  --ring-error:     0 0 0 3px rgba(239, 68, 68, 0.30);
  --ring-success:   0 0 0 3px rgba(16, 185, 129, 0.30);
  --ring-info:      0 0 0 3px rgba(14, 165, 233, 0.30);

  /* ───── Layout ───── */
  --header-height: 56px;
  --sidebar-width: 260px;
  --transition: 0.25s ease;

  /* ───── Typographie ───── */
  --font-body: 'General Sans', 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Fraunces', 'Montserrat', Georgia, serif;
}

/* ═══════════════════════════════════════════════════════════════════
   DARK MODE — activer avec <html data-theme="dark">
   ═══════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Surfaces */
  --bg:           #0f1115;
  --bg-card:      #1a1d24;
  --bg-dark:      #050608;
  --bg-sidebar:   #050608;

  /* Texte (inversé) */
  --text:           #e6e6e6;
  --text-secondary: #a0a3aa;
  --text-light:     #6b6f78;
  --text-inverse:   #1a1a1a;
  --border:         #2a2e36;

  /* Échelle de gris inversée */
  --gray-50:  #1a1d24;
  --gray-100: #22262e;
  --gray-200: #2a2e36;
  --gray-300: #383d47;
  --gray-400: #5c6168;
  --gray-500: #8a8e95;
  --gray-600: #b0b4ba;
  --gray-700: #ccd0d6;
  --gray-800: #e6e8ec;
  --gray-900: #f5f6f8;

  /* États : tints transparents pour s'adapter au fond sombre */
  --success-bg: rgba(16, 185, 129, 0.15);
  --success-fg: #6ee7b7;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --warning-fg: #fbbf24;
  --error-bg:   rgba(239, 68, 68, 0.15);
  --error-fg:   #fca5a5;
  --info-bg:    rgba(14, 165, 233, 0.15);
  --info-fg:    #7dd3fc;

  /* Ombres plus marquées sur fond sombre */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.60);
  --shadow: var(--shadow-sm);

  /* Card glass adapté */
  --glass-bg: rgba(26, 29, 36, 0.72);
}

/* Lisser les images / réduire la luminosité de certaines images claires */
[data-theme="dark"] img:not([data-no-invert]):not([src*=".svg"]) {
  filter: brightness(0.95) contrast(0.95);
}

/* Ajuste le glass par défaut au dark mode */
[data-theme="dark"] .card--glass {
  background: rgba(26, 29, 36, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ============================================
   RESET & BASE
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

a {
  color: var(--secondary);
  text-decoration: none;
}

a:hover {
  color: var(--secondary-dark);
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  outline: none;
}

/* Focus ring accessible (WCAG 2.1) — n'apparaît qu'au focus clavier
   pour ne pas perturber les utilisateurs souris. */
button:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--ring-primary);
  border-radius: var(--radius-sm);
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring-primary);
}
/* État erreur (input invalide) */
input[aria-invalid="true"],
textarea[aria-invalid="true"],
input.is-error,
textarea.is-error {
  border-color: var(--error);
}
input[aria-invalid="true"]:focus-visible,
textarea[aria-invalid="true"]:focus-visible,
input.is-error:focus-visible,
textarea.is-error:focus-visible {
  box-shadow: var(--ring-error);
}

/* ============================================
   LAYOUT: APP SHELL
   ============================================ */

#app {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

.app-layout {
  display: flex;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: 0;
  padding-top: var(--header-height);
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-title-bar {
  position: sticky;
  top: var(--header-height);
  background: var(--bg);
  z-index: 50;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-title-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Students list (ribbon > Étudiants tab) ── */
.ct-student-list { padding: 16px 24px; }
.ct-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ct-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  border-bottom: 2px solid var(--border);
}
.ct-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.ct-table tbody tr:hover { background: #f8f9fa; }
.ct-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.ct-badge-active { background: #e6f7ee; color: #1a8a4a; }
.ct-empty { padding: 40px 24px; text-align: center; color: #999; font-size: 14px; }

/* DataTable action buttons */
.dt-action-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  color: #666;
  font-size: 13px;
  transition: background .15s, color .15s;
}
.dt-action-btn:hover { background: #e8eaed; color: var(--text); }
.dt-action-danger:hover { background: #fde8e8; color: #c0392b; }

/* Course search bar in title bar */
.course-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
}
.course-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.course-search-input {
  width: 180px;
  padding: 5px 30px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.course-search-input:focus { border-color: var(--primary); }
.course-search-icon {
  position: absolute;
  right: 9px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
/* Filter button */
.course-search-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  position: relative;
  transition: border-color 0.15s, color 0.15s;
}
.course-search-filter-btn:hover,
.course-search-filter-btn.is-active {
  border-color: var(--primary);
  color: var(--primary);
}
.csf-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Filter dropdown */
.course-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 100;
  padding: 6px 0;
}
.course-search-dropdown.is-open { display: block; }

.csf-section + .csf-section {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 4px;
}
.csf-section-title {
  padding: 6px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.csf-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
}
.csf-item:hover { background: var(--bg); }
.csf-item-icon { width: 16px; text-align: center; color: var(--text-secondary); }
.csf-item span { flex: 1; }
.csf-check {
  font-size: 12px;
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.12s;
}
.csf-item.is-active .csf-check { opacity: 1; }
.csf-item.is-active { font-weight: 600; }

/* Search summary bar */
.drive-search-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.drive-search-summary i { font-size: 12px; }
.drive-search-cancel {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.drive-search-cancel:hover { background: rgba(255,255,255,0.35); }

/* Filter label for local search */
.drive-filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Document Viewer — full-screen overlay ─────────────────────────── */
.docview-overlay {
  position: fixed;
  inset: 0;
  /* Le bandeau Get-Skills (.header, position: fixed, height: --header-height)
     reste visible au-dessus de l'overlay. */
  top: var(--header-height);
  z-index: 5000;
  background: var(--bg);
  display: flex;
  flex-direction: row;
}
.docview-sidebar {
  width: 52px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
}
.docview-back-btn {
  background: transparent;
  border: 0;
  color: var(--text-inverse, #fff);
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.docview-back-btn:hover { background: rgba(255,255,255,.12); }
.docview-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* Aligné sur .mindmap-title-bar pour cohérence visuelle avec les cartes
   mentales (fond blanc, icône primary, titre 16/600, border-bottom). */
.docview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 6px;
  background: #fff;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.docview-header > i {
  color: var(--primary);
  font-size: 15px;
}
.docview-title {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docview-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto; /* pousse les actions DST (Export/Soumettre) à droite */
}
/* Contenu du header du document-viewer, placé dans la barre .fsv-header
   (sombre) du FullscreenViewer — même présentation que le TipTap collaboratif. */
.docview-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.docview-doc-title {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docview-save-btn,
.docview-close-btn {
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.docview-save-btn {
  background: var(--primary);
  color: #fff;
}
.docview-save-btn:hover { background: var(--primary-dark); }
.docview-close-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.docview-close-btn:hover { background: rgba(255,255,255,0.25); }

.docview-editor-wrap {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.docview-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* PageEditor inside overlay: fill available space */
.docview-editor .pe-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.docview-editor .pe-pages-container {
  flex: 1;
  overflow-y: auto;
}

/* ── Document viewer: inline file viewers ───────────────────────────── */
.docview-pdf-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #525659;
}
.docview-image-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  padding: 20px;
}
.docview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.docview-media-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  padding: 20px;
}
.docview-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}

/* ── PDF Annotator ──────────────────────────────────────────────────── */
.pdfa-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pdfa-tool-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 34px; height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.pdfa-tool-btn:hover { background: var(--bg-hover); }
.pdfa-tool-btn.active { background: var(--primary); color: #fff; }
.pdfa-tool-btn:disabled { opacity: 0.35; cursor: default; }
.pdfa-shape-btn { font-size: 18px; }
.pdfa-sep {
  width: 1px; height: 22px;
  background: var(--border);
  margin: 0 4px;
}
/* PDF annotator — color picker button (shows current color as background) */
.pdfa-color-btn {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(0,0,0,0.2) !important;
  padding: 0 !important;
  min-width: unset !important;
  flex-shrink: 0;
}
.pdfa-color-btn:hover {
  border-color: var(--primary) !important;
  transform: scale(1.1);
}
.pdfa-color-btn.pdfa-color-btn-dim {
  opacity: 0.35;
  pointer-events: none;
}
.pdfa-color-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  padding: 0;
}
.pdfa-color-swatch:hover { transform: scale(1.15); }
.pdfa-color-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--bg-card); }
.pdfa-hl-style-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 2px;
}
.pdfa-hl-style-btn {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  width: 26px;
  height: 26px;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
}
.pdfa-hl-style-btn:hover { background: var(--bg-hover); }
.pdfa-hl-style-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pdfa-size-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdfa-size-preview {
  border-radius: 50%;
  background: var(--text);
  transition: width 0.1s, height 0.1s;
  flex-shrink: 0;
}
.pdfa-size-slider {
  width: 80px;
  accent-color: var(--primary);
}
.pdfa-spacer { flex: 1; }
.pdfa-collab-btn.is-active { color: var(--primary); }
.pdfa-collab-btn:not(.is-active) { color: #999; }

/* Textbox annotation */
.pdfa-textbox {
  border: 1.5px dashed rgba(0,0,0,0.3);
  border-radius: 3px;
  padding: 4px 6px;
  font-family: sans-serif;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
  outline: none;
  box-sizing: border-box;
  cursor: text;
  min-width: 40px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pdfa-textbox:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.15);
}
.pdfa-textbox:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}
.pdfa-save-btn {
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.pdfa-save-btn:hover { background: var(--primary-dark); }
.pdfa-save-btn:disabled { opacity: 0.6; cursor: default; }
.pdfa-flatten-btn {
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-hover);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.pdfa-flatten-btn:hover { background: #e8e0f8; color: var(--primary); }
.pdfa-flatten-btn:disabled { opacity: 0.6; cursor: default; }
.pdfa-pages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: #525659;
}
.pdfa-page-wrap {
  position: relative;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  background: #fff;
}
.pdfa-render-canvas {
  display: block;
}
.pdfa-highlight-canvas {
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.pdfa-author-canvas {
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  mix-blend-mode: multiply;
}
.pdfa-draw-canvas {
  position: absolute;
  top: 0; left: 0;
  z-index: 3;
}
.pdfa-text-layer {
  position: absolute;
  text-align: initial;
  top: 0; left: 0;
  overflow: hidden;
  opacity: 0.25;
  line-height: 1;
  -webkit-text-size-adjust: none;
  -moz-text-size-adjust: none;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  z-index: 1;
  pointer-events: none;
}
.pdfa-text-layer :is(span, br) {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.pdfa-text-layer span.markedContent {
  top: 0;
  height: 0;
}
.pdfa-text-layer br {
  display: none;
}
.pdfa-text-layer ::-moz-selection {
  background: rgba(0, 100, 200, 0.6);
}
.pdfa-text-layer ::selection {
  background: rgba(0, 100, 200, 0.6);
}
.pdfa-text-layer br::selection {
  background: transparent;
}
.pdfa-text-layer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: -1;
  cursor: default;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
.pdfa-hl-swatch {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15);
}

/* ── Presence avatars ────────────────────────────────────────────────── */
.presence-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.presence-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  cursor: default;
  position: relative;
  border: 2px solid var(--bg);
  letter-spacing: 0.5px;
  transition: transform 0.15s;
}
.presence-avatar:hover {
  transform: scale(1.15);
  z-index: 2;
}
.presence-bar .presence-avatar + .presence-avatar {
  margin-left: -8px;
}
.header-right .presence-bar {
  padding: 0 8px;
}
.header-right .presence-avatar {
  border-color: var(--bg-dark);
}
.course-title-right {
  display: flex;
  align-items: center;
}
.course-title-sep {
  height: 28px;
  margin: 0 8px;
}

/* ── Mind map ──────────────────────────────────────────────────────────── */
.mindmap-title-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 6px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mindmap-title-bar i {
  color: var(--primary);
  font-size: 15px;
}
.mindmap-title-input {
  flex: 0 1 auto;
  min-width: 0;          /* autorise la réduction → ellipsis */
  max-width: 360px;      /* borne haute pour garder les onglets visibles */
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Onglets du ruban placés à droite du titre de la carte mentale */
.mindmap-title-bar .mm-title-tabs {
  margin-left: auto;
  flex-shrink: 0;          /* les onglets ne se compriment jamais */
  flex-wrap: nowrap;
  border-bottom: none;
  background: transparent;
  position: static;
  align-self: stretch;
}
.mindmap-title-input:focus {
  background: var(--bg-hover, #f5f5f5);
}
.mindmap-title-input[readonly] {
  cursor: default;
}
.mindmap-toolbar {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mm-tab-content {
  display: flex;
  align-items: center;
  padding: 4px 12px;
  gap: 2px;
  flex-wrap: wrap;
}
.mindmap-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.mindmap-toolbar-btn:hover {
  background: #f0f0f0;
}
.mindmap-toolbar-btn.is-active {
  background: var(--primary);
  color: #fff;
}
.mindmap-toolbar-btn.is-active i {
  color: #fff;
}
.mindmap-toolbar-btn i {
  font-size: 13px;
  color: var(--text-secondary);
}
.mindmap-container {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
  background: #fafafa;
}
/* Overlay « Chargement de la carte mentale… » : posé pendant que la requête
   API et l'init UI s'exécutent. Retiré dès que la carte est rendue. */
.mindmap-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(2px);
  z-index: 50;
  pointer-events: none;
}
.mindmap-loading-spinner i {
  font-size: 42px;
  color: var(--primary, #2563eb);
}
.mindmap-loading-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1e293b);
  letter-spacing: 0.02em;
}
.mm-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--primary);
  background: #fafafa;
  z-index: 10;
}
.mindmap-container svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.mindmap-container svg.is-panning {
  cursor: grabbing;
}
.course-content:has(.mindmap-container) {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-content:has(.mindmap-container) {
  padding: 0;
  max-width: none;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.page-body:has(.mindmap-container) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.course-content.pe-fullscreen {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: 0 !important;
}

/* ── Mind Map panels ───────────────────────────────────────── */
.mindmap-toolbar {
  position: relative;
  flex-wrap: wrap;
}
.mindmap-toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.mindmap-toolbar-btn {
  flex-direction: column;
  gap: 2px;
  min-width: 44px;
}
.mindmap-toolbar-btn span:last-child {
  font-size: 9px;
  color: inherit;
  opacity: 0.8;
}
/* Panel (dropdown) */
.mm-panel {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 360px;
}
.mm-panel-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mm-panel-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Color swatches */
.mm-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s;
}
.mm-swatch:hover { transform: scale(1.2); }
.mm-swatch-reset {
  background: #fff !important;
  border: 1px solid #ccc !important;
  color: #999;
  font-size: 11px;
  line-height: 1;
}
/* Notes panel */
.mm-notes-panel {
  display: none;
  flex-direction: column;
  background: #fffdf0;
  border-bottom: 1px solid #e8e0b0;
  padding: 6px 12px;
  flex-shrink: 0;
  max-height: 140px;
  /* Overlay en haut de la carte : ne décale pas le contenu vers le bas */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}
.mm-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #7a6820;
  margin-bottom: 4px;
}
.mm-notes-header button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #999;
  padding: 0 2px;
}
.mm-notes-area {
  flex: 1;
  border: 1px solid #e0d880;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: sans-serif;
  resize: none;
  background: #fffff8;
  color: #333;
  min-height: 60px;
}
.mm-notes-area:focus { outline: none; border-color: #c0b820; }
/* Tuile d'aperçu de note (survol d'un nœud annoté) — taille auto selon le contenu */
.mm-note-tip {
  position: absolute;
  display: none;
  z-index: 50;
  max-width: 320px;
  padding: 8px 12px;
  background: #fffdf0;
  color: #4a4020;
  border: 1px solid #e8d98a;
  border-left: 3px solid #f0a500;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  pointer-events: none;
}
/* Save indicator */
.mm-save-indicator {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 6px;
  min-width: 90px;
}

.page-body {
  flex: 1;
}

.app-content {
  padding: 24px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.page-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 6px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: var(--text-light);
  z-index: 50;
}

.page-footer-link {
  color: var(--text-light);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.page-footer-link:hover {
  color: var(--primary);
}

.coming-soon-text {
  color: var(--text-secondary);
  font-size: 15px;
  padding-top: 8px;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.header-left {
  display: flex;
  align-items: center;
}

.header-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: var(--text-inverse);
  font-size: 20px;
  border-radius: var(--radius);
  margin-right: 12px;
  -webkit-tap-highlight-color: transparent;
}

.header-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-logo {
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 32px;
  width: auto;
}

.header-logo span {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-inverse);
  margin-left: 10px;
  letter-spacing: -0.3px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Live header icon */
.header-live-icon {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: transparent; color: #64748b; cursor: default;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; margin-right: 4px; transition: all .2s;
  opacity: 0.4;
}
.header-live-icon.header-live-active {
  color: #ef4444; cursor: pointer; opacity: 1;
  animation: live-pulse 1.5s ease-in-out infinite;
}
.header-live-icon.header-live-active:hover { background: rgba(239,68,68,.15); }

.header-user {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--text-inverse);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.header-user:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-inverse);
  margin-right: 8px;
}

.header-username {
  font-size: 14px;
  font-weight: 500;
}

.header-logout,
.header-theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  border-radius: var(--radius-md);
  margin-left: 4px;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              transform var(--duration-base) var(--ease-spring);
}

.header-logout:hover {
  color: var(--error);
  background: rgba(255, 255, 255, 0.1);
}

.header-theme-toggle:hover {
  color: var(--accent-light);
  background: rgba(255, 255, 255, 0.1);
}
.header-theme-toggle:active {
  transform: rotate(180deg);
}

/* ─── Notification bell ──────────────────────────────── */
.notif-bell-wrap { position: relative; }
.notif-bell-btn {
  background: none; border: none; color: rgba(255,255,255,0.85); font-size: 16px;
  cursor: pointer; padding: 6px 8px; border-radius: 6px; position: relative;
}
.notif-bell-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.notif-bell-badge {
  position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 8px; text-align: center; padding: 0 4px;
}
.notif-hidden { display: none !important; }
.notif-dropdown {
  width: 340px; max-height: 440px;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  overflow: hidden;
}
.notif-dd-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--gray-200);
}
.notif-dd-title { font-weight: 600; font-size: 13px; color: var(--gray-800); }
.notif-dd-markall {
  background: none; border: none; color: var(--primary, #3b82f6); font-size: 11px;
  cursor: pointer; font-weight: 500;
}
.notif-dd-markall:hover { text-decoration: underline; color: var(--primary); }
.notif-dd-actions { display: flex; gap: 8px; align-items: center; }
.notif-dd-clearall { color: var(--gray-400); }
.notif-dd-clearall:hover { color: var(--primary) !important; }
.notif-dd-list { overflow-y: auto; max-height: 400px; }
.notif-dd-item {
  display: flex; gap: 8px; padding: 6px 10px; cursor: pointer;
  border-bottom: 1px solid var(--gray-100); transition: background 0.15s;
  align-items: flex-start; position: relative;
}
.notif-dd-item:hover { background: var(--gray-50); }
.notif-unread { background: #eff6ff; }

/* Left column: icon + time */
.notif-dd-left { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; width: 32px; }
.notif-dd-icon {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}

/* Body */
.notif-dd-body { flex: 1; min-width: 0; }
.notif-dd-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  font-size: 8px; font-weight: 700; color: #fff; letter-spacing: 0.03em;
}
.notif-dd-line1 { display: flex; align-items: center; gap: 5px; margin-bottom: 1px; }
.notif-dd-titre { font-size: 12px; font-weight: 600; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.notif-dd-detail { font-size: 11px; color: var(--gray-500); line-height: 1.3; }
.notif-dd-time { font-size: 9px; color: #b0b5bd; white-space: nowrap; text-align: center; }
.notif-action-link { margin-top: 4px; background: none; border: 1px solid var(--border); color: var(--primary); font-size: 11px; padding: 2px 8px; border-radius: 4px; cursor: pointer; }
.notif-action-link:hover { background: var(--primary); color: #fff; }
.notif-action-link i { margin-right: 4px; }

/* Delete button */
.notif-dd-del {
  background: none; border: none; color: var(--gray-300); cursor: pointer;
  font-size: 11px; padding: 3px; border-radius: 4px; flex-shrink: 0;
  opacity: 0; transition: opacity 0.15s;
}
.notif-dd-item:hover .notif-dd-del { opacity: 1; }
.notif-dd-del:hover { color: #ef4444; background: #fef2f2; }

/* Permission pills */
.notif-perms { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.notif-perm-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: 500;
  white-space: nowrap;
}
.notif-perm-on  { background: #ecfdf5; color: #059669; }
.notif-perm-off { background: var(--gray-100); color: var(--gray-400); text-decoration: line-through; }
.notif-perm-pill .fa-check { font-size: 8px; }
.notif-perm-pill .fa-xmark { font-size: 8px; }
.notif-perms-revoked {
  font-size: 11px; color: #dc2626; margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}

.notif-dd-empty { padding: 16px 12px; text-align: center; color: var(--gray-400); font-size: 12px; }
@media (max-width: 420px) { .notif-dropdown { width: calc(100vw - 20px); right: -40px; } }

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 90;
  transform: translateX(-100%);
  transition: transform var(--transition);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 80;
}

.sidebar-overlay.visible {
  display: block;
}

.sidebar-nav {
  padding: 16px 0;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.35);
  padding: 12px 12px 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-inverse);
}

.sidebar-item.active {
  background: var(--primary);
  color: var(--text-inverse);
}

.sidebar-item i {
  width: 20px;
  margin-right: 12px;
  text-align: center;
  font-size: 15px;
}

/* Collapsed sidebar — single back arrow */
.sidebar.sidebar-collapsed { width: 52px; overflow: hidden; }
.sidebar.sidebar-collapsed > *:not(.sidebar-back-btn):not(.sidebar-validate-btn):not(.sidebar-live-btn) { display: none; }
.sidebar-back-btn {
  display: none; width: 100%; padding: 16px 0;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.7); font-size: 20px; text-align: center;
  transition: color 0.15s;
}
.sidebar-back-btn:hover { color: #fff; }
.sidebar.sidebar-collapsed .sidebar-back-btn { display: block; }
.sidebar-validate-btn {
  display: none; width: 100%; padding: 14px 0;
  background: none; border: none; cursor: pointer;
  color: #56ba62; font-size: 20px; text-align: center;
  transition: color 0.15s;
}
.sidebar-validate-btn:hover { color: #86efac; }
.sidebar.sidebar-collapsed .sidebar-validate-btn { display: block; }
/* Live button — bottom of course sidebar */
.sidebar-live-btn {
  margin-top: auto; padding: 12px 14px;
  background: var(--primary); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  transition: background 0.15s;
}
.sidebar-live-btn:hover { background: var(--primary-dark); }
.sidebar-live-btn i { font-size: 15px; }
.sidebar.sidebar-collapsed .sidebar-live-btn {
  display: flex; justify-content: center; padding: 12px 0;
}
.sidebar.sidebar-collapsed .sidebar-live-btn span { display: none; }
/* Live session picker row */
.live-session-pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; border-radius: 6px;
  font-size: 14px; transition: background 0.15s;
}
.live-session-pick-row:hover { background: var(--bg-hover); }
.live-session-pick-row i { color: var(--primary); }
@media (min-width: 1024px) {
  .app-main.sidebar-collapsed-margin { margin-left: 52px; }
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #143d5e 50%, var(--primary-dark) 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 48px;
  margin: 0 auto 12px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--bg-dark);
}

.login-logo p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-group {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 120px;
  min-width: 120px;
  flex-shrink: 0;
  white-space: normal;
  line-height: 1.4;
}

.form-group .ff-input,
.form-group .ff-select-wrap,
.form-group input,
.form-group select,
.form-group textarea {
  flex: 1;
  min-width: 0;
}

@media (orientation: portrait), (max-width: 600px) {
  .form-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .form-label {
    min-width: unset;
  }
}

/* ───────────────────────────────────────────────────────────────────
   Système de formulaire unifié
   - .form-input  : input du login/inscription (taille standard)
   - .bg-input, .bg-select : inputs du business game et autres (idem)
   - Toutes ces classes partagent désormais paddings, borders, focus
   - Variantes : .form-input--sm pour les formats compacts
   ─────────────────────────────────────────────────────────────────── */
.form-input,
.bg-input,
.bg-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.bg-input:focus,
.bg-select:focus {
  border-color: var(--primary);
  box-shadow: var(--ring-primary);
  outline: none;
}

.form-input::placeholder,
.bg-input::placeholder {
  color: var(--text-light);
}

/* État erreur (cohérent entre tous les inputs) */
.form-input.is-error,
.bg-input.is-error,
.bg-select.is-error,
.form-input[aria-invalid="true"],
.bg-input[aria-invalid="true"],
.bg-select[aria-invalid="true"] {
  border-color: var(--error);
}
.form-input.is-error:focus,
.bg-input.is-error:focus,
.bg-select.is-error:focus,
.form-input[aria-invalid="true"]:focus,
.bg-input[aria-invalid="true"]:focus,
.bg-select[aria-invalid="true"]:focus {
  box-shadow: var(--ring-error);
}

/* Variante compacte (modales avec beaucoup de champs) */
.form-input--sm,
.bg-input--sm {
  padding: 6px 10px;
  font-size: 13px;
  border-width: 1px;
}

/* Désactivé */
.form-input:disabled,
.bg-input:disabled,
.bg-select:disabled {
  background: var(--gray-50);
  color: var(--gray-400);
  cursor: not-allowed;
}

.form-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.form-error.visible {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  cursor: pointer;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-primary);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Variante pleine largeur — opt-in via classe dédiée (au lieu d'imposer 100% à btn-primary) */
.btn-block {
  width: 100%;
}

/* ───── Variante : Primary (action principale) ───── */
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-primary);
}

/* ───── Variante : Secondary (action alternative) ───── */
.btn-secondary {
  background: var(--secondary);
  color: var(--text-inverse);
  border-color: var(--secondary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--secondary-dark);
  border-color: var(--secondary-dark);
}
.btn-secondary:focus-visible {
  box-shadow: var(--ring-secondary);
}

/* ───── Variante : Tertiary (action neutre, alternative au "secondary" gris) ───── */
.btn-tertiary {
  background: var(--gray-100);
  color: var(--gray-800);
  border-color: var(--gray-200);
}
.btn-tertiary:hover:not(:disabled) {
  background: var(--gray-200);
  border-color: var(--gray-300);
}

/* ───── Variante : Ghost (action discrète, fond transparent) ───── */
.btn-ghost {
  background: transparent;
  color: var(--gray-700);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-900);
}

/* ───── Variante : Danger (vrai rouge, pour suppression / actions destructives) ───── */
.btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: var(--shadow-error);
}
.btn-danger:focus-visible {
  box-shadow: var(--ring-error);
}

/* Compat : utilisations historiques de .btn-primary qui assumaient width:100%
   (formulaires login, signup, modales). On rétablit le full-width uniquement
   dans ces contextes connus pour ne pas casser visuellement. */
.login-form .btn-primary,
.bg-setup-form .btn-primary {
  width: 100%;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
}

.login-footer a {
  font-size: 13px;
  color: var(--text-secondary);
}

.login-footer a:hover {
  color: var(--primary);
}

.login-register-link {
  display: block;
  margin-top: 12px;
  font-weight: 500;
  color: var(--secondary) !important;
}

.login-register-link:hover {
  color: var(--secondary-dark) !important;
}

.login-alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}

.login-alert.visible {
  display: block;
}

.login-alert.error {
  background: #fef2f2;
  color: var(--error);
  border: 1px solid #fecaca;
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-welcome {
  margin-bottom: 32px;
}

.dashboard-welcome h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.dashboard-welcome p {
  color: var(--text-secondary);
  font-size: 15px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ───────────────────────────────────────────────────────────────────
   Système de cards à 4 niveaux d'élévation
   - .card           : neutre, ombre légère, hover lift (par défaut)
   - .card--flat     : sans ombre, juste fond, pour grilles denses
   - .card--bordered : bord net, pas d'ombre, plus formel
   - .card--elevated : ombre marquée, pour éléments importants
   - .card--glass    : effet verre, pour overlays sur image/dégradé
   ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4);
  transition: box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Variante plate — pour les grilles denses où l'ombre alourdit */
.card--flat {
  box-shadow: none;
  background: var(--gray-50);
}
.card--flat:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transform: none;
}

/* Variante bordée — pas d'ombre, bord net (style Notion/Linear) */
.card--bordered {
  box-shadow: none;
  border: 1px solid var(--gray-200);
}
.card--bordered:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-xs);
  transform: none;
}

/* Variante élevée — pour CTA importants, modales, parties critiques */
.card--elevated {
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
}
.card--elevated:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

/* Variante glass — pour overlays sur images/gradients (parcours, visio) */
.card--glass {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  backdrop-filter: saturate(150%) blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-md);
}

/* Variante "interactive" — clic visible (transformation tactile) */
.card.is-interactive {
  cursor: pointer;
}
.card.is-interactive:active {
  transform: scale(0.99);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
}

.card-icon.blue { background: rgba(48, 176, 243, 0.12); color: var(--secondary); }
.card-icon.pink { background: rgba(207, 21, 120, 0.12); color: var(--primary); }
.card-icon.orange { background: rgba(242, 145, 0, 0.12); color: var(--accent); }
.card-icon.green { background: rgba(73, 191, 103, 0.12); color: var(--success); }

.card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.card p {
  font-size: 12px;
  color: var(--text-secondary);
}

.card-stat {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
}

/* ============================================
   STUDENT COURSES
   ============================================ */

.student-courses {
  margin-top: 8px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.empty-state {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Cartes-cartouches de cours (refonte UX) ──────────────────────── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  padding: 4px 0;
}
@media (max-width: 1024px) {
  .course-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .course-grid { grid-template-columns: 1fr; }
}

.course-card {
  --course-color: #1a73e8;
  --prof-color: #888;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  position: relative;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
  overflow: hidden;
  cursor: pointer;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--course-color);
}

/* Bandeau image — affiché au lieu du bandeau coloré quand un image_path existe */
.course-card-image {
  aspect-ratio: 16/7;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--course-color) 10%, transparent),
    color-mix(in srgb, var(--course-color) 4%, transparent));
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.course-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--duration-slow) var(--ease-out);
}
.course-card:hover .course-card-image img {
  transform: scale(1.04);
}
.course-card-with-image .course-card-title-block {
  background: transparent;
  border-bottom: 1px solid var(--gray-100);
}

.course-card-band {
  height: 5px;
  background: var(--course-color);
  flex-shrink: 0;
}

/* (A) Bandeau "Ajouter une image" pour un cours possédé sans illustration */
.course-card-band-addimg {
  height: auto;
  aspect-ratio: 16/7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: color-mix(in srgb, var(--course-color) 75%, #333);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--course-color) 12%, transparent),
    color-mix(in srgb, var(--course-color) 5%, transparent));
  border-bottom: 1px dashed color-mix(in srgb, var(--course-color) 40%, transparent);
  transition: background var(--duration-fast) var(--ease-out);
}
.course-card-band-addimg i { font-size: 22px; opacity: 0.7; }
.course-card-band-addimg span { font-size: 12px; font-weight: 600; letter-spacing: 0.2px; }
.course-card-band-addimg:hover {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--course-color) 22%, transparent),
    color-mix(in srgb, var(--course-color) 10%, transparent));
}
.course-card-band-addimg:hover i { opacity: 1; }

/* (B) Coachmark : bandeau-conseil dismissable au-dessus de la grille */
.course-image-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef9c3 0%, #fefce8 100%);
  border: 1px solid #fde68a;
  border-radius: 10px;
  animation: tipSlideIn var(--duration-normal) var(--ease-out);
}
@keyframes tipSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.course-image-tip-icon { color: #d97706; font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.course-image-tip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.course-image-tip-text strong { font-size: 13px; color: #713f12; }
.course-image-tip-text span { font-size: 12px; color: #854d0e; line-height: 1.4; }
.course-image-tip-close { background: transparent; border: none; color: #a16207; cursor: pointer; padding: 4px; font-size: 14px; flex-shrink: 0; border-radius: 4px; }
.course-image-tip-close:hover { background: rgba(0,0,0,0.06); }

.course-card-title-block {
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--course-color) 8%, transparent) 0%, transparent 100%);
  border-bottom: 1px solid #f0f2f5;
}

.course-card-title-block h4 {
  font-size: 16px;
  font-weight: 700;
  color: #222;
  line-height: 1.25;
  margin: 0 0 4px 0;
  word-break: break-word;
}

.course-school {
  font-size: 12px;
  color: #5f6368;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.course-school i { width: 12px; font-size: 11px; color: #9aa0a6; }

.course-card-body {
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.course-prof-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.course-prof-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--prof-color);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.course-prof-name {
  font-size: 13px;
  color: #333;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
}

.course-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.course-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f3f4;
  color: #5f6368;
  white-space: nowrap;
}
.course-pill i { font-size: 10px; }

.pill-code {
  background: #f1f3f4;
  color: #444;
  font-family: 'Consolas', 'Monaco', monospace;
}
.pill-score {
  background: #e6f4ea;
  color: #137333;
}
.pill-students {
  background: #e8f0fe;
  color: #1967d2;
}
.pill-duration {
  background: #fef7e0;
  color: #b06000;
}

.course-score span {
  font-weight: 600;
  color: var(--secondary);
}

/* ============================================
   PROFILE
   ============================================ */

/* ── Profile page (sp-page layout) ─────────────────────────── */
.profile-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.profile-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
  max-width: 720px;
}
.profile-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-section-title i {
  color: var(--primary);
  font-size: 14px;
}
.profile-section-desc {
  font-size: 13px;
  color: var(--gray-500);
  margin: -8px 0 16px;
}
/* Avatar row */
.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
}
.profile-avatar-preview .avatar-wrap {
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.profile-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-avatar-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.profile-avatar-username {
  font-size: 13px;
  color: var(--text-light);
}
.profile-role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  width: fit-content;
}
.profile-role-badge.teacher {
  background: #dbeafe;
  color: #1e40af;
}
.profile-role-badge.student {
  background: var(--success-bg);
  color: var(--success-fg);
}
/* Form grid — 2 columns landscape, 1 column portrait */
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.profile-field-full {
  grid-column: 1 / -1;
}
.profile-field {}
.profile-field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.profile-field-required {
  color: var(--error);
}
.form-readonly {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 15px;
}
.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}
.profile-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.profile-actions .btn {
  width: auto;
  min-height: 32px;
  padding: 6px 14px;
  font-size: 13px;
}
.profile-msg {
  font-size: 13px;
  font-weight: 500;
}
.profile-msg.success {
  color: var(--success);
}
.profile-msg.error {
  color: var(--error);
}
/* ── Password strength bar ──────────────────────────── */
.profile-pwd-strength {
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-pwd-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  flex: 1;
  max-width: 200px;
  position: relative;
  overflow: hidden;
}
.profile-pwd-bar::after {
  content: '';
  position: absolute;
  left: 0; top: 0; height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
  width: 0;
}
.profile-pwd-bar.weak::after { width: 25%; background: #ef4444; }
.profile-pwd-bar.fair::after { width: 50%; background: #f59e0b; }
.profile-pwd-bar.good::after { width: 75%; background: #10b981; }
.profile-pwd-bar.strong::after { width: 100%; background: #059669; }
.profile-pwd-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
}
.profile-pwd-bar.weak + .profile-pwd-label { color: #ef4444; }
.profile-pwd-bar.fair + .profile-pwd-label { color: #f59e0b; }
.profile-pwd-bar.good + .profile-pwd-label { color: #10b981; }
.profile-pwd-bar.strong + .profile-pwd-label { color: #059669; }
/* ── Danger zone ───────────────────────────────────── */
.profile-danger {
  border: 1.5px solid #fca5a5;
  background: #fef2f2;
}
.profile-danger .profile-section-title {
  color: #b91c1c;
}
.profile-danger .profile-section-title i {
  color: #ef4444;
}
.profile-danger .profile-section-desc {
  color: var(--error-fg);
}
.profile-danger-icon {
  text-align: center;
  margin-bottom: 8px;
}
.profile-danger-icon i {
  font-size: 36px;
  color: #f59e0b;
}
.profile-danger-text {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.5;
}
.profile-danger-err {
  font-size: 12px;
  color: #ef4444;
  margin-top: 6px;
  min-height: 18px;
}
/* Avatar photo */
.profile-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.profile-avatar-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
/* Customize button */
.profile-avatar-customize-btn {
  margin-top: 4px;
  width: auto;
  min-height: 28px;
  padding: 4px 12px;
  font-size: 12px;
}
/* ── Avatar customization panel ────────���────────────── */
.profile-avatar-panel.hidden { display: none; }
.profile-avatar-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.avp-live {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.avp-live-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.avp-live-avatar svg { width: 100%; height: 100%; }
.avp-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.avp-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avp-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 100px;
  flex-shrink: 0;
}
.avp-swatches, .avp-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.avp-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  padding: 0;
}
.avp-swatch:hover { transform: scale(1.15); }
.avp-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(207,21,120,0.25); }
.avp-option {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  transition: border-color 0.15s;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.avp-option:hover { border-color: var(--primary-light); }
.avp-option.active { border-color: var(--primary); background: rgba(207,21,120,0.06); }
.avp-option svg { display: block; }
.avp-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-light);
  transition: all 0.15s;
  padding: 0;
}
.avp-toggle:hover { border-color: var(--primary-light); }
.avp-toggle.active { border-color: var(--primary); background: rgba(207,21,120,0.06); color: var(--primary); }
.avp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.avp-actions .btn { width: auto; min-height: 32px; padding: 6px 14px; font-size: 13px; }
@media (max-width: 600px) {
  .profile-form-grid { grid-template-columns: 1fr; }
  .profile-avatar-row { flex-direction: column; text-align: center; }
  .profile-avatar-info { align-items: center; }
  .profile-body { padding: 16px; }
  .avp-row { flex-direction: column; align-items: flex-start; }
  .avp-label { min-width: auto; }
}

/* ============================================
   ENROLLMENT PANEL (inline)
   ============================================ */

.enroll-panel {
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.enroll-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  position: sticky;
  top: var(--header-height);
  background: var(--bg-card);
  padding: 4px 0;
  z-index: 10;
}

/* Dans la modale : filtres fixes hors du scroll, résultats scrollables */
.enroll-modal-body {
  overflow-y: hidden !important;
  padding: 0 !important;
  gap: 0 !important;
}

.enroll-modal-body .enroll-filters {
  position: static;
  flex-shrink: 0;
  margin-bottom: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #f8f9fb;
  z-index: auto;
}

.enroll-modal-body .enroll-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 12px;
  min-height: 0;
}

.enroll-filter {
  flex: 1;
  min-width: 140px;
}

.form-label-sm {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.form-input-sm {
  padding: 6px 8px;
  font-size: 13px;
}

.enroll-results {
  min-height: 40px;
}

.enroll-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.enroll-row:last-child {
  border-bottom: none;
}

.enroll-row:hover {
  background: rgba(48, 176, 243, 0.06);
}

.enroll-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.enroll-row-meta {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: right;
}

.enroll-row-add {
  font-size: 11px;
  color: var(--secondary);
  flex-shrink: 0;
}

.enroll-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 13px;
}

.enroll-confirm span {
  flex: 1;
}

.enroll-confirm-actions {
  display: flex;
  gap: 6px;
}

.enroll-confirm-actions .btn {
  padding: 4px 14px;
  font-size: 12px;
  min-height: 28px;
}

.enroll-confirm-yes {
  width: auto;
}

.enroll-confirm-no {
  background: var(--border);
  color: var(--text);
}

.enroll-confirm-no:hover {
  background: var(--text-light);
  color: var(--text-inverse);
}

/* FAB — mobile only (shown when empty on all sizes) */
.fab-enroll {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-inverse);
  font-size: 20px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(207, 21, 120, 0.4);
  transition: background var(--transition), transform var(--transition);
  z-index: 100;
}
.fab-enroll:hover {
  background: var(--primary-dark);
  transform: scale(1.08);
}
.fab-enroll:active {
  transform: scale(0.96);
}

/* FAB — mobile only */
@media (max-width: 767px) {
  .fab-enroll { display: flex; }
}

/* Tuile "+" — même taille que les cartes, bordure pointillée discrète */
.course-add-tile {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: transparent;
  border: 2px dashed #c1c4c8;
  border-radius: 10px;
  color: #5f6368;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 170px;
  transition: all .18s ease;
}
.course-add-tile i {
  font-size: 30px;
  color: #9aa0a6;
  transition: color .18s ease;
}
.course-add-tile:hover {
  border-color: var(--primary);
  border-style: solid;
  background: rgba(26, 115, 232, 0.04);
  color: var(--primary);
  transform: translateY(-2px);
}
.course-add-tile:hover i { color: var(--primary); }
@media (min-width: 768px) {
  .course-add-tile { display: flex; }
}
.student-courses.is-empty .course-add-tile {
  display: flex;
}
.student-courses.is-empty .fab-enroll {
  display: none;
}

/* ── New course form (modal) ──────────────────────────────────────── */
.new-course-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.new-course-row {
  display: flex;
  gap: 12px;
}
.new-course-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ============================================
   PAGE 404
   ============================================ */

.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
}

.page-404 h1 {
  font-size: 72px;
  font-weight: 700;
  color: var(--border);
}

.page-404 p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.page-404 a {
  margin-top: 24px;
  display: inline-flex;
}

/* ============================================
   SPINNER
   ============================================ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE: TABLET (768px+)
   ============================================ */

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Course grid : auto-fill prend le relais — règle conservée pour fallback */

  .app-content {
    padding: 32px;
  }
}

/* ============================================
   RESPONSIVE: DESKTOP (1024px+)
   ============================================ */

@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none !important;
  }

  .app-main {
    margin-left: var(--sidebar-width);
  }

  .header {
    padding-left: 16px;
  }

  .header-toggle {
    display: none;
  }

  .header-logo {
    display: flex;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Course grid : auto-fill remplit la place dispo (jusqu'à 4-5 cols sur grand écran) */

  .dashboard-welcome h2 {
    font-size: 28px;
  }
}

/* ============================================
   SAFARI / iOS FIXES
   ============================================ */

@supports (padding: env(safe-area-inset-bottom)) {
  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-content {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* Fix Safari 100vh issue */
@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}

/* ── Fenêtre modale (Modal class) ─────────────────────────────────── */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
}

.win {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  max-width: 95vw;
  max-height: 90vh;
}

.win-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 14px;
  background: linear-gradient(to bottom, #dce8f8, #c8d9ef);
  border-bottom: 1px solid #a8bedb;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  border-radius: 6px 6px 0 0;
}

.win-title {
  font-size: 0.84em;
  font-weight: 600;
  color: #1a3a5c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-close {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  color: #4a6080;
  font-size: 0.75em;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.win-close:hover {
  background: #c0392b;
  color: #fff;
  border-color: #a93226;
}

/* Confirmation modal — standard layout (icon left + text right) */
.confirm-delete-body {
  display: flex; flex-direction: row; align-items: stretch; gap: 16px;
}
.confirm-delete-icon {
  display: flex; align-items: center; justify-content: center;
  min-width: 48px; padding: 0 4px;
  background: #fff7ed; border-radius: 8px; flex-shrink: 0;
}
.confirm-delete-icon i {
  font-size: 24px; color: #f59e0b;
}
.confirm-delete-text {
  font-size: 14px; line-height: 1.6; color: #333; flex: 1;
}

.win-body {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.win-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid #e0e0e0;
  background: #f7f8fa;
  flex-shrink: 0;
  border-radius: 0 0 6px 6px;
}

.win-footer .btn {
  width: auto;
  min-width: 90px;
  min-height: 32px;
  padding: 5px 16px;
  font-size: 0.82em;
  font-weight: 500;
}

/* ── Modal — Mobile portrait (bottom sheet) ── */
@media (max-width: 600px) {
  .win-overlay {
    align-items: flex-end;
    justify-content: stretch;
  }
  .win {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,.2);
    animation: win-slide-up .25s ease-out;
    /* Override any inline left/top/width from JS */
    left: 0 !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    position: fixed !important;
  }
  .win-header {
    border-radius: 16px 16px 0 0;
    cursor: default;
    padding: 12px 14px;
    position: relative;
  }
  .win-header::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: #b0becc; border-radius: 2px;
    position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  }
  .win-body {
    padding: 14px 16px;
  }
  .win-footer {
    border-radius: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .win-footer .btn {
    min-height: 40px;
    font-size: 14px;
    flex: 1;
  }
  /* Disable resize handles on mobile */
  .win-rz { display: none !important; }
}

@keyframes win-slide-up {
  from { transform: translateY(100%); } to { transform: none; }
}

/* MindmapModal — mode cards */
.mm-modal-form { display: flex; flex-direction: column; gap: 12px; }
.mm-modal-modes { display: flex; gap: 10px; }
.mm-mode-card {
  flex: 1; padding: 12px; border: 2px solid var(--gray-200); border-radius: 10px;
  cursor: pointer; transition: all .15s; display: flex; gap: 10px; align-items: flex-start;
}
.mm-mode-card:hover { border-color: #93c5fd; background: #f8fafc; }
.mm-mode-card.mm-mode-active { border-color: var(--primary, #2980b9); background: #eff6ff; }
.mm-mode-icon { font-size: 20px; color: var(--gray-500); flex-shrink: 0; width: 28px; text-align: center; padding-top: 2px; }
.mm-mode-card.mm-mode-active .mm-mode-icon { color: var(--primary, #2980b9); }
.mm-mode-info { min-width: 0; }
.mm-mode-title { font-size: 13px; font-weight: 600; color: #1a1a2e; margin-bottom: 2px; }
.mm-mode-desc { font-size: 11px; color: var(--gray-500); line-height: 1.4; }
.mm-mode-card.mm-mode-active .mm-mode-title { color: var(--primary, #2980b9); }
.mm-modal-exo-params { padding-top: 8px; border-top: 1px solid #eaecf0; display: flex; flex-direction: column; gap: 10px; }

.win-rz {
  position: absolute;
  z-index: 10;
}

.win-rz-n  { top: 0;    left: 6px;    right: 6px;   height: 4px; cursor: n-resize; }
.win-rz-s  { bottom: 0; left: 6px;    right: 6px;   height: 4px; cursor: s-resize; }
.win-rz-e  { right: 0;  top: 6px;     bottom: 6px;  width:  4px; cursor: e-resize; }
.win-rz-w  { left: 0;   top: 6px;     bottom: 6px;  width:  4px; cursor: w-resize; }
.win-rz-ne { top: 0;    right: 0;  width: 10px; height: 10px; cursor: ne-resize; }
.win-rz-nw { top: 0;    left: 0;   width: 10px; height: 10px; cursor: nw-resize; }
.win-rz-se { bottom: 0; right: 0;  width: 10px; height: 10px; cursor: se-resize; }
.win-rz-sw { bottom: 0; left: 0;   width: 10px; height: 10px; cursor: sw-resize; }

.win-btn {
  padding: 6px 16px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  background: #f0f0f0;
  color: #444;
  font-size: 0.82em;
  cursor: pointer;
  transition: background 0.15s;
}

.win-btn:hover {
  background: #e2e2e2;
}

.win-btn-primary {
  background: #2e75b6;
  border-color: #2567a0;
  color: #fff;
  font-weight: 600;
}

.win-btn-primary:hover:not(:disabled) {
  background: #1d5a8c;
}

.win-btn-primary:disabled {
  background: #a0b8d8;
  border-color: #8daecf;
  cursor: not-allowed;
}

/* ── Actions des cartes : en pied de carte, apparaissent au hover ─── */
.course-card-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 3;
}
.course-card:hover .course-card-actions { opacity: 1; }
.course-card-actions button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 1px solid #d0d3d6;
  color: #5f6368;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color .12s, background .12s, border-color .12s;
}
.course-card-actions button:hover { background: #fff; }
.course-card-actions .course-card-delete:hover    { color: var(--error); border-color: var(--error); }
.course-card-actions .course-card-share:hover     { color: var(--secondary); border-color: var(--secondary); }
.course-card-actions .course-card-image-btn:hover { color: var(--primary); border-color: var(--primary); }
.course-card-actions .course-card-edit:hover      { color: var(--accent); border-color: var(--accent); }

/* Aperçu d'illustration dans la modale création de cours */
.nc-image-preview {
  margin: 6px 0 8px;
  aspect-ratio: 16/9;
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nc-image-preview img { width: 100%; height: 100%; object-fit: contain; }
.nc-image-empty {
  color: var(--gray-400);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Pastille "partagé" en coin haut-droit (icône seule + tooltip natif au survol) */
.course-shared-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: #fef7e0;
  color: #b06000;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: help;
  transition: opacity .15s;
}
.course-shared-badge i { font-size: 11px; }
.course-card-shared { /* plus de bord gauche, on a le bandeau coloré + ruban */ }

/* Confirmation de suppression (overlay sur la carte) */

.course-card-confirm {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  z-index: 5;
}

.course-card-confirm-actions {
  display: flex;
  gap: 8px;
}

.course-card-confirm-actions .btn {
  padding: 5px 14px;
  font-size: 12px;
  min-height: 28px;
}

.course-card-confirm-no {
  background: var(--border);
  color: var(--text);
}

.course-card-confirm-no:hover {
  background: var(--text-light);
  color: var(--text-inverse);
}

/* ── Sharing modal ───────────────────────────────────────────────────── */
.sharing-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.sharing-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sharing-filter {
  flex: 1 1 140px;
}

.sharing-search {
  width: 100%;
}

.sharing-teachers {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
}

.sharing-loading {
  text-align: center;
  color: var(--text-light);
  padding: 32px 16px;
  font-size: 14px;
}

.sharing-row {
  display: grid;
  grid-template-columns: 1fr 72px 72px 72px;
  align-items: center;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}

.sharing-row:last-child {
  border-bottom: none;
}

.sharing-row-header {
  background: var(--bg-subtle, #f5f7fa);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sharing-row-active {
  background: rgba(11, 62, 102, 0.04);
}

.sharing-name {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sharing-col-label {
  text-align: center;
  font-size: 11px;
}

.sharing-check {
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.sharing-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.sharing-footer-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── InfoDialog ──────────────────────────────────────────────────────── */
.idlg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.idlg-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 32px 24px;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.idlg-icon {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  flex-shrink: 0;
}

/* Row: icon + content side by side */
.idlg-box {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
}

.idlg-icon {
  font-size: 32px;
  color: var(--secondary);
  margin-right: 16px;
  margin-top: 2px;
}

.idlg-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.idlg-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.idlg-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}

.idlg-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.idlg-btn {
  width: auto;
  min-width: 80px;
  padding: 10px 20px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ── Course sidebar layout ───────────────────────────────────────────── */
.course-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.course-sb-header {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.course-sidebar-back {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.course-sb-title {
  padding: 10px 20px 8px;
}

.course-sb-back-slot:empty {
  display: none;
}

/* ── Répertoires list in sidebar ────────────────────────────────────── */
.rep-back {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  background: rgba(255,255,255,0.06);
  border-top: 1px solid rgba(255,255,255,0.08);
  transition: background var(--transition), color var(--transition);
}

.rep-back:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.rep-back-icon {
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 2px;
}

.rep-chevron {
  margin-left: auto;
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
  margin-top: 2px;
}

.rep-list {
  list-style: none;
  padding: 6px 0;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.rep-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 20px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition), color var(--transition);
  border-left: 2px solid transparent;
  position: relative;
}

.rep-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.rep-item.rep-root {
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.rep-item.rep-dragging {
  visibility: hidden;
}

.rep-item.rep-dragover {
  border-left-color: var(--secondary);
  background: rgba(48, 176, 243, 0.12);
}

.rep-handle {
  cursor: grab;
  color: rgba(255,255,255,0.25);
  font-size: 11px;
  flex-shrink: 0;
  margin-top: -2px;
  transition: color var(--transition);
}

.rep-handle:hover {
  color: rgba(255,255,255,0.6);
}

.rep-folder-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.rep-folder-icon {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 2px;
  transition: opacity var(--transition), color var(--transition);
}

.rep-folder-icon.rep-folder-hidden {
  opacity: 0.4;
  color: rgba(255,255,255,0.4);
}
.rep-parcours .rep-folder-icon {
  color: var(--accent);
}

.rep-hidden-badge {
  font-size: 8px;
  position: absolute;
  bottom: -2px;
  right: -5px;
  color: rgba(255,255,255,0.5);
}

.rep-item-hidden > .rep-name,
.rep-item-hidden .rep-name {
  opacity: 0.5;
  font-style: italic;
}

.rep-name {
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  flex: 1;
}

.rep-name-empty {
  opacity: 0.45;
  font-style: italic;
  cursor: text;
}

/* ── Rep inline rename ───────────────────────────────────────────────── */
.rep-rename-input {
  display: block;
  flex: 1;          /* prend la place du .rep-name dans le flex du li */
  width: 0;         /* flex: 1 gère la largeur, width: 0 évite le débordement */
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.35);
  color: inherit;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  padding: 0;
  margin: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap;
  border-radius: 0;
  box-sizing: border-box;
}

.rep-rename-input:focus {
  color: #fff;
  border-bottom-color: var(--secondary);
  background: rgba(255,255,255,0.05);
}

/* ── Rep settings form (modal) ────────────────────────────────────── */
.rep-settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rep-settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rep-settings-chk-label {
  margin: 0;
  cursor: pointer;
}

/* ── Rep add button (teacher only) ──────────────────────────────────── */
.rep-add-btn {
  justify-content: center;
  gap: 6px;
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px dashed rgba(255,255,255,0.35);
  border-radius: 6px;
  margin: 6px 8px 0;
  padding: 7px 10px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  draggable: false;
}
.rep-add-btn:hover {
  color: #fff;
  border-color: var(--secondary);
  background: rgba(255,255,255,0.08);
}
.rep-add-icon {
  font-size: 12px;
}
.rep-new-item {
  padding: 4px 8px;
}
.rep-new-item .rep-rename-input {
  width: 100%;
  flex: none;
}

/* ── Rep kebab menu (teacher only) ───────────────────────────────────── */
.rep-kebab {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.rep-item:hover .rep-kebab,
.rep-kebab.is-open {
  opacity: 1;
}
.rep-kebab:hover,
.rep-kebab.is-open {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
}

.rep-menu {
  position: absolute;
  right: 4px;
  top: 100%;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.rep-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  transition: background 0.12s;
}
.rep-menu-item:hover {
  background: rgba(255,255,255,0.08);
}
.rep-menu-item i {
  width: 16px;
  text-align: center;
  font-size: 12px;
  opacity: 0.6;
}
.rep-menu-danger {
  color: #e74c3c;
}
.rep-menu-danger i {
  opacity: 0.8;
}

/* ── Rep inline confirmation ─────────────────────────────────────────── */
.rep-confirm {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  left: 28px;
  background: rgba(15, 35, 55, 0.97);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 4px;
  z-index: 5;
  animation: rep-confirm-in 0.12s ease;
}

@keyframes rep-confirm-in {
  from { opacity: 0; transform: translateX(6px); }
  to   { opacity: 1; transform: translateX(0); }
}

.rep-confirm-label {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rep-confirm-yes,
.rep-confirm-no {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.rep-confirm-yes {
  color: #2ecc71;
}

.rep-confirm-yes:hover {
  background: rgba(46, 204, 113, 0.2);
}

.rep-confirm-no,
.rep-confirm-close {
  color: rgba(255,255,255,0.5);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 3px;
}

.rep-confirm-no:hover,
.rep-confirm-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.rep-confirm-warning {
  background: rgba(40, 20, 0, 0.97);
  gap: 8px;
}

.rep-confirm-warning i {
  color: #f39c12;
  font-size: 13px;
  flex-shrink: 0;
}

.rep-confirm-warning span {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  flex: 1;
}

/* ── Course content area ────────────────────────────────────────────── */
.course-content {
  padding: 24px;
}

.course-content-hint {
  color: var(--text-light);
  font-size: 13px;
  font-style: italic;
}

/* Course card clickable cursor */
.course-card {
  cursor: pointer;
}

/* ============================================
   PAGE EDITOR — Word-like collaborative editor
   ============================================ */
.pe-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
}

/* Viewer mode — student DST: page preview, no editor chrome */
.pe-viewer-mode > .pe-menubar,
.pe-viewer-mode > .pe-toolbar,
.pe-viewer-mode > .pe-table-toolbar,
.pe-viewer-mode > .pe-presentation-toolbar,
.pe-viewer-mode > .pe-exercise-toolbar,
.pe-viewer-mode > .pe-image-toolbar,
.pe-viewer-mode > .pe-ruler { display: none !important; }

/* Read-only mode: no caret, no toolbar (already stripped in JS), cursor default */
.pe-readonly .ProseMirror { caret-color: transparent; cursor: default; }
.pe-readonly .pe-exo-edit-btn,
.pe-readonly .pe-exo-delete-btn { display: none !important; }
.pe-viewer-mode { background: #d0d0d0; }
.pe-viewer-mode .pe-pages-container {
  background: #d0d0d0;
  overflow-y: auto;
  overflow-x: hidden;
}
.pe-viewer-mode .pe-page {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.08);
  margin: 20px auto;
  pointer-events: auto;
}
.pe-viewer-mode .ProseMirror { cursor: default; }
.pe-viewer-mode .ProseMirror ::selection { background: transparent; }
/* Keep exercise blocks interactive in viewer mode */
.pe-viewer-mode .pe-exercise-block { pointer-events: auto; cursor: default; }
.pe-viewer-mode .pe-exo-free-clickable { cursor: pointer; }

/* Zoom control in menubar */
.pe-zoom-control {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 0 8px;
  flex-shrink: 0;
}
.pe-zoom-btn {
  width: 24px; height: 24px;
  border: none; background: none; border-radius: 4px;
  cursor: pointer; color: #666; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.pe-zoom-btn:hover { background: #e8e8e8; color: #111; }
.pe-zoom-label {
  font-size: 12px; color: #555; min-width: 40px; text-align: center;
  cursor: pointer; padding: 2px 4px; border-radius: 3px;
  transition: background 0.12s;
}
.pe-zoom-label:hover { background: #e8e8e8; }

/* Menu bar */
.pe-menubar {
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 22;
  font-size: 13px;
  user-select: none;
}
/* Ribbon tabs in menu bar */
.pe-menubar-sep {
  width: 1px;
  height: 20px;
  background: #ccc;
  margin: 0 8px;
  flex-shrink: 0;
}
.pe-ribbon-tab {
  display: inline-block;
  padding: 6px 14px;
  cursor: pointer;
  color: #444;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.pe-ribbon-tab:hover {
  color: #111;
  background: #f0f0f0;
}
.pe-ribbon-tab.is-active {
  color: var(--primary, #cf1578);
  border-bottom-color: var(--primary, #cf1578);
  font-weight: 600;
}
.pe-ribbon-tab-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.pe-menu-item {
  position: relative;
}
.pe-menu-trigger {
  display: inline-block;
  padding: 6px 12px;
  cursor: pointer;
  color: #444;
  transition: background 0.12s;
}
.pe-menu-trigger:hover,
.pe-menu-item.is-open > .pe-menu-trigger {
  background: #e8e8e8;
  color: #111;
}
/* Dropdown */
.pe-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  padding: 4px 0;
  margin: 0;
  list-style: none;
  z-index: 50;
}
.pe-menu-item.is-open > .pe-dropdown {
  display: block;
}
.pe-dropdown-item {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  cursor: pointer;
  gap: 8px;
  color: #333;
  transition: background 0.1s;
  position: relative;
}
.pe-dropdown-item:hover {
  background: #f0f4ff;
}
.pe-dropdown-item.pe-dropdown-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.pe-dropdown-icon {
  width: 18px;
  text-align: center;
  font-size: 12px;
  color: #666;
  flex-shrink: 0;
}
.pe-dropdown-label {
  flex: 1;
  white-space: nowrap;
}
.pe-dropdown-shortcut {
  font-size: 11px;
  color: #999;
  margin-left: 16px;
  white-space: nowrap;
}
.pe-dropdown-arrow {
  font-size: 10px;
  color: #999;
  margin-left: 12px;
}
.pe-dropdown-sep {
  height: 1px;
  background: #e8e8e8;
  margin: 4px 0;
  list-style: none;
}
/* Sub-menus */
.pe-dropdown-sub {
  display: none;
  position: absolute;
  left: 100%;
  top: -4px;
}
.pe-dropdown-item.has-submenu:hover > .pe-dropdown-sub {
  display: block;
}

/* Fullscreen mode */
.pe-fullscreen {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9000;
  border-radius: 0;
}
.pe-fs-exit {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 9010;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pe-fs-exit:hover {
  background: rgba(0,0,0,0.8);
}

/* Print mode — #pe-print-root is a clone of the editor DOM */
@media print {
  /* Hide editor handles/overlays */
  .pe-table-col-handle, .pe-table-row-handle,
  .pe-table-add-handle, .pe-table-handle-menu,
  .pe-table-cell-handle, .pe-cell-hover-overlay {
    display: none !important;
  }
  /* Encarts: force background colors to print */
  #pe-print-root .pe-encart,
  #pe-print-root .pe-encart::before {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* Tables: separate borders for reliable printing */
  #pe-print-root table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  #pe-print-root td, #pe-print-root th {
    border: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
/* Page number inline node in editor */
.pe-page-number-node {
  display: inline-block;
  background: #e8f0fb;
  border: 1px solid #b8d0f0;
  border-radius: 3px;
  padding: 0 4px;
  color: #4a90d9;
  font-size: inherit;
  line-height: inherit;
  cursor: default;
  user-select: all;
}

/* Page number modal */
.pe-pn-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pe-pn-option-row label {
  font-size: 13px;
  color: #555;
}
.pe-pn-input {
  width: 56px;
  height: 28px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}
.pe-pn-info {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

/* Print content styles — reuse same pt/mm sizes as editor */
.pe-print-content {
  font-family: inherit;
  font-size: 12pt;
  line-height: 1.15;
  color: #000;
}
.pe-print-content p { margin: 0 0 6pt; }
.pe-print-content h1 { font-size: 22pt; font-weight: 700; margin: 12pt 0 4pt; }
.pe-print-content h2 { font-size: 16pt; font-weight: 600; margin: 10pt 0 4pt; }
.pe-print-content h3 { font-size: 14pt; font-weight: 600; margin: 8pt 0 4pt; }
.pe-print-content h4 { font-size: 12pt; font-weight: 700; margin: 6pt 0 3pt; }
.pe-print-content h5 { font-size: 11pt; font-weight: 600; margin: 6pt 0 3pt; }
.pe-print-content h6 { font-size: 10pt; font-weight: 600; margin: 6pt 0 3pt; font-style: italic; }
.pe-print-content ul,
.pe-print-content ol { padding-left: 18pt; margin: 4pt 0; }
.pe-print-content li {
  min-height: 1.15em;
  margin: 2pt 0;
}
.pe-print-content li p { margin: 0; min-height: 1.15em; }
.pe-print-content blockquote {
  border-left: 3px solid #0b3e66;
  padding-left: 12pt;
  margin: 6pt 0;
  font-style: italic;
}

/* Tables in editor */
.pe-page table, .pe-print-content table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  margin: 6pt 0;
}
.pe-page td, .pe-page th,
.pe-print-content td, .pe-print-content th {
  border: none;
  padding: 6px 8px;
  vertical-align: top;
  min-width: 40px;
  position: relative;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
/* Editor mode only: light dashed border as visual guide (replaced by custom borders inline) */
.pe-page-content .tiptap[contenteditable="true"] td,
.pe-page-content .tiptap[contenteditable="true"] th {
  border: 1px dashed #d0d0d0;
}
/* Viewer mode + print: no grid lines (only custom borders from inline style), no handles */
.pe-viewer-mode td, .pe-viewer-mode th { border-color: transparent; border-style: none; }
/* Table delete button (top-left corner) */
.pe-table-delete-btn {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #999;
  font-size: 11px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pe-table-delete-btn:hover {
  background: #fde8e8;
  color: #c62828;
  border-color: #ef9a9a;
}

.pe-viewer-mode .pe-table-delete-btn,
.pe-viewer-mode .pe-table-col-handle,
.pe-viewer-mode .pe-table-row-handle,
.pe-viewer-mode .pe-table-add-handle,
.pe-viewer-mode .pe-table-cell-handle,
.pe-viewer-mode .pe-cell-hover-overlay,
.pe-viewer-mode .pe-table-handle-menu,
.pe-viewer-mode .column-resize-handle { display: none !important; }
.pe-viewer-mode .resize-cursor { cursor: default; }
@media print {
  td, th { border-color: transparent !important; border-style: none !important; }
  td[style*="border"], th[style*="border"] { border-style: solid !important; }
}
.pe-page th, .pe-print-content th {
  font-weight: bold;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.pe-page .selectedCell {
  background-color: #d4e6ff;
}
.pe-page .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: #4a9eff;
  pointer-events: none;
  z-index: 1;
}
.pe-page .resize-cursor {
  cursor: col-resize;
}

/* Table — extra space for handles */
.pe-page table {
  margin-top: 18px;
  margin-bottom: 18px;
}

/* Table column/row hover handles */
.pe-table-col-handle, .pe-table-row-handle {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  z-index: 5;
  color: #888;
  font-size: 11px;
  letter-spacing: 1px;
  transition: background 0.15s;
}
.pe-table-col-handle:hover, .pe-table-row-handle:hover {
  background: #e0e0e0;
  color: #555;
}
.pe-table-col-handle {
  height: 14px;
}
.pe-table-row-handle {
  width: 14px;
}
.pe-table-add-handle {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  z-index: 5;
  color: #888;
  font-size: 13px;
  font-weight: bold;
  transition: background 0.15s;
}
.pe-table-add-handle:hover {
  background: #e0e0e0;
  color: #555;
}
.pe-table-add-col {
  width: 14px;
}
.pe-table-add-row {
  height: 14px;
}

/* Table handle dropdown menus */
.pe-table-handle-menu {
  position: absolute;
  z-index: 10;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px 0;
  min-width: 180px;
  font-size: 13px;
}
.pe-table-handle-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  color: #333;
  white-space: nowrap;
}
.pe-table-handle-menu-item:hover {
  background: #f5f5f5;
}
.pe-table-handle-menu-item i {
  width: 16px;
  text-align: center;
  font-size: 12px;
  color: #888;
}
.pe-table-handle-menu-item.pe-danger {
  color: #d44;
}
.pe-table-handle-menu-item.pe-danger i {
  color: #d44;
}
.pe-table-handle-menu-item.pe-danger:hover {
  background: #fef0f0;
}

/* Cell hover overlay — blue border highlight */
.pe-cell-hover-overlay {
  position: absolute;
  display: none;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px #1a73e8;
  z-index: 5;
}

/* Cell handle — small circle on right border */
.pe-table-cell-handle {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a73e8;
  cursor: pointer;
  z-index: 6;
  transition: width 0.15s ease, height 0.15s ease, margin 0.15s ease;
  overflow: hidden;
}
.pe-cell-handle-icon {
  font-size: 0;
  color: #fff;
  line-height: 1;
  transition: font-size 0.15s ease;
}
.pe-table-cell-handle:hover {
  width: 20px;
  height: 20px;
  margin-left: -5px;
  margin-top: -5px;
}
.pe-table-cell-handle:hover .pe-cell-handle-icon {
  font-size: 11px;
}

/* Table contextual toolbar */
.pe-table-toolbar {
  border-bottom: 1px solid #d0e0f0;
  background: #f0f6ff;
}
.pe-table-toolbar-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
  user-select: none;
}
.pe-toolbar-btn-danger {
  color: #d44;
}
.pe-toolbar-btn-danger:hover {
  background: #fef0f0 !important;
}
.pe-toolbar-btn-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Presentation toolbar — template chooser ────────────────────────── */
.pe-presentation-toolbar {
  position: relative;
  padding: 8px 12px !important;
  gap: 10px;
}
.pe-pres-label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.pe-pres-label i { color: var(--primary); }

.pe-tpl-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  flex: 1;
  padding: 4px 0;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.pe-tpl-scroll::-webkit-scrollbar { display: none; }

.pe-tpl-card {
  flex-shrink: 0;
  width: 140px;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
}
.pe-tpl-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(207,21,120,0.12);
}
.pe-tpl-card.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,0.2);
}

.pe-tpl-preview {
  height: 100px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
  pointer-events: none;
}

.pe-tpl-name {
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pe-tpl-card.is-active .pe-tpl-name {
  color: var(--primary);
}

.pe-tpl-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: #555;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  z-index: 2;
  transition: background 0.15s;
}
.pe-tpl-arrow:hover { background: var(--bg); }
.pe-tpl-arrow-left { left: 4px; }
.pe-tpl-arrow-right { right: 4px; }
/* TableCellFormat modal */
.tcf-tab-bar {
  display: flex;
  border-bottom: 1px solid #ddd;
  background: #fafafa;
}
.tcf-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tcf-tab:hover { color: #333; }
.tcf-tab-active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 600;
}
.tcf-panel { padding: 16px; }
.tcf-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.tcf-field-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 80px;
  flex-shrink: 0;
}
.tcf-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tcf-font-select {
  font-size: 14px;
}
.tcf-font-select option {
  padding: 3px 0;
}
.tcf-size-select option {
  line-height: 1.6;
}
.tcf-select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}
.tcf-color-input {
  width: 36px;
  height: 28px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px;
  cursor: pointer;
}
.tcf-preset-btn {
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}
.tcf-preset-btn:hover { background: #f0f0f0; }

/* Border preview — 2×2 grid with clickable outer/inner zones */
.tcf-border-preview {
  position: relative;
  width: 200px;
  height: 130px;
  background: #fafafa;
  margin-top: 4px;
}
.tcf-border-grid {
  position: absolute;
  top: 16px; right: 16px; bottom: 16px; left: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.tcf-border-gcell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #aaa;
}
.tcf-border-side {
  position: absolute;
  cursor: pointer;
  background: transparent;
  transition: background 0.15s;
  z-index: 1;
}
.tcf-border-side:hover { background: rgba(26,115,232,0.12); }
.tcf-border-top    { top: 0; left: 0; right: 0; height: 16px; }
.tcf-border-bottom { bottom: 0; left: 0; right: 0; height: 16px; }
.tcf-border-left   { top: 16px; bottom: 16px; left: 0; width: 16px; }
.tcf-border-right  { top: 16px; bottom: 16px; right: 0; width: 16px; }
.tcf-border-insideH { top: 50%; left: 16px; right: 16px; height: 16px; margin-top: -8px; }
.tcf-border-insideV { left: 50%; top: 16px; bottom: 16px; width: 16px; margin-left: -8px; }

/* Text style buttons */
.tcf-style-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tcf-style-btn:hover { background: #f0f0f0; }
.tcf-style-active {
  background: #e3f0ff;
  border-color: #1a73e8;
  color: #1a73e8;
}

/* Background color — two-column layout */
.tcf-bg-layout {
  display: flex;
  gap: 16px;
}
.tcf-bg-left { flex: 1; }
.tcf-bg-right {
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tcf-bg-none-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}
.tcf-bg-none-btn:hover { background: #f5f5f5; }
.tcf-bg-none-btn.tcf-bg-selected { border-color: #1a73e8; color: #1a73e8; }
.tcf-bg-grid {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  gap: 3px;
}
.tcf-bg-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.12);
  transition: transform 0.1s;
}
.tcf-bg-circle:hover {
  transform: scale(1.25);
  border-color: rgba(0,0,0,.4);
}
.tcf-bg-circle.tcf-bg-selected {
  border: 2px solid #1a73e8;
}
.tcf-bg-preview {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  color: #333;
  min-height: 40px;
  margin-top: auto;
}
.tcf-bg-recent-label {
  font-size: 11px;
  color: #666;
}
.tcf-bg-recent-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tcf-bg-recent-cell {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}
.tcf-bg-recent-cell:hover {
  border-color: rgba(0,0,0,.4);
  transform: scale(1.25);
}
/* Color pick button (shared for text + background) */
.tcf-color-pick-btn {
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}
.tcf-color-pick-btn:hover { background: #f5f5f5; }
.tcf-color-swatch {
  width: 28px;
  height: 28px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

/* Toolbar */
.pe-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  background: #fff;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pe-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: #444;
  font-size: 14px;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.pe-toolbar-btn:hover {
  background: #f0f0f0;
  color: #111;
}
.pe-toolbar-btn.is-active {
  background: var(--primary, #0b3e66);
  color: #fff;
}
.pe-toolbar-btn sub {
  font-size: 9px;
  position: absolute;
  bottom: 4px;
  right: 4px;
  line-height: 1;
}
.pe-toolbar-sep {
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 6px;
}

/* Groupes de boutons dans les toolbars ribbon (tableau, exercices, images) */
.pe-toolbar-group {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 6px;
}
.pe-toolbar-group-label {
  text-align: center;
  font-size: 9px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  margin-bottom: 2px;
  pointer-events: none;
}
.pe-toolbar-group-row {
  display: flex;
  flex-direction: row;
  gap: 2px;
}
/* Boutons dans un groupe : colonne icône + texte */
.pe-toolbar-group .pe-toolbar-btn {
  flex-direction: column;
  width: auto;
  min-width: 40px;
  height: auto;
  min-height: 44px;
  padding: 4px 6px 2px;
  gap: 2px;
  font-size: 14px;
}
.pe-toolbar-btn-text {
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

/* Heading dropdown in toolbar */
.pe-heading-dropdown {
  position: relative;
  display: inline-flex;
}
.pe-heading-toggle {
  min-width: 90px;
  justify-content: space-between;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 2px 8px;
}
.pe-heading-label {
  white-space: nowrap;
}
.pe-heading-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 150px;
  max-height: 300px;
  overflow-y: auto;
}
.pe-heading-list-open {
  display: block;
}
.pe-heading-option {
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.pe-heading-option:hover {
  background: #e8f0fe;
}

/* Columns dropdown in toolbar */
.pe-columns-dropdown {
  position: relative;
  display: inline-flex;
}
.pe-columns-toggle {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 2px 8px;
}
.pe-columns-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 200;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 140px;
}
.pe-columns-list-open {
  display: block;
}
.pe-columns-option {
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.pe-columns-option:hover {
  background: #e8f0fe;
}
.pe-columns-option.is-active {
  background: #d2e3fc;
  font-weight: 600;
}

/* Font dropdown in toolbar */
.pe-font-dropdown {
  position: relative;
  display: inline-flex;
}
.pe-font-toggle {
  min-width: 120px;
  justify-content: space-between;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 2px 8px;
}
.pe-font-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

/* Font size control */
.pe-fontsize-control {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin-left: 4px;
}
.pe-fontsize-btn {
  width: 24px;
  height: 28px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: #333;
}
.pe-fontsize-btn:hover { background: #f0f0f0; }
/* Compact mode: hide +/- buttons, input gets full border */
.pe-fontsize-compact { border: 1px solid #ccc; border-radius: 4px; }
.pe-fontsize-compact .pe-fontsize-btn { display: none; }
.pe-fontsize-compact .pe-fontsize-input { border: none; }
.pe-fontsize-compact .pe-fontsize-list { left: 0; }
.pe-fontsize-input {
  width: 36px;
  height: 28px;
  text-align: center;
  border: 1px solid #ccc;
  border-left: 0;
  border-right: 0;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.pe-fontsize-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 24px;
  width: 36px;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
}
.pe-fontsize-list-open { display: block; }
.pe-fontsize-option {
  padding: 4px 6px;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
}
.pe-fontsize-option:hover { background: #e8f0fe; }
.pe-fontsize-option.is-active { background: #d0e0fd; font-weight: 600; }

/* Color picker button */
.pe-color-wrapper {
  position: relative;
  display: inline-flex;
  margin-left: 4px;
}
.pe-color-btn {
  padding: 2px 6px;
}
.pe-color-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.pe-color-icon b {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}
.pe-color-bar {
  width: 16px;
  height: 4px;
  border-radius: 1px;
  margin-top: 1px;
}
.pe-color-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  z-index: 100;
  padding: 10px;
  border-radius: 4px;
  width: 230px;
}
.pe-color-panel-open { display: block; }
.pe-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}
.pe-color-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.12);
  transition: transform .1s;
}
.pe-color-circle:hover {
  transform: scale(1.25);
  border-color: rgba(0,0,0,.4);
}
.pe-color-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}
.pe-color-custom-preview {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #ccc;
  flex-shrink: 0;
}
.pe-color-custom-btn {
  font-size: 12px;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  color: #333;
}
.pe-color-custom-btn:hover {
  background: #f0f0f0;
}

/* ColorPicker — tab bar */
.pe-cpk-tab-bar {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 4px;
}
.pe-cpk-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 6px 16px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
}
.pe-cpk-tab:hover { color: var(--primary); }
.pe-cpk-tab.pe-cpk-tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.pe-cpk-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* 80-color palette grid */
.pe-cpk-pal-grid {
  display: grid;
  grid-template-columns: repeat(10, 28px);
  gap: 10px;
  padding: 4px;
}
.pe-cpk-pal-cell {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.pe-cpk-pal-cell:hover { transform: scale(1.15); border-color: #999; }
.pe-cpk-pal-cell.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--primary, #0f9d58), 0 0 8px rgba(0,0,0,0.4);
  transform: scale(1.2);
  z-index: 1;
  position: relative;
}

/* Ligne palette + témoin couleur sélectionnée */
.pe-cpk-pal-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.pe-cpk-pal-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  min-width: 80px;
}
.pe-cpk-pal-preview-label {
  font-size: 11px;
  color: var(--text-muted, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pe-cpk-pal-preview-swatch {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), 0 1px 3px rgba(0,0,0,0.15);
}
.pe-cpk-pal-preview-hex {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #222);
}

/* Custom color picker modal */
.pe-cpk {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px;
}
.pe-cpk-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.pe-cpk-sl-wrap {
  position: relative;
  width: 256px;
  height: 256px;
  cursor: crosshair;
  border: 1px solid #ccc;
  flex-shrink: 0;
}
.pe-cpk-sl {
  display: block;
  width: 256px;
  height: 256px;
}
.pe-cpk-sl-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 2px rgba(0,0,0,0.6);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.pe-cpk-hue-wrap {
  position: relative;
  width: 20px;
  height: 256px;
  cursor: pointer;
  border: 1px solid #ccc;
  flex-shrink: 0;
}
.pe-cpk-hue {
  display: block;
  width: 20px;
  height: 256px;
}
.pe-cpk-hue-cursor {
  position: absolute;
  left: -2px;
  right: -2px;
  height: 4px;
  background: #fff;
  border: 1px solid #333;
  pointer-events: none;
  transform: translateY(-50%);
}
.pe-cpk-right {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  align-items: center;
  align-self: flex-end;
}
.pe-cpk-preview-col {
  display: contents;
}
.pe-cpk-preview-label {
  font-size: 11px;
  color: #666;
  text-align: right;
}
.pe-cpk-preview {
  width: 48px;
  height: 48px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.pe-cpk-input-group {
  display: contents;
}
.pe-cpk-input-group label {
  font-size: 12px;
  color: #666;
  text-align: right;
}
.pe-cpk-input-group input {
  width: 52px;
  height: 26px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
}
.pe-cpk-hex-group input {
  width: 72px;
}
.pe-cpk-recent {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pe-cpk-recent-label {
  font-size: 12px;
  color: #555;
}
.pe-cpk-recent-grid {
  display: flex;
  gap: 4px;
}
.pe-cpk-recent-cell {
  width: 24px;
  height: 24px;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
}
.pe-cpk-recent-cell:hover {
  border-color: #666;
  transform: scale(1.1);
}
.pe-cpk-recent-grid {
  padding: 4px;
  gap: 10px !important;
}
.pe-cpk-recent-cell.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--primary, #0f9d58), 0 0 8px rgba(0,0,0,0.4);
  transform: scale(1.2);
  position: relative;
  z-index: 1;
}

/* Page settings modal */
.pe-ps-tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 16px;
}
.pe-ps-tab {
  padding: 8px 20px;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.pe-ps-tab.is-active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 600;
}
.pe-ps-tab:hover { color: #333; }
.pe-ps-panel { display: flex; flex-direction: column; gap: 14px; }
.pe-ps-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.pe-ps-unit {
  font-size: 12px;
  color: #888;
  min-width: 20px;
}
.pe-ps-row label, .pe-ps-label {
  width: 130px;
  font-size: 13px;
  color: #444;
  flex-shrink: 0;
}
.pe-ps-select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}
.pe-ps-input {
  width: 70px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  text-align: right;
}
.pe-ps-ori-group {
  display: flex;
  gap: 12px;
}
.pe-ps-ori-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  color: #555;
}
.pe-ps-ori-btn.is-active {
  border-color: #1a73e8;
  color: #1a73e8;
  background: #e8f0fe;
}
.pe-ps-ori-btn:hover { border-color: #999; }
.pe-ps-ori-icon {
  border: 2px solid currentColor;
  border-radius: 2px;
}
.pe-ps-ori-portrait { width: 24px; height: 32px; }
.pe-ps-ori-landscape { width: 32px; height: 24px; }
.pe-ps-preview {
  border: 1px solid #bbb;
  background: #fff;
  box-shadow: 1px 1px 4px rgba(0,0,0,.1);
  transition: width .2s, height .2s;
}

/* Ruler — full-width bar with centered page zone */
.pe-ruler {
  background: #e8e8e8;
  border-bottom: 1px solid #d0d0d0;
  user-select: none;
  overflow: hidden;
}
.pe-ruler-track {
  position: relative;
  height: 24px;
  width: 100%;
}
.pe-ruler-marks {
  position: relative;
  height: 100%;
}
.pe-ruler-page-zone {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #fff;
  border-left: 1px solid #bbb;
  border-right: 1px solid #bbb;
}

/* Overflow zones (outside the page) */
.pe-ruler-overflow {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
}

/* Graduation marks */
.pe-ruler-mark {
  position: absolute;
  top: 0;
  width: 0;
  border-left: 1px solid #999;
}
.pe-ruler-mark-major {
  height: 12px;
}
.pe-ruler-mark-sub {
  border-left-color: #bbb;
}
.pe-ruler-mark-outside {
  border-left-color: #aaa;
  opacity: 0.5;
}
.pe-ruler-num {
  position: absolute;
  top: 12px;
  left: -6px;
  font-size: 9px;
  color: #666;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}

/* Margin shaded zones (within page area) */
.pe-ruler-margin-zone {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(0,0,0,0.06);
  pointer-events: none;
}
.pe-ruler-margin-left {
  left: 0;
}
.pe-ruler-margin-right {
  right: 0;
}

/* Margin handles */
.pe-ruler-handle {
  position: absolute;
  top: 0;
  width: 0;
  height: 100%;
  cursor: ew-resize;
  z-index: 2;
}
.pe-ruler-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -5px;
  transform: translateY(-50%);
  width: 10px;
  height: 16px;
  background: var(--primary, #0b3e66);
  border-radius: 2px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.pe-ruler-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -1px;
  transform: translateY(-50%);
  width: 2px;
  height: 10px;
  background: #fff;
  border-radius: 1px;
  pointer-events: none;
}
.pe-ruler-handle:hover::before,
.pe-ruler-handle-dragging::before {
  opacity: 1;
}
.pe-ruler-handle-dragging::before {
  background: var(--accent, #e74c3c);
}
/* Paragraph indent handles (triangles) */
.pe-ruler-indent {
  position: absolute;
  top: 0;
  width: 0;
  height: 100%;
  z-index: 3;
  cursor: ew-resize;
}
/* Right indent: full triangle pointing right, vertical edge on left */
.pe-ruler-indent-right::before {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: -8px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid var(--accent, #f29100);
  transition: border-left-color 0.15s;
}
.pe-ruler-indent-right:hover::before {
  border-left-color: var(--primary, #cf1578);
}
.pe-ruler-indent-right.pe-ruler-handle-dragging::before {
  border-left-color: var(--error, #e74c3c);
}
/* First line indent (top half): point faces left, flat bottom */
.pe-ruler-indent-firstline::before {
  content: '';
  position: absolute;
  bottom: 50%;
  right: -8px;
  width: 0;
  height: 0;
  border-right: 8px solid var(--accent, #f29100);
  border-top: 7px solid transparent;
  transition: border-right-color 0.15s;
}
.pe-ruler-indent-firstline:hover::before {
  border-right-color: var(--primary, #cf1578);
}
.pe-ruler-indent-firstline.pe-ruler-handle-dragging::before {
  border-right-color: var(--error, #e74c3c);
}
/* Left indent (bottom half): point faces left, flat top */
.pe-ruler-indent-left::before {
  content: '';
  position: absolute;
  top: 50%;
  right: -8px;
  width: 0;
  height: 0;
  border-right: 8px solid var(--accent, #f29100);
  border-bottom: 7px solid transparent;
  transition: border-right-color 0.15s;
}
.pe-ruler-indent-left:hover::before {
  border-right-color: var(--primary, #cf1578);
}
.pe-ruler-indent-left.pe-ruler-handle-dragging::before {
  border-right-color: var(--error, #e74c3c);
}
/* Vertical guide line during indent drag */
.pe-ruler-guide {
  position: fixed;
  bottom: 0;
  width: 0;
  border-left: 1px dashed var(--accent, #f29100);
  pointer-events: none;
  z-index: 9999;
  opacity: 0.6;
}
.pe-ruler-tooltip {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}
.pe-ruler-tooltip-fixed {
  position: fixed;
  top: auto;
  left: auto;
  transform: translateX(-50%);
  z-index: 10000;
}

/* Pages container (scrollable) */
.pe-pages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Placeholder « choisir un groupe » (collab work, vue prof) ──── */
.pe-collab-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--gray-100, #f3f4f6);
}
.pe-collab-placeholder-card {
  background: var(--bg-card, #fff);
  border-radius: var(--radius, 8px);
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.1));
  padding: 32px 36px;
  max-width: 480px;
  text-align: center;
  color: var(--text, #1a1a1a);
}
.pe-collab-placeholder-icon {
  font-size: 44px;
  color: var(--primary, #cf1578);
  margin-bottom: 16px;
}
.pe-collab-placeholder-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
}
.pe-collab-placeholder-card p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-600, #4b5563);
}
.pe-collab-placeholder-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(207, 21, 120, 0.08);
  color: var(--primary-dark, #a01060);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.pe-collab-placeholder-hint:hover {
  background: rgba(207, 21, 120, 0.16);
  border-color: rgba(207, 21, 120, 0.4);
  transform: translateY(-1px);
}
.pe-collab-placeholder-hint:active { transform: translateY(0); }
.pe-collab-placeholder-hint:focus-visible {
  outline: 2px solid var(--primary-dark, #a01060);
  outline-offset: 2px;
}
.pe-collab-placeholder-hint i { font-size: 12px; }

/* Individual page */
.pe-page {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}
.pe-page-content {
  outline: none;
  position: relative;
}
.pe-page-content .tiptap {
  outline: none;
  min-height: 200px;
}
/* New pagination: page nodes inside ProseMirror */
.pe-page-content .tiptap div[data-page] {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  box-sizing: border-box;
  margin-bottom: 24px;
  overflow: hidden;
}
.pe-page-content .tiptap div[data-page-body] {
  outline: none;
  min-height: 100px;
}
.pe-page-content .tiptap:focus {
  outline: none;
}

/* ── Mouchard — show invisible formatting marks ─────────────────────── */
/* Pilcrow ¶ at end of paragraphs — zero-width inline, follows last character */
.pe-show-invisibles .tiptap p {
  position: relative;
}
.pe-show-invisibles .tiptap p::after {
  content: '\00B6';
  display: inline-block;
  width: 0;
  overflow: visible;
  color: #bbc;
  font-size: 0.8em;
  pointer-events: none;
  user-select: none;
  vertical-align: baseline;
}
/* Paragraph ending with a trailing <br> (empty line or empty paragraph) — pin ¶ to last line */
.pe-show-invisibles .tiptap p:has(> br:last-child)::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: auto;
}
/* Heading marker § — zero-width inline */
.pe-show-invisibles .tiptap h1::after,
.pe-show-invisibles .tiptap h2::after,
.pe-show-invisibles .tiptap h3::after,
.pe-show-invisibles .tiptap h4::after,
.pe-show-invisibles .tiptap h5::after,
.pe-show-invisibles .tiptap h6::after {
  content: '\00A7';
  display: inline-block;
  width: 0;
  overflow: visible;
  color: #bbc;
  font-size: 0.7em;
  font-weight: normal;
  pointer-events: none;
  user-select: none;
  vertical-align: baseline;
}
/* Arrow ↵ for hard breaks (Shift+Enter) — zero-width inline */
.pe-show-invisibles .tiptap .pe-hard-break::before {
  content: '\21B5';
  display: inline-block;
  width: 0;
  overflow: visible;
  color: #bbc;
  font-size: 0.8em;
  pointer-events: none;
  user-select: none;
}
/* Encart boundary — outline only, zero layout impact */
.pe-show-invisibles .tiptap .pe-encart {
  outline: 1px dashed #ccd;
  outline-offset: -1px;
}
/* Exercise block — outline only */
.pe-show-invisibles .tiptap .pe-exercise-block {
  outline: 1px dashed #ccd;
  outline-offset: -1px;
}

/* Page break spacer — Widget Decoration inserted by ProseMirror plugin */
.pe-break-spacer {
  display: block;
  position: relative;
  user-select: none;
  pointer-events: none;
  list-style: none;
  counter-increment: none;
  column-span: all;
}
.pe-break-spacer .pe-hf-clone {
  pointer-events: auto;
}
/* Encart clone (overflow portion shown on next page) */
.pe-encart-clone {
  display: block;
  pointer-events: none;
  user-select: none;
}
.pe-encart-clone .pe-encart::before { display: none; }
.pe-encart-clone .pe-encart { counter-increment: none; }

/* Header / Footer zones */
.pe-hf-zone {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s;
}
.pe-hf-zone .tiptap {
  font-size: 10pt;
  line-height: 1.3;
  color: #888;
  outline: none;
  min-height: auto !important;
}
.pe-hf-active .tiptap {
  color: #333;
}
.pe-hf-zone .tiptap p { margin: 0; }
.pe-hf-header { justify-content: flex-start; border-bottom: 1px dashed transparent; }
.pe-hf-footer { justify-content: flex-start; border-top: 1px dashed transparent; }
.pe-hf-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  cursor: pointer;
}
.pe-hf-zone:not(.pe-hf-active) { opacity: 0.4; }
.pe-hf-active { opacity: 1; cursor: text; }
.pe-hf-active .pe-hf-overlay { display: none; }
.pe-hf-active.pe-hf-header { border-bottom-color: #aaa; }
.pe-hf-active.pe-hf-footer { border-top-color: #aaa; }
.pe-content-dimmed { opacity: 0.5; transition: opacity 0.2s; }

/* Header/Footer clones in page-break spacers */
.pe-hf-clone {
  overflow: hidden;
  font-size: 10pt;
  line-height: 1.3;
  color: #888;
  opacity: 0.4;
  cursor: pointer;
}
.pe-hf-clone p { margin: 0; }
.pe-hf-clone:hover { opacity: 0.6; }

/* Page number overlay */
.pe-page-num {
  position: absolute;
  right: 20px;
  font-size: 11px;
  color: #999;
  z-index: 10;
  pointer-events: none;
}

/* Tiptap content styles — all in pt/mm for WYSIWYG print fidelity */
.pe-page-content .tiptap,
.pe-print-content {
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.pe-page-content .tiptap,
.pe-print-content {
  font-size: 12pt;
  line-height: 1.15;
}
.pe-page-content {
  line-height: 1.15;
}
.pe-page-content .tiptap p,
.pe-print-content p {
  margin: 0 0 6pt;
}
.pe-page-content .tiptap h1,
.pe-print-content h1 {
  font-size: 22pt;
  font-weight: 700;
  margin: 12pt 0 4pt;
  color: #1a1a1a;
}
.pe-page-content .tiptap h2,
.pe-print-content h2 {
  font-size: 16pt;
  font-weight: 600;
  margin: 10pt 0 4pt;
  color: #2a2a2a;
}
.pe-page-content .tiptap h3,
.pe-print-content h3 {
  font-size: 14pt;
  font-weight: 600;
  margin: 8pt 0 4pt;
  color: #3a3a3a;
}
.pe-page-content .tiptap h4,
.pe-print-content h4 {
  font-size: 12pt;
  font-weight: 700;
  margin: 6pt 0 3pt;
  color: #3a3a3a;
}
.pe-page-content .tiptap h5,
.pe-print-content h5 {
  font-size: 11pt;
  font-weight: 600;
  margin: 6pt 0 3pt;
  color: #4a4a4a;
}
.pe-page-content .tiptap h6,
.pe-print-content h6 {
  font-size: 10pt;
  font-weight: 600;
  margin: 6pt 0 3pt;
  color: #4a4a4a;
  font-style: italic;
}
.pe-page-content .tiptap ul,
.pe-page-content .tiptap ol,
.pe-print-content ul,
.pe-print-content ol {
  padding-left: 18pt;
  margin: 4pt 0;
}
.pe-page-content .tiptap li,
.pe-print-content li {
  min-height: 1.15em;
  margin: 2pt 0;
}
.pe-page-content .tiptap li p,
.pe-print-content li p { margin: 0; min-height: 1.15em; }
.pe-page-content .tiptap blockquote,
.pe-print-content blockquote {
  border-left: 3px solid var(--primary, #0b3e66);
  padding-left: 12pt;
  margin: 6pt 0;
  color: #555;
  font-style: italic;
}

/* Active folder highlight */
.rep-item-active {
  background: rgba(255, 255, 255, 0.15);
}
.rep-item-active .rep-name {
  font-weight: 600;
}

/* Editor fills the content area */
.course-content:has(.pe-wrapper) {
  display: flex;
  flex-direction: column;
  height: 100%;
}
/* Lock parent chain height so pe-pages-container scrolls internally */
.app-content:has(.pe-wrapper) {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.page-body:has(.pe-wrapper) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-main:has(.pe-wrapper) {
  height: 100vh;
  min-height: 0;
}

/* Collaboration cursors */
.collaboration-cursor__caret {
  position: relative;
  border-left: 2px solid;
  margin-left: -1px;
  margin-right: -1px;
  pointer-events: none;
  word-break: normal;
}
.collaboration-cursor__label {
  position: absolute;
  top: -1.4em;
  left: -1px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px 3px 3px 0;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

/* ============================================
   DRIVE GRID — repertoire content view
   ============================================ */
.drive-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 0;
  color: var(--text-secondary);
  font-size: 14px;
}
.drive-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 0;
  color: var(--error);
  font-size: 14px;
}
.drive-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-light);
}
.drive-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.drive-empty p {
  font-size: 15px;
  margin: 0;
}

/* Breadcrumb */
.course-content:has(.drive-breadcrumb) { padding-top: 8px; }
.drive-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
}
.drive-breadcrumb-sep { font-size: 0.65rem; color: #bbb; flex-shrink: 0; }
.drive-breadcrumb-item { color: var(--text-muted); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 20px; }
.drive-breadcrumb-item:not(.is-current):hover { color: var(--primary); }
.drive-breadcrumb-item.is-current { color: var(--text); font-weight: 600; cursor: default; flex-shrink: 1; }
.drive-breadcrumb-home { font-size: 0.9rem; flex-shrink: 0; }

/* Grid layout */
.drive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 14px 20px;
}

/* Card */
.drive-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s;
  border: 1px solid var(--border);
}
.drive-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  transform: translateY(-3px);
  border-color: var(--primary);
}
.drive-card-dragging {
  visibility: hidden;
}

/* Thumbnail area */
.drive-card-thumb {
  height: 105px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f0f2f5;
  margin: 6px 6px 0;
  border-radius: 8px 8px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: -3px 0 6px rgba(0,0,0,0.08), 3px 0 6px rgba(0,0,0,0.08), 0 -3px 6px rgba(0,0,0,0.08);
  position: relative;
}
/* Closed item (student view) — subtle lock badge, no muting */
.drive-card--closed { cursor: default; }
.drive-card--closed .drive-card-thumb { border-color: #e5a00d; }
.drive-card-lock {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f59e0b; box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.drive-card-lock i { font-size: 12px; color: #fff; }

.drive-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}
.drive-card-thumb.drive-thumb-full {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: none;
}
.drive-card-thumb.drive-thumb-full img {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.drive-card-thumb img.thumb-contain {
  object-fit: contain;
}
.drive-card-type-icon {
  font-size: 28px;
  color: #fff;
  opacity: 0.9;
}

/* Card body */
.drive-card-body {
  padding: 8px 10px 10px;
  position: relative;
  border-top: 1px solid var(--border);
}

/* Top row: badge + actions */
.drive-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.drive-card-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.5;
}
/* Pending corrections badge on exercise cards */
.drive-card-corr-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; color: #fff;
  background: #ef4444; padding: 2px 8px; border-radius: 10px;
  animation: corr-pulse 2s ease-in-out infinite;
}
@keyframes corr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* Permission indicators on shared teacher cards */
.drive-card-perms {
  display: flex;
  gap: 4px;
  font-size: 10px;
  color: var(--text-light, #999);
  margin-left: auto;
  margin-right: 4px;
  align-items: center;
}
.drive-card-perms i { opacity: 0.6; }

.drive-card-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.drive-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.drive-card-action:hover {
  background: var(--primary);
  color: #fff;
}
.drive-card-editable {
  color: var(--primary);
}
.drive-card-kebab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-light);
  font-size: 14px;
  padding: 0;
  transition: background 0.12s, color 0.12s;
}
.drive-card-kebab:hover,
.drive-card-kebab.is-open {
  background: var(--gray-100);
  color: var(--text);
}
/* Bring card above siblings when menu is open */
.drive-card:has(.drive-card-kebab.is-open) {
  z-index: 30;
}
.drive-card-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  overflow: hidden;
}
.drive-card-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  transition: background 0.12s;
}
.drive-card-menu-item:hover {
  background: var(--gray-100);
}
.drive-card-menu-item i {
  width: 16px;
  text-align: center;
  font-size: 12px;
  opacity: 0.6;
}
.drive-card-menu-muted { opacity: 0.4; cursor: default; pointer-events: none; }
.drive-card-menu-danger { color: #b91c1c; }
.drive-card-menu-danger:hover { background: #fef2f2; }
.drive-card-menu-danger i { opacity: 1; color: #ef4444; }

/* Delete confirmation overlay */
.drive-card-confirm {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 5;
  border-radius: var(--radius-lg);
  opacity: 0;
  transition: opacity 0.2s;
}
.drive-card-confirm.is-visible { opacity: 1; }
.drive-card-confirm > i {
  font-size: 22px;
  color: #f59e0b;
}
.drive-card-confirm > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.drive-card-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.drive-card-confirm-actions .btn-sm {
  padding: 4px 14px;
  font-size: 12px;
  min-height: 28px;
}
.drive-card-confirm-actions .btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.drive-card-confirm-actions .btn-danger:hover { background: #dc2626; }

/* Title */
.drive-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Metadata */
.drive-card-meta {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

/* File type icon (bottom of card body) */
.drive-card-file-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 14px;
  opacity: 0.5;
}

/* ── Drive grid — Mobile (< 600px) ────────────────────────── */
@media (max-width: 600px) {
  .drive-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px 10px;
  }
  .drive-card-thumb {
    height: 80px;
    margin: 4px 4px 0;
    border-radius: 6px 6px 0 0;
  }
  .drive-card-type-icon { font-size: 24px; }
  .drive-card-body { padding: 6px 8px 8px; }
  .drive-card-top { margin-bottom: 3px; }
  .drive-card-badge { font-size: 8px; padding: 1px 5px; }
  .drive-card-title { font-size: 11px; -webkit-line-clamp: 1; }
  .drive-card-meta { font-size: 9px; margin-top: 2px; }
  .drive-card-kebab { width: 24px; height: 24px; font-size: 12px; }
  .drive-card-file-icon { font-size: 11px; bottom: 6px; right: 6px; }

  /* Kebab menu — bottom sheet style for thumb reach */
  .drive-card-menu {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    border-radius: 16px 16px 0 0;
    border: none;
    box-shadow: 0 -4px 24px rgba(0,0,0,.18);
    padding: 8px 0 env(safe-area-inset-bottom, 12px);
    animation: drive-menu-slide-up .2s ease-out;
    z-index: 10001;
    transform: none !important;
  }
  .drive-card-menu::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: #d0d5dd; border-radius: 2px;
    margin: 4px auto 8px;
  }
  .drive-card-menu-item {
    padding: 14px 20px;
    font-size: 15px;
    gap: 12px;
  }
  .drive-card-menu-item i { font-size: 16px; width: 20px; }

  /* Backdrop — blocks scroll behind */
  .drive-card-menu-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.3);
    z-index: 10000; animation: drive-menu-fade-in .15s;
    touch-action: none; overscroll-behavior: contain;
    -webkit-overflow-scrolling: auto;
  }

  /* Delete confirm — also bottom-sheet-like */
  .drive-card-confirm {
    border-radius: 8px;
    padding: 12px;
  }
}

@keyframes drive-menu-slide-up {
  from { transform: translateY(100%); } to { transform: none; }
}
@keyframes drive-menu-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}

/* ============================================================
   Course Ribbon (teacher-only hamburger panel)
   ============================================================ */

.course-btn-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.course-hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  font-size: 18px;
}
.course-hamburger-btn:hover { background: var(--primary); color: #fff; }
.course-hamburger-btn.is-active { background: var(--primary); color: #fff; }

/* --- Base commune --- */
.course-ribbon {
  position: fixed;
  background: #fff;
  z-index: 100;
  visibility: hidden;
}
.course-ribbon.is-open {
  visibility: visible;
  transform: translate(0, 0) !important;
  transition: transform 0.3s ease, visibility 0s 0s !important;
}

/* --- Boutons (identiques pour toutes les positions) --- */
.course-ribbon .pe-toolbar-btn {
  flex-direction: column;
  width: 58px;
  height: auto;
  min-height: 52px;
  padding: 6px 4px 4px;
  gap: 4px;
  font-size: 10px;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}
.course-ribbon .pe-toolbar-btn i { font-size: 16px; }
.ribbon-svg-icon { width: 28px; height: 28px; opacity: 0.7; }
.pe-toolbar-btn:hover .ribbon-svg-icon { opacity: 1; }

/* --- Sections --- */
.course-ribbon-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.course-ribbon-section-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  padding: 0 4px 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.course-ribbon-group {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

/* --- Punaise --- */
.course-ribbon-pin {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.15s, background 0.15s, transform 0.2s;
  transform: rotate(45deg);
}
.course-ribbon-pin:hover { background: #f0f0f0; color: var(--text); }
.course-ribbon-pin.is-active { color: var(--primary); transform: rotate(0deg); }

/* ============================================================
   Position : top
   ============================================================ */
.course-ribbon[data-pos="top"] {
  top: var(--header-height);
  left: 0; right: 0;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-110%);
  transition: transform 0.3s ease, visibility 0s 0.3s;
}
.course-ribbon[data-pos="top"] .pe-toolbar,
.course-ribbon[data-pos="bottom"] .pe-toolbar {
  flex-wrap: nowrap;
  align-items: center;
  padding: 8px 8px 8px 16px;
  gap: 4px;
}
.course-ribbon[data-pos="top"] .course-ribbon-sep,
.course-ribbon[data-pos="bottom"] .course-ribbon-sep {
  width: 1px; align-self: stretch;
  background: #e0e0e0; margin: 4px 8px;
}

/* Sections wrapper : clips overflowed buttons */
.course-ribbon[data-pos="top"] .course-ribbon-sections,
.course-ribbon[data-pos="bottom"] .course-ribbon-sections {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

/* "More" button in horizontal ribbon */
.course-ribbon-more-btn {
  flex-shrink: 0;
  width: 32px;
  min-height: 52px;
  padding: 6px 4px;
}

/* ============================================================
   Position : bottom
   ============================================================ */
.course-ribbon[data-pos="bottom"] {
  bottom: 0;
  left: 0; right: 0;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  transform: translateY(110%);
  transition: transform 0.3s ease, visibility 0s 0.3s;
}

/* ============================================================
   Overflow panel (horizontal ribbon, mobile)
   ============================================================ */
.course-ribbon-overflow-panel {
  position: fixed;
  right: 0;
  bottom: 22vh;
  max-height: 55vh;
  width: fit-content;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-right: none;
  border-radius: 10px 0 0 10px;
  box-shadow: -6px 4px 20px rgba(0,0,0,0.15);
  z-index: 102;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  visibility: hidden;
  transform: translateX(110%);
  transition: transform 0.25s ease, visibility 0s 0.25s;
}
.course-ribbon-overflow-panel.is-open {
  visibility: visible;
  transform: translateX(0);
  transition: transform 0.25s ease, visibility 0s 0s;
}
/* Separator inside overflow panel */
.course-ribbon-overflow-panel .course-ribbon-sep {
  width: 100%; height: 1px;
  background: #e0e0e0; margin: 4px 0;
}
/* Buttons inside overflow panel: square, same style as side panel */
.course-ribbon-overflow-panel .pe-toolbar-btn {
  width: clamp(52px, 5.2vw, 70px);
  min-height: unset;
  aspect-ratio: 1;
  font-size: clamp(8px, 0.85vw, 11px);
  padding: clamp(4px, 0.5vw, 7px) 2px 2px;
  gap: clamp(2px, 0.3vw, 4px);
  flex-direction: column;
}
.course-ribbon-overflow-panel .pe-toolbar-btn i {
  font-size: clamp(13px, 1.5vw, 20px);
}

/* ============================================================
   Position : right
   ============================================================ */
/* Boutons panneau vertical : taille fixe indépendante du conteneur */
.course-ribbon[data-pos="right"] .pe-toolbar-btn,
.course-ribbon[data-pos="left"] .pe-toolbar-btn {
  width: clamp(52px, 5.2vw, 82px);
  min-height: unset;
  aspect-ratio: 1;
  font-size: clamp(8px, 0.85vw, 11px);
  padding: clamp(4px, 0.5vw, 8px) 2px 2px;
  gap: clamp(2px, 0.3vw, 4px);
}
.course-ribbon[data-pos="right"] .pe-toolbar-btn i,
.course-ribbon[data-pos="left"] .pe-toolbar-btn i {
  font-size: clamp(13px, 1.5vw, 22px);
}

/* ============================================================
   Position : right
   ============================================================ */
.course-ribbon[data-pos="right"] {
  top: var(--header-height);
  right: 0; bottom: 0;
  width: fit-content;
  border-left: 1px solid #e0e0e0;
  box-shadow: -4px 0 12px rgba(0,0,0,0.08);
  overflow-x: hidden;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease, visibility 0s 0.3s;
}
.course-ribbon[data-pos="right"] .pe-toolbar {
  flex-direction: column;
  align-items: stretch;
  padding: 8px;
  gap: 6px;
}
.course-ribbon[data-pos="right"] .course-ribbon-group {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 2px;
}
.course-ribbon[data-pos="right"] .course-ribbon-sep {
  width: 100%; height: 1px;
  background: #e0e0e0; margin: 2px 0;
}

/* ============================================================
   Position : left
   ============================================================ */
.course-ribbon[data-pos="left"] {
  top: var(--header-height);
  left: 0; bottom: 0;
  width: fit-content;
  border-right: 1px solid #e0e0e0;
  box-shadow: 4px 0 12px rgba(0,0,0,0.08);
  overflow-x: hidden;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s ease, visibility 0s 0.3s;
}
.course-ribbon[data-pos="left"] .pe-toolbar {
  flex-direction: column;
  align-items: stretch;
  padding: 8px;
  gap: 6px;
}
.course-ribbon[data-pos="left"] .course-ribbon-group {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 2px;
}
.course-ribbon[data-pos="left"] .course-ribbon-sep {
  width: 100%; height: 1px;
  background: #e0e0e0; margin: 2px 0;
}


/* ============================================================
   StatsPanel (sp-*)
   ============================================================ */
.sp-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
  overflow: hidden;
}
.sp-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  font-size: 28px;
  color: var(--primary);
}
.sp-error {
  padding: 32px;
  text-align: center;
  color: #c0392b;
  font-size: 14px;
}

/* Ligne heatmap + total */
.sp-top-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #eaecef;
  background: var(--gray-50);
  flex-wrap: wrap;
}

/* Heatmap */
.sp-heatmap-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.sp-heatmap-svg {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
.sp-hm-month {
  font-size: 9px;
  fill: #6e7781;
  font-family: inherit;
}
.sp-hm-day {
  font-size: 9px;
  fill: #6e7781;
  font-family: inherit;
}
.sp-hm-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6e7781;
}
.sp-hm-legend-label { font-size: 11px; }
.sp-hm-legend-sq {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

/* Carte total */
.sp-total-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 110px;
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  flex-shrink: 0;
}
.sp-total-icon {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 1px;
}
.sp-total-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.sp-total-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.sp-total-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Tableau étudiants */
.sp-table-section {
  padding: 16px 24px 20px;
  flex: 1;
  overflow-y: auto;
}

/* DataTable IUT dans le StatsPanel — ajustements d'intégration */
.sp-dt-section .dt-wrapper {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}
.sp-dt-section .dt-scroll-wrap {
  max-height: 340px;
}

/* StatsPanel — mode in-page (sp-page) */
/* Annule le padding des conteneurs parents (.app-content, .course-content) */
.course-content:has(.sp-page) {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-content:has(.sp-page) {
  padding: 0;
  max-width: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.app-main:has(.sp-page) {
  height: 100vh;
}
.page-body:has(.sp-page) {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: auto;
}
.sp-page {
  display: flex;
  flex-direction: column;
  padding: 0;
  flex: 1 0 auto;
  overflow: visible;
}
.sp-page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 20px 24px 10px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #eaecef;
}
.sp-page-title i {
  color: var(--primary);
  font-size: 15px;
}
/* En mode in-page, le DataTable remplit l'espace restant */
.sp-page .sp-dt-section {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}
.sp-page .sp-dt-section .dt-wrapper {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  border-left: none;
  border-right: none;
  border-radius: 0;
}
.sp-page .sp-dt-section .dt-scroll-wrap {
  max-height: none;
  flex: 1 0 auto;
}
.sp-page .sp-top-row {
  background: var(--gray-50);
}
/* Tableau aligné bord à bord avec la heatmap — on retire le padding latéral
   et on neutralise la bordure/rayon du wrapper DataTable */
.sp-page .sp-table-section {
  padding: 12px 0 0;
  flex: 1;
}
/* ============================================================
   RichImageNode — nœud image riche dans l'éditeur
   ============================================================ */
.pe-image-wrapper {
  display: block;
  max-width: 100%;
  line-height: 0;
}
.pe-image-container {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.pe-image-img {
  display: block;
  max-width: 100%;
}
.pe-img-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #cf1578;
  border-radius: 2px;
  z-index: 20;
  pointer-events: all;
  display: none;
}
.ProseMirror-selectednode.pe-image-wrapper .pe-img-handle { display: block; }
.ProseMirror-selectednode.pe-image-wrapper .pe-image-container { outline: 2px solid #cf1578; outline-offset: 2px; }
.pe-img-handle-nw { top:-5px;  left:-5px;            cursor: nw-resize; }
.pe-img-handle-n  { top:-5px;  left:calc(50% - 5px); cursor: n-resize;  }
.pe-img-handle-ne { top:-5px;  right:-5px;            cursor: ne-resize; }
.pe-img-handle-e  { top:calc(50% - 5px); right:-5px;  cursor: e-resize;  }
.pe-img-handle-se { bottom:-5px; right:-5px;          cursor: se-resize; }
.pe-img-handle-s  { bottom:-5px; left:calc(50% - 5px);cursor: s-resize;  }
.pe-img-handle-sw { bottom:-5px; left:-5px;           cursor: sw-resize; }
.pe-img-handle-w  { top:calc(50% - 5px); left:-5px;   cursor: w-resize;  }
@media print { .pe-img-handle { display: none !important; } }

/* ============================================================
   Mind-map — panels supplémentaires (v25)
   ============================================================ */
/* Disposition / Forme buttons */
.mm-layout-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 72px;
  min-height: 56px;
  padding: 4px 6px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  color: var(--text);
  transition: background .15s, border-color .15s;
}
.mm-layout-btn:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}
.mm-layout-btn.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.mm-layout-icon {
  font-size: 22px;
  line-height: 1;
}
.mm-layout-label {
  font-size: 10px;
  text-align: center;
  line-height: 1.2;
}

/* Shape picker panel */
.mm-shape-panel {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 420px;
  padding: 10px;
}
.mm-shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 68px;
  min-height: 52px;
  padding: 4px 4px 3px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.mm-shape-btn:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}
.mm-shape-btn:active {
  background: #dbe5f5;
}
.mm-shape-label {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Icon picker panel */
.mm-icon-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  max-width: 280px;
}
.mm-icon-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.mm-icon-cell:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}
.mm-icon-cell.is-active {
  background: var(--primary);
  border-color: var(--primary);
}

/* Color panel */
.mm-color-panel {
  flex-direction: column !important;
  gap: 4px !important;
  padding: 8px !important;
  min-width: 180px;
}
.mm-color-btn2 {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  transition: background .12s;
}
.mm-color-btn2:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}
.mm-color-reset {
  color: var(--danger, #e74c3c);
  border-color: #fdd;
}
.mm-color-reset:hover {
  background: #fff0f0;
  border-color: var(--danger, #e74c3c);
}

/* Mind-map — color toolbar buttons (text / fill / edge) */
.mm-clr-btn {
  position: relative;
}
.mm-clr-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 1px;
}
.mm-clr-icon b {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.1;
}
.mm-clr-icon i {
  font-size: 14px;
  line-height: 1.1;
}
.mm-clr-bar {
  display: block;
  width: 18px;
  height: 4px;
  border-radius: 1px;
  background: #ccc;
  margin-top: 1px;
}
.mm-clr-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Mind-map — line style panel (width + arrows) */
.mm-line-panel {
  flex-direction: column !important;
  gap: 6px !important;
  padding: 10px !important;
  min-width: 200px;
}
.mm-line-section-label {
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mm-line-row {
  display: flex;
  gap: 4px;
}
.mm-line-width-btn,
.mm-line-arrow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  padding: 0;
  transition: background .12s, border-color .12s;
}
.mm-line-width-btn:hover,
.mm-line-arrow-btn:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}
.mm-line-width-btn svg,
.mm-line-arrow-btn svg {
  display: block;
}
.mm-line-arrow-btn.is-active,
.mm-line-width-btn.is-active,
.mm-line-size-btn.is-active {
  background: #e8f0fe;
  border-color: var(--primary);
}
.mm-btn-disabled,
.mm-line-arrow-btn[disabled],
.mm-line-width-btn[disabled],
.mm-line-size-btn[disabled] {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}
.mm-cap-size-row {
  align-items: center;
  gap: 3px;
  margin-top: -2px;
}
.mm-cap-size-label {
  font-size: 10px;
  color: #888;
  margin-right: 2px;
}
.mm-line-size-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 24px;
  font-size: 10px;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  padding: 0 2px;
  transition: background .12s, border-color .12s;
  overflow: hidden;
}
.mm-line-size-btn:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}

/* ─── DocumentModal ─────────────────────────────────────────────────── */
.dm-form { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.dm-field > .ff-input,
.dm-field > .ff-select,
.dm-field > .ff-date,
.dm-field > .ff-textarea,
.dm-field > .ff-rich,
.dm-field > .ff-password-wrap { flex: 1; min-width: 0; }
.dm-field { display: flex; flex-direction: column; gap: 4px; }
.dm-label { font-size: 13px; font-weight: 600; color: var(--gray-700); line-height: 1.4; }
.dm-input { padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; outline: none; }
.dm-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.dm-input:disabled { background: var(--gray-100); color: var(--gray-400); }
.dm-date { max-width: 170px; }
.dm-score { max-width: 100px; }
.dm-row { display: flex; gap: 16px; }
.dm-row .dm-field { flex: 1; }
.dm-check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 2px 0; }
.dm-check { width: 16px; height: 16px; cursor: pointer; }
.dm-error { background: #fef2f2; color: #b91c1c; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.dm-label-spacer { display: none; }
/* Landscape: labels à gauche des champs */
@media (min-width: 600px) {
  .dm-field { flex-direction: row; align-items: baseline; gap: 10px; }
  .dm-label { width: 120px; min-width: 120px; flex-shrink: 0; }
  .dm-input { flex: 1; min-width: 0; }
  .dm-label-spacer { display: block; }
  .vm-status-row { gap: 0; }
  .vm-status-row .dm-label-spacer { display: block; }
  .dm-row { flex: 1; }
  /* Exception: dates restent en colonne, côte à côte */
  .dm-row .dm-field { flex-direction: column; align-items: stretch; gap: 4px; }
  .dm-row .dm-label { width: auto; }
}

/* ─── Mode description ───────────────────────────────────────── */
.dm-datetime-group { display: flex; gap: 6px; align-items: center; }
.dm-mode-desc { font-size: 12px; color: var(--gray-500); line-height: 1.4; padding: 0 0 0 0; margin-top: -6px; }
@media (min-width: 600px) { .dm-mode-desc { padding-left: 100px; } }

/* ─── Quantity row (select + number side by side) ────────────── */
.dm-quantity-row { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.dm-quantity-row > .ff-select { flex: 1; min-width: 0; }
.dm-quantity-row > .ff-input { width: 80px; flex: 0 0 auto; }

/* ─── FileSettingsModal file info ─────────────────────────────── */
.fm-file-info {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: #f0f4f8; border: 1px solid var(--border, #dde1e7);
  border-radius: var(--radius, 8px); font-size: 13px;
}
.fm-file-info > i { color: var(--primary, #cf1578); font-size: 16px; flex-shrink: 0; }
.fm-file-name { font-weight: 600; color: var(--text, #1a1a1a); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-file-size { color: var(--text-light, #999); font-size: 11px; flex-shrink: 0; }
.fm-file-change {
  width: 26px; min-width: 26px; height: 26px; border: none; border-radius: 50%;
  background: transparent; color: var(--text-light, #999); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  transition: background .15s, color .15s; flex-shrink: 0;
}
.fm-file-change i { transition: color .15s; }
.fm-file-change:hover, .fm-file-del:hover { background: var(--primary, #cf1578); color: #fff; }
.fm-file-change:hover i, .fm-file-del:hover i { color: #fff; }

/* ─── VideoSettingsModal status indicator ────────────────────────── */
.vm-status { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: 6px; font-size: 13px; line-height: 1.4; }
.vm-status i { flex-shrink: 0; margin-top: 2px; font-size: 15px; }
.vm-checking { background: #f0f4ff; color: #4b6baf; }
.vm-valid { background: #f0fdf4; color: #15803d; flex-wrap: wrap; }
.vm-valid i { color: #22c55e; }
.vm-invalid { background: #fef2f2; color: #b91c1c; }
.vm-invalid i { color: #ef4444; }
.vm-preview { text-align: center; }
.vm-thumb { width: 100%; max-width: 280px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
@media (min-width: 600px) {
  .vm-status { margin-left: 0; font-size: 11px; padding: 4px 8px; }
  .vm-preview { text-align: left; padding-left: 130px; }
}

/* ─── Bareme Editor (reuses ee-split / ee-qlist / ee-detail from exercises.css) */
.bar-ribbon { align-items: center; }
.bar-ribbon-total {
  display: flex; align-items: center; gap: 4px;
  font-size: 14px; color: var(--text-secondary); margin-left: 8px;
}
.bar-total-value { font-size: 18px; font-weight: 700; color: var(--text); }
.bar-total-icon { color: var(--accent); }
.bar-form { padding: 4px 0; }
.bar-form .dm-field { align-items: flex-start; }
.bar-form .dm-label { padding-top: 6px; }
.bar-form .ff-textarea { flex: 1; min-width: 0; }
.bar-form .ee-eval-row2 { flex: 1; padding-top: 4px; }
.bar-qlist-score {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  background: #eef2f7; padding: 1px 6px; border-radius: 8px; flex-shrink: 0;
}

/* ─── Deposit file upload zone ─────────────────────────────────────── */
.dep-consigne-ro {
  font-size: 13px; color: var(--text); line-height: 1.5;
  padding: 8px 12px; background: #f8f9fa; border-radius: 6px;
  border: 1px solid var(--border); white-space: pre-wrap;
}
.dep-closed-banner {
  display: flex; align-items: center; padding: 12px 16px;
  background: var(--warning-bg); border: 1px solid #f59e0b; border-radius: 8px;
  color: var(--warning-fg); font-size: 13px; margin-bottom: 8px;
}
.dep-closed-banner i { color: #f59e0b; font-size: 16px; }
.dep-dropzone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 20px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--text-secondary); transition: border-color 0.15s, background 0.15s;
}
.dep-dropzone:hover, .dep-dropzone.is-dragover {
  border-color: var(--secondary); background: #f0f8ff;
}
.dep-dropzone i { font-size: 28px; color: var(--secondary); }
.dep-dropzone span { font-size: 13px; }
.dep-formats { font-size: 11px !important; color: var(--text-light); }
.dep-max { font-size: 11px !important; color: var(--text-light); font-style: italic; }
.dep-file-list { margin-top: 8px; }
.dep-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dep-row { cursor: pointer; transition: background 0.12s; }
.dep-row:hover { background: #f0f6fb; }
.dep-cell { padding: 6px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.dep-cell-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-link { color: var(--secondary-dark); text-decoration: none; }
.dep-link:hover { text-decoration: underline; }
.dep-cell-size { width: 70px; color: var(--text-secondary); text-align: right; white-space: nowrap; }
.dep-cell-date { width: 120px; color: var(--text-secondary); white-space: nowrap; }
.dep-cell-actions { width: 60px; text-align: right; white-space: nowrap; }
.dep-act-btn {
  border: none; background: none; cursor: pointer; color: var(--text-light);
  padding: 4px; border-radius: 3px; font-size: 12px;
}
.dep-act-btn:hover { background: #e0e4e8; color: var(--text); }
.dep-act-del:hover { background: #fde8e8; color: var(--error); }
.dep-empty { padding: 16px; text-align: center; color: var(--text-light); font-size: 13px; font-style: italic; }
.dep-loading { padding: 16px; text-align: center; color: var(--text-light); }

/* ─── Embed preview + status ───────────────────────────────────────── */
.embed-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 6px 0;
}
.embed-status i { font-size: 14px; }
.embed-status-ok { color: #16a34a; }
.embed-status-ok i { color: #16a34a; }
.embed-status-warn { color: #d97706; }
.embed-status-warn i { color: #d97706; }
.embed-preview {
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  padding: 8px;
  background: var(--gray-50);
  max-height: 200px;
  overflow: auto;
}
.embed-preview iframe { max-width: 100%; border: none; }

/* ─── FormField — cross-platform form components ───────────────────── */

/* Text / password */
.ff-input {
  padding: 6px 10px;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text, #1a1a1a);
  background: #fff;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ff-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-input:disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
}
.ff-input::placeholder {
  color: var(--text-light, #999);
}
/* Select search input */
.ff-select-search {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, var(--gray-300));
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.ff-select-search-input {
  width: 100%;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
.ff-select-search-input:focus {
  border-color: var(--primary);
}

/* Flag images in selects */
.ff-flag {
  vertical-align: middle;
  margin-right: 2px;
  border-radius: 2px;
}
.ff-country-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Phone field with country prefix */
.ff-phone-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s;
}
.ff-phone-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-phone-prefix {
  padding: 6px 10px;
  font-size: 14px;
  color: #555;
  white-space: nowrap;
  background: #f8f9fa;
  border-right: 1px solid var(--border, var(--gray-300));
  flex-shrink: 0;
  user-select: none;
}
.ff-phone-input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  flex: 1;
  min-width: 0;
}
.ff-phone-input:focus {
  box-shadow: none !important;
}

.ff-password-wrap {
  position: relative;
  display: flex;
  width: 100%;
}
.ff-password-wrap .ff-input {
  padding-right: 36px;
}
.ff-password-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--text-light, #999);
  font-size: 13px;
}
.ff-password-toggle:hover { color: var(--text); }

/* Textarea */
.ff-textarea {
  padding: 6px 10px;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text, #1a1a1a);
  background: #fff;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ff-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-textarea:disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
}

/* Rich Textarea (reuses pe-* toolbar classes from PageEditor) */
.ff-rich {
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  background: #fff;
  overflow: visible;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ff-rich:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-rich.is-disabled {
  background: var(--gray-100);
  pointer-events: none;
  opacity: .6;
}
.ff-rich-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border, var(--gray-200));
  background: var(--gray-50);
  border-radius: 6px 6px 0 0;
  flex-wrap: wrap;
}
.ff-rich-toolbar .pe-color-panel,
.ff-rich-toolbar .pe-heading-list,
.ff-rich-toolbar .pe-fontsize-list {
  z-index: 10002;
}
.ff-rich-editor {
  position: relative;
  /* padding gauche/droite ≥ HANDLE_SIZE(14) + HANDLE_GAP(2) + marge visuelle */
  padding: 20px 22px;
  font-size: 14px;
  line-height: 1.5;
  overflow-y: auto;
  max-height: 300px;
}
.ff-rich-editor .tiptap { outline: none; min-height: inherit; }
.ff-rich-editor .tiptap p { margin: 0 0 4px; }
.ff-rich-editor .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--gray-400);
  pointer-events: none;
  height: 0;
}
.ff-rich-content[data-placeholder]:empty::before,
.ff-rich-editor .tiptap > .is-empty::before {
  content: attr(data-placeholder);
  color: var(--gray-400);
  pointer-events: none;
}

/* Rich textarea — resize colonne (même que .pe-page, scopé .ff-rich-editor) */
.ff-rich-editor .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: #4a9eff;
  pointer-events: none;
  z-index: 1;
}
.ff-rich-editor .resize-cursor {
  cursor: col-resize;
}

/* Rich textarea — table styles */
.ff-rich-editor .tiptap table {
  border-collapse: collapse;
  width: 100%;
  /* margin ≥ HANDLE_SIZE(14) + HANDLE_GAP(2) pour que les poignées haut/bas
     n'empiètent pas sur le texte environnant */
  margin: 20px 0;
  table-layout: fixed;
}
.ff-rich-editor .tiptap table td,
.ff-rich-editor .tiptap table th {
  border: 1px solid var(--gray-300);
  padding: 4px 8px;
  min-width: 40px;
  vertical-align: top;
  font-size: 13px;
  position: relative;
}
.ff-rich-editor .tiptap table th {
  background: var(--gray-100);
  font-weight: 600;
}
.ff-rich-editor .tiptap table .selectedCell {
  background: #dbeafe;
}

/* Number */
.ff-number {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s;
  max-width: 140px;
  height: 32px;
}
.ff-number:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-number.is-disabled {
  background: var(--gray-100);
  opacity: 0.6;
  pointer-events: none;
}
.ff-number-input {
  border: none;
  outline: none;
  text-align: center;
  width: 50px;
  min-width: 50px;
  flex: 1 1 50px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  padding: 4px 2px;
  -moz-appearance: textfield;
}
.ff-number-input::-webkit-outer-spin-button,
.ff-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ff-number-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-width: 30px;
  height: 100%;
  flex-shrink: 0;
  border: none;
  background: var(--gray-100);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  padding: 0;
  line-height: 1;
}
.ff-number-btn:hover { background: var(--gray-200); }
.ff-number-btn:active { background: var(--gray-300); }

/* Pills selector */
.ff-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 16px;
  background: #fff;
  color: var(--text-light, #666);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.3;
}
.ff-pill:hover { background: #f0f6fb; border-color: #90caf9; color: var(--text); }
.ff-pill.is-active {
  background: #fff;
  border-color: var(--primary, #cf1578);
  color: var(--primary, #cf1578);
  font-weight: 600;
}
.ff-pill.is-active:hover { background: #fef2f6; }
.ff-pills.is-disabled .ff-pill {
  opacity: 0.5;
  pointer-events: none;
}

/* Checkbox */
.ff-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.ff-checkbox.is-disabled {
  opacity: 0.7;
  pointer-events: none;
}
.ff-checkbox.is-disabled .ff-checkbox-native:checked + .ff-checkbox-box {
  background: #b0b0b0;
  border-color: #b0b0b0;
}
.ff-checkbox-native {
  position: fixed;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  top: -9999px;
  left: -9999px;
}
.ff-checkbox-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 2px solid #b0b0b0;
  border-radius: 4px;
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.ff-checkbox-svg {
  width: 12px;
  height: 10px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.12s;
}
.ff-checkbox-native:checked + .ff-checkbox-box {
  background: var(--primary);
  border-color: var(--primary);
}
.ff-checkbox-native:checked + .ff-checkbox-box .ff-checkbox-svg {
  opacity: 1;
}
.ff-checkbox-native:focus-visible + .ff-checkbox-box {
  box-shadow: 0 0 0 2px rgba(207,21,120,.2);
}

/* Select */
.ff-select {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
  position: relative;
  min-width: 100px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
  outline: none;
}
.ff-select:focus, .ff-select.is-open {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-select.is-disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  pointer-events: none;
}
.ff-select-display {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ff-select-arrow {
  margin-left: 8px;
  font-size: 11px;
  color: var(--text-light, #999);
  flex-shrink: 0;
}
.ff-select-panel {
  background: #fff;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.ff-select-option {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}
.ff-select-option:hover {
  background: var(--bg, #f0f2f5);
}
.ff-select-option.is-selected {
  background: rgba(207,21,120,.08);
  color: var(--primary);
  font-weight: 600;
}

/* Date picker */
.ff-date {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  width: 140px; max-width: 140px;
  transition: border-color 0.15s;
}
.ff-date:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(207,21,120,.12);
}
.ff-date.is-disabled {
  background: var(--gray-100);
  opacity: 0.6;
  pointer-events: none;
}
.ff-date-input {
  border: none;
  outline: none;
  padding: 5px 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  width: 100%;
  min-width: 0;
}
.ff-date-input::placeholder { color: var(--text-light, #999); }
/* Time input */
.ff-time {
  display: inline-flex; align-items: center; gap: 2px;
  background: #fff;
  border: 1px solid var(--border, var(--gray-300)); border-radius: 6px;
  padding: 4px 6px;
  width: auto; max-width: none;
}
.ff-time-col {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.ff-time-btn {
  border: none; background: none; color: var(--text-light, #999);
  cursor: pointer; padding: 0; line-height: 1; font-size: 9px;
  width: 28px; height: 14px; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; transition: background 0.12s, color 0.12s;
}
.ff-time-btn:hover { background: #f0f4ff; color: var(--secondary, #30b0f3); }
.ff-time-btn:active { background: #dbeafe; }
.ff-time-digit {
  width: 28px; text-align: center; border: none; outline: none;
  font-size: 15px; font-weight: 600; font-family: inherit;
  color: var(--text, #1a1a1a); background: transparent;
  padding: 0; line-height: 1.2;
}
.ff-time-digit:focus { background: #f0f4ff; border-radius: 3px; }
.ff-time-sep {
  font-size: 16px; font-weight: 700; color: var(--text-secondary, #6b6b6b);
  padding: 0 1px; align-self: center; margin-top: 1px;
}
.ff-time.is-disabled { opacity: .5; pointer-events: none; }
.ff-date-btn {
  border: none;
  background: var(--gray-100);
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.12s;
}
.ff-date-btn:hover { background: var(--gray-200); }

/* Calendar panel */
.ff-cal-panel {
  background: #fff;
  border: 1px solid var(--border, var(--gray-300));
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  padding: 10px;
  width: 260px;
  user-select: none;
}
.ff-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ff-cal-nav {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 8px;
  color: var(--text-secondary);
  border-radius: 4px;
  transition: background 0.12s;
}
.ff-cal-nav:hover { background: #f0f0f0; }
.ff-cal-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
}
.ff-cal-days, .ff-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}
.ff-cal-dayname {
  font-size: 11px;
  color: var(--text-light, #999);
  font-weight: 600;
  padding: 4px 0;
}
.ff-cal-cell {
  padding: 5px 0;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
}
.ff-cal-cell:hover { background: #f0f2f5; }
.ff-cal-cell.is-today {
  font-weight: 700;
  color: var(--primary);
}
.ff-cal-cell.is-selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.ff-cal-cell.is-selected:hover { background: var(--primary-dark); }
.ff-cal-empty { cursor: default; }

/* ─── Toast notifications ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: #333;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 320px;
  line-height: 1.4;
}
.toast-visible {
  opacity: 1;
  transform: translateX(0);
}
.toast i {
  font-size: 12px;
  color: var(--primary);
  flex-shrink: 0;
}

/* ── SaveIndicator — discreet top-center pill ─────────────────── */
.save-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 16px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  animation: save-ind-in .2s ease-out;
}
@keyframes save-ind-in { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.save-indicator.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity .3s, transform .3s;
  animation: none;
}
.save-indicator i { font-size: 10px; }
.save-indicator.is-saving { background: rgba(11,62,102,0.9); }
.save-indicator.is-saved  { background: rgba(22,101,52,0.9); }
.save-indicator.is-error  { background: rgba(185,28,28,0.9); }

/* ══════════════════════════════════════════════════════════════
   FullscreenViewer — plein écran avec barre latérale
   ══════════════════════════════════════════════════════════════ */
.fsv-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 9000; display: flex;
  background: var(--bg-dark, #0b3e66);
  overflow: hidden;
}
/* Sidebar */
.fsv-sidebar {
  width: 44px; flex-shrink: 0;
  background: rgba(0,0,0,.2);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; border-right: 1px solid rgba(255,255,255,.08);
}
.fsv-back-btn { flex-shrink: 0; }
.fsv-back-btn:hover { background: #ef4444; color: #fff; }
.fsv-sidebar-sep { width: 20px; height: 1px; background: rgba(255,255,255,.08); margin: 4px 0; flex-shrink: 0; }
.fsv-tools { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.fsv-sidebar-spacer { flex: 1; }
/* Bottom tools (live controls) */
.fsv-bottom-tools {
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  padding: 6px 0 4px;
  border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.fsv-bottom-tools:empty { display: none; }
.fsv-bottom-btn { color: rgba(255,255,255,.35); }
.fsv-bottom-btn:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.7); }
.fsv-bottom-btn.fsv-bottom-on { background: var(--primary, #2980b9); color: #fff; }
.fsv-bottom-btn.fsv-bottom-on:hover { background: #2471a3; }
.fsv-bottom-btn.fsv-bottom-danger.fsv-bottom-on { background: #ef4444; }
.fsv-bottom-btn.fsv-bottom-danger.fsv-bottom-on:hover { background: #dc2626; }
.fsv-tool-btn {
  width: 32px; height: 32px; border: 2px solid transparent; border-radius: 8px;
  background: transparent; color: #64748b; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all .15s; box-sizing: border-box;
}
/* Muted: unavailable */
.fsv-tool-btn.fsv-tool-flash { animation: fsv-flash 0.6s ease-in-out 3; }
@keyframes fsv-flash { 0%,100% { background: transparent; } 50% { background: rgba(245,158,11,.4); color: #f59e0b; } }
.fsv-tool-btn.fsv-tool-muted { opacity: 0.2; cursor: not-allowed; }
.fsv-tool-btn.fsv-tool-muted:hover { background: transparent; color: #64748b; border-color: transparent; }
/* Available: outlined border */
.fsv-tool-btn:not(.fsv-tool-muted):not(.active):not(.fsv-back-btn) { border-color: rgba(255,255,255,.2); color: #94a3b8; }
.fsv-tool-btn:not(.fsv-tool-muted):not(.active):not(.fsv-back-btn):hover { border-color: var(--primary, #2980b9); color: #fff; background: rgba(255,255,255,.06); }
/* Panels (collapsible, overlay on top of main) */
.fsv-panel-slot { position: absolute; left: 44px; top: 0; height: 100%; z-index: 10; pointer-events: none; }
.fsv-panel-wrap { display: flex; height: 100%; position: relative; pointer-events: auto; }
.fsv-panel {
  width: 240px; display: flex; flex-direction: column;
  background: rgba(11,62,102,.95); border-right: 1px solid rgba(255,255,255,.1);
  overflow: hidden; transition: width .2s;
}
.fsv-panel--collapsed { width: 0 !important; border: none !important; }
.fsv-panel-toggle {
  position: absolute; right: -24px; top: 50%; transform: translateY(-50%);
  z-index: 5; width: 24px; height: 60px; border: none; border-radius: 0 8px 8px 0;
  background: rgba(59,130,246,.3); color: #93c5fd; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.fsv-panel-toggle:hover { background: rgba(59,130,246,.6); color: #fff; }
/* Active: filled */
.fsv-tool-btn.active { background: var(--primary, #2980b9); color: #fff; border-color: var(--primary, #2980b9); }
.fsv-close-btn:hover { background: #ef4444; color: #fff; }
/* Main area */
.fsv-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  position: relative;
}
/* Proctoring inline inside FullscreenViewer content */
.fsv-proct-inline { width: 100%; }
.fsv-proct-inline .proct-page { background: none; }
/* Proctoring controls injected in exercise runner header */
.er-proct-controls {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
}
.er-proct-time {
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,.6);
}
.er-proct-label {
  font-size: 13px; font-weight: 600; color: #93c5fd;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
}
.er-proct-sound {
  width: 28px; height: 28px; border: none; border-radius: 6px;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.5);
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.er-proct-sound:hover { background: rgba(255,255,255,.2); }
.er-proct-date {
  padding: 3px 6px; border: 1px solid rgba(255,255,255,.2); border-radius: 5px;
  background: rgba(255,255,255,.1); color: var(--gray-200); font-size: 11px;
  outline: none; cursor: pointer;
}
.er-proct-date option { background: #1e293b; color: var(--gray-200); }
.er-proct-sound.is-active { background: var(--primary); color: #fff; }
/* Hide timer + counter when in proctoring mode */
.proct-mode .er-timer { display: none !important; }
.proct-mode .er-timer-bar { display: none !important; }
.proct-mode .er-counter { display: none !important; }

/* PDF inside FullscreenViewer */
/* PDF toolbar inside FullscreenViewer — light grey to contrast with dark background */
.fsv-content .pdfa-toolbar {
  background: var(--gray-100); border-color: var(--gray-200);
  color: var(--gray-700);
}
.fsv-content .pdfa-tool-btn { color: var(--gray-600); }
.fsv-content .pdfa-tool-btn:hover { background: var(--gray-200); color: var(--gray-800); }
.fsv-content .pdfa-tool-btn.active { background: var(--primary); color: #fff; }
.fsv-content .pdfa-save-btn { background: var(--primary); color: #fff; }
.fsv-content .pdfa-save-btn:hover { background: var(--primary-dark); color: #fff; }
.fsv-content .pdfa-flatten-btn { color: var(--gray-600); }
.fsv-content .pdfa-flatten-btn:hover { background: var(--gray-200); color: var(--gray-800); }
.fsv-content .pdfa-collab-btn { color: var(--gray-600); }
.fsv-content .pdfa-collab-btn.is-active { background: var(--primary); color: #fff; }
.fsv-content .pdfa-size-slider { accent-color: var(--primary); }
.pdfa-personal-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; color: var(--gray-500);
  white-space: nowrap;
}
.pdfa-personal-label i { font-size: 12px; }
.fsv-content .pdfa-personal-label { color: var(--gray-500); }
/* Presentation button */
.pdfa-pres-btn.is-active { background: #ef4444 !important; color: #fff !important; }
.fsv-content .pdfa-pres-btn.is-active { background: #ef4444 !important; color: #fff !important; }
/* Student status labels */
.pdfa-status--pres { color: #ef4444 !important; font-weight: 600; }
.pdfa-status--pres i { color: #ef4444 !important; }
.pdfa-status--collab { color: var(--primary) !important; font-weight: 600; }
.pdfa-status--collab i { color: var(--primary) !important; }
.fsv-content .pdfa-pages { flex: 1; }

/* Written document inside FullscreenViewer */
.fsv-content--written {
  padding: 0 !important;
  background: #d0d0d0 !important;
  color: #1a1a1a !important;
  justify-content: stretch !important;
  overflow: hidden !important;
}
.fsv-content--live {
  padding: 0 !important;
  background: #fff !important;
  color: var(--text) !important;
  justify-content: stretch !important;
  overflow: hidden !important;
}
.fsv-content--written .docview-editor {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.fsv-content--written .pe-wrapper {
  flex: 1; min-height: 0; overflow: hidden;
}
.fsv-content--written .pe-pages-container {
  overflow-y: auto !important; flex: 1; min-height: 0;
}

/* Collab work — group panel (sidebar tool) */
.collab-group-panel {
  padding: 20px; height: 100%; overflow-y: auto;
}
.collab-panel-title {
  font-size: 16px; font-weight: 600; color: #1e293b;
  padding-bottom: 12px; border-bottom: 1px solid #e2e8f0; margin-bottom: 16px;
}
.collab-panel-grid {
  display: flex; flex-wrap: wrap; gap: 16px;
}
.collab-panel-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px; border-radius: 10px; background: #f8fafc;
  border: 1px solid #e2e8f0; min-width: 90px;
}
.collab-panel-card .avatar-wrap {
  width: 48px !important; height: 48px !important;
}
.collab-panel-name {
  font-size: 12px; color: #475569; text-align: center; line-height: 1.3;
}
.collab-ribbon-empty {
  font-size: 13px; color: #94a3b8; font-style: italic; padding: 20px;
}

/* PageEditor — Author highlight (collab) — styled by JS toggle */

/* PageEditor — Groupe toolbar (collab members) */
.pe-groupe-toolbar {
  display: flex; align-items: center; gap: 12px; padding: 6px 12px;
}
.pe-groupe-member {
  display: flex; align-items: center; gap: 6px;
}
.pe-groupe-avatar-wrap {
  position: relative; flex-shrink: 0;
}
.pe-groupe-avatar-wrap .avatar-wrap {
  width: 32px !important; height: 32px !important;
  border-radius: 50%; overflow: hidden; border: 2px solid #e2e8f0;
}
.pe-groupe-color-dot {
  position: absolute; top: -2px; right: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}
.pe-groupe-name {
  font-size: 12px; color: #475569; white-space: nowrap;
}
.pe-groupe-empty {
  font-size: 13px; color: #94a3b8; font-style: italic;
}
/* Teacher: group list buttons */
.pe-groupe-card-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 14px; border-radius: 6px; border: 1px solid #e2e8f0;
  background: #f8fafc; cursor: pointer; transition: background 0.15s;
}
.pe-groupe-card-btn:hover { background: #e0f2fe; border-color: #93c5fd; }
.pe-groupe-card-label { font-size: 13px; font-weight: 600; color: #1e293b; }
.pe-groupe-card-count { font-size: 11px; color: #64748b; }
/* Back arrow + selected label */
.pe-groupe-back-btn {
  background: none; border: none; cursor: pointer; font-size: 16px;
  color: #475569; padding: 4px 8px; border-radius: 4px;
}
.pe-groupe-back-btn:hover { background: #e2e8f0; }
.pe-groupe-sel-label {
  font-size: 13px; font-weight: 600; color: #1e293b;
  padding-right: 8px; border-right: 1px solid #cbd5e1; margin-right: 4px;
}

/* Audio inside FullscreenViewer */
.fsv-content--audio {
  justify-content: center !important;
  align-items: center !important;
  padding: 40px !important;
}
.fsv-audio-wrap {
  width: 100%; max-width: 700px;
}

.fsv-proct-inline .proct-header { display: none; }
.fsv-proct-inline .proct-controls { color: var(--gray-200); }
.fsv-proct-inline .proct-summary { color: var(--gray-400); }
.fsv-proct-inline .proct-card { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.fsv-proct-inline .proct-card:hover { border-color: rgba(255,255,255,.3); }
.fsv-proct-inline .proct-card--alert { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.3); }
.fsv-proct-inline .proct-card-name { color: var(--gray-200); }
.fsv-proct-inline .proct-badge { color: var(--gray-400); font-size: 18px; }
.fsv-proct-inline .proct-badge--danger { background: #ef4444; color: #fff; }
.fsv-proct-inline .proct-badge--danger i { color: #fff; }
.fsv-proct-inline { overflow-y: auto; max-height: 100%; }
.fsv-proct-inline .proct-back { display: none; }
.fsv-proct-inline .proct-content { overflow-y: auto; }
.fsv-proct-inline .proct-detail-back { color: #93c5fd; }
.fsv-proct-inline .proct-detail-name { color: var(--gray-200); }
.fsv-proct-inline .proct-detail-stats { color: var(--gray-400); }
.fsv-proct-inline .proct-detail-section-title { color: var(--gray-400); }
.fsv-proct-inline .proct-detail-act { color: var(--gray-300); }
.fsv-proct-inline .proct-event { color: var(--gray-300); border-left-color: rgba(255,255,255,.1); }
.fsv-proct-inline .proct-event--suspect { border-left-color: #f87171; background: rgba(239,68,68,.1); }
.fsv-proct-inline .proct-event-time { color: var(--gray-500); }
.fsv-proct-inline .proct-empty { color: var(--gray-500); }
.fsv-proct-inline .proct-date { background: rgba(255,255,255,.1); color: var(--gray-200); border-color: rgba(255,255,255,.15); }
.fsv-header {
  padding: 8px 24px;
  background: var(--bg-dark, #0b3e66);
  border-bottom: 1px solid rgba(255,255,255,.1);
  color: var(--text-inverse, #fff); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.fsv-content {
  flex: 1; overflow-y: auto; padding: 20px 32px; color: var(--gray-200);
  display: flex; flex-direction: column; justify-content: center;
  background: rgba(0,0,0,.15);
}
.fsv-footer {
  padding: 10px 20px;
  background: var(--bg-dark, #0b3e66);
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
  color: var(--text-inverse, #fff);
}
/* Footer navigation buttons */
.fsv-nav-btn {
  padding: 7px 20px; border: none; border-radius: 6px;
  background: rgba(255,255,255,.15); color: #fff; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; gap: 6px; transition: background .15s;
}
.fsv-nav-btn:hover { background: rgba(255,255,255,.25); }
.fsv-nav-btn:disabled { opacity: .3; cursor: default; }
.fsv-nav-btn-primary { background: var(--primary, #2980b9); color: #fff; }
.fsv-nav-btn-primary:hover { background: var(--primary-dark, #1a6898); }
/* Progress bar */
.fsv-progress { color: var(--gray-400); font-size: 13px; }
.fsv-progress-bar {
  height: 4px; background: var(--gray-700); border-radius: 2px; flex: 1; min-width: 100px;
}
.fsv-progress-fill {
  height: 100%; background: #4f46e5; border-radius: 2px; transition: width .3s;
}
/* ── FullscreenViewer — Mobile (< 600px) ── */
@media (max-width: 600px) {
  /* Remove sidebar — full screen for content */
  .fsv-sidebar { display: none !important; }

  /* Overlay: column layout, strict viewport bounds */
  .fsv-overlay {
    flex-direction: column; width: 100vw; height: 100vh;
    max-width: 100vw; overflow: hidden;
  }

  /* Main: strict column, no overflow leak */
  .fsv-main {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden; width: 100%; max-width: 100vw; min-width: 0;
  }

  /* Header: compact single row */
  .fsv-header {
    padding: 4px 8px; font-size: 12px; gap: 4px;
    min-height: 34px; flex-shrink: 0;
  }
  .fsv-header-back {
    width: 28px; height: 28px; min-width: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--gray-200); font-size: 15px;
    cursor: pointer; border-radius: 6px; flex-shrink: 0;
  }
  .fsv-header-back:active { background: rgba(255,255,255,.12); }

  /* Content: fills remaining space, scrolls internally, NO centering */
  .fsv-content {
    flex: 1 1 0; min-height: 0;
    padding: 2px 0; overflow-y: auto; overflow-x: hidden;
    justify-content: flex-start; align-items: stretch;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw; width: 100%;
  }

  /* Footer: always pinned at bottom, never pushed off-screen */
  .fsv-footer {
    padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom));
    gap: 6px; flex-shrink: 0;
  }
  .fsv-nav-btn {
    padding: 8px 4px; font-size: 13px; min-height: 38px;
    flex: 1; justify-content: center; border-radius: 8px;
  }
}

/* ============================================
   Competence Panel — 3-column tree editor
   ============================================ */

.comp-page { padding: 0; display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: hidden; }

/* ── Grid: 3 equal columns ─────────────────── */
.comp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.comp-col {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}

/* ── Column header ─────────────────────────── */
.comp-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-dark);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.comp-col-badge {
  background: rgba(255,255,255,0.2);
  color: var(--text-inverse);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

/* ── Input row ─────────────────────────────── */
.comp-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.comp-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.comp-input:focus { border-color: var(--secondary); }

.comp-add-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: var(--success);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.comp-add-btn:hover { background: #3aad5b; }

/* ── List ──────────────────────────────────── */
.comp-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.comp-list::-webkit-scrollbar { width: 5px; }
.comp-list::-webkit-scrollbar-track { background: transparent; }
.comp-list::-webkit-scrollbar-thumb { background: #c8c8c8; border-radius: 3px; }

/* ── Item ──────────────────────────────────── */
.comp-item {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  gap: 6px;
  min-height: 36px;
}
.comp-item:hover { background: #f0f6fb; }
.comp-item.is-selected {
  background: #e3f0fa;
  border-left-color: var(--secondary);
  font-weight: 600;
}

.comp-item-label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.comp-item.is-selected .comp-item-label { color: var(--bg-dark); }

/* ── Item actions ──────────────────────────── */
.comp-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
  flex-shrink: 0;
}
.comp-item:hover .comp-item-actions { opacity: 1; }

.comp-action-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.12s, color 0.12s;
}
.comp-action-btn:hover { background: #e0e4e8; color: var(--text); }
.comp-action-del:hover { background: #fde8e8; color: var(--error); }

/* ── Rename input ──────────────────────────── */
.comp-rename-input {
  flex: 1;
  border: 1px solid var(--secondary);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.35;
  color: var(--text);
  outline: none;
  background: #fff;
  resize: none;
  overflow: hidden;
}

/* ── Drag indicators ───────────────────────── */
.comp-item.is-dragging { opacity: 0.3; }
.comp-drag-ghost {
  background: #e3f0fa !important;
  border: 1px solid var(--secondary);
  border-left: 3px solid var(--secondary);
  border-radius: 6px;
  padding: 7px 10px;
}
.comp-item.drag-above { box-shadow: inset 0 2px 0 var(--secondary); }
.comp-item.drag-below { box-shadow: inset 0 -2px 0 var(--secondary); }

/* ── Empty / hint states ───────────────────── */
.comp-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  font-style: italic;
}

/* ── Mobile tabs (hidden on desktop) ───────── */
.comp-mobile-tabs { display: none; }

/* ── Responsive: tablet / small desktop ────── */
@media (max-width: 1024px) {
  .comp-grid { gap: 8px; padding: 12px; }
  .comp-col-header { padding: 8px 10px; font-size: 12px; }
  .comp-item { padding: 6px 8px; min-height: 32px; }
  .comp-item-label { font-size: 12px; }
}

/* ── Responsive: mobile (<768px) ───────────── */
@media (max-width: 767px) {
  .comp-grid {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: auto;
    padding: 0 8px 8px;
    gap: 0;
  }

  .comp-col {
    display: none;
    border-radius: 0 0 var(--radius) var(--radius);
    min-height: 50vh;
    max-height: 60vh;
  }
  .comp-col.is-visible { display: flex; }

  .comp-mobile-tabs {
    display: flex;
    gap: 0;
    padding: 8px 8px 0;
    overflow-x: auto;
  }
  .comp-mobile-tab {
    flex: 1;
    padding: 10px 8px;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    text-align: center;
  }
  .comp-mobile-tab.is-active {
    color: var(--secondary);
    border-bottom-color: var(--secondary);
    background: var(--bg-card);
  }

  .comp-col-header { font-size: 12px; padding: 8px 10px; }
  .comp-item { padding: 10px 12px; min-height: 40px; }
  .comp-item-label { font-size: 14px; }
  .comp-item-actions { opacity: 1; }
  .comp-input { font-size: 14px; padding: 8px 12px; }
  .comp-add-btn { width: 36px; height: 36px; font-size: 16px; }
}

/* ============================================
   Groups Panel — 3-zone student group manager
   ============================================ */

.grp-page { padding: 0; display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: hidden; }

.grp-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2fr 2fr;
  gap: 10px;
  padding: 12px;
  flex: 1; min-height: 0; overflow: hidden;
}
.grp-col {
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; min-height: 0;
}
.grp-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg-dark); color: var(--text-inverse);
  font-weight: 600; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.5px; flex-shrink: 0;
}
.grp-col-header-assigned { background: var(--secondary-dark); }
.grp-col-badge {
  background: rgba(255,255,255,0.2); color: var(--text-inverse);
  font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; min-width: 22px; text-align: center;
}
.grp-input-row {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.grp-input {
  width: calc(100% - 40px); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font-size: 13px; color: var(--text); outline: none;
  box-sizing: border-box;
}
.grp-input:focus { border-color: var(--secondary); }
.grp-search { border-color: transparent; background: var(--bg); }
.grp-search:focus { border-color: var(--secondary); background: #fff; }
.grp-add-btn {
  width: 32px; height: 32px; display: flex; align-items: center;
  justify-content: center; border: none; border-radius: 6px;
  background: var(--success); color: #fff; cursor: pointer;
  font-size: 14px; flex-shrink: 0;
}
.grp-add-btn:hover { background: #3aad5b; }

/* ── Lists ──────────────────────────────── */
.grp-list {
  flex: 1; overflow-y: auto; list-style: none;
  margin: 0; padding: 4px 0; min-height: 0;
}
.grp-list::-webkit-scrollbar { width: 5px; }
.grp-list::-webkit-scrollbar-thumb { background: #c8c8c8; border-radius: 3px; }

/* ── Group items ────────────────────────── */
.grp-item {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}
.grp-item:hover { background: #f0f6fb; }
.grp-item.is-selected {
  background: #e3f0fa; border-left-color: var(--secondary); font-weight: 600;
}
.grp-item-label { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-item-count {
  background: var(--bg); font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px; color: var(--text-secondary); flex-shrink: 0;
}
.grp-item-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; flex-shrink: 0; }
.grp-item:hover .grp-item-actions { opacity: 1; }
.grp-act-btn {
  width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; border: none; border-radius: 4px;
  background: transparent; color: var(--text-light); cursor: pointer; font-size: 11px;
}
.grp-act-btn:hover { background: #e0e4e8; color: var(--text); }
.grp-act-del:hover { background: #fde8e8; color: var(--error); }
.grp-rename-input {
  flex: 1; border: 1px solid var(--secondary); border-radius: 4px;
  padding: 3px 8px; font-size: 13px; outline: none;
}

/* ── Student items ──────────────────────── */
.grp-student {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer;
  transition: background 0.12s; border-bottom: 1px solid #f5f5f5;
}
.grp-student:last-child { border-bottom: none; }
.grp-student:hover { background: #f0f6fb; }
.grp-student.is-assigned:hover { background: #fef3f3; }
.grp-student-name {
  flex: 1; font-size: 13px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grp-student-action {
  flex-shrink: 0; font-size: 16px; color: var(--success); transition: color 0.12s;
}
.grp-student.is-assigned .grp-student-action { color: var(--error); }
.grp-student:hover .grp-student-action { transform: scale(1.15); }

/* ── Empty / loading states ─────────────── */
.grp-empty {
  padding: 20px 14px; text-align: center;
  color: var(--text-light); font-size: 13px; font-style: italic;
}
.grp-loading { padding: 24px; text-align: center; color: var(--text-light); font-size: 16px; }

/* ── Responsive: tablet ─────────────────── */
@media (max-width: 1024px) {
  .grp-grid { grid-template-columns: minmax(160px, 1fr) 2fr 2fr; gap: 8px; padding: 8px; }
}

/* ── Responsive: mobile ─────────────────── */
@media (max-width: 767px) {
  .grp-grid {
    display: flex; flex-direction: column;
    height: auto; padding: 8px; gap: 8px;
  }
  .grp-col { max-height: 35vh; }
  .grp-item-actions { opacity: 1; }
  .grp-student { padding: 10px 12px; }
  .grp-student-name { font-size: 14px; }
}

/* ── Group color dots ───────────────────────────────────────────────────────── */
.grp-color-dot {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0; border: 2px solid rgba(255,255,255,.7);
  box-shadow: 0 0 0 1px rgba(0,0,0,.1);
}
.grp-color-dot--item { width: 10px; height: 10px; margin-right: 6px; border-width: 1px; }
.grp-color-dot--sm { width: 10px; height: 10px; border-width: 1px; cursor: default; }
.grp-color-dot--xs { width: 7px; height: 7px; border: none; cursor: default; }

.grp-color-picker {
  position: fixed; z-index: 10001;
  display: flex; gap: 4px; padding: 6px 8px;
  background: #fff; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.grp-color-swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  transition: transform .1s;
}
.grp-color-swatch:hover { transform: scale(1.2); }

/* ── Assignment modal ──────────────────────────────────────────────────────── */
.asgn-radios {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.asgn-radio {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--gray-200); font-size: 13px; font-weight: 500;
  color: var(--gray-700); transition: border-color .15s, background .15s;
}
.asgn-radio:hover { border-color: #93c5fd; }
.asgn-radio.is-active {
  border-color: var(--primary); background: #eff6ff; color: var(--primary);
}
.asgn-radio i { font-size: 15px; }

.asgn-panel { display: flex; flex-direction: column; gap: 14px; }
.asgn-columns { display: flex; gap: 0; }
.asgn-section--students { flex: 3; min-width: 0; padding-left: 14px; }
.asgn-section { flex: 2; padding-right: 14px; border-right: 1px solid var(--gray-200); }
@media (max-width: 600px) {
  .asgn-columns { flex-direction: column; }
  .asgn-section--students { padding-left: 0; padding-top: 12px; }
  .asgn-section { padding-right: 0; border-right: none; border-bottom: 1px solid var(--gray-200); padding-bottom: 12px; }
}

.asgn-section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: var(--gray-500); margin-bottom: 6px; letter-spacing: .03em;
}

.asgn-group-list { display: flex; flex-direction: column; gap: 2px; }
.asgn-group-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--gray-800);
}
.asgn-group-row:hover { background: var(--gray-100); }
.asgn-group-row input[type="checkbox"] { margin: 0; }
.asgn-group-name { flex: 1; }
.asgn-group-count { font-size: 12px; color: var(--gray-400); }

.asgn-search {
  width: 100%; padding: 7px 10px; border: 1px solid var(--gray-300);
  border-radius: 6px; font-size: 13px; outline: none;
  margin-bottom: 6px;
}
.asgn-search:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }

.asgn-student-list {
  max-height: 200px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
}
.asgn-student-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px; cursor: pointer;
  font-size: 13px; color: var(--gray-800);
}
.asgn-student-row:hover { background: var(--gray-100); }
.asgn-student-row input[type="checkbox"] { margin: 0; }
.asgn-student-name { flex: 1; }
.asgn-student-dots { display: flex; gap: 3px; align-items: center; }
.asgn-via-group { opacity: .6; }
.asgn-via-group input[type="checkbox"] { accent-color: var(--gray-400); }

.asgn-empty { font-size: 13px; color: var(--gray-400); padding: 8px; font-style: italic; }

.asgn-counter {
  margin-top: 12px; padding: 8px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; text-align: center;
  background: #f0fdf4; color: #166534;
}
.asgn-counter--partial { background: #fffbeb; color: var(--warning-fg); }

/* ── Drive card differentiation dots ───────────────────────────────────────── */
.drive-card-assign-dots {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 0 0; min-height: 12px;
}
.asgn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.asgn-dot-label {
  font-size: 10px; color: var(--gray-500); font-weight: 500;
  white-space: nowrap;
}

/* ── Drive selection mode ───────────────────────────────────────────────────── */
.drive-card--selected {
  outline: 3px solid var(--primary);
  outline-offset: -3px;
  border-radius: 10px;
  position: relative;
}
.drive-card--selected::after {
  content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.drive-selecting .drive-card { cursor: pointer; }
.drive-selecting .drive-card:not(.drive-card--selected) { opacity: .7; }
.drive-selecting .drive-card:not(.drive-card--selected):hover { opacity: 1; }

.drive-sel-bar {
  display: flex; align-items: center; gap: 6px;
  animation: drive-sel-slide .2s ease-out;
}
@keyframes drive-sel-slide {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
.drive-sel-count {
  font-size: 12px; font-weight: 700; color: var(--primary);
  padding: 0 8px; white-space: nowrap;
}
/* Affecter — bleu, blanc au hover */
.drive-sel-action { color: var(--primary) !important; }
.drive-sel-action i { color: var(--primary) !important; }
.drive-sel-action:hover { background: var(--primary) !important; color: #fff !important; }
.drive-sel-action:hover i { color: #fff !important; }
/* Visibilité — rouge, blanc au hover */
.drive-sel-vis { color: #ef4444 !important; }
.drive-sel-vis i { color: #ef4444 !important; }
.drive-sel-vis:hover { background: #ef4444 !important; color: #fff !important; }
.drive-sel-vis:hover i { color: #fff !important; }
/* Annuler — gris */
.drive-sel-cancel { color: var(--text-secondary, var(--gray-500)) !important; }
.drive-sel-cancel:hover { background: var(--gray-200) !important; }
/* Tooltip interactive */
.drive-sel-tooltip {
  position: fixed; z-index: 10001;
  transform: translateX(-50%);
  padding: 5px 10px; border-radius: 6px;
  background: var(--gray-800); color: #fff;
  font-size: 11px; font-weight: 500;
  white-space: nowrap; pointer-events: none;
  animation: drive-sel-tip-in .12s ease-out;
}
@keyframes drive-sel-tip-in { from { opacity: 0; transform: translateX(-50%) translateY(-4px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── Offline modal ─────────────────────────────────────────────────────────── */
.ofl-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 14px;
}
.ofl-header i { font-size: 18px; color: var(--primary); }
.ofl-stats {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.ofl-stat {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-700);
}
.ofl-stat i { font-size: 11px; color: var(--gray-500); }
.ofl-info {
  font-size: 12px; color: var(--gray-500); margin-bottom: 14px;
}
.ofl-info i { margin-right: 4px; }
.ofl-checks {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px;
}
.ofl-check-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--gray-800);
}
.ofl-check-row:hover { background: var(--gray-100); }
.ofl-check-row input { margin: 0; }
.ofl-check-row i { font-size: 12px; color: var(--gray-500); width: 16px; text-align: center; }
.ofl-progress { margin-top: 8px; }
.ofl-progress-bar {
  height: 6px; border-radius: 3px; background: var(--gray-200); overflow: hidden;
}
.ofl-progress-fill {
  height: 100%; width: 0; background: var(--primary);
  border-radius: 3px; transition: width .3s;
}
.ofl-progress-text {
  font-size: 11px; color: var(--gray-500); text-align: center; margin-top: 6px;
}

/* Offline drive banner */
.drive-offline-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; margin-bottom: 10px;
  border-radius: 8px; font-size: 12px; font-weight: 500;
  background: var(--warning-bg); color: var(--warning-fg); border: 1px solid #fcd34d;
}
.drive-offline-banner i { font-size: 14px; }

/* Offline viewer for written docs */
.pe-offline-viewer {
  padding: 40px 60px; max-width: 800px; margin: 0 auto;
  background: #fff; min-height: 100%;
}

/* Offline: mute ribbon + add/tools/students buttons */
.course-ribbon.is-offline .pe-toolbar-btn,
.course-btn-group.is-offline .course-hamburger-btn:not(.course-offline-btn) {
  opacity: 0.3; pointer-events: none;
}
.course-ribbon.is-offline::after {
  content: 'Mode hors-ligne — consultation uniquement';
  position: absolute; bottom: 4px; left: 0; right: 0;
  text-align: center; font-size: 10px; color: var(--warning-fg);
  pointer-events: none;
}

/* Offline button in title bar */
.course-offline-btn.is-cached { color: #10b981 !important; }
.course-offline-btn.is-cached:hover { background: #10b981 !important; color: #fff !important; }

/* ── FolderPicker (drill-down) ─────────────────────────────────────────────── */
.fp-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 360px; overflow-y: auto;
}
.fp-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--gray-800);
}
.fp-header i { font-size: 16px; color: var(--primary); }
.fp-location {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--primary);
  background: #eff6ff; border-radius: 6px; margin-bottom: 4px;
}
.fp-location i { font-size: 12px; }
.fp-location { cursor: pointer; transition: background .15s; border: 2px solid transparent; }
.fp-location:hover { background: #dbeafe; }
.fp-location.is-selected { border-color: var(--primary); background: #dbeafe; }
.fp-location-hint { font-size: 11px; font-weight: 400; color: #93c5fd; margin-left: auto; }
.fp-location--source { cursor: default; opacity: .6; }
.fp-location--source:hover { background: #eff6ff; }
.fp-location--source .fp-location-hint { color: var(--gray-400); font-style: italic; }
.fp-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; font-size: 13px; color: var(--gray-700);
  border-radius: 6px; cursor: pointer; transition: background .1s;
}
.fp-row:hover { background: var(--gray-100); }
.fp-row i:first-child { font-size: 13px; color: var(--gray-400); width: 16px; text-align: center; flex-shrink: 0; }
.fp-row-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-row-chevron { font-size: 10px; color: var(--gray-300); flex-shrink: 0; }
.fp-row.is-selected { background: #dbeafe; color: var(--primary); font-weight: 600; }
.fp-row.is-selected i:first-child { color: var(--primary); }
.fp-row--back {
  color: var(--gray-500); font-weight: 500; border-bottom: 1px solid var(--gray-100);
  padding-bottom: 10px; margin-bottom: 4px;
}
.fp-row--back i:first-child { color: var(--gray-500); }
.fp-row--back:hover { color: var(--primary); }
.fp-row--back:hover i:first-child { color: var(--primary); }
.fp-row--course { font-weight: 500; }
.fp-row--course i:first-child { color: var(--gray-500); }
.fp-row--current { color: var(--primary); }
.fp-row--current i:first-child { color: var(--primary); }
.fp-empty { font-size: 12px; color: var(--gray-400); padding: 12px; text-align: center; font-style: italic; }

/* Selection bar: move/copy buttons */
.drive-sel-move { color: #f59e0b !important; }
.drive-sel-move i { color: #f59e0b !important; }
.drive-sel-move:hover { background: #f59e0b !important; color: #fff !important; }
.drive-sel-move:hover i { color: #fff !important; }
.drive-sel-copy { color: #8b5cf6 !important; }
.drive-sel-copy i { color: #8b5cf6 !important; }
.drive-sel-copy:hover { background: #8b5cf6 !important; color: #fff !important; }
.drive-sel-copy:hover i { color: #fff !important; }

/* Teacher deposit */
.dep-file-list { max-height: 220px; overflow-y: auto; }
/* Teacher deposit select */
.dep-student-select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-300);
  border-radius: 6px; font-size: 13px; outline: none;
  background: #fff;
}
.dep-student-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }

/* ── Proctoring Panel ──────────────────────────────────────────────────────── */
.proct-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
}
.proct-header-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  flex: 1; display: flex; align-items: center; gap: 6px;
}
.proct-header-title i { font-size: 14px; color: var(--primary); }
.proct-date { padding: 5px 8px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 12px; }
.proct-sound-btn {
  width: 32px; height: 32px; border: none; background: var(--gray-100); border-radius: 6px;
  cursor: pointer; color: var(--gray-500); font-size: 14px;
}
.proct-stop-btn {
  width: 32px; height: 32px; border: none; background: #fef2f2; border-radius: 6px;
  cursor: pointer; color: #ef4444; font-size: 14px;
}
.proct-stop-btn:hover { background: #ef4444; color: #fff; }
.proct-stop-btn.is-stopped { opacity: 0.3; cursor: default; }
.proct-sound-btn.is-active { background: var(--primary); color: #fff; }
.proct-content { padding: 16px 24px; }
.proct-summary {
  display: flex; gap: 16px; padding: 8px 0 14px; font-size: 13px; color: var(--gray-500);
}
.proct-summary--alert { color: #ef4444; font-weight: 600; }
/* Grid */
.proct-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.proct-card {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--gray-200);
  background: #fff; cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.proct-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); border-color: var(--primary); }
.proct-card--alert { border-color: #fca5a5; background: #fef2f2; }
.proct-card-name { font-size: 12px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.proct-status {
  width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); flex-shrink: 0;
}
.proct-status--active { background: #10b981; }
.proct-status--out { background: #ef4444; animation: proct-pulse 1s infinite; }
@keyframes proct-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.proct-card-badges { display: flex; gap: 14px; margin-top: 4px; }
.proct-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 18px; font-weight: 700; color: var(--gray-500);
  transition: transform .15s;
}
.proct-badge i { font-size: 16px; }
.proct-badge-count { min-width: 20px; }
.proct-badge--danger {
  background: #ef4444; color: #fff; border-radius: 8px; padding: 3px 8px;
}
.proct-badge--danger i { color: #fff; }
.proct-badge--muted { color: var(--gray-400); font-size: 13px; font-weight: 500; }
.proct-badge--muted i { font-size: 12px; }
/* Flash animation when count changes */
.proct-badge--flash {
  animation: proct-flash .5s ease-out;
}
@keyframes proct-flash {
  0% { transform: scale(1); }
  20% { transform: scale(1.5); filter: brightness(1.5); }
  100% { transform: scale(1); filter: brightness(1); }
}
/* Detail */
.proct-detail-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--primary); cursor: pointer; margin-bottom: 14px;
}
.proct-detail-back:hover { text-decoration: underline; }
.proct-detail-header { margin-bottom: 16px; }
.proct-detail-name { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.proct-detail-stats { display: block; font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.proct-detail-section { margin-bottom: 16px; }
.proct-detail-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--gray-500);
  letter-spacing: .03em; margin-bottom: 8px;
}
.proct-detail-act {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; border-radius: 6px; font-size: 12px; color: var(--gray-700);
}
.proct-detail-act:nth-child(even) { background: var(--gray-50); }
.proct-detail-act-badges { color: var(--gray-500); }
.proct-detail-act-badges i { margin-right: 2px; }
/* Timeline */
.proct-timeline { margin-top: 8px; }
.proct-event {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; font-size: 12px; color: var(--gray-700); border-left: 3px solid var(--gray-200);
}
.proct-event--suspect { border-left-color: #ef4444; background: #fef2f2; }
.proct-event-time { font-size: 11px; color: var(--gray-400); min-width: 60px; }
.proct-event i { font-size: 11px; color: var(--gray-500); width: 14px; text-align: center; }
.proct-event--suspect i { color: #ef4444; }
.proct-event-desc { flex: 1; }
.proct-empty { font-size: 12px; color: var(--gray-400); padding: 12px; font-style: italic; }
/* Monitored indicator (student, in footer) */
.proct-monitored {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto;
  padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 500;
  transition: background .4s, color .4s;
}
.proct-monitored i { font-size: 6px; }
/* Dormant: greyed out, discreet */
.proct-monitored--dormant {
  background: rgba(156,163,175,.1); color: var(--gray-400);
}
.proct-monitored--dormant i { animation: none; }
/* Active: red, pulsing wave */
.proct-monitored--active {
  background: rgba(239,68,68,.15); color: #ef4444;
  animation: proct-wave 2s ease-in-out infinite;
}
.proct-monitored--active i { animation: proct-pulse 1s infinite; }
/* Prof badge in footer */
.proct-prof-badge {
  display: inline-flex; align-items: center; gap: 0;
  margin-left: auto;
  border-radius: 10px;
  background: rgba(239,68,68,.15);
  font-size: 10px; font-weight: 600;
  animation: proct-wave 2s ease-in-out infinite;
  overflow: hidden;
}
.proct-prof-badge-label {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; color: #ef4444; cursor: pointer;
  transition: background .2s;
}
.proct-prof-badge-label:hover { background: rgba(239,68,68,.3); }
.proct-prof-badge-label i { font-size: 10px; }
.proct-prof-badge-sound {
  display: inline-flex; align-items: center;
  padding: 2px 6px; color: #ef4444; cursor: pointer;
  border-left: 1px solid rgba(239,68,68,.2);
  transition: background .2s;
}
.proct-prof-badge-sound:hover { background: rgba(239,68,68,.3); }
.proct-prof-badge-sound i { font-size: 9px; }
.proct-prof-badge-sound.is-muted { color: var(--gray-400); }
@keyframes proct-wave {
  0% { background: rgba(239,68,68,.1); }
  50% { background: rgba(239,68,68,.3); }
  100% { background: rgba(239,68,68,.1); }
}

/* ── Classroom Editor ──────────────────────────────────────────────────────── */
.cr-editor { display: flex; position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; }
.cr-sidebar {
  width: 220px; flex-shrink: 0; display: flex; flex-direction: column;
  background: rgba(0,0,0,.2); border-right: 1px solid rgba(255,255,255,.1);
  padding: 12px; gap: 8px; min-height: 0; overflow: hidden;
}
.cr-sidebar-title { font-size: 13px; font-weight: 600; color: var(--gray-200); }
.cr-sidebar-search {
  width: 100%; padding: 6px 8px; border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px; background: rgba(255,255,255,.08); color: var(--gray-200);
  font-size: 12px; outline: none;
}
.cr-sidebar-search::placeholder { color: var(--gray-500); }
.cr-sidebar-search:focus { border-color: var(--primary); }
.cr-student-list { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 3px; }
.cr-student {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 6px; cursor: grab;
  font-size: 11px; color: var(--gray-200); transition: background .1s;
}
.cr-student:hover { background: rgba(255,255,255,.08); }
.cr-student--placed { opacity: 0.35; cursor: default; }
.cr-student-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-sidebar-counter { font-size: 11px; color: var(--gray-500); text-align: center; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.08); }

.cr-sidebar--collapsed { width: 0 !important; padding: 0 !important; overflow: hidden !important; border: none !important; }
.cr-sidebar-toggle {
  position: absolute; left: 220px; top: 50%; transform: translateY(-50%);
  z-index: 5; width: 24px; height: 60px; border: none; border-radius: 0 8px 8px 0;
  background: rgba(59,130,246,.3); color: #93c5fd; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: left .2s, background .15s;
}
.cr-sidebar--collapsed ~ .cr-sidebar-toggle { left: 0; }
.cr-sidebar-toggle:hover { background: rgba(59,130,246,.6); color: #fff; }

.cr-canvas-wrap { flex: 1; overflow: hidden; position: relative; min-height: 0; }
.cr-canvas { cursor: crosshair; width: 100%; height: 100%; display: block; }
.cr-table { cursor: move; }
.cr-table rect { transition: opacity .15s, stroke-width .15s; }
.cr-table:hover rect { opacity: 0.35 !important; }
.cr-table--selected rect { opacity: 1 !important; stroke-width: 4; filter: drop-shadow(0 0 8px rgba(255,255,255,.5)); }
.cr-table--selected:hover rect { opacity: 0.85 !important; }
.cr-table-del { opacity: 0; transition: opacity .15s; }
.cr-table:hover .cr-table-del { opacity: 1; }
.cr-seat { transition: transform .15s; }

/* Header buttons for classroom editor */
.cr-header-btns {
  display: flex; align-items: center; gap: 4px; margin-left: auto;
}
.cr-header-btn {
  width: 30px; height: 30px; border: none; border-radius: 6px;
  background: rgba(255,255,255,.1); color: var(--gray-200); font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cr-header-btn:hover { background: rgba(255,255,255,.2); }
.cr-zoom-input {
  width: 36px; height: 28px; border: 1px solid rgba(255,255,255,.15); border-radius: 4px;
  background: rgba(255,255,255,.08); color: var(--gray-200); font-size: 11px;
  text-align: center; outline: none;
}
.cr-zoom-input:focus { border-color: var(--primary); }
.cr-zoom-pct { font-size: 10px; color: var(--gray-500); margin-right: 2px; }
.cr-header-sep { width: 1px; height: 20px; background: rgba(255,255,255,.15); margin: 0 4px; }

.avatar-wrap { border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.avatar-wrap svg { width: 100%; height: 100%; display: block; }
.fsv-content--classroom {
  padding: 0 !important;
  overflow: hidden !important;
  position: relative !important;
}
.cr-editor-host { position: relative; flex: 1; min-height: 0; }

/* Kebab menu active item highlight (for assigned items) */
.drive-card-menu-active { color: var(--primary); }
.drive-card-menu-active i { color: var(--primary); }

/* ── NetworkManager — global offline/online pills (same style as SaveIndicator) ── */
.nm-offline-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; font-size: 11px; font-weight: 500;
  border-radius: 16px; white-space: nowrap; pointer-events: none;
  z-index: 10000; color: #fff;
  background: rgba(120,53,15,0.92);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  animation: save-ind-in .2s ease-out;
}
.nm-offline-banner i { font-size: 10px; }

.nm-online-toast {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; font-size: 11px; font-weight: 500;
  border-radius: 16px; white-space: nowrap; pointer-events: none;
  z-index: 10000; color: #fff;
  background: rgba(22,101,52,0.92);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  animation: save-ind-in .2s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════
   ÉMARGEMENT
   ═══════════════════════════════════════════════════════════════════ */
.emg-page { padding: 0; }
.emg-empty { padding: 40px 24px; text-align: center; color: var(--gray-500); }

.emg-table { width: 100%; border-collapse: collapse; }
.emg-table th { text-align: left; padding: 10px 12px; font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--gray-200); }
.emg-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.emg-row:hover { background: var(--gray-50); }
.emg-actions { display: flex; gap: 6px; }

.emg-status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.emg-status--draft { background: var(--gray-100); color: var(--gray-500); }
.emg-status--scheduled { background: var(--warning-bg); color: var(--warning-fg); }
.emg-status--open { background: #dcfce7; color: #166534; }
.emg-status--closed { background: var(--error-bg); color: var(--error-fg); }
.emg-status--archived { background: #e0e7ff; color: #3730a3; }

.emg-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.emg-badge--signed { background: #dcfce7; color: #166534; }
.emg-badge--absent { background: var(--error-bg); color: var(--error-fg); }
.emg-badge--excused { background: var(--warning-bg); color: var(--warning-fg); }
.emg-badge--pending { background: var(--gray-100); color: var(--gray-500); }
.emg-badge--late { background: var(--warning-bg); color: var(--warning-fg); }

.emg-slot-section { margin: 16px 0; padding: 0 24px; }
.emg-slot-header { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--gray-200); }
.emg-slot-time { color: var(--gray-500); font-size: 13px; }

.emg-sig-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.emg-sig-table th { text-align: left; padding: 6px 10px; font-size: 12px; color: var(--gray-500); border-bottom: 1px solid var(--gray-200); }
.emg-sig-table td { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
.emg-status-select { font-size: 12px; padding: 2px 6px; border: 1px solid var(--gray-300); border-radius: 6px; }

.emg-student-card { margin: 12px 24px; padding: 16px; background: #fff; border: 1px solid var(--gray-200); border-radius: 10px; }
.emg-student-card-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.emg-student-date { font-weight: 600; font-size: 14px; }
.emg-student-loc { color: var(--gray-500); font-size: 13px; }
.emg-student-slot { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--gray-100); }

.emg-sign-inline { margin-top: 8px; }
.emg-sign-canvas { width: 100%; max-width: 400px; height: 120px; border: 2px dashed var(--gray-300); border-radius: 8px; background: #fff; cursor: crosshair; }
.emg-sign-inline-actions { display: flex; gap: 8px; margin-top: 8px; }

.emg-time-row { display: flex; gap: 12px; }
.emg-slots-wrap { padding: 8px 0; }
.emg-slot-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.emg-geo-label { display: flex; align-items: center; gap: 8px; padding: 12px 0; font-size: 14px; cursor: pointer; }

.profile-sig-preview { min-height: 60px; margin-bottom: 12px; }
.profile-sig-img { max-width: 300px; max-height: 100px; border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px; background: #fff; }
.profile-sig-none { color: var(--gray-400); font-size: 13px; font-style: italic; }
.profile-sig-canvas-wrap { margin-bottom: 12px; }
.profile-sig-canvas { width: 100%; max-width: 400px; height: 150px; border: 2px dashed var(--gray-300); border-radius: 8px; background: #fff; cursor: crosshair; }
.profile-sig-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-sig-actions .btn { width: auto; min-height: 32px; padding: 6px 14px; font-size: 13px; }
.btn-danger { background: #ef4444; color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; }

/* ═══════════════════════════════════════════════════════════════════════
   CORRECTION PANEL — split view (legacy model)
   ═══════════════════════════════════════════════════════════════════ */
.course-content:has(.corr-wrap) { padding: 0; }
.app-content:has(.corr-wrap) { padding: 0; max-width: none; }
.corr-wrap { width: 100%; height: calc(100vh - var(--header-height, 56px) - 30px); position: relative; }
.corr-split { display: flex; height: 100%; overflow: hidden; }
.corr-empty { padding: 40px; text-align: center; color: var(--gray-500); }

/* LEFT: Student copy */
.corr-left { flex: 1; overflow-y: auto; background: #3a3535; padding: 24px; min-height: 0; }
.corr-left:has(.corr-pdf-viewer) { padding: 0; overflow: hidden; }
.corr-left:has(.corr-pdf-viewer) .corr-pdf-back { padding: 6px 12px; }
.corr-copy-block { margin-bottom: 20px; }
.corr-copy-question { color: var(--gray-300); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.corr-copy-page { background: #fff; border: 1px solid #222; padding: 7% 7%; margin-bottom: 20px; font-size: 14px; line-height: 1.8; box-shadow: -1px 2px 5px 1px rgba(0,0,0,.6), -1px 2px 20px rgba(255,255,255,.3) inset; border-radius: 2px; }
.corr-copy-page img { max-width: 100%; }
.corr-pdf-frame { width: 100%; height: 80vh; border: none; border-radius: 2px; }
.corr-file-link { color: #60a5fa; font-size: 14px; text-decoration: none; }
.corr-file-link:hover { text-decoration: underline; }
.corr-no-response { color: var(--gray-400); text-align: center; padding: 60px 20px; font-style: italic; }
.corr-copy-empty { text-align: center; color: var(--gray-400); font-style: italic; padding: 40px 20px !important; font-size: 14px; line-height: 2; }
.corr-copy-empty i { font-size: 28px; margin-bottom: 8px; opacity: .5; }
/* Deposit file cards in corrector — reuse drive-card classes directly */
.corr-deposit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 0 0 14px; }
.corr-dcard-active { border-color: var(--primary) !important; box-shadow: 0 0 0 2px var(--primary); }
.corr-dcard-date { color: var(--text-light, #999); font-size: 10px; margin-top: 2px; }
.corr-dcard-dl { margin-top: 4px; display: flex; justify-content: flex-end; gap: 4px; }
.corr-pdf-back { background: none; border: none; color: var(--gray-300); font-size: 12px; cursor: pointer; padding: 8px 0; display: flex; align-items: center; gap: 6px; }
.corr-pdf-back:hover { color: #fff; }
.corr-pdf-viewer { width: 100%; height: calc(100% - 30px); }

/* RIGHT: Bareme panel */
.corr-right { width: 35%; min-width: 280px; max-width: 420px; display: flex; flex-direction: column; background: #004063; color: #fff; min-height: 0; }

/* ── Buttons (used in overlays) ── */
.cb-btn { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 4px 16px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.cb-btn:hover { background: rgba(255,255,255,.15); }
.cb-btn-green { border-color: #56ba62; color: #56ba62; }
.cb-btn-green:hover { background: rgba(86,186,98,.15); }

/* ── Student name (H1) ── */
.cb-student-name { font-size: calc(2.5 * var(--vh, 1vh)); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; padding-left: 1vw; color: #fff; margin-top: calc(1 * var(--vh, 1vh)); height: calc(3 * var(--vh, 1vh)); }

/* ── Score header (total + comment buttons) ── */
.cb-score-header { border: none; background: none; font-size: calc(2.5 * var(--vh, 1vh)); display: flex; align-items: center; padding: 0.5vw 10px; margin: 0; flex-shrink: 0; }
.cb-score-left { color: whitesmoke; display: flex; align-items: center; flex: 1; }
.cb-total-val { color: #56ba62; font-size: calc(2.5 * var(--vh, 1vh)); font-weight: 700; }
.cb-total-max { color: #56ba62; font-size: calc(2.5 * var(--vh, 1vh)); }
.cb-score-header span { font-size: calc(2.5 * var(--vh, 1vh)); }
.cb-comment-btns { display: flex; flex-direction: row-reverse; gap: 4px; align-items: center; }
.cb-comment-icon { padding: 0.9vw; margin-right: 0.5vw; border-radius: 50%; height: clamp(28px, 4vw, 44px); width: clamp(28px, 4vw, 44px); display: flex; justify-content: center; align-items: center; color: #005583; font-size: clamp(14px, 2vw, 22px); }
.cb-comment-active { color: #56ba62; cursor: pointer; border: 2px solid transparent; }
.cb-comment-active:hover { border: 2px solid #56ba62; }

/* ── Bareme scrollable content ── */
.cb-bareme-wrap { width: 100%; padding: 0 10px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cb-bareme-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; margin-bottom: 10px; }

/* ── Bareme block (per question) ── */
.cb-block { margin-bottom: 0; }

/* ── Question header H4 — blue top border ── */
.cb-q-header { font-size: 0.95vw; border-top: 6px solid #00a2eb; border-top-left-radius: 6px; border-top-right-radius: 6px; font-weight: normal; color: #fff; background: #005f92; padding: 0.5vw; border-bottom: 1px solid #fff; margin: 0; display: flex; }
.cb-q-title { font-size: calc(2 * var(--vh, 1vh)); font-weight: 700; width: 80%; }
.cb-q-title b { font-weight: 700; }
.cb-q-title * { margin: 0; font-size: inherit; }

/* ── Bareme lines list ── */
.cb-liste { padding-bottom: 12px; }

/* ── Bareme row (each criterion) ── */
.cb-row { display: flex; align-items: center; padding: 3px 6px; margin: 0; }
.cb-row:nth-child(odd) { background: #005f92; }
.cb-row:nth-child(even) { background: #005583; }

/* Checkbox row — full row clickable */
.cb-row-tor { cursor: pointer; }
.cb-row-tor:hover { background: #949292 !important; }
.cb-row-tor:hover .cb-val { color: #fff; }

/* Text column */
.cb-text { flex: 1; font-size: 12px; color: #fff; padding: 0 4px; }
.cb-text-full { flex: none; width: 100%; }
.cb-text * { margin: 0; }

/* Checkbox column */
.cb-cb-col { width: 30px; text-align: center; flex-shrink: 0; }
.cb-checkbox { cursor: pointer; accent-color: #56ba62; }

/* Score column */
.cb-score-col { display: flex; align-items: center; flex-shrink: 0; width: 100px; justify-content: flex-end; }

/* Score value display (div or input) */
.cb-val { color: #fff; border-radius: 0.4vw; border: 1px solid #0070a8; height: 25px; line-height: 25px; background: #004063; padding: 0; width: 50px; text-align: right; padding-right: 5px; margin-right: 5px; font-size: 12px; box-sizing: border-box; }
.cb-val-input { text-align: center; padding-left: 5px; padding-right: 5px; cursor: text; width: 50px; height: 25px; }
.cb-val-echelle { }

/* Score max (/N) */
.cb-max { position: relative; float: left; font-size: 0.85vw; color: #fff; white-space: nowrap; }

/* ── Slider row ── */
.cb-row-slider { flex-wrap: nowrap; }
.cb-row-slider .cb-text { display: flex; flex-direction: column; gap: 4px; }
.cb-slider-col { width: 100%; padding: 2px 0 0; }
.cb-slider { width: 100%; cursor: pointer; accent-color: #56ba62; height: 3px; }

/* ── Comment overlay (text + audio) ── */
.cb-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #004063; z-index: 3; display: flex; align-items: center; justify-content: center; }
.cb-overlay-text { width: 100%; height: 90%; display: flex; flex-direction: column; padding: 10px; }
.cb-overlay-text p { color: whitesmoke; font-size: 14px; text-align: center; margin-bottom: 8px; }
.cb-overlay-ta { width: 100%; flex: 1; margin-bottom: 8px; padding: 1vw; color: #004063; background: #f9f4f4; border: 1px solid #008ace; font-size: 14px; font-family: inherit; resize: none; }
.cb-overlay-ta:focus { outline: none; box-shadow: none; }
.cb-overlay-btns { display: flex; justify-content: center; gap: 8px; }

/* Tiptap editor in comment overlay */
.cb-editor-toolbar { display: flex; gap: 2px; margin-bottom: 6px; }
.cb-editor-btn { background: #005583; border: 1px solid #0070a8; color: #fff; width: 30px; height: 30px; border-radius: 4px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.cb-editor-btn:hover { background: #0070a8; }
.cb-editor-content { flex: 1; border: 1px solid #008ace; border-radius: 4px; overflow-y: auto; background: #f9f4f4; }
.cb-tiptap { padding: 12px; color: #004063; font-size: 14px; line-height: 1.6; min-height: 100%; outline: none; }
.cb-tiptap p { margin: 0 0 8px; }
.cb-tiptap ul, .cb-tiptap ol { margin: 0 0 8px; padding-left: 20px; }
.cb-comment-filled { color: #56ba62 !important; border: 2px solid #56ba62; }

/* Audio record button in modal */
.cb-audio-big-btn { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--primary); background: none; color: var(--primary); font-size: 24px; cursor: pointer; transition: all .2s; }
.cb-audio-big-btn:hover { background: rgba(var(--primary-rgb, 59,130,246), .1); }
.cb-audio-recording { border-color: #ef4444 !important; color: #ef4444 !important; animation: corr-pulse-rec 1s ease-in-out infinite; }
.cb-overlay-audio { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 70%; }
.cb-overlay-audio p { color: whitesmoke; font-size: 2vw; margin-bottom: 3vh; }
.cb-overlay-controls { display: flex; justify-content: space-between; width: 80%; margin-top: 3vh; }
.cb-overlay-icon { border: 2px solid #cf1578; cursor: pointer; border-radius: 50%; padding: 1vw; color: #cf1578; font-size: 1.5vw; display: flex; align-items: center; justify-content: center; }
.cb-overlay-icon:hover { color: whitesmoke; border-color: whitesmoke; }
.cb-overlay-muted { border-color: darkgray !important; color: darkgray !important; pointer-events: none; }
.cb-overlay-recording { border-color: #56ba62 !important; color: #56ba62 !important; animation: corr-pulse-rec 1s ease-in-out infinite; }
@keyframes corr-pulse-rec { 0%,100% { opacity:1; } 50% { opacity:.5; } }

/* ── Navigation bar (bottom) ── */
.cb-nav { width: 100%; background: #005f92; color: #fff; height: calc(var(--vh, 1vh) * 6); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; padding: 0 10px; }
.cb-nav.bottom { background: #004063; }
.cb-nav-group { display: flex; gap: 4px; }
.cb-nav-btn { color: #fff; font-size: 16px; padding: 4px 10px; text-decoration: none; }
.cb-nav-btn:hover { color: #56ba62; }
.cb-nav-counter { font-size: 14px; font-weight: 600; }

/* No bareme message */
.cb-no-bareme { color: #7dd3fc; font-size: 12px; font-style: italic; padding: 12px 6px; text-align: center; opacity: .7; }
.cb-no-bareme i { margin-right: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .corr-wrap { flex-direction: column; height: auto; }
  .corr-left { max-height: 50vh; }
  .corr-right { width: 100%; max-width: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   LIVE EDITOR — rivière pédagogique
   ═══════════════════════════════════════════════════════════════════ */
.live-editor { display: flex; flex-direction: column; height: 100%; }
.live-editor .sp-page-title { gap: 8px; }

/* Main: labels + content */
.live-editor-main {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}
/* ── Left sidebar ─────────────────────────────── */
.live-editor-sidebar {
  display: flex; flex-direction: column;
  width: 200px; flex-shrink: 0;
  background: #f6f8fa; border-right: 1px solid var(--border);
  overflow: hidden;
}
.live-sidebar-section {
  display: flex; flex-direction: column; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.live-sidebar-section:last-child { border-bottom: none; flex: 1; }
.live-sidebar-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-light);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.live-sidebar-drive .live-sidebar-title i { color: var(--secondary); }
.live-sidebar-live .live-sidebar-title i { color: var(--primary); }
.live-sidebar-search { font-size: 12px; margin-bottom: 6px; }
/* Stats */
.live-sidebar-stats {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px;
}
.live-sidebar-stat {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
}
.live-sidebar-stat i { font-size: 12px; width: 14px; text-align: center; }
.live-sidebar-stat-val { font-weight: 700; color: var(--text); }
.live-sidebar-stat-label { color: var(--text-light); }
.live-sidebar-launch { width: 100%; min-height: 32px; padding: 6px 12px; font-size: 13px; }
/* ── Content column ───────────────────────────── */
.live-editor-content {
  display: flex; flex-direction: column; flex: 1; overflow: hidden; min-width: 0;
}
/* Splitter horizontal entre drive (haut) et chemin de fer (bas).
   Trois modes : top-only / split / bottom-only. */
/* Bouton de header chat « muted » : visible mais non interactif */
.chat-header-btn.is-muted {
  opacity: 0.35; cursor: not-allowed;
}
.chat-header-btn.is-muted:hover { background: transparent; }
/* Contact muted (élève occupé dans un travail collaboratif) */
.chat-contact-item.is-muted {
  opacity: 0.45; cursor: not-allowed; pointer-events: auto;
}
.chat-contact-item.is-muted:hover { background: transparent; }
.chat-contact-busy {
  color: var(--text-light, #64748b); font-style: italic; font-size: 11px;
}

.live-editor-splitter {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  height: 22px; flex-shrink: 0;
  background: var(--gray-100, #f1f5f9);
  border-top: 1px solid var(--border, #e2e8f0);
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.live-splitter-btn {
  background: transparent; border: none; cursor: pointer;
  width: 32px; height: 18px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-light, #64748b); font-size: 11px;
  transition: background .12s, color .12s;
}
.live-splitter-btn:hover { background: rgba(0,0,0,.06); color: var(--text, #1e293b); }
.live-splitter-btn.is-active {
  background: var(--primary, #2563eb); color: #fff;
}
/* Mode haut plein : drive prend toute la hauteur, river ramenée à 30px (entête seul) */
.live-editor-content--top .live-editor-drive  { flex: 1; min-height: 0; }
.live-editor-content--top .live-editor-river  { flex: 0 0 30px; min-height: 30px; overflow: hidden; }
/* Mode équilibré : drive et river partagent 50/50 */
.live-editor-content--split .live-editor-drive { flex: 1 1 50%; min-height: 0; }
.live-editor-content--split .live-editor-river { flex: 1 1 50%; min-height: 0; }
/* Mode bas plein : river prend toute la hauteur, drive ramenée à 30px */
.live-editor-content--bottom .live-editor-drive { flex: 0 0 30px; min-height: 30px; overflow: hidden; }
.live-editor-content--bottom .live-editor-river { flex: 1; min-height: 0; }
/* ── Drive panel (top) ────────────────────────── */
.live-editor-drive {
  display: flex; flex-direction: row;
  background: var(--gray-50); overflow: hidden;
  border-bottom: 1px solid var(--border);
  flex: 1; min-height: 100px;
}
/* Back column */
.live-drive-back-col {
  width: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-right: none; background: #f0f2f5;
  transition: width 0.2s, border-right 0.2s;
  flex-shrink: 0;
}
.live-drive-back-col.visible {
  width: 36px; border-right: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.live-drive-back-col.visible:hover {
  background: rgba(207,21,120,0.06); border-right-color: var(--primary-light);
}
.live-drive-back-col.visible:hover .live-drive-back-btn {
  color: var(--primary);
}
.live-drive-back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 14px;
  padding: 8px; border-radius: 6px;
  transition: color 0.15s;
}
.live-drive-search { font-size: 13px; }
.live-drive-breadcrumb {
  padding: 0 14px 6px; font-size: 12px; color: var(--text-light);
  display: flex; flex-wrap: wrap; gap: 2px;
}
.live-drive-crumb { color: var(--text-light); }
.live-drive-crumb.active { color: var(--text); font-weight: 500; }
.live-drive-crumb:not(.active):hover { color: var(--primary); }
.live-drive-crumb-sep { color: var(--border); }
.live-drive-list {
  flex: 1; overflow-y: auto; padding: 0 6px 12px;
}
.live-drive-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text); transition: background 0.15s;
}
.live-drive-item:hover { background: var(--bg-hover); }
.live-drive-item.incompatible { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.live-drive-item.already-added { opacity: 0.5; cursor: default; }
.live-drive-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-drive-folder { font-weight: 500; }
.live-drive-folder i { color: #f59e0b; }
.live-drive-add {
  background: none; border: none; cursor: pointer; color: var(--primary);
  font-size: 14px; padding: 2px 6px; border-radius: 4px; opacity: 0;
  transition: opacity 0.15s;
}
.live-drive-item:hover .live-drive-add { opacity: 1; }
.live-drive-add:hover { background: rgba(207,21,120,0.1); }
.live-drive-badge {
  font-size: 11px; font-weight: 600; padding: 1px 4px; border-radius: 4px;
}
.live-drive-badge.incompatible { color: #ef4444; }
.live-drive-badge.added { color: var(--success); }

/* ── River panel (bottom) ─────────────────────── */
.live-editor-river {
  display: flex; flex-direction: column;
  padding: 0; background: var(--bg);
  min-height: 0;
}
.live-river-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1; padding: 20px;
  color: var(--text-light); font-size: 13px; text-align: center;
}
/* River grid — horizontal scroll, cards fill height */
.live-river-grid {
  display: flex; gap: 12px;
  padding: 12px 16px;
  overflow-x: auto; overflow-y: hidden;
  flex: 1; align-items: flex-start;
}
/* Mode « chemin de fer plein » : on a beaucoup de place verticale →
   les tuiles passent en grille à lignes multiples, le scroll devient
   vertical (le translateur horizontal disparaît). */
.live-editor-content--bottom .live-river-grid {
  flex-wrap: wrap;
  align-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
}
.live-river-grid::-webkit-scrollbar { height: 6px; }
.live-river-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.live-river-card { min-width: 160px; max-width: 180px; flex-shrink: 0; display: flex; flex-direction: column; }
/* Card — reuses drive-card base, adds drag + number overlay */
.live-river-card { position: relative; cursor: grab; }
.live-river-card:active { cursor: grabbing; }
.live-river-card.dragging { opacity: 0.3; }
.live-river-card.drag-over { border: 2px dashed var(--primary); }
.live-river-card-meta { font-size: 11px; color: var(--text-light); margin-top: 2px; }
/* Number badge */
.live-river-num {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--primary);
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
/* Action buttons — visible on hover */
.live-river-card-actions {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s;
}
.live-river-card:hover .live-river-card-actions { opacity: 1; }
.live-river-action-btn {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-secondary);
  transition: all 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.live-river-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.live-river-action-del:hover { border-color: #ef4444; color: #ef4444; }

/* Timer inline editor */
.live-river-timer-edit {
  display: flex; align-items: center; gap: 4px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary);
}
.live-timer-input {
  width: 48px; padding: 4px 6px; border: 1.5px solid var(--border);
  border-radius: 4px; font-size: 13px; text-align: center;
}
.live-river-timer-edit .btn { min-height: 26px; padding: 2px 10px; font-size: 12px; width: auto; }


/* ═══════════════════════════════════════════════════════════════════
   LIVE CONTROLLER — waiting room
   ═══════════════════════════════════════════════════════════════════ */
/* Header */
.live-wait-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; width: 100%;
  color: #fff;
}
.live-dot-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ef4444;
  animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.6); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.live-wait-title { font-size: 15px; font-weight: 600; flex: 1; }
.live-wait-count {
  font-size: 14px; font-weight: 700; color: var(--primary);
  background: rgba(207,21,120,0.08); padding: 4px 12px; border-radius: 12px;
}
/* Toggle buttons (in footer) */
.live-wait-toggle-btn {
  width: auto; min-height: 28px; padding: 3px 10px; font-size: 11px;
  background: rgba(255,255,255,0.08); border: 1.5px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.6);
}
.live-wait-toggle-btn:hover { background: rgba(255,255,255,0.12); }
.live-wait-toggle-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
/* Content */
.live-wait-content { overflow: hidden; flex: 1; display: flex; flex-direction: column; }
.live-wait-grid-wrap { padding: 0 20px 20px; flex: 1; display: flex; flex-direction: column; }
/* Group sections */
.live-wait-group { margin-bottom: 16px; }
.live-wait-group-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  color: rgba(255,255,255,0.5); letter-spacing: 0.5px;
  padding: 4px 0 8px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 10px;
}
/* Avatar grid */
.live-wait-avatars {
  display: flex; flex-wrap: wrap; gap: 12px;
}
.live-wait-avatars-alpha { gap: 16px; }
/* Individual avatar card */
.live-wait-avatar {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; width: 64px;
  opacity: 0.25; filter: grayscale(1);
  transition: opacity 0.4s, filter 0.4s, transform 0.3s;
}
.live-wait-avatar .avatar-wrap {
  border: 2.5px solid transparent; border-radius: 50%;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.live-wait-name {
  font-size: 10px; color: rgba(255,255,255,0.3); text-align: center;
  line-height: 1.2; word-break: break-word;
}
/* Joined state */
.live-wait-avatar.joined {
  opacity: 1; filter: none;
}
.live-wait-avatar.joined .avatar-wrap {
  border-color: var(--success);
  box-shadow: 0 0 8px rgba(16,185,129,0.3);
}
.live-wait-avatar.joined .live-wait-name { color: #34d399; font-weight: 600; }
/* Just joined — pop animation */
.live-wait-avatar.just-joined {
  animation: live-avatar-pop 0.5s ease-out;
}
.live-wait-avatar.just-joined .avatar-wrap {
  box-shadow: 0 0 16px rgba(16,185,129,0.6);
}
@keyframes live-avatar-pop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
/* Classroom view in waiting room */
.live-wait-classroom {
  position: relative; flex: 1; min-height: 300px; width: 100%; height: 100%;
}
.live-wait-classroom-active .cr-sidebar { display: none; }
.live-wait-classroom-active .cr-sidebar-toggle { display: none; }
.live-wait-classroom-active .cr-seat.live-seat-waiting {
  opacity: 0.2; filter: grayscale(1);
  transition: opacity 0.4s, filter 0.4s;
}
.live-wait-classroom-active .cr-seat.live-seat-joined {
  opacity: 1; filter: none;
  transition: opacity 0.4s, filter 0.4s;
}
.live-wait-classroom-active .cr-seat.live-seat-joined circle {
  stroke: #34d399 !important; stroke-width: 3;
}
.live-wait-classroom-active .cr-seat.live-seat-just-joined {
  animation: live-avatar-pop 0.5s ease-out;
}
/* Hide toolbar and table controls in read-only mode */
.live-wait-classroom-active .cr-toolbar { display: none; }
.live-wait-classroom-active .cr-table-label-edit,
.live-wait-classroom-active .cr-table-del { display: none; }
/* Footer */
.live-wait-footer {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 16px;
}
.fsv-footer:has(.live-wait-footer) {
  background: transparent; border-top: none; padding: 0;
}
.live-wait-footer .btn {
  width: auto; min-height: 28px; padding: 3px 12px; font-size: 12px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: #fff;
}
.live-wait-footer .btn:hover { background: rgba(255,255,255,0.18); }
.live-wait-footer .btn-primary { background: var(--primary); border-color: var(--primary); }
.live-wait-footer .btn-primary:hover { background: var(--primary-dark); }
.live-wait-footer-title { font-size: 12px; font-weight: 600; color: #fff; margin-right: 4px; }
.live-wait-footer .live-wait-count {
  font-size: 11px; font-weight: 700; color: var(--primary);
  background: rgba(207,21,120,0.15); padding: 2px 8px; border-radius: 10px; margin-right: 6px;
}
.live-wait-footer-spacer { flex: 1; }

/* ── Live invitation modal (student, any page) ── */
.live-invite-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5);
  animation: live-invite-fade 0.3s ease-out;
}
@keyframes live-invite-fade {
  from { opacity: 0; } to { opacity: 1; }
}
.live-invite-card {
  background: var(--bg-card); border-radius: 16px;
  padding: 32px 40px; text-align: center; max-width: 380px; width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.25);
  animation: live-invite-pop 0.4s ease-out;
}
@keyframes live-invite-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.live-invite-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  animation: live-pulse 1.5s ease-in-out infinite;
}
.live-invite-icon i { font-size: 28px; color: #fff; }
.live-invite-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.live-invite-subtitle { font-size: 15px; color: var(--primary); font-weight: 500; margin-bottom: 12px; }
.live-invite-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.live-invite-btns { display: flex; gap: 10px; justify-content: center; }
.live-invite-btns .btn { width: auto; min-height: 38px; padding: 8px 24px; font-size: 14px; }

/* ── Live student waiting message (inside FullscreenViewer) ── */
.live-wait-msg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center;
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  padding: 48px 56px;
  background: rgba(255,255,255,.04);
}
.live-wait-msg-icon {
  font-size: 36px; color: var(--primary, #2980b9);
  margin-bottom: 20px;
  animation: live-pulse 1.5s ease-in-out infinite;
}
.live-wait-msg-text {
  font-size: 17px; line-height: 1.6;
  color: rgba(255,255,255,.75); font-weight: 500;
  margin: 0;
}

/* ── Live river panel (inside fsv-panel) ── */
.live-river-panel {
  display: flex; flex-direction: column; height: 100%;
  padding: 12px; gap: 8px; min-height: 0; overflow: hidden;
}
.live-river-sidebar-title {
  font-size: 13px; font-weight: 600; color: var(--gray-200);
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; margin: -12px -12px 0; background: rgba(0,0,0,.3);
}
.live-river-list {
  flex: 1; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.live-river-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  font-size: 12px; color: #cbd5e1; transition: background .15s;
}
.live-river-row:hover { background: rgba(255,255,255,.1); }
.live-river-row:hover .live-river-row-thumb { border-color: rgba(255,255,255,.4); color: #fff; }
.live-river-row:hover .live-river-row-name { color: #fff; }
.live-river-row.active { background: var(--primary, #2980b9); color: #fff; }
.live-river-row-thumb {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #94a3b8;
}
.live-river-row.active .live-river-row-thumb { border-color: rgba(255,255,255,.3); color: #fff; }
.live-river-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gray-200); }
.live-river-counter {
  font-size: 11px; color: var(--gray-500); text-align: center;
  padding-top: 6px; border-top: 1px solid rgba(255,255,255,.08);
}
.live-river-empty-msg {
  padding: 20px 8px; text-align: center; color: var(--gray-500); font-size: 12px;
}
/* Exercise mode option buttons */
.live-exo-opt-readonly.active { background: rgba(34,197,94,.25); color: #22c55e; border-color: #22c55e; }
.live-exo-opt-writing.active { background: rgba(34,197,94,.25); color: #22c55e; border-color: #22c55e; }
/* Interrogate panel */
.live-interrogate-panel {
  width: 260px; max-height: 400px; background: rgba(11,62,102,.97);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4); z-index: 9500;
  display: flex; flex-direction: column; overflow: hidden;
}
.live-interrogate-title {
  font-size: 13px; font-weight: 600; color: var(--gray-200); padding: 10px 12px;
  background: rgba(0,0,0,.3); display: flex; align-items: center; gap: 6px;
}
.live-interrogate-current {
  padding: 8px 12px; font-size: 12px; font-weight: 600; color: #fbbf24;
  background: rgba(251,191,36,.1); display: flex; align-items: center; gap: 6px;
}
.live-interrogate-list {
  flex: 1; overflow-y: auto; padding: 6px;
}
.live-interrogate-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; font-size: 12px; color: #cbd5e1;
}
.live-interrogate-row:hover { background: rgba(255,255,255,.08); }
.live-interrogate-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-interrogate-board-btn {
  width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 6px;
  background: rgba(255,255,255,.08); color: #94a3b8; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  flex-shrink: 0;
}
.live-interrogate-board-btn:hover { background: var(--primary, #2980b9); color: #fff; }
.live-interrogate-release {
  margin: 6px; font-size: 12px; min-height: 32px;
  background: rgba(239,68,68,.15); color: #f87171; border: 1px solid rgba(239,68,68,.3);
}
.live-interrogate-release:hover { background: rgba(239,68,68,.25); }
.live-interrogate-empty {
  padding: 16px 8px; text-align: center; color: var(--gray-500); font-size: 12px;
}
/* Question picker modal */
.live-pick-student {
  display: flex; align-items: center; gap: 10px; padding: 10px 0 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.live-pick-student-name { font-weight: 600; font-size: 15px; }
.live-pick-question-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: background .15s;
}
.live-pick-question-row:hover { background: var(--bg-hover, #f0f4f8); }
.live-pick-question-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  background: var(--primary); color: #fff; flex-shrink: 0;
}
.live-pick-question-text { font-size: 14px; color: var(--text); flex: 1; }
/* Student answer overlay */
.live-answer-overlay {
  position: fixed; inset: 0; z-index: 9600;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6);
  animation: live-invite-fade 0.25s ease-out;
}
.live-answer-card {
  background: var(--bg-card, #fff); border-radius: 16px;
  padding: 32px; max-width: 560px; width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,.3);
  animation: live-invite-pop 0.3s ease-out;
}
.live-answer-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.live-answer-name-block { flex: 1; }
.live-answer-student-name { font-size: 18px; font-weight: 700; color: var(--text); }
.live-answer-question-type { font-size: 12px; color: var(--primary); font-weight: 600; }
.live-answer-question {
  font-size: 14px; color: var(--text-secondary); line-height: 1.5;
  padding: 12px 16px; background: var(--bg-hover, #f8f9fa); border-radius: 8px;
  margin-bottom: 16px;
}
.live-answer-text {
  font-size: 15px; line-height: 1.7; color: var(--text);
  padding: 16px 20px; border: 1px solid var(--border);
  border-radius: 10px; min-height: 60px;
  background: #fff; white-space: pre-wrap;
}
.live-answer-text.live-answer-empty {
  color: var(--gray-400); font-style: italic;
}
.live-answer-copy {
  margin-top: 16px; font-size: 13px; min-height: 36px;
  background: var(--primary); color: #fff; border: none;
}
.live-answer-copy:hover { opacity: 0.9; }
.live-answer-close {
  margin-top: 8px; margin-left: 8px; font-size: 13px; min-height: 36px;
}
/* Live timer bar (on fsv-footer) */
/* Live exercise projection screen (teacher) */
.live-exo-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; height: 100%; padding: 40px;
}
.live-exo-screen-icon {
  font-size: 48px; color: rgba(255,255,255,.2); margin-bottom: 24px;
}
.live-exo-screen-title {
  font-size: 32px; font-weight: 700; color: #fff; margin: 0 0 12px;
  line-height: 1.3;
}
.live-exo-screen-meta {
  font-size: 15px; color: rgba(255,255,255,.5); margin-bottom: 32px;
}
.live-exo-screen-status {
  font-size: 14px; color: rgba(255,255,255,.4);
  display: flex; align-items: center; gap: 8px;
  animation: live-pulse 1.5s ease-in-out infinite;
}

/* Kahoot mode */
.live-exo-screen-choose { color: rgba(255,255,255,.6); font-size: 15px; margin-bottom: 20px; }
.live-exo-screen-btns { display: flex; gap: 12px; }
.live-exo-screen-btn { min-width: 160px; padding: 12px 24px; font-size: 15px; }
.kahoot-question-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 24px; text-align: center;
}
.kahoot-progress { font-size: 14px; color: rgba(255,255,255,.4); margin-bottom: 12px; }
.kahoot-question-text {
  font-size: 24px; font-weight: 600; color: #fff; line-height: 1.4;
  max-width: 700px; margin-bottom: 32px;
}
/* Kahoot body row (media left, choices right) */
.kahoot-body-row {
  display: flex; gap: 24px; align-items: center;
  width: 100%; max-width: 800px;
}
.kahoot-body-row .kahoot-media { flex: 1; min-width: 0; }
.kahoot-body-row .kahoot-choices { flex: 1; min-width: 0; grid-template-columns: 1fr; }
/* Kahoot media (image/video) */
.kahoot-media { text-align: center; }
.kahoot-media-img {
  max-width: 100%; max-height: 300px; border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.kahoot-media iframe { max-width: 100%; border-radius: 10px; }
.kahoot-choices {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  width: 100%; max-width: 600px;
}
.kahoot-choice {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-radius: 10px; color: #fff;
  font-size: 16px; font-weight: 500;
  min-height: 56px;
}
.kahoot-choice-shape { font-size: 18px; opacity: .7; }
.kahoot-choice-text { flex: 1; text-align: left; }
.kahoot-choice-clickable { cursor: pointer; transition: transform .15s, opacity .15s; }
.kahoot-choice-clickable:hover { transform: scale(1.03); }
.kahoot-choice-disabled { opacity: .35; pointer-events: none; }
.kahoot-choice-selected { opacity: 1; transform: scale(1.05); box-shadow: 0 0 0 3px #fff; }
.kahoot-counter {
  margin-top: 24px; font-size: 15px; color: rgba(255,255,255,.5);
  animation: live-pulse 1.5s ease-in-out infinite;
}
/* Kahoot results */
.kahoot-results-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 32px; overflow-y: auto;
}
.kahoot-results-question {
  font-size: 26px; font-weight: 700; color: #fff; line-height: 1.4;
  max-width: 800px; text-align: center; margin-bottom: 36px;
}
.kahoot-results-chart { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.kahoot-results-row {
  display: grid; grid-template-columns: 2fr 1.5fr 56px 40px;
  align-items: start; gap: 14px; padding-top: 4px;
}
.kahoot-results-row-correct { background: rgba(34,197,94,.15); border-radius: 10px; padding: 8px 12px; margin: -8px -12px; }
.kahoot-results-row-label {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 17px; color: #fff; line-height: 1.3;
}
.kahoot-results-row-correct .kahoot-results-row-label { color: #4ade80; font-weight: 700; }
.kahoot-results-row-shape { font-size: 14px; padding-top: 3px; flex-shrink: 0; }
.kahoot-results-row-check { color: #4ade80; font-size: 16px; margin-left: 6px; }
.kahoot-results-row-bar-wrap {
  height: 32px; background: rgba(255,255,255,.1); border-radius: 8px; overflow: hidden;
}
.kahoot-results-row-bar {
  height: 100%; border-radius: 8px; transition: width .6s ease-out;
  min-width: 3px;
}
.kahoot-results-row-pct { font-size: 18px; font-weight: 700; color: #fff; text-align: right; }
.kahoot-results-row-count { font-size: 14px; color: rgba(255,255,255,.5); text-align: center; }
.kahoot-results-row-noresponse .kahoot-results-row-label { color: rgba(255,255,255,.4); font-style: italic; }
.kahoot-results-summary {
  font-size: 18px; font-weight: 600; color: rgba(255,255,255,.6); margin-top: 28px;
}
.kahoot-results-summary-small { font-size: 15px; color: rgba(255,255,255,.6); }
.live-kahoot-start-btn { margin-top: 24px; padding: 12px 32px; font-size: 16px; width: auto; align-self: center; }
/* Kahoot timer buttons (prof footer) */
.kahoot-timer-btns { display: flex; gap: 6px; }
.kahoot-timer-btn { padding: 6px 14px; font-size: 13px; min-height: 32px; width: auto; transition: all .15s; }
.kahoot-timer-btn-active { background: var(--primary, #cf1578); color: #fff; border-color: var(--primary, #cf1578); }
/* Kahoot countdown (prof screen — overlay top right) */
.kahoot-countdown {
  position: fixed; top: 24px; right: 32px; z-index: 100;
  width: 120px; height: 120px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 56px; font-weight: 800; color: #fff;
  font-variant-numeric: tabular-nums;
  text-align: center; line-height: 1;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  background: rgba(255,255,255,.1);
  border: 4px solid rgba(255,255,255,.25);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.kahoot-countdown-danger {
  color: #ef4444; border-color: #ef4444;
  background: rgba(239,68,68,.15);
  animation: ev-timer-pulse 1s infinite;
}
/* Kahoot student timer bar (on footer) */
.kahoot-student-timer-bar {
  position: absolute; top: 0; left: 0; height: 3px;
  background: var(--primary, #2980b9); transition: width .2s linear;
}
.kahoot-student-timer-bar.kahoot-timer-warn { background: #f59e0b; }
.kahoot-student-timer-bar.kahoot-timer-danger { background: #ef4444; }
/* Kahoot student feedback */
.kahoot-student-feedback {
  font-size: 20px; font-weight: 700; padding: 14px 24px; border-radius: 12px;
  margin-bottom: 24px; text-align: center;
}
.kahoot-feedback-correct { background: rgba(34,197,94,.15); color: #4ade80; }
.kahoot-feedback-correct i { font-size: 24px; margin-right: 8px; }
.kahoot-feedback-wrong { background: rgba(239,68,68,.15); color: #f87171; }
.kahoot-feedback-wrong i { font-size: 24px; margin-right: 8px; }
/* Kahoot podium */
.kahoot-podium {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 16px; margin: 28px 0 8px;
}
.kahoot-podium-col {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 12px; border-radius: 12px;
  background: rgba(255,255,255,.04);
  animation: kahoot-podium-in .4s ease-out both;
}
.kahoot-podium-rank-0 {
  background: rgba(255,215,0,.1); border: 1px solid rgba(255,215,0,.2);
  transform: translateY(-12px); animation-delay: .15s;
}
.kahoot-podium-rank-1 {
  background: rgba(192,192,192,.08); border: 1px solid rgba(192,192,192,.15);
  animation-delay: .3s;
}
.kahoot-podium-rank-2 {
  background: rgba(205,127,50,.08); border: 1px solid rgba(205,127,50,.15);
  animation-delay: .45s;
}
@keyframes kahoot-podium-in { from { opacity: 0; transform: scale(.8) translateY(10px); } to { opacity: 1; } }
.kahoot-podium-rank-0 { animation: kahoot-podium-in .4s ease-out .15s both; transform: translateY(-12px); }
.kahoot-podium-medal { font-size: 28px; margin-bottom: 6px; }
.kahoot-podium-rank-0 .kahoot-podium-medal { font-size: 36px; }
.kahoot-podium-avatar { margin-bottom: 8px; }
.kahoot-podium-name {
  font-size: 13px; color: rgba(255,255,255,.8); font-weight: 500;
  max-width: 120px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kahoot-podium-rank-0 .kahoot-podium-name { font-size: 15px; font-weight: 700; color: #fff; }
.kahoot-podium-score {
  font-size: 12px; color: rgba(255,255,255,.4); margin-top: 4px;
}
.kahoot-podium-rank-0 .kahoot-podium-score { font-size: 14px; color: rgba(255,215,0,.7); font-weight: 600; }
/* Podium full screen */
.kahoot-podium-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 32px;
  position: relative; overflow: hidden;
}
/* Fireworks animation */
.kahoot-firework {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  animation: kahoot-fw-burst 1.2s ease-out forwards;
  pointer-events: none;
}
@keyframes kahoot-fw-burst {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--fw-x), var(--fw-y)) scale(0); opacity: 0; }
}
.kahoot-firework-shower { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.kahoot-podium-screen > *:not(.kahoot-firework-shower) { z-index: 1; }
.kahoot-podium-screen-title {
  font-size: 28px; font-weight: 700; color: #fff; margin-bottom: 32px;
  display: flex; align-items: center; gap: 12px;
}
.kahoot-podium-screen-title i { color: #fbbf24; }
/* Podium button in footer */
.kahoot-podium-btn {
  background: rgba(251,191,36,.15); color: #fbbf24; border: 1px solid rgba(251,191,36,.3);
  padding: 6px 16px; font-size: 13px; min-height: 32px; width: auto;
}
.kahoot-podium-btn:hover { background: rgba(251,191,36,.25); }
/* QCM multi-select in Kahoot */
.kahoot-multi-hint {
  font-size: 13px; color: rgba(255,255,255,.4); margin-top: 12px; text-align: center;
}
.kahoot-validate-btn {
  margin-top: 12px; padding: 10px 28px; font-size: 15px; width: auto; align-self: center;
}

.live-timer-bar {
  position: absolute; top: 0; left: 0; height: 2px;
  background: var(--primary, #2980b9);
  transition: width .5s linear;
  z-index: 1;
}
.live-timer-bar.live-timer-warn { background: #f59e0b; }
.live-timer-bar.live-timer-danger { background: #ef4444; }
/* Answer choices (QCM/QCU/VF) */
.live-answer-choices {
  list-style: none; padding: 0; margin: 0 0 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.live-answer-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid var(--border, var(--gray-200));
  border-radius: 8px; font-size: 14px; color: var(--text);
}
.live-answer-choice-selected {
  background: #e3f2fd; border-color: #42a5f5;
}
.live-answer-choice-indicator {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--gray-300); display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff;
}
.live-answer-choice-selected .live-answer-choice-indicator {
  background: #42a5f5; border-color: #42a5f5;
}
/* Board status on student */
.pdfa-status--board { color: #fbbf24 !important; }
/* Live item display */
.live-item-frame { width: 100%; height: 100%; border: none; background: #fff; }
.live-item-pdf { padding: 0 !important; display: flex; flex-direction: column; }
.live-item-pdf .pdf-annotator { flex: 1; height: 100%; }
.live-item-pdf .pdfanno-container { height: 100%; }
.live-item-image { max-width: 100%; max-height: 100%; object-fit: contain; display: block; margin: auto; }
.live-item-video { width: 100%; max-height: 100%; display: block; margin: auto; background: #000; }
.live-item-written { padding: 40px; background: #fff; color: #222; min-height: 100%; overflow-y: auto; line-height: 1.6; }
.fsv-content:has(.live-item-exercise) { justify-content: flex-start; }
.live-item-exercise { width: 100%; height: 100%; overflow-y: auto; }
.live-item-download { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 40px; color: #93c5fd; font-size: 16px; text-decoration: none; }
.live-item-download:hover { color: #fff; }

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 768px) {
  .live-editor-sidebar { display: none; }
  .live-editor-drive { display: none; }
  .live-river-card { min-width: 140px; }
  .live-river-card-actions { opacity: 1; }
}

/* ══════════════════════════════════════════════════
   GradesPanel — grille de notes enseignant
   ══════════════════════════════════════════════════ */
.gp-loader { display: flex; align-items: center; justify-content: center; height: 200px; font-size: 24px; color: var(--text-light); }
.gp-error { padding: 40px; text-align: center; color: var(--error); font-size: 15px; }
.gp-empty { padding: 40px; text-align: center; color: var(--text-light); font-size: 14px; }

.gp-filters { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.gp-filter-select { padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg-card); color: var(--text); cursor: pointer; }
.gp-filter-select:focus { outline: none; border-color: var(--primary); }

/* Grid scroll container — fills remaining space like dt-scroll-wrap */
.sp-page:has(.gp-grid-scroll) { flex: 1 1 0; overflow: hidden; min-height: 0; }
.gp-grid-scroll { flex: 1 1 0; overflow: auto; background: var(--bg-card); min-height: 0; position: relative; }
.gp-header-bg { position: sticky; top: 0; left: 0; height: 140px; background: #f5f6f8; z-index: 1; pointer-events: none; margin-bottom: -140px; }

/* CSS Grid */
.gp-grid { display: inline-grid; min-width: 100%; font-size: 13px; }

/* All cells */
.gp-cell { padding: 8px 10px; border-bottom: 1px solid #eef0f3; border-right: 1px solid #eef0f3; white-space: nowrap; display: flex; align-items: center; }

/* ── Header row (exercise titles) ── */
.gp-header-first { position: sticky; top: 0; left: 0; z-index: 3; background: #f5f6f8; height: 140px; border: none; }
.gp-header-avg { position: sticky; top: 0; left: 180px; z-index: 3; background: #f5f6f8; height: 140px; font-weight: 700; font-size: 11px; color: var(--text-secondary); text-align: center; border-right: 1px solid #eef0f3; border-bottom: 1px solid #eef0f3; flex-direction: column; justify-content: center; align-items: center; }
.gp-header-avg-label { font-weight: 700; }
.gp-header-exo { position: sticky; top: 0; z-index: 2; background: transparent; height: 140px; padding: 0; overflow: visible; transform: skewX(-34deg); transform-origin: bottom left; border-left: 1px solid #eef0f3; border-right: 1px solid #eef0f3; border-bottom: 1px solid #eef0f3; }
.gp-header-exo-inner { position: absolute; bottom: 0; left: 55px; transform: skewX(34deg) rotate(-56deg); transform-origin: bottom left; white-space: normal; width: 130px; font-size: 12px; color: var(--text); line-height: 1.3; padding: 4px 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-align: left; }

/* ── Student name (sticky left) ── */
.gp-name { position: sticky; left: 0; z-index: 1; background: inherit; font-weight: 600; color: var(--text); min-width: 180px; }

/* ── Student average (sticky left, after name) ── */
.gp-avg { position: sticky; left: 180px; z-index: 1; background: inherit; font-weight: 700; justify-content: center; min-width: 55px; }

/* ── Note cells ── */
.gp-note { justify-content: center; min-width: 55px; }
.gp-note-none { color: var(--text-light); }

/* ── Color coding ── */
.gp-note-excellent { color: #15803d; }
.gp-note-good { color: #2563eb; }
.gp-note-average { color: #d97706; }
.gp-note-weak { color: #dc2626; }

/* ── Legend ── */
.gp-legend { display: flex; flex-direction: column; gap: 3px; font-size: 9px; color: var(--text-secondary); margin-top: 6px; }
.gp-legend-item { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.gp-legend-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.gp-legend-dot.gp-note-excellent { background: #15803d; }
.gp-legend-dot.gp-note-good { background: #2563eb; }
.gp-legend-dot.gp-note-average { background: #d97706; }
.gp-legend-dot.gp-note-weak { background: #dc2626; }

/* ── Row alternation ── */
.gp-row-even { background: #ffffff; }
.gp-row-odd { background: #f8fafc; }

/* ── Footer row (class averages) ── */
.gp-footer-label { position: sticky; left: 0; z-index: 1; background: #eef1f6; font-weight: 700; color: var(--text); font-size: 12px; border-top: 2px solid var(--border); min-width: 180px; }
.gp-footer-avg { position: sticky; left: 180px; z-index: 1; background: #eef1f6; font-weight: 700; justify-content: center; border-top: 2px solid var(--border); min-width: 55px; }
.gp-footer-note { background: #eef1f6; font-weight: 600; justify-content: center; border-top: 2px solid var(--border); color: var(--text-secondary); min-width: 55px; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .gp-filters { margin-left: 8px; gap: 6px; }
  .gp-grid { font-size: 12px; }
  .gp-name { min-width: 120px; }
  .gp-avg, .gp-header-avg { left: 120px; }
}

/* ══════════════════════════════════════════════════
   ModuleView — vue liste modulaire (parcours)
   ══════════════════════════════════════════════════ */
.mv-page { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: hidden; }
.mv-loader { display: flex; align-items: center; justify-content: center; height: 200px; font-size: 24px; color: var(--text-light); }
.mv-error { padding: 40px; text-align: center; color: var(--error); font-size: 14px; }

/* Header */
.mv-header { padding: 20px 24px 12px; border-bottom: 1px solid #eaecef; flex-shrink: 0; }
.mv-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mv-title { font-size: 17px; font-weight: 700; color: var(--text); margin: 0; display: flex; align-items: center; gap: 8px; }
.mv-title i { color: var(--primary); font-size: 16px; }
.mv-mode-badge { font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.mv-mode-libre { background: #dbeafe; color: #1d4ed8; }
.mv-mode-sequentiel { background: var(--warning-bg); color: var(--warning-fg); }
.mv-mode-conditionnel { background: #fce7f3; color: #9d174d; }
.mv-settings-btn { background: none; border: none; color: var(--text-secondary); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 4px; margin-left: auto; }
.mv-settings-btn:hover { background: var(--bg); color: var(--text); }

/* Info row */
.mv-info-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
.mv-progress-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.mv-progress-bar { flex: 1; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.mv-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.mv-progress-fill.mv-progress-validated { background: var(--success); }
.mv-progress-text { font-size: 12px; font-weight: 600; white-space: nowrap; }
.mv-score { font-size: 12px; }
.mv-score strong { color: var(--text); }
.mv-validated-badge { font-size: 12px; font-weight: 600; color: var(--success); display: flex; align-items: center; gap: 4px; }
.mv-teacher-stat { display: flex; align-items: center; gap: 5px; font-size: 13px; }

/* Item list */
.mv-list { flex: 1; overflow-y: auto; padding: 0; }

.mv-item { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid #f0f1f3; transition: background 0.15s; }
.mv-item:last-child { border-bottom: none; }

/* Status-based styling */
.mv-item-available, .mv-item-started { background: #fff; }
.mv-item-active:hover { background: #f0f7ff; }
.mv-item-completed { background: #f0fdf4; }
.mv-item-locked { background: #fafafa; opacity: 0.55; }

/* Status icons */
.mv-item-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.mv-icon-completed { color: var(--success); }
.mv-icon-locked { color: var(--gray-300); }
.mv-icon-started { color: var(--accent); }
.mv-icon-available { color: var(--secondary); }

/* Item content */
.mv-item-num { font-size: 13px; font-weight: 600; color: var(--text-secondary); min-width: 24px; }
.mv-item-type-icon { font-size: 14px; color: var(--text-light); flex-shrink: 0; }
.mv-item-title { font-size: 14px; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-item-completed .mv-item-title { color: var(--text-secondary); }
.mv-item-locked .mv-item-title { color: var(--text-light); }

/* Score / status labels */
.mv-item-score { font-size: 12px; font-weight: 600; color: var(--success); white-space: nowrap; }
.mv-item-read { color: var(--secondary); }
.mv-item-optional { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: var(--gray-100); color: var(--text-light); white-space: nowrap; }

/* Teacher badges */
.mv-item-teacher-count { font-size: 11px; color: var(--text-light); background: var(--gray-100); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.mv-item-settings { background: none; border: none; color: var(--text-light); font-size: 13px; cursor: pointer; padding: 4px; border-radius: 4px; flex-shrink: 0; }
.mv-item-settings:hover { color: var(--text); background: var(--gray-100); }
.mv-item-kebab { background: none; border: none; color: var(--text-light); font-size: 14px; cursor: pointer; padding: 4px 8px; border-radius: 4px; flex-shrink: 0; position: relative; }
.mv-item-kebab:hover { color: var(--text); background: var(--gray-100); }
.mv-item-kebab.is-open { color: var(--primary); background: var(--gray-100); }
.mv-item-score-max { font-size: 10px; color: var(--text-light); background: #eef2ff; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.mv-score-max-info { font-size: 13px; color: var(--secondary); font-weight: 600; }
.mv-score-hint { font-size: 11px; color: var(--text-light); white-space: nowrap; }

/* Drag handle */
.mv-item-handle { color: var(--text-light); cursor: grab; padding: 0 4px; flex-shrink: 0; font-size: 12px; }
.mv-item-handle:hover { color: var(--text-secondary); }
.mv-item-dragging { opacity: 0.3; }
.mv-item-handle:active { cursor: grabbing; }

/* Mobile */
@media (max-width: 768px) {
  .mv-header { padding: 12px 16px 8px; }
  .mv-item { padding: 10px 16px; gap: 8px; }
  .mv-title { font-size: 15px; }
  .mv-progress-wrap { min-width: 140px; }
}

/* ════════════════════════════════════════════════════════════════════════ */
/* Business Game — §17 cahier des charges                                   */
/* Aligné sur les panels Getskills2 (sp-page / sp-page-title)               */
/* ════════════════════════════════════════════════════════════════════════ */

/* Actions à droite de la barre de titre standard */
.sp-page-title .sp-page-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Page business game : body scrollable sous la barre de titre.
   Le .sp-page parent doit libérer sa contrainte de hauteur pour que le
   body puisse réellement scroller à l'intérieur (même pattern que
   .sp-page:has(.gp-grid-scroll) utilisé par GradesPanel). */
.sp-page:has(.bg-page-body) { flex: 1 1 0; overflow: hidden; min-height: 0; }
.bg-page-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1 1 0; min-height: 0; }
.bg-empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.bg-empty i { font-size: 48px; display: block; margin-bottom: 12px; opacity: 0.4; color: var(--primary); }
.bg-empty p { margin: 0; font-size: 14px; }

/* Liste de cartes (parties) — inspiré du style drive/parcours */
.bg-card-list { display: flex; flex-direction: column; gap: 10px; }
.bg-card { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; transition: box-shadow 0.15s, border-color 0.15s; }
.bg-card:hover { border-color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.bg-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bg-card-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.bg-card-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-light); }
.bg-card-meta i { margin-right: 4px; color: var(--primary); opacity: 0.7; }
.bg-card-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.bg-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.bg-badge-cree      { background: #eef2ff; color: #4338ca; }
.bg-badge-lance     { background: #dbeafe; color: #1e40af; }
.bg-badge-en_cours  { background: #dcfce7; color: #166534; }
.bg-badge-cloture   { background: var(--gray-100); color: var(--gray-600); }

/* Wizard */
.bg-wiz-stepper { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.bg-wiz-step { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--border); background: #fff; font-weight: 600; color: var(--text-light); }
.bg-wiz-step.is-active { border-color: var(--primary); color: var(--primary); }
.bg-wiz-step.is-done   { border-color: var(--success, #10b981); background: var(--success, #10b981); color: #fff; }

.bg-wiz-content { padding: 0 8px; }
.bg-wiz-content h3 { margin: 0 0 16px; font-size: 18px; }
.bg-field-label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
.bg-field-hint { font-size: 13px; color: var(--text-light); margin: 0 0 16px; }
/* Compat : ancienne définition .bg-select/.bg-input surchargée par le bloc unifié plus haut */
.bg-radio-group { display: flex; gap: 20px; }
.bg-radio { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }

.bg-market-list, .bg-level-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 8px; }
.bg-market-card, .bg-level-card { border: 2px solid var(--border); border-radius: 8px; padding: 14px; cursor: pointer; transition: all 0.15s; }
.bg-market-card:hover, .bg-level-card:hover { border-color: var(--primary); }
.bg-market-card.is-selected, .bg-level-card.is-selected { border-color: var(--primary); background: #eef2ff; }
.bg-market-card h4, .bg-level-card h4 { margin: 0 0 6px; font-size: 14px; }
.bg-market-card p, .bg-level-card p { margin: 0 0 6px; font-size: 12px; color: var(--text-light); line-height: 1.4; }
.bg-market-card small { font-size: 11px; color: var(--text-light); }

.bg-group-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 6px; }
.bg-group-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; border-radius: 4px; }
.bg-group-item:hover { background: var(--gray-50); }
.bg-group-name { flex: 1; font-size: 14px; }
.bg-group-count { font-size: 12px; color: var(--text-light); }

.bg-wiz-summary dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.bg-wiz-summary dt { font-weight: 600; color: var(--text-light); font-size: 13px; }
.bg-wiz-summary dd { margin: 0; font-size: 14px; }
.bg-wiz-note { margin-top: 20px; padding: 12px; background: #eff6ff; border-radius: 6px; font-size: 13px; color: #1e40af; }
.bg-wiz-note i { margin-right: 6px; }

/* Business Game — écrans joueur */

/* Dashboard joueur : hérite entièrement de .bg-page-body (scroll + padding) */

.bg-kpi-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.bg-kpi { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; text-align: center; }
.bg-kpi-label { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.4px; }
.bg-kpi-value { font-size: 20px; font-weight: 700; margin-top: 4px; }

.bg-notice { padding: 12px 16px; border-radius: 8px; font-size: 14px; }
.bg-notice-info { background: #eff6ff; color: #1e40af; }
.bg-notice-warn { background: var(--warning-bg); color: var(--warning-fg); }
.bg-notice-danger { background: var(--error-bg); color: var(--error-fg); border: 1px solid #fecaca; padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
.bg-notice-danger strong { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.bg-notice-danger strong i { color: #dc2626; }
.bg-notice-danger p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; }

.bg-delete-modal-head { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 0 0 12px; }
.bg-delete-modal-head i { color: #dc2626; font-size: 18px; }
.bg-delete-modal-hint { margin: 10px 0 0; font-size: 13px; color: var(--text-light); font-style: italic; }

.bg-start-modal-head { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 0 0 12px; }
.bg-start-modal-head i { color: #16a34a; font-size: 18px; }
.bg-start-modal-hint { margin: 10px 0 0; font-size: 13px; color: var(--text-light); line-height: 1.5; }

.bg-decisions-panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.bg-decisions-panel h3 { margin: 0 0 14px; font-size: 16px; }
.bg-decisions-section { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.bg-decisions-section:last-child { border-bottom: none; margin-bottom: 0; }
.bg-decisions-section h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); }
.bg-decision-row { display: grid; grid-template-columns: 220px 1fr auto; align-items: center; gap: 12px; margin-bottom: 8px; }
.bg-decision-label { font-size: 14px; }
.bg-decision-hint { color: var(--text-light); font-size: 12px; }

.bg-save-bar { display: flex; justify-content: flex-end; margin-top: 12px; }

.bg-history-panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.bg-history-panel h3 { margin: 0 0 12px; font-size: 16px; }
.bg-history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bg-history-table th, .bg-history-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.bg-history-table th { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.4px; }

.bg-setup-card { max-width: 540px; margin: 20px auto; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 24px; }
.bg-setup-card h3 { margin: 0 0 8px; }
.bg-setup-form { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.bg-setup-form button[type="submit"] { margin-top: 18px; align-self: flex-start; }

@media (max-width: 640px) {
  .bg-decision-row { grid-template-columns: 1fr; }
  .bg-decision-label { font-weight: 600; }
}

/* Business Game — Mapping + Grading panels */
.bg-map-section { margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.bg-map-section h4 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); }
.bg-map-row { margin-bottom: 14px; padding: 12px; background: var(--gray-50); border-radius: 8px; }
.bg-map-row-head { margin-bottom: 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bg-map-row-head .bg-badge { font-size: 10px; padding: 2px 8px; }
.bg-map-comp-list { display: flex; flex-direction: column; gap: 6px; }
.bg-map-comp-line { display: flex; align-items: center; gap: 8px; }
.bg-map-comp-line select { flex: 1; }
.bg-input-small { width: 80px; }

.bg-grade-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bg-grade-table th, .bg-grade-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.bg-grade-table th { background: var(--gray-50); text-align: left; position: sticky; top: 0; }
.bg-grade-th small { color: var(--text-light); font-size: 10px; font-weight: normal; }
.bg-grade-cell { text-align: center; }
.bg-input-tiny { width: 62px; text-align: center; padding: 4px; }
.bg-grade-auto { background: #eff6ff; }
.bg-grade-saved { background: #dcfce7 !important; transition: background 0.3s; }
.bg-grade-total { font-weight: 700; text-align: right; padding-right: 12px; }

/* Business Game — Gazette */
.bg-gazette-bar { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
.bg-gazette-bar .bg-field-hint { flex: 1; margin: 0; color: var(--warning-fg); }

/* Business Game — Gazette : liste des éditions (modale) */
.bg-gz-intro { margin: 0 0 14px; font-size: 13px; color: var(--text-light); }
.bg-gz-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.bg-gz-editions { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
/* Passé + courant : ambre. Prof futur (preview) : bleu. Élève futur : muted gris. */
.bg-gz-edition { display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; background: #fff; border: 1px solid var(--border); border-left: 4px solid #f59e0b; border-radius: 8px; text-decoration: none; color: var(--text); transition: transform .12s ease, box-shadow .12s ease; cursor: pointer; }
.bg-gz-edition-head { font-weight: 700; font-size: 14px; }
.bg-gz-edition-head i { margin-right: 6px; color: #f59e0b; }
.bg-gz-edition-meta { font-size: 12px; color: var(--text-light); }
.bg-gz-edition[role="link"]:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.bg-gz-edition[role="link"]:focus-visible { outline: 2px solid #f59e0b; outline-offset: 2px; }
.bg-gz-edition.is-current { background: linear-gradient(180deg, #fffbeb 0%, #fff 100%); }
.bg-gz-edition.is-preview { border-left-color: #0ea5e9; background: linear-gradient(180deg, #f0f9ff 0%, #fff 100%); }
.bg-gz-edition.is-preview .bg-gz-edition-head i { color: #0ea5e9; }
.bg-gz-edition.is-preview[role="link"]:focus-visible { outline-color: #0ea5e9; }
.bg-gz-edition.is-muted { border-left-color: var(--border); opacity: 0.55; cursor: default; background: var(--gray-50); }
.bg-gz-edition.is-muted .bg-gz-edition-head i { color: var(--text-light); }

/* Business Game — Strategy */
.bg-strategy-card { background: #fff; border: 1px solid var(--border); border-left: 4px solid #8b5cf6; border-radius: 10px; padding: 14px 16px; }
.bg-strategy-head h3 { margin: 0 0 8px; font-size: 15px; }
.bg-strategy-body { margin-bottom: 10px; }
.bg-strategy-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; margin-bottom: 6px; }
.bg-strategy-frame { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #6d28d9; background: #ede9fe; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.bg-strategy-desc { font-size: 13px; color: var(--text-light); margin: 0; line-height: 1.5; }
.bg-strategy-loading { text-align: center; padding: 20px; color: var(--text-light); }

.bg-strat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 20px; }
.bg-strat-section { margin-bottom: 0; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.bg-strat-section h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-light); }
.bg-strat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bg-strat-card { border: 2px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer; transition: all 0.15s; position: relative; }
.bg-strat-card:hover { border-color: #10b981; }
.bg-strat-card.is-selected { border-color: #10b981; background: var(--success-bg); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15); }
.bg-strat-card.is-selected::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; top: 8px; right: 10px; color: #10b981; font-size: 14px; }

/* Bouton "?" d'aide sur chaque carte de stratégie */
.bg-strat-help-btn { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: var(--gray-100); border: 1px solid transparent; color: var(--gray-500); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.12s; z-index: 2; }
.bg-strat-help-btn:hover { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.bg-strat-help-btn i { font-size: 13px; }
.bg-strat-card.is-selected .bg-strat-help-btn { right: 34px; }

/* Modale d'aide de stratégie */
.bg-strat-help-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #eaecef; }
.bg-strat-help-level { margin-left: auto; font-size: 11px; padding: 2px 10px; background: #eef2ff; color: #4338ca; border-radius: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.bg-strat-help-body { font-size: 14px; line-height: 1.6; color: var(--text); }
.bg-strat-help-body p { margin: 0 0 12px; }
.bg-strat-help-body p:last-child { margin-bottom: 0; }
.bg-strat-help-body strong { color: var(--primary); font-weight: 600; }

/* ─── Course Image Picker ─────────────────────────────────────────── */
.cip-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--sp-4);
  align-items: stretch;
  min-height: 480px;
}
.cip-tabs {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  border-right: 1px solid var(--gray-200);
  padding-right: var(--sp-3);
  align-content: start;
}
.cip-tab {
  padding: var(--sp-2) var(--sp-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  text-align: left;
  width: 100%;
  transition: all var(--duration-fast) var(--ease-out);
}
.cip-tab:hover { background: var(--gray-100); color: var(--gray-800); }
.cip-tab.is-active {
  background: var(--primary-50);
  color: var(--primary);
  border-color: var(--primary-200);
  font-weight: 600;
}
.cip-tab i { font-size: 14px; width: 18px; text-align: center; }

.cip-main {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}
.cip-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.cip-mode-toggle {
  display: inline-flex;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 3px;
}
.cip-mode-btn {
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast) var(--ease-out);
}
.cip-mode-btn.is-active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.cip-search {
  display: flex;
  justify-content: flex-end;
  flex: 1;
  min-width: 220px;
}
.cip-search input { max-width: 380px; width: 100%; }
.cip-load-more {
  grid-column: 1 / -1;
  padding: var(--sp-3);
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  color: var(--gray-700);
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--duration-fast) var(--ease-out);
}
.cip-load-more:hover:not(:disabled) {
  background: var(--gray-100);
  border-color: var(--gray-400);
}
.cip-load-more:disabled { opacity: 0.6; cursor: wait; }
.cip-attribution {
  font-size: 11px;
  color: var(--gray-500);
  text-align: right;
  padding: 0 var(--sp-1);
  min-height: 16px;
}
.cip-attribution a { color: inherit; text-decoration: underline; }
.cip-empty-hint { font-size: 12px; color: var(--gray-500); margin-top: 6px; }

.cip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--sp-3);
  max-height: 440px;
  overflow-y: auto;
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
  scrollbar-gutter: stable;
}
.cip-search-more {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 80px;
  padding: var(--sp-3);
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  color: var(--gray-700);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all var(--duration-fast) var(--ease-out);
}
.cip-search-more:hover {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary);
}
.cip-search-more i { font-size: 18px; }
.cip-card {
  display: block;
  min-height: 132px;
  background: var(--bg-card);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  font-family: inherit;
  padding: 0;
  text-align: left;
}
.cip-card:hover { border-color: var(--gray-400); transform: translateY(-2px); }
.cip-card.is-selected {
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}
.cip-thumb {
  display: block;
  width: 100%;
  height: 100px;
  background: var(--gray-50);
  overflow: hidden;
  position: relative;
}
.cip-thumb img,
.cip-thumb object,
.cip-thumb svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.cip-label {
  padding: var(--sp-2) var(--sp-3);
  font-size: 12px;
  color: var(--gray-700);
  font-weight: 500;
  text-align: left;
  background: var(--bg-card);
}
.cip-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-8);
  color: var(--text-light);
  font-size: 14px;
}

/* ─── HelpPopover ──────────────────────────────────────────────────── */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin-left: 6px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  vertical-align: middle;
}
/* Quand le bouton ? est le dernier enfant d'un flex row, il se cale à droite.
   Tous les rows d'une même modale ont alors leur ? vertically alignés. */
.pe-ps-row > .help-btn:last-child,
.form-row > .help-btn:last-child {
  margin-left: auto;
}
.help-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
}
.help-btn.is-open {
  background: var(--primary-50);
  color: var(--primary);
}
.help-popover {
  position: fixed;
  width: 280px;
  max-width: calc(100vw - 16px);
  padding: 12px 32px 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10500;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  opacity: 0;
  transform: translateY(-50%) scale(0.96);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  pointer-events: none;
}
.help-popover[data-placement="bottom"] {
  transform: scale(0.96);
}
.help-popover.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
.help-popover[data-placement="bottom"].is-open {
  transform: scale(1);
}
.help-popover-title {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 6px;
  font-size: 13px;
}
.help-popover-body {
  color: var(--gray-700);
}
.help-popover-body p { margin: 0 0 6px; }
.help-popover-body p:last-child { margin-bottom: 0; }
.help-popover-body strong { color: var(--gray-900); }
.help-popover-body code {
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.help-popover-body ul { margin: 6px 0; padding-left: 18px; }
.help-popover-body li { margin: 2px 0; }
.help-popover-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
}
.help-popover-close:hover { background: var(--gray-100); color: var(--gray-900); }
.help-popover-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border-top: 1px solid var(--gray-200);
  border-left: 1px solid var(--gray-200);
  transform: rotate(-45deg);
}
.help-popover[data-placement="right"] .help-popover-arrow {
  left: -6px;
  top: calc(50% - 5px);
}
.help-popover[data-placement="left"] .help-popover-arrow {
  right: -6px;
  top: calc(50% - 5px);
  transform: rotate(135deg);
}
.help-popover[data-placement="bottom"] .help-popover-arrow {
  top: -6px;
  left: 16px;
  transform: rotate(45deg);
}

/* Ateliers regroupés par produit (tuile Ateliers + marché) */
.bg-workshops-group-head { margin: 14px 0 6px; font-size: 14px; color: var(--text); padding: 6px 10px; background: #eef2ff; border-left: 3px solid var(--primary); border-radius: 4px; }
.bg-workshops-group-head:first-child { margin-top: 0; }
.bg-workshops-group-head small { color: var(--text-light); font-weight: 400; }
.bg-strat-card h5 { margin: 0 0 6px; font-size: 14px; }
.bg-strat-card p { margin: 0 0 6px; font-size: 12px; color: var(--text-light); line-height: 1.4; }
.bg-strat-card small { color: var(--text-light); font-size: 10px; }

.bg-preset-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 8px 12px; background: var(--gray-50); border-radius: 6px; }
.bg-strat-admin-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.bg-strat-admin-row input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }
.bg-strat-admin-name { flex: 1; min-width: 0; line-height: 1.4; }
.bg-strat-admin-row .bg-strat-help-btn { position: static; flex-shrink: 0; margin-top: 0; }
.bg-strat-admin-row.bg-strat-card { /* reset style hérité éventuel */ }
.bg-strat-admin-row:hover { background: var(--gray-50); }

/* Business Game — Banquier (NPC) */
.bg-npc-bar { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; }
.bg-npc-bar .bg-field-hint { flex: 1; margin: 0; color: #1e40af; }

.bg-banker-persona { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--gray-50); border-radius: 8px; margin-bottom: 14px; }
.bg-banker-avatar { width: 48px; height: 48px; background: #1e40af; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; }

.bg-loans-section { margin-bottom: 18px; }
.bg-loans-section h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-light); margin: 0 0 10px; }
.bg-loan-row { display: grid; grid-template-columns: 50px 90px 70px 50px 1fr 130px auto; gap: 10px; align-items: center; padding: 8px 12px; background: #fff; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; margin-bottom: 4px; }
.bg-loan-row.is-repay-requested { background: linear-gradient(180deg, #fffbeb 0%, #fff 100%); border-color: #f59e0b; border-left: 4px solid #f59e0b; padding-left: 9px; }
.bg-loan-id { color: var(--text-light); font-family: monospace; }
.bg-loan-rembourse { opacity: 0.6; }
.bg-loan-repay-btn { white-space: nowrap; }
.bg-loan-repay-btn.is-muted { opacity: 0.55; color: var(--text-light); background: var(--gray-100); border-color: var(--gray-200); cursor: default; }
.bg-loan-repay-btn.is-muted:hover { background: var(--gray-100); border-color: var(--gray-200); }
.bg-loan-repay-btn.is-muted i { color: #10b981; opacity: 0.9; }
.bg-badge-repay-pending { background: var(--warning-bg); color: var(--warning-fg); display: inline-flex; align-items: center; gap: 4px; }
.bg-badge-repay-pending i { font-size: 10px; }

.bg-convo { margin-bottom: 18px; max-height: 260px; overflow-y: auto; padding: 8px; background: #fafafa; border-radius: 6px; }
.bg-convo h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-light); margin: 0 0 8px; }
.bg-convo-msg { margin-bottom: 8px; padding: 8px 12px; border-radius: 6px; }
.bg-convo-msg p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.bg-convo-user { background: #fff; border: 1px solid var(--border); }
.bg-convo-npc  { background: #eff6ff; border: 1px solid #bfdbfe; }
.bg-convo-author { font-weight: 700; font-size: 12px; }
.bg-convo-turn { color: var(--text-light); font-size: 11px; margin-left: 6px; }

.bg-banker-form { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.bg-banker-form h4 { margin: 0 0 10px; font-size: 14px; }
.bg-banker-fields { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.bg-banker-fields .bg-field-label { margin: 0; }
.bg-banker-actions { display: flex; justify-content: flex-end; gap: 8px; }
.bg-banker-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.bg-banker-split .bg-convo { margin-bottom: 0; max-height: none; }
.bg-banker-left { display: flex; flex-direction: column; gap: 12px; }
.bg-banker-left .bg-banker-persona { margin-bottom: 0; }

.bg-repay-modal-head { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 0 0 14px; }
.bg-repay-modal-head i { color: #f59e0b; font-size: 18px; }
.bg-repay-modal-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; padding: 10px 14px; background: var(--gray-50); border-radius: 8px; font-size: 13px; }
.bg-repay-modal-facts dt { color: var(--text-light); margin: 0; }
.bg-repay-modal-facts dd { margin: 0; color: var(--text); }
.bg-repay-modal-hint { margin: 0; font-size: 13px; color: var(--text-light); line-height: 1.5; }

/* Business Game — Panel produits (dashboard joueur) */
.bg-products-panel { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 14px 16px; }
.bg-products-panel h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.bg-products-panel h3 i { color: var(--primary); }
.bg-products-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bg-products-table th, .bg-products-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--gray-100); }
.bg-products-table th { background: var(--gray-50); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-light); font-weight: 600; }
.bg-products-table th:first-child, .bg-products-table td:first-child { text-align: left; }
.bg-products-table th:nth-child(2), .bg-products-table td:nth-child(2) { text-align: center; }
.bg-stock-warn { color: #b45309; font-weight: 600; }

.bg-seg-pill { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.bg-seg-prix     { background: var(--warning-bg); color: var(--warning-fg); }
.bg-seg-premium  { background: #e0e7ff; color: #3730a3; }
.bg-seg-engages  { background: var(--success-bg); color: var(--success-fg); }
.bg-seg-neutre   { background: var(--gray-100); color: var(--gray-600); }

/* Business Game — Ateliers (§13) */
.bg-workshops-card { background: #fff; border: 1px solid #eaecef; border-left: 4px solid #f59e0b; border-radius: 8px; padding: 14px 16px; }
.bg-workshops-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.bg-workshops-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.bg-workshops-head h3 i { color: #f59e0b; }

/* Toolbar Marché / Mes négos : 2 tuiles d'action visibles et claires */
.bg-ws-toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.bg-ws-action { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; font-family: inherit; text-align: left; transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; min-width: 200px; }
.bg-ws-action:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); transform: translateY(-1px); }
.bg-ws-action-icon { width: 36px; height: 36px; border-radius: 8px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bg-ws-action-icon i { font-size: 16px; color: var(--text-light); }
.bg-ws-action-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bg-ws-action-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.bg-ws-action-sub { font-size: 11px; color: var(--text-light); line-height: 1.2; }
/* Variante primaire : pour le Marché des ateliers (CTA principal) */
.bg-ws-action-primary { background: #eff6ff; border-color: #bfdbfe; }
.bg-ws-action-primary .bg-ws-action-icon { background: var(--primary); }
.bg-ws-action-primary .bg-ws-action-icon i { color: #fff; }
.bg-ws-action-primary:hover { background: #dbeafe; border-color: var(--primary); }

/* Encart produit : sobre, sans color-coding par produit (les barres
   colorées rose/cyan créaient un contraste désagréable). */
.bg-workshops-group-card { margin: 18px 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.bg-workshops-group-card:first-of-type { margin-top: 8px; }

/* Bandeau d'en-tête (intégré dans la carte) */
.bg-workshops-group-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: #fafbfc; border-bottom: 1px solid #e2e8f0; }
.bg-ws-grp-icon { width: 40px; height: 40px; border-radius: 8px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bg-ws-grp-icon i { font-size: 18px; color: var(--text-light); }
.bg-ws-grp-info { flex: 1; min-width: 0; }
.bg-ws-grp-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; line-height: 1.2; }
.bg-ws-grp-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-light); }
.bg-ws-grp-meta i { margin-right: 4px; opacity: 0.6; }
.bg-ws-grp-meta span { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Tableau ateliers dans l'encart : pas de bordure externe, padding latéral */
.bg-workshops-group-card .bg-workshops-table { margin: 0; }
.bg-workshops-group-card .bg-workshops-table th { background: #fafbfc; }

/* Liste verticale de mini-cartes ateliers (alternative au tableau) */
.bg-ws-list { display: flex; flex-direction: column; }
.bg-ws-row { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(0, 2fr) auto; gap: 16px; align-items: center; padding: 12px 18px; border-bottom: 1px solid #f1f5f9; transition: background 0.12s; }
.bg-ws-row:last-child { border-bottom: none; }
.bg-ws-row:hover { background: #fafbfc; }
.bg-ws-row-arrete, .bg-ws-row-ferme { opacity: 0.55; }

/* Bloc identité (nom + sous-titre) */
.bg-ws-row-id { min-width: 0; }
.bg-ws-row-name { font-weight: 600; font-size: 14px; color: var(--text); line-height: 1.25; word-wrap: break-word; }
.bg-ws-row-sub { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-light); margin-top: 3px; }
.bg-ws-row-sub i { margin-right: 3px; opacity: 0.7; }

/* Bloc 4 stats */
.bg-ws-row-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.bg-ws-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bg-ws-cell-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-light); }
.bg-ws-cell-val { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.25; word-wrap: break-word; }
.bg-ws-cell-val.bg-stock-warn { color: #d97706; }

/* Bloc droit : état + actions */
.bg-ws-row-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.bg-ws-row-actions { display: flex; gap: 6px; }
.bg-ws-row-actions .btn { padding: 6px 10px; }

/* Responsive : 3 colonnes deviennent 1 colonne en dessous de 900px */
@media (max-width: 900px) {
  .bg-ws-row { grid-template-columns: 1fr; gap: 10px; }
  .bg-ws-row-right { flex-direction: row; align-items: center; justify-content: space-between; }
  .bg-ws-row-stats { grid-template-columns: repeat(2, 1fr); }
}

/* (color-coding par produit supprimé — barres rose/cyan/lime
    créaient un contraste désagréable entre groupes adjacents) */

/* Grille de tuiles ateliers (legacy, non utilisée actuellement) */
.bg-workshops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin: 8px 0 14px; }
.bg-workshop-tile { background: #fff; border: 1px solid #eaecef; border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; }
.bg-workshop-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border-color: var(--primary); }
.bg-ws-arrete, .bg-ws-ferme { opacity: 0.6; }
.bg-workshop-tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bg-workshop-tile-title { font-weight: 600; font-size: 14px; color: var(--text); line-height: 1.3; }
.bg-workshop-tile-title i { color: #f59e0b; margin-right: 4px; }
.bg-workshop-tile-sub { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-light); }
.bg-workshop-tile-sub i { margin-right: 4px; }
.bg-workshop-tile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.bg-ws-stat { padding: 6px 8px; background: #fafbfc; border-radius: 6px; font-size: 12px; }
.bg-ws-stat-lbl { color: var(--text-light); font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.bg-ws-stat-val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bg-ws-stat-val.bg-stock-warn { color: #d97706; }
.bg-workshop-tile-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 8px; border-top: 1px dashed #eef1f4; margin-top: auto; }
.bg-workshop-tile-actions .btn { flex: 1 1 auto; }

.bg-workshops-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.bg-workshops-table th, .bg-workshops-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: top; overflow-wrap: anywhere; }
.bg-workshops-table th { background: var(--gray-50); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-light); font-weight: 600; }
/* Largeurs de colonnes fixes pour que les ateliers groupés par produit
   présentent toutes les mêmes proportions, quel que soit le contenu. */
.bg-workshops-table th:nth-child(1), .bg-workshops-table td:nth-child(1) { width: 28%; }
.bg-workshops-table th:nth-child(2), .bg-workshops-table td:nth-child(2) { width: 11%; }
.bg-workshops-table th:nth-child(3), .bg-workshops-table td:nth-child(3) { width: 16%; }
.bg-workshops-table th:nth-child(4), .bg-workshops-table td:nth-child(4) { width: 11%; }
.bg-workshops-table th:nth-child(5), .bg-workshops-table td:nth-child(5) { width: 12%; }
.bg-workshops-table th:nth-child(6), .bg-workshops-table td:nth-child(6) { width: 12%; }
.bg-workshops-table th:nth-child(7), .bg-workshops-table td:nth-child(7) { width: 10%; }
.bg-workshops-table small { color: var(--text-light); font-size: 11px; }
.bg-ws-staff { position: relative; }
.bg-ws-staff-btn { position: absolute; top: 4px; right: 4px; background: none; border: none; color: var(--text-light); cursor: pointer; padding: 4px; }
.bg-ws-staff-btn:hover { color: var(--primary); }

.bg-workshops-summary { display: flex; gap: 22px; padding: 10px 4px 0; font-size: 13px; color: var(--text-light); border-top: 1px solid var(--border); margin-top: 10px; }

.bg-staff-row { display: flex; gap: 6px; margin-bottom: 12px; }
.bg-staff-row .btn { min-width: 56px; }

/* En-tête de section dans la modale marché (Gel douche · Marché inter-équipes…) */
.bg-offer-section-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; font-size: 14px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.4px; }
.bg-offer-section-head:first-child { margin-top: 4px; }
.bg-offer-section-head i { color: var(--primary); }
.bg-offer-count { background: var(--gray-100); color: var(--text-light); font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; letter-spacing: 0; }

/* Grille de cartes (2 colonnes sur large, 1 colonne sinon) */
.bg-offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 18px; }

/* Carte d'offre — structure sobre : header → stats → certs → prix → CTA */
.bg-offer-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color 0.15s, box-shadow 0.15s; }
.bg-offer-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-color: #cbd5e1; }

/* Header : titre + sous-titre. Pas de badge tier ni de bordure colorée. */
.bg-offer-head { display: flex; flex-direction: column; gap: 4px; }
.bg-offer-title strong { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.25; }
.bg-offer-subtitle { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-light); }
.bg-offer-subtitle i { margin-right: 3px; opacity: 0.7; }
.bg-offer-tier { display: none; } /* tier badge masqué pour épurer */

/* Stats : grille 2×2 de mini-blocs gris très clairs */
.bg-offer-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bg-offer-stat { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; background: #fafbfc; border-radius: 4px; }
.bg-offer-stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-light); }
.bg-offer-stat-lbl i { margin-right: 4px; opacity: 0.7; }
.bg-offer-stat-val { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Certifications : chips vertes */
.bg-offer-certs { display: flex; gap: 6px; flex-wrap: wrap; }
.bg-offer-certs span { background: var(--success-bg); color: var(--success-fg); font-size: 10px; padding: 3px 8px; border-radius: 10px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.3px; }

/* Bloc prix : ligne séparée par un trait, prix principal sobre */
.bg-offer-price { padding: 10px 0 0; border-top: 1px solid #eef1f4; }
.bg-offer-price-main { display: flex; justify-content: space-between; align-items: baseline; }
.bg-offer-price-lbl { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.3px; }
.bg-offer-price-val { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.bg-offer-price-sub { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--text-light); }

/* CTA : bouton pleine largeur en bas */
.bg-offer-cta { width: 100%; padding: 10px; margin-top: auto; }

/* Business Game — Événements aléatoires */
.bg-events-bar { display: flex; flex-direction: column; gap: 8px; }
.bg-event-card { background: #fff; border: 1px solid #eaecef; border-left: 4px solid #ef4444; border-radius: 8px; padding: 10px 14px; }
.bg-event-sev_mineur, .bg-event-sev-mineur     { border-left-color: #3b82f6; }
.bg-event-sev_standard, .bg-event-sev-standard { border-left-color: #f59e0b; }
.bg-event-sev_majeur, .bg-event-sev-majeur     { border-left-color: #dc2626; background: #fef2f2; }
.bg-event-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 14px; }
.bg-event-head i { color: #dc2626; }
.bg-event-card p { margin: 0; font-size: 13px; color: var(--text); line-height: 1.5; }
.bg-event-tag { margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.bg-event-tag-mineur   { background: #dbeafe; color: #1e40af; }
.bg-event-tag-standard { background: var(--warning-bg); color: var(--warning-fg); }
.bg-event-tag-majeur   { background: var(--error-bg); color: var(--error-fg); }

/* Injection prof */
.bg-event-section { margin-bottom: 20px; }
.bg-event-section h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-light); }
.bg-event-tpl { background: #fff; border: 1px solid #eaecef; border-left: 4px solid #ef4444; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.bg-event-tpl p { margin: 4px 0; font-size: 13px; }
.bg-event-tpl small { color: var(--text-light); font-family: monospace; font-size: 11px; }
.bg-event-tpl-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; align-items: center; }
.bg-event-tpl.is-muted { opacity: 0.55; background: var(--gray-50); }
.bg-event-tpl.is-muted:hover { opacity: 0.7; }
.bg-event-launched { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--success-bg); color: var(--success-fg); }
.bg-event-launched i { font-size: 10px; }

.bg-events-tabs { margin: 12px 0 6px; padding: 0 4px; }
.bg-events-tab-count { color: var(--text-light); font-weight: 500; font-size: 12px; }
.bg-events-tab-content { padding-top: 10px; }
.bg-events-tab-hint { margin: 4px 0 12px; font-style: italic; }

/* Business Game — Sous-traitance B2B */
.bg-b2b-card { background: #fff; border: 1px solid #eaecef; border-left: 4px solid #06b6d4; border-radius: 8px; padding: 14px 16px; }
.bg-b2b-card h3 i { color: #06b6d4; }
.bg-b2b-section-title { margin: 14px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-light); }
.bg-b2b-offer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.bg-b2b-meta { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; font-size: 13px; }
.bg-b2b-type { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: #cffafe; color: #155e75; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.bg-b2b-desc { color: var(--text-light); font-style: italic; }
.bg-b2b-actions { display: flex; gap: 6px; }
.bg-b2b-contracts-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.bg-b2b-contracts-table th, .bg-b2b-contracts-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--gray-100); }

.bg-b2b-help { margin: 10px 0 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.bg-b2b-help > summary { padding: 10px 14px; font-weight: 600; font-size: 13px; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.bg-b2b-help > summary::-webkit-details-marker { display: none; }
.bg-b2b-help > summary::after { content: '▸'; margin-left: auto; color: var(--text-light); font-size: 12px; transition: transform 0.15s; }
.bg-b2b-help[open] > summary::after { transform: rotate(90deg); }
.bg-b2b-help > summary i { color: #06b6d4; }
.bg-b2b-help-body { padding: 0 14px 14px; }
.bg-b2b-help-body p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text); }

.bg-b2b-terms { color: var(--text); font-weight: 500; }
.bg-b2b-product { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 10px; background: #e0e7ff; color: #3730a3; font-size: 12px; font-weight: 600; }
.bg-b2b-product i { font-size: 11px; }

.bg-param-block { margin-top: 20px; padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.bg-param-block h4 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.bg-param-block h4 i { color: var(--primary); }
.bg-param-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.bg-param-locked { margin-top: 8px; color: var(--warning-fg); }
.bg-param-locked i { margin-right: 4px; }

.bg-product-picker { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.bg-rse-option { margin-top: 14px; }
.bg-rse-toggle-row { display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: start; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color 0.12s; }
.bg-rse-toggle-row:hover { border-color: var(--primary); }
.bg-rse-toggle-row input[type="checkbox"] { margin: 3px 0 0; }
.bg-rse-toggle-info strong { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); }
.bg-rse-toggle-info strong i { color: #10b981; }
.bg-rse-toggle-info p { margin: 6px 0 0; font-size: 13px; color: var(--text-light); line-height: 1.5; }

.bg-product-picker-item { display: grid; grid-template-columns: 20px 200px 1fr; gap: 10px; align-items: start; padding: 8px 12px; background: #fff; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; transition: border-color 0.12s; }
.bg-product-picker-item:hover { border-color: var(--primary); }
.bg-product-picker-item input[type="checkbox"] { margin: 2px 0 0; }
.bg-product-picker-item input[type="checkbox"]:disabled { cursor: not-allowed; }
.bg-product-picker-name { font-weight: 600; font-size: 14px; color: var(--text); }
.bg-product-picker-desc { font-size: 13px; color: var(--text-light); line-height: 1.4; }
.bg-b2b-cap { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.bg-b2b-cap-pending { background: var(--warning-bg); color: var(--warning-fg); }
.bg-b2b-cap-delivered { background: var(--success-bg); color: var(--success-fg); }
.bg-b2b-cap-delivered-seller { background: #dbeafe; color: #1e40af; }
.bg-b2b-cap-default { background: var(--error-bg); color: var(--error-fg); }
.bg-b2b-contracts-table th { background: var(--gray-50); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-light); font-weight: 600; }

/* Bouton "danger" discret pour les actions irréversibles */
.bg-btn-danger { color: var(--error-fg) !important; border-color: #fecaca !important; }
.bg-btn-danger:hover { background: #fef2f2 !important; }

/* Badges compteur de tour */
.bg-card-badges { display: flex; align-items: center; gap: 6px; }
.bg-badge-turn { background: #eef2ff; color: #3730a3; font-family: monospace; font-weight: 700; letter-spacing: 0.5px; }

/* Business Game — Page de pilotage (4 onglets) */
.bg-card-clickable { cursor: pointer; }
.bg-card-clickable:hover { border-color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.bg-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); padding: 0 24px; background: var(--gray-50); align-items: center; }
.bg-tabs-extra { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.bg-tabs-extra:empty { display: none; }
.bg-tabs-extra-label { font-size: 13px; color: var(--text-light); display: inline-flex; align-items: center; gap: 6px; }
.bg-tabs-team-select { font-size: 13px; padding: 4px 8px; min-width: 180px; }
.bg-tab { background: none; border: none; padding: 10px 18px; font-size: 14px; font-weight: 600; color: var(--text-light); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; display: inline-flex; align-items: center; gap: 6px; }
.bg-tab:hover { color: var(--text); }
.bg-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.bg-subtabs { display: flex; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.bg-subtab { background: none; border: none; padding: 6px 14px; font-size: 13px; color: var(--text-light); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.bg-subtab:hover { color: var(--text); }
.bg-subtab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.bg-subpane { padding-top: 6px; }

/* Paramètres moteur (overrides prof) */
.bg-engine-form { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }
.bg-engine-section { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: #fff; }
.bg-engine-section legend { font-weight: 700; font-size: 14px; padding: 0 6px; color: var(--text); }
.bg-engine-field { margin: 10px 0; }
.bg-engine-label-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bg-engine-label { font-size: 13px; font-weight: 600; color: var(--text); }
.bg-engine-badge { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #b45309; background: var(--warning-bg); padding: 2px 6px; border-radius: 3px; }
.bg-engine-input-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.bg-engine-input { width: 120px !important; }
.bg-engine-default { font-size: 11px; color: var(--text-light); font-family: monospace; }
.bg-engine-clear { background: none; border: none; color: var(--text-light); cursor: pointer; padding: 3px 5px; border-radius: 4px; }
.bg-engine-clear:hover { color: var(--primary); background: var(--gray-100); }
.bg-engine-perproduct { margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--border); }
.bg-engine-perproduct summary { font-size: 12px; color: var(--text-light); cursor: pointer; padding: 2px 0; }
.bg-engine-perproduct summary:hover { color: var(--primary); }
.bg-engine-perproduct[open] summary { margin-bottom: 6px; }
.bg-engine-prod-label { font-size: 12px; min-width: 140px; color: var(--text); }

.bg-engine-perturn { margin-top: 10px; padding: 8px 12px; background: var(--gray-50); border-left: 2px solid var(--border); border-radius: 0 4px 4px 0; }
.bg-engine-perturn summary { font-size: 12px; color: var(--text-light); cursor: pointer; padding: 2px 0; font-weight: 600; }
.bg-engine-perturn summary:hover { color: var(--primary); }
.bg-engine-perturn .bg-field-hint { margin: 6px 0; font-size: 11px; }
.bg-engine-turn-table { border-collapse: collapse; margin-top: 6px; table-layout: fixed; }
.bg-engine-turn-table th,
.bg-engine-turn-table td { width: 44px; padding: 2px !important; text-align: center; border-bottom: 1px solid var(--border); box-sizing: border-box; }
.bg-engine-turn-table th { font-size: 11px; font-weight: 600; color: var(--text-light); letter-spacing: 0.2px; background: #fff; }
.bg-engine-turn-table input { width: 100% !important; min-width: 0 !important; min-height: 0; padding: 2px !important; font-size: 12px; text-align: center; box-sizing: border-box; -moz-appearance: textfield; appearance: textfield; }
.bg-engine-turn-table input::-webkit-inner-spin-button, .bg-engine-turn-table input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.bg-engine-toolbar { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }

.bg-engine-betas-grid { margin: 10px 0; }
.bg-engine-betas-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; table-layout: fixed; }
.bg-engine-betas-table col.bg-engine-betas-col-label { width: 160px; }
.bg-engine-betas-table th { background: var(--gray-50); padding: 6px 4px; text-align: center; font-weight: 600; font-size: 11px; color: var(--text-light); letter-spacing: 0.2px; border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-engine-betas-table th.bg-engine-betas-th-label { text-align: left; text-transform: none; letter-spacing: 0; color: var(--text); }
.bg-engine-betas-table td { padding: 4px 4px; border-bottom: 1px solid var(--gray-100); vertical-align: top; text-align: center; }
.bg-engine-betas-table td.bg-engine-betas-label { text-align: left; }
.bg-engine-betas-label strong { font-size: 13px; }
.bg-engine-betas-default { color: var(--text-light); font-size: 11px; }
.bg-engine-betas-input { width: 100% !important; max-width: 56px; min-height: 0; padding: 3px 4px; font-size: 12px; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.bg-engine-betas-input::-webkit-inner-spin-button, .bg-engine-betas-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.bg-dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bg-dash-table th, .bg-dash-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--gray-100); }
.bg-dash-table th { background: var(--gray-50); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-light); font-weight: 600; text-align: right; }
.bg-dash-table th:first-child, .bg-dash-table td:first-child,
.bg-dash-table th:nth-child(2), .bg-dash-table td:nth-child(2) { text-align: left; }

.bg-anim-block { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.bg-anim-block h3 { margin: 0 0 8px; font-size: 15px; }
.bg-anim-big-btn { font-size: 15px; padding: 10px 22px; }

/* ─── Onglet Piloter — layout 2 colonnes ──────────────────────────────── */
.bg-pilot-events { margin-bottom: 14px; }
.bg-pilot-events-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.bg-pilot-events-title i { color: #d97706; }

.bg-pilot-row { display: grid; grid-template-columns: 260px 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .bg-pilot-row { grid-template-columns: 1fr; } }

.bg-pilot-actions { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 14px; }
.bg-pilot-teams   { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
.bg-pilot-col-title { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.4px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #f0f1f3; padding-bottom: 8px; }
.bg-pilot-col-title i { color: var(--primary); }

.bg-pilot-btn { justify-content: flex-start; text-align: left; width: 100%; }
.bg-pilot-btn i { margin-right: 6px; }

/* Statut équipe dans la colonne de gauche du tableau */
.bg-pilot-table { font-size: 12.5px; }
.bg-pilot-th-status { width: 28px; }
.bg-pilot-status-cell { text-align: center !important; width: 28px; padding-left: 4px !important; padding-right: 4px !important; }
.bg-pilot-status-ok    { color: #10b981; font-size: 16px; }
.bg-pilot-status-warn  { color: #f59e0b; font-size: 16px; }
.bg-pilot-status-alert { color: #ef4444; font-size: 16px; }

/* ─── Écran élève : Option C — tuiles cliquables ───────────────────────── */
.bg-turn-header { padding: 8px 0 10px; margin: -6px 0 10px; border-bottom: 1px solid #eaecef; }
.bg-turn-side { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; }
.bg-turn-side .bg-turn-events { flex: 1; }
.bg-turn-events:empty { display: none; }
.bg-turn-gazette-btn { white-space: nowrap; }

.bg-tiles-panel { background: transparent; margin: 16px 0; }
.bg-tiles-head h3 { margin: 0 0 12px; font-size: 16px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.bg-tiles-head h3 i { color: var(--primary); }
.bg-tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }

.bg-tile { display: flex; align-items: flex-start; gap: 12px; background: #fff; border: 1px solid #eaecef; border-radius: 10px; padding: 14px 16px; cursor: pointer; text-align: left; transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s; font-family: inherit; min-height: 88px; }
.bg-tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-color: var(--primary); }
.bg-tile:disabled, .bg-tile.is-locked { opacity: 0.6; cursor: not-allowed; }
.bg-tile-icon { width: 40px; height: 40px; border-radius: 8px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bg-tile-icon i { font-size: 18px; color: #64748b; }
.bg-tile-body { flex: 1; min-width: 0; }
.bg-tile-title { font-weight: 600; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.bg-tile-preview { font-size: 12px; color: var(--text-light); line-height: 1.4; }
.bg-tile-preview em { color: #94a3b8; font-style: italic; }

.bg-tile-status { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; flex-shrink: 0; }
.bg-tile-status-ok       { background: var(--success-bg); color: var(--success-fg); }
.bg-tile-status-warn     { background: var(--warning-bg); color: var(--warning-fg); }
.bg-tile-status-optional { background: #e0e7ff; color: #4338ca; font-size: 6px; }

/* Fond de la tuile coloré selon le statut */
.bg-tile.bg-tile-ok       .bg-tile-icon { background: var(--success-bg); }
.bg-tile.bg-tile-ok       .bg-tile-icon i { color: #059669; }
.bg-tile.bg-tile-warn     .bg-tile-icon { background: var(--warning-bg); }
.bg-tile.bg-tile-warn     .bg-tile-icon i { color: #d97706; }
.bg-tile.bg-tile-optional .bg-tile-icon { background: #e0e7ff; }
.bg-tile.bg-tile-optional .bg-tile-icon i { color: #4f46e5; }

.bg-turn-info-section { margin-top: 14px; background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 0; }
.bg-turn-info-section > summary { padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; list-style: none; }
.bg-turn-info-section > summary::-webkit-details-marker { display: none; }
.bg-turn-info-section > summary i { margin-right: 6px; color: var(--primary); }
.bg-turn-info-section[open] > summary { border-bottom: 1px solid #eaecef; }
.bg-turn-info-section > :not(summary) { padding: 14px; }

.bg-turn-footer { margin-top: 18px; padding: 14px 18px; background: #fff; border: 1px solid #eaecef; border-radius: 8px; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.bg-turn-footer i { color: #10b981; font-size: 18px; }
.bg-turn-footer strong { color: var(--primary); }
.bg-turn-ready { margin-left: 6px; color: #059669; font-weight: 600; }

/* Formulaire dans modal de section schema */
.bg-schema-form { display: flex; flex-direction: column; gap: 12px; }
.bg-schema-row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; align-items: center; }
.bg-schema-row .bg-decision-hint { grid-column: 2; font-size: 11px; color: var(--text-light); margin-top: -2px; }
.bg-schema-label { font-size: 13px; color: var(--text); font-weight: 500; }
@media (max-width: 640px) { .bg-schema-row { grid-template-columns: 1fr; } .bg-schema-row .bg-decision-hint { grid-column: 1; } }

/* Pastilles d'effets d'événements */
.bg-event-resume { margin: 4px 0 6px; font-size: 13px; color: var(--text); line-height: 1.4; }
.bg-event-effects { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.bg-effect-chip { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; font-family: monospace; }
.bg-effect-chip.is-neg { background: var(--error-bg); color: var(--error-fg); }
.bg-effect-chip.is-pos { background: #dcfce7; color: #166534; }

/* Wizard — badge difficulté recommandée + modale confirmation niveau */
.bg-market-reco { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--warning-bg); color: var(--warning-fg); border-radius: 10px; font-weight: 500; }
.bg-market-card.is-selected .bg-market-reco { background: #ede9fe; color: #6d28d9; }

.bg-level-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 10px; }
.bg-level-detail-sec { background: var(--gray-50); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.bg-level-detail-sec h5 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.bg-level-detail-sec h5 i { color: var(--primary); }
.bg-level-detail-sec ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--text-light); line-height: 1.55; }
.bg-level-detail-sec li { margin-bottom: 2px; }

.bg-wiz-launch { margin-top: 16px; padding: 12px 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; }
.bg-wiz-launch-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 14px; }

/* Onglet Résultats — documents comptables + graphiques */
.bg-results-docs { margin-bottom: 24px; }
.bg-results-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.bg-results-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.bg-results-company { color: var(--primary); }
.bg-results-turn-ctrl label,
.bg-results-docs-head label { font-size: 13px; color: var(--text-light); display: inline-flex; align-items: center; gap: 6px; }
.bg-results-docs-head { margin-bottom: 14px; }
.bg-results-docs-head .bg-input { min-width: 220px; }
.bg-results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 960px) { .bg-results-grid { grid-template-columns: 1fr; } }
/* Bilan structuré en deux colonnes Actif | Passif → on lui donne la largeur
   complète pour rester lisible, le compte de résultat passe en dessous. */
.bg-results-grid:has(.bg-bilan-card) { grid-template-columns: 1fr; }
.bg-bilan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
@media (max-width: 640px) { .bg-bilan-grid { grid-template-columns: 1fr; } }
.bg-bilan-side { display: flex; flex-direction: column; min-height: 100%; }
.bg-bilan-spacer { flex: 1 1 auto; }
.bg-bilan-side-title { margin: 6px 0 8px; font-size: 13px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.6px; border-bottom: 2px solid var(--primary); padding-bottom: 4px; }
.bg-actif-table, .bg-passif-table { font-size: 13px; }
.bg-actif-table th, .bg-actif-table td.num,
.bg-passif-table td.num { text-align: right; white-space: nowrap; }
.bg-actif-table th { font-size: 11px; color: var(--text-light); font-weight: 700; text-transform: uppercase; padding: 6px 6px; border-bottom: 1px solid #e0e4e9; }
.bg-actif-table th:first-child, .bg-passif-table th:first-child { text-align: left; }
.bg-actif-table .sub td, .bg-passif-table .sub td { font-weight: 700; background: var(--gray-50); font-size: 11px; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.4px; padding-top: 8px; font-style: normal; }
.bg-actif-table .sub-total td, .bg-passif-table .sub-total td { font-style: italic; border-top: 1px solid #d1d5db; background: #fafbfc; font-size: 12px; color: var(--text-light); }

/* Barres de total alignées en bas des deux colonnes (flex push-down) */
.bg-bilan-total { background: #eff6ff; border: 2px solid #bfdbfe; border-radius: 6px; padding: 10px 12px; margin-top: 10px; font-weight: 700; font-size: 14px; }
.bg-bilan-total-label { color: var(--primary); }
.bg-bilan-total-actif { display: grid; grid-template-columns: 1fr 80px 80px 90px; gap: 8px; align-items: center; }
.bg-bilan-total-actif .num { text-align: right; font-variant-numeric: tabular-nums; }
.bg-bilan-total-passif { display: flex; justify-content: space-between; align-items: center; }
.bg-bilan-total-passif .num { font-variant-numeric: tabular-nums; }

/* Lignes cliquables (bilan + CR) → ouvrent la modale "détail du calcul" */
.bg-row-clickable { cursor: pointer; }
.bg-row-clickable:hover td { background: #eef4ff; }
.bg-row-clickable td:first-child::after { content: ' \f05a'; font-family: 'Font Awesome 6 Free'; font-weight: 900; color: var(--primary); opacity: 0.35; margin-left: 6px; font-size: 11px; }
.bg-row-clickable:hover td:first-child::after { opacity: 1; }

/* Modale d'explication d'une ligne comptable */
.bg-explain-formula { background: var(--gray-50); border-left: 3px solid var(--primary); padding: 10px 14px; border-radius: 4px; font-size: 13px; color: var(--text); margin-bottom: 14px; }
.bg-explain-formula i { color: var(--primary); margin-right: 6px; }
.bg-explain-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bg-explain-table td { padding: 8px 10px; border-bottom: 1px dashed #eef1f4; vertical-align: top; }
.bg-explain-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bg-explain-table td.num.neg { color: #b91c1c; }
.bg-explain-table td small { color: var(--text-light); font-size: 11px; }
.bg-explain-table tr.sub-total td { font-weight: 700; background: #fafbfc; border-top: 1px solid #d1d5db; }
.bg-explain-total { margin-top: 14px; padding: 10px 14px; background: #eff6ff; border: 2px solid #bfdbfe; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; }
.bg-explain-total strong { color: var(--primary); font-variant-numeric: tabular-nums; }

/* Tableau d'amortissements */
.bg-amort-section { margin-top: 14px; }
.bg-amort-card { margin: 10px 0 16px; background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 10px 12px; }
.bg-amort-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid #eaecef; }
.bg-amort-meta { font-size: 12px; color: var(--text-light); }
.bg-amort-table { font-size: 12px; }
.bg-amort-table td.num, .bg-amort-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bg-doc-card { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 14px 16px; }
.bg-doc-card h4 { margin: 0 0 10px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.bg-doc-card h4 i { color: var(--primary); }
.bg-doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bg-doc-table th { text-align: left; padding: 6px 8px; background: #f5f7fa; font-weight: 600; font-size: 12px; color: var(--text-light); border-bottom: 1px solid #e0e4e9; }
.bg-doc-table td { padding: 5px 8px; border-bottom: 1px dashed #eef1f4; }
.bg-doc-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bg-doc-table td.num.neg { color: #b91c1c; }
.bg-doc-table tr.head td { font-weight: 700; background: var(--gray-50); }
.bg-doc-table tr.sub td { font-style: italic; background: var(--gray-50); }
.bg-doc-table tr.total td { font-weight: 700; background: #eff6ff; border-top: 2px solid #bfdbfe; border-bottom: none; }
.bg-doc-footer { margin-top: 10px; padding-top: 8px; border-top: 1px solid #eaecef; font-size: 13px; display: flex; justify-content: space-between; }
.bg-doc-footer strong { color: var(--primary); font-size: 15px; }

/* Modale "Céder l'atelier" — tableau comparatif vente anonyme / vente équipes */
.bg-cede-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 12.5px; }
.bg-cede-table th, .bg-cede-table td { padding: 4px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid #eaecef; line-height: 1.3; }
.bg-cede-table thead th { background: var(--gray-50); font-weight: 700; font-size: 13px; color: var(--text); border-bottom: 2px solid var(--border); padding-top: 7px; padding-bottom: 7px; }
.bg-cede-table thead th i { color: var(--primary); margin-right: 6px; }
.bg-cede-table tbody th { font-weight: 600; color: var(--text-light); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; background: var(--gray-50); width: 22%; }
.bg-cede-table tbody td { font-variant-numeric: tabular-nums; }
.bg-cede-table tbody td small { color: var(--text-light); font-size: 11px; }
.bg-cede-table tfoot td { padding: 10px 10px; background: #fafbfc; border-bottom: none; }
.bg-cede-table tfoot th { background: transparent; border-bottom: none; }
.bg-cede-table .btn-block { width: 100%; }
.bg-cede-col-a, .bg-cede-col-b { width: 39%; }

/* Vente inter-équipes d'ateliers + négociation live */
.bg-sale-facts { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 10px 0; font-size: 13px; }
.bg-sale-facts dt { color: var(--text-light); }
.bg-sale-facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.bg-nego-wrap { display: flex; flex-direction: column; gap: 12px; }
.bg-nego-head { display: flex; justify-content: space-between; align-items: center; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 14px; }
.bg-nego-price { display: flex; flex-direction: column; gap: 2px; }
.bg-nego-price strong { font-size: 22px; color: var(--primary); font-variant-numeric: tabular-nums; }
.bg-nego-price small { color: var(--text-light); font-size: 11px; }
.bg-nego-signs { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.bg-sign-ok { color: #10b981; font-weight: 700; }
.bg-sign-pending { color: var(--text-light); }
.bg-nego-chat { max-height: 320px; min-height: 200px; overflow-y: auto; background: #fafbfc; border: 1px solid #eaecef; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.bg-nego-msg { padding: 8px 12px; border-radius: 12px; font-size: 13px; max-width: 80%; word-wrap: break-word; }
.bg-nego-msg-system { align-self: center; background: var(--gray-50); color: var(--text-light); font-style: italic; max-width: 100%; }
.bg-nego-msg-mine { align-self: flex-end; background: var(--primary); color: #fff; }
.bg-nego-msg-other { align-self: flex-start; background: #fff; border: 1px solid #eaecef; }
.bg-nego-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid #eaecef; }
.bg-nego-row { display: flex; gap: 8px; align-items: center; }
.bg-nego-row > .bg-input { flex: 1 1 auto; }
.bg-nego-row-label { font-size: 11px; color: var(--text-light); }
.bg-nego-row-ctrl { justify-content: flex-end; }

/* Bloc Image de marque (indicateurs élève) */
.bg-image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 8px; }
@media (max-width: 720px) { .bg-image-grid { grid-template-columns: 1fr; } }
.bg-image-card { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 12px 14px; }
.bg-image-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 13px; }
.bg-image-head i { margin-right: 6px; }
.bg-image-head strong { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--primary); }
.bg-image-bar { width: 100%; height: 8px; background: #f1f3f5; border-radius: 4px; overflow: hidden; }
.bg-image-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #10b981); transition: width 0.4s ease; }
.bg-image-hint { font-size: 11px; color: var(--text-light); margin-top: 8px; line-height: 1.4; }
.bg-image-prix .bg-image-head i { color: #f59e0b; }
.bg-image-qualite .bg-image-head i { color: #8b5cf6; }
.bg-image-notoriete .bg-image-head i { color: #3b82f6; }
.bg-image-climat .bg-image-head i { color: #10b981; }

/* Delta climat (↗ +n / ↘ −n) à côté du libellé */
.bg-image-delta { font-size: 11px; font-weight: 600; margin-left: 6px; padding: 2px 6px; border-radius: 4px; }
.bg-image-delta.pos { background: #d1fae5; color: #047857; }
.bg-image-delta.neg { background: #fee2e2; color: #b91c1c; }

/* Bouton "Pourquoi ?" pour ouvrir la modale d'explication climat */
.bg-image-why { margin-top: 8px; background: transparent; border: 1px solid #e2e8f0; color: var(--primary); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 600; transition: background 0.12s; }
.bg-image-why:hover { background: #eff6ff; border-color: var(--primary); }
.bg-image-clickable { position: relative; }

/* Rappel période trimestrielle au-dessus du bilan/CR */
.bg-trim-notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.bg-trim-notice i { color: #d97706; }

.bg-results-charts { margin-top: 16px; }
.bg-results-controls { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; }
.bg-results-controls label { font-size: 13px; color: var(--text-light); display: inline-flex; align-items: center; gap: 6px; }
.bg-results-controls .bg-input { min-width: 200px; }
.bg-chart-box { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 8px; }
.bg-chart-svg { width: 100%; height: auto; display: block; }
.bg-chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; padding: 0 4px; }
.bg-chart-legend-top { margin-top: 0; margin-bottom: 12px; }
.bg-chart-legend-bottom { margin-top: 0; }
.bg-chart-legend-item { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding: 4px 10px; background: #fff; border: 1px solid #eaecef; border-radius: 16px; }
.bg-chart-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.bg-chart-legend-box { margin-top: 14px; padding: 12px 14px; background: var(--gray-50); border: 1px solid #eaecef; border-radius: 8px; }
.bg-chart-legend-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); margin-bottom: 8px; }

/* Grille des 4 indicateurs financiers (CA · trésorerie · bénéfice · valeur d'action) */
.bg-results-charts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
@media (max-width: 720px) { .bg-results-charts-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .bg-results-charts-grid { grid-template-columns: 1fr; } }
.bg-chart-card { background: #fff; border: 1px solid #eaecef; border-radius: 8px; padding: 10px 12px 6px; }
.bg-chart-card-title { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text); }
.bg-chart-card .bg-chart-svg { margin-top: 0; }
.bg-chart-extra { margin-top: 18px; }
.bg-chart-extra > label { font-size: 13px; color: var(--text-light); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bg-chart-extra .bg-input { min-width: 200px; }
.bg-chart-card-wide { padding: 12px 14px; }

/* Alerte risque de faillite */
.bg-alerte-faillite { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; line-height: 1.5; }
.bg-alerte-faillite i { font-size: 22px; margin-top: 2px; flex-shrink: 0; }
.bg-alerte-faillite strong { font-size: 14px; }
.bg-alerte-faillite small { color: inherit; opacity: 0.85; }
.bg-alerte-serieuse { background: var(--warning-bg); color: #78350f; border: 1px solid #fcd34d; }
.bg-alerte-serieuse i { color: #d97706; }
.bg-alerte-critique { background: var(--error-bg); color: #7f1d1d; border: 1px solid #fca5a5; }
.bg-alerte-critique i { color: #dc2626; }
