/* =====================================================================
   app.css — Identité visuelle INVEX « Vigie » (terminal vert)
   Toutes les couleurs et tailles sont dans les variables ci-dessous :
   modifier une valeur ici change toute l'appli.
   ===================================================================== */

@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Medium.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-SemiBold.woff') format('woff'); font-weight: 600; font-display: swap; }

@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/JetBrainsMono-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/JetBrainsMono-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  /* Fonds */
  --fond: #07100D;
  --surface: #0E1915;
  --surface-2: #15231E;
  --surface-3: #1C2D27;
  --bordure: #203530;
  --bordure-forte: #2C4740;

  /* Textes */
  --texte: #E6F2EC;
  --texte-2: #B5CCC3;
  --texte-3: #7F9A90;
  --texte-4: #55706A;

  /* Accent (= hausse) */
  --accent: #3DDC97;
  --accent-fort: #6BE8B0;
  --accent-fond: #12352A;
  --sur-accent: #07100D;

  /* Marché */
  --hausse: #3DDC97;
  --hausse-fond: #12352A;
  --baisse: #FF5C6C;
  --baisse-fond: #3A1A1F;
  --neutre: #7F9A90;

  /* États */
  --succes: #3DDC97;
  --succes-fond: #12352A;
  --alerte: #F5C451;
  --alerte-fond: #3A3018;
  --danger: #FF5C6C;
  --danger-fond: #3A1A1F;
  --info: #6CB8FF;
  --info-fond: #162B40;

  /* Graphiques (séries) */
  --serie-1: #3DDC97;
  --serie-2: #F5C451;
  --serie-3: #6CB8FF;
  --serie-4: #C792EA;
  --serie-5: #FF9F5A;

  /* Typographies */
  --police-texte: 'Inter', system-ui, sans-serif;
  --police-chiffres: 'JetBrains Mono', ui-monospace, monospace;

  /* Formes */
  --rayon: 8px;
  --rayon-petit: 6px;
  --police: var(--police-texte);
  --largeur-contenu: 820px;
  --hauteur-nav: 64px;
  --largeur-barre: 248px;
  --duree: 180ms;
  --rayon-pilule: 999px;
}

/* Thème clair (Réglages > Apparence) */
html[data-theme="clair"] {
  color-scheme: light;
  --fond: #F4F8F6;
  --surface: #FFFFFF;
  --surface-2: #EAF1EE;
  --surface-3: #DDE7E3;
  --bordure: #D3DFDA;
  --bordure-forte: #B8C9C2;
  --texte: #0B1713;
  --texte-2: #2E4740;
  --texte-3: #5B7069;
  --texte-4: #8AA099;
  --accent: #0B7A4B;
  --accent-fort: #08613B;
  --accent-fond: #DDF3E8;
  --sur-accent: #FFFFFF;
  --hausse: #0B7A4B;
  --hausse-fond: #DDF3E8;
  --baisse: #C42A41;
  --baisse-fond: #FBE3E6;
  --neutre: #5B7069;
  --succes: #0B7A4B;
  --succes-fond: #DDF3E8;
  --alerte: #8A6200;
  --alerte-fond: #FBF0D2;
  --danger: #C42A41;
  --danger-fond: #FBE3E6;
  --info: #1B66B3;
  --info-fond: #E1EEFA;
}
html[data-theme="clair"] .bouton.danger, html[data-theme="clair"] .bouton.revoir { border-color: #E7A9B7; }
html[data-theme="clair"] .voile { background: rgba(22, 26, 37, 0.35); }


html[data-theme="clair"] .chaleur .c.n3 { background: #6F7CE0; }
html[data-theme="clair"] .chaleur .c.n4 { background: #3442B5; }
html[data-theme="clair"] .etat-synchro .point.ok { background: #1F9D63; }

/* Taille du texte (Réglages > Apparence) : toute l'interface s'agrandit */
body { zoom: var(--echelle, 1); }

.choix-apparence { display: flex; flex-wrap: wrap; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  :root { --duree: 0ms; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Base ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; background: var(--fond); }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icone { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Mise en page ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.barre-laterale { display: none; }
.principal { flex: 1; min-width: 0; padding: calc(20px + env(safe-area-inset-top)) 16px calc(var(--hauteur-nav) + 28px + env(safe-area-inset-bottom)); }
.page { max-width: var(--largeur-contenu); margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.page.large { max-width: 980px; }

.nav-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--hauteur-nav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--fond);
  border-top: 1px solid var(--bordure);
}
/* iPhone : le fond de la barre continue sous l'écran, pour que le contenu
   ne se voie jamais en dessous (même si iOS place la barre un peu trop haut). */
.nav-bas::after {
  content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 200px; background: var(--fond);
}
/* iPhone : bande opaque sous l'heure et la batterie, pour que le texte ne
   passe pas derrière en faisant défiler. */
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; z-index: 25;
  height: env(safe-area-inset-top); background: var(--fond); pointer-events: none;
}
.nav-bas a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--texte-3); font-size: 11px; font-weight: 500;
}
.nav-bas a[aria-current="page"] { color: var(--accent); }

@media (min-width: 980px) {
  .nav-bas { display: none; }
  .barre-laterale {
    display: flex; flex-direction: column; gap: 4px;
    width: var(--largeur-barre); flex: none;
    position: sticky; top: 0; height: 100vh;
    padding: 24px 14px; border-right: 1px solid var(--bordure); overflow-y: auto;
  }
  .principal { padding: 36px 40px 60px; }
}
.marque { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 600; font-size: 17px; }
.marque img { width: 28px; height: 28px; border-radius: 8px; }
.lien-barre {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--rayon-petit);
  color: var(--texte-2); font-size: 14px; font-weight: 500;
}
.lien-barre:hover { background: var(--surface); color: var(--texte); }
.lien-barre[aria-current="page"] { background: var(--accent-fond); color: var(--accent-fort); }
.titre-barre { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--texte-4); padding: 18px 10px 6px; }

/* ---------- En-têtes de page ---------- */
.entete { display: flex; flex-direction: column; gap: 4px; }
.entete .sur-titre { font-size: 13px; color: var(--texte-3); }
.entete .sous-titre { font-size: 14px; color: var(--texte-3); }
.retour { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--texte-3); background: none; border: 0; padding: 4px 0; cursor: pointer; align-self: flex-start; }
.retour:hover { color: var(--texte); }
.retour svg.icone { width: 16px; height: 16px; }
.ligne-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ligne-titre a, .ligne-titre button.lien { font-size: 13px; }

