/* =====================================================================
   Modernization layer on top of adminHMD's stock style.css.
   Loaded last so it wins on the properties it touches: typography,
   radius/shadow scale, and a handful of component refinements
   (nav active state, buttons, cards, alerts, progress). Everything else
   (layout, grid, sidebar mechanics, dark mode plumbing) stays exactly
   as adminHMD ships it.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --admin-radius-sm: 6px;
  --admin-radius: 8px;
  --admin-radius-lg: 12px;

  /* Flat surfaces: borders carry the structure, shadows stay discreet. */
  --admin-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --admin-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --admin-shadow-lg: 0 12px 28px -14px rgba(15, 23, 42, 0.22);

  /* Bootstrap's own blue (#0d6efd) still leaked into links, progress
     bars and utilities: route everything to the brand indigo. */
  --bs-primary: #4338ca;
  --bs-primary-rgb: 67, 56, 202;
  --bs-link-color: #4338ca;
  --bs-link-color-rgb: 67, 56, 202;
  --bs-link-hover-color: #3730a3;
  --bs-link-hover-color-rgb: 55, 48, 163;
  --bs-border-radius: 6px;

  --admin-primary: #4338ca;
  --admin-primary-dark: #3730a3;
  --admin-primary-soft: #eef0fd;

  --admin-good-soft: #e3f1e8;
  --admin-warm-soft: #faf0d7;
  --admin-tip: #1d7a8c;
  --admin-tip-soft: #dff1f3;

  /* -----------------------------------------------------------------
     Compatibility aliases for the course content's inline SVG diagrams
     (imported from the legacy site, hand-authored with these variable
     names). Keeping the names stable here means the diagrams never need
     to be re-generated when the shell's own palette changes.
     ------------------------------------------------------------------- */
  --paper: var(--admin-bg);
  --surface: var(--admin-surface);
  --ink: var(--admin-text);
  --ink-soft: var(--admin-muted);
  --ink-faint: var(--admin-muted);
  --line: var(--admin-border);
  --line-strong: var(--admin-border);
  --acc: var(--admin-primary);
  --acc-soft: var(--admin-primary-soft);
  --good: var(--admin-success);
  --good-soft: var(--admin-good-soft);
  --warm: var(--admin-warning);
  --warm-soft: var(--admin-warm-soft);
  --tip: var(--admin-tip);
  --tip-soft: var(--admin-tip-soft);
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
}

html[data-theme='dark'] {
  --admin-primary: #818cf8;
  --admin-primary-dark: #6366f1;
  --admin-primary-soft: rgba(129, 140, 248, 0.14);

  --admin-shadow-sm: none;
  --admin-shadow: none;
  --admin-shadow-lg: 0 12px 28px -14px rgba(0, 0, 0, 0.6);

  --bs-primary: #818cf8;
  --bs-primary-rgb: 129, 140, 248;
  --bs-link-color: #a5b4fc;
  --bs-link-color-rgb: 165, 180, 252;
  --bs-link-hover-color: #c7d2fe;
  --bs-link-hover-color-rgb: 199, 210, 254;

  --admin-good-soft: rgba(15, 118, 110, 0.18);
  --admin-warm-soft: rgba(217, 119, 6, 0.18);
  --admin-tip: #5fc2d3;
  --admin-tip-soft: rgba(95, 194, 211, 0.16);
}

/* ---------------------------------------------------------------------
   Global type scale — one notch smaller and denser across the whole
   platform. Shrinking the root size cascades through every rem-based
   size in both adminHMD's stylesheet and this file, rather than having
   to hunt down each one individually.
   ------------------------------------------------------------------- */
html {
  font-size: 93.75%; /* 16px -> 15px base */
}

body,
.btn,
.form-control,
.form-select {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6,
.page-heading h1,
.section-title,
.metric-value,
.brand-title,
.auth-brand strong {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Arial, sans-serif;
  letter-spacing: -0.01em;
}

/* Lets a flex child shrink below its content so .text-truncate works. */
.min-w-0 {
  min-width: 0;
}

/* Page titles (every screen uses <h1 class="h3">) and the big dashboard
   percentages were carrying Bootstrap's/adminHMD's default sizes, which
   read as oversized once everything else on the page is this compact. */
.page-heading h1 {
  font-size: 1.5rem;
}

.metric-value {
  font-size: 1.75rem;
}

/* ---------------------------------------------------------------------
   Cards, panels, metrics — small radius, 1px border, almost no shadow
   ------------------------------------------------------------------- */
.metric-card,
.panel,
.auth-card,
.modal-content {
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
}

.metric-card:hover,
.panel:hover {
  box-shadow: var(--admin-shadow);
}

.metric-card:hover {
  transform: none;
  border-color: var(--admin-primary);
}

.metric-icon,
.badge {
  border-radius: var(--admin-radius-sm);
}

.metric-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------------
   Locked metric card — a catalog formation the student isn't enrolled in
   ------------------------------------------------------------------- */
.metric-locked {
  --metric-color: var(--admin-muted);
  opacity: 0.72;
}

.metric-locked .metric-icon {
  background: var(--admin-surface-soft);
}

.metric-locked:hover {
  transform: none;
  box-shadow: var(--admin-shadow);
}

.badge.rounded-pill {
  border-radius: 999px !important;
}

/* ---------------------------------------------------------------------
   Buttons — solid colours, square-ish corners
   ------------------------------------------------------------------- */
.btn {
  border-radius: var(--admin-radius-sm);
  padding-inline: 1.1rem;
}

.btn {
  font-weight: 600;
}

.btn-sm {
  border-radius: var(--admin-radius-sm);
}

.btn-primary {
  --bs-btn-bg: var(--admin-primary);
  --bs-btn-border-color: var(--admin-primary);
  --bs-btn-hover-bg: var(--admin-primary-dark);
  --bs-btn-hover-border-color: var(--admin-primary-dark);
  --bs-btn-active-bg: var(--admin-primary-dark);
  --bs-btn-active-border-color: var(--admin-primary-dark);
  --bs-btn-disabled-bg: var(--admin-primary);
  --bs-btn-disabled-border-color: var(--admin-primary);
  background: var(--bs-btn-bg);
  border-color: var(--bs-btn-border-color);
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--bs-btn-hover-bg);
  border-color: var(--bs-btn-hover-border-color);
}

.btn-outline-primary {
  --bs-btn-color: var(--admin-primary);
  --bs-btn-border-color: var(--admin-primary);
  --bs-btn-hover-bg: var(--admin-primary);
  --bs-btn-hover-border-color: var(--admin-primary);
  --bs-btn-active-bg: var(--admin-primary-dark);
  --bs-btn-active-border-color: var(--admin-primary-dark);
}

html[data-theme='dark'] .btn-primary,
html[data-theme='dark'] .btn-outline-primary {
  --bs-btn-color: #0f172a;
  --bs-btn-hover-color: #0f172a;
  --bs-btn-active-color: #0f172a;
}

html[data-theme='dark'] .btn-outline-primary {
  --bs-btn-color: var(--admin-primary);
}

.progress {
  --bs-progress-bar-bg: var(--admin-primary);
}

/* Card titles: a plain glyph next to the text, no tinted square. */
.section-title i,
html[data-theme='dark'] .section-title i {
  width: auto;
  height: auto;
  background: none;
  color: var(--admin-muted);
  font-size: 1rem;
}

.section-title {
  font-weight: 700;
}

/* Bootstrap reads its own data-bs-theme, not our data-theme: without this
   the active breadcrumb stayed near-black on the dark background. */
.breadcrumb {
  --bs-breadcrumb-item-active-color: var(--admin-muted);
  --bs-breadcrumb-divider-color: var(--admin-muted);
}

/* Context line above a page title (e.g. "Espace formateur", "Quiz ·
   Chapitre II"): read like a breadcrumb, not a shouted label. */
