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

:root {
  --maths-ink: #0f172a;
  --maths-muted: #64748b;
  --maths-bg: #f6f8fb;
  --maths-card: #ffffff;
  --maths-primary: #174ea6;
  --maths-primary-dark: #0b2f6b;
  --maths-accent: #00a884;
  --maths-warning: #f59e0b;
  --maths-border: rgba(15, 23, 42, 0.09);
}

/* PWA : état réseau, installation et copies pédagogiques anonymisées. */
.pwa-connectivity-status {
  position: fixed;
  z-index: 1080;
  right: 1rem;
  bottom: 1rem;
  max-width: min(34rem, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  border: 1px solid #f1c56f;
  border-radius: 0.9rem;
  background: #fff7df;
  color: #744500;
  box-shadow: 0 12px 32px rgba(15, 38, 72, 0.18);
  font-weight: 700;
}

.pwa-install-button {
  position: fixed;
  z-index: 1070;
  right: 1rem;
  bottom: 1rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 999px;
  background: #0b4faa;
  color: #fff;
  box-shadow: 0 10px 26px rgba(11, 79, 170, 0.28);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.pwa-connectivity-status:not([hidden]) + .pwa-install-button {
  bottom: 5.25rem;
}

.pwa-offline-document {
  min-height: 100vh;
  margin: 0;
  background: #f5f8fc;
  color: #10233f;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.pwa-offline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0.8rem clamp(1rem, 4vw, 3rem);
  background: #0b4faa;
  color: #fff;
}

.pwa-offline-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 900;
}

.pwa-offline-brand > span:first-child {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.65rem;
  background: #fff;
  color: #0b4faa;
  font-size: 1.5rem;
}

.pwa-offline-badge {
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.pwa-offline-main {
  width: min(74rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) 0;
}

.pwa-offline-message {
  padding: clamp(1.4rem, 4vw, 3rem);
  border: 1px solid #d5e0ef;
  border-radius: 1.35rem;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 38, 72, 0.08);
}

.pwa-offline-message h1 {
  margin: 0.25rem 0 1rem;
  color: #0b326b;
}

.pwa-offline-chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.pwa-offline-chapter-list a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid #d8e3f1;
  border-radius: 0.9rem;
  background: #f8fbff;
  color: #123c76;
  text-decoration: none;
  font-weight: 800;
}

.pwa-offline-chapter-list small {
  color: #60728a;
  font-weight: 700;
}

.pwa-offline-breadcrumb {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  color: #60728a;
}

.pwa-offline-chapter {
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid #d5e0ef;
  border-radius: 1.35rem;
  background: #fff;
}

@media (max-width: 600px) {
  .pwa-offline-badge {
    display: none;
  }

  .pwa-connectivity-status,
  .pwa-install-button {
    right: 0.75rem;
    bottom: 0.75rem;
  }
}

html, body {
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--maths-bg);
  color: var(--maths-ink);
}

.premium-nav {
  background: linear-gradient(90deg, var(--maths-primary-dark), var(--maths-primary));
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  min-height: var(--app-navbar-height);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: #fff;
  color: var(--maths-primary);
  font-weight: 900;
}

.search-input {
  min-width: 260px;
  border-radius: 999px;
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 104px 24px 32px;
  padding-top: calc(var(--app-navbar-height) + 2.5rem);
  min-height: 100vh;
}

.app-shell-full-width {
  display: block;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;

  /* Ne pas utiliser padding: ... ici */
  padding-right: 2rem;
  padding-bottom: 3rem;
  padding-left: 2rem;
}

.app-shell-full-width .chapter-panel {
  width: 100%;
  max-width: none;
}

@media (max-width: 991.98px) {
  :root {
    --app-navbar-height: 74px;
  }

  .app-shell {
    padding-top: calc(var(--app-navbar-height) + 1.5rem);
  }

  .app-shell-full-width {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

.chapter-sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
  height: calc(100vh - 110px);
  overflow: auto;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--maths-border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 44px rgba(15,23,42,0.08);
}

.sidebar-title {
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--maths-primary-dark);
}

.sidebar-part {
  margin: 18px 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--maths-muted);
}

.sidebar-link, .search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--maths-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.sidebar-link:hover, .search-result:hover {
  background: rgba(23, 78, 166, 0.08);
  color: var(--maths-primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(23,78,166,0.13), rgba(0,168,132,0.10));
  color: var(--maths-primary-dark);
}

.sidebar-link[aria-current="page"] {
  background: linear-gradient(135deg, rgba(23,78,166,0.13), rgba(0,168,132,0.10));
  color: var(--maths-primary-dark);
}

.chapter-panel {
  min-width: 0;
}

.home-hero, .content-card, .chapter-article {
  background: var(--maths-card);
  border: 1px solid var(--maths-border);
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(15,23,42,0.08);
}

.home-hero {
  padding: 44px;
  margin-bottom: 24px;
  background:
    radial-gradient(circle at top right, rgba(0,168,132,0.16), transparent 28%),
    linear-gradient(135deg, #ffffff, #f8fbff);
}

.home-hero h1 {
  font-weight: 850;
  letter-spacing: -0.04em;
  max-width: 850px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--maths-accent);
}

#chapter-panel,
.main-content,
.app-main {
  min-width: 0;
  overflow-x: hidden;
}

/* ================================
   Grille éditoriale des chapitres
   ================================ */

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.chapter-card {
  display: flex;
  flex-direction: column;
  min-height: 245px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(23, 78, 166, 0.12);
  background:
    radial-gradient(circle at top right, rgba(23, 78, 166, 0.08), transparent 34%),
    #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.055);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.chapter-card:hover {
  transform: translateY(-3px);
  border-color: rgba(23, 78, 166, 0.22);
  box-shadow: 0 20px 46px rgba(15, 23, 42, 0.10);
}

.chapter-card-planned {
  background:
    radial-gradient(circle at top right, rgba(100, 116, 139, 0.08), transparent 34%),
    #f8fafc;
}

.chapter-card-header {
  padding: 18px 18px 10px;
}

.chapter-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.chapter-card-part {
  color: var(--maths-primary);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chapter-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chapter-card-title {
  margin: 0;
  color: var(--maths-ink);
  font-size: 1.05rem;
  line-height: 1.24;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.chapter-card-content {
  flex: 1 1 auto;
  padding: 0 18px 16px;
}

.chapter-card-summary {
  margin: 0;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.58;
  font-weight: 650;
}

.chapter-card-footer {
  padding: 16px 18px 18px;
  margin-top: auto;
}

.chapter-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--maths-primary-dark);
  font-size: 0.86rem;
  font-weight: 850;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.chapter-card-action:hover {
  background: var(--maths-primary);
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

.chapter-card-action-disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: default;
}

.chapter-card-action-disabled:hover {
  background: #f1f5f9;
  color: #94a3b8;
  transform: none;
}

.chapter-card-arrow {
  font-weight: 950;
}

/* Très grands écrans : maximum 4 colonnes */
@media (min-width: 1400px) {
  .chapter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Desktop standard : 3 colonnes, plus éditorial */
@media (max-width: 1399px) {
  .chapter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tablette paysage / petit laptop : 2 colonnes */
@media (max-width: 1050px) {
  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile : 1 colonne */
@media (max-width: 640px) {
  .chapter-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .chapter-card {
    min-height: 210px;
  }
}

/* ========================================== */

.chapter-card-action-disabled .chapter-card-arrow {
  background: #f1f5f9;
  color: #94a3b8;
}

.chapter-card-body {
  flex: 1 1 auto;
  padding-top: 18px;
}

.sidebar-link-disabled {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  color: #94a3b8;
  font-weight: 750;
  line-height: 1.35;
  cursor: not-allowed;
}

.sidebar-link-disabled:hover {
  background: transparent;
  color: #94a3b8;
}

.sidebar-link-disabled small {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #64748b;
  white-space: nowrap;
}

.chapter-article {
  max-width: 980px;
  margin: 0 auto;
  padding: 44px;
}

.chapter-header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--maths-border);
  margin-bottom: 28px;
}

.chapter-header h1, .content-card h1 {
  font-weight: 850;
  letter-spacing: -0.035em;
}

.chapter-article h2 {
  margin-top: 34px;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--maths-primary-dark);
}

.chapter-article h3 {
  margin-top: 26px;
  font-size: 1.12rem;
  font-weight: 800;
}

.chapter-article p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: #1f2937;
}

.math-display {
  overflow-x: auto;
  padding: 14px 16px;
  margin: 18px 0;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--maths-border);
}

.math-card {
  margin: 22px 0;
  padding: 0;
  border-radius: 20px;
  border: 1px solid var(--maths-border);
  overflow: hidden;
  background: #fff;
}

.math-card-title {
  padding: 12px 16px;
  font-weight: 850;
  color: #fff;
  background: var(--maths-primary);
}

.math-card-body {
  padding: 18px;
}

.math-card-intuition .math-card-title { background: #00a884; }
.math-card-definition .math-card-title { background: #174ea6; }
.math-card-methode .math-card-title { background: #6d28d9; }
.math-card-attention .math-card-title,
.math-card-piege .math-card-title { background: #d97706; }
.math-card-exercice .math-card-title { background: #be123c; }
.math-card-corrige .math-card-title { background: #0f766e; }
.math-card-universite .math-card-title { background: #334155; }

.list-item {
  display: flex;
  gap: 10px;
  margin: 8px 0;
  line-height: 1.65;
}

.list-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--maths-accent);
  margin-top: 10px;
}

.content-card {
  padding: 36px;
}

.kpi-card {
  border: 1px solid var(--maths-border);
  border-radius: 20px;
  padding: 22px;
  background: linear-gradient(135deg, #fff, #f8fafc);
}

.kpi-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--maths-primary);
}

.kpi-label {
  color: var(--maths-muted);
  font-weight: 700;
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 92px 14px 24px;
  }

  .chapter-sidebar {
    position: relative;
    top: 0;
    height: auto;
    max-height: 360px;
  }

  .chapter-article, .home-hero, .content-card {
    padding: 24px;
    border-radius: 22px;
  }

  .search-input {
    min-width: 180px;
  }
}

.exercise-card {
  margin: 28px 0;
  border: 1px solid rgba(23, 78, 166, 0.16);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.exercise-card[id] {
  scroll-margin-top: calc(var(--app-navbar-height, 82px) + 7rem);
}

.exercise-anchor-highlight {
  animation: exercise-anchor-highlight 2.2s ease;
}

@keyframes exercise-anchor-highlight {
  0% {
    outline: 0 solid rgba(13, 110, 253, 0);
  }

  30% {
    outline: 7px solid rgba(13, 110, 253, 0.2);
  }

  100% {
    outline: 0 solid rgba(13, 110, 253, 0);
  }
}

.exercise-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 14px;
  background: linear-gradient(135deg, rgba(23, 78, 166, 0.08), rgba(0, 168, 132, 0.08));
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.exercise-eyebrow {
  color: var(--maths-primary);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.exercise-title {
  margin: 4px 0 0;
  color: var(--maths-ink);
  font-size: 1.15rem;
  line-height: 1.2;
  font-weight: 850;
}

.exercise-badges {
  flex-shrink: 0;
}

.exercise-difficulty {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--maths-primary-dark);
  border: 1px solid rgba(23, 78, 166, 0.12);
  font-size: 0.74rem;
  font-weight: 850;
}

.exercise-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px 0;
}

.exercise-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 750;
}

.exercise-statement {
  padding: 18px 22px 4px;
}

.exercise-actions {
  padding: 14px 22px 22px;
}

.exercise-solution-slot {
  padding: 0 22px 22px;
}

.exercise-solution {
  margin-top: 8px;
  border: 1px solid rgba(0, 168, 132, 0.20);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #f0fdfa);
  overflow: hidden;
}

.exercise-solution-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(0, 168, 132, 0.16);
}

.exercise-solution-title {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 850;
  color: var(--maths-ink);
}

.exercise-solution-body {
  padding: 16px 18px 18px;
}

.exercise-solution-body p:last-child,
.exercise-statement p:last-child {
  margin-bottom: 0;
}

.quiz-card {
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid rgba(109, 40, 217, 0.18);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(76, 29, 149, 0.08);
}

.quiz-card[id] {
  scroll-margin-top: calc(var(--app-navbar-height, 82px) + 7rem);
}

.quiz-card-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(109, 40, 217, 0.12);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 38%),
    linear-gradient(135deg, rgba(109, 40, 217, 0.10), rgba(37, 99, 235, 0.07));
}

.quiz-eyebrow {
  color: #6d28d9;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.quiz-title {
  margin: 5px 0 0;
  color: var(--maths-ink);
  font-size: 1.18rem;
  font-weight: 900;
}

.quiz-question {
  padding: 20px 22px 4px;
}

.quiz-question p:last-child,
.quiz-explanation p:last-child {
  margin-bottom: 0;
}

.quiz-form {
  padding: 8px 22px 22px;
}

.quiz-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-instruction {
  width: 100%;
  margin-bottom: 12px;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 800;
}

.quiz-choices {
  display: grid;
  gap: 10px;
}

.quiz-choice {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid #dbe3ee;
  border-radius: 16px;
  background: #f8fafc;
  color: var(--maths-ink);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.quiz-choice:hover {
  border-color: rgba(109, 40, 217, 0.38);
  background: #f5f3ff;
  transform: translateY(-1px);
}

.quiz-choice:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 3px;
}

.quiz-choice input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: #6d28d9;
}

.quiz-choice-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 0.75rem;
  font-weight: 950;
}

.quiz-choice-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.quiz-choice-correct {
  border-color: rgba(5, 150, 105, 0.5);
  background: #ecfdf5;
}

.quiz-choice-correct .quiz-choice-marker {
  background: #059669;
  color: #ffffff;
}

.quiz-choice-incorrect {
  border-color: rgba(220, 38, 38, 0.46);
  background: #fef2f2;
}

.quiz-choice-incorrect .quiz-choice-marker {
  background: #dc2626;
  color: #ffffff;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.quiz-actions .btn {
  border-radius: 999px;
}

.quiz-feedback {
  min-height: 1.5rem;
  margin: 14px 0 0;
  color: #475569;
  font-weight: 850;
}

.quiz-form-correct .quiz-feedback {
  color: #047857;
}

.quiz-form-incorrect .quiz-feedback {
  color: #b91c1c;
}

.quiz-persistence-status {
  min-height: 1.25rem;
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.quiz-persistence-status[hidden] {
  display: none;
}

.quiz-explanation {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(109, 40, 217, 0.18);
  border-radius: 17px;
  background: #faf5ff;
}

.quiz-explanation[hidden] {
  display: none;
}

.quiz-explanation h4 {
  margin: 0 0 8px;
  color: #5b21b6;
  font-size: 0.95rem;
  font-weight: 900;
}

.quiz-authoring-error code {
  color: inherit;
}

body.visual-comfort-mode .quiz-card {
  border-color: rgba(167, 139, 250, 0.28);
  background: #0f172a;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.30);
}

body.visual-comfort-mode .quiz-card-header {
  border-color: rgba(167, 139, 250, 0.22);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.10), transparent 38%),
    linear-gradient(135deg, rgba(109, 40, 217, 0.23), rgba(15, 23, 42, 0.90));
}

body.visual-comfort-mode .quiz-eyebrow,
body.visual-comfort-mode .quiz-explanation h4 {
  color: #c4b5fd;
}

body.visual-comfort-mode .quiz-title,
body.visual-comfort-mode .quiz-choice {
  color: #f8fafc;
}

body.visual-comfort-mode .quiz-instruction,
body.visual-comfort-mode .quiz-feedback,
body.visual-comfort-mode .quiz-persistence-status {
  color: #cbd5e1;
}

body.visual-comfort-mode .quiz-choice {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(30, 41, 59, 0.82);
}

body.visual-comfort-mode .quiz-choice:hover {
  border-color: rgba(196, 181, 253, 0.55);
  background: rgba(76, 29, 149, 0.32);
}

body.visual-comfort-mode .quiz-choice-correct {
  border-color: rgba(52, 211, 153, 0.58);
  background: rgba(6, 78, 59, 0.46);
}

body.visual-comfort-mode .quiz-choice-incorrect {
  border-color: rgba(248, 113, 113, 0.58);
  background: rgba(127, 29, 29, 0.42);
}

body.visual-comfort-mode .quiz-explanation {
  border-color: rgba(167, 139, 250, 0.28);
  background: rgba(76, 29, 149, 0.26);
}

@media (max-width: 560px) {
  .quiz-card-header,
  .quiz-question,
  .quiz-form {
    padding-right: 16px;
    padding-left: 16px;
  }

  .quiz-choice {
    padding: 12px;
  }

  .quiz-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quiz-actions .btn {
    width: 100%;
  }
}

.exercise-bank-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1.7fr) minmax(190px, 1fr) minmax(140px, 0.7fr) minmax(160px, 0.8fr) 150px;
  gap: 14px;
  align-items: end;
  margin: 26px 0 14px;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
}

.exercise-filter-main,
.exercise-filter,
.exercise-filter-reset {
  min-width: 0;
}

.exercise-bank-status {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 18px;
  color: #64748b;
  font-weight: 800;
  font-size: 0.88rem;
}

.exercise-bank-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.exercise-bank-item {
  margin: 0;
}

.exercise-bank-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.exercise-statement-compact {
  max-height: 320px;
  overflow: auto;
}

.exercise-bank-empty {
  padding: 34px;
  border-radius: 20px;
  border: 1px dashed rgba(148, 163, 184, 0.8);
  background: #f8fafc;
  text-align: center;
}

.exercise-bank-empty h3 {
  margin-bottom: 8px;
  color: var(--maths-ink);
  font-weight: 850;
}

.exercise-bank-empty p {
  margin-bottom: 0;
  color: #64748b;
}

.exercise-bank-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.exercise-bank-actions .favorite-control {
  margin-right: auto;
}

@media (max-width: 575.98px) {
  .exercise-bank-actions {
    align-items: stretch;
  }

  .exercise-bank-actions > * {
    width: 100%;
  }

  .exercise-bank-actions .favorite-control {
    margin-right: 0;
  }
}

