/* =========================================================
   PIPO — App pages (Cours + Devoir)
   Reprend les tokens définis dans styles.css
   ========================================================= */

/* ==================== Page shell ==================== */
.app-page {
  padding: clamp(40px, 6vw, 80px) 0 clamp(56px, 8vw, 120px);
  min-height: calc(100vh - 80px);
}
.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border);
}
.app-header-copy h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: var(--s-2);
}
.app-header-copy p {
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.5;
  max-width: 60ch;
}
.app-header-actions {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}

/* Breadcrumb / page eyebrow */
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s-3);
}
.page-eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  display: inline-block;
}

/* Active nav link */
.nav a.active,
.mobile-nav a.active {
  color: var(--accent);
  font-weight: 700;
}

/* ==================== Two-column app layout ==================== */
.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 980px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Card ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.card + .card {
  margin-top: var(--s-5);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}
.card-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==================== Forms (light theme) ==================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.field-input,
.field-textarea,
.field-select {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
  font-family: var(--font-body);
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(14, 140, 130, 0.12);
}
.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'><path d='M1 1l6 6 6-6' stroke='%235C5C5C' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.field-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
@media (max-width: 540px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-actions {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  flex-wrap: wrap;
}

/* ==================== File dropzone ==================== */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-6);
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--r-md);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
}
.dropzone-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text);
}
.dropzone-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* Import progress */
.import-progress {
  margin-top: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.import-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
}
.import-row-name {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-row-status {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.import-row-status.done {
  color: var(--accent);
  font-weight: 700;
}
.import-row-status.error {
  color: #a03d18;
  font-weight: 700;
}

/* ==================== Course list ==================== */
.course-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.course-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--s-4);
  row-gap: var(--s-2);
  align-items: start;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.course-item.with-check {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
@media (max-width: 720px) {
  .course-item {
    grid-template-columns: minmax(0, 1fr);
  }
  .course-item.with-check {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .course-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}
.course-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.course-check {
  margin-top: 2px;
}
.course-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.course-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.course-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
  word-break: break-word;
}
.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.course-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.course-preview {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  justify-self: end;
  min-width: 0;
}

/* ==================== Subject groups (pliables) ==================== */
.subject-group {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.subject-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  text-align: left;
  transition: background 0.15s;
}
.subject-header:hover { background: var(--bg); }
.subject-header[aria-expanded="false"] { border-bottom-color: transparent; }
.subject-toggle-icon {
  display: inline-block;
  width: 16px;
  color: var(--accent);
  font-size: 14px;
}
.subject-label { flex: 1; }
.subject-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}
.subject-courses {
  list-style: none;
  margin: 0;
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.subject-group .course-item {
  background: var(--surface);
}

/* ==================== Revision card (fiche de révision) ==================== */
.revision-toggle {
  align-self: flex-start;
  margin-top: var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.revision-toggle:hover {
  background: var(--bg);
  border-color: var(--accent);
}
.revision-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}
.revision-panel {
  margin-top: var(--s-3);
  padding: var(--s-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.revision-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.revision-block h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s-2) 0;
}
.revision-block p,
.revision-block ul,
.revision-block ol,
.revision-block dl {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text);
}
.revision-block ul,
.revision-block ol {
  padding-left: 20px;
}
.revision-block li {
  margin-bottom: 4px;
}
.revision-defs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px var(--s-3);
}
.revision-defs dt {
  font-weight: 700;
  color: var(--text);
}
.revision-defs dd {
  margin: 0;
  color: var(--text-muted);
}
.revision-formulas li {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: var(--text-xs);
  background: var(--surface);
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 8px;
}
.revision-questions li {
  color: var(--text-muted);
}
.revision-questions li strong {
  color: var(--text);
  font-weight: 500;
}
.revision-empty {
  text-align: center;
  padding: var(--s-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.revision-empty p { margin-bottom: var(--s-2); }
.revision-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: var(--s-2);
  border-top: 1px solid var(--border);
}
.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: var(--text-xs);
}

[hidden] { display: none !important; }
.icon-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.icon-btn:hover {
  background: var(--bg);
}
.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.icon-btn svg {
  width: 14px;
  height: 14px;
}
.icon-btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  text-decoration: none;
}
.icon-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}
.icon-btn[href] {
  text-decoration: none;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--s-7) var(--s-5);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text);
  margin-bottom: var(--s-2);
}
.empty-state p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  max-width: 42ch;
  margin: 0 auto;
}

/* ==================== Stats row ==================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-5);
}
.stats-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.stats-tile strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stats-tile span {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-top: 4px;
}
@media (max-width: 540px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: calc(100% - 48px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== Devoir page ==================== */
.select-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--s-3);
}
.select-all-row label {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
}
.select-all-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.select-count {
  font-weight: 700;
  color: var(--accent);
}

.type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.chip {
  padding: 8px 14px;
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  border-color: var(--text);
  color: var(--text);
}
.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  font-weight: 700;
}

/* Output panel */
.output-empty {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.output-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--s-4);
  border-radius: 50%;
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
}

.output-section {
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--border);
}
.output-section:first-child {
  padding-top: 0;
}
.output-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.output-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s-3);
}
.output-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: var(--s-2);
}

.output-plan {
  list-style: none;
  counter-reset: plan;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.output-plan > li {
  counter-increment: plan;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.output-plan > li::before {
  content: counter(plan, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}
.plan-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.plan-body {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.plan-body ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.plan-body li {
  margin-bottom: 2px;
}

/* RNCP mapping */
.rncp-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: var(--s-3);
}
.rncp-block {
  padding: var(--s-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.rncp-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}
.rncp-block-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
}
.rncp-coverage {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-base);
  color: var(--accent);
}
.rncp-bar {
  height: 4px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--s-3);
}
.rncp-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rncp-comps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}
.rncp-comps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-2);
}
.rncp-comps li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 8px;
}