.eyebrow {
  color: var(--admin-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* adminHMD's .btn is display:flex, so Bootstrap's .text-start (a
   text-align rule) has no effect on the flex child's own position —
   quiz answer buttons need the flex alignment set explicitly. */
.btn.text-start {
  justify-content: flex-start;
  text-align: left;
}

/* ---------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------- */
.form-control,
.form-select {
  border-radius: var(--admin-radius-sm);
  border-color: var(--admin-border);
  padding-block: 0.6rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 4px var(--admin-primary-soft);
}

.form-check-input:checked {
  background-color: var(--admin-primary);
  border-color: var(--admin-primary);
}

.form-check-input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 4px var(--admin-primary-soft);
}

/* ---------------------------------------------------------------------
   Sidebar — adapted from AdminKit's own sidebar component (adminkit-3.1.0)
   rather than adminHMD's. AdminKit's sidebar is a permanently-dark rail
   regardless of the app's light/dark toggle (same idea as before), with
   resting links dimmed to ~55% opacity by design and only the active
   item at full brightness — exactly the hierarchy the old adminHMD nav
   was missing. Its collapse toggle is also just a full show/hide, not a
   partial icon-only rail, which sidesteps the "every chapter row looks
   identical once the labels are gone" problem entirely. The active-state
   accent below is tied to this platform's own indigo brand color rather
   than AdminKit's default blue.
   ------------------------------------------------------------------- */
:root {
  --sidebar-bg: #1a2332;
  --sidebar-bg-end: #131b28;
  --sidebar-link-color: rgba(226, 232, 240, 0.55);
  --sidebar-link-hover-color: rgba(226, 232, 240, 0.9);
  --sidebar-link-active-color: #ffffff;
  --sidebar-accent: #818cf8;
  --sidebar-accent-strong: #a5b4fc;
  --sidebar-muted: rgba(226, 232, 240, 0.38);
  --sidebar-border: rgba(255, 255, 255, 0.08);
}

.admin-sidebar {
  background: var(--sidebar-bg);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.35rem 1.25rem 1.15rem;
  border-bottom: 1px solid var(--sidebar-border);
  color: #ffffff;
  text-decoration: none;
}

.sidebar-brand:hover,
.sidebar-brand:focus {
  color: #ffffff;
}

.sidebar-brand .brand-logo-chip {
  flex: 0 0 auto;
}

.sidebar-brand-copy {
  display: grid;
  min-width: 0;
}

.sidebar-brand-title {
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-brand-subtitle {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: block;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
  padding: 0.9rem 0.85rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding: 0.75rem 0.5rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sidebar-muted);
}

.sidebar-header::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: var(--sidebar-border);
}

.sidebar-item {
  min-width: 0;
  margin-bottom: 0.2rem;
}

.sidebar-link-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.6rem 0.65rem;
  border-radius: var(--admin-radius-sm);
  border-left: 3px solid transparent;
  color: var(--sidebar-link-color);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-link i {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 0.95rem;
  color: inherit;
  transition: color 0.16s ease;
}

.sidebar-link-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-link .badge {
  flex: 0 0 auto;
}

/* Learner's progress through the formation, above the chapter tree. */
.sidebar-progress {
  list-style: none;
  color: rgba(255, 255, 255, 0.78);
}

.sidebar-progress .progress {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-item.is-locked > .sidebar-link-row > .sidebar-link {
  opacity: 0.55;
}

.sidebar-link:hover,
.sidebar-link:focus {
  color: var(--sidebar-link-hover-color);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
  transform: translateX(2px);
}

.sidebar-link:focus-visible,
.sidebar-dropdown-toggle:focus-visible {
  outline: 2px solid var(--sidebar-accent);
  outline-offset: 1px;
}

.sidebar-item.active > .sidebar-link,
.sidebar-item.active > .sidebar-link-row > .sidebar-link {
  color: var(--sidebar-link-active-color);
  background: color-mix(in srgb, var(--sidebar-accent) 16%, transparent);
  border-left-color: var(--sidebar-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-item.active > .sidebar-link i,
.sidebar-item.active > .sidebar-link-row > .sidebar-link i {
  color: var(--sidebar-accent-strong);
}

/* A chapter you're currently browsing (but not standing exactly on its
   own root page — e.g. three levels deep in a subsection) previously
   looked identical to a chapter you've never opened: same dim resting
   color either way, no sense of "you are somewhere in here." Give it a
   lighter resting tone and a soft accent tick, one step below the full
   active treatment above. */
.sidebar-item.has-active-child > .sidebar-link-row > .sidebar-link {
  color: var(--sidebar-link-hover-color);
  border-left-color: color-mix(in srgb, var(--sidebar-accent) 35%, transparent);
}

.sidebar-item.has-active-child > .sidebar-link-row > .sidebar-link i {
  color: var(--sidebar-accent);
}

/* The chapter collapse-toggle chevron rotates to show open/closed state,
   and stays dim until hovered/focused so it doesn't compete with the
   read/unread icon right next to it. */
.sidebar-dropdown-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-inline-end: 0.15rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--sidebar-muted);
  transition: color 0.14s ease, background 0.14s ease;
}

.sidebar-dropdown-toggle:hover,
.sidebar-dropdown-toggle:focus {
  color: var(--sidebar-link-hover-color);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-dropdown-toggle i {
  display: inline-block;
  transition: transform 0.2s ease;
}

.sidebar-dropdown-toggle[aria-expanded='true'] i {
  transform: rotate(180deg);
}

.sidebar-dropdown {
  list-style: none;
  margin: 0.1rem 0 0.4rem;
  padding: 0 0 0 1.15rem;
  border-left: 1px solid var(--sidebar-border);
  margin-left: 0.85rem;
}

.sidebar-dropdown-sub {
  padding-left: 1.15rem;
  margin-left: 0.85rem;
}

.sidebar-dropdown .sidebar-link {
  font-size: 0.86rem;
  font-weight: 500;
  padding-block: 0.45rem;
}

/* A thin scrollbar matching the dark rail, instead of the browser's
   default light one, for the (common) case where the chapter tree is
   taller than the viewport. */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

/* No arrow buttons at either end of the rail. */
.sidebar-nav::-webkit-scrollbar-button {
  display: none;
}

/* Chrome ignores the ::-webkit-scrollbar rules above (and draws its native
   scrollbar, arrows included) as soon as scrollbar-width/scrollbar-color
   are set, so the standard properties are kept for the other engines. */
@supports not selector(::-webkit-scrollbar) {
  .sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  }
}

/* Sidebar user card */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--admin-radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  transition: border-color 0.16s ease;
}

.sidebar-user:hover {
  border-color: color-mix(in srgb, var(--sidebar-accent) 35%, transparent);
}

.sidebar-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--sidebar-accent);
  background: color-mix(in srgb, var(--sidebar-accent) 18%, transparent);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sidebar-accent) 12%, transparent);
}

.sidebar-user-copy {
  display: grid;
  min-width: 0;
}