/* Espace compte et sécurité */
.auth-user-account-link {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.auth-user-account-link:hover .auth-user-name,
.auth-user-account-link:focus-visible .auth-user-name {
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.account-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.account-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.4rem;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  overflow: hidden;
  border: 1px solid #cfe0f6;
  border-radius: 1.75rem;
  background:
    radial-gradient(circle at 92% 20%, rgba(20, 184, 166, 0.18), transparent 32%),
    linear-gradient(135deg, #fff 15%, #eef5ff 100%);
  box-shadow: 0 20px 50px rgba(15, 45, 85, 0.08);
}

.account-hero h1 {
  margin: 0.25rem 0 0.7rem;
  color: #091a38;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.045em;
}

.account-hero p:last-child {
  max-width: 700px;
  margin: 0;
  color: #53657f;
  font-size: 1.05rem;
}

.account-role-summary {
  flex: 0 0 auto;
  min-width: 150px;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(23, 105, 255, 0.14);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.78);
}

.account-role-summary span,
.account-role-summary strong {
  display: block;
}

.account-role-summary span {
  color: #6b7c94;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-role-summary strong {
  margin-top: 0.2rem;
  color: #123d7a;
  font-size: 1.05rem;
}

.account-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid #b8e3d8;
  border-radius: 1rem;
  background: #ecfbf6;
  color: #096b59;
  font-weight: 700;
}

.account-notice-error {
  border-color: #f2c1c6;
  background: #fff1f2;
  color: #a52332;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.account-card {
  margin: 0;
  padding: clamp(1.35rem, 2.6vw, 2rem);
  border-radius: 1.5rem;
}

.account-sessions-card {
  grid-column: 1 / -1;
}

.account-card-heading {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.account-card-heading h2 {
  margin: 0.1rem 0 0.35rem;
  color: #10213f;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
}

.account-card-heading p:last-child {
  margin: 0;
  color: #66768d;
}

.account-card-icon {
  display: inline-grid;
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 0.9rem;
  font-size: 1.3rem;
}

.account-card-icon-blue {
  background: #e8f1ff;
  color: #1769ff;
}

.account-card-icon-green {
  background: #e5f8f3;
  color: #008b78;
}

.account-card-icon-gold {
  background: #fff4d5;
  color: #a76700;
}

.account-card-icon-purple {
  background: #f1ebff;
  color: #6d3bd1;
}

.account-form,
.account-form-field {
  display: grid;
  gap: 0.5rem;
}

.account-form {
  gap: 1rem;
}

.account-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.account-form-field label,
.account-readonly-label {
  color: #30435e;
  font-size: 0.9rem;
  font-weight: 750;
}

.account-form-field input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid #cfdae9;
  border-radius: 0.8rem;
  background: #fff;
  color: #10213f;
}

.account-form-field input:focus {
  border-color: #1769ff;
  outline: 3px solid rgba(23, 105, 255, 0.13);
}

.account-form-field input[aria-invalid="true"] {
  border-color: #c83a49;
}

.account-field-error {
  color: #b52d3c;
  font-size: 0.82rem;
  font-weight: 650;
}

.account-form-help {
  margin: -0.2rem 0 0;
  color: #6b7c94;
  font-size: 0.85rem;
}

.account-readonly-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #dde5f0;
  border-radius: 0.9rem;
  background: #f7f9fc;
}

.account-readonly-field strong {
  display: block;
  margin-top: 0.12rem;
  color: #10213f;
  overflow-wrap: anywhere;
}

.account-verified-badge,
.account-current-badge {
  flex: 0 0 auto;
  color: #007966;
  font-size: 0.82rem;
  font-weight: 750;
}

.account-submit {
  width: fit-content;
  min-height: 2.8rem;
  padding-inline: 1.1rem;
  border-radius: 0.75rem;
  font-weight: 750;
}

.account-session-list {
  display: grid;
  gap: 0.75rem;
}

.account-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #dbe4f0;
  border-radius: 1rem;
  background: #fff;
}

.account-session.is-current {
  border-color: #a9ddd1;
  background: #f1fbf8;
}

.account-session-device {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.9rem;
}

.account-session-device > i {
  display: inline-grid;
  flex: 0 0 2.8rem;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 0.85rem;
  background: #edf3fb;
  color: #406184;
  font-size: 1.35rem;
}

.account-session-details {
  min-width: 0;
}

.account-session-title,
.account-session-meta,
.account-session-times {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.account-session-title {
  gap: 0.6rem;
}

.account-session-title strong {
  color: #10213f;
  font-size: 1rem;
}

.account-session-meta {
  gap: 0.35rem 0.9rem;
  margin-top: 0.35rem;
}

.account-session-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #687990;
  font-size: 0.85rem;
}

.account-session-meta i {
  color: #537498;
}

.account-session-times {
  gap: 0.25rem 0.75rem;
  margin-top: 0.3rem;
  color: #687990;
  font-size: 0.78rem;
}

.account-session-times small {
  color: #7b899c;
}

.account-session-current-state {
  flex: 0 0 auto;
  color: #007966;
  font-size: 0.8rem;
  font-weight: 800;
}

.account-session.is-current .account-session-device > i {
  background: #dff5ef;
  color: #007966;
}

.account-empty-state {
  padding: 1.5rem;
  border: 1px dashed #bfd0e4;
  border-radius: 1rem;
  color: #60728a;
  text-align: center;
}

.account-empty-state i {
  color: #008b78;
  font-size: 1.6rem;
}

.account-empty-state p {
  margin: 0.4rem 0 0;
}

.account-confirmation-page {
  display: grid;
  min-height: 100dvh;
  padding: 1.25rem;
  place-items: center;
  background:
    radial-gradient(circle at 10% 10%, rgba(23, 105, 255, 0.16), transparent 30%),
    radial-gradient(circle at 90% 85%, rgba(255, 193, 7, 0.14), transparent 28%),
    #f3f6fb;
}

.account-confirmation-card {
  width: min(560px, 100%);
  padding: clamp(2rem, 6vw, 3.5rem);
  border: 1px solid #dce5f2;
  border-radius: 1.75rem;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 33, 63, 0.14);
  text-align: center;
}

.account-confirmation-card h1 {
  margin: 0.65rem 0 1rem;
  color: #0b1934;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.account-confirmation-card > p:not(.eyebrow) {
  margin: 0 auto 1.7rem;
  color: #5b6d85;
  font-size: 1.05rem;
  line-height: 1.7;
}

.account-confirmation-icon {
  display: inline-grid;
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1.25rem;
  place-items: center;
  border-radius: 1.35rem;
  font-size: 2rem;
}

.billing-page {
  display: grid;
  gap: 1.5rem;
  padding: clamp(1rem, 2vw, 2rem);
}

.billing-hero {
  padding: clamp(2rem, 5vw, 4.5rem);
  border: 1px solid rgba(23, 105, 255, 0.14);
  border-radius: 2rem;
  background:
    radial-gradient(circle at 90% 15%, rgba(0, 167, 145, 0.17), transparent 32%),
    radial-gradient(circle at 10% 85%, rgba(23, 105, 255, 0.15), transparent 34%),
    #f8fbff;
  text-align: center;
}

.billing-hero h1 {
  max-width: 920px;
  margin: 0.4rem auto 1rem;
  color: #071a3a;
  font-size: clamp(2.1rem, 5vw, 4.3rem);
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.billing-hero > p:last-child {
  max-width: 760px;
  margin: 0 auto;
  color: #52637b;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  font-weight: 650;
  line-height: 1.75;
}

.billing-current-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid #b8e5db;
  border-radius: 1rem;
  background: #effbf8;
}

.billing-current-summary span,
.billing-current-summary strong {
  display: block;
}

.billing-current-summary span {
  color: #5a7184;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-current-summary strong {
  color: #006f60;
  font-size: 1.2rem;
}

.billing-current-summary p {
  margin: 0;
  color: #526b77;
  font-weight: 700;
}

.billing-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 1rem;
}

.billing-plan-card {
  position: relative;
  display: flex;
  min-width: 0;
  padding: 1.5rem;
  flex-direction: column;
  border: 1px solid #d9e3f0;
  border-radius: 1.5rem;
  background: #fff;
  box-shadow: 0 14px 35px rgba(16, 33, 63, 0.06);
}

.billing-plan-card.is-highlighted {
  border-color: rgba(23, 105, 255, 0.5);
  box-shadow: 0 18px 45px rgba(23, 105, 255, 0.13);
}

.billing-plan-ribbon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #eaf2ff;
  color: #145bd1;
  font-size: 0.7rem;
  font-weight: 850;
}

.billing-plan-audience {
  margin: 0 0 0.55rem;
  color: #008b78;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.billing-plan-card h2 {
  margin: 0;
  color: #10213f;
  font-size: 1.65rem;
  font-weight: 950;
}

.billing-plan-tagline {
  min-height: 2.8rem;
  margin: 0.35rem 0 1rem;
  color: #61728a;
  font-weight: 700;
}

.billing-plan-price {
  color: #071a3a;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 950;
}

.billing-plan-annual {
  min-height: 1.15rem;
  margin: 0.2rem 0 0;
  color: #748298;
  font-size: 0.75rem;
  font-weight: 700;
}

.billing-plan-description {
  margin: 1rem 0;
  color: #52637b;
  font-size: 0.9rem;
  line-height: 1.55;
}

.billing-plan-benefits {
  display: grid;
  margin: 0 0 1.5rem;
  padding: 0;
  gap: 0.65rem;
  list-style: none;
}

.billing-plan-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  color: #344a66;
  font-size: 0.86rem;
  font-weight: 700;
}

.billing-plan-benefits i {
  color: #008b78;
  font-size: 1rem;
}

.billing-plan-footer {
  margin-top: auto;
}

.billing-plan-action,
.billing-plan-button {
  width: 100%;
}

.billing-plan-payment-actions {
  display: grid;
  gap: 0.65rem;
  width: 100%;
}

.billing-plan-transition-note,
.billing-plan-unavailable {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.45;
}

.billing-plan-transition-note {
  color: #065f46;
  background: #ecfdf5;
}

.billing-plan-unavailable {
  color: #7c2d12;
  background: #fff7ed;
}

.billing-plan-transition-note i,
.billing-plan-unavailable i {
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.admin-payment-section {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid #dbe5f3;
}

.admin-section-heading,
.admin-payment-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-section-heading h2,
.admin-payment-panel-heading h3 {
  margin: 0;
}

.admin-wave-state,
.admin-payment-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-weight: 800;
}

.admin-wave-state {
  padding: 0.5rem 0.8rem;
  color: #7a4c00;
  background: #fff3cd;
}

.admin-wave-state.is-enabled {
  color: #006b54;
  background: #dff7ef;
}

.admin-payment-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.admin-payment-kpi,
.admin-payment-panel {
  border: 1px solid #dbe5f3;
  border-radius: 1.15rem;
  background: #fff;
}

.admin-payment-kpi {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
}

.admin-payment-kpi strong {
  color: #0d3575;
  font-size: 1.4rem;
}

.admin-payment-kpi span,
.admin-payment-panel-heading span {
  color: #65758b;
  font-size: 0.88rem;
}

.admin-payment-panel {
  padding: 1.1rem;
  margin-top: 1rem;
}

.admin-payment-table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
}

.admin-payment-table th,
.admin-payment-table td {
  padding: 0.8rem 0.65rem;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
}

.admin-payment-table th {
  color: #52627a;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-payment-table code {
  color: #334866;
  overflow-wrap: anywhere;
}

.admin-payment-status {
  padding: 0.32rem 0.58rem;
  font-size: 0.78rem;
}

.admin-payment-status.is-success {
  color: #006b54;
  background: #dff7ef;
}

.admin-payment-status.is-pending {
  color: #7a4c00;
  background: #fff3cd;
}

.admin-payment-status.is-error {
  color: #9f1d2d;
  background: #fde7ea;
}

.admin-payment-alerts {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.admin-payment-alerts li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border-radius: 0.85rem;
  background: #fff7f8;
}

.admin-payment-alerts li div {
  display: grid;
  gap: 0.2rem;
}

.admin-payment-alerts li span {
  color: #65758b;
  font-size: 0.82rem;
}

.admin-payment-alert-reason {
  color: #9f1d2d !important;
  font-weight: 700;
}

.admin-payment-empty {
  margin: 1rem 0 0;
  color: #65758b;
}

.admin-refund-request-form,
.admin-refund-confirm-form {
  display: grid;
  gap: 0.65rem;
}

.admin-refund-request-form {
  min-width: 13rem;
}

.admin-refund-request-form label,
.admin-refund-confirm-form label {
  display: grid;
  gap: 0.3rem;
  margin: 0;
}

.admin-refund-request-form label span,
.admin-refund-confirm-form label span {
  color: #52627a;
  font-size: 0.76rem;
  font-weight: 800;
}

.admin-refund-request-form input,
.admin-refund-confirm-form input,
.admin-refund-confirm-form select {
  min-height: 2.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #cbd7e7;
  border-radius: 0.65rem;
  background: #fff;
  color: #10213f;
}

.admin-refund-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.admin-refund-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid #ecd4d8;
  border-radius: 0.9rem;
  background: #fffafb;
}

.admin-refund-summary,
.admin-refund-meta,
.admin-refund-confirm-form {
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
}

.admin-refund-summary {
  justify-content: space-between;
}

.admin-refund-summary > div:first-child {
  display: grid;
  gap: 0.2rem;
}

.admin-refund-summary > div:first-child span {
  color: #65758b;
  font-size: 0.88rem;
}

.admin-refund-meta {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-weight: 800;
}

.admin-refund-confirm-form label {
  flex: 1 1 15rem;
}

.admin-refund-confirm-form button {
  min-height: 2.5rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .admin-payment-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-refund-summary,
  .admin-refund-confirm-form {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-refund-confirm-form label {
    flex-basis: auto;
  }
}

@media (max-width: 575.98px) {
  .admin-section-heading,
  .admin-payment-panel-heading,
  .admin-payment-alerts li {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-payment-kpis {
    grid-template-columns: 1fr;
  }
}

.billing-plan-button {
  min-height: 2.8rem;
  border-radius: 0.8rem;
  font-weight: 800;
}

.billing-current-plan {
  display: inline-flex;
  width: 100%;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.8rem;
  background: #e9f8f4;
  color: #007966;
  font-weight: 850;
}

.billing-usage-card {
  margin: 0;
  padding: clamp(1.4rem, 3vw, 2.2rem);
}

.billing-usage-card h2 {
  margin: 0.2rem 0 1.2rem;
  color: #10213f;
  font-weight: 950;
}

.billing-documents-card {
  margin: 1.25rem 0 0;
  padding: clamp(1.4rem, 3vw, 2.2rem);
}

.billing-documents-card h2 {
  margin: 0.2rem 0 0.5rem;
  color: #10213f;
  font-weight: 950;
}

.billing-documents-intro,
.billing-documents-empty {
  color: #65758b;
}

.billing-document-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.billing-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid #dbe5f3;
  border-radius: 0.9rem;
  background: #f9fbfe;
}

.billing-document-row > div:first-child,
.billing-document-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.billing-document-type,
.billing-document-status {
  display: inline-flex;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  color: #7a4c00;
  background: #fff3cd;
  font-size: 0.76rem;
  font-weight: 850;
}

.billing-document-type {
  color: #0d3575;
  background: #eaf2ff;
}

.billing-document-status.is-certified {
  color: #006b54;
  background: #dff7ef;
}

@media (max-width: 700px) {
  .billing-document-row,
  .billing-document-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.billing-usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.billing-usage-item {
  padding: 0.9rem 1rem;
  border: 1px solid #dde6f1;
  border-radius: 0.9rem;
  background: #f9fbfd;
}

.billing-usage-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.billing-usage-item strong {
  color: #263d5a;
}

.billing-usage-item span {
  color: #6c7d93;
  font-size: 0.76rem;
  font-weight: 750;
}

.billing-usage-item progress {
  width: 100%;
  height: 0.45rem;
  margin-top: 0.65rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: #1769ff;
}

.billing-principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  gap: 1rem;
}

.billing-principles > div {
  padding: 0.5rem;
}

.billing-principles i {
  color: #1769ff;
  font-size: 1.6rem;
}

.billing-principles h2 {
  margin: 0.7rem 0 0.4rem;
  color: #10213f;
  font-size: 1.05rem;
  font-weight: 900;
}

.billing-principles p {
  margin: 0;
  color: #61728a;
  font-size: 0.88rem;
  line-height: 1.55;
}

.billing-required-page {
  display: grid;
  min-height: 60vh;
  padding: 1.5rem;
  place-items: center;
}

.billing-required-card {
  max-width: 660px;
  margin: 0;
  padding: clamp(2rem, 5vw, 4rem);
  text-align: center;
}

.billing-required-icon {
  display: inline-grid;
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1rem;
  place-items: center;
  border-radius: 1.3rem;
  background: #eaf2ff;
  color: #1769ff;
  font-size: 2rem;
}

.billing-required-card h1 {
  color: #10213f;
  font-weight: 950;
}

.billing-required-card p:not(.eyebrow) {
  margin: 1rem auto 1.5rem;
  color: #61728a;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  .billing-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .billing-usage-grid,
  .billing-principles {
    grid-template-columns: 1fr;
  }

  .billing-current-summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 575.98px) {
  .billing-page {
    padding: 0.65rem;
  }

  .billing-hero {
    padding: 2rem 1.2rem;
    border-radius: 1.35rem;
  }

  .billing-plan-grid {
    grid-template-columns: 1fr;
  }

  .billing-plan-tagline {
    min-height: 0;
  }
}

.account-confirmation-icon.is-success {
  background: #e5f8f3;
  color: #008b78;
}

.account-confirmation-icon.is-error {
  background: #fff1f2;
  color: #b52d3c;
}

@media (max-width: 820px) {
  .account-grid {
    grid-template-columns: 1fr;
  }

  .account-sessions-card {
    grid-column: auto;
  }
}

@media (max-width: 575.98px) {
  .account-page {
    padding-top: 0.5rem;
  }

  .account-hero {
    display: block;
    border-radius: 1.25rem;
  }

  .account-role-summary {
    width: fit-content;
    margin-top: 1.2rem;
  }

  .account-form-grid {
    grid-template-columns: 1fr;
  }

  .account-readonly-field,
  .account-session {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-session-current-state {
    padding-left: 3.7rem;
  }

  .account-submit {
    width: 100%;
  }
}

@media (max-width: 1200px) {
  .exercise-bank-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .exercise-filter-reset {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .exercise-bank-toolbar {
    grid-template-columns: 1fr;
  }

  .exercise-filter-reset {
    grid-column: auto;
  }

  .exercise-bank-status {
    justify-content: flex-start;
  }
}

.exercise-bank-summary {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) auto minmax(320px, 1.4fr);
  gap: 18px;
  align-items: stretch;
  margin: 26px 0 18px;
}

.exercise-bank-summary-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(135deg, #ffffff, #f8fafc);
}

.exercise-bank-summary-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(23, 78, 166, 0.10);
  color: var(--maths-primary-dark);
  font-size: 1.45rem;
  font-weight: 900;
}

.exercise-bank-summary-label {
  color: var(--maths-ink);
  font-weight: 900;
  line-height: 1.2;
}

.exercise-bank-summary-help {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 650;
}

.exercise-bank-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #ffffff;
}

