/* Les compositions reprennent les maquettes personnelles, desktop et mobile. */
.student-space { max-width: var(--content-max-width); gap: 18px; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.student-title { display: flex; align-items: center; gap: var(--sp-3); margin: 0; }
.student-title h1 { font-family: var(--font-display); font-size: 28px; line-height: 1.2; margin: 0; font-weight: 800; }
.student-title p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.student-back { display: grid; place-items: center; flex: 0 0 36px; height: 44px; color: var(--text); border-radius: var(--r-xs); }
.student-back svg { width: 26px; height: 26px; }
.student-muted { color: var(--muted); font-size: 13px; }
.student-space h2 { font-family: var(--font-display); font-size: 21px; line-height: 1.2; margin: 0; }
.student-space h3 { font-size: 15px; line-height: 1.35; margin: 0; }
.student-space p { line-height: 1.5; }
.student-space .form-status:empty { display: none; }
.student-space .text-link { font-size: 13px; font-weight: 800; }
.student-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.student-icon { width: 28px; height: 28px; flex-shrink: 0; display: block; object-fit: contain; }
.student-empty { padding: var(--sp-3) 0; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.student-info { margin: 0; border-radius: var(--r-sm); background: var(--soft); color: var(--muted); padding: 14px var(--sp-4); font-size: 13px; }

/* Tableau de bord : accueil, quatre compteurs, activité et matières. */
.student-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--sp-2); }
.student-subject-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; }
.student-subject-icon .student-icon { width: 40px; height: 40px; }

/* Profil : matières/séries/badges puis réglages, dans l'ordre de lecture mobile. */
.student-space form { display: grid; gap: 10px; }
.student-space form .button { margin-top: var(--sp-1); }
.student-class-display { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.student-class-display .field__label { margin: 0; }
.student-class-chip { white-space: normal; }
.student-subjects { border: 0; padding: 0; margin: 10px 0; }
.student-subjects legend { font-weight: 800; margin-bottom: var(--sp-3); }
.student-subjects h3 { margin-top: var(--sp-3); color: var(--muted); }
.student-check { display: flex; align-items: center; gap: 10px; padding: 10px 0; min-height: 44px; }
.student-check input { width: 20px; height: 20px; accent-color: var(--violet); }
.student-subject-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.student-subject-chip { display: inline-flex; align-items: center; gap: 7px; border: 2px solid var(--border); border-bottom-width: 3px; border-radius: 12px; background: var(--soft); padding: 5px 9px 5px 5px; text-decoration: none; color: var(--text); font-size: 12px; font-weight: 800; }
.student-subject-chip .student-subject-icon { width: 28px; height: 28px; }
.student-subject-chip .student-icon { width: 24px; height: 24px; }
.student-switch { display: inline-flex; position: relative; flex-shrink: 0; width: 52px; height: 32px; cursor: pointer; }
.student-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.student-switch > span { width: 52px; height: 30px; border-radius: 16px; background: var(--border); border: 2px solid var(--border); pointer-events: none; transition: background .15s; }
.student-switch > span::after { content: ''; display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); margin: 2px; transition: transform .15s; }
.student-switch input:checked + span { background: var(--violet); border-color: var(--violet-dark); }
.student-switch input:checked + span::after { background: var(--on-accent); transform: translateX(20px); }
.student-switch input:focus-visible + span { outline: 3px solid var(--brand-text); outline-offset: 3px; }
.student-switch input:disabled + span { opacity: .5; }
/* Sous 768 px, le menu latéral (et son « Se déconnecter ») est masqué : le profil prend le relais. */
.student-danger { font-size: 12px; color: var(--muted); }
.student-danger > .student-delete-toggle { display: flex; width: 100%; list-style: none; cursor: pointer; --button-edge: var(--red-strong); color: var(--red-strong); background: var(--surface); }
.student-delete-toggle::-webkit-details-marker { display: none; }
.student-danger > p { margin: 14px 0; }