.sidebar-user-copy strong {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy small {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

/* Collapse toggle: hides the whole sidebar rather than shrinking it to
   an icon-only rail. AdminKit does the same — a formation's chapter tree
   has nothing to show but identical read/unread dots once the labels
   are gone, so a partial "mini" state was never useful; full show/hide
   is simpler and behaves identically everywhere (dashboard or formation),
   with no special-casing needed. */
@media (min-width: 992px) {
  body.sidebar-mini .admin-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-mini .admin-main {
    margin-left: 0;
  }
}

/* ---------------------------------------------------------------------
   Alerts (pedagogical callouts) — softer fills, colored left rule
   ------------------------------------------------------------------- */
.alert {
  border: none;
  border-left: 4px solid currentColor;
  border-radius: var(--admin-radius-sm);
  box-shadow: var(--admin-shadow-sm);
}

/* ---------------------------------------------------------------------
   Progress bars — rounder, softer track
   ------------------------------------------------------------------- */
.progress {
  border-radius: 999px;
  background: var(--admin-surface-soft);
  overflow: hidden;
}

.progress-bar {
  border-radius: 999px;
}

/* ---------------------------------------------------------------------
   Top navbar — subtle glass effect when scrolled content sits behind it
   ------------------------------------------------------------------- */
/* clip plutôt que hidden : hidden fait de <body> un conteneur de défilement,
   ce qui neutralise tous les position: sticky (barre du haut, arborescence et
   barre d'enregistrement de l'éditeur de contenu). clip coupe pareil sans ça. */
html,
body {
  overflow-x: hidden;
}

@supports (overflow-x: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

.profile-name {
  display: inline-block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (min-width: 992px) {
  .profile-name {
    max-width: 180px;
  }
}

.admin-navbar.bg-white {
  background: rgba(255, 255, 255, 0.86) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html[data-theme='dark'] .admin-navbar.bg-white {
  background: rgba(31, 41, 55, 0.86) !important;
}

/* ---------------------------------------------------------------------
   Auth pages
   ------------------------------------------------------------------- */
/* Split screen: the form on a plain surface, a solid brand panel beside it
   (from 992px). No floating card, no gradient backdrop. */
.auth-split {
  display: grid;
  min-height: 100vh;
  background: var(--admin-surface);
}

.auth-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.25rem clamp(1.25rem, 5vw, 3.5rem);
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-topbar .brand-logo-chip {
  box-shadow: none;
  padding-inline: 0;
}

html[data-theme='dark'] .auth-topbar .brand-logo-chip {
  padding-inline: 0.6rem;
}

.auth-topbar .theme-toggle {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}

.auth-form-area {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding-block: 2.5rem;
}

.auth-form-area h1 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800 !important;
  letter-spacing: -0.02em;
}

.auth-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.auth-legal a {
  color: var(--admin-muted);
  text-decoration: underline;
}

.auth-aside {
  display: none;
}

@media (min-width: 992px) {
  .auth-split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  }

  .auth-aside {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: clamp(2.5rem, 5vw, 4rem) clamp(2rem, 4vw, 3.5rem) 0;
    background: #1e1b4b;
    color: #ffffff;
  }
}

.auth-aside-title {
  max-width: 26rem;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1.75rem;
}

.auth-aside-list {
  list-style: none;
  max-width: 26rem;
  margin: 0;
  padding: 0;
}

.auth-aside-list li {
  padding: 0.85rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.82);
}

.auth-aside-list li:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

/* Real screenshot of the learner dashboard, cut by the bottom edge. */
.auth-aside-phone {
  align-self: center;
  width: min(260px, 60%);
  margin-top: 2.5rem;
  margin-bottom: -18%;
  border: 6px solid #0f0d2e;
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  overflow: hidden;
  background: #0f0d2e;
}

.auth-aside-phone img {
  display: block;
  width: 100%;
  height: auto;
}

/* Error pages: same plain surface, message aligned left. */
.error-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.25rem clamp(1.25rem, 5vw, 3.5rem);
  background: var(--admin-surface);
}

.error-body {
  width: 100%;
  max-width: 640px;
  margin: auto;
  padding-block: 3rem;
}

.error-body .error-status {
  color: var(--admin-primary);
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.error-body h1 {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.error-body p {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--admin-muted);
  max-width: 34rem;
  margin-bottom: 2rem;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.auth-brand .brand-icon {
  background: var(--admin-primary);
}

/* adminHMD's .error-code was sized for a literal "404"/"403" number;
   we use it for a single icon glyph, which doesn't need to be this huge. */
.error-code {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
}

/* ---------------------------------------------------------------------
   Brand logo — a white-background artwork, so it always sits on its own
   light chip regardless of the surrounding surface (dark sidebar, dark
   mode auth card, etc).
   ------------------------------------------------------------------- */
.brand-logo-chip {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--admin-radius-sm);
  padding: 0.3rem 0.6rem;
  box-shadow: var(--admin-shadow-sm);
  flex: 0 0 auto;
}

.brand-logo-chip img {
  display: block;
  height: 28px;
  width: auto;
}


/* ---------------------------------------------------------------------
   Marketing homepage
   ------------------------------------------------------------------- */
.marketing-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--admin-border);
}

html[data-theme='dark'] .marketing-nav {
  background: rgba(15, 23, 42, 0.86);
}

.marketing-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marketing-nav .auth-brand {
  margin-bottom: 0;
}

.marketing-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) 1.5rem 2rem;
  text-align: center;
}

.hero-shot-dark {
  display: none !important;
}

html[data-theme='dark'] .hero-shot-dark {
  display: block !important;
}

html[data-theme='dark'] .hero-shot-light {
  display: none !important;
}

.marketing-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  color: var(--admin-text);
}

.marketing-lead {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--admin-muted);
}

.marketing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.marketing-section-heading {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 2.25rem;
}

.feature-card {
  height: 100%;
  padding: 1.75rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.feature-card:hover {
  box-shadow: var(--admin-shadow-lg);
  transform: translateY(-3px);
}

.feature-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  border-radius: var(--admin-radius-sm);
  background: var(--admin-primary-soft);
  color: var(--admin-primary-dark);
  margin-bottom: 1rem;
}

/* ---------------------------------------------------------------------
   Homepage (marketing/home.blade.php) — flat, editorial layout: solid
   colours, no gradients, left-aligned headings, full-width tinted bands.
   ------------------------------------------------------------------- */
.home-body {
  --home-ink: #16142b;
  --home-bg: #ffffff;
  --home-band: #f3f1fb;
  --home-teach: #1e1b4b;
  --home-line: #e4e2ef;
  background: var(--home-bg);
  color: var(--home-ink);
}

html[data-theme='dark'] .home-body {
  --home-ink: #e5edf7;
  --home-bg: #0f172a;
  --home-band: #16203a;
  --home-teach: #1c1a45;
  --home-line: #2f3b52;
}

.home-container {
  max-width: 1160px;
  margin: 0 auto;
  padding-inline: 1.5rem;
}

.home-h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
}

.home-muted {
  color: var(--admin-muted);
}

.home-link {
  color: var(--admin-primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.home-link:hover {
  color: var(--admin-primary-dark);
}

.home-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border: 2px solid transparent;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.home-btn-lg {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
}

.home-btn-primary {
  background: var(--admin-primary);
  color: #ffffff;
}

.home-btn-primary:hover {
  background: var(--admin-primary-dark);
  color: #ffffff;
}

html[data-theme='dark'] .home-btn-primary,
html[data-theme='dark'] .home-btn-primary:hover {
  color: #0f172a;
}

.home-btn-ghost {
  color: var(--admin-primary);
  border-color: var(--admin-primary);
}

.home-btn-ghost:hover {
  background: var(--admin-primary-soft);
  color: var(--admin-primary);
}

.home-btn-light {
  background: #ffffff;
  color: var(--home-teach);
}

.home-btn-light:hover {
  background: #e9e7fb;
  color: var(--home-teach);
}

.home-btn-outline-light {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
}

.home-btn-outline-light:hover {
  color: #ffffff;
  border-color: #ffffff;
}

/* Navigation */
.home-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--home-bg);
  border-bottom: 1px solid var(--home-line);
}

.home-nav-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 72px;
}

.home-nav-brand .brand-logo-chip {
  box-shadow: none;
  padding-inline: 0;
}

html[data-theme='dark'] .home-nav-brand .brand-logo-chip {
  padding-inline: 0.6rem;
}

.home-nav-links {
  display: none;
  gap: 1.75rem;
}

.home-nav-links a {
  color: var(--home-ink);
  font-weight: 600;
  font-size: 0.95rem;
}

.home-nav-links a:hover {
  color: var(--admin-primary);
}

.home-body [id] {
  scroll-margin-top: 88px;
}

.home-nav-actions .theme-toggle {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}

.home-nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

@media (min-width: 992px) {
  .home-nav-links {
    display: flex;
  }
}

/* Hero */
.home-hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem);
}

.home-hero-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

.home-hero-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 1.25rem;
  color: var(--home-ink);
}

.home-hero-lead {
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--admin-muted);
  max-width: 34rem;
  margin-bottom: 2rem;
}

.home-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
}

.home-hero-note {
  margin: 1.75rem 0 0;
  font-size: 0.9rem;
  color: var(--admin-muted);
}

/* Screenshots posées sur un aplat de couleur, décalé comme un papier. */
.home-hero-visual {
  position: relative;
  padding: 0 10% 2rem 0;
}

.home-hero-visual::before {
  content: "";
  position: absolute;
  inset: 12% 4% 0 8%;
  background: var(--home-band);
  border-radius: 8px;
}

.home-hero-screen,
.home-hero-phone {
  position: relative;
  overflow: hidden;
  background: var(--home-bg);
  border: 1px solid var(--home-line);
}

.home-hero-screen {
  border-radius: 8px;
  box-shadow: 0 20px 40px -24px rgba(22, 20, 43, 0.35);
}

.home-hero-phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26%;
  border: 5px solid var(--home-ink);
  border-radius: 18px;
}

.home-hero-screen img,
.home-hero-phone img {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 992px) {
  .home-hero-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  }
}

/* Sections */
.home-section {
  padding: clamp(3rem, 7vw, 4.5rem) 0;
}

.home-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.75rem;
}

.home-section-head .home-h2 {
  margin-bottom: 0;
}

.home-split {
  display: grid;
  gap: 2rem 4rem;
}

@media (min-width: 992px) {
  .home-split {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }
}

/* Course cards: a coloured cover per formation, text underneath. */
.home-course-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.home-course {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--home-line);
  border-radius: 8px;
  background: var(--home-bg);
  color: var(--home-ink);
  transition: border-color 0.15s ease;
}

a.home-course:hover {
  color: var(--home-ink);
  border-color: var(--admin-primary);
}

a.home-course:hover .home-course-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-course-cover {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  aspect-ratio: 16 / 8;
  padding: 1rem 1.25rem;
  background: var(--course-color);
  color: rgba(255, 255, 255, 0.92);
  font-size: 3rem;
  line-height: 1;
}

.home-course-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 1.1rem 1.25rem 1.25rem;
}

