/* HV-Learn — charte graphique (F-GEN-001 v2). Conception mobile d'abord.
   Sobre et lisible : fond blanc, texte presque noir, un bleu d'accent, police système, angles peu arrondis. */

:root {
  /* Interface (RG-GEN-001-1) */
  --primaire: #0F6CBD; --primaire-f: #0C5494; --primaire-c: #EBF3FC;
  --fond: #FAFAFA; --blanc: #fff; --texte: #161616; --gris: #505050;
  --bord: #E0E0E0; --bord-f: #8A8886; --survol: #F2F2F2;
  --ombre: 0 1px 2px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .06);
  /* Couleurs de sens : réussite, attention, erreur */
  --vert: #107C10; --vert-f: #0B5A0B; --vert-c: #E6F4E6;
  --orange: #D83B01; --orange-f: #A6330A; --orange-c: #FDEEE5;
  --jaune: #FFB900; --jaune-f: #6D5200; --jaune-c: #FFF4CE;
  --mauve: #8764B8; --mauve-f: #5C2E91; --mauve-c: #F1EAF9;
  --rouge-f: #A4262C; --rouge-c: #FDE7E9;
  /* Code couleur des matières (RG-GEN-001-2) */
  --math: var(--vert); --math-c: var(--vert-c);
  --pc: var(--orange); --pc-c: var(--orange-c);
  --philo: var(--mauve); --philo-c: var(--mauve-c);
  --exam: var(--jaune); --exam-c: var(--jaune-c);
  --rayon: 8px;
  --nav-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: 'Segoe UI', 'Segoe UI Variable Text', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

h1 { font-size: 1.6rem; font-weight: 600; margin: 0 0 16px; color: var(--primaire-f); text-wrap: balance; }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--primaire-f); font-weight: 600; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.muted { color: var(--gris); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { flex: none; }

/* ---------- Gabarit (F-GEN-002) ---------- */

.shell { min-height: 100vh; padding-bottom: var(--nav-h); }
.main { min-width: 0; }
.content { padding: 16px; max-width: 1200px; margin: 0 auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; color: var(--blanc);
  background: linear-gradient(110deg, var(--vert-f) 0%, var(--vert-f) 55%, var(--orange-f) 100%);
}
.countdown { margin: 0; }
.countdown b { font-size: 1.3rem; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 4px; }
.topbar-user form { margin: 0; }
.topbar-user a, .btn-icon {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 8px;
  justify-content: center; color: var(--blanc); text-decoration: none; background: none; border: 0;
  border-radius: 4px; font: inherit; font-weight: 600; cursor: pointer;
}
.topbar-user a:hover, .btn-icon:hover { background: rgba(255, 255, 255, .18); }
.topbar-user a span { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile : barre d'onglets en bas d'écran (RG-GEN-002-3) */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: var(--nav-h);
  background: var(--blanc); border-top: 1px solid var(--bord);
}
.nav .brand { display: none; }
.nav ul { display: flex; height: 100%; margin: 0; padding: 0; list-style: none; }
.nav li { flex: 1; min-width: 0; }
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 100%; min-height: 44px; padding: 4px; color: var(--gris); text-decoration: none;
  font-size: .72rem; font-weight: 600; text-align: center;
}
.nav a.active { color: var(--primaire-f); box-shadow: inset 0 3px 0 var(--primaire); }

/* Ordinateur : barre latérale gauche */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 230px 1fr; padding-bottom: 0; }
  .nav { position: sticky; top: 0; height: 100vh; border-top: 0; border-right: 1px solid var(--bord); padding: 16px 12px; }
  .nav .brand { display: block; }
  .nav ul { display: block; height: auto; }
  .nav a {
    flex-direction: row; justify-content: flex-start; gap: 10px; height: auto; padding: 10px 12px;
    border-radius: 4px; font-size: 1rem; text-align: left;
  }
  .nav a:hover { background: var(--primaire-c); color: var(--primaire-f); }
  .nav a.active { background: var(--primaire-c); box-shadow: none; }
  .content { padding: 24px; }
}

.brand { font-size: 1.4rem; font-weight: 600; color: var(--primaire-f); margin: 0 0 18px; }
.brand small { display: block; font-size: .85rem; font-weight: 600; color: var(--gris); }

/* Pages hors connexion */
.guest-main { max-width: 460px; margin: 0 auto; padding: 32px 16px; }
.guest .brand { text-align: center; }
.guest-main > .card:not(.card-narrow) { margin-top: 14px; }

/* ---------- Composants ---------- */

.card {
  background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 16px; margin-bottom: 14px;
}
.card-narrow { max-width: 460px; }