/* Progression : anneau à gauche et chapitres à droite sur grand écran. */
.student-progress-grid { display: grid; gap: 22px; }
.student-progress-summary { text-align: center; min-width: 0; }
.student-mastery { width: 180px; height: 180px; position: relative; margin: 0 auto; }
.student-mastery__ring { width: 100%; height: 100%; fill: none; stroke-width: 14px; }
.student-mastery__track { stroke: var(--border); }
.student-mastery__value { stroke: var(--violet); stroke-linecap: round; }
.student-mastery > strong { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 44px; color: var(--brand-text); }
.student-mastery-label { font-weight: 800; margin: 10px 0 2px; font-size: 15px; }
.student-progress-summary > .student-muted { margin: 0; }
.student-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); margin: var(--sp-5) 0 var(--sp-3); }
.student-metrics > div { display: flex; flex-direction: column-reverse; gap: 5px; padding: var(--sp-3) 5px; border: 2px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.student-metrics dt { color: var(--muted); font-size: 10px; line-height: 1.3; }
.student-metrics dd { margin: 0; font-family: var(--font-display); font-size: 27px; line-height: 1.1; }
.student-cards-note { font-size: 12px; color: var(--muted); margin: 0 0 18px; }
.student-progress-cta { width: 100%; white-space: normal; }
.student-chapters { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.student-chapters > h2 { margin-bottom: 2px; }
.student-chapter { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 14px; border: 2px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.student-chapter__body { flex: 1; min-width: 0; }
.student-chapter__body p { font-size: 12px; color: var(--muted); margin: 5px 0 9px; }
.student-chapter__icon { flex-shrink: 0; }
.student-chapter__icon .student-icon { width: 32px; height: 32px; }
.student-row__actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.student-row__actions a { padding: 3px 0; }

/* Boutique et calendrier : même colonne de 720px que les maquettes. */
.student-space--shop [data-role="shop"], .student-calendar-content { display: flex; flex-direction: column; gap: 14px; }
.student-gem-balance { display: flex; align-items: center; gap: 14px; background: var(--cyan-bg); color: var(--cyan-text); padding: 18px; border-radius: var(--r-xl); }
.student-gem-balance > .student-icon { width: 54px; height: 54px; }
.student-gem-balance h2 { color: var(--cyan); font-size: 2.625rem; line-height: 1; }
.student-gem-balance p { margin: 0; font-weight: 800; font-size: 0.875rem; }
.student-product { border-bottom-width: 4px; background: var(--surface); display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); border: 0; border-radius: var(--r-xl); }
.student-product__heading { display: flex; gap: 14px; margin-bottom: var(--sp-4); align-items: center; margin: 0; }
.student-product__icon { display: grid; place-items: center; flex-shrink: 0; width: 64px; height: 64px; border-radius: 20px; background: var(--soft); }
.student-product__icon .student-icon { width: 36px; height: 36px; }
.student-product h2 { font-size: 1.25rem; }
.student-product p { color: var(--muted); margin: 0; font-weight: 700; font-size: 0.875rem; }
.student-stock { display: inline-block; border-radius: 8px; background: var(--soft); font-size: 11px; padding: var(--sp-1) 7px; margin-top: var(--sp-2); color: var(--muted); font-weight: 800; }
.student-product__action { width: 100%; gap: var(--sp-2); min-height: 54px; border-radius: var(--r-md); font-size: 1.0625rem; text-transform: uppercase; }
.student-product .student-product__hint { margin-top: 10px; margin: 0; color: var(--muted); font-weight: 800; font-size: 0.8125rem; text-align: left; }
.student-calendar-intro h2 { font-size: 22px; margin-bottom: var(--sp-2); }
.student-calendar-intro p { margin: 0 0 10px; }
.student-calendar-source { display: inline-block; padding: 6px 10px; border-radius: 8px; background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 800; }
.student-exam-card { display: flex; align-items: center; gap: var(--sp-3); padding: 14px; border: 2px solid var(--border); border-radius: 16px; background: var(--surface); }
.student-exam-card__body { flex: 1; min-width: 0; }
.student-exam-card h2 { font-family: var(--font-body); font-size: 16px; font-weight: 900; }
.student-exam-card p { color: var(--muted); margin: 5px 0; font-size: 12px; }
.student-exam-card .text-link { font-size: 11px; }
.student-exam-card[data-enabled="false"] .student-subject-icon { filter: grayscale(1); opacity: .6; }
.student-calendar-content > .button { width: 100%; }
.student-space [data-role="content"] { animation: student-enter .2s ease-out; }
@keyframes student-enter { from { opacity: .3; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (min-width: 960px) {
  body:has(.student-space) .app__main { position: relative; }
  .student-space { padding: var(--sp-6) var(--content-gutter) 48px; gap: 22px; }
  .student-space > .student-title { min-height: 44px; padding-right: 64px; }
  .student-title h1 { font-size: 32px; }
  .student-stack { gap: 18px; }
  .student-progress-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--space-6); align-items: start; }
  .student-progress-summary { padding-top: var(--sp-3); }
  .student-chapters { grid-column: 2; grid-row: 1 / span 2; }
  .student-progress-cta { grid-column: 1; grid-row: 2; align-self: start; }
  .student-mastery { width: 210px; height: 210px; }
  .student-mastery > strong { font-size: 48px; }
}
@media (max-width: 400px) {
  .student-exam-card { padding: var(--sp-3); gap: 10px; }
  .student-exam-card > .student-subject-icon, .student-exam-card .student-subject-icon .student-icon { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .student-space [data-role="content"] { animation: none; }
  .student-switch > span, .student-switch > span::after { transition: none; }
}

/* --- Refonte v2, phase 6 : boutique (maquette compte/BoutiqueMobile) --------- */
.student-space--shop [data-role="shop"] { gap: var(--sp-5); }
.student-product__heading > div { display: flex; flex-direction: column; gap: 2px; }
.student-product .student-stock { display: block; margin: 0; padding: 0; background: none; color: var(--accent-text); font-family: var(--font-display); font-weight: 800; font-size: 0.875rem; }
.student-product__action:disabled { --button-edge-size: 0px; background: var(--soft); color: var(--muted-2); box-shadow: none; opacity: 1; }
.student-product__gem { width: 20px; height: 20px; }

@media (max-width: 767px) {
  .student-space--shop .student-title { display: none; }
}