.home-course-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--admin-muted);
  margin-bottom: 0.4rem;
}

.home-course-title {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.home-course-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--admin-muted);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.home-course-price {
  font-weight: 800;
}

.home-course-title a {
  color: inherit;
}

.home-course-title a:hover,
.home-course-title a:focus-visible {
  color: var(--admin-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home-course:has(.home-course-cover:hover) {
  border-color: var(--admin-primary);
}

.home-course-cta {
  color: var(--admin-primary);
  font-weight: 700;
  font-size: 0.92rem;
}

/* Catalogue: full descriptions, price + action on the same line. */
.home-course-text-full {
  display: block;
  -webkit-line-clamp: unset;
}

.home-course-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--home-line);
}

.home-course-cover {
  position: relative;
}

.home-course-badge {
  position: absolute;
  top: 0.9rem;
  left: 1rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: #ffffff;
  color: #16142b;
  font-size: 0.75rem;
  font-weight: 800;
}

.home-course:target {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-soft);
}

.home-prose {
  max-width: 760px;
  line-height: 1.7;
}

.home-prose h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 2.25rem 0 0.6rem;
}

.home-prose h2:first-child {
  margin-top: 0;
}

.home-prose a {
  color: var(--admin-primary);
  text-decoration: underline;
}

/* Formation cover with an image (components/formation-cover): the logo or
   illustration centred on a light tint of the formation colour. It stays
   light in dark mode too, like a printed cover, so dark artwork remains
   readable. */
.formation-cover.has-image {
  position: relative;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--course-color) 12%, #ffffff);
}

/* Absolutely placed so the image never changes the cover's own height:
   every card keeps the same proportions whatever the artwork's size. */
.formation-cover-image {
  position: absolute;
  inset: 12% 8%;
  width: 84%;
  height: 76%;
  object-fit: contain;
}

/* A status badge sits in the top-left corner: keep the artwork below it. */
.formation-cover.has-image:has(.home-course-badge, .dash-course-status) .formation-cover-image {
  top: 32%;
  bottom: 8%;
  height: 60%;
}

.dash-course.is-locked .formation-cover.has-image {
  background: color-mix(in srgb, var(--course-color) 6%, #f1f5f9);
}

.dash-course.is-locked .formation-cover-image {
  filter: grayscale(0.7);
  opacity: 0.6;
}

/* Public page of one formation (marketing/formation.blade.php). */
.course-hero {
  background: var(--home-band);
  padding: clamp(2rem, 5vw, 3.5rem) 0;
}

.course-hero-grid {
  display: grid;
  gap: 2rem 3rem;
  align-items: start;
}

@media (min-width: 992px) {
  .course-hero-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
}

.course-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--admin-muted);
}

.course-breadcrumb a {
  color: var(--admin-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.course-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

/* A dot on every item (not a separator between them): stays tidy when
   the list wraps on a phone. */
.course-facts li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--admin-primary);
  vertical-align: middle;
}

.course-offer {
  overflow: hidden;
  border: 1px solid var(--home-line);
  border-radius: 8px;
  background: var(--home-bg);
}

.course-offer-cover {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  aspect-ratio: 16 / 7;
  padding: 1rem 1.25rem;
  background: var(--course-color);
  color: rgba(255, 255, 255, 0.92);
  font-size: 3rem;
  line-height: 1;
}

.course-offer-body {
  padding: 1.25rem;
}

.course-offer-price {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.course-offer-note {
  margin: 0.9rem 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--admin-muted);
}

.course-highlights {
  display: grid;
  gap: 0.9rem 2.5rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

@media (min-width: 768px) {
  .course-highlights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.course-highlights li {
  display: flex;
  gap: 0.75rem;
  line-height: 1.55;
}

.course-highlights i {
  color: var(--admin-primary);
  font-size: 1.2rem;
  line-height: 1.3;
}

.course-plan details,
.course-plan-end {
  border-top: 1px solid var(--home-line);
  padding: 1rem 0;
}

.course-plan-end {
  border-bottom: 1px solid var(--home-line);
}

.course-plan summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
}

.course-plan summary::-webkit-details-marker {
  display: none;
}

.course-plan summary::after {
  content: "\F282";
  font-family: "bootstrap-icons";
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--admin-primary);
  transition: transform 0.15s ease;
}

.course-plan details[open] summary::after {
  transform: rotate(180deg);
}

.course-plan-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--admin-primary);
}

.course-plan-title {
  display: block;
  font-weight: 700;
  font-size: 1.02rem;
}

.course-plan details ul,
.course-plan details p {
  margin: 0.75rem 0 0;
  color: var(--admin-muted);
  line-height: 1.6;
}

.course-teachers {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 992px) {
  .course-teachers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.course-teacher {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.course-teacher-name {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

/* Teacher photo (public page and profile preview). */
.teacher-photo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--admin-primary-soft);
  color: var(--admin-primary);
  font-weight: 800;
}

.teacher-photo-lg {
  width: 72px;
  height: 72px;
  font-size: 1.6rem;
}

.teacher-photo-xl {
  width: 96px;
  height: 96px;
  font-size: 2rem;
}

/* Page header for secondary public pages (catalogue, conditions). */
.home-page-head {
  background: var(--home-band);
  padding: clamp(2.5rem, 6vw, 3.75rem) 0;
}

.home-page-title {
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
  color: var(--home-ink);
}

.home-page-lead {
  max-width: 40rem;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--admin-muted);
}

.home-nav-links a[aria-current="page"] {
  color: var(--admin-primary);
  text-decoration: underline;
  text-underline-offset: 8px;
  text-decoration-thickness: 2px;
}

/* Tinted band: how it works */
.home-band {
  background: var(--home-band);
  padding: clamp(3rem, 7vw, 4.5rem) 0;
}

.home-steps {
  list-style: none;
  counter-reset: home-step;
  margin: 0;
  padding: 0;
}

.home-steps li {
  counter-increment: home-step;
  position: relative;
  padding: 1.25rem 0 1.25rem 3rem;
  border-top: 1px solid var(--home-line);
}

.home-steps li:last-child {
  border-bottom: 1px solid var(--home-line);
}

.home-steps li::before {
  content: counter(home-step);
  position: absolute;
  left: 0;
  top: 1.2rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--admin-primary);
}

.home-steps h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.home-steps p {
  margin: 0;
  color: var(--admin-muted);
  line-height: 1.6;
}

/* FAQ: plain list separated by rules. */
.home-faq details {
  border-top: 1px solid var(--home-line);
  padding: 1.1rem 0;
}

.home-faq details:last-child {
  border-bottom: 1px solid var(--home-line);
}

.home-faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
  font-size: 1.02rem;
}

.home-faq summary::-webkit-details-marker {
  display: none;
}

.home-faq summary::after {
  content: "\F282";
  font-family: "bootstrap-icons";
  color: var(--admin-primary);
  transition: transform 0.15s ease;
}

.home-faq details[open] summary::after {
  transform: rotate(180deg);
}

.home-faq details p {
  margin: 0.75rem 0 0;
  color: var(--admin-muted);
  line-height: 1.65;
}

/* Teacher band */
.home-teach {
  background: var(--home-teach);
  color: #ffffff;
  padding: clamp(3rem, 7vw, 4.5rem) 0;
}

.home-teach .home-h2 {
  color: #ffffff;
}

.home-teach p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.65;
}

.home-teach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.home-teach-list {
  list-style: none;
  margin: 0;
  padding: 0;
  align-self: center;
}

.home-teach-list li {
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
}

.home-teach-list li:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.home-teach-list strong {
  color: #ffffff;
}

.home-body .site-footer {
  border-top: 0;
  background: var(--home-bg);
}

/* ---------------------------------------------------------------------
   Site footer
   ------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--admin-border);
  background: var(--admin-surface);
  padding: 3rem 1.5rem 0;
}

.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.site-footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding-bottom: 2.5rem;
}

.site-footer-brand {
  flex: 1.6 1 260px;
}

.site-footer-col {
  flex: 1 1 140px;
}

@media (max-width: 767.98px) {
  .site-footer-grid {
    flex-direction: column;
    gap: 1.75rem;
  }

  /* En colonne, flex-basis devient une hauteur : 260px de vide sous le logo. */
  .site-footer-brand,
  .site-footer-col {
    flex: 0 0 auto;
  }
}

.site-footer-brand p {
  color: var(--admin-muted);
  font-size: 0.92rem;
  margin-top: 1rem;
  max-width: 320px;
}

.site-footer-heading {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
  margin-bottom: 0.9rem;
}