/* ---------- Surfaces ---------- */
.carte-surface { background: var(--surface); border-radius: var(--rayon); padding: 16px; }
.carte-surface.bordee { border: 1px solid var(--bordure-forte); }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grille-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pile { display: flex; flex-direction: column; gap: 10px; }
.rangee { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muet { color: var(--texte-3); font-size: 14px; }
.petit { font-size: 13px; }

/* Compte à rebours d'examen */
.examen .nom { font-size: 13px; color: var(--texte-3); }
.examen .jours { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }
.examen .jours.accent { color: var(--accent); }
.examen .jours.sans { font-size: 15px; font-weight: 500; color: var(--texte-2); padding: 10px 0 6px; }
.examen .legende { font-size: 12px; color: var(--texte-3); margin-top: 6px; }

/* Barre de progression */
.progression { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progression > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width var(--duree); }

/* Listes */
.liste { background: var(--surface); border-radius: var(--rayon); overflow: hidden; }
.liste > * + * { border-top: 1px solid var(--bordure); }
.element {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%;
  background: none; border: 0; text-align: left; color: var(--texte); cursor: pointer;
}
a.element:hover, button.element:hover { background: var(--surface-2); }
.element .corps { flex: 1; min-width: 0; }
.element .titre { font-size: 15px; font-weight: 500; }
.element .detail { font-size: 12px; color: var(--texte-3); margin-top: 1px; }
.element .valeur { font-size: 13px; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.element .chevron { color: var(--texte-4); }
.element .numero {
  width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--texte-2);
}
.element .mini-prog { width: 64px; }

.pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--rayon-petit);
  border: 1px solid var(--bordure-forte); background: var(--surface); color: var(--texte);
  font-size: 15px; font-weight: 500; cursor: pointer; text-align: center;
  transition: background var(--duree), transform var(--duree);
}
.bouton:hover { background: var(--surface-2); }
.bouton:active { transform: scale(0.98); }
.bouton.principal-btn { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; }
.bouton.principal-btn:hover { background: var(--accent-fort); }
.bouton.danger { border-color: #5A2E3A; color: var(--danger); }
.bouton.plein { width: 100%; }
.bouton.discret { background: none; border-color: transparent; color: var(--texte-2); }
.bouton[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Puces / filtres / onglets */
.onglets { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.onglets::-webkit-scrollbar { display: none; }
.puce {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: var(--rayon-pilule); border: 0; background: var(--surface); color: var(--texte-2);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.puce:hover { background: var(--surface-2); }
.puce[aria-selected="true"], .puce[aria-pressed="true"] { background: var(--accent); color: var(--sur-accent); font-weight: 600; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--rayon-pilule); background: var(--surface-3); color: var(--texte-2); }
.badge.accent { background: var(--accent-fond); color: var(--accent-fort); }
.badge.succes { background: var(--succes-fond); color: var(--succes); }
.badge.alerte { background: var(--alerte-fond); color: var(--alerte); }

/* Chiffres clés */
.chiffre { background: var(--surface); border-radius: var(--rayon); padding: 12px 14px; }
.chiffre .val { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chiffre .lib { font-size: 12px; color: var(--texte-3); }

/* Formulaires */
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label, .champ .label { font-size: 13px; font-weight: 500; color: var(--texte-2); }
.saisie {
  min-height: 44px; padding: 10px 12px; border-radius: var(--rayon-petit);
  background: var(--surface-2); border: 1px solid var(--bordure-forte); color: var(--texte); width: 100%;
}
.saisie:focus { outline: none; border-color: var(--accent); }
.recherche { position: relative; }
.recherche svg.icone { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--texte-3); }
.recherche .saisie { padding-left: 40px; }
.case { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; font-size: 15px; }
.case input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Aide-mémoire (texte mis en forme) ---------- */
.texte-riche { font-size: 15px; line-height: 1.65; color: var(--texte); }
.texte-riche h3 { font-size: 16px; margin: 20px 0 8px; color: var(--accent-fort); }
.texte-riche h3:first-child { margin-top: 0; }
.texte-riche h2.titre-partie { font-size: 19px; margin: 30px 0 10px; padding-top: 16px; border-top: 1px solid var(--bordure-forte); }
.texte-riche h2.titre-partie:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.texte-riche p { margin: 8px 0; }
.texte-riche ul, .texte-riche ol { margin: 8px 0; padding-left: 20px; }
.texte-riche li { margin: 4px 0; }
.texte-riche li::marker { color: var(--accent); }
.texte-riche strong { color: #fff; font-weight: 600; }
.texte-riche .encadre { border-left: 3px solid var(--accent); background: var(--accent-fond); padding: 10px 14px; border-radius: 0 var(--rayon-petit) var(--rayon-petit) 0; margin: 12px 0; }
.texte-riche table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 10px 0; display: block; overflow-x: auto; }
.texte-riche th, .texte-riche td { border-bottom: 1px solid var(--bordure-forte); padding: 7px 10px 7px 0; text-align: left; vertical-align: top; }
.texte-riche th { color: var(--texte-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Lexique ---------- */
.terme { padding: 13px 14px; }
.terme .mot { font-weight: 600; font-size: 15px; }
.terme .def { font-size: 14px; color: var(--texte-2); margin-top: 3px; }
.terme .origine { font-size: 12px; color: var(--texte-4); margin-top: 5px; display: flex; align-items: center; gap: 6px; }

/* ---------- Cartes (flashcards) ---------- */
.zone-carte { display: flex; flex-direction: column; gap: 16px; }
.compteur { display: flex; justify-content: space-between; font-size: 13px; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.carte-flash {
  min-height: 260px; background: var(--surface); border: 1px solid var(--bordure-forte); border-radius: 16px;
  padding: 26px 22px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center;
}
.carte-flash .contexte { font-size: 12px; color: var(--texte-3); }
.carte-flash .recto { font-size: 20px; font-weight: 600; line-height: 1.35; }
.carte-flash .separateur { width: 40px; height: 2px; background: var(--bordure-forte); border-radius: 1px; }
.carte-flash .verso { font-size: 16px; color: var(--texte-2); line-height: 1.6; white-space: pre-line; }
.actions-carte { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bouton.revoir { border-color: #5A2E3A; color: var(--danger); background: var(--danger-fond); }
.bouton.sais { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; }
.raccourcis { font-size: 12px; color: var(--texte-4); text-align: center; }

/* ---------- Quiz ---------- */
.question { font-size: 18px; font-weight: 600; line-height: 1.4; }
.choix { display: flex; flex-direction: column; gap: 8px; }
.choix button {
  text-align: left; padding: 13px 14px; border-radius: var(--rayon-petit); border: 1px solid var(--bordure-forte);
  background: var(--surface); color: var(--texte); cursor: pointer; font-size: 15px; line-height: 1.45;
  display: flex; gap: 10px; align-items: flex-start;
}
.choix button:hover:not([disabled]) { background: var(--surface-2); }
.choix button .lettre { flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--texte-2); }
.choix button.juste { border-color: var(--succes); background: var(--succes-fond); }
.choix button.faux { border-color: var(--danger); background: var(--danger-fond); }
.choix button[disabled] { cursor: default; }
.explication { font-size: 14px; color: var(--texte-2); background: var(--surface-2); border-radius: var(--rayon-petit); padding: 12px 14px; }
.verdict { font-weight: 600; font-size: 15px; }
.verdict.ok { color: var(--succes); }
.verdict.ko { color: var(--danger); }
.verdict.presque { color: var(--alerte); }

.paires { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.paires .col { display: flex; flex-direction: column; gap: 8px; }
.paires button {
  min-height: 64px; padding: 10px 12px; border-radius: var(--rayon-petit); border: 1px solid var(--bordure-forte);
  background: var(--surface); color: var(--texte); cursor: pointer; font-size: 13px; line-height: 1.4; text-align: left;
}
.paires button.choisi { border-color: var(--accent); background: var(--accent-fond); }
.paires button.trouve { border-color: var(--succes); background: var(--succes-fond); color: var(--succes); cursor: default; }
.paires button.erreur { border-color: var(--danger); background: var(--danger-fond); }

.resultat { text-align: center; padding: 28px 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.resultat .grand { font-size: 44px; font-weight: 600; color: var(--accent); letter-spacing: -0.02em; }

/* ---------- Statistiques ---------- */
.barres { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; }
.barres .b { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.barres .b span.v { width: 100%; max-width: 28px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.barres .b span.j { font-size: 11px; color: var(--texte-3); }

/* ---------- Planning ---------- */
.jour-plan { display: flex; gap: 14px; padding: 12px 14px; }
.jour-plan .date { width: 86px; flex: none; font-size: 13px; color: var(--texte-3); }
.jour-plan .date strong { display: block; color: var(--texte); font-size: 15px; }
.jour-plan.aujourdhui { background: var(--accent-fond); }

/* ---------- Vidéo ---------- */
.video { width: 100%; border-radius: var(--rayon); background: #000; aspect-ratio: 16 / 9; }

/* ---------- Vide / chargement ---------- */
.vide { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; gap: 10px; align-items: center; color: var(--texte-3); }
.vide svg.icone { width: 32px; height: 32px; color: var(--texte-4); }
.vide .titre { color: var(--texte); font-weight: 600; font-size: 16px; }

/* ---------- Panneaux (confirmation, fenêtres) ---------- */
.voile {
  position: fixed; inset: 0; z-index: 50; background: rgba(5, 7, 12, 0.7);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  animation: apparition var(--duree) ease-out;
}
@media (min-width: 640px) { .voile { align-items: center; } }
.panneau {
  width: 100%; max-width: 440px; background: var(--surface-2); border: 1px solid var(--bordure-forte);
  border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  max-height: 85vh; overflow-y: auto;
}
.panneau .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes apparition { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Messages éphémères ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--hauteur-nav) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 980px) { .toasts { bottom: 24px; } }
.toast { background: var(--surface-3); border: 1px solid var(--bordure-forte); color: var(--texte); padding: 10px 16px; border-radius: var(--rayon-pilule); font-size: 14px; animation: apparition var(--duree) ease-out; }

/* ---------- Bienvenue ---------- */
.bienvenue { max-width: 460px; margin: 6vh auto 0; display: flex; flex-direction: column; gap: 22px; }
.bienvenue .logo { width: 56px; height: 56px; border-radius: 14px; }

/* Onglets du chapitre : sur téléphone, ils se partagent toute la largeur */
@media (max-width: 520px) {
  .onglets.chapitre { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .onglets.chapitre .puce { justify-content: center; padding: 7px 4px; font-size: 12px; }
}
.consigne { font-size: 13px; color: var(--texte-3); margin-bottom: -8px; }

/* ---------- Calendrier ---------- */
.calendrier { padding: 12px; }
.cal-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-entete { text-align: center; font-size: 11px; font-weight: 600; color: var(--texte-4); padding: 4px 0; }
.cal-jour {
  aspect-ratio: 1 / 1; min-height: 40px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; color: var(--texte); padding: 0;
}
.cal-jour:hover { background: var(--surface-3); }
.cal-jour .num { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-jour .points { display: flex; gap: 2px; min-height: 5px; }
.point { display: inline-block; width: 5px; height: 5px; border-radius: 50%; }
.cal-jour.hors { background: none; color: var(--texte-4); }
.cal-jour.aujourdhui { border-color: var(--accent); }
.cal-jour.aujourdhui .num { color: var(--accent-fort); font-weight: 700; }
.cal-jour.choisi { background: var(--accent); color: var(--sur-accent); }
.cal-jour.choisi .num { color: var(--sur-accent); }
.cal-jour.examen { box-shadow: inset 0 0 0 2px var(--alerte); }
.cal-legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--texte-3); margin-top: 10px; }
.cal-legende > span { display: inline-flex; align-items: center; gap: 6px; }
.carre-examen { width: 10px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 2px var(--alerte); display: inline-block; }
.element.moment { cursor: default; }
.element.moment .bouton { min-height: 36px; padding: 6px 8px; }
input[type="date"], input[type="time"] { color-scheme: dark; }
@media (min-width: 980px) { .cal-jour { aspect-ratio: auto; height: 58px; } }

/* ---------- Organisation des pages : sections titrées ---------- */
.page { gap: 26px; }
.bloc { display: flex; flex-direction: column; gap: 10px; }
.bloc-tete { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.bloc-titre { font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--texte-3); }
.bloc-sous-titre { font-size: 13px; color: var(--texte-3); margin-top: 2px; }
.bloc-action { font-size: 13px; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bloc-action svg.icone { width: 16px; height: 16px; }

/* Sous-onglets (Planning) */
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface); padding: 4px; border-radius: var(--rayon); }
.segment { text-align: center; padding: 9px 6px; border-radius: var(--rayon-petit); font-size: 14px; font-weight: 500; color: var(--texte-2); }
.segment:hover { color: var(--texte); background: var(--surface-2); }
.segment[aria-current="page"] { background: var(--accent); color: var(--sur-accent); font-weight: 600; }

/* Carte examen enrichie */
.examen .ligne-rythme { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bordure); display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--texte-2); }

/* Tuile d'action du jour */
.tuile { display: flex; flex-direction: column; gap: 4px; }
.tuile .tete { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tuile .grand-chiffre { font-size: 26px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }

/* Repli (chapitres à venir) */
details.repli { background: var(--surface); border-radius: var(--rayon); }
details.repli > summary { list-style: none; cursor: pointer; padding: 13px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--texte-2); }
details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary .chevron { margin-left: auto; transition: transform var(--duree); color: var(--texte-4); }
details.repli[open] > summary .chevron { transform: rotate(90deg); }
details.repli > .liste { border-radius: 0 0 var(--rayon) var(--rayon); border-top: 1px solid var(--bordure); }
@media (max-width: 520px) { .element .mini-prog { display: none; } }

/* ---------- Mode concentration ---------- */
body.concentration .barre-laterale, body.concentration .nav-bas, body.concentration .retour { display: none !important; }
body.concentration .principal { padding-top: 28px; }
.petit-bouton { min-height: 36px; padding: 6px 10px; font-size: 13px; gap: 6px; }
.petit-bouton svg.icone { width: 18px; height: 18px; }
.petit-bouton[aria-pressed="true"] { color: var(--accent); }

/* ---------- Entraînement ---------- */
.grand-chrono { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.courbe { width: 100%; height: auto; display: block; }
.courbe-ligne { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.courbe-point { fill: var(--accent); }
.courbe-point.bas { fill: var(--danger); }
.courbe-seuil { stroke: var(--texte-4); stroke-dasharray: 4 4; stroke-width: 1; }
textarea.saisie { min-height: 96px; resize: vertical; font: inherit; }

/* Anneau de l'objectif du jour */
.anneau { position: relative; width: 64px; height: 64px; flex: none; }
.anneau svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.anneau circle { fill: none; stroke-width: 7; }
.anneau .fond { stroke: var(--surface-3); }
.anneau .plein { stroke: var(--succes); stroke-linecap: round; transition: stroke-dashoffset var(--duree); }
.anneau .val { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }

/* Carte de chaleur */
.chaleur { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.chaleur .c { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-3); }
.chaleur .c.n1 { background: #2C3566; }
.chaleur .c.n2 { background: #4855A3; }
.chaleur .c.n3 { background: #6B7BE0; }
.chaleur .c.n4 { background: #A7B2FF; }
.chaleur .c.futur { background: none; }
.chaleur-legende { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--texte-3); justify-content: flex-end; margin-top: 8px; }
.chaleur-legende .c { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.badge-carte { background: var(--surface); border-radius: var(--rayon); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.badge-carte .ico { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--texte-4); }
.badge-carte.obtenu .ico { background: var(--alerte-fond); color: var(--alerte); }
.badge-carte .nom { font-size: 13px; font-weight: 600; }
.badge-carte:not(.obtenu) .nom { color: var(--texte-3); }
.badge-carte .desc { font-size: 11px; color: var(--texte-3); line-height: 1.4; }

/* Alerte matière en retard */
.alerte-retard { display: flex; gap: 10px; align-items: flex-start; background: var(--alerte-fond); color: var(--alerte); border-radius: var(--rayon); padding: 12px 14px; font-size: 14px; }
.alerte-retard p { color: var(--texte); }
.alerte-retard svg.icone { margin-top: 1px; }

/* Recherche : résultats */
.resultat-recherche .type { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--texte-3); }
.resultat-recherche .extrait { font-size: 13px; color: var(--texte-2); margin-top: 2px; }

.ligne-dispo { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; align-items: center; font-size: 14px; }
.ligne-dispo .saisie { min-height: 38px; padding: 6px 8px; }
.tuile .anneau, .tuile .anneau svg { width: 54px; height: 54px; }

/* ---------- Comptes et administration ---------- */
.saisie-cle { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 1.15rem; letter-spacing: 0.06em; text-align: center; }
.erreur-cle { color: var(--danger); min-height: 1.2em; font-size: 0.92rem; text-align: center; }
.cle-affichee { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 1.25rem; letter-spacing: 0.05em; text-align: center;
  padding: 14px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--bordure-forte); user-select: all; word-break: break-all; }
.liste-cles { display: flex; flex-direction: column; gap: 8px; }
.ligne-cle { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--rayon); padding: 12px 14px; }
.ligne-cle.revoquee { opacity: 0.6; }
.ligne-cle-nom { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ligne-cle-actions { display: flex; gap: 4px; }
.etiquette { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--texte-2); }
.etiquette.accent { background: var(--accent); color: var(--sur-accent); }
.etiquette.danger { background: var(--danger-fond); color: var(--danger); }
.bouton.petit-btn { padding: 6px 10px; font-size: 0.85rem; min-height: 0; }
.texte-danger { color: var(--danger) !important; }
.etat-synchro { display: flex; align-items: center; gap: 10px; }
.etat-synchro .point { width: 9px; height: 9px; border-radius: 50%; background: var(--texte-3, #777); flex: none; }
.etat-synchro .point.ok { background: #6FD3A0; }
.etat-synchro .point.envoi { background: var(--accent); animation: pulsation 1s ease-in-out infinite; }
.etat-synchro .point.erreur { background: var(--danger); }
@keyframes pulsation { 50% { opacity: 0.35; } }
.annonce-bloc { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--rayon); padding: 14px 16px; }
.annonce-bloc svg { color: var(--accent); flex: none; margin-top: 2px; }
.annonce-bloc p { margin: 0; white-space: pre-line; }
.annonce-bloc .fermer-annonce { margin-left: auto; flex: none; }
.cle-masquee { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.95rem; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; user-select: all; }
.ecran-seul { padding: max(24px, env(safe-area-inset-top)) 20px 40px; min-height: 100vh; }
.titre-video { font-size: 1rem; font-weight: 600; margin: 0; }
.element-video { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.element-video[aria-current="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.numero-video { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 0.8rem; font-weight: 600; color: var(--texte-2); }
.element-video[aria-current="true"] .numero-video { background: var(--accent); color: var(--sur-accent); }
.case-conditions { align-items: flex-start; gap: 12px; font-size: 0.9rem; line-height: 1.45; color: var(--texte-2); background: var(--surface); border-radius: var(--rayon); padding: 14px; }
.case-conditions input { margin-top: 3px; flex: none; }
.lien-texte { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.conditions-texte { max-height: 60vh; overflow-y: auto; }
.conditions-page { max-height: 45vh; background: var(--surface); border-radius: var(--rayon); padding: 14px 16px; font-size: 0.9rem; }

/* Formules (v0.8.0) */
.formule-boite { font-weight: 600; font-size: 15px; line-height: 1.45; color: var(--texte); background: var(--accent-fond); border-left: 3px solid var(--accent); border-radius: var(--rayon-petit); padding: 10px 12px; margin-top: 8px; }
.formule-variante { font-weight: 500; color: var(--texte-2); font-size: 14px; margin-top: 4px; }
.formule-nom { font-weight: 600; font-size: 16px; }
.formule-fiche summary { cursor: pointer; list-style: none; }
.formule-fiche summary::-webkit-details-marker { display: none; }
.formule-fiche[open] summary .formule-nom { color: var(--accent-fort); }
.formule-termes { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.formule-termes dt { font-weight: 600; color: var(--texte); }
.formule-termes dd { margin: 0; color: var(--texte-2); }
.encadre-formule { border-radius: var(--rayon-petit); padding: 10px 12px; font-size: 14px; }
.encadre-formule p { margin: 0; }
.encadre-formule.retenir { background: var(--succes-fond); }
.encadre-formule.retenir .encadre-titre { color: var(--succes); }
.encadre-formule.piege { background: var(--danger-fond); }
.encadre-formule.piege .encadre-titre { color: var(--danger); }
.encadre-titre { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texte-3); margin-bottom: 4px; }
.niveau-formule { font-size: 12px; color: var(--texte-3); white-space: nowrap; }
.niveau-formule.apprentissage { color: var(--alerte); }
.niveau-formule.maitrisee { color: var(--succes); }
.methode-formules { margin: 0; padding-left: 20px; display: grid; gap: 4px; color: var(--texte-2); }
@media (max-width: 480px) { .formule-termes { grid-template-columns: 1fr; } .formule-termes dd { margin-bottom: 6px; } }

/* Formules par cœur + exercices bloqués (v0.8.1) */
.partie-titre { font-size: 16px; font-weight: 600; margin: 0; }
.partie-bloquee { border: 1px dashed var(--bordure-forte); }
.niveau-formule.acquise { color: var(--succes); }
.niveau-formule.ignoree { color: var(--texte-4); }
.formule-fiche.ignoree { opacity: 0.55; }
.formule-fiche.ignoree .formule-boite { text-decoration: line-through; }
.choix-formule { justify-content: flex-start; text-align: left; white-space: normal; height: auto; min-height: 48px; padding: 10px 14px; line-height: 1.4; }
.choix-formule.juste { background: var(--succes-fond); border-color: var(--succes); color: var(--texte); opacity: 1; }
.choix-formule.fausse { background: var(--danger-fond); border-color: var(--danger); color: var(--texte); opacity: 1; }
.etapes-formule { display: flex; gap: 6px; flex-wrap: wrap; }
.etapes-formule span { font-size: 12px; padding: 3px 9px; border-radius: var(--rayon-pilule); background: var(--surface-2); color: var(--texte-3); }
.etapes-formule span.faite { color: var(--succes); }
.etapes-formule span.actuelle { background: var(--accent); color: var(--sur-accent); font-weight: 600; }
.carte-formule { display: flex; flex-direction: column; align-items: stretch; justify-content: center; text-align: center; min-height: 200px; width: 100%; border: 1px solid var(--bordure-forte); color: var(--texte); font: inherit; cursor: pointer; }
.carte-formule .formule-boite { text-align: left; margin-top: 14px; }
.avertissement-formules { margin: 0; background: var(--alerte-fond); color: var(--alerte); border-radius: var(--rayon-petit); padding: 10px 12px; }

/* Simulateurs (v0.9.0) */
.simulateur .grille-curseurs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 560px) { .simulateur .grille-curseurs { grid-template-columns: 1fr; } }
.curseur { display: flex; flex-direction: column; gap: 4px; }
.curseur-tete { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--texte-2); }
.curseur-valeur { font-weight: 600; color: var(--texte); font-variant-numeric: tabular-nums; }
.curseur input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 28px; }
.svg-pm { width: 100%; max-width: 560px; height: auto; display: block; margin: 0 auto; }
.legende-pm { justify-content: center; }
.pm-grille { stroke: var(--bordure); stroke-width: 1; }
.pm-axe-ligne { stroke: var(--texte-4); stroke-width: 1.2; }
.pm-axe { fill: var(--texte-3); font-size: 14px; font-family: var(--police); }
.pm-ca { stroke: var(--accent); stroke-width: 3; }
.pm-ct { stroke: var(--danger); stroke-width: 3; }
.pm-cf { stroke: var(--alerte); stroke-width: 2; stroke-dasharray: 6 5; }
.pm-cv { stroke: var(--texte-3); stroke-width: 1.5; stroke-dasharray: 3 4; }
.pm-q { stroke: var(--texte-3); stroke-width: 1; stroke-dasharray: 2 4; }
.pm-repere { stroke: var(--texte-2); stroke-width: 1; stroke-dasharray: 4 4; }
.pm-point { fill: var(--fond); stroke: var(--texte); stroke-width: 3; }
.pm-etiquette { fill: var(--texte); font-size: 16px; font-weight: 600; font-family: var(--police); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.pm-zone-perte { fill: var(--danger); opacity: 0.14; }
.pm-zone-benefice { fill: var(--succes); opacity: 0.16; }
.pm-zone-texte { font-size: 15px; font-weight: 600; font-family: var(--police); }
.pm-zone-texte.perte { fill: var(--danger); }
.pm-zone-texte.benefice { fill: var(--succes); }
.legende-pm { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--texte-2); margin-top: 6px; }
.legende-pm span { display: inline-flex; align-items: center; gap: 6px; }
.legende-pm .trait { display: inline-block; width: 18px; height: 0; border-top-width: 3px; border-top-style: solid; }
.legende-pm .trait.pm-ca { border-color: var(--accent); }
.legende-pm .trait.pm-ct { border-color: var(--danger); }
.legende-pm .trait.pm-cf { border-color: var(--alerte); border-top-style: dashed; }
.legende-pm .trait.pm-cv { border-color: var(--texte-3); border-top-style: dotted; }
.lecture-pm { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .lecture-pm { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chiffre-pm { background: var(--surface-2); border-radius: var(--rayon-petit); padding: 10px 12px; }
.chiffre-pm .lib { font-size: 12px; color: var(--texte-3); }
.chiffre-pm .val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chiffre-pm .calc { font-size: 12px; color: var(--texte-3); margin-top: 2px; }
.bilan-sim { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .bilan-sim { grid-template-columns: 1fr; } }
.bilan-col { background: var(--surface-2); border-radius: var(--rayon-petit); padding: 10px 12px; font-size: 14px; }
.bilan-ligne { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; font-variant-numeric: tabular-nums; color: var(--texte-2); }
.bilan-ligne.fort { font-weight: 600; color: var(--texte); border-top: 1px solid var(--bordure-forte); margin-top: 2px; padding-top: 4px; }
.ratio-sim { display: flex; flex-direction: column; gap: 4px; }
.ratio-nom { font-weight: 600; }
.ratio-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.ratio-sim.ok .ratio-val { color: var(--succes); }
.ratio-sim.bas .ratio-val { color: var(--danger); }
.ratio-sim.haut .ratio-val { color: var(--alerte); }
.jauge { position: relative; height: 10px; border-radius: var(--rayon-pilule); background: var(--surface-3); overflow: hidden; }
.jauge-norme { position: absolute; top: 0; bottom: 0; background: var(--succes); opacity: 0.25; }
.jauge-valeur { position: absolute; left: 0; top: 3px; height: 4px; border-radius: var(--rayon-pilule); background: var(--texte); }

/* Explique-moi, cas complets (v0.9.0) */
.bouton-explique { align-self: flex-start; }
.extrait-fiche { background: var(--surface); border-radius: var(--rayon-petit); padding: 10px 12px; font-size: 14px; }
.donnees-cas .texte-riche table, .donnees-cas table { font-size: 14px; }
.donnees-cas td:last-child, .donnees-cas th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.contexte-cas summary { cursor: pointer; }

/* Codes d'accès */
.verrou-carte { max-width: 420px; margin: 24px auto 0; text-align: center; }
.verrou-carte .champ { text-align: left; }
.verrou-icone { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2, rgba(61,220,151,.12)); color: var(--accent); }
.verrou-icone .icone { width: 28px; height: 28px; }
.code-acces { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.etiquette-verrou { display: inline-flex; align-items: center; gap: 4px; }
.etiquette-verrou .icone { width: 14px; height: 14px; }

/* Mathématiques financières */
:root { --coul-A: #F0997B; --coul-V0: #5DCAA5; --coul-int: #E9B872; }
.puce[aria-checked="true"] { background: var(--accent); color: var(--sur-accent); font-weight: 600; }
.enonce-fiche { border-left: 3px solid #F2A06B; border-radius: 0 var(--rayon) var(--rayon) 0; }
.exo-maths .indice { margin: 0; font-size: 14px; background: var(--accent-fond); border-radius: var(--rayon-petit); padding: 8px 12px; }
.exo-maths .diagnostic { margin: 0; font-size: 14px; background: var(--danger-fond); color: var(--texte); border-radius: var(--rayon-petit); padding: 10px 12px; }
.etapes-correction { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.interrupteur-guide { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--texte-2); cursor: pointer; }
.interrupteur-guide input { width: 18px; height: 18px; accent-color: var(--accent); }
.etape-guide { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 12px; }
.chiffre .val.ok { color: var(--succes); }
.competence { display: flex; flex-direction: column; gap: 4px; }

.ligne-temps { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.lt-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lt-defile svg { display: block; max-width: none; }
.lt-axe { stroke: var(--texte-3); stroke-width: 1.5; }
.lt-date { fill: var(--texte-3); font-size: 11px; font-family: var(--police); }
.lt-versement { fill: var(--surface-3); stroke: var(--bordure-forte); }
.lt-a { fill: var(--texte-2); font-size: 11px; font-family: var(--police); }
.lt-unique { fill: var(--accent); }
.lt-retrait { fill: var(--danger); }
.lt-A { fill: var(--coul-A); }
.lt-V0 { fill: var(--coul-V0); }
.lt-etiquette { fill: #07100D; font-size: 11px; font-weight: 600; font-family: var(--police); }
.lt-cible { fill: var(--alerte); font-size: 11px; font-family: var(--police); }
.lt-cible-trait { stroke: var(--alerte); stroke-width: 2; }
.lt-legende { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.lt-legende span { display: inline-flex; align-items: center; gap: 6px; }
.lt-p { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.lt-p.lt-versement { background: var(--surface-3); border: 1px solid var(--bordure-forte); }
.lt-p.lt-unique { background: var(--accent); border-radius: 50%; }
.lt-p.lt-retrait { background: var(--danger); }
.lt-p.lt-A { background: var(--coul-A); }
.lt-p.lt-V0 { background: var(--coul-V0); }

.tableau-defile { overflow-x: auto; display: flex; flex-direction: column; gap: 10px; }
.table-amortissement { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table-amortissement th, .table-amortissement td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--bordure); white-space: nowrap; }
.table-amortissement th:first-child, .table-amortissement td:first-child { text-align: center; }
.table-amortissement th { color: var(--texte-3); font-weight: 500; }
.table-amortissement td.interets { color: var(--coul-int); }
.table-amortissement tr.surligne td { background: var(--accent-fond); }
.barres-versements { display: flex; flex-direction: column; gap: 4px; }
.barre-versement { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.part-interets { background: var(--coul-int); display: inline-block; height: 100%; }
.part-rembourse { background: var(--texte-2); display: inline-block; height: 100%; }
.lt-p.part-interets, .lt-p.part-rembourse { height: 12px; margin-right: 4px; }
.blocs-versements { display: flex; flex-wrap: wrap; gap: 4px; }
.bloc-versement { flex: 1 0 28px; min-width: 28px; height: 32px; display: grid; place-items: center; border-radius: 6px; font-size: 13px; font-weight: 600; }
.bloc-versement.groupe-A { background: var(--coul-A); color: #4A1B0C; }
.bloc-versement.groupe-V0 { background: var(--coul-V0); color: #04342C; }
.simulateur .chiffre { padding: 10px 8px; min-width: 0; }
.simulateur .chiffre .val { font-size: clamp(14px, 4.2vw, 20px); overflow-wrap: anywhere; }

/* Maintenance */
.maintenance { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px 24px; text-align: center; }
.maintenance h1 { margin: 0; }
.maintenance p { margin: 0; max-width: 420px; }
.maintenance-logo { width: 56px; height: 56px; border-radius: 14px; }
.maintenance-retour { font-weight: 600; color: var(--alerte); }
.roue { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--surface-3); border-top-color: var(--accent); animation: tourner 1s linear infinite; }
@keyframes tourner { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .roue { animation-duration: 3s; } }

/* Assistant d'exercice */
.assistant-etape { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; padding-top: 14px; border-top: 1px solid var(--bordure); }
.assistant-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-fond); color: var(--accent); font-weight: 700; }
.assistant-titre { margin: 4px 0 0; font-size: 17px; }
.tuiles-choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.tuile-choix { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 12px 14px; border-radius: var(--rayon); border: 1px solid var(--bordure-forte); background: var(--surface-2); color: var(--texte); cursor: pointer; font: inherit; min-height: 48px; }
.tuile-choix:hover { border-color: var(--accent); }
.tuile-choix[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-fond); padding: 11px 13px; }
.tuile-titre { font-weight: 600; font-size: 15px; }
.tuile-detail { font-size: 13px; color: var(--texte-2); }
.aide-champ { margin: 4px 0 0; font-size: 12.5px; color: var(--texte-3); }
.pastille-info { margin: 0; font-size: 14px; font-weight: 600; color: var(--accent); background: var(--accent-fond); border-radius: var(--rayon-petit); padding: 8px 12px; }
.reponse-assistant { border-radius: var(--rayon); background: var(--accent-fond); padding: 14px 16px; }
.reponse-valeur { font-size: clamp(22px, 6vw, 30px); font-weight: 700; color: var(--succes); font-variant-numeric: tabular-nums; }
.reponse-phrase { margin: 4px 0 0; }
.etapes-assistant { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.etapes-assistant li { padding-left: 4px; }
.etapes-assistant strong { display: block; font-size: 14px; }
.etapes-assistant span { font-size: 14px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.explication-annee { font-size: 14px; background: var(--surface-2); border-radius: var(--rayon-petit); padding: 10px 12px; }
.tuiles-choix.une-colonne { grid-template-columns: 1fr; }
.tuile-exemples { font-size: 12.5px; color: var(--texte-3); font-style: italic; line-height: 1.45; }
.tuile-choix.petite { padding: 10px 12px; min-height: 0; }
.tuile-choix.petite[aria-pressed="true"] { padding: 9px 11px; }
.champ-lib { font-size: 14px; font-weight: 500; color: var(--texte-2); display: block; margin-bottom: 6px; }
.ligne-liste { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.ligne-liste select.saisie { width: auto; }
.rappel-situation { margin: 0; font-size: 14px; background: var(--surface-2); border-radius: var(--rayon-petit); padding: 10px 12px; }
.reponse-lib { font-size: 13px; color: var(--texte-2); }
.reponses-autres { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bordure); }
.reponse-autre { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-variant-numeric: tabular-nums; }

/* Avertissement : réponse de l'assistant non garantie */
.alerte-fiabilite { display: block; padding: 3px 8px; border: 1px solid var(--danger); border-left-width: 2px; border-radius: 6px; background: var(--danger-fond); color: var(--danger); font-size: .76rem; line-height: 1.3; }
.alerte-fiabilite strong { font-weight: 600; margin-right: 4px; }

/* Matière ou chapitre en préparation / mise à jour */
.maintenance.maintenance-contenu { min-height: 60vh; min-height: 60dvh; }
.maintenance-nom { font-weight: 600; color: var(--texte-2, inherit); opacity: .8; }
.etiquette.etiquette-etat { margin-left: 8px; border: 1px solid var(--alerte); color: var(--alerte); background: transparent; }

.case-option { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .95rem; }
.case-option input { width: 18px; height: 18px; accent-color: var(--accent); }

.rangee > input[type=datetime-local] { flex: 1; min-width: 0; }

/* Remarque sur une vidéo (ex. notion pas travaillée en classe) */
.note-video { margin: 0; padding: 8px 12px; border: 1px solid var(--alerte); border-left-width: 3px; border-radius: 8px; color: var(--alerte); font-size: .9rem; line-height: 1.4; }
.note-video[hidden] { display: none; }
.note-video-detail { color: var(--alerte); }

/* Désactivation déguisée : écran de panne neutre, sans marque de l'appli */
.ecran-panne { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px; text-align: center; background: #f6f6f6; color: #2b2b2b; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; z-index: 50; }
.ecran-panne .panne-code { margin: 0; font-size: 72px; font-weight: 300; color: #9a9a9a; letter-spacing: 2px; }
.ecran-panne h1 { margin: 0; font-size: 22px; font-weight: 600; }
.ecran-panne p { margin: 0; max-width: 420px; line-height: 1.5; color: #555; }
.ecran-panne .panne-detail { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #8a8a8a; }
.ecran-panne .bouton { margin-top: 12px; background: #fff; color: #2b2b2b; border: 1px solid #ccc; }
.maintenance.fermeture .maintenance-logo { opacity: .7; }

/* Simulateur d'écritures (FIC) */
.compta-enonce { margin: 0; font-size: 1.05rem; line-height: 1.5; font-weight: 500; }
.compta-ligne { display: grid; grid-template-columns: 110px minmax(0, 1fr) 130px auto; gap: 8px; align-items: center; border-radius: 10px; padding: 2px; }
.compta-ligne.ok { box-shadow: 0 0 0 2px var(--succes); }
.compta-ligne.ko { box-shadow: 0 0 0 2px var(--danger); }
.compta-montant { text-align: right; }
@media (max-width: 560px) { .compta-ligne { grid-template-columns: 92px minmax(0, 1fr) auto; } .compta-ligne .compta-montant { grid-column: 2 / 3; } }
.table-compta { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table-compta th, .table-compta td { padding: 6px 8px; border-bottom: 1px solid var(--bordure, rgba(128,128,128,.25)); text-align: left; }
.table-compta td.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.compta-journal { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.compta-journal span:nth-child(2) { flex: 1; }
.point-verdict { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.point-verdict.ok { background: var(--succes); } .point-verdict.ko { background: var(--danger); }
.grille-comptes-t { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.compte-t { font-size: .85rem; }
.compte-t-nom { text-align: center; font-weight: 600; border-bottom: 2px solid currentColor; padding-bottom: 3px; }
.compte-t-corps { display: grid; grid-template-columns: 1fr 1fr; min-height: 28px; }
.compte-t-corps > div { padding: 4px 6px; text-align: right; font-variant-numeric: tabular-nums; }
.compte-t-corps > div:first-child { border-right: 2px solid currentColor; }

.table-defile { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-defile .table-compta { min-width: 420px; }
@media (max-width: 560px) { .table-compta { font-size: .8rem; } .table-compta th, .table-compta td { padding: 5px 6px; } }

/* ===================== INVEX 1.0 : accueil ===================== */
.accueil-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: -10px; }
.accueil-marque { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: 0.04em; }
.accueil-marque img { width: 30px; height: 30px; border-radius: 8px; }
.accueil-actions { display: flex; align-items: center; gap: 6px; }
.accueil-actions .rond { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--bordure-forte); display: flex; align-items: center; justify-content: center; color: var(--texte-2); text-decoration: none; }
.accueil-actions .rond svg { width: 16px; height: 16px; }
.accueil-actions .rond:hover { border-color: var(--accent); color: var(--accent); }
.accueil-actions .initiale { background: var(--accent-fond); border-color: transparent; color: var(--accent); font-weight: 700; font-size: 14px; }
@media (min-width: 900px) { .accueil-marque { visibility: hidden; } }
.accueil-salut { flex-direction: row; justify-content: space-between; align-items: flex-start; }
.bouton-theme { width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; background: transparent; color: var(--texte-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.bouton-theme:hover { background: var(--surface-2); color: var(--texte); }
.bouton-theme svg { width: 17px; height: 17px; }
.ligne-discrete { display: flex; align-items: center; gap: 8px; border: 1px solid var(--bordure); border-radius: 10px; padding: 2px 2px 2px 12px; min-height: 36px; font-size: 13px; color: var(--texte-3); text-decoration: none; margin-top: -10px; }
.ligne-discrete a { color: var(--accent); font-weight: 600; text-decoration: none; }
.ligne-discrete strong { color: var(--accent); }
.ligne-discrete > span { flex: 1; }
.ligne-discrete .fermer { width: 32px; height: 32px; border: 0; background: transparent; color: var(--texte-4); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; }
.ligne-discrete .fermer svg { width: 13px; height: 13px; }
.carte-semaine { display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--bordure); border-radius: 18px; padding: 14px; }
.carte-semaine .haut { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 0 2px; }
.carte-semaine a { color: inherit; text-decoration: none; }
.carte-semaine .gros, .carte-semaine .objectif { display: flex; flex-direction: column; gap: 2px; }
.carte-semaine .objectif { align-items: flex-end; text-align: right; }
.etiquette-muette { font-size: 12px; color: var(--texte-3); }
.carte-semaine .chiffre { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.carte-semaine .unite { font-size: 14px; font-weight: 500; color: var(--texte-3); letter-spacing: 0; }
.chiffre-moyen { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.jour-semaine { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 10px; }
.jour-semaine:hover { background: var(--surface-2); }
.jour-semaine.aujourdhui { background: var(--accent-fond); color: var(--accent); }
.jour-semaine .lettre { font-size: 10px; color: var(--texte-3); }
.jour-semaine .num { font-size: 14px; font-weight: 700; }
.pastille-jour { font-size: 10px; font-weight: 600; border-radius: 999px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.pastille-jour.cartes { background: var(--succes-fond); color: var(--succes); }
.pastille-jour.examen { background: var(--danger-fond); color: var(--danger); }
.pastille-jour.vide { color: var(--texte-4); }
.encart-prochain { display: flex; align-items: center; gap: 10px; background: var(--fond); border-radius: 12px; padding: 8px 10px; }
.encart-prochain .point { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.encart-prochain .point.rouge { background: var(--danger); }
.encart-prochain .corps { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 11px; color: var(--texte-3); }
.encart-prochain .corps strong { font-size: 13px; color: var(--texte); font-weight: 600; }
.encart-prochain svg { width: 14px; height: 14px; color: var(--texte-3); flex: none; }
.bouton-reprendre { display: flex; align-items: center; gap: 12px; background: var(--accent); color: var(--sur-accent); border-radius: 14px; padding: 10px 16px; text-decoration: none; margin-top: -10px; }
.bouton-reprendre .corps { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bouton-reprendre .petit { font-size: 12px; opacity: 0.8; }
.bouton-reprendre .titre { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bouton-reprendre svg { width: 18px; height: 18px; flex: none; }
.grille-matieres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .grille-matieres { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tuile-matiere { background: var(--surface); border: 1px solid var(--bordure); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--texte); min-width: 0; }
.tuile-matiere:hover { border-color: var(--accent); }
.tuile-matiere .code { align-self: flex-start; min-width: 38px; height: 38px; padding: 0 6px; box-sizing: border-box; border-radius: 11px; background: var(--accent-fond); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.tuile-matiere .nom { font-size: 13px; font-weight: 600; line-height: 1.2; overflow-wrap: break-word; hyphens: auto; }
.tuile-matiere .detail { font-size: 11px; color: var(--texte-3); }
.tuile-matiere .barre-vide { height: 4px; }
.grille-outils { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tuile-outil { background: var(--surface); border: 1px solid var(--bordure); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--texte); min-width: 0; }
.tuile-outil .ic { color: var(--texte-3); }
.tuile-outil .ic svg { width: 18px; height: 18px; }
.tuile-outil.accent { border-color: var(--accent); }
.tuile-outil.accent .ic { color: var(--accent); }
.tuile-outil .titre { font-size: 13px; font-weight: 600; }
.tuile-outil .detail { font-size: 11px; color: var(--texte-3); }
.pied-droits { margin-top: 8px; text-align: center; font-size: 11px; color: var(--texte-4); padding-bottom: 8px; }
.case.interrupteur { align-items: flex-start; }
.titre-matiere { gap: 12px; align-items: center; }
.code-matiere { min-width: 44px; height: 44px; padding: 0 6px; box-sizing: border-box; border-radius: 13px; background: var(--accent-fond); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