.exercise-bank-chapter-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: center;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #ffffff;
}

.exercise-chapter-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(23, 78, 166, 0.12);
  background: #f8fafc;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.exercise-chapter-count:hover {
  background: rgba(23, 78, 166, 0.08);
  color: var(--maths-primary-dark);
  border-color: rgba(23, 78, 166, 0.20);
}

.exercise-chapter-count-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exercise-chapter-count-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--maths-primary);
  font-size: 0.72rem;
  font-weight: 900;
}

.exercise-bank-list-compact .exercise-bank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.exercise-bank-list-compact .exercise-card-header {
  padding-bottom: 12px;
}

.exercise-bank-list-compact .exercise-tags {
  padding-top: 12px;
}

.exercise-bank-list-compact .exercise-statement-compact {
  max-height: 105px;
  overflow: hidden;
  position: relative;
}

.exercise-bank-list-compact .exercise-statement-compact::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #ffffff);
  pointer-events: none;
}

.exercise-bank-list-detailed .exercise-statement-compact {
  max-height: none;
  overflow: visible;
}

.exercise-bank-list-detailed .exercise-statement-compact::after {
  display: none;
}

@media (max-width: 1280px) {
  .exercise-bank-summary {
    grid-template-columns: 1fr;
  }

  .exercise-bank-view-switch {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .exercise-bank-summary-main {
    align-items: flex-start;
  }

  .exercise-bank-view-switch {
    flex-direction: column;
    align-items: stretch;
  }

  .exercise-bank-view-switch .btn {
    width: 100%;
  }
}

.exercise-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.exercise-level {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 168, 132, 0.10);
  color: #047857;
  border: 1px solid rgba(0, 168, 132, 0.16);
  font-size: 0.74rem;
  font-weight: 850;
}

.exercise-hint-slot {
  padding: 0 22px 12px;
}

.exercise-hint {
  margin-top: 8px;
  border: 1px solid rgba(23, 78, 166, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #eff6ff);
  overflow: hidden;
}

.exercise-hint-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(23, 78, 166, 0.14);
}

.exercise-hint-title {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 850;
  color: var(--maths-ink);
}

.exercise-hint-body {
  padding: 16px 18px 18px;
}

.exercise-hint-body p:last-child {
  margin-bottom: 0;
}

.exercise-solution-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  border: 1px solid transparent;
}

.exercise-solution-status-complete {
  background: rgba(0, 168, 132, 0.10);
  color: #047857;
  border-color: rgba(0, 168, 132, 0.16);
}

.exercise-solution-status-hints-only {
  background: rgba(23, 78, 166, 0.10);
  color: var(--maths-primary-dark);
  border-color: rgba(23, 78, 166, 0.16);
}

.exercise-solution-status-none {
  background: #f8fafc;
  color: #64748b;
  border-color: rgba(148, 163, 184, 0.24);
}

.exercise-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.exercise-muted-info {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 750;
}

.exercise-series-builder {
  margin: 24px 0 22px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  background:
    radial-gradient(circle at top right, rgba(0, 168, 132, 0.10), transparent 34%),
    linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
}

.exercise-series-header h2 {
  margin: 4px 0 6px;
  color: var(--maths-ink);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.exercise-series-header p {
  margin: 0;
  color: #64748b;
  font-weight: 650;
}

.exercise-series-controls {
  display: grid;
  grid-template-columns:
    minmax(170px, 1fr)
    minmax(130px, 0.75fr)
    minmax(110px, 0.55fr)
    minmax(150px, 0.8fr)
    minmax(140px, 0.65fr);
  gap: 14px;
  align-items: end;
  margin-top: 20px;
}

.exercise-series-buttons {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.exercise-series-buttons .btn {
  width: auto !important;
  min-width: 6.75rem;
}

.exercise-series-title-field {
  grid-column: span 2;
}

.exercise-series-save-status {
  min-height: 1.5rem;
  margin-top: 12px;
  color: #64748b;
  font-weight: 750;
}

.exercise-series-save-status[data-state="success"] {
  color: #047857;
}

.exercise-series-save-status[data-state="error"] {
  color: #b91c1c;
}

.exercise-series-save-status[data-state="pending"] {
  color: var(--maths-primary-dark);
}

.exercise-series-result {
  margin-top: 18px;
}

.exercise-series-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.65);
  background: rgba(255, 255, 255, 0.78);
  color: #64748b;
  font-weight: 750;
  text-align: center;
}

.exercise-series-result-list {
  display: grid;
  gap: 12px;
}

.exercise-series-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.exercise-series-result-title {
  margin: 0;
  color: var(--maths-ink);
  font-weight: 900;
  line-height: 1.2;
}

.exercise-series-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.exercise-series-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 800;
}

.exercise-bank-item {
  scroll-margin-top: 96px;
}

@media (max-width: 1200px) {
  .exercise-series-controls {
    grid-template-columns: 1fr 1fr;
  }

  .exercise-series-buttons {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exercise-series-title-field {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .exercise-series-controls {
    grid-template-columns: 1fr;
  }

  .exercise-series-buttons {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
  }

  .exercise-series-buttons .btn {
    width: 100% !important;
    min-width: 0;
  }

  .exercise-series-title-field {
    grid-column: auto;
  }

  .exercise-series-result-card {
    grid-template-columns: 1fr;
  }
}

.teacher-series-page {
  display: grid;
  gap: 22px;
}

.teacher-series-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.teacher-series-hero h1 {
  margin: 4px 0 8px;
}

.teacher-series-hero p {
  max-width: 760px;
  margin: 0;
  color: #64748b;
  font-weight: 650;
}

.teacher-series-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.teacher-series-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  border-radius: 20px;
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.teacher-series-card-title {
  margin: 3px 0 10px;
  color: var(--maths-ink);
  font-size: 1.12rem;
  font-weight: 900;
}

.teacher-series-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.teacher-series-card-meta span {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--maths-primary-dark);
  font-size: 0.75rem;
  font-weight: 800;
}

.teacher-series-id {
  display: inline-flex;
  align-items: center;
  max-width: 19rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 0.8rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.teacher-series-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #dbe3ef;
}

.teacher-series-card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  white-space: nowrap;
}

.teacher-series-card-actions-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2rem;
}


.teacher-series-card-actions-main,
.teacher-series-card-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.teacher-series-card-actions-main {
  justify-content: flex-start;
}

.teacher-series-card-actions-secondary {
  justify-content: flex-end;
}

.teacher-series-settings {
  flex: 1 1 100%;
  padding-top: 16px;
  border-top: 1px solid rgba(203, 213, 225, 0.8);
}

.teacher-series-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.teacher-series-settings-grid label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
}

.teacher-series-settings-help {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.teacher-series-settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.teacher-series-settings-status {
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 750;
}

.teacher-series-settings-status[data-state="success"] {
  color: #047857;
}

.teacher-series-settings-status[data-state="error"] {
  color: #b91c1c;
}

.teacher-series-settings-status[data-state="pending"] {
  color: var(--maths-primary-dark);
}

.teacher-series-id {
  overflow-wrap: anywhere;
}

.teacher-series-empty {
  padding: 32px 20px;
  text-align: center;
}

.teacher-series-empty h2 {
  margin-bottom: 8px;
  font-weight: 900;
}

.teacher-series-empty p {
  margin: 0 auto 18px;
  max-width: 620px;
  color: #64748b;
}

@media (max-width: 820px) {
  .teacher-series-grid {
    grid-template-columns: 1fr;
  }

  .teacher-series-hero,
  .teacher-series-card {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-series-card {
    flex-wrap: nowrap;
  }

  .teacher-series-card-main,
  .teacher-series-settings,
  .teacher-series-card-actions {
    width: 100%;
    min-width: 0;
  }

  .teacher-series-settings {
    flex: 0 0 auto;
  }

  .teacher-series-card-actions {
    align-items: stretch;
    max-width: none;
  }

  .teacher-series-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .teacher-series-settings-grid {
    grid-template-columns: 1fr;
  }

  .teacher-series-settings-actions,
  .teacher-series-card-actions-footer,
  .teacher-series-card-actions-main,
  .teacher-series-card-actions-secondary {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-series-card-actions-main,
  .teacher-series-card-actions-secondary {
    width: 100%;
  }

  .teacher-series-settings-actions .btn,
  .teacher-series-card-actions .btn {
    width: 100%;
    min-height: 2.75rem;
  }
}

.exercise-bank-browser {
  margin-top: 28px;
  padding-top: 26px;
  border-top: 1px solid rgba(203, 213, 225, 0.9);
}

.exercise-bank-browser-header {
  margin-bottom: 18px;
}

.exercise-bank-browser-header h2 {
  margin: 4px 0 6px;
  color: var(--maths-ink);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.exercise-bank-browser-header p {
  margin: 0;
  color: #64748b;
  font-weight: 650;
}

.exercise-series-generated {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(0, 168, 132, 0.18);
  background: rgba(255, 255, 255, 0.82);
}

.exercise-series-generated-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.exercise-series-generated-header h3 {
  margin: 4px 0 4px;
  color: var(--maths-ink);
  font-size: 1.12rem;
  font-weight: 900;
}

.exercise-series-generated-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 650;
}

.exercise-series-notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 750;
}

.exercise-series-buttons .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.markdown-list {
  margin: 0.85rem 0 1rem;
  padding-left: 1.35rem;
  color: var(--maths-ink);
}

.markdown-list li {
  margin: 0.38rem 0;
  padding-left: 0.25rem;
  line-height: 1.65;
}

.markdown-list ol,
.markdown-list ul {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.markdown-list-ul {
  list-style-type: disc;
}

.markdown-list-ol {
  list-style-type: decimal;
}

.exercise-statement .markdown-list,
.exercise-solution-body .markdown-list,
.exercise-hint-body .markdown-list {
  margin-top: 0.6rem;
  margin-bottom: 0.8rem;
}

.inline-code {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.36rem;
  border-radius: 0.45rem;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.28);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  font-weight: 700;
}

.chapter-article strong,
.exercise-card strong,
.math-card strong {
  color: var(--maths-ink);
  font-weight: 850;
}

.chapter-article em,
.exercise-card em,
.math-card em {
  color: #334155;
}

.markdown-link {
  color: var(--maths-primary);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid rgba(23, 78, 166, 0.25);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.markdown-link:hover {
  color: var(--maths-primary-dark);
  border-bottom-color: rgba(23, 78, 166, 0.65);
}

.markdown-link-internal::after {
  content: " →";
  font-weight: 900;
}

.markdown-link-external::after {
  content: " ↗";
  font-size: 0.86em;
  font-weight: 900;
}

.markdown-blockquote {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  margin: 1.4rem 0;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  background:
    radial-gradient(circle at top left, rgba(23, 78, 166, 0.08), transparent 34%),
    #ffffff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.045);
}

.markdown-blockquote-mark {
  color: var(--maths-primary);
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 900;
  opacity: 0.72;
}

.markdown-blockquote-body {
  color: #334155;
  font-size: 1rem;
  line-height: 1.7;
  font-weight: 650;
}

.markdown-blockquote-body p:last-child {
  margin-bottom: 0;
}

.pedagogical-quote {
  margin: 1.6rem 0;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(0, 168, 132, 0.18);
  background:
    radial-gradient(circle at top right, rgba(0, 168, 132, 0.12), transparent 36%),
    linear-gradient(135deg, #ffffff, #f0fdfa);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.pedagogical-quote-label {
  margin-bottom: 12px;
  color: #047857;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.pedagogical-quote-body {
  margin: 0;
  color: var(--maths-ink);
  font-size: 1.04rem;
  line-height: 1.75;
  font-weight: 650;
}

.pedagogical-quote-body p:last-child {
  margin-bottom: 0;
}

.pedagogical-quote-caption {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 168, 132, 0.16);
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 750;
}

.pedagogical-quote-author {
  color: #047857;
  font-weight: 900;
}

.chapter-navigation {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid rgba(203, 213, 225, 0.9);
}

.chapter-navigation-header {
  margin-bottom: 18px;
}

.chapter-navigation-header h2 {
  margin: 4px 0 0;
  color: var(--maths-ink);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.chapter-navigation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chapter-nav-card {
  display: flex;
  flex-direction: column;
  min-height: 150px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  background:
    radial-gradient(circle at top right, rgba(23, 78, 166, 0.08), transparent 36%),
    #ffffff;
  color: var(--maths-ink);
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.chapter-nav-card:hover {
  transform: translateY(-3px);
  border-color: rgba(23, 78, 166, 0.26);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.10);
  color: var(--maths-ink);
  text-decoration: none;
}

.chapter-nav-card-prev {
  align-items: flex-start;
  text-align: left;
}

.chapter-nav-card-next {
  align-items: flex-end;
  text-align: right;
}

.chapter-nav-kicker {
  color: var(--maths-primary);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.chapter-nav-title {
  margin-top: 12px;
  max-width: 95%;
  color: var(--maths-ink);
  font-size: 1.08rem;
  line-height: 1.25;
  font-weight: 900;
}

.chapter-nav-meta {
  margin-top: auto;
  padding-top: 18px;
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 750;
}

.chapter-nav-card-disabled {
  opacity: 0.58;
  background: #f8fafc;
  cursor: default;
  box-shadow: none;
}

.chapter-nav-card-disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(203, 213, 225, 0.9);
}

@media (max-width: 720px) {
  .chapter-navigation-grid {
    grid-template-columns: 1fr;
  }

  .chapter-nav-card-next {
    align-items: flex-start;
    text-align: left;
  }
}

.chapter-synthesis {
  margin-top: 34px;
  padding: 26px;
  border-radius: 26px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  background:
    radial-gradient(circle at top right, rgba(0, 168, 132, 0.10), transparent 34%),
    linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.chapter-synthesis-header {
  margin-bottom: 20px;
}

.chapter-synthesis-header h2 {
  margin: 4px 0 6px;
  color: var(--maths-ink);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.chapter-synthesis-header p {
  margin: 0;
  color: #64748b;
  font-weight: 650;
}

.chapter-synthesis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chapter-synthesis-card {
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.88);
}

.chapter-synthesis-card-main {
  border-color: rgba(0, 168, 132, 0.20);
  background: linear-gradient(135deg, #ffffff, #f0fdfa);
}

.chapter-synthesis-card-title {
  margin-bottom: 12px;
  color: var(--maths-primary-dark);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chapter-synthesis-card p {
  margin-bottom: 0;
  color: #334155;
  line-height: 1.65;
  font-weight: 600;
}

.chapter-synthesis-list {
  margin: 0;
  padding-left: 1.25rem;
}

.chapter-synthesis-list li {
  margin: 0.42rem 0;
  color: #334155;
  line-height: 1.55;
  font-weight: 650;
}

.chapter-synthesis-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chapter-synthesis-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #f8fafc;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 850;
}

.chapter-synthesis-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--maths-primary);
  font-size: 0.72rem;
  font-weight: 900;
}

.chapter-synthesis-pill-label {
  white-space: nowrap;
}

.pill-blue {
  background: #eff6ff;
  color: #1e3a8a;
}

.pill-indigo {
  background: #eef2ff;
  color: #3730a3;
}

.pill-purple {
  background: #f5f3ff;
  color: #6d28d9;
}

.pill-green {
  background: #ecfdf5;
  color: #047857;
}

.pill-orange {
  background: #fff7ed;
  color: #c2410c;
}

.pill-red {
  background: #fef2f2;
  color: #b91c1c;
}

.pill-dark {
  background: #f1f5f9;
  color: #0f172a;
}

@media (max-width: 920px) {
  .chapter-synthesis-grid {
    grid-template-columns: 1fr;
  }

  .chapter-synthesis {
    padding: 20px;
  }
}

.chapter-breadcrumb {
  margin: 0 0 22px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
}

.chapter-breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.25;
}

.chapter-breadcrumb-link {
  color: var(--maths-primary);
  text-decoration: none;
  font-weight: 900;
}

.chapter-breadcrumb-link:hover {
  color: var(--maths-primary-dark);
  text-decoration: none;
}

.chapter-breadcrumb-separator {
  color: #94a3b8;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
}

.chapter-breadcrumb-part {
  max-width: 260px;
  overflow: hidden;
  color: #475569;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-breadcrumb-current {
  max-width: 420px;
  overflow: hidden;
  color: var(--maths-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

@media (max-width: 720px) {
  .chapter-breadcrumb {
    padding: 11px 12px;
  }

  .chapter-breadcrumb-part,
  .chapter-breadcrumb-current {
    max-width: 100%;
    white-space: normal;
  }
}

.chapter-synthesis-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.chapter-synthesis-header > div {
  min-width: 0;
}

.chapter-synthesis-header .btn {
  flex-shrink: 0;
  border-radius: 999px;
}

@media (max-width: 720px) {
  .chapter-synthesis-header {
    flex-direction: column;
  }

  .chapter-synthesis-header .btn {
    width: 100%;
  }
}

.chapter-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.chapter-topbar .chapter-breadcrumb {
  flex: 1 1 auto;
  margin-bottom: 0;
}

/*
.chapter-reading-toggle {
  flex: 0 0 auto;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}
*/

body.reading-mode {
  background: #f8fafc;
}

body.reading-mode .premium-nav {
  display: none !important;
}

body.reading-mode .chapter-sidebar {
  display: none !important;
}

body.reading-mode .app-shell {
  display: block;
  padding: 28px 18px 38px;
  min-height: 100vh;
}

body.reading-mode .chapter-panel {
  width: min(980px, 100%);
  margin: 0 auto;
}

body.reading-mode .chapter-topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 10px;
  border-radius: 22px;
  background: rgba(248, 250, 252, 0.86);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

body.reading-mode .chapter-article,
body.reading-mode .chapter-synthesis,
body.reading-mode .chapter-navigation {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

body.reading-mode .chapter-article {
  font-size: 1.04rem;
  line-height: 1.76;
}

body.reading-mode .chapter-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

@media (max-width: 720px) {
  .chapter-topbar {
    flex-direction: column;
  }

  .chapter-reading-toggle {
    width: 100%;
  }

  body.reading-mode .app-shell {
    padding: 14px 10px 28px;
  }

  body.reading-mode .chapter-topbar {
    top: 8px;
  }
}

.chapter-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.chapter-progress-indicator {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(64px, 92px) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(239, 246, 255, 0.92);
  color: var(--maths-primary-dark);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.chapter-progress-indicator[hidden] {
  display: none;
}

.chapter-progress-label,
.chapter-progress-value {
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.chapter-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.3);
}

.chapter-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maths-primary), #00a884);
  transition: width 180ms ease;
}

.chapter-status-control {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.94);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.chapter-status-control[hidden] {
  display: none;
}

.chapter-status-button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font-weight: 800;
  white-space: nowrap;
}

.chapter-status-button:hover:not(:disabled) {
  border-color: rgba(37, 99, 235, 0.22);
  background: #ffffff;
  color: var(--maths-primary-dark);
}

.chapter-status-button[data-chapter-status="TERMINE"].chapter-status-button-active {
  border-color: rgba(5, 150, 105, 0.3);
  background: #d1fae5;
  color: #047857;
}

.chapter-status-button[data-chapter-status="A_REVOIR"].chapter-status-button-active {
  border-color: rgba(217, 119, 6, 0.3);
  background: #fef3c7;
  color: #b45309;
}

.chapter-status-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.chapter-print-toggle,
.chapter-reading-toggle {
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

@media (max-width: 720px) {
  .chapter-topbar-actions {
    width: 100%;
    flex-direction: column;
  }

  .chapter-progress-indicator,
  .chapter-status-control,
  .visual-comfort-toggle,
  .chapter-print-toggle,
  .chapter-reading-toggle {
    width: 100%;
  }

  .chapter-progress-indicator {
    grid-template-columns: auto minmax(80px, 1fr) auto;
  }

  .chapter-status-control {
    justify-content: stretch;
  }

  .chapter-status-button {
    flex: 1 1 0;
  }
}

.visual-comfort-toggle,
.chapter-print-toggle,
.chapter-reading-toggle {
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

/* ================================
   Mode sombre / confort visuel
   ================================ */

body.visual-comfort-mode {
  --maths-ink: #e5edf7;
  --maths-primary: #7dd3fc;
  --maths-primary-dark: #38bdf8;

  background: #07111f;
  color: #dbeafe;
}

body.visual-comfort-mode .premium-nav {
  background: rgba(7, 17, 31, 0.94);
  border-bottom-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

body.visual-comfort-mode .app-shell {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.10), transparent 34%),
    #07111f;
}

body.visual-comfort-mode .chapter-sidebar,
body.visual-comfort-mode .chapter-article,
body.visual-comfort-mode .chapter-synthesis,
body.visual-comfort-mode .chapter-navigation,
body.visual-comfort-mode .chapter-breadcrumb,
body.visual-comfort-mode .chapter-topbar,
body.visual-comfort-mode .math-card,
body.visual-comfort-mode .exercise-card,
body.visual-comfort-mode .chapter-nav-card,
body.visual-comfort-mode .chapter-synthesis-card,
body.visual-comfort-mode .markdown-blockquote,
body.visual-comfort-mode .pedagogical-quote {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.82));
  color: #dbeafe;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.25);
}

body.visual-comfort-mode .chapter-header h1,
body.visual-comfort-mode h1,
body.visual-comfort-mode h2,
body.visual-comfort-mode h3,
body.visual-comfort-mode .chapter-nav-title,
body.visual-comfort-mode .chapter-synthesis-card-title,
body.visual-comfort-mode .exercise-title,
body.visual-comfort-mode .math-card-title {
  color: #f8fafc;
}

body.visual-comfort-mode p,
body.visual-comfort-mode li,
body.visual-comfort-mode .chapter-synthesis-card p,
body.visual-comfort-mode .chapter-synthesis-list li,
body.visual-comfort-mode .markdown-blockquote-body,
body.visual-comfort-mode .pedagogical-quote-body {
  color: #dbeafe;
}

body.visual-comfort-mode .eyebrow,
body.visual-comfort-mode .chapter-breadcrumb-link,
body.visual-comfort-mode .chapter-nav-kicker,
body.visual-comfort-mode .markdown-link {
  color: #7dd3fc;
}

body.visual-comfort-mode .chapter-breadcrumb-item,
body.visual-comfort-mode .chapter-breadcrumb-part,
body.visual-comfort-mode .chapter-breadcrumb-current,
body.visual-comfort-mode .chapter-nav-meta,
body.visual-comfort-mode .chapter-synthesis-header p,
body.visual-comfort-mode .text-muted {
  color: #94a3b8 !important;
}

body.visual-comfort-mode .sidebar-link {
  color: #cbd5e1;
}

body.visual-comfort-mode .sidebar-link:hover,
body.visual-comfort-mode .sidebar-link.active {
  background: rgba(56, 189, 248, 0.14);
  color: #f8fafc;
}

body.visual-comfort-mode .sidebar-link-disabled {
  color: #64748b;
}

body.visual-comfort-mode .inline-code {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.32);
  color: #bae6fd;
}

body.visual-comfort-mode .math-display {
  border-color: rgba(148, 163, 184, 0.20);
  background: rgba(15, 23, 42, 0.78);
}

body.visual-comfort-mode .exercise-card-header {
  background: rgba(15, 23, 42, 0.86);
  border-bottom-color: rgba(148, 163, 184, 0.18);
}

body.visual-comfort-mode .exercise-level,
body.visual-comfort-mode .exercise-difficulty,
body.visual-comfort-mode .exercise-solution-status,
body.visual-comfort-mode .exercise-tag,
body.visual-comfort-mode .chapter-synthesis-pill {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(148, 163, 184, 0.22);
  color: #dbeafe;
}

body.visual-comfort-mode .chapter-synthesis-pill-count {
  background: rgba(15, 23, 42, 0.95);
  color: #7dd3fc;
}

body.visual-comfort-mode .btn-outline-primary {
  border-color: #7dd3fc;
  color: #7dd3fc;
}

body.visual-comfort-mode .btn-outline-primary:hover,
body.visual-comfort-mode .btn-primary {
  border-color: #38bdf8;
  background: #38bdf8;
  color: #07111f;
}

body.visual-comfort-mode .btn-outline-secondary {
  border-color: #94a3b8;
  color: #cbd5e1;
}

body.visual-comfort-mode .btn-outline-secondary:hover,
body.visual-comfort-mode .btn-secondary {
  border-color: #cbd5e1;
  background: #cbd5e1;
  color: #07111f;
}

body.visual-comfort-mode .katex {
  color: #f8fafc;
}

body.visual-comfort-mode.reading-mode {
  background: #07111f;
}

body.visual-comfort-mode.reading-mode .chapter-topbar {
  background: rgba(7, 17, 31, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

body.visual-comfort-mode .chapter-card {
  border-color: rgba(148, 163, 184, 0.18);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.10), transparent 34%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.82));
  color: #dbeafe;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.25);
}