.site-footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.site-footer-links a {
  color: var(--admin-text);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-footer-links a:hover {
  color: var(--admin-primary);
}

.site-footer-bottom {
  border-top: 1px solid var(--admin-border);
  padding: 1.1rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--admin-muted);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------
   Table polish
   ------------------------------------------------------------------- */
.table > :not(caption) > * > * {
  padding-block: 0.85rem;
}

.table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
  border-bottom-width: 1px;
}

/* Dark mode tables: Bootstrap reads its own data-bs-theme, not our
   data-theme, so its light table header (.table-light, used by the tables
   inside course content) and its text/border colours stayed light-mode
   — a white header band on a dark page. */
html[data-theme='dark'] .table {
  --bs-table-color: var(--admin-text);
  --bs-table-border-color: var(--admin-border);
  --bs-border-color: var(--admin-border);
  --bs-table-striped-color: var(--admin-text);
  --bs-table-hover-color: var(--admin-text);
}

html[data-theme='dark'] .table-light,
html[data-theme='dark'] .table > thead.table-light > tr > th {
  --bs-table-bg: var(--admin-surface-soft);
  --bs-table-color: var(--admin-text);
  --bs-table-border-color: var(--admin-border);
  background-color: var(--admin-surface-soft);
  color: var(--admin-text);
}

html[data-theme='dark'] .table-bordered > :not(caption) > * > * {
  border-color: var(--admin-border);
}

/* Light mode: a soft brand tint rather than Bootstrap's grey for headers
   of tables inside course content. */
.content .table-light {
  --bs-table-bg: color-mix(in srgb, var(--admin-primary) 6%, var(--admin-surface));
}

/* ---------------------------------------------------------------------
   Reading content — the course text itself (resources/views/livewire/
   reader/chapter-page.blade.php's .content wrapper) previously carried
   no typography of its own: bare Bootstrap reboot line-height (1.5) at
   full panel width, roughly 130 characters per line at this viewport.
   A taller line-height plus a comfortable measure on flowing text (not
   on images/tables/diagrams, which keep the panel's full width) brings
   it in line with the polish the rest of the shell already has.
   ------------------------------------------------------------------- */
.content {
  line-height: 1.7;
}

.content p,
.content ul,
.content ol {
  max-width: 46rem;
}

.content p {
  margin-bottom: 1.15rem;
}

.content ul,
.content ol {
  margin-bottom: 1.15rem;
}

.content li + li {
  margin-top: 0.35rem;
}

/* Course text a notch larger than the app chrome: it is what learners
   read for an hour at a time. */
.content {
  font-size: 1.0625rem;
}

.reader-title {
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-bottom: 1.5rem;
}

/* Pedagogical callouts inside a chapter: one quiet shape for every kind,
   told apart by a thin coloured rule and the label colour only, text in
   the normal reading colour (Bootstrap's alerts tinted the whole text). */
.content .alert {
  --callout: var(--admin-muted);
  color: var(--admin-text);
  background: color-mix(in srgb, var(--callout) 6%, var(--admin-surface));
  border: 1px solid color-mix(in srgb, var(--callout) 22%, var(--admin-border));
  border-left: 3px solid var(--callout);
  border-radius: var(--admin-radius-sm);
  box-shadow: none;
  padding: 1rem 1.25rem;
  margin-block: 1.5rem !important;
}

.content .alert > .fw-bold:first-child {
  color: var(--callout);
  font-size: 0.95rem;
  margin-bottom: 0.6rem !important;
}

.content .alert > :last-child,
.content .alert p:last-child,
.content .alert ul:last-child,
.content .alert ol:last-child {
  margin-bottom: 0;
}

.content .alert-primary { --callout: #4338ca; }
.content .alert-info { --callout: #1d7a8c; }
.content .alert-secondary { --callout: #b45309; }
.content .alert-danger { --callout: #b42318; }
.content .alert-warning { --callout: #a16207; }
.content .alert-success { --callout: #15803d; }
.content .alert-light,
.content .alert-dark { --callout: #475569; }

html[data-theme='dark'] .content .alert-primary { --callout: #a5b4fc; }
html[data-theme='dark'] .content .alert-info { --callout: #5fc2d3; }
html[data-theme='dark'] .content .alert-secondary { --callout: #fbbf24; }
html[data-theme='dark'] .content .alert-danger { --callout: #fca5a5; }
html[data-theme='dark'] .content .alert-warning { --callout: #facc15; }
html[data-theme='dark'] .content .alert-success { --callout: #4ade80; }
html[data-theme='dark'] .content .alert-light,
html[data-theme='dark'] .content .alert-dark { --callout: #94a3b8; }

/* The "label" content block (a short sub-heading within a page, e.g.
   "Ce que vous allez apprendre") — was mb-1 in the markup, essentially
   sitting flush against the paragraph before it. */
.content .fw-semibold.text-muted.small {
  display: block;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

/* Rich text editor (admin content editor's paragraph/label/list-item
   fields) — a contenteditable div styled like a .form-control, with a
   CSS-only placeholder since contenteditable has no native one. */
.rich-text-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.375rem;
}

.rich-text-link-prompt {
  max-width: 320px;
  margin-bottom: 0.375rem;
}

.rich-text-editable {
  overflow-y: auto;
}

.rich-text-editable:empty::before {
  content: attr(data-placeholder);
  color: var(--bs-secondary-color);
}

[x-cloak] {
  display: none !important;
}

/* Floating "chat bubble" assistant, embedded once in layouts.admin-shell
   for every learner-facing formation page. Fixed above the viewport's
   content so it survives scrolling; the panel opens upward from the
   button since the button sits at the bottom of the screen. */
.assistant-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1045;
}

/* A labelled pill rather than a round robot bubble: says what it does. */
.assistant-widget-fab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--admin-primary);
  border-radius: 999px;
  background: var(--admin-surface);
  color: var(--admin-primary);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.35);
}

.assistant-widget-fab:hover,
.assistant-widget-fab[aria-expanded="true"] {
  background: var(--admin-primary);
  color: #ffffff;
}

html[data-theme='dark'] .assistant-widget-fab:hover,
html[data-theme='dark'] .assistant-widget-fab[aria-expanded="true"] {
  color: #0f172a;
}

.assistant-widget-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(360px, calc(100vw - 2.5rem));
  max-height: min(520px, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  background: var(--admin-surface);
  box-shadow: 0 16px 40px -16px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.assistant-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text);
  font-weight: 700;
}

html[data-theme='dark'] .assistant-widget-header .btn-close {
  filter: invert(1) grayscale(1) brightness(2);
}

.assistant-widget-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75rem 0.9rem;
}

.assistant-widget-form {
  padding: 0.65rem 0.9rem;
  border-top: 1px solid var(--admin-border);
}

.assistant-widget-form textarea {
  resize: none;
}

/*
 * Fil de discussion façon messagerie : la question de l'apprenant à
 * droite, la réponse de l'assistant à gauche, chacune avec son propre
 * avatar — utilisé à la fois par la page Assistant IA pleine page et par
 * le widget flottant (voir chat-thread--compact pour la variante plus
 * dense du widget).
 */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 0.55rem;
  max-width: 82%;
}

.chat-message--user {
  flex-direction: row-reverse;
  align-self: flex-end;
  margin-left: auto;
}

.chat-message--ai {
  align-self: flex-start;
  margin-right: auto;
}

.chat-avatar {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.chat-avatar--user {
  background: var(--admin-primary);
}

.chat-avatar--ai {
  background: var(--admin-primary-dark);
  font-size: 1rem;
}

.chat-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 1.1rem;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
}

.chat-message--user .chat-bubble {
  background: var(--admin-primary);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}

.chat-message--ai .chat-bubble {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  border-bottom-left-radius: 0.3rem;
}

.chat-message--error .chat-bubble {
  background: rgba(220, 38, 38, 0.1);
  border-color: #dc2626;
  color: var(--admin-danger, #dc2626);
}

/* Page Assistant IA du formateur : un échange (question + réponse) par
   bloc, séparé du suivant, avec sa date et son bouton de suppression. */
.assistant-exchange {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.assistant-exchange + .assistant-exchange {
  padding-top: 1rem;
  border-top: 1px solid var(--admin-border);
}

.assistant-exchange-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--admin-muted);
}

/* Variante compacte pour le widget flottant : avatars et bulles plus petits. */
.chat-thread--compact {
  gap: 0.65rem;
}

.chat-thread--compact .chat-message {
  max-width: 88%;
  gap: 0.4rem;
}

.chat-thread--compact .chat-avatar {
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.7rem;
}

.chat-thread--compact .chat-avatar--ai {
  font-size: 0.8rem;
}

/* Assistant answers rendered from Markdown (AssistantQuestion::answerHtml). */
.chat-bubble--rich > :last-child {
  margin-bottom: 0;
}

.chat-bubble--rich p,
.chat-bubble--rich ul,
.chat-bubble--rich ol {
  margin-bottom: 0.6rem;
}

.chat-bubble--rich ul,
.chat-bubble--rich ol {
  padding-left: 1.2rem;
}

.chat-bubble--rich li > p {
  margin-bottom: 0.2rem;
}

.chat-bubble--rich li + li {
  margin-top: 0.15rem;
}

.chat-bubble--rich code {
  font-size: 0.85em;
  color: inherit;
  background: var(--admin-surface-soft);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
}

.chat-thread--compact .chat-bubble {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

@media (max-width: 575.98px) {
  .chat-message {
    max-width: 92%;
  }
}

/* Learner dashboard: one tile per formation, same coloured cover as the
   public catalogue, a real progress bar in the formation's colour. */
.dash-course-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 1.25rem;
}

.dash-course {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

.dash-course-cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  aspect-ratio: 16 / 7;
  padding: 0.75rem 1rem;
  background: var(--course-color);
  color: rgba(255, 255, 255, 0.92);
}

.dash-course-cover .formation-cover-icon {
  font-size: 2.4rem;
  line-height: 1;
}

@media (max-width: 575.98px) {
  .dash-course-cover {
    aspect-ratio: 16 / 5;
  }

  .dash-course-cover .formation-cover-icon {
    font-size: 1.9rem;
  }
}

.dash-course-status {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.75rem;
  font-weight: 700;
}

.dash-course.is-done .dash-course-status {
  color: #15803d;
}

.dash-course.is-suspended .dash-course-status {
  color: #b42318;
}

/* Not enrolled: the colour stays recognisable but steps back. */
.dash-course.is-locked .dash-course-cover {
  background: color-mix(in srgb, var(--course-color) 45%, var(--admin-surface-soft));
}

.dash-course-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 0.9rem 1rem 1rem;
}

.dash-course-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
}

.dash-course-title a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--admin-border);
  text-underline-offset: 3px;
}

.dash-course-title a:hover {
  color: var(--admin-primary);
  text-decoration-color: currentColor;
}

.dash-course-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--admin-surface-soft);
  box-shadow: inset 0 0 0 1px var(--admin-border);
  overflow: hidden;
}

.dash-course-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--course-color);
}