.flash { padding: 10px 14px; border-radius: 4px; font-weight: 600; border-left: 5px solid; margin: 0 0 14px; }
.flash-success { background: var(--vert-c); color: var(--vert-f); border-color: var(--vert); }
.flash-error { background: var(--rouge-c); color: var(--rouge-f); border-color: var(--rouge-f); }
.flash-info { background: var(--jaune-c); color: var(--jaune-f); border-color: var(--jaune); }
.flash.is-leaving { opacity: 0; transition: opacity .4s; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 18px; border-radius: 4px; border: 2px solid var(--primaire-f);
  background: var(--blanc); color: var(--primaire-f); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primaire-c); }
.btn-primary { background: var(--primaire-f); color: var(--blanc); }
.btn-primary:hover { background: #0C5494; }

.form { display: grid; gap: 6px; }
.form label { font-weight: 600; margin-top: 8px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number],
.form input[type=date], .form select, .form textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--gris); border-radius: 4px;
  background: var(--blanc); color: var(--texte); font: inherit;
}
.form input[aria-invalid=true] { border-color: var(--rouge-f); border-width: 2px; }
.form .check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.form .check input { width: 20px; height: 20px; accent-color: var(--primaire-f); flex: none; }
.form .btn { margin-top: 12px; }
.field-error { color: var(--rouge-f); font-weight: 600; font-size: .9rem; margin: 0; }
.field-hint { color: var(--gris); font-size: .9rem; margin: 0; }

.facts { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0 0 16px; }
.facts dt { color: var(--gris); font-size: .9rem; }
.facts dd { margin: 0 0 8px; font-weight: 600; overflow-wrap: anywhere; }
@media (min-width: 600px) {
  .facts { grid-template-columns: max-content 1fr; }
  .facts dd { margin: 0; }
}

/* Pages d'erreur (RG-GEN-002-6) */
.error-page { text-align: center; }
.error-code { font-size: 3rem; font-weight: 600; color: var(--orange-f); margin: 0; line-height: 1.1; }
.error-detail { font-size: .85rem; overflow-wrap: anywhere; }
.error-detail pre { overflow-x: auto; background: var(--fond); padding: 10px; border-radius: 8px; }

/* ---------- Planning et séances (F-PLAN-002) ---------- */

h1 small { display: block; font-size: .95rem; font-weight: 600; color: var(--gris); margin-top: 2px; }
h2.section { margin: 22px 0 10px; color: var(--primaire-f); }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }
.lead { font-size: 1.05rem; }

.session-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.session {
  border-radius: 4px; padding: 10px 12px; border-left: 5px solid var(--c); background: var(--c-clair); margin-bottom: 8px;
}
.session.is-math { --c: var(--math); --c-clair: var(--math-c); --c-texte: var(--vert-f); }
.session.is-pc { --c: var(--pc); --c-clair: var(--pc-c); --c-texte: var(--orange-f); }
.session.is-philo { --c: var(--philo); --c-clair: var(--philo-c); --c-texte: var(--mauve-f); }
.session.is-exam { --c: var(--exam); --c-clair: var(--exam-c); --c-texte: var(--jaune-f); }
.session-head { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 2px; color: var(--c-texte); }
.session-time { font-weight: 600; white-space: nowrap; }
.session-text { margin: 0 0 6px; font-size: .95rem; }
.session-date { margin: 0 0 4px; font-weight: 600; color: var(--gris); font-size: .9rem; }
.session.status-validee { opacity: .75; }

.badge {
  display: inline-block; margin: 0; padding: 1px 9px; border-radius: 20px; font-size: .8rem; font-weight: 600;
  background: var(--blanc); border: 1px solid currentColor; color: var(--gris);
}
.badge-declaree { color: var(--jaune-f); }
.badge-validee { color: var(--vert-f); }
.badge-refusee, .badge-manquee { color: var(--rouge-f); }

.week-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.week-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 700px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .week-grid { grid-template-columns: repeat(5, 1fr); } }
.day { background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px; min-width: 0; }
.day h2, .day h3 { font-size: 1rem; margin: 0 0 8px; }
.day.is-today { border: 2px solid var(--orange); }
.day.is-today h2, .day.is-today h3 { color: var(--orange-f); }
.day-total { margin: 4px 0 0; text-align: right; color: var(--gris); font-size: .9rem; font-weight: 600; }
.card .day { background: var(--fond); }