body.visual-comfort-mode .chapter-card-planned {
  background:
    radial-gradient(circle at top right, rgba(148, 163, 184, 0.08), transparent 34%),
    rgba(15, 23, 42, 0.86);
}

body.visual-comfort-mode .chapter-card-title {
  color: #f8fafc;
}

body.visual-comfort-mode .chapter-card-summary {
  color: #cbd5e1;
}

body.visual-comfort-mode .chapter-status-badge {
  background: rgba(30, 41, 59, 0.95);
  color: #94a3b8;
}

body.visual-comfort-mode .chapter-card-action {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
}

body.visual-comfort-mode .chapter-card-action:hover {
  background: #38bdf8;
  color: #07111f;
}

body.visual-comfort-mode .chapter-card-action-disabled,
body.visual-comfort-mode .chapter-card-action-disabled:hover {
  background: rgba(30, 41, 59, 0.95);
  color: #64748b;
}

body.visual-comfort-mode .sidebar-toggle {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.94);
  color: #7dd3fc;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

body.visual-comfort-mode .sidebar-backdrop {
  background: rgba(2, 6, 23, 0.62);
}

@media (max-width: 920px) {
  body.visual-comfort-mode .chapter-sidebar {
    background:
      linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
    border-color: rgba(148, 163, 184, 0.18);
  }
}

body.reading-mode .sidebar-toggle,
body.reading-mode .sidebar-backdrop {
  display: none !important;
}

/*===============================================
= Page d'accueil
================================================*/
.home-editorial-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 24px;
  margin-bottom: 28px;
  padding: 30px;
  border-radius: 30px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  background:
    radial-gradient(circle at top left, rgba(23, 78, 166, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(0, 168, 132, 0.12), transparent 32%),
    linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.07);
}

.home-editorial-content h1 {
  margin: 6px 0 12px;
  color: var(--maths-ink);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: -0.055em;
}

.home-editorial-lead {
  max-width: 780px;
  margin: 0;
  color: #475569;
  font-size: 1.04rem;
  line-height: 1.75;
  font-weight: 650;
}

.home-editorial-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.home-editorial-actions .btn {
  border-radius: 999px;
}

.home-editorial-panel {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(0, 168, 132, 0.18);
  background: rgba(255, 255, 255, 0.78);
}

.home-editorial-panel-title {
  margin-bottom: 12px;
  color: #047857;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.home-editorial-steps {
  margin: 0;
  padding-left: 1.25rem;
}

.home-editorial-steps li {
  margin: 0.55rem 0;
  color: #334155;
  line-height: 1.5;
  font-weight: 700;
}

.student-progress-dashboard {
  box-sizing: border-box;
  margin: 28px 0;
  padding: 26px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.13), transparent 34%),
    linear-gradient(135deg, #ffffff, #f8fbff);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.student-progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.student-progress-header h2 {
  margin: 4px 0 8px;
  color: var(--maths-ink);
  font-size: 1.55rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.student-progress-header p,
.student-progress-state p {
  margin: 0;
  color: #64748b;
  font-weight: 650;
}

.student-progress-overall {
  flex: 0 0 auto;
  padding: 12px 16px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 18px;
  background: rgba(239, 246, 255, 0.9);
  text-align: right;
}

.student-progress-overall strong,
.student-progress-overall span {
  display: block;
}

.student-progress-overall strong {
  color: var(--maths-primary-dark);
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 950;
}

.student-progress-overall span {
  margin-top: 5px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
}

.student-progress-summary {
  margin-top: 22px;
}

.student-progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe5f1;
}

.student-progress-track-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maths-primary), #00a884);
}

.student-progress-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.student-progress-stats article {
  padding: 13px 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.84);
}

.student-progress-stats strong,
.student-progress-stats span {
  display: block;
}

.student-progress-stats strong {
  color: var(--maths-ink);
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 950;
}

.student-progress-stats span {
  margin-top: 5px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
}

.student-quiz-progress {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(109, 40, 217, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(139, 92, 246, 0.10), transparent 38%),
    rgba(250, 245, 255, 0.72);
}

.student-quiz-progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.student-quiz-progress-header h3 {
  margin: 0 0 5px;
  color: var(--maths-ink);
  font-size: 1rem;
  font-weight: 950;
}

.student-quiz-progress-header p,
.student-quiz-progress-empty p {
  margin: 0;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 650;
}

.student-quiz-mastery {
  flex: 0 0 auto;
  text-align: right;
}

.student-quiz-mastery strong,
.student-quiz-mastery span {
  display: block;
}

.student-quiz-mastery strong {
  color: #6d28d9;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 950;
}

.student-quiz-mastery span {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}

.student-quiz-progress-track {
  height: 9px;
  margin-top: 15px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9d5ff;
}

.student-quiz-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #2563eb);
}

.student-quiz-progress-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.student-quiz-progress-stats article {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(196, 181, 253, 0.46);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.student-quiz-progress-stats strong,
.student-quiz-progress-stats span {
  display: block;
}

.student-quiz-progress-stats strong {
  color: var(--maths-ink);
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 950;
}

.student-quiz-progress-stats span {
  margin-top: 5px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
}

.student-quiz-progress-empty {
  margin-top: 15px;
  padding: 14px;
  border: 1px dashed rgba(109, 40, 217, 0.26);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
}

.student-quiz-progress-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--maths-ink);
  font-weight: 900;
}

.student-quiz-progress-empty[hidden],
.student-quiz-progress-stats[hidden] {
  display: none;
}

.student-progress-recent {
  margin-top: 24px;
}

.student-progress-recent h3 {
  margin: 0 0 12px;
  color: var(--maths-ink);
  font-size: 1rem;
  font-weight: 900;
}

.student-progress-recent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.student-progress-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: 20px;
  background: #ffffff;
}

.student-progress-card-head,
.student-progress-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.student-progress-part {
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.student-progress-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
}

.student-progress-status-active {
  background: #dbeafe;
  color: #1d4ed8;
}

.student-progress-status-completed {
  background: #d1fae5;
  color: #047857;
}

.student-progress-status-review {
  background: #fef3c7;
  color: #b45309;
}

.student-progress-card h4 {
  margin: 12px 0;
  overflow: hidden;
  color: var(--maths-ink);
  font-size: 0.98rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-progress-card-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.student-progress-card-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maths-primary), #00a884);
}

.student-progress-card-footer {
  margin-top: 12px;
}

.student-progress-card-footer strong {
  color: var(--maths-primary-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.student-progress-resume {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--maths-primary);
  font-size: 0.8rem;
  font-weight: 900;
  text-decoration: none;
}

.student-progress-resume:hover {
  color: var(--maths-primary-dark);
  text-decoration: underline;
}

.student-progress-state {
  margin-top: 20px;
  padding: 20px;
  border: 1px dashed rgba(37, 99, 235, 0.25);
  border-radius: 20px;
  background: rgba(239, 246, 255, 0.62);
}

.student-progress-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--maths-ink);
  font-weight: 900;
}

.student-progress-state .btn {
  margin-top: 14px;
  border-radius: 999px;
}

.student-progress-state-warning {
  border-color: rgba(217, 119, 6, 0.28);
  background: rgba(255, 251, 235, 0.75);
}

body.visual-comfort-mode .student-progress-dashboard {
  border-color: rgba(56, 189, 248, 0.2);
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.11), transparent 34%),
    linear-gradient(135deg, #0f172a, #111c31);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28);
}

body.visual-comfort-mode .student-progress-header h2,
body.visual-comfort-mode .student-progress-stats strong,
body.visual-comfort-mode .student-quiz-progress-header h3,
body.visual-comfort-mode .student-quiz-progress-stats strong,
body.visual-comfort-mode .student-quiz-progress-empty strong,
body.visual-comfort-mode .student-progress-recent h3,
body.visual-comfort-mode .student-progress-card h4,
body.visual-comfort-mode .student-progress-state strong {
  color: #f8fafc;
}

body.visual-comfort-mode .student-progress-header p,
body.visual-comfort-mode .student-progress-overall span,
body.visual-comfort-mode .student-progress-stats span,
body.visual-comfort-mode .student-quiz-progress-header p,
body.visual-comfort-mode .student-quiz-progress-stats span,
body.visual-comfort-mode .student-quiz-progress-empty p,
body.visual-comfort-mode .student-progress-part,
body.visual-comfort-mode .student-progress-state p {
  color: #cbd5e1;
}

body.visual-comfort-mode .student-progress-overall,
body.visual-comfort-mode .student-progress-stats article,
body.visual-comfort-mode .student-quiz-progress,
body.visual-comfort-mode .student-quiz-progress-stats article,
body.visual-comfort-mode .student-quiz-progress-empty,
body.visual-comfort-mode .student-progress-card,
body.visual-comfort-mode .student-progress-state {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.78);
}

body.visual-comfort-mode .student-progress-overall strong,
body.visual-comfort-mode .student-quiz-mastery strong,
body.visual-comfort-mode .student-progress-card-footer strong,
body.visual-comfort-mode .student-progress-resume {
  color: #7dd3fc;
}

body.visual-comfort-mode .student-progress-track,
body.visual-comfort-mode .student-quiz-progress-track,
body.visual-comfort-mode .student-progress-card-meter {
  background: rgba(148, 163, 184, 0.28);
}

body.visual-comfort-mode .student-progress-state-warning {
  border-color: rgba(251, 191, 36, 0.38);
  background: rgba(120, 53, 15, 0.22);
}

.manual-progress-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 22px;
  margin: 28px 0;
  padding: 26px;
  border-radius: 28px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.055);
}

.manual-progress-main h2,
.home-parts-header h2 {
  margin: 4px 0 8px;
  color: var(--maths-ink);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.manual-progress-main p,
.home-parts-header p {
  margin: 0;
  color: #64748b;
  font-weight: 650;
}

.manual-progress-bar {
  height: 14px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.manual-progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--maths-primary), #00a884);
}

.manual-progress-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  color: #64748b;
  font-weight: 750;
}