html[data-theme='dark'] .dash-course-progress span {
  background: color-mix(in srgb, var(--course-color) 70%, #ffffff);
}

.dash-course-meta {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.dash-course-foot {
  margin-top: auto;
  padding-top: 0.9rem;
}

/* AI quiz generation (admin/formation-quiz-questions): proposals to review. */
.quiz-generator {
  background: color-mix(in srgb, var(--admin-primary) 4%, var(--admin-surface));
}

.quiz-proposals {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 1200px) {
  .quiz-proposals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.quiz-proposal {
  padding: 0.9rem 1rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

.quiz-proposal.is-skipped {
  opacity: 0.55;
}

/* Reader: previous/next page buttons. Page titles can be long, so each
   button shows a small "Précédent"/"Suivant" label and a one-line,
   truncated title, and the two share the row instead of overflowing it. */
.reader-pager {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.reader-pager-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  max-width: calc(50% - 0.375rem);
  min-width: 0;
  overflow: hidden;
}

.reader-pager-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.reader-pager-copy small {
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.8;
}

.reader-pager-copy span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-pager-link.text-end .reader-pager-copy {
  align-items: flex-end;
}

.reader-pager-link.text-start .reader-pager-copy {
  align-items: flex-start;
}

/* On phones the profile button shrinks to a 40px square (adminhmd/style.css),
   which leaves no room for the dropdown caret: it spilled past the right
   edge of the screen. The avatar alone is clear enough there. */
@media (max-width: 767.98px) {
  .profile-button.dropdown-toggle::after {
    display: none;
  }
}

/* Search in the top bar stays available on phones: the field shrinks to the
   space left by the buttons, and its results open full width under the bar
   instead of inside that narrow field. */
.topbar-search {
  min-width: 0;
}

.topbar-search .dropdown-item {
  white-space: normal;
}

@media (max-width: 767.98px) {
  .topbar-search .search-input {
    min-height: 38px;
  }

  /* Bootstrap's .navbar is position: relative, so the menu anchors to the bar. */
  .topbar-search .dropdown {
    position: static;
  }

  .topbar-search .dropdown-menu {
    top: 100%;
    left: 0.75rem;
    right: 0.75rem;
    width: auto !important;
  }
}

/* Below 992px the sidebar opens as an overlay (z-index 1040); the assistant
   (1045) would otherwise sit on top of the chapter list it covers. */
@media (max-width: 991.98px) {
  body.sidebar-open .assistant-widget {
    display: none;
  }
}

/* The notification menu is 340px wide and aligned on the bell, which on a
   phone pushes it past the left edge. There it spans the width under the bar
   instead (Popper is off via data-bs-display="static"). */
@media (max-width: 767.98px) {
  .notification-dropdown {
    position: static;
  }

  .notification-dropdown .dropdown-menu {
    top: 100%;
    left: 0.75rem;
    right: 0.75rem;
    width: auto !important;
  }
}

/* Barre de navigation du bas pour les apprenants, sur téléphone seulement
   (partials.mobile-bottom-nav). Elle reste sous le menu latéral ouvert
   (z-index 1040) et le contenu de la page garde une marge pour ne pas
   finir caché derrière elle. */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 767.98px) {
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--admin-surface);
    border-top: 1px solid var(--admin-border);
    box-shadow: 0 -6px 18px -12px rgba(15, 23, 42, 0.35);
  }

  .mobile-bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 56px;
    padding: 0.35rem 0.25rem;
    border: 0;
    background: none;
    color: var(--admin-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
  }

  .mobile-bottom-nav-link .bi {
    font-size: 1.3rem;
    line-height: 1;
  }

  .mobile-bottom-nav-link.active,
  .mobile-bottom-nav-link:hover {
    color: var(--admin-primary);
  }

  .mobile-bottom-nav-link:focus-visible {
    outline: 2px solid var(--admin-primary);
    outline-offset: -4px;
  }

  .mobile-bottom-nav-icon {
    position: relative;
    display: inline-flex;
  }

  .mobile-bottom-nav-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.75rem;
    min-width: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--bs-danger);
    color: #ffffff;
    font-size: 0.65rem;
    line-height: 1.15rem;
    text-align: center;
  }

  body:has(.mobile-bottom-nav) .admin-footer {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }

  body:has(.mobile-bottom-nav) .assistant-widget {
    bottom: calc(56px + 1rem + env(safe-area-inset-bottom));
  }

  body.sidebar-open .mobile-bottom-nav {
    display: none;
  }
}

/* Répartition des notes d'un devoir (Admin\AssignmentSubmissions) : un
   histogramme d'une seule série, dans la couleur principale. Barres fines,
   coins arrondis en haut, posées sur une ligne de base discrète ; l'effectif
   est écrit au-dessus de chaque barre, la tranche en dessous. */
.grade-histogram-plot {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  height: 140px;
  border-bottom: 1px solid var(--admin-border);
}

.grade-histogram-col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
  cursor: default;
}

.grade-histogram-bar {
  display: block;
  width: min(48px, 70%);
  min-height: 0;
  border-radius: 4px 4px 0 0;
  background: var(--admin-primary);
}

.grade-histogram-col:hover .grade-histogram-bar {
  background: var(--admin-primary-dark);
}

.grade-histogram-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 0.15rem;
}

.grade-histogram-range {
  position: absolute;
  top: 100%;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--admin-muted);
  white-space: nowrap;
}

.grade-histogram {
  padding-bottom: 1.25rem;
}

/* Aperçu d'un rendu PDF ou image au-dessus du formulaire de note
   (Admin\AssignmentSubmissions), pour corriger sans télécharger. */
.submission-preview-frame {
  display: block;
  width: 100%;
  height: min(75vh, 900px);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-surface);
}

.submission-preview-image {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 auto;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
}

/* =====================================================================
   Modernisation du 27/10/2026 — résumé du tableau de bord, carte
   « Reprendre », onglets, champs de fichiers, tableaux sur téléphone.
   Uniquement des jetons du thème (--admin-*) : le mode sombre suit.
   ===================================================================== */

/* Bandeau « En résumé » sous le bonjour de l'apprenant. */
.dash-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.summary-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  background: var(--admin-surface);
  color: var(--admin-text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

a.summary-chip:hover {
  border-color: var(--admin-primary);
  color: var(--admin-text);
  transform: translateY(-1px);
}

.summary-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}