/* Coverage gauge (top of output) */
.coverage {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-5);
  background: var(--dark);
  color: var(--surface);
  border-radius: var(--r-md);
  margin-bottom: var(--s-5);
}
.coverage-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 4px;
}
.coverage-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--white);
  line-height: 1.4;
}
.coverage-bar {
  margin-top: var(--s-3);
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.coverage-bar-fill {
  height: 100%;
  background: var(--accent-soft);
  border-radius: inherit;
  transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.coverage-pct {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(36px, 3vw + 16px, 52px);
  color: var(--accent-soft);
  letter-spacing: -0.03em;
  line-height: 1;
}

/* Loading shimmer for output */
.loading-shimmer {
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.shimmer-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--surface-alt) 0%,
    var(--bg) 50%,
    var(--surface-alt) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.shimmer-line:nth-child(1) { width: 40%; height: 18px; }
.shimmer-line:nth-child(2) { width: 90%; }
.shimmer-line:nth-child(3) { width: 75%; }
.shimmer-line:nth-child(4) { width: 85%; }
.shimmer-line:nth-child(5) { width: 60%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Demo banner */
.demo-banner {
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 10px var(--gutter);
  font-size: var(--text-xs);
  text-align: center;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.demo-banner strong {
  color: var(--accent-hover);
  font-weight: 700;
}

/* =============== QCM de révision (page Devoir) =============== */
.qcm-card {
  margin-top: 24px;
}
.qcm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 8px;
}
@media (max-width: 900px) {
  .qcm-grid { grid-template-columns: 1fr; }
}

.qcm-opts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: end;
}
.qcm-opts .field {
  min-width: 0;
}
.qcm-opts .field-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qcm-opts input,
.qcm-opts select {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
}
@media (max-width: 600px) {
  .qcm-opts { grid-template-columns: 1fr; }
  .qcm-opts .field-label { white-space: normal; }
}

/* ==================== Sélecteur de bibliothèque (QCM) ==================== */
.qcm-library-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.qcm-library-select {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.qcm-library-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* PDF drop zone (réutilisable) */
.pdf-drop {
  display: block;
  border: 2px dashed #C8D6D3;
  border-radius: 14px;
  background: #F7FAF9;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
  color: #0E2927;
}
.pdf-drop:hover,
.pdf-drop:focus-visible {
  border-color: var(--accent);
  background: #EEF7F5;
  outline: none;
}
.pdf-drop.is-drag {
  border-color: var(--accent);
  background: #E5F3F1;
  transform: scale(1.01);
}
.pdf-drop-inner strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.pdf-drop-inner span {
  display: block;
  font-size: 13px;
  color: #4E6E6B;
}
.pdf-remove {
  margin-top: 10px;
  border: 1px solid #D8E0DE;
  background: white;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: #4E6E6B;
  cursor: pointer;
}
.pdf-remove:hover {
  border-color: #C43C3C;
  color: #C43C3C;
}

/* Sortie QCM */
.qcm-empty {
  border: 1px dashed #D8E0DE;
  border-radius: 14px;
  padding: 32px 20px;
  text-align: center;
  color: #4E6E6B;
  background: #FAFCFB;
}
.qcm-empty strong {
  display: block;
  margin: 10px 0 6px;
  color: #0E2927;
  font-size: 15px;
}
.qcm-summary {
  background: #F0F7F6;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #0E2927;
  font-style: normal;
}
.qcm-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qcm-item {
  border: 1px solid #E4EBE9;
  border-radius: 14px;
  padding: 16px 18px;
  background: white;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.qcm-item:hover {
  border-color: #B9D4D0;
  box-shadow: 0 2px 10px rgba(14, 140, 130, 0.06);
}
.qcm-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.qcm-question {
  font-size: 15px;
  font-weight: 600;
  color: #0E2927;
  line-height: 1.4;
  flex: 1;
}
.qcm-proba {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  color: white;
}
.qcm-proba small {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 2px;
  letter-spacing: 0.04em;
}
.qcm-proba[data-level="very-high"] { background: var(--accent); }
.qcm-proba[data-level="high"]      { background: #2AA88A; }
.qcm-proba[data-level="medium"]    { background: #E09F3E; }
.qcm-proba[data-level="low"]       { background: #B0B0B0; }
.qcm-proba[data-level="very-low"]  { background: #D0D0D0; color: #555; }

.qcm-choices {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.qcm-choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 12px;
  border-radius: 8px;
  background: #FAFCFB;
  border: 1px solid transparent;
  font-size: 14px;
  color: #0E2927;
  cursor: pointer;
}
.qcm-choice:hover {
  background: #F3F7F6;
}
.qcm-choice.is-correct {
  background: #E5F3F1;
  border-color: var(--accent);
  font-weight: 600;
}
.qcm-choice-letter {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 1px solid #D8E0DE;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #4E6E6B;
}
.qcm-choice.is-correct .qcm-choice-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.qcm-item-foot {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #E4EBE9;
  font-size: 13px;
  color: #4E6E6B;
}
.qcm-item-foot strong {
  color: #0E2927;
  font-weight: 600;
}
.qcm-topic {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #F0F7F6;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ==========================================================
   QCM — Onglets Révision / Quiz / Flashcards
========================================================== */
.qcm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.qcm-actions .field-hint { margin-left: auto; }

.qcm-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #F0F7F6;
  border: 1px solid #E4EBE9;
  border-radius: 12px;
  margin-bottom: 20px;
  width: fit-content;
}
.qcm-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #4E6E6B;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.qcm-tab:hover { color: #0E2927; }
.qcm-tab.is-active {
  background: white;
  color: #0E2927;
  box-shadow: 0 1px 3px rgba(14, 41, 39, 0.08);
}

.qcm-panel[hidden] { display: none; }

/* ==========================================================
   Mode Quiz (jouable)
========================================================== */
.quiz-setup {
  padding: 40px 24px;
  text-align: center;
  background: linear-gradient(180deg, #F7FBFA 0%, #F0F7F6 100%);
  border: 1px solid #E4EBE9;
  border-radius: 16px;
}
.quiz-setup-title {
  font-size: 24px;
  font-weight: 600;
  color: #0E2927;
  margin: 0 0 8px;
}
.quiz-setup-sub {
  color: #4E6E6B;
  font-size: 15px;
  margin: 0 0 24px;
}
.quiz-setup-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.quiz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: white;
  border: 1px solid #E4EBE9;
  border-radius: 999px;
  font-size: 14px;
  color: #0E2927;
  cursor: pointer;
  transition: border-color 0.15s;
}
.quiz-toggle:hover { border-color: var(--accent); }
.quiz-toggle input { accent-color: var(--accent); cursor: pointer; }
.quiz-setup-hint {
  margin-top: 16px;
  font-size: 13px;
  color: #4E6E6B;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E4EBE9;
}
.quiz-progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.quiz-progress span {
  font-size: 13px;
  color: #4E6E6B;
  font-weight: 500;
}
.quiz-progress-bar {
  height: 6px;
  background: #F0F7F6;
  border-radius: 999px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.quiz-score-live, .quiz-timer {
  text-align: center;
  padding: 6px 14px;
  background: #F0F7F6;
  border-radius: 10px;
  min-width: 64px;
}
.quiz-score-live span, .quiz-timer span {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #0E2927;
  line-height: 1.1;
}
.quiz-score-live small, .quiz-timer small {
  font-size: 11px;
  color: #4E6E6B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.quiz-timer.is-warning span { color: #E09F3E; }
.quiz-timer.is-danger span { color: #C8553D; }

.quiz-card {
  background: white;
  border: 1px solid #E4EBE9;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 16px;
}
.quiz-question-topic {
  display: inline-block;
  padding: 3px 10px;
  background: #F0F7F6;
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}
.quiz-question-topic:empty { display: none; }
.quiz-question {
  font-size: 19px;
  font-weight: 600;
  color: #0E2927;
  line-height: 1.4;
  margin-bottom: 20px;
}
.quiz-choices {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.quiz-choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: #F9FBFB;
  border: 1.5px solid #E4EBE9;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  font-size: 15px;
  color: #0E2927;
  width: 100%;
}
.quiz-choice:hover:not(:disabled) {
  border-color: var(--accent);
  background: white;
}
.quiz-choice:disabled { cursor: default; }
.quiz-choice.is-selected {
  border-color: var(--accent);
  background: white;
}
.quiz-choice.is-correct {
  background: #E8F6F3;
  border-color: var(--accent);
  color: #0E2927;
}
.quiz-choice.is-wrong {
  background: #FBEDE9;
  border-color: #C8553D;
  color: #0E2927;
}
.quiz-choice-letter {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #D0DAD8;
  background: white;
  color: #4E6E6B;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.15s;
}
.quiz-choice.is-correct .quiz-choice-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.quiz-choice.is-wrong .quiz-choice-letter {
  background: #C8553D;
  border-color: #C8553D;
  color: white;
}
.quiz-choice-text { flex: 1; padding-top: 3px; }

.quiz-feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.quiz-feedback.is-good {
  background: #E8F6F3;
  color: #0E2927;
  border-left: 4px solid var(--accent);
}
.quiz-feedback.is-bad {
  background: #FBEDE9;
  color: #0E2927;
  border-left: 4px solid #C8553D;
}
.quiz-feedback strong { display: block; margin-bottom: 4px; }

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quiz-result {
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(180deg, #F7FBFA 0%, #F0F7F6 100%);
  border: 1px solid #E4EBE9;
  border-radius: 16px;
}
.quiz-result-score { margin-bottom: 16px; }
.quiz-result-pct {
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.quiz-result-detail {
  color: #4E6E6B;
  font-size: 15px;
  margin-top: 8px;
}
.quiz-result-msg {
  font-size: 16px;
  color: #0E2927;
  font-weight: 500;
  margin-bottom: 20px;
}
.quiz-result-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.quiz-result-topic {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: white;
  border: 1px solid #E4EBE9;
  border-radius: 10px;
  font-size: 14px;
}
.quiz-result-topic-name { color: #0E2927; font-weight: 500; }
.quiz-result-topic-score { color: #4E6E6B; }
.quiz-result-topic.is-weak { border-color: #E09F3E; }
.quiz-result-topic.is-weak .quiz-result-topic-score { color: #C8553D; font-weight: 600; }
.quiz-result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==========================================================
   Flashcards
========================================================== */
.cards-empty {
  padding: 48px 24px;
  text-align: center;
  color: #4E6E6B;
  background: #F9FBFB;
  border: 1px dashed #D0DAD8;
  border-radius: 16px;
}
.cards-empty strong {
  display: block;
  color: #0E2927;
  font-size: 16px;
  margin: 12px 0 6px;
}
.cards-empty p { margin: 0; font-size: 14px; }

.cards-topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.cards-progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cards-progress span {
  font-size: 13px;
  color: #4E6E6B;
  font-weight: 500;
}
.cards-progress-bar {
  height: 6px;
  background: #F0F7F6;
  border-radius: 999px;
  overflow: hidden;
}
.cards-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.cards-stats {
  display: flex;
  gap: 10px;
}
.cards-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: #4E6E6B;
}
.cards-stat strong {
  font-size: 15px;
  font-weight: 700;
  color: #0E2927;
}
.cards-stat-known { background: #E8F6F3; }
.cards-stat-known strong { color: var(--accent); }
.cards-stat-review { background: #FBEDE9; }
.cards-stat-review strong { color: #C8553D; }

/* Carte avec flip 3D */
.flashcard {
  position: relative;
  width: 100%;
  min-height: 300px;
  perspective: 1600px;
  cursor: pointer;
  margin-bottom: 20px;
  outline: none;
}
.flashcard:focus-visible .flashcard-inner {
  box-shadow: 0 0 0 3px rgba(14, 140, 130, 0.25);
  border-radius: 20px;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 300px;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.flashcard.is-flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 300px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #E4EBE9;
  box-shadow: 0 2px 8px rgba(14, 41, 39, 0.04);
}
.flashcard-front {
  background: white;
}
.flashcard-back {
  background: linear-gradient(180deg, #F7FBFA 0%, #F0F7F6 100%);
  transform: rotateY(180deg);
}
.flashcard-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.flashcard-topic {
  display: inline-block;
  padding: 3px 10px;
  background: #F0F7F6;
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.flashcard-topic:empty { display: none; }
.flashcard-diff {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.flashcard-diff[data-level="facile"]    { background: #E8F6F3; color: var(--accent); }
.flashcard-diff[data-level="moyen"]     { background: #FFF3E4; color: #C27F28; }
.flashcard-diff[data-level="difficile"] { background: #FBEDE9; color: #C8553D; }
.flashcard-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  font-weight: 500;
  color: #0E2927;
  line-height: 1.4;
  padding: 12px 0;
}
.flashcard-back .flashcard-content {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.55;
}
.flashcard-hint {
  font-size: 13px;
  color: #4E6E6B;
  text-align: center;
  font-style: normal;
  padding: 8px 14px;
  background: #F7FBFA;
  border-radius: 8px;
}
.flashcard-hint::before {
  content: "Indice : ";
  font-weight: 600;
  color: var(--accent);
}
.flashcard-flip-cta {
  font-size: 12px;
  color: #7A9492;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.cards-actions {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  gap: 10px;
}
@media (max-width: 640px) {
  .cards-actions { grid-template-columns: 1fr 1fr; }
}

.btn-success-soft {
  background: #E8F6F3;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-success-soft:hover { background: #D4EEE9; }
.btn-danger-soft {
  background: #FBEDE9;
  color: #C8553D;
  border: 1px solid #C8553D;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-danger-soft:hover { background: #F7DCD3; }

.cards-result {
  padding: 32px 24px;
  text-align: center;
  background: linear-gradient(180deg, #F7FBFA 0%, #F0F7F6 100%);
  border: 1px solid #E4EBE9;
  border-radius: 16px;
}
.cards-result-title {
  font-size: 22px;
  font-weight: 600;
  color: #0E2927;
  margin-bottom: 20px;
}
.cards-result-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin-bottom: 24px;
}
.cards-result-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cards-result-stats strong {
  font-size: 40px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.cards-result-stats div:last-child strong { color: #C8553D; }
.cards-result-stats span {
  font-size: 13px;
  color: #4E6E6B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cards-result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   PROGRESSION — panneau Ma progression
   ============================================================ */

/* Pill dans le header */
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 2px 2px;
  margin-right: 8px;
  border-radius: 999px;
  background: #EFF7F4;
  color: #0E2927;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}
.progress-pill-acc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #F7F6F2;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.progress-pill-sep {
  width: 1px; height: 12px; background: #C6D9D3;
}
.progress-pill-review { color: #4E6E6B; font-size: 12px; }

#open-progress { display: inline-flex; align-items: center; }

/* Empty state */
.progress-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  color: #4E6E6B;
}
.progress-empty strong { color: #0E2927; font-size: 16px; }
.progress-empty p { margin: 0; font-size: 14px; }

/* KPIs */
.progress-panel { display: flex; flex-direction: column; gap: 24px; padding-top: 16px; }

.progress-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 720px) {
  .progress-kpis { grid-template-columns: repeat(2, 1fr); }
}
.progress-kpi {
  background: #F7F6F2;
  border: 1px solid #E6E3DA;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.progress-kpi-value {
  font-family: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  font-weight: 700;
  font-size: 28px;
  color: #0E2927;
  line-height: 1.1;
}
.progress-kpi-label {
  font-size: 12px;
  color: #4E6E6B;
  text-transform: lowercase;
  letter-spacing: 0.01em;
}

/* Blocks */
.progress-block {
  background: #FFFFFF;
  border: 1px solid #E6E3DA;
  border-radius: 14px;
  padding: 20px;
}
.progress-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.progress-block-head h3 {
  margin: 0;
  font-family: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #0E2927;
}
.progress-block-sub { font-size: 12px; color: #7A7466; }

/* Chart */
.progress-chart { width: 100%; min-height: 220px; }
.progress-chart svg { width: 100%; height: auto; display: block; }
.progress-chart-empty {
  padding: 32px;
  text-align: center;
  color: #7A7466;
  font-size: 13px;
}

/* Topics bars */
.progress-topics { display: flex; flex-direction: column; gap: 10px; }
.progress-topic-row { display: flex; flex-direction: column; gap: 4px; }
.progress-topic-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px;
}
.progress-topic-name { color: #0E2927; font-weight: 500; }
.progress-topic-stat { color: #4E6E6B; font-variant-numeric: tabular-nums; }
.progress-topic-bar {
  height: 8px;
  border-radius: 4px;
  background: #EFECE4;
  overflow: hidden;
}
.progress-topic-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.progress-topics-empty { color: #7A7466; font-size: 13px; padding: 12px 0; }

/* Review cards preview */
.progress-review {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 720px) {
  .progress-review { grid-template-columns: 1fr; }
}
.progress-review-card {
  background: #FBFAF5;
  border: 1px solid #E6E3DA;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-review-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.progress-review-topic {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4E6E6B;
  font-weight: 500;
}
.progress-review-diff {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: #F7F6F2;
  background: #C27F28;
}
.progress-review-diff[data-level="facile"] { background: var(--accent); }
.progress-review-diff[data-level="moyen"]  { background: #C27F28; }
.progress-review-diff[data-level="difficile"] { background: #C8553D; }
.progress-review-front {
  color: #0E2927;
  font-size: 14px;
  line-height: 1.4;
}
.progress-review-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #7A7466;
  font-size: 13px;
  padding: 20px 12px;
}
.progress-review-more {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: #7A7466;
  padding: 6px 0;
}
.progress-review-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

/* Footer reset */
.progress-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ==================== Modale plein écran — fiche de révision ==================== */
body.revision-modal-open {
  overflow: hidden;
}
.revision-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  z-index: 1000;
  animation: revisionFade 0.15s ease-out;
}
@keyframes revisionFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.revision-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  width: min(960px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}
.revision-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.revision-modal-titles {
  min-width: 0;
  flex: 1;
}
.revision-modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.3;
  color: var(--text);
}
.revision-modal-subject {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.revision-modal-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  flex-shrink: 0;
}
.revision-modal-body {
  overflow-y: auto;
  padding: var(--s-5);
  flex: 1;
}
.revision-modal-body .revision-card {
  gap: var(--s-5);
}
.revision-modal-body .revision-block h4 {
  font-size: 15px;
}

/* ==================== Onboarding (première visite) ==================== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 33, 0.72);
  backdrop-filter: blur(6px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: onboarding-fade 0.35s ease-out;
}
@keyframes onboarding-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.onboarding-card {
  position: relative;
  background: var(--surface, #F7F6F2);
  color: var(--text, #0F1F21);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 48px);
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 0, 0, 0.06);
  animation: onboarding-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes onboarding-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.onboarding-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted, #5B6A6C);
  cursor: pointer;
  transition: all 0.15s;
}
.onboarding-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text, #0F1F21);
}
.onboarding-card h2 {
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 8px 0 12px;
  color: var(--text, #0F1F21);
}
.onboarding-sub {
  color: var(--text-muted, #5B6A6C);
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 24px;
  max-width: 60ch;
}
.onboarding-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.onboarding-steps li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: start;
  padding: 16px;
  background: rgba(14, 140, 130, 0.04);
  border: 1px solid rgba(14, 140, 130, 0.10);
  border-radius: 12px;
  transition: background 0.15s;
}
.onboarding-steps li:hover {
  background: rgba(14, 140, 130, 0.07);
}
.onboarding-step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent, var(--accent));
  color: var(--white, #FFFFFF);
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.onboarding-step-body h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #0F1F21);
}
.onboarding-step-body p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted, #5B6A6C);
}
.onboarding-step-body .btn-sm {
  font-size: 13px;
  padding: 6px 14px;
}
.onboarding-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding-top: 18px;
}
.onboarding-note {
  color: var(--text-muted, #5B6A6C);
  font-size: 12.5px;
  line-height: 1.4;
}
@media (max-width: 640px) {
  .onboarding-steps li {
    grid-template-columns: 32px 1fr;
    gap: 12px;
    padding: 14px;
  }
  .onboarding-step-num {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
}

/* ==================== Quota upgrade modal ==================== */
.quota-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 31, 33, 0.62);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: onboarding-fade 0.25s ease-out;
}
.quota-card {
  position: relative;
  background: var(--surface, #F7F6F2);
  color: var(--text, #0F1F21);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 0, 0, 0.06);
  animation: onboarding-pop 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.quota-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted, #5B6A6C);
  cursor: pointer;
  transition: all 0.15s;
}
.quota-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text, #0F1F21);
}
.quota-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent, var(--accent));
  background: rgba(14, 140, 130, 0.10);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.quota-card h3 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
  color: var(--text, #0F1F21);
}
.quota-card > p {
  color: var(--text-muted, #5B6A6C);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 20px;
}
.quota-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.quota-note {
  color: var(--text-muted, #5B6A6C);
  font-size: 12.5px;
  line-height: 1.45;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Tile en mode alerte quota atteint (beta freemium) */
.stats-tile-warn {
  border-color: rgba(220, 113, 64, 0.35) !important;
  background: rgba(220, 113, 64, 0.04) !important;
}
.stats-tile-warn strong {
  color: rgb(180, 82, 28);
}

/* ===== Share dialog ===== */
.share-url-row {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.share-url-input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
  background: #fafafa;
  color: #1f2937;
}
.share-url-input:focus {
  outline: 2px solid #111827;
  outline-offset: 1px;
  background: #fff;
}
.share-url-row .btn {
  white-space: nowrap;
}

/* ===== Edit course modal ===== */
.edit-course-card {
  max-width: 560px;
  width: 100%;
}
.edit-course-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.75rem;
}
.edit-course-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: #374151;
}
.edit-course-label input,
.edit-course-label textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 0.5rem;
  font-size: 0.92rem;
  font-family: inherit;
  background: #fff;
  color: #111827;
}
.edit-course-label textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}
.edit-course-label input:focus,
.edit-course-label textarea:focus {
  outline: 2px solid #111827;
  outline-offset: 1px;
}
.edit-course-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* ==================== PIPO — Devoir Q&R ==================== */
.qa-summary {
  color: var(--text-mute, #5a5a5a);
  font-size: 0.95rem;
  margin: 0.25rem 0 1rem;
}

.qa-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qa-item {
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: var(--surface-soft, #fafafa);
}

.qa-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.qa-num {
  flex-shrink: 0;
  background: var(--accent, #0b5cff);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.qa-question {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text, #111);
  line-height: 1.35;
  font-size: 1rem;
}

.qa-confidence {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.qa-confidence.conf-high { background: #e7f5ec; color: #1a7a3f; }
.qa-confidence.conf-mid  { background: #fff4e2; color: #8a5a12; }
.qa-confidence.conf-low  { background: #fbe8e8; color: #a23232; }

.qa-intro {
  margin: 0.35rem 0 0.7rem;
  color: var(--text, #222);
  line-height: 1.5;
  font-size: 0.95rem;
}

.qa-points {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: var(--text, #222);
  font-size: 0.93rem;
  line-height: 1.5;
}
.qa-points li {
  margin-bottom: 0.25rem;
}

.qa-citations {
  margin-top: 0.6rem;
  border-top: 1px dashed var(--border, #e5e5e5);
  padding-top: 0.7rem;
}

.qa-citations-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mute, #666);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.qa-citations-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.qa-citation {
  background: #fff;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.qa-citation-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.qa-citation-badge {
  background: var(--accent-soft, #e8efff);
  color: var(--accent, #0b5cff);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qa-citation-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text, #222);
}

.qa-citation-excerpt {
  margin: 0;
  padding: 0.35rem 0.6rem;
  border-left: 3px solid var(--accent, #0b5cff);
  background: #fafbff;
  color: var(--text, #222);
  font-size: 0.88rem;
  line-height: 1.5;
  font-style: italic;
}

.qa-citations-empty {
  margin-top: 0.6rem;
  border-top: 1px dashed var(--border, #e5e5e5);
  padding-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-mute, #777);
}

/* ==================== v16 : Mode SOLVE (devoir PDF résolu) ==================== */

.qa-item--solve {
  background: #fff;
  border-left: 3px solid var(--accent, #0b5cff);
  padding: 1.1rem 1.2rem 1.2rem;
}

.qa-item--solve .qa-num {
  background: #0b5cff;
  min-width: 2.2rem;
  text-align: center;
  font-size: 0.9rem;
  padding: 0.28rem 0.6rem;
}

.qa-question-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.qa-exercise-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text, #111);
  line-height: 1.3;
}

.qa-item--solve .qa-question {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text-mute, #555);
  line-height: 1.45;
}

.qa-calcs {
  margin: 0.6rem 0 0.8rem;
  background: #f6f9ff;
  border: 1px solid #d9e4ff;
  border-radius: 10px;
  padding: 0.7rem 0.9rem 0.85rem;
}

.qa-calcs-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #3a5bb3;
  margin-bottom: 0.45rem;
}

.qa-calcs-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text, #222);
  font-size: 0.92rem;
  line-height: 1.55;
}

.qa-calc-step {
  margin-bottom: 0.3rem;
  font-family: "SF Mono", "JetBrains Mono", "Consolas", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
}

.qa-final {
  margin: 0.55rem 0 0.7rem;
  background: #eaf7ed;
  border: 1px solid #b8e0c3;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-size: 0.92rem;
  color: #1a7a3f;
  line-height: 1.5;
}

.qa-final-label {
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: 0.3rem;
}

/* Hint quand un PDF de devoir est déposé */
#devoir-qa-hint.hint-solve {
  background: #eaf1ff;
  border-left: 3px solid #0b5cff;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  color: #1a3d8a;
  font-weight: 500;
}

/* ==================== Page Révision ==================== */
.page-main { padding: 2rem 0 4rem; }
.page-intro { margin-bottom: 2rem; }
.page-intro h1 { font-family: 'Cabinet Grotesk', sans-serif; font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; color: #0F1F21; margin: 0.4rem 0 0.6rem; }
.page-lede { color: #41595c; max-width: 720px; line-height: 1.55; }

.devoir-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .devoir-grid { grid-template-columns: 1fr; } }

.form-block { margin: 1rem 0; }
.form-label { display: block; font-weight: 600; color: #0F1F21; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.form-input { width: 100%; padding: 0.7rem 0.9rem; border: 1px solid #d6dadd; border-radius: 10px; background: #fff; font: inherit; color: #0F1F21; }
.form-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form-hint { color: #5f7679; font-size: 0.85rem; margin: 0.5rem 0 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { padding: 0.5rem 0.95rem; border-radius: 999px; border: 1px solid #d6dadd; background: #fff; cursor: pointer; font: inherit; color: #0F1F21; transition: all 0.15s ease; }
.chip:hover { border-color: var(--accent); }
.chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

.course-picker { display: flex; flex-direction: column; gap: 0.4rem; max-height: 240px; overflow-y: auto; padding: 0.4rem; border: 1px solid #e3e6e9; border-radius: 10px; background: #fafbfb; }
.picker-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border-radius: 8px; cursor: pointer; transition: background 0.12s; }
.picker-row:hover { background: #f0f5f5; }
.picker-row input[type="checkbox"] { margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.picker-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.picker-title { font-weight: 600; color: #0F1F21; }
.picker-meta { font-size: 0.8rem; color: #5f7679; }

.form-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }

.output-card { background: #fff; border: 1px solid #e3e6e9; border-radius: 18px; padding: 1.5rem; }
.output-head { margin-bottom: 1rem; }
.output-title { font-family: 'Cabinet Grotesk', sans-serif; font-size: 1.3rem; font-weight: 700; color: #0F1F21; margin: 0.3rem 0 0.4rem; }
.output-sub { color: #5f7679; margin: 0; }

.output-empty { text-align: center; color: #5f7679; padding: 2.5rem 1rem; border: 1px dashed #d6dadd; border-radius: 12px; }
.output-loading { text-align: center; padding: 2rem 1rem; color: #5f7679; }
.loading-spinner { width: 40px; height: 40px; margin: 0 auto 1rem; border: 3px solid #e3e6e9; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.revision-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.badge { display: inline-block; padding: 0.25rem 0.7rem; background: var(--accent); color: #fff; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-soft { background: #e6efef; color: #0F1F21; }

.revision-section { margin: 1.4rem 0; padding-top: 1.2rem; border-top: 1px solid #eef0f1; }
.revision-section:first-of-type { border-top: none; padding-top: 0; }
.revision-section h3 { font-family: 'Cabinet Grotesk', sans-serif; font-size: 1.1rem; color: #0F1F21; margin: 0 0 0.7rem; }
.revision-section h4 { font-size: 1rem; color: #0F1F21; margin: 0.8rem 0 0.4rem; }
.revision-section ul, .revision-section ol { margin: 0.4rem 0; padding-left: 1.3rem; }
.revision-section li { margin: 0.3rem 0; line-height: 1.5; color: #1a2b2d; }

.revision-subsection { margin: 0.8rem 0; padding: 0.8rem 1rem; background: #f7f9f9; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }

.revision-defs { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 0.5rem 1rem; margin: 0; }
.revision-defs dt { font-weight: 700; color: var(--accent); }
.revision-defs dd { margin: 0; color: #1a2b2d; line-height: 1.5; }

.revision-formulas { list-style: none; padding: 0; }
.revision-formula { background: #f0f5f5; border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0.5rem 0; }
.revision-formula-label { font-weight: 700; color: #0F1F21; }
.revision-formula-expr { font-family: 'SF Mono', Monaco, Consolas, monospace; color: #0a4744; margin: 0.2rem 0; }
.revision-formula-note { font-size: 0.85rem; color: #5f7679; }

.revision-example { background: #f7f9f9; border-radius: 12px; padding: 0.9rem 1rem; margin: 0.7rem 0; border-left: 3px solid #d4a943; }
.revision-example-source { font-weight: 700; color: #7a5d10; font-size: 0.85rem; margin-bottom: 0.4rem; }
.revision-example-context { margin: 0.3rem 0; color: #1a2b2d; }
.revision-example-steps { margin: 0.4rem 0; padding-left: 1.3rem; }
.revision-example-steps li { font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 0.92rem; color: #1a2b2d; }
.revision-example-result { margin-top: 0.5rem; padding: 0.4rem 0.7rem; background: #eaf7ed; border-radius: 6px; font-weight: 600; color: #0a4724; }
.revision-example-result span { color: #0a4724; opacity: 0.7; }

.revision-questions li { margin: 0.6rem 0; padding-bottom: 0.6rem; border-bottom: 1px dashed #e3e6e9; }
.revision-questions li:last-child { border-bottom: none; }
.revision-q { font-weight: 600; color: #0F1F21; margin-bottom: 0.3rem; }
.revision-a { color: #41595c; }

.output-actions { display: flex; gap: 0.6rem; margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid #eef0f1; flex-wrap: wrap; }

.library-section { margin-top: 3rem; }
.library-head { margin-bottom: 1rem; }
.library-head h2 { font-family: 'Cabinet Grotesk', sans-serif; font-size: 1.4rem; margin: 0.3rem 0 0.4rem; color: #0F1F21; }
.library-sub { color: #5f7679; margin: 0; }
.empty-state { text-align: center; color: #5f7679; padding: 2rem; border: 1px dashed #d6dadd; border-radius: 12px; }

/* Compatibilité avec course-list (déjà stylée) */

/* ==================== AUTH (login / signup) — v19 ==================== */
.auth-card {
  background: #ffffff;
  border: 1px solid var(--color-border, #e5e2d8);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-top: 32px;
}
.auth-title {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin: 8px 0 8px;
  color: #0F1F21;
  line-height: 1.15;
}
.auth-sub {
  color: #5a6566;
  margin: 0 0 24px;
  font-size: 15px;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .form-block { display: flex; flex-direction: column; gap: 6px; }
.auth-form .form-label { font-size: 13px; font-weight: 600; color: #2a3537; }
.auth-form .form-input {
  width: 100%; box-sizing: border-box;
  padding: 11px 14px;
  border: 1px solid #d8d4c8;
  border-radius: 10px;
  font-family: inherit; font-size: 15px;
  background: #fafaf6;
  transition: border-color 0.15s, background-color 0.15s;
}
.auth-form .form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(14, 140, 130,0.12);
}
.form-hint { font-size: 12px; color: #6a7172; margin-top: 2px; }
.form-hint-ok { color: #1d6a3d; }
.form-hint-warn { color: #b04a1a; }
.auth-error {
  background: #fef0eb;
  color: #a13a16;
  border: 1px solid #f4c4ad;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.auth-success {
  background: #ecf6ed;
  color: #2a6a3d;
  border: 1px solid #b8d8be;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.auth-form .btn-primary { margin-top: 6px; }
.auth-switch { margin: 18px 0 0; font-size: 14px; color: #4a5455; }
.auth-switch a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.auth-switch-soft { font-size: 13px; color: #777e7f; margin-top: 8px; }

/* ==================== Connexion sociale (SSO) ==================== */
.sso-block { margin-top: 4px; }
.sso-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 18px;
  color: #777e7f;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.sso-divider::before,
.sso-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e2d8;
}
.sso-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid #d8d4c5;
  background: #ffffff;
  color: #0F1F21;
  font-family: 'Satoshi', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.sso-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.sso-btn:active { transform: translateY(1px); }
.sso-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.sso-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.sso-btn-apple {
  background: #0F1F21;
  color: #F7F6F2;
  border-color: #0F1F21;
}
.sso-btn-apple:hover {
  background: #1a2b2d;
  border-color: #1a2b2d;
}
.sso-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff4f0;
  border: 1px solid #f5c8b5;
  color: #8a3a1a;
  font-size: 13px;
  line-height: 1.4;
}

/* ==================== TARIFS (pricing page) — v19 ==================== */
.pricing-header { text-align: center; margin: 48px 0 32px; }
.pricing-title {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 44px; font-weight: 800;
  color: #0F1F21; margin: 8px 0 12px; line-height: 1.1;
}
.pricing-sub { color: #4a5455; font-size: 17px; max-width: 600px; margin: 0 auto; }
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 40px 0 32px;
}
.pricing-loading { grid-column: 1/-1; text-align: center; color: #6a7172; padding: 40px; }
.pricing-card {
  background: #ffffff;
  border: 1px solid #e5e2d8;
  border-radius: 18px;
  padding: 32px 28px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.pricing-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,31,33,0.08); }
.pricing-card-featured {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(14, 140, 130,0.10);
}
.pricing-card-current { border-color: #d4a943; background: #fffbef; }
.pricing-badge {
  position: absolute;
  top: -12px; right: 24px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px; font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pricing-name {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 24px; font-weight: 700;
  margin: 0; color: #0F1F21;
}
.pricing-tagline { color: #6a7172; font-size: 14px; margin: 0; }
.pricing-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  margin: 8px 0;
}
.pricing-features {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 14.5px;
  color: #2a3537;
  flex: 1;
}
.pricing-features li {
  position: relative;
  padding-left: 22px;
}
.pricing-features li::before {
  content: ""; position: absolute;
  left: 0; top: 8px;
  width: 12px; height: 7px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.pricing-cta { margin-top: 8px; width: 100%; }
.pricing-cta:disabled {
  background: #f0ede4 !important;
  color: #6a7172 !important;
  border-color: #d8d4c8 !important;
  cursor: default;
}
.pricing-note {
  text-align: center;
  font-size: 13px;
  color: #6a7172;
  max-width: 700px;
  margin: 16px auto 48px;
  font-style: normal;
}

/* ==================== COMPTE (account page) — v19 ==================== */
.account-title {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 36px; font-weight: 700;
  color: #0F1F21;
  margin: 6px 0 28px;
  line-height: 1.1;
}
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
@media (max-width: 720px) {
  .account-grid { grid-template-columns: 1fr; }
}
.account-block {
  background: #ffffff;
  border: 1px solid #e5e2d8;
  border-radius: 16px;
  padding: 24px 22px;
}
.account-h2 {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 18px; font-weight: 700;
  color: #0F1F21;
  margin: 0 0 16px;
}
.account-dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.account-dl dt { color: #6a7172; font-weight: 600; }
.account-dl dd { margin: 0; color: #2a3537; }
.account-plan { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.account-plan-name {
  font-family: 'Cabinet Grotesk', system-ui, sans-serif;
  font-size: 24px; font-weight: 700;
  color: var(--accent);
}
.account-plan-price { font-size: 16px; font-weight: 600; color: #2a3537; }
.account-plan-tag { font-size: 14px; color: #6a7172; }
.account-plan-features {
  list-style: none; padding: 0; margin: 12px 0 0;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 14px; color: #2a3537;
}
.account-plan-features li { position: relative; padding-left: 18px; }
.account-plan-features li::before {
  content: "·"; position: absolute; left: 4px; top: -2px;
  font-size: 18px; color: var(--accent); font-weight: 800;
}
.account-actions { display: flex; justify-content: flex-end; }
/* .btn-ghost — la définition canonique vit dans styles.css */


/* ============================================================
   v21 — Onglets nav verrouillés (compte requis)
   ============================================================ */
.nav a.nav-locked,
.mobile-nav a.nav-locked {
  opacity: 0.6;
  position: relative;
}
.nav a.nav-locked:hover,
.mobile-nav a.nav-locked:hover {
  opacity: 0.85;
}
.nav-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  vertical-align: -2px;
  color: currentColor;
  opacity: 0.75;
}
.nav-lock svg {
  display: block;
}

/* Bandeau d'info contextuel sur la page login */
.auth-context-notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  color: var(--text-2, #475569);
  font-size: 0.95rem;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.auth-context-notice svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: rgb(99, 102, 241);
}

/* =========================================================
   v27 — Hub "Mon espace" (compte.html)
   ========================================================= */

.hub-page {
  padding-bottom: var(--s-9);
}

.hub-hero {
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-7);
}

.hub-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw + 12px, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: var(--s-2) 0 var(--s-3);
  color: var(--text);
}

.hub-subtitle {
  color: var(--text-muted);
  font-size: var(--text-base);
  margin: 0;
}

.hub-section {
  margin-bottom: var(--s-7);
}

.hub-section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--s-4);
}

/* Carte Cursus (hero) */
.cursus-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-6);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--white);
  border-radius: var(--r-lg);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.cursus-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 80% at 90% 0%, rgba(255, 255, 255, 0.18), transparent 70%);
  pointer-events: none;
}
.cursus-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(14, 41, 39, 0.18);
}
.cursus-card-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}
.cursus-card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  opacity: 0.75;
  margin-bottom: var(--s-2);
}
.cursus-card-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.2vw + 12px, 30px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: var(--s-2);
}
.cursus-card-meta {
  font-size: var(--text-sm);
  opacity: 0.92;
  line-height: 1.5;
  max-width: 60ch;
}
.cursus-card-cta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--text-sm);
  white-space: nowrap;
  transition: background 0.2s ease;
}
.cursus-card:hover .cursus-card-cta {
  background: rgba(255, 255, 255, 0.28);
}

/* Grille outils */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.tool-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: var(--s-2);
}
.tool-card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.tool-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.tool-card-meta {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
  padding-top: var(--s-3);
}

/* Footer grid : profil + plan */
.hub-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-5);
}
.hub-card {
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.hub-card .hub-section-title {
  margin-bottom: var(--s-4);
}

@media (max-width: 640px) {
  .cursus-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .cursus-card-cta {
    align-self: stretch;
    justify-content: center;
  }
}

/* Bouton "Retour à mon espace" sur les pages outils */
.back-to-hub {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
  margin-bottom: var(--s-4);
}
.back-to-hub:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.back-to-hub svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   v28 — Cursus généraliste (cursus.html)
   ========================================================================== */
.cursus-page {
  padding-bottom: 140px; /* place pour la barre actions sticky */
}

.cursus-step {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  margin-top: var(--s-5);
  box-shadow: 0 1px 2px rgba(15, 31, 33, 0.03);
}

.cursus-step-head {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  margin-bottom: var(--s-5);
}

.cursus-step-num {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}

.cursus-step-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
}

.cursus-step-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Formulaire profil */
.cursus-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

.cursus-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cursus-field-wide {
  grid-column: 1 / -1;
}

.cursus-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cursus-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.cursus-input::placeholder {
  color: #99a3a4;
}

.cursus-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: white;
}

.cursus-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23556668' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.cursus-textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
}

/* Liste des matières */
.matieres-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.matiere-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.matiere-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.matiere-header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.matiere-input.matiere-name {
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  width: 100%;
  min-width: 0;
}

.matiere-input.matiere-name::placeholder {
  font-weight: 500;
  color: #99a3a4;
}

.matiere-input.matiere-name:focus {
  outline: none;
  background: white;
  border-color: var(--accent);
}

.matiere-remove {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.matiere-remove:hover {
  color: #B23A3A;
  border-color: #E8B6B6;
  background: #FBEEEE;
}

.matiere-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--s-3);
}

.matiere-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* Bouton ajouter une matière */
.btn-add-matiere {
  margin-top: var(--s-4);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px dashed var(--accent);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
}

.btn-add-matiere:hover {
  background: #D9EEEB;
  transform: translateY(-1px);
}

.btn-add-matiere svg {
  flex: 0 0 auto;
}

.cursus-empty {
  margin-top: var(--s-3);
  padding: var(--s-4);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.cursus-empty p {
  margin: 0;
}

/* Récap visuel */
.cursus-recap-summary {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.recap-line {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text);
}

.recap-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.recap-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.recap-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid #C5E2DE;
}

.recap-pill-meta {
  font-weight: 500;
  color: var(--text-muted);
  font-size: var(--text-xs);
  border-left: 1px solid #C5E2DE;
  padding-left: 8px;
}

/* Barre actions fixe en bas du viewport */
.cursus-actions-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  width: calc(100% - 32px);
  max-width: 828px; /* container 860px - 2*16px de marge */
  padding: 12px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 32px rgba(15, 31, 33, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  z-index: 30;
}

.cursus-save-status {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.cursus-save-status.is-saved {
  color: var(--accent);
  font-weight: 600;
}

.cursus-actions-btns {
  display: inline-flex;
  gap: var(--s-2);
}

.cursus-note {
  margin-top: var(--s-5);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 720px) {
  .cursus-form-grid {
    grid-template-columns: 1fr;
  }
  .matiere-grid {
    grid-template-columns: 1fr;
  }
  .cursus-actions-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .cursus-actions-btns {
    justify-content: center;
  }
  .cursus-step {
    padding: var(--s-4);
  }
}

/* ==========================================================================
   v29 — Sélecteur matière commun aux outils (cursus-selector.js)
   ========================================================================== */
.cursus-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cursus-selector-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cursus-selector-select,
.cursus-selector-free {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-base);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.cursus-selector-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23556668' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.cursus-selector-select:focus,
.cursus-selector-free:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cursus-selector-hint {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.cursus-selector-hint a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}

.cursus-selector-hint a:hover {
  text-decoration: underline;
}

/* ==================== Mes statistiques (P1-3) ==================== */
.stats-page {
  padding-bottom: var(--s-7);
}
.stats-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-7) 0;
  color: var(--text-muted);
}
.stats-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: stats-spin 0.9s linear infinite;
}
@keyframes stats-spin {
  to { transform: rotate(360deg); }
}
.stats-empty {
  text-align: center;
  padding: var(--s-6) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-top: var(--s-5);
}
.stats-empty h2 {
  font-size: var(--text-xl);
  margin: 0 0 var(--s-2);
}
.stats-empty p {
  color: var(--text-muted);
  margin: 0 auto var(--s-4);
  max-width: 480px;
}
.stats-empty-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: center;
  flex-wrap: wrap;
}
.stats-error {
  text-align: center;
  padding: var(--s-5);
  color: var(--text-muted);
}
.stats-error p {
  margin: 0 0 var(--s-3);
}

/* Cards KPI */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 160ms ease, transform 160ms ease;
}
.stats-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.stats-card-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
}
.stats-card-value {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stats-card-foot {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Section générique stats */
.stats-section {
  margin-top: var(--s-6);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.stats-section-title {
  margin: 0 0 var(--s-2);
  font-size: var(--text-xl);
}
.stats-section-desc {
  margin: 0 0 var(--s-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* Détail sessions */
.stats-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.stats-detail-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s-3);
  background: var(--surface-alt);
  border-radius: var(--r-sm);
}
.stats-detail-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.stats-detail-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Chart historique */
.stats-chart-wrap {
  background: var(--surface-alt);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  overflow: hidden;
}
.stats-chart {
  width: 100%;
  height: auto;
  display: block;
}
.stats-chart-legend {
  display: flex;
  gap: var(--s-3);
  margin-top: var(--s-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-dot-quiz { background: var(--accent); }
.legend-dot-cards { background: #E8B45C; }

/* Topics */
.stats-topics-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.topic-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.topic-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-2);
}
.topic-name {
  font-weight: 600;
  color: var(--text);
}
.topic-score {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-alt);
}
.topic-score-low { background: rgba(220, 80, 70, 0.15); color: #E07A6B; }
.topic-score-mid { background: rgba(232, 180, 92, 0.15); color: #E8B45C; }
.topic-score-high { background: rgba(14, 140, 130, 0.18); color: var(--accent); }
.topic-bar {
  height: 8px;
  background: var(--surface-alt);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.topic-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 320ms ease;
}
.topic-bar-low { background: #E07A6B; }
.topic-bar-mid { background: #E8B45C; }
.topic-bar-high { background: var(--accent); }
.topic-meta {
  font-size: var(--text-xs);
  color: var(--text-faint);
}

/* Tableau récent */
.stats-table-wrap {
  overflow-x: auto;
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.stats-table th,
.stats-table td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.stats-table th {
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
}
.stats-table td {
  color: var(--text);
}
.stats-table tr:last-child td {
  border-bottom: none;
}
.stats-table .cell-num {
  text-align: right;
}

/* CTA bar */
.stats-cta-bar {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-6);
  justify-content: center;
}

/* Mobile */
@media (max-width: 640px) {
  .stats-card-value { font-size: 1.9rem; }
  .stats-detail-value { font-size: 1.25rem; }
  .stats-section { padding: var(--s-4); }
}

/* ============================================================
   P1-5 — Mobile responsive fixes (v=39)
   ============================================================ */

/* Fix overflow horizontal causé par les longs mots/URLs/refs juridiques */
.legal-content,
.legal-content li,
.legal-content p,
.legal-content a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Fix .app-header grid qui ne wrappe pas en mobile (devoir, cours) */
@media (max-width: 600px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  .app-header-actions {
    justify-content: flex-start;
  }
  .app-header-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* Tap targets confortables sur mobile (min 40px) */
@media (max-width: 600px) {
  .site-footer a,
  .footer-links a,
  .footer-legal a,
  footer a {
    padding-block: 6px;
    display: inline-block;
    min-height: 36px;
    line-height: 1.4;
  }
}

/* Sécurité globale : empêcher tout scroll horizontal accidentel */
html, body {
  overflow-x: hidden;
}

/* Forcer le wrap des contenus dynamiques (emails, IDs, URLs) */
.user-email,
.token-display,
[data-long-text] {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ============================================================
   v40 — Lien Connexion / Mon espace dans la nav
   Style discret façon "ghost" pour ne pas concurrencer le CTA principal.
   ============================================================ */
.nav-auth-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.nav-auth-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Mobile nav : adaptation du bouton */
.mobile-nav .nav-auth-link {
  display: inline-block;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  text-align: center;
  margin: 6px 0;
}