.manual-progress-caption strong {
  color: var(--maths-primary-dark);
}

.manual-progress-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.manual-stat-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #f8fafc;
}

.manual-stat-value {
  display: block;
  color: var(--maths-ink);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 950;
}

.manual-stat-label {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 800;
}

.home-parts-overview {
  margin: 28px 0;
}

.home-parts-header {
  margin-bottom: 16px;
}

.home-parts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.home-part-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(23, 78, 166, 0.12);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.045);
}

.home-part-title {
  color: var(--maths-ink);
  font-size: 1.05rem;
  font-weight: 900;
}

.home-part-meta {
  margin-top: 6px;
  color: #64748b;
  font-size: 0.88rem;
  font-weight: 700;
}

.home-part-actions {
  margin-top: 14px;
}

.home-part-actions .btn {
  border-radius: 999px;
}

@media (max-width: 920px) {
  .home-editorial-hero,
  .manual-progress-dashboard,
  .home-parts-grid {
    grid-template-columns: 1fr;
  }

  .student-progress-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-quiz-progress-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-progress-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .student-progress-dashboard {
    padding: 20px 16px;
  }

  .student-progress-header {
    display: block;
  }

  .student-quiz-progress-header {
    display: block;
  }

  .student-quiz-mastery {
    margin-top: 12px;
    text-align: left;
  }

  .student-progress-overall {
    margin-top: 14px;
    text-align: left;
  }

  .student-progress-recent-grid {
    grid-template-columns: 1fr;
  }

  .manual-progress-stats {
    grid-template-columns: 1fr;
  }
}

.exercise-series-evaluation {
  border-color: rgba(185, 28, 28, 0.18);
  background:
    radial-gradient(circle at top right, rgba(185, 28, 28, 0.08), transparent 34%),
    #ffffff;
}

.exercise-evaluation-notice {
  margin-bottom: 10px;
  padding: 9px 11px;
  border-radius: 14px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
  font-weight: 850;
}

.exercise-evaluation-mode .exercise-actions,
.exercise-evaluation-mode .exercise-hint-slot,
.exercise-evaluation-mode .exercise-solution-slot {
  display: none !important;
}

.chapter-number-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--maths-primary-dark);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ================================
   Sommaire responsive
   ================================ */

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: sticky;
  top: 76px;
  z-index: 60;
  width: fit-content;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid rgba(23, 78, 166, 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--maths-primary-dark);
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
}

.sidebar-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
    position: relative;
    padding-left: 16px;
    padding-right: 16px;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .chapter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: min(84vw, 340px);
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    padding: 18px;
    border-radius: 0 24px 24px 0;
    background: #ffffff;
    box-shadow: 24px 0 60px rgba(15, 23, 42, 0.22);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  body.sidebar-open .chapter-sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .chapter-panel {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .sidebar-toggle {
    width: 100%;
    margin-bottom: 12px;
  }

  .chapter-sidebar {
    width: min(90vw, 330px);
    padding: 16px;
  }
}

/* ================================
   Accessibilité clavier / focus-visible
   ================================ */

:root {
  --focus-ring-color: rgba(23, 78, 166, 0.45);
  --focus-ring-inner: #ffffff;
  --focus-ring-offset: 3px;
  --app-navbar-height: 82px;
}

/* Liens du sommaire */
.sidebar-link:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: 14px;
  background: rgba(23, 78, 166, 0.10);
  color: var(--maths-primary-dark);
  box-shadow:
    0 0 0 2px var(--focus-ring-inner),
    0 0 0 6px var(--focus-ring-color);
}

/* Boutons / liens d'ouverture de chapitre sur l'accueil */
.chapter-card-action:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  box-shadow:
    0 0 0 2px var(--focus-ring-inner),
    0 0 0 6px var(--focus-ring-color),
    0 12px 28px rgba(15, 23, 42, 0.12);
}

/* Cartes chapitre précédent / suivant */
.chapter-nav-card:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  box-shadow:
    0 0 0 2px var(--focus-ring-inner),
    0 0 0 6px var(--focus-ring-color),
    0 18px 42px rgba(15, 23, 42, 0.12);
}

/* Résultats de recherche dans le sommaire */
.search-result:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: 12px;
  background: rgba(23, 78, 166, 0.10);
}

/* Bouton Sommaire mobile */
.sidebar-toggle:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  box-shadow:
    0 0 0 2px var(--focus-ring-inner),
    0 0 0 6px var(--focus-ring-color),
    0 12px 28px rgba(15, 23, 42, 0.12);
}

/* Boutons d'action du haut de chapitre */
.visual-comfort-toggle:focus-visible,
.chapter-print-toggle:focus-visible,
.chapter-reading-toggle:focus-visible,
.student-progress-resume:focus-visible,
#chapter-synthesis-print:focus-visible,
#exercise-series-generate:focus-visible,
#exercise-series-export-pdf:focus-visible,
#exercise-series-clear:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  box-shadow:
    0 0 0 2px var(--focus-ring-inner),
    0 0 0 6px var(--focus-ring-color),
    0 12px 28px rgba(15, 23, 42, 0.12);
}

/* Liens internes dans les chapitres */
.markdown-link:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 4px;
  border-radius: 8px;
  background: rgba(23, 78, 166, 0.08);
}

body.visual-comfort-mode {
  --focus-ring-color: rgba(125, 211, 252, 0.60);
  --focus-ring-inner: #07111f;
}

body.visual-comfort-mode .sidebar-link:focus-visible,
body.visual-comfort-mode .chapter-card-action:focus-visible,
body.visual-comfort-mode .chapter-nav-card:focus-visible,
body.visual-comfort-mode .search-result:focus-visible,
body.visual-comfort-mode .sidebar-toggle:focus-visible,
body.visual-comfort-mode .visual-comfort-toggle:focus-visible,
body.visual-comfort-mode .chapter-print-toggle:focus-visible,
body.visual-comfort-mode .chapter-reading-toggle:focus-visible,
body.visual-comfort-mode .student-progress-resume:focus-visible,
body.visual-comfort-mode #chapter-synthesis-print:focus-visible,
body.visual-comfort-mode #exercise-series-generate:focus-visible,
body.visual-comfort-mode #exercise-series-export-pdf:focus-visible,
body.visual-comfort-mode #exercise-series-clear:focus-visible,
body.visual-comfort-mode .markdown-link:focus-visible {
  outline-color: var(--focus-ring-color);
  box-shadow:
    0 0 0 2px var(--focus-ring-inner),
    0 0 0 6px var(--focus-ring-color),
    0 14px 34px rgba(0, 0, 0, 0.28);
}

#chapter-panel {
  scroll-margin-top: 92px;
}

body.reading-mode #chapter-panel {
  scroll-margin-top: 28px;
}

.exercise-kind {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.exercise-kind-application {
  background: #eff6ff;
  color: #1e3a8a;
}

.exercise-kind-methode {
  background: #f5f3ff;
  color: #6d28d9;
}

.exercise-kind-probleme {
  background: #fef2f2;
  color: #b91c1c;
}

body.visual-comfort-mode .exercise-kind-application,
body.visual-comfort-mode .exercise-kind-methode,
body.visual-comfort-mode .exercise-kind-probleme {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

body.visual-comfort-mode .exercise-kind-application {
  color: #93c5fd;
}

body.visual-comfort-mode .exercise-kind-methode {
  color: #c4b5fd;
}

body.visual-comfort-mode .exercise-kind-probleme {
  color: #fca5a5;
}

body.visual-comfort-mode .pedagogic-figure-title {
  color: #7dd3fc;
}

body.visual-comfort-mode .pedagogic-figure-frame {
  border-color: rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(
      circle at top right,
      rgba(56, 189, 248, 0.1),
      transparent 35%
    ),
    rgba(15, 23, 42, 0.92);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

body.visual-comfort-mode .pedagogic-figure-caption {
  color: #cbd5e1;
}

/* =====================================
   Figures pédagogiques
   ===================================== */

.pedagogic-figure {
  margin: 1.75rem 0 2rem;
}

.pedagogic-figure-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.65rem;
}

.pedagogic-figure-title {
  color: var(--maths-primary-dark);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.pedagogic-figure-frame {
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(23, 78, 166, 0.14);
  border-radius: 22px;
  background:
    radial-gradient(
      circle at top right,
      rgba(0, 168, 132, 0.07),
      transparent 35%
    ),
    #f8fbff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.07);
}

.pedagogic-figure-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 14px;
  background: #ffffff;
}

.pedagogic-figure-caption {
  margin-top: 12px;
  padding: 0 6px;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.65;
  font-weight: 600;
}

.pedagogic-figure-caption > :last-child {
  margin-bottom: 0;
}

.pedagogic-figure-error {
  border-color: rgba(185, 28, 28, 0.2);
}

/* =====================================
   Tableaux de variations et courbes
   ===================================== */

.variation-object,
.curve-object {
  margin: 1.75rem 0 2rem;
}

.variation-title,
.curve-title {
  margin-bottom: 0.65rem;
  color: var(--maths-primary-dark);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.variation-table-wrap,
.curve-frame {
  overflow-x: auto;
  border: 1px solid rgba(23, 78, 166, 0.16);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.07);
}

.variation-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
  color: #0f172a;
}

.variation-table th,
.variation-table td {
  min-width: 74px;
  padding: 0.8rem 0.7rem;
  border-right: 1px solid #dbe4ee;
  border-bottom: 1px solid #dbe4ee;
  text-align: center;
  vertical-align: middle;
}

.variation-table th {
  width: 145px;
  background: #eaf2ff;
  color: #12385b;
  font-weight: 900;
}

.variation-table tr:last-child th,
.variation-table tr:last-child td {
  border-bottom: 0;
}

.variation-table td:last-child {
  border-right: 0;
}

.variation-row-sign td {
  background: #f8fafc;
  font-weight: 800;
}

.variation-value {
  color: #12385b;
  font-weight: 800;
}

.variation-direction {
  color: #087d5b;
  font-size: 2.45rem;
  font-weight: 900;
  line-height: 1;
}

.variation-direction-down {
  color: #b45309;
}

.curve-frame {
  overflow: hidden;
  padding: 12px;
  background:
    radial-gradient(circle at top right, rgba(0, 168, 132, 0.07), transparent 35%),
    #f8fbff;
}

.curve-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
}

.curve-background {
  fill: #ffffff;
  stroke: #dbe4ee;
  stroke-width: 2;
}

.curve-grid {
  stroke: #dce6f1;
  stroke-width: 1.5;
}

.curve-axis {
  stroke: #173b70;
  stroke-width: 3;
}

.curve-line {
  fill: none;
  stroke: #2456d6;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.curve-axis-label {
  fill: #123a74;
  font: 800 24px "Inter", "Segoe UI", Arial, sans-serif;
}

.curve-expression {
  padding: 0.85rem 1rem 0.2rem;
  color: #334155;
  text-align: center;
  font-weight: 700;
}

body.visual-comfort-mode .variation-title,
body.visual-comfort-mode .curve-title {
  color: #7dd3fc;
}

body.visual-comfort-mode .variation-table-wrap,
body.visual-comfort-mode .curve-frame {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.92);
}

body.visual-comfort-mode .variation-table {
  color: #e2e8f0;
}

body.visual-comfort-mode .variation-table th,
body.visual-comfort-mode .variation-row-sign td {
  background: rgba(30, 41, 59, 0.96);
  color: #dbeafe;
}

/* =========================================================
   Tableaux Markdown
   ========================================================= */

.markdown-table-wrap {
  width: 100%;
  margin: 1.4rem 0;
  overflow-x: auto;
  border: 1px solid #dbe4ee;
  border-radius: 14px;
  background: #ffffff;
}

.markdown-table {
  width: 100%;
  min-width: 540px;
  border-collapse: separate;
  border-spacing: 0;
  color: #0f172a;
}

.markdown-table th,
.markdown-table td {
  padding: 0.85rem 1rem;
  border-right: 1px solid #dbe4ee;
  border-bottom: 1px solid #dbe4ee;
  vertical-align: middle;
}

.markdown-table th:last-child,
.markdown-table td:last-child {
  border-right: 0;
}

.markdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.markdown-table th {
  background: #eff6ff;
  color: #12385b;
  font-size: 0.92rem;
  font-weight: 800;
}

.markdown-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.markdown-table th > p,
.markdown-table td > p {
  margin: 0;
}

.markdown-table-align-left {
  text-align: left;
}

.markdown-table-align-center {
  text-align: center;
}

.markdown-table-align-right {
  text-align: right;
}

/* =====================================
   Favoris
   ===================================== */
.favorite-control {
  display: inline-flex;
}

.favorite-button {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
}

.favorite-button-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.favorite-button.is-favorite {
  color: #6b4900;
}

.favorites-page {
  display: grid;
  gap: 1.5rem;
}

.favorites-header {
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  background: linear-gradient(135deg, #fffbea, #ffffff);
}

.favorites-header h1 {
  margin: .25rem 0 .5rem;
  font-weight: 850;
}

.favorites-header p {
  margin: 0;
  color: #64748b;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1rem;
}

.favorite-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.favorite-card-title {
  margin: .25rem 0 .5rem;
  font-size: 1.15rem;
  font-weight: 850;
}

.favorite-card-summary {
  margin: 0;
  color: #64748b;
}

.favorite-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.favorites-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  text-align: center;
  background: #f8fafc;
}

.favorites-empty-icon {
  margin-bottom: .75rem;
  color: #d39e00;
  font-size: 2.5rem;
}

.favorite-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.favorite-resource-context {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.favorite-exercise-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.favorite-exercise-id,
.favorite-exercise-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0.25rem 0.6rem;
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #52637a;
  font-size: 0.72rem;
  font-weight: 750;
}

.favorite-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.exercise-card {
  scroll-margin-top: calc(var(--app-navbar-height, 82px) + 1.25rem);
}

.favorites-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.favorites-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid #dce5f1;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.06);
}

.favorites-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.favorite-filter-button {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.favorite-filter-count {
  margin-left: 0.25rem;
  opacity: 0.78;
  font-size: 0.8em;
}

.favorites-filter-summary {
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.favorites-filter-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1.25rem;
  text-align: center;
  background: #f8fafc;
}

.favorite-card {
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.favorite-card:not(.d-none):hover {
  transform: translateY(-2px);
}

@media (max-width: 700px) {
  .favorites-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .favorites-filter-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .favorite-filter-button {
    justify-content: center;
    width: 100%;
  }

  .favorites-filter-summary {
    text-align: center;
  }
}

/* =====================================
   Authentification
   ===================================== */
.auth-area {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.auth-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.4rem 0.45rem 0.4rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.auth-avatar {
  display: flex;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  font-size: 1.2rem;
}

.auth-user-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-right: 0.35rem;
  line-height: 1.1;
}

.auth-user-name {
  max-width: 190px;
  overflow: hidden;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-role {
  width: fit-content;
  margin-top: 0.28rem;
  padding: 0.18rem 0.48rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.auth-logout-button,
.auth-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 38px;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.auth-logout-button:hover,
.auth-login-button:hover {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
  transform: translateY(-1px);
}

.auth-logout-button:active,
.auth-login-button:active {
  transform: translateY(0);
}

.auth-logout-button:focus-visible,
.auth-login-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.45);
  outline-offset: 3px;
}

.auth-logout-button {
  cursor: pointer;
}

.auth-logout-button .bi,
.auth-login-button .bi {
  font-size: 1rem;
}

@media (max-width: 991.98px) {
  .auth-area {
    width: 100%;
    margin-top: 0.8rem;
  }

  .auth-user-card {
    width: 100%;
  }

  .auth-user-details {
    flex: 1;
  }

  .auth-user-name {
    max-width: none;
  }
}

@media (max-width: 575.98px) {
  .auth-user-card {
    gap: 0.6rem;
  }

  .auth-avatar {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .auth-logout-label {
    display: none;
  }

  .auth-logout-button {
    width: 38px;
    padding: 0;
  }
}

/* =====================================
   Recherche Globale
   ===================================== */
.global-search-results {
  width: min(520px, calc(100vw - 2rem));
  max-height: min(70vh, 620px);
  overflow-y: auto;
  border: 1px solid #dce5f1;
  border-radius: 1rem;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}

.global-search-summary {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #e7edf5;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.global-search-list {
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
}

.global-search-result {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.75rem;
  border-radius: 0.8rem;
  color: #0f172a;
  text-decoration: none;
}

.global-search-result:hover,
.global-search-result:focus-visible {
  background: #f1f5ff;
  color: #0f172a;
  outline: none;
}

.global-search-result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 0.7rem;
  background: #eef4ff;
  color: #174ea6;
}

.global-search-result-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.18rem;
}

.global-search-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.global-search-result-title {
  font-weight: 850;
  line-height: 1.25;
}

.global-search-result-type {
  flex: 0 0 auto;
  padding: 0.17rem 0.42rem;
  border-radius: 999px;
  background: #e8eef8;
  color: #52637a;
  font-size: 0.64rem;
  font-weight: 850;
  text-transform: uppercase;
}

.global-search-result-type-problem {
  background: #fff1d6;
  color: #915c00;
}

.global-search-result-type-exercise {
  background: #e8f7ef;
  color: #137047;
}

.global-search-result-type-section {
  background: #f0ebff;
  color: #6440a5;
}

.global-search-result-subtitle {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
}

.global-search-result-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: #52637a;
  font-size: 0.75rem;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.global-search-empty {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #ffffff;
  color: #64748b;
  font-size: 0.85rem;
  font-weight: 700;
}

.markdown-heading[id] {
  scroll-margin-top: calc(var(--app-navbar-height, 82px) + 7rem);
}

.markdown-heading[id],
.exercise-card[id] {
  scroll-margin-top: 8rem;
}

.global-search {
  position: relative;
  width: 100%;
  min-width: 0;
}

.global-search-input-wrapper {
  position: relative;
}

.global-search-input {
  min-height: 2.65rem;
  padding-right: 2.75rem;
  padding-left: 2.65rem;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.96);
}

.global-search-input:focus {
  border-color: rgba(37, 99, 235, 0.5);
  background: #fff;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.global-search-input-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 1rem;
  color: #64748b;
  transform: translateY(-50%);
  pointer-events: none;
}