.summary-label {
  display: block;
  font-size: 0.8rem;
  color: var(--admin-muted);
}

.summary-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--admin-primary-soft);
  color: var(--admin-primary);
  font-size: 1.15rem;
}

.summary-icon.is-warm {
  background: var(--admin-warm-soft);
  color: var(--admin-warning);
}

.summary-icon.is-good {
  background: var(--admin-good-soft);
  color: var(--admin-success);
}

/* Anneau de progression : la part remplie suit --value (0 à 100). */
.summary-ring {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--admin-surface) 72%, transparent 73%),
    conic-gradient(var(--admin-primary) calc(var(--value) * 1%), var(--admin-primary-soft) 0);
}

@media (max-width: 991.98px) {
  .dash-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Carte « Reprendre » : l'icône dans la couleur de la formation, l'action bien visible. */
.resume-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.resume-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--admin-radius-lg);
  background: var(--course-color, var(--admin-primary));
  color: #ffffff;
  font-size: 1.5rem;
}

.resume-body {
  flex: 1 1 auto;
  min-width: 0;
}

.resume-title {
  margin-bottom: 0.15rem;
  font-weight: 700;
}

.resume-hint {
  display: -webkit-box;
  margin-bottom: 0.5rem;
  overflow: hidden;
  font-size: 0.875rem;
  color: var(--admin-muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.resume-cta {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .resume-card {
    flex-wrap: wrap;
  }

  .resume-body {
    flex-basis: calc(100% - 4.25rem);
  }

  .resume-cta {
    width: 100%;
  }
}

/* Onglets (filtres des rendus…) : la couleur de la plateforme, pas le bleu de Bootstrap. */
.nav-pills .nav-link {
  border-radius: 999px;
  color: var(--admin-muted);
}

.nav-pills .nav-link:hover {
  color: var(--admin-text);
  background: var(--admin-primary-soft);
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background: var(--admin-primary);
  color: #ffffff;
}

html[data-theme='dark'] .nav-pills .nav-link.active {
  color: #0f172a;
}

.nav-pills .nav-link .badge {
  margin-left: 0.25rem;
  border-radius: 999px;
}

/* Champ de fichiers : une vraie zone de dépôt plutôt que le champ brut du navigateur. */
input[type='file'].form-control {
  padding: 0.85rem;
  border-style: dashed;
  border-width: 2px;
  background: var(--admin-bg);
  cursor: pointer;
}

input[type='file'].form-control:hover {
  border-color: var(--admin-primary);
}

input[type='file'].form-control::file-selector-button {
  margin: -0.35rem 0.85rem -0.35rem -0.35rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: var(--admin-radius);
  background: var(--admin-primary);
  color: #ffffff;
  font-weight: 600;
}

html[data-theme='dark'] input[type='file'].form-control::file-selector-button {
  color: #0f172a;
}

/* Tuiles de chiffres (carnet de notes, statistiques d'un devoir). */
.stat-tile {
  height: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  background: var(--admin-surface);
}

.stat-tile-label {
  margin-bottom: 0.15rem;
  font-size: 0.78rem;
  color: var(--admin-muted);
}

.stat-tile-value {
  margin-bottom: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-tile-value small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--admin-muted);
}

.stat-tile-note {
  margin-bottom: 0;
  font-size: 0.75rem;
  color: var(--admin-muted);
}

@media (max-width: 575.98px) {
  .stat-tile {
    padding: 0.6rem 0.7rem;
  }

  .stat-tile-value {
    font-size: 1.1rem;
  }

  .stat-tile-note {
    display: none;
  }
}

/* Choix de réponse des quiz (partials.quiz-choice) : une pastille pour la
   lettre, une icône pour l'état — la couleur n'est jamais seule. */
.quiz-choice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--admin-radius-lg);
  font-weight: 500;
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.quiz-choice.btn-outline-secondary:not(.disabled) {
  border-color: var(--admin-border);
  color: var(--admin-text);
  background: var(--admin-surface);
}

.quiz-choice.btn-outline-secondary:not(.disabled):hover,
.quiz-choice.btn-outline-secondary:not(.disabled):focus-visible {
  border-color: var(--admin-primary);
  background: var(--admin-primary-soft);
  color: var(--admin-text);
  transform: translateX(2px);
}

/* Un choix corrigé est désactivé (plus cliquable) mais doit rester lisible :
   Bootstrap rendrait la bonne et la mauvaise réponse semi-transparentes. */
.quiz-choice:disabled:not(.disabled) {
  opacity: 1;
}

.quiz-choice.disabled {
  opacity: 0.55;
}

.quiz-letter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
}

.quiz-choice-text {
  flex: 1 1 auto;
}

.quiz-mark {
  flex: 0 0 auto;
  font-size: 1.15rem;
}

/* Surlignages et notes d'un apprenant dans un chapitre (public/js/page-notes.js). */
/* Sans marge intérieure : un passage qui traverse du gras est découpé en
   plusieurs <mark>, qui doivent se toucher. */
mark.note-highlight {
  padding: 0;
  border-radius: 2px;
  background: rgba(250, 204, 21, 0.45);
  color: inherit;
  cursor: pointer;
}

html[data-theme='dark'] mark.note-highlight {
  background: rgba(250, 204, 21, 0.3);
}

.note-toolbar {
  position: fixed;
  z-index: 1050;
  padding: 0.35rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-lg);
}

.note-toolbar-form {
  width: min(320px, calc(100vw - 2rem));
}

.page-note {
  padding: 0.6rem 0;
  border-top: 1px solid var(--admin-border);
}

.page-note:first-of-type {
  border-top: 0;
}

.page-note-quote {
  padding-left: 0.6rem;
  border-left: 3px solid rgba(250, 204, 21, 0.8);
  font-style: italic;
  color: var(--admin-muted);
}

.page-note-missing {
  display: none;
  color: var(--admin-warning);
}

.page-note[data-missing] .page-note-missing {
  display: block;
}

.page-note[data-missing] .page-note-quote {
  border-left-color: var(--admin-border);
}

/* Saisie du code de connexion à 6 chiffres (pages.auth.two-factor-challenge). */
.two-factor-code {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.35em;
}

/* Badges de l'apprenant (Dashboard\StudentBadges). Un badge à gagner reste
   lisible (titre et condition), seulement plus discret, avec un cadenas. */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  background: var(--admin-surface);
  text-align: center;
}

.badge-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 0.25rem;
  border-radius: 50%;
  background: var(--admin-warm-soft);
  color: var(--admin-warning);
  font-size: 1.5rem;
}

.badge-card.is-locked .badge-medal {
  background: var(--admin-bg);
  color: var(--admin-muted);
}

.badge-card.is-locked .badge-title {
  color: var(--admin-muted);
}

.badge-title {
  font-weight: 700;
}

.badge-description,
.badge-status {
  font-size: 0.8rem;
  color: var(--admin-muted);
}

/* Carte mémoire du glossaire (Glossary\Flashcards). */
.flashcard {
  max-width: 640px;
  margin-right: auto;
  margin-left: auto;
  padding: 2.5rem 1.5rem;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-lg);
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow-lg);
  text-align: center;
}

.flashcard.is-revealed {
  border-color: var(--admin-primary);
}

.flashcard-term {
  margin-bottom: 0.75rem;
  font-size: 1.6rem;
  font-weight: 800;
}

.flashcard-definition {
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

/* Discussion par chapitre */
.discussion-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--admin-border);
    border-radius: var(--admin-radius-lg);
    background: var(--admin-surface);
    color: var(--admin-text);
    text-decoration: none;
}

.discussion-link:hover {
    border-color: var(--admin-primary);
    color: var(--admin-text);
}

.discussion-link > .bi {
    color: var(--admin-primary);
    font-size: 1.25rem;
}

.discussion-replies {
    margin-top: 0.75rem;
    margin-left: 0.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--admin-primary-soft);
    display: grid;
    gap: 0.75rem;
}

.discussion-post.is-hidden {
    opacity: 0.75;
}

.discussion-hidden-body {
    text-decoration: line-through;
}

/* Rapport mensuel : des colonnes de chiffres étroites et alignées. */
.report-table th,
.report-table td {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.report-table thead th {
    font-size: 0.78rem;
    white-space: normal;
    min-width: 6.5rem;
}

.report-table tfoot th,
.report-table tfoot td {
    border-top: 2px solid var(--admin-border);
}

/* Profil : carte d'en-tête (photo, rôle, chiffres clés) puis onglets. */
.profile-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-lg);
    background: linear-gradient(135deg, var(--admin-primary-soft), var(--admin-surface) 60%);
}