.objectives { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.objectives li { padding-left: 12px; border-left: 5px solid var(--c); }
.objectives li b { display: inline-block; min-width: 9.5em; }
.objectives .is-math { --c: var(--math); } .objectives .is-pc { --c: var(--pc); }
.objectives .is-philo { --c: var(--philo); } .objectives .is-exam { --c: var(--exam); }

.progress-label { margin: 0 0 4px; }
.bar { height: 14px; background: #E6E6E6; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--vert); }

.rest { background: var(--vert-c); border-color: var(--vert); }
.rest h2 { color: var(--vert-f); }

/* ---------- Échéances (F-PLAN-004) ---------- */

.deadlines { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.deadlines li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.deadline-date { font-weight: 600; white-space: nowrap; }
.estimated { color: var(--orange-f); font-weight: 600; font-style: normal; font-size: .9rem; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; border-radius: 6px; padding: 1px 7px; background: #EDEDED; color: var(--texte); }
.tag-bac { background: var(--mauve-f); color: var(--blanc); }
.tag-parcoursup { background: var(--orange-f); color: var(--blanc); }
.tag-examen { background: var(--jaune); color: var(--texte); }

/* ---------- Tableau de bord et tableaux ---------- */

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.tile { background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px; }
.tile small { display: block; color: var(--gris); font-weight: 600; }
.tile b { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.tile span { font-size: .85rem; color: var(--gris); }
.tile.is-pending b { color: var(--gris); }

.table-wrap { overflow-x: auto; background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--rayon); margin-bottom: 14px; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--gris); padding: 10px 12px; border-bottom: 2px solid var(--bord); }
.table td { padding: 10px 12px; border-bottom: 1px solid #EDEDED; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { margin: 0; }
.btn-small { padding: 4px 12px; font-size: .9rem; border-width: 1px; }

.credentials { background: var(--jaune-c); border: 2px solid var(--jaune); }
.credentials code { font-size: 1.2rem; font-weight: 600; letter-spacing: 1px; user-select: all; }

/* ---------- Séances : déclaration et validation (F-SUIVI-001, F-SUIVI-002) ---------- */

a.session { display: block; color: var(--texte); text-decoration: none; font-weight: 400; }
a.session:hover { box-shadow: 0 0 0 2px var(--c); }
a.session .session-head { display: flex; }
a.session .session-text { display: block; }
.session-reason { display: block; margin-top: 6px; font-size: .9rem; font-weight: 600; color: var(--rouge-f); }
.badge-retard { color: var(--orange-f); }

.session-detail { border-left: 6px solid var(--c); }
.session-detail.is-math { --c: var(--math); } .session-detail.is-pc { --c: var(--pc); }
.session-detail.is-philo { --c: var(--philo); } .session-detail.is-exam { --c: var(--exam); }
.session-detail .session-text { font-size: 1.1rem; font-weight: 600; }

.proofs { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.proofs li { display: grid; gap: 6px; justify-items: center; }
.proofs img, .proof-pdf {
  display: block; width: 120px; height: 120px; object-fit: cover; border-radius: 4px; border: 1px solid var(--bord); background: var(--fond);
}
.proof-pdf { display: grid; place-items: center; text-align: center; font-weight: 600; color: var(--rouge-f); }
.proofs form { margin: 0; }

.form textarea { resize: vertical; }
.form input[type=file] { width: 100%; min-height: 44px; padding: 8px 0; font: inherit; }
.btn-danger { border-color: var(--rouge-f); color: var(--rouge-f); }
.btn-danger:hover { background: var(--rouge-c); }
.form .actions { margin-top: 12px; }
.form .actions .btn { margin-top: 0; }

.review { border-left: 6px solid var(--c); }
.review.is-math { --c: var(--math); } .review.is-pc { --c: var(--pc); }
.review.is-philo { --c: var(--philo); } .review.is-exam { --c: var(--exam); }
.review-check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.review-check input { width: 22px; height: 22px; accent-color: var(--primaire-f); flex: none; }
.review-form { max-width: 520px; }

.nav-badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--orange-f); color: var(--blanc); font-size: .78rem; font-weight: 600;
}
.nav a { position: relative; }
@media (max-width: 899px) { .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); } }
@media (min-width: 900px) { .nav-badge { margin-left: auto; } }

/* ---------- Indicateurs (F-SUIVI-003) ---------- */

.progress-rows { display: grid; grid-template-columns: max-content 1fr max-content; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.bar-time i { background: var(--mauve); }
.gap { display: inline-block; padding: 6px 12px; border-radius: 4px; font-weight: 600; }
.gap small { font-weight: 600; }
.gap-ok { background: var(--vert-c); color: var(--vert-f); }
.gap-light { background: var(--jaune-c); color: var(--jaune-f); }
.gap-late { background: var(--orange-c); color: var(--orange-f); }
.regularity-label { margin: 6px 0; }
.dots { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dot { border-radius: 4px; padding: 6px 4px; text-align: center; border: 2px solid var(--d); background: var(--d-c); min-width: 0; }
.dot b { display: block; }
.dot span { display: block; font-size: .78rem; overflow-wrap: anywhere; }
.dot-none, .dot-upcoming { --d: #C8C8C8; --d-c: #F5F5F5; }
.dot-validated { --d: var(--vert); --d-c: var(--vert-c); }
.dot-declared { --d: var(--jaune); --d-c: var(--jaune-c); }
.dot-partial { --d: var(--orange); --d-c: var(--orange-c); }
.dot-missed { --d: var(--rouge-f); --d-c: var(--rouge-c); }

a.tile { color: var(--texte); text-decoration: none; }
a.tile:hover { border-color: var(--primaire-f); }
.tile.is-alert { border: 2px solid var(--orange); background: var(--orange-c); }

/* ---------- Cours et chapitres (F-CONT-004) ---------- */

.chapter-list { border-left: 6px solid var(--c); }
.chapter-list.is-math { --c: var(--math); } .chapter-list.is-pc { --c: var(--pc); } .chapter-list.is-philo { --c: var(--philo); }
.chapter-list h3 { color: var(--gris); margin-top: 14px; }
.chapter-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.chapter-list li { display: flex; gap: 10px; align-items: baseline; min-height: 32px; }
.chapter-week { flex: none; min-width: 2.6em; font-weight: 600; color: var(--gris); font-size: .9rem; }

.chapter { max-width: 900px; --c: var(--vert); --c-f: var(--vert-f); --c-c: var(--vert-c); }
.chapter.is-pc { --c: var(--orange); --c-f: var(--orange-f); --c-c: var(--orange-c); }
.chapter.is-philo { --c: var(--mauve); --c-f: var(--mauve-f); --c-c: var(--mauve-c); }
.chapter-head { background: var(--c-f); color: var(--blanc); border-radius: 8px; padding: 18px 20px; }
.chapter-head h1 { color: var(--blanc); margin: 0; font-size: 1.5rem; line-height: 1.25; }
.crumb { margin: 0 0 4px; font-size: .85rem; opacity: .95; }
.chapter-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.chapter-meta span { border: 1px solid rgba(255, 255, 255, .5); border-radius: 20px; padding: 2px 12px; font-size: .85rem; font-weight: 600; }

.tabs { display: flex; gap: 6px; margin: 14px 0; overflow-x: auto; position: sticky; top: 0; z-index: 5; background: var(--fond); padding: 6px 0; }
.tabs a {
  flex: 1; min-width: 96px; min-height: 44px; display: grid; place-items: center; text-align: center; text-decoration: none;
  border: 2px solid var(--bord); background: var(--blanc); border-radius: 6px; padding: 6px 10px; color: var(--gris); font-weight: 600;
}
.tabs a.on { border-color: var(--c-f); background: var(--c-f); color: var(--blanc); }
.panel { display: none; }
.panel.on { display: block; }

.chapter .panel h2 { color: var(--c-f); font-size: 1.35rem; margin: 26px 0 8px; }
.chapter .panel h3 { font-size: 1.1rem; margin: 20px 0 6px; }
.chapter .panel { line-height: 1.6; }
.box { border-radius: 8px; padding: 12px 16px; margin: 14px 0; border-left: 6px solid; }
.box > b:first-child { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }
.box > b:first-child .katex { text-transform: none; letter-spacing: 0; font-size: 1.15em; }
.box.def { background: var(--vert-c); border-color: var(--vert); } .box.def > b:first-child { color: var(--vert-f); }
.box.thm { background: var(--mauve-c); border-color: var(--mauve); } .box.thm > b:first-child { color: var(--mauve-f); }
.box.meth { background: var(--jaune-c); border-color: var(--jaune); } .box.meth > b:first-child { color: var(--jaune-f); }
.box.piege { background: var(--rouge-c); border-color: var(--rouge-f); } .box.piege > b:first-child { color: var(--rouge-f); }
.box.ex { background: var(--blanc); border: 1px solid var(--bord); border-left: 6px solid var(--orange); } .box.ex > b:first-child { color: var(--orange-f); }
.box ul, .box ol { margin: 6px 0; padding-left: 22px; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.chapter table { border-collapse: collapse; width: 100%; margin: 8px 0; background: var(--blanc); }
.chapter table th, .chapter table td { border: 1px solid var(--bord); padding: 8px 10px; text-align: left; }
.chapter table th { background: var(--c-c); }
.table-scroll { overflow-x: auto; }
.chapter pre { background: var(--texte); color: #F4F1E0; border-radius: 6px; padding: 14px; overflow-x: auto; font-size: .9rem; }
.fig { background: var(--blanc); border: 1px solid var(--bord); border-radius: 8px; padding: 10px; text-align: center; margin: 14px 0; }
.fig svg { display: block; margin: 0 auto 6px; width: 100%; max-width: 520px; height: auto; }
.fig small { color: var(--gris); }

.exo { background: var(--blanc); border: 1px solid var(--bord); border-radius: 8px; padding: 14px 16px; margin: 14px 0; }
.chapter .panel .exo h2 { font-size: 1.05rem; color: var(--texte); margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.exo h2 small { margin-left: auto; color: var(--gris); font-weight: 600; }
.lvl { font-size: .78rem; font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.l1 { background: var(--vert-c); color: var(--vert-f); } .l2 { background: var(--orange-c); color: var(--orange-f); } .l3 { background: var(--mauve-c); color: var(--mauve-f); }
.sol { margin-top: 10px; border-radius: 4px; border: 1px dashed var(--bord); background: var(--fond); }
.sol summary { cursor: pointer; font-weight: 600; padding: 10px 14px; min-height: 44px; }
.sol-indice summary { color: var(--jaune-f); } .sol-correction summary { color: var(--vert-f); }
.sol > div { padding: 0 14px 12px; }
.memo { background: var(--blanc); border: 3px solid var(--c); border-radius: 8px; padding: 16px 20px; }
.chapter .panel .memo h2 { margin-top: 0; }
.memo ul { padding-left: 20px; }
.chapter-print { margin-top: 16px; }

@media print {
  .nav, .topbar, .tabs, .chapter-print, .chapter > p:first-child, .panel-jeux { display: none !important; }
  .shell { display: block; padding: 0; }
  .panel { display: block !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Parcours, exercices suivis, jeux (F-NOTIF-003, F-EXO-001, F-JEU-001) ---------- */

.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0 0; padding: 0; }
.steps li { border: 2px solid var(--bord); border-radius: 4px; padding: 6px 4px; text-align: center; font-size: .85rem; font-weight: 600; color: var(--gris); background: var(--blanc); min-width: 0; overflow-wrap: anywhere; }
.steps li b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bord); color: var(--texte); font-size: .8rem; }
.steps li.is-done { border-color: var(--c-f); color: var(--c-f); background: var(--c-c); }
.steps li.is-done b { background: var(--c-f); color: var(--blanc); }
.step-dots { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.step-dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--gris); }
.step-dots i.is-done { background: var(--vert-f); border-color: var(--vert-f); }
.chapter-read { margin-top: 20px; }
.bilan { background: var(--blanc); border: 2px solid var(--jaune); border-radius: 6px; padding: 10px 14px; margin: 14px 0; }
.exo-state { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.exo .actions { margin: 8px 0 0; }

.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 12px 0; }
.game-card { background: var(--blanc); border: 2px solid var(--bord); border-radius: 8px; padding: 14px; text-align: left; font: inherit; color: var(--texte); cursor: pointer; min-height: 44px; }
.game-card:hover { border-color: var(--c-f); }
.game-card small { display: block; color: var(--gris); font-weight: 600; }
.game-card b { display: block; font-size: 1.05rem; margin: 2px 0 6px; }
.game-best { font-size: .85rem; font-weight: 600; color: var(--orange-f); }
.game-zone { background: var(--blanc); border: 1px solid var(--bord); border-radius: 8px; padding: 16px; min-height: 180px; }
.game-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.game-timer { height: 10px; background: #E6E6E6; border-radius: 4px; overflow: hidden; margin: 10px 0 14px; }
.game-timer i { display: block; height: 100%; width: 100%; background: var(--orange); transition: width .1s linear; }
.game-question { font-size: 1.15rem; font-weight: 600; margin: 8px 0 14px; }
.game-options { display: grid; gap: 10px; }
.game-options.game-two { grid-template-columns: 1fr 1fr; }
.game-option, .game-step, .game-pair { border: 2px solid var(--bord); background: var(--blanc); border-radius: 6px; padding: 12px 14px; font: inherit; color: var(--texte); text-align: left; cursor: pointer; min-height: 44px; }
.game-two .game-option { text-align: center; font-weight: 600; }
.game-option:hover:not(:disabled), .game-step:hover, .game-pair:hover { border-color: var(--c-f); }
.game-option.is-good { border-color: var(--vert-f); background: var(--vert-c); }
.game-option.is-bad { border-color: var(--rouge-f); background: var(--rouge-c); }
.game-feedback { margin-top: 12px; padding: 10px 14px; border-radius: 4px; font-weight: 600; }
.game-feedback.is-good { background: var(--vert-c); color: var(--vert-f); }
.game-feedback.is-bad { background: var(--rouge-c); color: var(--rouge-f); }
.game-steps, .game-column { display: grid; gap: 8px; align-content: start; }
.game-step.is-placed, .game-pair.is-placed { border-color: var(--vert-f); background: var(--vert-c); cursor: default; }
.game-pair.is-selected { border-color: var(--orange-f); background: var(--orange-c); }
.game-num { font-weight: 600; color: var(--vert-f); }
.game-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.is-shaking { animation: hv-shake .35s; }
@keyframes hv-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .is-shaking { animation: none; border-color: var(--rouge-f); } }
.game-answer { background: var(--c-c); border-left: 6px solid var(--c); border-radius: 4px; padding: 10px 14px; margin-bottom: 12px; }
.game-end { text-align: center; padding: 16px 0; }
.game-score { font-size: 3rem; font-weight: 600; color: var(--c-f); margin: 0; line-height: 1.1; }

/* ---------- Notifications (F-NOTIF-003) ---------- */

.topbar-user .bell { position: relative; }
.topbar-user .bell .nav-badge { position: absolute; top: 2px; right: 0; left: auto; margin: 0; }
.notifications { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notifications a { display: grid; gap: 2px; padding: 10px 14px; background: var(--blanc); border: 1px solid var(--bord); border-radius: 6px; color: var(--texte); text-decoration: none; font-weight: 400; }
.notifications a:hover { border-color: var(--primaire-f); }
.notifications small { color: var(--gris); }
.notifications .is-unread a { border-left: 6px solid var(--orange); background: var(--orange-c); }

/* ---------- Page Échéances et veille (F-NOTIF-004, F-PLAN-006) ---------- */

.deadline-list { list-style: none; margin: 0 0 14px; padding: 0; }
.deadline { border-left: 6px solid var(--bord); }
.deadline.is-proche { border-left-color: var(--orange); }
.deadline.is-depassee { border-left-color: var(--rouge-f); }
.deadline.is-faite { border-left-color: var(--vert); opacity: .75; }
.deadline-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.badge-proche { color: var(--orange-f); } .badge-depassee { color: var(--rouge-f); } .badge-faite { color: var(--vert-f); }
.proposal { border: 2px solid var(--jaune); background: var(--jaune-c); }

/* ---------- Examens (F-EXAM-001 à 009) ---------- */

.exam { max-width: 900px; }
.exam-bar { position: sticky; top: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--texte); color: var(--blanc); border-radius: 8px; padding: 10px 16px; margin-bottom: 12px; }
.exam-bar small { display: block; opacity: .9; }
.exam-clock { margin: 0; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam.is-ending .exam-clock { color: var(--jaune); }
.exam-index { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.exam-index a { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 2px solid var(--bord); border-radius: 4px; background: var(--blanc); color: var(--gris); text-decoration: none; font-weight: 600; }
.exam-index a.is-answered { border-color: var(--vert-f); background: var(--vert-c); color: var(--vert-f); }
.exam-index a.is-flagged { border-color: var(--orange-f); box-shadow: inset 0 -5px 0 var(--orange); }
.exam-question { scroll-margin-top: 80px; }
.chapter .exam-question h2 { font-size: 1.05rem; color: var(--texte); margin: 0 0 8px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.exam-question h2 small { color: var(--gris); font-weight: 600; }
.exam-question.is-right { border-left: 6px solid var(--vert); }
.exam-question.is-partial { border-left: 6px solid var(--jaune); }
.exam-question.is-wrong { border-left: 6px solid var(--rouge-f); }
.exam-statement { margin-bottom: 12px; line-height: 1.6; }
.exam-options { display: grid; gap: 8px; }
.exam-options.exam-two { grid-template-columns: 1fr 1fr; }
.exam-option { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 2px solid var(--bord); border-radius: 6px; background: var(--blanc); cursor: pointer; }
.exam-option input { width: 20px; height: 20px; flex: none; accent-color: var(--primaire-f); }
.exam-option:has(input:checked) { border-color: var(--primaire-f); }
.exam-option.is-good { border-color: var(--vert-f); background: var(--vert-c); }
.exam-option.is-bad { border-color: var(--rouge-f); background: var(--rouge-c); }
.exam-number { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.exam-number input, .exam-rows select, .exam-question textarea, .exam-grade input { min-height: 44px; padding: 8px 12px; border: 1px solid var(--gris); border-radius: 4px; font: inherit; background: var(--blanc); color: var(--texte); }
.exam-number input { width: 12em; max-width: 100%; }
.exam-question textarea { width: 100%; resize: vertical; }
.exam-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.exam-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 4px; background: var(--blanc); }
.exam-rows select { max-width: 100%; }
.exam-rows .ok { color: var(--vert-f); } .exam-rows .ko { color: var(--rouge-f); }
.exam-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 0; }
.exam-tools .check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
.exam-tools input { width: 20px; height: 20px; accent-color: var(--orange-f); }
.exam-upload { margin-top: 10px; border-top: 1px dashed var(--bord); padding-top: 10px; }
.exam-written { background: var(--fond); border: 1px solid var(--bord); border-radius: 4px; padding: 10px 14px; white-space: normal; }
.exam-score { text-align: center; }
.exam-grade { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--bord); }
.exam-grade input[inputmode=decimal] { width: 8em; }
.exam-card h3 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.exam-chapters { border: 1px solid var(--bord); border-radius: 4px; margin: 8px 0 0; padding: 6px 10px; }
.exam-chapters legend { font-weight: 600; padding: 0 6px; }
.exam-chapters .check { margin: 0; min-height: 36px; font-weight: 400; }
.retake-form { max-width: 460px; }
.grade-tile.is-math { border-left: 6px solid var(--math); } .grade-tile.is-pc { border-left: 6px solid var(--pc); } .grade-tile.is-philo { border-left: 6px solid var(--philo); }

/* ---------- Tableau de bord complet, paramètres ---------- */

.chart-key { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; white-space: nowrap; }
.prefs .check { display: grid; place-items: center; min-height: 44px; }
.prefs input { width: 22px; height: 22px; accent-color: var(--primaire-f); }
.prefs th:not(:first-child), .prefs td:not(:first-child) { text-align: center; width: 9em; }
.table.prefs { min-width: 0; }

/* ---------- Menu : 4 onglets et « Plus » sur mobile, liste complète sur ordinateur ---------- */

@media (max-width: 899px) { .nav .nav-extra { display: none; } }
@media (min-width: 900px) { .nav .nav-more { display: none; } .nav { overflow-y: auto; } }
.menu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.menu-list a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; background: var(--blanc); border: 1px solid var(--bord); border-radius: 6px; color: var(--texte); text-decoration: none; }
.menu-list a:hover { border-color: var(--primaire-f); color: var(--primaire-f); }
.menu-list .nav-badge { position: static; margin-left: auto; }

.student-select { margin: 0; }
.student-select select { min-height: 40px; border-radius: 4px; border: 0; padding: 4px 8px; font: inherit; font-weight: 600; max-width: 40vw; }

/* ====================================================================================================
   Charte v2 : habillage des composants (F-GEN-001 v2)
   ==================================================================================================== */

body { background: var(--fond); }
h1 { font-size: 1.75rem; font-weight: 600; color: var(--texte); letter-spacing: -.01em; }
h2 { font-weight: 600; }
h2.section { color: var(--texte); font-size: 1.3rem; margin-top: 28px; }
a { color: var(--primaire-f); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
/* Dans un texte, un lien se reconnaît aussi sans la couleur */
.content p a:not(.btn), .box a, .sol a { text-decoration: underline; text-underline-offset: 2px; }
.notifications a, .notifications a:hover, .menu-list a:hover { text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--texte); outline-offset: 2px;
}

/* Bandeau : clair, avec un filet, comme une barre d'application */
.topbar { background: var(--blanc); color: var(--texte); border-bottom: 1px solid var(--bord); padding: 6px 16px; }
.countdown b { color: var(--primaire-f); font-weight: 600; }
.countdown span { color: var(--gris); }
.topbar-user a, .btn-icon { color: var(--texte); font-weight: 600; border-radius: 4px; }
.topbar-user a:hover, .btn-icon:hover { background: var(--survol); text-decoration: none; }
.student-select select { border: 1px solid var(--bord-f); background: var(--blanc); border-radius: 4px; }

/* Menu */
.nav { background: var(--blanc); border-color: var(--bord); }
.brand { color: var(--texte); font-weight: 600; letter-spacing: -.01em; }
.nav a { color: var(--gris); font-weight: 600; }
.nav a:hover { text-decoration: none; }
.nav a.active { color: var(--primaire-f); box-shadow: inset 0 3px 0 var(--primaire); }
.nav-badge { background: var(--orange-f); font-weight: 600; }
@media (min-width: 900px) {
  .nav { background: var(--fond); }
  .nav a { color: var(--texte); font-weight: 400; border-radius: 4px; }
  .nav a:hover { background: var(--survol); color: var(--texte); }
  .nav a.active { background: var(--blanc); color: var(--primaire-f); font-weight: 600; box-shadow: inset 3px 0 0 var(--primaire), var(--ombre); }
}

/* Cartes : blanches, filet discret, ombre légère */
.card, .day, .tile, .exo, .game-zone, .table-wrap, .notifications a, .menu-list a, .memo {
  border: 1px solid var(--bord); box-shadow: var(--ombre);
}
.card .day { background: var(--fond); box-shadow: none; }
.day.is-today { border: 1px solid var(--primaire); box-shadow: inset 0 3px 0 var(--primaire), var(--ombre); }
.day.is-today h2, .day.is-today h3 { color: var(--primaire-f); }
.memo { border-top: 4px solid var(--c); }
.rest { background: var(--blanc); border-color: var(--bord); border-left: 4px solid var(--vert); }
.rest h2 { color: var(--texte); }
.credentials, .proposal { background: var(--jaune-c); border: 1px solid var(--jaune); box-shadow: none; }

/* Petits libellés en capitales espacées */
.tile small, .game-card small, .crumb, .table th, .facts dt {
  text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 600; color: var(--gris);
}
.crumb { color: inherit; }
.tile b { font-weight: 600; }
a.tile:hover { text-decoration: none; box-shadow: 0 2px 4px rgba(0, 0, 0, .1), 0 6px 14px rgba(0, 0, 0, .1); }
.tile.is-alert { border: 1px solid var(--orange); background: var(--orange-c); }

/* Boutons */
.btn {
  min-height: 40px; padding: 6px 16px; border: 1px solid var(--bord-f); border-radius: 4px;
  background: var(--blanc); color: var(--texte); font-weight: 600;
}
.btn:hover { background: var(--survol); text-decoration: none; }
.btn-primary { background: var(--primaire); border-color: var(--primaire); color: var(--blanc); }
.btn-primary:hover { background: var(--primaire-f); border-color: var(--primaire-f); }
.btn-danger { border-color: var(--rouge-f); color: var(--rouge-f); }
.btn-small { min-height: 36px; padding: 4px 12px; }
@media (pointer: coarse) { .btn, .btn-small { min-height: 44px; } }

/* Formulaires */
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form input[type=date],
.form input[type=datetime-local], .form select, .form textarea {
  border: 1px solid var(--bord-f); border-radius: 4px;
}
.form input[type=datetime-local] { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--blanc); color: var(--texte); font: inherit; }
.form label { font-weight: 600; }
.flash { border-radius: 4px; border-left-width: 4px; font-weight: 600; }

/* Séances, étiquettes */
.session { border-radius: 6px; border-left-width: 4px; }
a.session:hover { text-decoration: none; }
.badge { border-radius: 4px; font-weight: 600; }
.tag { border-radius: 4px; font-weight: 600; }
.tag-bac { background: var(--mauve-f); } .tag-parcoursup { background: var(--orange-f); }

/* Chapitres : bandeau de titre plein, onglets soulignés */
.chapter-head { border-radius: 8px; padding: 22px 24px; }
.chapter-head h1 { font-size: 1.7rem; }
.tabs { gap: 0; border-bottom: 1px solid var(--bord); padding: 0; background: var(--fond); }
.tabs a {
  border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--gris);
  font-weight: 600; min-height: 48px;
}
.tabs a:hover { color: var(--texte); text-decoration: none; background: var(--survol); }
.tabs a.on { background: none; color: var(--c-f); border-bottom-color: var(--c-f); }
.steps li { border-width: 1px; border-radius: 4px; }
.box { border-radius: 4px; border-left-width: 4px; }
.box.ex { border-left-width: 4px; }
.game-card, .game-option, .game-step, .game-pair, .exam-option { border-width: 1px; border-color: var(--bord-f); }
.game-card { box-shadow: var(--ombre); border-color: var(--bord); }
.game-option.is-good, .exam-option.is-good { border-color: var(--vert-f); }
.game-option.is-bad, .exam-option.is-bad { border-color: var(--rouge-f); }
.exam-bar { border-radius: 8px; }
.exam-index a { border-width: 1px; border-color: var(--bord-f); }
.chapter-list { border-left-width: 4px; }

/* Page de connexion */
.guest .brand { font-size: 1.6rem; }

/* Extrait à expliquer (philosophie, F-EXAM-010) */
.exam-statement blockquote { margin: 10px 0; padding: 12px 16px; border-left: 4px solid var(--philo, #8764B8); background: #F1EAF9; border-radius: 0 4px 4px 0; line-height: 1.7; }