.global-search-spinner {
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
}

.global-search-results {
  display: none;
  position: absolute;
  z-index: 1080;
  top: calc(100% + 0.6rem);
  right: 0;
  left: auto;

  width: min(44rem, calc(100vw - 2rem));
  max-height: min(70vh, 40rem);

  overflow-y: auto;
  border: 1px solid #dce5f1;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

.global-search-open .global-search-results {
  display: block;
}

.global-search-filter-panel {
  padding: 0.8rem 0.9rem 0.9rem;
  border-bottom: 1px solid #e7edf5;
  background: #f8fafc;
}

.global-search-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 850;
}

.global-search-filter-reset {
  padding: 0;
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 800;
}

.global-search-filter-reset:hover,
.global-search-filter-reset:focus-visible {
  color: #1d4ed8;
  text-decoration: underline;
}

.global-search-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.65rem;
}

.global-search-filter-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
}

.global-search-filter-label {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.global-search-filter-select {
  width: 100%;
  min-height: 2.15rem;
  padding: 0.35rem 1.8rem 0.35rem 0.55rem;
  border: 1px solid #d7e0ec;
  border-radius: 0.55rem;
  background-color: #fff;
  color: #1e293b;
  font-size: 0.76rem;
  font-weight: 700;
}

.global-search-filter-select:focus-visible {
  border-color: #2563eb;
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.global-search-result-summary {
  display: flex;
  position: sticky;
  z-index: 2;
  top: 0;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #e7edf5;
  background: rgba(255, 255, 255, 0.96);
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.global-search-keyboard-help {
  font-weight: 600;
}

.global-search-result-list {
  display: flex;
  flex-direction: column;
  padding: 0.4rem;
}

.global-search-result {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.8rem;
  color: #0f172a;
  text-decoration: none;
}

.global-search-result:hover,
.global-search-result:focus-visible,
.global-search-result.is-active {
  background: #eff6ff;
  color: #0f172a;
  outline: none;
}

.global-search-result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: #eaf1ff;
  color: #174ea6;
}

.global-search-result-icon-section {
  background: #f0ebff;
  color: #6d42aa;
}

.global-search-result-icon-exercise {
  background: #e8f7ef;
  color: #137047;
}

.global-search-result-icon-problem {
  background: #fff1d6;
  color: #915c00;
}

.global-search-result-content {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.18rem;
}

.global-search-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.global-search-result-title {
  overflow: hidden;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.global-search-result-type {
  flex: 0 0 auto;
  padding: 0.16rem 0.42rem;
  border-radius: 999px;
  background: #e8eef8;
  color: #52637a;
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}

.global-search-result-type-section {
  background: #f0ebff;
  color: #6440a5;
}

.global-search-result-type-exercise {
  background: #e8f7ef;
  color: #137047;
}

.global-search-result-type-problem {
  background: #fff1d6;
  color: #915c00;
}

.global-search-result-subtitle {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
}

.global-search-result-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: #52637a;
  font-size: 0.75rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.global-search-highlight {
  padding: 0.02em 0.12em;
  border-radius: 0.22em;
  background: #fde68a;
  color: inherit;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.global-search-result:hover .global-search-highlight,
.global-search-result:focus-visible .global-search-highlight,
.global-search-result.is-active .global-search-highlight {
  background: #fcd34d;
}

.global-search-view-all {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e7edf5;
  text-align: center;
}

.global-search-view-all a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--maths-primary);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.global-search-view-all a:hover,
.global-search-view-all a:focus-visible {
  text-decoration: underline;
}

.global-search-message {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 700;
}

/* =====================================
   Page complète de recherche
   ===================================== */
.search-page {
  display: grid;
  width: min(1180px, 100%);
  margin: 0 auto;
  gap: 1.35rem;
}

.search-page-header,
.search-page-form,
.search-page-results-section,
.search-page-state {
  border: 1px solid var(--maths-border);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.07);
}

.search-page-header {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background:
    radial-gradient(circle at top right, rgba(0, 168, 132, 0.10), transparent 34%),
    linear-gradient(135deg, #ffffff, #f7faff);
}

.search-page-header h1 {
  margin: 0.25rem 0 0.65rem;
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 900;
}

.search-page-header p {
  max-width: 52rem;
  margin: 0;
  color: var(--maths-muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.search-page-form {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.search-page-query-field {
  position: relative;
  display: block;
}

.search-page-query-field .bi {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 1rem;
  color: #64748b;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-page-query-field .form-control {
  min-height: 3.25rem;
  padding-left: 2.8rem;
  border-radius: 1rem;
  font-size: 1rem;
}

.search-page-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem;
}

.search-page-filter-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.3rem;
}

.search-page-filter-label {
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-page-filter-select {
  min-width: 0;
  border-radius: 0.8rem;
  font-size: 0.86rem;
}

.search-page-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.search-page-form-actions .btn {
  border-radius: 999px;
  font-weight: 800;
}

.search-page-results-section {
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.search-page-results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-page-results-header h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
  font-weight: 900;
}

.search-page-results-range {
  flex: 0 0 auto;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--maths-primary-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.search-page-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.search-page-result {
  min-height: 100%;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.search-page-result:hover,
.search-page-result:focus-visible {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.10);
  transform: translateY(-1px);
}

.search-page-result .global-search-result-excerpt {
  -webkit-line-clamp: 3;
}

.search-page-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.search-page-pagination-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  min-height: 2.7rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--maths-primary-dark);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.search-page-pagination-link:last-child {
  justify-self: end;
}

.search-page-pagination-link:not(.is-disabled):hover,
.search-page-pagination-link:not(.is-disabled):focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
}

.search-page-pagination-link.is-disabled {
  color: #94a3b8;
  cursor: default;
}

.search-page-pagination-status {
  color: #475569;
  font-size: 0.84rem;
  font-weight: 850;
  text-align: center;
}

.search-page-state {
  display: grid;
  place-items: center;
  min-height: 17rem;
  padding: 2rem;
  text-align: center;
}

.search-page-state .bi {
  color: #7c93b4;
  font-size: 2rem;
}

.search-page-state h2 {
  margin: 0.75rem 0 0.35rem;
  font-weight: 900;
}

.search-page-state p {
  max-width: 34rem;
  margin: 0;
  color: #64748b;
}

@media (max-width: 920px) {
  .search-page-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-page-results {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .search-page {
    gap: 1rem;
  }

  .search-page-header,
  .search-page-form,
  .search-page-results-section,
  .search-page-state {
    border-radius: 1.15rem;
  }

  .search-page-filter-grid {
    grid-template-columns: 1fr;
  }

  .search-page-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-page-results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-page-pagination {
    grid-template-columns: 1fr 1fr;
  }

  .search-page-pagination-status {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-width: 900px) {
  .global-search {
    width: 100%;
  }

  .global-search-keyboard-help {
    display: none;
  }

  .global-search-results {
    position: fixed;
    top: 4.75rem;
    right: 1rem;
    left: 1rem;
    width: auto;
    max-height: calc(100vh - 6rem);
  }
}

@media (max-width: 600px) {
  .global-search-filter-grid {
    grid-template-columns: 1fr;
  }
}

.app-navbar-inner {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: clamp(0.75rem, 1.1vw, 1.4rem);
}

.app-navbar-brand {
  flex: 0 0 auto;
  white-space: nowrap;
}

.app-navbar-links {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: nowrap;
  gap: clamp(0.7rem, 0.9vw, 1.2rem);
}

.app-navbar-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.app-navbar-search {
  flex: 1 1 26rem;
  min-width: 15rem;
  max-width: 31rem;
}

.app-navbar-user {
  flex: 0 0 auto;
  min-width: 0;
}

.app-navbar-user-name {
  display: block;
  max-width: 11rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 1600px) {
  .app-navbar-inner {
    gap: 0.75rem;
  }

  .app-navbar-links {
    gap: 0.7rem;
  }

  .app-navbar-search {
    min-width: 13rem;
    max-width: 25rem;
  }

  .global-search-input {
    font-size: 0.9rem;
  }

  .app-navbar-user-name {
    max-width: 8rem;
  }
}

@media (max-width: 1200px) {
  .app-navbar-inner {
    flex-wrap: wrap;
  }

  .app-navbar-search {
    order: 10;
    flex: 1 0 100%;
    max-width: none;
  }

  .global-search-results {
    right: 0;
    left: 0;
    width: 100%;
  }
}

/* =====================================
   Navigation responsive unifiée
   ===================================== */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sidebar-close {
  display: none;
  flex: 0 0 2.5rem;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(23, 78, 166, 0.16);
  border-radius: 50%;
  background: #f1f5ff;
  color: var(--maths-primary-dark);
}

.sidebar-close:focus-visible {
  outline: 3px solid var(--focus-ring-color);
  outline-offset: 2px;
}

/*
 * De 1101 à 2100 px, les enfants du bloc Bootstrap participent directement
 * à la grille de la navbar. La recherche dispose ainsi d'une ligne complète
 * sans pousser le compte utilisateur hors de l'écran, y compris sur un
 * laptop utilisant une mise à l'échelle système élevée.
 */
@media (min-width: 1101px) and (max-width: 2100px) {
  :root {
    --app-navbar-height: 9.25rem;
  }

  .premium-nav > .app-navbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand navigation"
      "search user";
    gap: 0.65rem 1.25rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .app-navbar-brand {
    grid-area: brand;
    min-width: 0;
  }

  .premium-nav .app-navbar-links {
    display: contents !important;
  }

  .app-navbar-links .navbar-nav {
    grid-area: navigation;
    margin: 0 !important;
  }

  .app-navbar-search {
    grid-area: search;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .app-navbar-user {
    grid-area: user;
    margin: 0;
  }

  .app-shell {
    padding-top: calc(var(--app-navbar-height) + 1.5rem);
  }
}

/*
 * Les petites tablettes en mode paysage utilisent trois lignes maîtrisées.
 * Cette zone évite tout débordement au voisinage du breakpoint Bootstrap lg.
 */
@media (min-width: 992px) and (max-width: 1100px) {
  :root {
    --app-navbar-height: 11.25rem;
  }

  .premium-nav > .app-navbar-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .premium-nav .app-navbar-links {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "navigation user"
      "search search";
    width: 100%;
    gap: 0.6rem 1rem;
  }

  .app-navbar-links .navbar-nav {
    grid-area: navigation;
    margin: 0 !important;
  }

  .app-navbar-search {
    grid-area: search;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .app-navbar-user {
    grid-area: user;
    margin: 0;
  }

  .app-shell {
    padding-top: calc(var(--app-navbar-height) + 1.25rem);
  }
}

@media (max-width: 991.98px) {
  :root {
    --app-navbar-height: 8.4rem;
  }

  .premium-nav {
    min-height: 0;
    padding: 0.55rem 0;
  }

  .premium-nav > .app-navbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding-right: 1rem !important;
    padding-left: 1rem !important;
  }

  .app-navbar-brand {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: clamp(1rem, 3.4vw, 1.35rem);
  }

  .app-navbar-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-navbar-badge {
    flex: 0 0 auto;
    font-size: 0.72em;
  }

  .app-navbar-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 0.9rem;
  }

  /*
   * Le conteneur reste rendu lorsque Bootstrap le replie : seuls les liens et
   * le compte sont masqués. La recherche reste donc toujours disponible.
   */
  .app-navbar-links.collapse,
  .app-navbar-links.collapsing {
    display: flex !important;
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    height: auto !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    transition: none;
  }

  .app-navbar-links:not(.show):not(.collapsing) > .navbar-nav,
  .app-navbar-links:not(.show):not(.collapsing) > .app-navbar-user {
    display: none;
  }

  .app-navbar-search {
    order: -1;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .app-navbar-links .navbar-nav {
    width: 100%;
    margin: 0 !important;
    padding: 0.25rem 0;
  }

  .app-navbar-link,
  .app-navbar-links .nav-link {
    min-height: 2.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
  }

  .app-navbar-links .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
  }

  .app-navbar-user {
    width: 100%;
    margin: 0;
  }

  .auth-area,
  .auth-user-card {
    width: 100%;
    margin-top: 0;
  }

  .app-navbar-links.show,
  .app-navbar-links.collapsing {
    max-height: calc(100dvh - 4.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 0.25rem;
  }

  .global-search-results {
    top: calc(var(--app-navbar-height) - 0.15rem);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    max-height: calc(100dvh - var(--app-navbar-height) - 1rem);
  }

  .app-shell {
    padding-top: calc(var(--app-navbar-height) + 1rem) !important;
  }

  .sidebar-toggle {
    top: calc(var(--app-navbar-height) + 0.5rem);
    width: fit-content;
    max-width: 100%;
    margin-bottom: 1rem;
  }

  .chapter-sidebar {
    z-index: 1100;
    padding-top: max(1rem, env(safe-area-inset-top));
  }

  .sidebar-backdrop {
    z-index: 1090;
  }

  .sidebar-close {
    display: inline-flex;
  }
}

@media (min-width: 700px) and (max-width: 991.98px) and (orientation: landscape) {
  .app-navbar-links.show > .navbar-nav,
  .app-navbar-links.collapsing > .navbar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.2rem 0.5rem;
  }
}

@media (max-width: 575.98px) {
  :root {
    --app-navbar-height: 8rem;
  }

  .app-navbar-badge {
    display: none;
  }

  .brand-mark {
    flex: 0 0 2.4rem;
    width: 2.4rem;
    height: 2.4rem;
    margin-right: 0.55rem !important;
  }

  .app-navbar-brand {
    font-size: 1.05rem;
  }

  .app-navbar-toggler {
    width: 2.75rem;
    height: 2.75rem;
  }

  .global-search-input {
    min-height: 2.55rem;
    font-size: 0.9rem;
  }

  .app-shell {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }
}

/* Administration commerciale et licences institutionnelles */
.admin-commercial-section,
.admin-seat-section {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid #dbe5f3;
}

.admin-period-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.48rem 0.78rem;
  border: 1px solid #cddbed;
  border-radius: 999px;
  color: #29486f;
  background: #f5f8fc;
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-commercial-kpis,
.admin-seat-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.admin-commercial-kpi {
  display: grid;
  gap: 0.32rem;
  padding: 1.1rem;
  border: 1px solid #dbe5f3;
  border-radius: 1.15rem;
  background: linear-gradient(145deg, #ffffff 0%, #f7faff 100%);
}

.admin-commercial-kpi > span {
  color: #52627a;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-commercial-kpi strong {
  color: #0d3575;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.2;
}

.admin-commercial-kpi small,
.admin-retention-value span,
.admin-revenue-row small,
.admin-seat-table td small {
  color: #65758b;
  font-size: 0.8rem;
}

.admin-commercial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.65fr);
  gap: 1rem;
}

.admin-funnel {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.admin-funnel-step {
  display: grid;
  gap: 0.2rem;
  padding: 0.9rem;
  border-radius: 0.9rem;
  background: #f3f7fc;
  text-align: center;
}

.admin-funnel-step.is-success {
  background: #e3f7f0;
}

.admin-funnel-step strong {
  color: #0d3575;
  font-size: 1.45rem;
}

.admin-funnel-step.is-success strong {
  color: #006b54;
}

.admin-funnel-step span,
.admin-rate-grid span {
  color: #65758b;
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-funnel-arrow {
  color: #8ca0bb;
  font-size: 1.35rem;
  font-weight: 900;
}

.admin-rate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.admin-rate-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid #e1e9f4;
  border-radius: 0.75rem;
}

.admin-rate-grid strong {
  color: #173d75;
}

.admin-retention-value {
  display: grid;
  gap: 0.35rem;
  margin-top: 1.15rem;
}

.admin-retention-value strong {
  color: #0d3575;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1;
}

.admin-revenue-trend {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.admin-revenue-row {
  display: grid;
  grid-template-columns: minmax(5rem, 0.32fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 0.8rem;
  background: #f7f9fc;
}

.admin-revenue-row > span {
  color: #52627a;
  font-weight: 800;
}

.admin-revenue-row > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.admin-revenue-row strong {
  color: #173d75;
}

.admin-payment-kpi.is-overage {
  border-color: #efbbc3;
  background: #fff7f8;
}

.admin-payment-kpi.is-overage strong,
.admin-payment-kpi.is-overage span {
  color: #9f1d2d;
}

.admin-seat-alert {
  margin: 0 0 1rem;
}

.admin-seat-table td:first-child {
  display: grid;
  gap: 0.18rem;
  min-width: 14rem;
}

.admin-seat-action {
  margin: 0;
}

.admin-seat-action button {
  min-width: 6.7rem;
}

@media (max-width: 1000px) {
  .admin-commercial-kpis,
  .admin-seat-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-commercial-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .admin-commercial-kpis,
  .admin-seat-kpis,
  .admin-rate-grid {
    grid-template-columns: 1fr;
  }

  .admin-funnel {
    grid-template-columns: 1fr;
  }

  .admin-funnel-arrow {
    transform: rotate(90deg);
    text-align: center;
  }

  .admin-revenue-row,
  .admin-revenue-row > div {
    grid-template-columns: 1fr;
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =====================================
   Plateforme back-office
   ===================================== */
.platform-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
}

.platform-kpi-card {
  min-width: 0;
  min-height: 132px;
  padding: 1.35rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 1.35rem;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.platform-kpi-value {
  display: block;
  color: #1553aa;
  font-size: clamp(1.8rem, 2.3vw, 2.65rem);
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-kpi-label {
  display: block;
  margin-top: 0.75rem;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
}

@media (max-width: 1399.98px) {
  .platform-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .platform-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 479.98px) {
  .platform-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.platform-tenant-domain {
  color: #d81b78;
  font-family: var(--bs-font-monospace);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.platform-tenant-name {
  color: inherit;
  text-decoration: none;
}

.platform-tenant-name:hover {
  color: #1553aa;
  text-decoration: underline;
}

.platform-detail-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.platform-detail-panel {
  padding: 1.5rem;
  border: 1px solid #dce3ec;
  border-radius: 1.25rem;
  background: #fff;
}

.platform-detail-list {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.2fr);
  gap: 0.75rem 1rem;
  margin: 1.25rem 0 0;
}

.platform-detail-list dt {
  color: #64748b;
  font-weight: 600;
}

.platform-detail-list dd {
  margin: 0;
  color: #0f172a;
  font-weight: 700;
}

.platform-kpi-card.is-danger {
  border-color: #fecaca;
  background: #fff7f7;
}

.platform-kpi-card.is-danger .platform-kpi-value {
  color: #b91c1c;
}

.platform-audit-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.platform-audit-list li {
  padding: 0.9rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.platform-audit-list li:last-child {
  border-bottom: 0;
}

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

@media (max-width: 575.98px) {
  .platform-detail-kpis {
    grid-template-columns: 1fr;
  }

  .platform-detail-list {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .platform-detail-list dd {
    margin-bottom: 0.75rem;
  }
}

.platform-reconciliation-action {
  min-width: 230px;
}

.platform-reconciliation-action > summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
}

.platform-reconciliation-action > summary::-webkit-details-marker {
  display: none;
}

.platform-reconciliation-action[open] {
  padding: 0.75rem;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.platform-danger-action {
  max-width: 680px;
}

.platform-danger-action > summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
}

.platform-danger-action > summary::-webkit-details-marker {
  display: none;
}

.platform-danger-action[open] {
  padding: 1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.platform-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.platform-subnav-link {
  padding: 0.65rem 1rem;
  border-radius: 0.8rem;
  color: #475569;
  font-weight: 700;
  text-decoration: none;
}

.platform-subnav-link:hover {
  color: #1553aa;
  background: #eff6ff;
}

.platform-subnav-link.active {
  color: #1553aa;
  background: #dbeafe;
}

.platform-audit-count {
  min-width: 130px;
  padding: 0.8rem 1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
  text-align: center;
}

.platform-audit-count strong {
  display: block;
  color: #1553aa;
  font-size: 1.6rem;
  line-height: 1;
}

.platform-audit-count span {
  display: block;
  margin-top: 0.35rem;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.platform-audit-filters {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.5fr)
    minmax(220px, 1.2fr)
    minmax(220px, 1.2fr)
    minmax(145px, 0.7fr)
    minmax(145px, 0.7fr);
  gap: 1rem;
  align-items: end;
}

.platform-audit-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
}

.platform-audit-table td {
  vertical-align: middle;
}

.platform-audit-reason {
  min-width: 240px;
  max-width: 420px;
}

.platform-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.platform-audit-json {
  max-height: 420px;
  margin-bottom: 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.platform-audit-user-agent {
  overflow-wrap: anywhere;
}

@media (max-width: 1199.98px) {
  .platform-audit-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .platform-audit-filters {
    grid-template-columns: 1fr;
  }

  .platform-audit-filter-actions {
    flex-direction: column;
  }

  .platform-pagination {
    justify-content: space-between;
  }
}

.teacher-dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.teacher-dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.teacher-dashboard-hero h1 {
  margin-bottom: 0.65rem;
}

.teacher-dashboard-hero p {
  max-width: 720px;
  margin-bottom: 0;
  color: #64748b;
}

.teacher-dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.teacher-dashboard-section {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.teacher-dashboard-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.teacher-dashboard-section-header h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.teacher-dashboard-section-header p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-dashboard-privacy {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.teacher-dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-dashboard-kpi {
  min-width: 0;
  padding: 1.3rem;
  border: 1px solid #dce3ec;
  border-radius: 1.15rem;
  background: #f8fafc;
}

.teacher-dashboard-kpi strong {
  display: block;
  color: #1553aa;
  font-size: clamp(1.75rem, 2vw, 2.35rem);
  font-weight: 850;
  line-height: 1;
}

.teacher-dashboard-kpi span {
  display: block;
  margin-top: 0.7rem;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.3;
  text-transform: uppercase;
}

.teacher-dashboard-kpis-secondary .teacher-dashboard-kpi {
  background: #fff;
}

.teacher-dashboard-all-link {
  color: #1553aa;
  font-weight: 750;
  text-decoration: none;
}

.teacher-dashboard-all-link:hover {
  text-decoration: underline;
}

.teacher-dashboard-series-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-dashboard-series-card {
  display: flex;
  min-width: 0;
  min-height: 220px;
  padding: 1.25rem;
  border: 1px solid #dce3ec;
  border-radius: 1.15rem;
  background: #fff;
  flex-direction: column;
}

.teacher-dashboard-series-card-header,
.teacher-dashboard-series-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.teacher-dashboard-series-card h3 {
  margin: 1rem 0;
  font-size: 1.05rem;
}

.teacher-dashboard-series-type {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.teacher-dashboard-status {
  display: inline-flex;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.teacher-dashboard-status.is-draft {
  background: #fef3c7;
  color: #92400e;
}

.teacher-dashboard-status.is-ready {
  background: #dcfce7;
  color: #166534;
}

.teacher-dashboard-status.is-archived {
  background: #e2e8f0;
  color: #475569;
}

.teacher-dashboard-series-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  color: #64748b;
  font-size: 0.8rem;
}

.teacher-dashboard-series-card-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.teacher-dashboard-series-card-footer small {
  color: #64748b;
}

.teacher-dashboard-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1.15rem;
  text-align: center;
}

.teacher-dashboard-empty > i {
  color: #1553aa;
  font-size: 2.4rem;
}

.teacher-dashboard-empty h3 {
  margin-top: 1rem;
}

.teacher-dashboard-empty p {
  color: #64748b;
}

.teacher-dashboard-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-dashboard-shortcut {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid #dce3ec;
  border-radius: 1.15rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease;
}

.teacher-dashboard-shortcut:hover {
  border-color: #1553aa;
  color: inherit;
  transform: translateY(-2px);
}

.teacher-dashboard-shortcut > i {
  color: #1553aa;
  font-size: 1.7rem;
}

.teacher-dashboard-shortcut strong,
.teacher-dashboard-shortcut span {
  display: block;
}

.teacher-dashboard-shortcut span {
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.84rem;
}

@media (max-width: 1199.98px) {
  .teacher-dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .teacher-dashboard-series-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .teacher-dashboard-hero,
  .teacher-dashboard-section-header {
    flex-direction: column;
  }

  .teacher-dashboard-kpis,
  .teacher-dashboard-series-grid,
  .teacher-dashboard-shortcuts {
    grid-template-columns: 1fr;
  }

  .teacher-dashboard-actions {
    width: 100%;
  }

  .teacher-dashboard-actions .btn {
    flex: 1 1 auto;
  }
}

.teacher-classes-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.teacher-classes-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.teacher-classes-header h1 {
  margin-bottom: 0.65rem;
}

.teacher-classes-header p {
  max-width: 760px;
  margin-bottom: 0;
  color: #64748b;
}

.teacher-classes-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.teacher-classes-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border: 1px solid;
  border-radius: 1rem;
  font-weight: 650;
}

.teacher-classes-notice.is-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.teacher-classes-notice.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.teacher-classes-panel {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.teacher-classes-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.teacher-classes-panel-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.teacher-classes-panel-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-classes-year-filter {
  min-width: 260px;
}

.teacher-classes-create-box {
  margin-bottom: 1.5rem;
}

.teacher-classes-create-box > summary,
.teacher-group-create > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.teacher-classes-create-box > summary::-webkit-details-marker,
.teacher-group-create > summary::-webkit-details-marker {
  display: none;
}

.teacher-classes-create-box[open] {
  padding: 1.25rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.teacher-classes-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-classes-form-wide,
.teacher-classes-form-actions,
.teacher-classes-form-checkbox {
  grid-column: 1 / -1;
}

.teacher-classes-form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.teacher-classes-form-actions {
  display: flex;
  justify-content: flex-end;
}

.teacher-classes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.teacher-class-card {
  display: flex;
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid #dce3ec;
  border-radius: 1.25rem;
  background: #fff;
  flex-direction: column;
}

.teacher-class-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.teacher-class-card-header h2 {
  margin: 0.35rem 0;
  font-size: 1.2rem;
}

.teacher-class-card-header p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-class-code {
  color: #1553aa;
  font-family: var(--bs-font-monospace);
  font-size: 0.78rem;
  font-weight: 800;
}

.teacher-class-role {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: #eff6ff;
  color: #1553aa;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.teacher-class-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.teacher-class-metrics > div {
  padding: 0.9rem;
  border-radius: 0.9rem;
  background: #f8fafc;
}

.teacher-class-metrics strong,
.teacher-class-metrics span {
  display: block;
}

.teacher-class-metrics strong {
  color: #1553aa;
  font-size: 1.35rem;
}

.teacher-class-metrics span {
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.teacher-class-groups {
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.teacher-class-groups-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.teacher-class-groups-heading h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.teacher-group-create[open] {
  min-width: 320px;
  padding: 0.8rem;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.teacher-group-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.teacher-group-form-wide,
.teacher-group-form-actions {
  grid-column: 1 / -1;
}

.teacher-group-form-actions {
  display: flex;
  justify-content: flex-end;
}

.teacher-group-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.teacher-group-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.teacher-group-list li:last-child {
  border-bottom: 0;
}

.teacher-group-type {
  display: block;
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.78rem;
}

.teacher-group-count {
  text-align: right;
}

.teacher-group-count strong,
.teacher-group-count span {
  display: block;
}

.teacher-group-count strong {
  color: #1553aa;
}

.teacher-group-count span {
  color: #64748b;
  font-size: 0.72rem;
}

.teacher-groups-empty {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.85rem;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.85rem;
  text-align: center;
}

.teacher-class-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.25rem;
}

.teacher-class-card-footer small {
  color: #64748b;
}

.teacher-classes-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1.15rem;
  text-align: center;
}

.teacher-classes-empty > i {
  color: #1553aa;
  font-size: 2.3rem;
}

.teacher-classes-empty h3 {
  margin-top: 1rem;
}

.teacher-classes-empty p {
  margin-bottom: 0;
  color: #64748b;
}

@media (max-width: 1199.98px) {
  .teacher-classes-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-classes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .teacher-classes-header,
  .teacher-classes-panel-heading,
  .teacher-class-card-header,
  .teacher-class-card-footer {
    flex-direction: column;
  }

  .teacher-classes-header-actions,
  .teacher-classes-year-filter {
    width: 100%;
  }

  .teacher-classes-form,
  .teacher-group-form {
    grid-template-columns: 1fr;
  }

  .teacher-group-create[open] {
    min-width: 0;
  }
}

.teacher-roster-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.teacher-roster-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.teacher-roster-header h1 {
  margin-bottom: 0.4rem;
}

.teacher-roster-header p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-roster-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-roster-kpis article {
  min-width: 0;
  padding: 1.15rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.teacher-roster-kpis strong,
.teacher-roster-kpis span {
  display: block;
}

.teacher-roster-kpis strong {
  color: #1553aa;
  font-size: 1.8rem;
  line-height: 1;
}

.teacher-roster-kpis span {
  margin-top: 0.55rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.teacher-roster-panel {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.teacher-roster-panel-heading {
  margin-bottom: 1rem;
}

.teacher-roster-panel-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.teacher-roster-panel-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-roster-search {
  display: flex;
  gap: 0.75rem;
  max-width: 760px;
}

.teacher-roster-search .form-control {
  min-width: 0;
}

.teacher-roster-table td {
  vertical-align: middle;
}

.teacher-roster-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.teacher-roster-group-editor,
.teacher-roster-remove {
  min-width: 105px;
}

.teacher-roster-group-editor > summary,
.teacher-roster-remove > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.teacher-roster-group-editor > summary::-webkit-details-marker,
.teacher-roster-remove > summary::-webkit-details-marker {
  display: none;
}

.teacher-roster-group-editor[open],
.teacher-roster-remove[open] {
  min-width: 260px;
  padding: 0.8rem;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.teacher-roster-remove[open] {
  border-color: #fecaca;
  background: #fff7f7;
}

.teacher-roster-group-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.teacher-roster-group-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  cursor: pointer;
}

@media (max-width: 1199.98px) {
  .teacher-roster-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .teacher-roster-header,
  .teacher-roster-search,
  .teacher-roster-actions {
    flex-direction: column;
  }

  .teacher-roster-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-roster-search,
  .teacher-roster-search .btn {
    width: 100%;
  }
}

@media (max-width: 479.98px) {
  .teacher-roster-kpis {
    grid-template-columns: 1fr;
  }
}

.teacher-assignments-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.teacher-assignments-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.teacher-assignments-header p {
  max-width: 760px;
  margin-bottom: 0;
  color: #64748b;
}

.teacher-assignments-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.teacher-assignments-panel {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.teacher-assignments-panel-heading {
  margin-bottom: 1.25rem;
}

.teacher-assignments-panel-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.teacher-assignments-panel-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-assignment-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-assignment-form-wide,
.teacher-assignment-form-actions,
.teacher-assignment-access-rules {
  grid-column: 1 / -1;
}

.teacher-assignment-access-rules {
  padding: 1rem 1.15rem;
  border: 1px solid #bfdbfe;
  border-radius: 1rem;
  background: #eff6ff;
  color: #1e3a8a;
}

.teacher-assignment-access-rules ul {
  margin: 0.7rem 0 0;
  padding-left: 1.25rem;
}

.teacher-assignment-access-rules li + li {
  margin-top: 0.3rem;
}

.teacher-assignment-form-actions {
  display: flex;
  justify-content: flex-end;
}

.teacher-assignments-table td {
  vertical-align: middle;
}

.teacher-assignment-state {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.teacher-assignment-state.is-open {
  background: #dcfce7;
  color: #166534;
}

.teacher-assignment-state.is-scheduled {
  background: #dbeafe;
  color: #1e40af;
}

.teacher-assignment-state.is-late,
.teacher-assignment-state.is-read-only {
  background: #fef3c7;
  color: #92400e;
}

.teacher-assignment-state.is-closed,
.teacher-assignment-state.is-cancelled {
  background: #e2e8f0;
  color: #475569;
}

.teacher-assignment-cancel {
  min-width: 90px;
}

.teacher-assignment-cancel > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.teacher-assignment-cancel > summary::-webkit-details-marker {
  display: none;
}

.teacher-assignment-cancel[open] {
  min-width: 250px;
  padding: 0.8rem;
  border: 1px solid #fecaca;
  border-radius: 0.85rem;
  background: #fff7f7;
}

.teacher-assignments-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1.15rem;
  text-align: center;
}

.teacher-assignments-empty > i {
  color: #1553aa;
  font-size: 2.3rem;
}

.teacher-assignments-empty h3 {
  margin-top: 1rem;
}

.teacher-assignments-empty p {
  color: #64748b;
}

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

@media (max-width: 767.98px) {
  .teacher-assignments-header {
    flex-direction: column;
  }

  .teacher-assignments-header-actions {
    width: 100%;
  }

  .teacher-assignment-form {
    grid-template-columns: 1fr;
  }
}

.student-work-page,
.student-work-detail {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.student-work-header,
.student-work-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.student-work-header p,
.student-work-detail-header p {
  max-width: 760px;
  margin-bottom: 0;
  color: #64748b;
}

.student-work-notice {
  padding: 1rem 1.15rem;
  border: 1px solid;
  border-radius: 1rem;
  font-weight: 650;
}

.student-work-notice.is-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.student-work-notice.is-error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.student-work-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.student-work-counts article {
  padding: 1.2rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.student-work-counts strong,
.student-work-counts span {
  display: block;
}

.student-work-counts strong {
  color: #1553aa;
  font-size: 1.9rem;
  line-height: 1;
}

.student-work-counts span {
  margin-top: 0.6rem;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.student-work-tabs {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.student-work-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid #dce3ec;
  border-radius: 999px;
  color: #475569;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.student-work-tab strong {
  min-width: 1.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #e2e8f0;
  text-align: center;
  font-size: 0.72rem;
}

.student-work-tab.active {
  border-color: #1553aa;
  background: #eff6ff;
  color: #1553aa;
}

.student-work-section {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.student-work-section-heading {
  margin-bottom: 1.25rem;
}

.student-work-section-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.student-work-section-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.student-work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.student-work-card {
  display: flex;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid #dce3ec;
  border-radius: 1.15rem;
  background: #fff;
  flex-direction: column;
}

.student-work-card-header,
.student-work-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.student-work-card h3 {
  margin: 1rem 0 0.5rem;
  font-size: 1.08rem;
}

.student-work-type {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 750;
}

.student-work-target {
  color: #64748b;
  font-size: 0.84rem;
}

.student-work-state {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.student-work-state.is-open {
  background: #dcfce7;
  color: #166534;
}

.student-work-state.is-upcoming {
  background: #dbeafe;
  color: #1e40af;
}

.student-work-state.is-late,
.student-work-state.is-read-only {
  background: #fef3c7;
  color: #92400e;
}

.student-work-state.is-closed {
  background: #e2e8f0;
  color: #475569;
}

.student-work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  color: #64748b;
  font-size: 0.8rem;
}

.student-work-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}

.student-work-dates > div {
  padding: 0.75rem;
  border-radius: 0.8rem;
  background: #f8fafc;
}

.student-work-dates dt {
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.student-work-dates dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
}

.student-work-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e8f0;
}

.student-work-progress span {
  color: #64748b;
  font-size: 0.8rem;
}

.student-work-access-warning {
  margin-top: 0.9rem;
  padding: 0.75rem;
  border-radius: 0.8rem;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.82rem;
}

.student-work-card-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.student-work-card-footer small {
  max-width: 55%;
  color: #64748b;
}

.student-work-empty,
.student-work-blocked {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1.15rem;
  text-align: center;
}

.student-work-empty > i,
.student-work-blocked > i {
  color: #1553aa;
  font-size: 2.4rem;
}

.student-work-empty h3,
.student-work-blocked h2 {
  margin-top: 1rem;
}

.student-work-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.student-work-detail-summary article {
  padding: 1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.student-work-detail-summary span,
.student-work-detail-summary strong {
  display: block;
}

.student-work-detail-summary span {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.student-work-detail-summary strong {
  margin-top: 0.35rem;
}

.student-work-instructions {
  padding: 1.2rem;
  border: 1px solid #bfdbfe;
  border-radius: 1rem;
  background: #eff6ff;
}

.student-work-instructions h2 {
  font-size: 1.1rem;
}

.student-work-instructions p {
  margin-bottom: 0;
}

.student-work-exercise-list {
  margin: 0;
  padding-left: 1.5rem;
}

.student-work-exercise-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.student-work-exercise-list li:last-child {
  border-bottom: 0;
}

.student-work-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

@media (max-width: 1199.98px) {
  .student-work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-work-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .student-work-header,
  .student-work-detail-header,
  .student-work-card-footer,
  .student-work-exercise-list li {
    align-items: stretch;
    flex-direction: column;
  }

  .student-work-counts,
  .student-work-grid,
  .student-work-detail-summary {
    grid-template-columns: 1fr;
  }

  .student-work-card-footer small {
    max-width: none;
  }
}

.student-reader-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.student-reader-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.student-reader-header p {
  margin-bottom: 0;
  color: #64748b;
}

.student-reader-progress {
  padding: 1rem 1.15rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.student-reader-progress-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.student-reader-progress-heading span {
  display: block;
  margin-top: 0.2rem;
  color: #64748b;
  font-size: 0.82rem;
}

.student-reader-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.student-reader-navigation {
  position: sticky;
  top: 96px;
  padding: 1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.student-reader-navigation h2 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.student-reader-navigation nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.student-reader-nav-item {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  color: #475569;
  text-decoration: none;
}

.student-reader-nav-item:hover {
  border-color: #bfdbfe;
  background: #fff;
  color: #1553aa;
}

.student-reader-nav-item.active {
  border-color: #1553aa;
  background: #eff6ff;
  color: #1553aa;
}

.student-reader-nav-item.answered {
  color: #166534;
}

.student-reader-nav-number {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 800;
}

.student-reader-nav-item.active .student-reader-nav-number {
  background: #1553aa;
  color: #fff;
}

.student-reader-nav-title {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-reader-content {
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid #dce3ec;
  border-radius: 1.15rem;
}

.student-reader-exercise-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.student-reader-exercise-heading h2 {
  margin-top: 0.35rem;
  font-size: 1.35rem;
}

.student-reader-position {
  color: #1553aa;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.student-reader-source-note {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 1.25rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid #bfdbfe;
  border-radius: 0.85rem;
  background: #eff6ff;
  color: #1e3a8a;
}

.student-reader-source-note p {
  margin-bottom: 0;
}

.student-reader-response-form textarea {
  min-height: 280px;
  resize: vertical;
}

.student-reader-save-status {
  margin-top: 0.6rem;
  color: #64748b;
  font-size: 0.8rem;
}

.student-reader-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
}

.student-reader-actions-left,
.student-reader-actions-right {
  display: flex;
  gap: 0.75rem;
}

.student-reader-submit-panel {
  margin-top: 1.5rem;
  padding: 1.15rem;
  border: 1px solid #86efac;
  border-radius: 1rem;
  background: #f0fdf4;
}

.student-reader-submit-panel h3 {
  font-size: 1.1rem;
}

.student-reader-submit-panel p {
  color: #475569;
}

@media (max-width: 991.98px) {
  .student-reader-layout {
    grid-template-columns: 1fr;
  }

  .student-reader-navigation {
    position: static;
  }

  .student-reader-navigation nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .student-reader-header,
  .student-reader-exercise-heading,
  .student-reader-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .student-reader-navigation nav {
    grid-template-columns: 1fr;
  }

  .student-reader-actions-left,
  .student-reader-actions-right {
    width: 100%;
    flex-direction: column;
  }

  .student-reader-actions .btn {
    width: 100%;
  }
}

.teacher-submissions-page,
.teacher-submission-detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.teacher-submissions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.teacher-submissions-header p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-submission-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-submission-kpis article,
.teacher-submission-detail-kpis article {
  padding: 1.1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.teacher-submission-kpis strong,
.teacher-submission-kpis span,
.teacher-submission-detail-kpis strong,
.teacher-submission-detail-kpis span {
  display: block;
}

.teacher-submission-kpis strong {
  color: #1553aa;
  font-size: 1.8rem;
  line-height: 1;
}

.teacher-submission-kpis span,
.teacher-submission-detail-kpis span {
  margin-top: 0.5rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.teacher-submission-schedule {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
}

.teacher-submission-schedule > div {
  min-width: 180px;
}

.teacher-submission-schedule span,
.teacher-submission-schedule strong {
  display: block;
}

.teacher-submission-schedule span {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.teacher-submission-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.teacher-submission-tab {
  padding: 0.65rem 0.9rem;
  border: 1px solid #dce3ec;
  border-radius: 999px;
  color: #475569;
  font-weight: 750;
  text-decoration: none;
}

.teacher-submission-tab.active {
  border-color: #1553aa;
  background: #eff6ff;
  color: #1553aa;
}

.teacher-submission-search {
  display: flex;
  gap: 0.75rem;
  max-width: 700px;
}

.teacher-submission-status {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.teacher-submission-status.is-submitted {
  background: #dcfce7;
  color: #166534;
}

.teacher-submission-status.is-progress {
  background: #dbeafe;
  color: #1e40af;
}

.teacher-submission-status.is-not-started {
  background: #e2e8f0;
  color: #475569;
}

.teacher-submission-progress {
  min-width: 150px;
}

.teacher-submission-progress .progress {
  height: 0.45rem;
}

.teacher-submission-progress small {
  display: block;
  margin-top: 0.35rem;
  color: #64748b;
}

.teacher-submission-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.teacher-submission-detail-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.teacher-submission-detail-kpis strong {
  margin-top: 0.35rem;
}

.teacher-submission-warning {
  padding: 1rem;
  border: 1px solid #bfdbfe;
  border-radius: 1rem;
  background: #eff6ff;
  color: #1e3a8a;
}

.teacher-submissions-section-heading {
  margin-bottom: 1rem;
}

.teacher-submissions-section-heading h2 {
  margin-bottom: 0.25rem;
  font-size: 1.35rem;
}

.teacher-submissions-section-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.teacher-response-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.teacher-response-card {
  padding: 1.2rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
}

.teacher-response-card > header,
.teacher-response-card > footer,
.teacher-assignment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.teacher-response-position {
  color: #1553aa;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.teacher-response-card h3 {
  margin: 0.3rem 0 0;
  font-size: 1.05rem;
}

.teacher-response-content {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #f8fafc;
  font-family: inherit;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.teacher-response-empty {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 0.85rem;
  background: #f8fafc;
  color: #64748b;
}

.teacher-response-card footer small {
  color: #64748b;
}

.teacher-submissions-empty {
  padding: 3rem 1.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  text-align: center;
}

.teacher-submissions-empty > i {
  color: #1553aa;
  font-size: 2.2rem;
}

.teacher-submissions-empty h3 {
  margin-top: 1rem;
}

@media (max-width: 1199.98px) {
  .teacher-submission-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .teacher-submission-detail-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .teacher-submissions-header,
  .teacher-submission-search,
  .teacher-response-card > header,
  .teacher-response-card > footer,
  .teacher-assignment-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-submission-kpis,
  .teacher-submission-detail-kpis {
    grid-template-columns: 1fr;
  }

  .teacher-submission-search,
  .teacher-submission-search .btn {
    width: 100%;
  }
}

.class-teachers-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.class-teachers-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.class-teachers-header p {
  margin-bottom: 0;
  color: #64748b;
}

.class-teachers-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.class-teachers-kpis article {
  padding: 1.15rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.class-teachers-kpis strong,
.class-teachers-kpis span {
  display: block;
}

.class-teachers-kpis strong {
  color: #1553aa;
  font-size: 1.35rem;
}

.class-teachers-kpis span {
  margin-top: 0.45rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.class-teachers-panel {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.class-teachers-panel-heading {
  margin-bottom: 1rem;
}

.class-teachers-panel-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.class-teachers-panel-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.class-teacher-search {
  display: flex;
  gap: 0.75rem;
  max-width: 720px;
}

.class-teacher-role-form,
.class-teacher-add-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.class-teacher-role-form .form-select,
.class-teacher-add-form .form-select {
  min-width: 150px;
}

.class-teacher-actions,
.teacher-class-card-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.class-teacher-transfer,
.class-teacher-remove {
  min-width: 90px;
}

.class-teacher-transfer > summary,
.class-teacher-remove > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.class-teacher-transfer > summary::-webkit-details-marker,
.class-teacher-remove > summary::-webkit-details-marker {
  display: none;
}

.class-teacher-transfer[open],
.class-teacher-remove[open] {
  min-width: 260px;
  padding: 0.8rem;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.class-teacher-remove[open] {
  border-color: #fecaca;
  background: #fff7f7;
}

@media (max-width: 991.98px) {
  .class-teachers-kpis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .class-teachers-header,
  .class-teacher-search,
  .class-teacher-role-form,
  .class-teacher-add-form,
  .class-teacher-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .class-teacher-search,
  .class-teacher-search .btn,
  .class-teacher-role-form .form-select,
  .class-teacher-add-form .form-select {
    width: 100%;
  }
}

.academic-years-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.academic-years-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.academic-years-header p,
.academic-years-panel-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.academic-years-panel {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.academic-years-panel-heading {
  margin-bottom: 1rem;
}

.academic-years-panel-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.academic-year-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.academic-year-checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.academic-year-form-actions {
  display: flex;
  justify-content: flex-end;
  grid-column: 1 / -1;
}

.academic-years-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.academic-year-card {
  padding: 1.2rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #fff;
}

.academic-year-card.is-current {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #eff6ff;
}

.academic-year-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.academic-year-card-header h3 {
  margin: 0.6rem 0 0.2rem;
  font-size: 1.15rem;
}

.academic-year-card-header p,
.academic-year-card-dates {
  color: #64748b;
}

.academic-year-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.academic-year-card-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.academic-year-card-metrics > div {
  padding: 0.85rem;
  border-radius: 0.8rem;
  background: #f8fafc;
}

.academic-year-card-metrics strong,
.academic-year-card-metrics span {
  display: block;
}

.academic-year-card-metrics strong {
  color: #1553aa;
  font-size: 1.3rem;
}

.academic-year-card-metrics span {
  margin-top: 0.3rem;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.academic-year-card-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.academic-year-edit-form,
.academic-year-close-form,
.academic-year-reopen-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.academic-year-edit-form {
  max-width: 850px;
}

.academic-year-edit-form .form-control {
  flex: 1 1 180px;
}

.academic-year-close[open] {
  min-width: 300px;
  padding: 0.8rem;
  border: 1px solid #fecaca;
  border-radius: 0.85rem;
  background: #fff7f7;
}

.academic-year-close > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.academic-year-close > summary::-webkit-details-marker {
  display: none;
}

@media (max-width: 991.98px) {
  .academic-year-form,
  .academic-year-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .academic-years-header,
  .academic-year-card-header,
  .academic-year-card-actions,
  .academic-year-edit-form,
  .academic-year-close-form,
  .academic-year-reopen-form {
    align-items: stretch;
    flex-direction: column;
  }

  .academic-year-form,
  .academic-year-card-metrics {
    grid-template-columns: 1fr;
  }
}

.class-settings-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.class-settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.class-settings-header p {
  margin-bottom: 0;
  color: #64748b;
}

.class-settings-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.class-settings-title-line h1 {
  margin-bottom: 0;
}

.class-settings-warning {
  padding: 1rem 1.15rem;
  border: 1px solid #fcd34d;
  border-radius: 1rem;
  background: #fffbeb;
  color: #92400e;
}

.class-settings-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.class-settings-kpis article {
  padding: 1.1rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #f8fafc;
}

.class-settings-kpis strong,
.class-settings-kpis span {
  display: block;
}

.class-settings-kpis strong {
  color: #1553aa;
  font-size: 1.7rem;
  line-height: 1;
}

.class-settings-kpis span {
  margin-top: 0.5rem;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.class-settings-panel {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.class-settings-panel-heading {
  margin-bottom: 1rem;
}

.class-settings-panel-heading h2 {
  margin-bottom: 0.3rem;
  font-size: 1.35rem;
}

.class-settings-panel-heading p {
  margin-bottom: 0;
  color: #64748b;
}

.class-settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.class-settings-form-wide,
.class-settings-form-actions {
  grid-column: 1 / -1;
}

.class-settings-form-actions {
  display: flex;
  justify-content: flex-end;
}

.class-settings-readonly {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.class-settings-readonly > div {
  padding: 1rem;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.class-settings-readonly dt {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.class-settings-readonly dd {
  margin: 0.35rem 0 0;
}

.class-settings-group-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.class-settings-group-card {
  padding: 1.15rem;
  border: 1px solid #dce3ec;
  border-radius: 1rem;
  background: #fff;
}

.class-settings-group-card.is-archived {
  background: #f8fafc;
  opacity: 0.9;
}

.class-settings-group-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.class-settings-group-card h3 {
  margin: 0.6rem 0 0.2rem;
  font-size: 1.1rem;
}

.class-settings-group-card p {
  margin-bottom: 0;
  color: #64748b;
}

.class-settings-group-badges,
.class-settings-group-metrics,
.class-settings-group-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.class-settings-group-metrics {
  justify-content: flex-end;
  color: #64748b;
  font-size: 0.82rem;
}

.class-settings-group-description {
  margin-top: 1rem;
}

.class-settings-group-actions {
  align-items: flex-start;
  margin-top: 1rem;
}

.class-settings-group-actions details > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}

.class-settings-group-actions details > summary::-webkit-details-marker {
  display: none;
}

.class-settings-group-actions details[open] {
  width: 100%;
  padding: 0.9rem;
  border: 1px solid #dce3ec;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.class-settings-group-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.class-settings-group-form textarea,
.class-settings-group-form button {
  grid-column: 1 / -1;
}

@media (max-width: 991.98px) {
  .class-settings-kpis,
  .class-settings-form,
  .class-settings-readonly,
  .class-settings-group-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .class-settings-header,
  .class-settings-group-card > header,
  .class-settings-group-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .class-settings-kpis,
  .class-settings-form,
  .class-settings-readonly,
  .class-settings-group-form {
    grid-template-columns: 1fr;
  }
}

.promotion-page {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.promotion-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.promotion-header p,
.promotion-target-panel p {
  margin-bottom: 0;
  color: #64748b;
}

.promotion-target-panel,
.promotion-candidates-panel,
.promotion-results {
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.promotion-target-panel h2,
.promotion-candidates-panel h2,
.promotion-results h2 {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}

.promotion-target-form {
  display: flex;
  gap: 0.75rem;
  max-width: 850px;
  margin-top: 1rem;
}

.promotion-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 767.98px) {
  .promotion-header,
  .promotion-target-form {
    align-items: stretch;
    flex-direction: column;
  }
}

.teacher-dashboard-actions {
  flex-wrap: wrap;
}

.teacher-dashboard-shortcuts {
  align-items: stretch;
}

.teacher-dashboard-shortcut {
  min-width: 0;
}

.teacher-dashboard-shortcut span {
  line-height: 1.45;
}

.teacher-series-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.teacher-series-lifecycle-form {
  display: inline-flex;
  margin: 0;
}

.teacher-series-lifecycle-status {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.teacher-series-lifecycle-status[data-state="pending"] {
  color: #64748b;
}

.teacher-series-lifecycle-status[data-state="success"] {
  color: #15803d;
}

.teacher-series-lifecycle-status[data-state="error"] {
  color: #b91c1c;
}

.teacher-series-delete {
  position: relative;
}

.teacher-series-delete > summary {
  list-style: none;
  cursor: pointer;
}

.teacher-series-delete > summary::-webkit-details-marker {
  display: none;
}

.teacher-series-delete-confirmation {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 0.5rem);
  width: min(22rem, 85vw);
  padding: 1rem;
  border: 1px solid #fecaca;
  border-radius: 0.8rem;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.teacher-series-delete-confirmation p {
  margin: 0 0 0.8rem;
  color: #7f1d1d;
  font-size: 0.9rem;
  font-weight: 650;
}

.teacher-series-card.is-archived {
  background: #f8fafc;
}

.teacher-series-archived-notice {
  display: flex;
  align-items: center;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  color: #475569;
  background: #f8fafc;
  font-weight: 650;
}

@media (max-width: 640px) {
  .teacher-series-card-actions-main,
  .teacher-series-card-actions-secondary {
    align-items: stretch;
    justify-content: stretch;
  }

  .teacher-series-card-actions-main > *,
  .teacher-series-card-actions-secondary > *,
  .teacher-series-card-actions-main .btn,
  .teacher-series-card-actions-secondary .btn {
    width: 100%;
  }

  .teacher-series-card-actions-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-series-id {
    max-width: 100%;
    border-radius: 0.75rem;
  }
}

.account-memberships-card {
  grid-column: 1 / -1;
}

.account-membership-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.account-membership {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid #dbe3ef;
  border-radius: 1rem;
  background: #ffffff;
}

.account-membership.is-current {
  border-color: #93c5fd;
  background: #eff6ff;
}

.account-membership-main {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.account-membership-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 0.85rem;
  background: #eef2ff;
  color: #1d4ed8;
  font-size: 1.2rem;
}

.account-membership-copy {
  min-width: 0;
}

.account-membership-title-row,
.account-membership-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.account-membership-title-row strong {
  color: #0f172a;
  font-size: 1rem;
}

.account-membership-meta {
  margin-top: 0.3rem;
  color: #64748b;
  font-size: 0.86rem;
}

.account-membership-current-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.76rem;
  font-weight: 800;
}

.account-membership-state.is-inactive {
  color: #b45309;
  font-weight: 700;
}

.account-membership-action {
  flex: 0 0 auto;
}

.account-membership-action form {
  margin: 0;
}

.account-membership-here {
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 800;
}

.account-membership-unavailable {
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 700;
}

@media (max-width: 700px) {
  .account-membership {
    align-items: stretch;
    flex-direction: column;
  }

  .account-membership-action,
  .account-membership-action form,
  .account-membership-action .btn {
    width: 100%;
  }
}