.profile-hero-photo {
    position: relative;
    flex: 0 0 auto;
}

.profile-hero-photo-edit {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--admin-surface);
    background: var(--admin-primary);
    color: #fff;
    cursor: pointer;
}

.profile-hero-photo-edit:focus-within {
    outline: 2px solid var(--admin-primary);
    outline-offset: 2px;
}

.profile-hero-copy {
    flex: 1 1 260px;
    min-width: 0;
}

.profile-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
}

.profile-hero-stats > div {
    min-width: 7.5rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-lg);
    background: var(--admin-surface);
}

.profile-hero-stats dt {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--admin-muted);
}

.profile-hero-stats dd {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--admin-text);
}

.profile-tabs {
    gap: 0.25rem;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.profile-tabs .nav-link {
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .profile-hero-stats > div {
        flex: 1 1 40%;
    }
}

.user-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    line-height: 1;
}

/* La photo couvre l'initiale ; si elle ne se charge pas, onerror la retire. */
.user-avatar > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.discussion-avatar {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}

/* Santé de la plateforme : un résumé coloré, puis un voyant par contrôle (icône + texte, jamais la couleur seule). */
.health-summary {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--admin-radius-lg);
    border: 1px solid var(--admin-border);
    background: var(--admin-surface);
}

.health-summary > .bi {
    font-size: 1.6rem;
}

.health-summary-ok { background: var(--admin-good-soft); }
.health-summary-ok > .bi { color: var(--admin-success); }
.health-summary-warning { background: var(--admin-warm-soft); }
.health-summary-warning > .bi { color: var(--admin-warning); }
.health-summary-danger { background: color-mix(in srgb, #dc3545 14%, var(--admin-surface)); }
.health-summary-danger > .bi { color: #dc3545; }

.health-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.health-status {
    flex: 0 0 auto;
    font-size: 1.1rem;
    line-height: 1.4;
}

.health-status.is-ok { color: var(--admin-success); }
.health-status.is-warning { color: var(--admin-warning); }
.health-status.is-danger { color: #dc3545; }

.min-w-0 {
    min-width: 0;
    flex: 1 1 auto;
}

/* Fréquentation : histogramme fin, une seule série (pas de légende), infobulle au survol ou au focus. */
.traffic-chart {
    display: flex;
    gap: 0.5rem;
    height: 180px;
}

.traffic-chart-scale {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 1.3rem;
    font-size: 0.72rem;
    color: var(--admin-muted);
    text-align: right;
    min-width: 1.5rem;
}

.traffic-chart-bars {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-bottom: 1px solid var(--admin-border);
    padding-bottom: 1.3rem;
    position: relative;
    min-width: 0;
}

.traffic-bar {
    position: relative;
    flex: 1 1 0;
    display: flex;
    align-items: flex-end;
    min-width: 0;
    outline: none;
}

.traffic-bar-fill {
    width: 100%;
    max-width: 28px;
    margin: 0 auto;
    border-radius: 4px 4px 0 0;
    background: var(--admin-primary);
}

.traffic-bar:hover .traffic-bar-fill,
.traffic-bar:focus-visible .traffic-bar-fill {
    filter: brightness(1.15);
}

.traffic-bar-label {
    position: absolute;
    left: 50%;
    bottom: -1.3rem;
    transform: translateX(-50%);
    font-size: 0.68rem;
    color: var(--admin-muted);
    white-space: nowrap;
}

.traffic-bar:hover::after,
.traffic-bar:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% - 1rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    background: var(--admin-text);
    color: var(--admin-surface);
    font-size: 0.72rem;
    white-space: nowrap;
    pointer-events: none;
}

.traffic-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
    font-size: 0.875rem;
}

.traffic-row-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--admin-primary-soft);
    overflow: hidden;
}

.traffic-row-bar > span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--admin-primary);
}

/* Droits d'un formateur dans une formation (Admin\FormationTeachers). */
.permission-chip {
    padding: 0.2rem 0.6rem 0.2rem 1.9rem;
    border: 1px solid var(--admin-border);
    border-radius: 999px;
    background: var(--admin-surface);
}

/* E-mails modifiables : la liste des variables et l'aperçu réel de l'e-mail. */
.email-variables {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.email-variables > div {
    display: flex;
    gap: 0.5rem;
}

.email-variables dt {
    flex: 0 0 6.5rem;
    font-weight: 500;
}

.email-variables dd {
    margin: 0;
    color: var(--admin-muted);
}

.email-preview {
    width: 100%;
    height: 560px;
    border: 1px solid var(--admin-border);
    border-radius: var(--admin-radius-lg);
    background: #fff;
}

/* Banque de questions par chapitre (Admin\FormationQuizQuestions). */
.quiz-pool-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.5fr) auto minmax(7rem, auto);
    align-items: center;
    gap: 0.75rem;
}

.quiz-pool-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--admin-primary-soft);
    overflow: hidden;
}

.quiz-pool-bar > span {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--admin-warning);
}

.quiz-pool-bar > span.is-full {
    background: var(--admin-success);
}

@media (max-width: 575.98px) {
    .quiz-pool-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .quiz-pool-bar {
        grid-column: 1 / -1;
        order: 3;
    }
}

/* Commentaires enregistrés proposés sous un critère de la grille. */
.snippet-chip {
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-font-size: 0.75rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Objectif de la semaine : un rond par jour, coché les jours d'étude. */
.weekly-goal-days {
    display: flex;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.weekly-goal-days > li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--admin-border);
    color: var(--admin-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.weekly-goal-days > li.is-active {
    border-color: var(--admin-success);
    background: var(--admin-success);
    color: #fff;
}

.weekly-goal-days > li.is-today:not(.is-active) {
    border: 2px solid var(--admin-primary);
    color: var(--admin-text);
}

.weekly-goal-days > li.is-future {
    border-style: dashed;
}

/* Lecture hors connexion (public/js/offline-reading.js). */
.offline-banner {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 1060;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: var(--admin-warning);
    color: #1f2024;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}

/* Au-dessus de la barre de navigation du bas, sur téléphone. */
@media (max-width: 991.98px) {
    .offline-banner {
        bottom: 5.25rem;
        border-radius: 12px;
    }
}

html.is-offline .offline-banner {
    display: block;
}

.offline-toggle-meta {
    color: rgba(255, 255, 255, 0.65);
}

.offline-toggle-meta .btn-link {
    color: rgba(255, 255, 255, 0.85);
    font-size: inherit;
}

.offline-spin {
    display: inline-block;
    animation: offline-spin 1s linear infinite;
}

@keyframes offline-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .offline-spin { animation: none; }
}

/* Score d'un quiz, affiché tout seul après la dernière réponse. */
.quiz-result-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
    animation: quiz-result-fade 0.2s ease-out;
}

.quiz-result {
    position: relative;
    width: 100%;
    max-width: 26rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 2rem 1.5rem 1.25rem;
    border-radius: var(--admin-radius-lg);
    background: var(--admin-surface);
    color: var(--admin-text);
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    animation: quiz-result-pop 0.25s ease-out;
    outline: none;
}

.quiz-result-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
}

.quiz-result-ring {
    --ring-color: var(--admin-warning);
    width: 7.5rem;
    height: 7.5rem;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--ring-color) calc(var(--value) * 1%), var(--admin-primary-soft) 0);
}

.is-passed .quiz-result-ring {
    --ring-color: var(--admin-success);
}

.quiz-result-ring > span {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-surface);
    font-size: 1.9rem;
    font-weight: 800;
}

.quiz-result-ring small {
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 0.1rem;
}

.quiz-result-confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.quiz-result-confetti > span {
    position: absolute;
    top: -12px;
    left: var(--x);
    width: 8px;
    height: 12px;
    border-radius: 2px;
    background: var(--c);
    animation: quiz-confetti 1.6s ease-in var(--d) both;
}

@keyframes quiz-result-fade { from { opacity: 0; } }
@keyframes quiz-result-pop { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes quiz-confetti { to { transform: translateY(420px) rotate(540deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .quiz-result-backdrop, .quiz-result { animation: none; }
    .quiz-result-confetti { display: none; }
}

/* -----------------------------------------------------------------
   Exercices Python (partials/python-exercise, public/js/python-exercise.js)
   ------------------------------------------------------------------- */
.python-exercise-code {
  font-size: 0.9rem;
  line-height: 1.5;
  tab-size: 4;
  white-space: pre;
  overflow-x: auto;
  background: var(--admin-bg);
  color: var(--admin-text);
}

.python-exercise-output {
  background: #0f172a;
  color: #e5edf7;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
  overflow: auto;
}
