/* ─────────────────────────────────────────────────────────────
   Mes notes — feuille de style unique, zéro dépendance externe.
   Clair par défaut, sombre automatique selon le réglage du tél.
   ───────────────────────────────────────────────────────────── */

:root {
  --violet:      #6d5efc;
  --violet-fonce:#5546e0;
  --violet-pale: #f0edff;

  --fond:        #f6f5fb;
  --carte:       #ffffff;
  --bordure:     #e8e6f2;
  --texte:       #1f1b3a;
  --texte-doux:  #6b6785;
  --ombre:       0 1px 2px rgba(31,27,58,.05), 0 8px 24px rgba(31,27,58,.06);
  --ombre-forte: 0 2px 6px rgba(31,27,58,.08), 0 16px 40px rgba(31,27,58,.10);

  --vert:   #10b981;
  --orange: #f59e0b;
  --rouge:  #ef4444;
  --gris:   #94a3b8;

  --r-s: 9px;
  --r-m: 13px;
  --r-l: 17px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond:       #131126;
    --carte:      #1c1936;
    --bordure:    #2c2850;
    --texte:      #eeecfb;
    --texte-doux: #a09cc4;
    --violet-pale:#241f4a;
    --ombre:       0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.28);
    --ombre-forte: 0 2px 8px rgba(0,0,0,.36), 0 18px 44px rgba(0,0,0,.42);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.02rem; }
h3 { font-size: .95rem; }
p  { margin: 0 0 .8em; }
a  { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }

.doux      { color: var(--texte-doux); }
.note-bas  { color: var(--texte-doux); font-size: .82rem; margin: .8em 0 0; }
.erreur    { color: var(--rouge); font-weight: 600; }

/* ───────────── En-tête ───────────── */

.entete {
  position: sticky; top: 0; z-index: 30;
  background: var(--carte);                                  /* repli */
  background: color-mix(in srgb, var(--carte) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--bordure);
}
.entete-inner {
  max-width: 1040px; margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: 10px; color: var(--texte); }
.marque:hover { text-decoration: none; }
.marque strong { display: block; font-size: 1rem; letter-spacing: -.02em; }
.marque em { display: block; font-style: normal; font-size: .78rem; color: var(--texte-doux); }

.logo-rond {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center; font-size: 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--violet), #a78bfa);
  box-shadow: 0 4px 14px rgba(109,94,252,.35);
}
.logo-rond.gros { width: 64px; height: 64px; font-size: 34px; border-radius: 20px; margin: 0 auto 14px; }

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 999px;
  color: var(--texte-doux); font-size: .9rem; font-weight: 500;
}
.nav a:hover { background: var(--violet-pale); color: var(--violet); text-decoration: none; }
.nav a.actif { background: var(--violet); color: #fff; }
.nav-icone { font-size: .95em; opacity: .85; }

/* ───────────── Page ───────────── */

.page { max-width: 1040px; margin: 0 auto; padding: 16px 16px 48px; }

.carte {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-l);
  padding: 15px 17px;
  box-shadow: var(--ombre);
  margin-bottom: 11px;
}

.section-titre { margin: 30px 0 14px; }
.section-titre h1, .section-titre h2 { margin-bottom: .2em; }

.flash {
  padding: 12px 16px; border-radius: var(--r-m); margin-bottom: 18px;
  font-weight: 500; border: 1px solid transparent;
}
.flash-ok     { background: #dcfce7; color: #065f46; border-color: #a7f3d0; }
.flash-erreur { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
@media (prefers-color-scheme: dark) {
  .flash-ok     { background: #063d2e; color: #a7f3d0; border-color: #0d5c46; }
  .flash-erreur { background: #4a1112; color: #fecaca; border-color: #7f1d1d; }
}

.pied { text-align: center; color: var(--texte-doux); font-size: .8rem; padding: 0 18px 40px; }

/* ───────────── Bandeau du haut (moyenne générale) ───────────── */

.hero { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 11px; margin-bottom: 11px; }

.hero-note {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r-l);
  padding: 17px 19px;
  box-shadow: var(--ombre-forte);
  position: relative; overflow: hidden;
}
.hero-note::before {
  content: ''; position: absolute; inset: 0 auto auto 0;
  width: 100%; height: 5px; background: var(--teinte, var(--violet));
}
.hero-label  { display: block; color: var(--texte-doux); font-size: .82rem;
               text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.hero-chiffre{ display: block; font-size: 2.9rem; font-weight: 750; line-height: 1;
               letter-spacing: -.04em; margin: 8px 0 12px;
               color: var(--teinte, var(--violet)); font-variant-numeric: tabular-nums; }
.hero-ecart  { margin: 12px 0 0; color: var(--texte-doux); font-size: .92rem; }
.hero-ecart strong { color: var(--texte); }
.hero-sous   { margin: 2px 0 0; color: var(--texte-doux); font-size: .84rem; }

.hero-cases { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 9px; }
.mini-carte {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--r-m);
  padding: 11px; box-shadow: var(--ombre);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 4px;
}
.mini-label  { color: var(--texte-doux); font-size: .76rem; text-transform: uppercase;
               letter-spacing: .05em; font-weight: 600; }
.mini-chiffre{ font-size: 1.55rem; font-weight: 700; letter-spacing: -.03em;
               font-variant-numeric: tabular-nums; }
.mini-chiffre.petit { font-size: 1.12rem; }
.mini-sous   { color: var(--texte-doux); font-size: .8rem; }

.anneau { width: 74px; height: 74px; margin: 1px 0; }
.anneau-fond  { fill: none; stroke: var(--bordure); stroke-width: 11; }
.anneau-jauge { fill: none; stroke-width: 11; stroke-linecap: round;
                transition: stroke-dasharray .6s ease; }
.anneau-chiffre { text-anchor: middle; font-size: 26px; font-weight: 700; fill: var(--texte); }
.anneau-sous    { text-anchor: middle; font-size: 12px; fill: var(--texte-doux); }

/* ───────────── Le mot d'encouragement ───────────── */

.carte-mot {
  display: flex; gap: 16px; align-items: flex-start;
  background: linear-gradient(135deg, var(--violet-pale), var(--carte) 65%);
  border-color: var(--bordure);                              /* repli */
  border-color: color-mix(in srgb, var(--violet) 22%, var(--bordure));
}
.carte-mot p:last-child { margin-bottom: 0; }
.mot-icone { font-size: 26px; flex: none; line-height: 1.2; }

/* ───────────── Notes minimales ───────────── */

.carte-requis .requis-duo {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px;
}
.requis-bloc {
  background: var(--fond); border: 1px solid var(--bordure);
  border-radius: var(--r-m); padding: 11px 13px;
  display: flex; flex-direction: column; gap: 3px;
}
.requis-bloc.impossible { border-style: dashed; }
.requis-label   { color: var(--texte-doux); font-size: .8rem; font-weight: 600; }
.requis-chiffre { font-size: 1.9rem; font-weight: 750; letter-spacing: -.035em;
                  color: var(--violet); font-variant-numeric: tabular-nums; line-height: 1.1; }
.requis-chiffre.ok { color: var(--vert); font-size: 1.45rem; }
.requis-chiffre.ko { color: var(--gris); }
.requis-sous    { color: var(--texte-doux); font-size: .82rem; }

/* ───────────── Graphiques ───────────── */

.duo-graph { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.graph { width: 100%; height: auto; display: block; overflow: visible; }

.grille { stroke: var(--bordure); stroke-width: 1; }
.tick   { fill: var(--texte-doux); font-size: 11px; text-anchor: middle; }
.tick-y { text-anchor: end; }
.tick-date { font-size: 10.5px; text-anchor: start; }
.piste  { fill: var(--bordure); opacity: .45; }

.ligne-passage { stroke: var(--rouge); stroke-width: 1.6; stroke-dasharray: 5 4; opacity: .75; }
.etiquette-passage { fill: var(--rouge); font-size: 10.5px; text-anchor: middle; font-weight: 600; }

.lbl-matiere { fill: var(--texte); font-size: 12.5px; text-anchor: end; font-weight: 500; }
.val-matiere { fill: var(--texte); font-size: 12.5px; font-weight: 700; }
.repere-objectif { fill: var(--violet); stroke: var(--carte); stroke-width: 1.2; }

.courbe { fill: none; stroke: var(--violet); stroke-width: 2.6;
          stroke-linejoin: round; stroke-linecap: round; }
.aire   { fill: var(--violet); opacity: .10; }
.point-note { stroke: var(--carte); stroke-width: 1.6; }

.vide-graph { color: var(--texte-doux); text-align: center; padding: 34px 10px; }
.legende { color: var(--texte-doux); font-size: .8rem; margin: 10px 0 0;
           display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pastille { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.losange  { width: 9px; height: 9px; background: var(--violet); display: inline-block;
            transform: rotate(45deg); flex: none; }

/* ───────────── Cartes de branche ───────────── */

.grille-matieres {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px;
}
.carte-matiere { position: relative; padding-top: 22px; margin-bottom: 0; }
.carte-matiere::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--teinte); border-radius: var(--r-l) var(--r-l) 0 0;
}
.cm-tete  { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cm-tete h3 { margin-bottom: 2px; }
.cm-tete h3 a { color: var(--texte); }
.cm-meta  { color: var(--texte-doux); font-size: .8rem; }
.cm-note  { font-size: 2rem; font-weight: 750; letter-spacing: -.035em; line-height: 1;
            font-variant-numeric: tabular-nums; }
.cm-phrase{ font-size: .9rem; margin: 12px 0 0; }
.cm-pied  { display: flex; justify-content: space-between; align-items: center;
            gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.lien-discret { font-size: .85rem; font-weight: 500; }

.jauge { margin-top: 14px; }
.jauge-piste { position: relative; height: 10px; background: var(--bordure);
               border-radius: 99px; overflow: visible; }
.jauge-remplie { height: 100%; border-radius: 99px; transition: width .5s ease; }
.jauge-seuil {
  position: absolute; top: -4px; width: 2px; height: 18px;
  background: var(--rouge); border-radius: 2px;
}
.jauge-objectif {
  position: absolute; top: -5px; width: 9px; height: 9px; margin-left: -4px;
  background: var(--violet); transform: rotate(45deg);
  border: 1.5px solid var(--carte);
}

/* ───────────── Compteur +/− ───────────── */

.compteur { display: flex; align-items: center; justify-content: space-between;
            gap: 12px; margin-top: 14px; padding: 10px 12px;
            background: var(--fond); border-radius: var(--r-m); }
.compteur-label { color: var(--texte-doux); font-size: .82rem; }
.compteur-cmd   { display: flex; align-items: center; gap: 10px; }
.compteur-cmd form { margin: 0; }
.compteur-valeur { font-size: 1.3rem; font-weight: 700; min-width: 26px; text-align: center;
                   font-variant-numeric: tabular-nums; }
.btn-rond {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--bordure);
  background: var(--carte); color: var(--texte); font-size: 19px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; transition: .15s;
}
.btn-rond:hover { border-color: var(--violet); color: var(--violet); background: var(--violet-pale); }

/* ───────────── Badges ───────────── */

.badge {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
}
.badge-top    { background: #ede9fe; color: #6d28d9; }
.badge-bien   { background: #d1fae5; color: #047857; }
.badge-ok     { background: #dcfce7; color: #15803d; }
.badge-limite { background: #fef3c7; color: #b45309; }
.badge-alerte { background: #fee2e2; color: #b91c1c; }
.badge-vide   { background: #eef2f6; color: #64748b; }
@media (prefers-color-scheme: dark) {
  .badge-top    { background: #3b2a72; color: #ddd6fe; }
  .badge-bien   { background: #064e3b; color: #a7f3d0; }
  .badge-ok     { background: #0a4726; color: #bbf7d0; }
  .badge-limite { background: #5a3d05; color: #fde68a; }
  .badge-alerte { background: #5c1414; color: #fecaca; }
  .badge-vide   { background: #2b2850; color: #a09cc4; }
}

/* ───────────── Formulaires ───────────── */

label { display: block; font-size: .82rem; font-weight: 600; color: var(--texte-doux); }
label small { display: block; font-weight: 400; font-size: .76rem; margin-top: 4px; line-height: 1.45; }

input[type=text], input[type=number], input[type=date], input[type=password], select {
  width: 100%; margin-top: 5px; padding: 9px 12px;
  border: 1px solid var(--bordure); border-radius: var(--r-s);
  background: var(--carte); color: var(--texte);
  font: inherit; font-size: .93rem; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--violet);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 18%, transparent);
}
input[type=color] {
  width: 46px; height: 38px; margin-top: 5px; padding: 3px;
  border: 1px solid var(--bordure); border-radius: var(--r-s);
  background: var(--carte); cursor: pointer;
}

.form-ligne  { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-ligne > label { flex: 1 1 130px; min-width: 110px; }
.form-ligne > label.large { flex: 2 1 220px; }
.form-ligne > button { flex: 0 0 auto; }

.form-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-actions { grid-column: 1 / -1; }
.form-cachee { display: none; }
.inline { display: inline-block; margin: 14px 0; }
.petit-champ { width: 90px; }

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--bordure); background: var(--carte); color: var(--texte);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: .15s; text-align: center;
}
.btn:hover { border-color: var(--violet); color: var(--violet); text-decoration: none; }
.btn-primaire {
  background: var(--violet); border-color: var(--violet); color: #fff;
  box-shadow: 0 4px 14px rgba(109,94,252,.30);
}
.btn-primaire:hover { background: var(--violet-fonce); border-color: var(--violet-fonce); color: #fff; }
.btn-mini { padding: 5px 11px; font-size: .8rem; }
.btn-danger { border-color: color-mix(in srgb, var(--rouge) 45%, var(--bordure)); color: var(--rouge); }
.btn-danger:hover { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.form-danger { margin-top: 14px; }

.grille-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
                gap: 8px; margin: 14px 0; }
.case { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
        border: 1px solid var(--bordure); border-radius: var(--r-s);
        cursor: pointer; font-weight: 500; color: var(--texte); font-size: .9rem; }
.case:hover { border-color: var(--violet); background: var(--violet-pale); }
.case input { width: auto; margin: 0; accent-color: var(--violet); }

.grille-objectifs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
                    gap: 12px; margin-bottom: 16px; }
.grille-objectifs label { display: flex; align-items: center; gap: 8px;
                          color: var(--texte); font-weight: 500; font-size: .88rem; }
.grille-objectifs input { width: 78px; margin: 0 0 0 auto; }
.objectif-general { grid-column: 1 / -1; padding-top: 12px; border-top: 1px dashed var(--bordure);
                    font-weight: 700 !important; }

.reglage-matiere { margin-top: 14px; border-top: 1px solid var(--bordure); padding-top: 12px; }
.reglage-matiere summary { cursor: pointer; color: var(--texte-doux);
                           font-size: .84rem; font-weight: 600; }
.reglage-matiere summary:hover { color: var(--violet); }
.reglage-matiere .form-grille { margin-top: 14px; }
.aide { display: inline-grid; place-items: center; width: 15px; height: 15px;
        border-radius: 50%; background: var(--bordure); color: var(--texte-doux);
        font-size: 10px; cursor: help; }

/* ───────────── Tableaux ───────────── */

.table-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.tableau { width: 100%; border-collapse: collapse; min-width: 580px; }
.tableau th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--texte-doux); padding: 8px 8px; border-bottom: 1px solid var(--bordure);
}
.tableau th.num, .tableau td.num { text-align: right; }
.tableau td { padding: 6px 8px; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: none; }
.tableau input { margin-top: 0; }
.ligne-attente { background: var(--violet-pale);           /* repli */
                 background: color-mix(in srgb, var(--violet) 5%, transparent); }
.champ-note  { width: 86px; text-align: right; font-weight: 700;
               font-variant-numeric: tabular-nums; }
.champ-note.sous-barre { color: var(--rouge); }
.champ-poids { width: 76px; text-align: right; }
.col-matiere a { display: flex; align-items: center; gap: 7px; color: var(--texte);
                 font-weight: 600; font-size: .88rem; white-space: nowrap; }
.actions-ligne { display: flex; gap: 6px; justify-content: flex-end; }
.rappel-slots { margin-top: 12px; padding: 10px 14px; border-radius: var(--r-s);
                background: var(--violet-pale); color: var(--texte-doux); font-size: .84rem; }

/* ───────────── Filtres et échéances ───────────── */

.barre-filtres { display: flex; justify-content: space-between; align-items: flex-end;
                 gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.onglets { display: flex; gap: 4px; background: var(--fond);
           padding: 4px; border-radius: 999px; }
.onglets a { padding: 6px 14px; border-radius: 999px; font-size: .85rem;
             font-weight: 600; color: var(--texte-doux); }
.onglets a:hover { text-decoration: none; color: var(--violet); }
.onglets a.actif { background: var(--carte); color: var(--violet); box-shadow: var(--ombre); }
.filtre-matiere { display: flex; align-items: flex-end; gap: 8px; }
.filtre-matiere select { min-width: 150px; }

.liste-echeances { list-style: none; margin: 0; padding: 0; }
.liste-echeances li { display: flex; align-items: center; gap: 10px;
                      padding: 10px 2px; border-bottom: 1px solid var(--bordure);
                      font-size: .9rem; flex-wrap: wrap; }
.liste-echeances li:last-child { border-bottom: none; }
.ech-matiere { font-weight: 700; }
.ech-titre   { color: var(--texte-doux); }
.ech-quand   { margin-left: auto; font-weight: 600; color: var(--violet);
               background: var(--violet-pale); padding: 3px 11px; border-radius: 999px;
               font-size: .8rem; white-space: nowrap; }
.puce-poids  { background: var(--bordure); color: var(--texte-doux);
               padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700; }

.explications p { font-size: .92rem; }
.explications code, .liste-info code {
  background: var(--violet-pale); color: var(--violet);
  padding: 2px 7px; border-radius: 5px; font-size: .88em;
}
.liste-info { margin: 0; padding-left: 20px; color: var(--texte-doux); font-size: .9rem; }
.liste-info li { margin-bottom: 5px; }

.accueil-vide { text-align: center; padding: 48px 26px; max-width: 560px; margin: 8vh auto; }
.accueil-vide .btn { margin-top: 10px; }

/* ───────────── Écran du code d'accès ───────────── */

.ecran-code { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.carte-code { width: 100%; max-width: 340px; text-align: center; margin: 0; }
.champ-code { text-align: center; font-size: 1.15rem; letter-spacing: .18em; margin-bottom: 14px; }
.carte-code .btn { width: 100%; }

/* ───────────── Téléphone ───────────── */

@media (max-width: 860px) {
  .hero      { grid-template-columns: 1fr; }
  .duo-graph { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page  { padding: 16px 13px 56px; }
  .carte { padding: 17px 16px; border-radius: var(--r-m); }
  h1 { font-size: 1.4rem; }
  .hero-chiffre { font-size: 3rem; }
  .grille-matieres { grid-template-columns: 1fr; }
  .entete-inner { padding: 9px 13px; gap: 10px; }
  .nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .nav a { padding: 7px 10px; flex: 1; justify-content: center; }
  .nav-txt { display: none; }
  .nav-icone { font-size: 1.15rem; }
  .form-ligne > label, .form-ligne > label.large { flex: 1 1 100%; }
  .form-ligne > button { width: 100%; }
  .barre-filtres { flex-direction: column; align-items: stretch; }
  .onglets a { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ───────── Ajouter / supprimer une branche : visible, jamais enterré ───────── */

.carte-ajout {
  border-color: color-mix(in srgb, var(--violet) 35%, var(--bordure));
  background: linear-gradient(135deg, var(--violet-pale), var(--carte) 70%);
}

.tuile-ajout {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 170px; padding: 24px;
  border: 2px dashed var(--bordure); border-radius: var(--r-l);
  color: var(--texte-doux); font-weight: 600; text-align: center;
  transition: .15s;
}
.tuile-ajout:hover {
  border-color: var(--violet); color: var(--violet);
  background: var(--violet-pale); text-decoration: none;
}
.tuile-plus  { font-size: 2rem; line-height: 1; }
.tuile-ajout small { font-weight: 400; font-size: .78rem; opacity: .8; }

.cm-supprimer { margin-top: 10px; text-align: right; }


/* ───────── Semestre affiché ───────── */

.barre-semestre {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 0 0 16px; font-size: .85rem;
}
.puce-semestre {
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--bordure); background: var(--carte); color: var(--texte-doux);
  font: inherit; font-weight: 600; transition: .15s;
}
.puce-semestre:hover { border-color: var(--violet); color: var(--violet); }
.puce-semestre.actif {
  background: var(--violet); border-color: var(--violet); color: #fff;
  box-shadow: 0 3px 10px rgba(109,94,252,.28);
}

/* ───────── Compte à rebours vacances ───────── */

.carte-vacances {
  display: flex; gap: 18px; align-items: flex-start;
  background: linear-gradient(135deg, #fff7ed, var(--carte) 62%);
  border-color: #fed7aa;
}
@media (prefers-color-scheme: dark) {
  .carte-vacances { background: linear-gradient(135deg, #3a2410, var(--carte) 62%);
                    border-color: #7c4a12; }
}
.vac-emoji { font-size: 32px; line-height: 1.1; flex: none; }
.vac-corps { flex: 1; min-width: 0; }
.vac-corps h2 { margin-bottom: 4px; }
.vac-mot   { font-size: 1.02rem; font-weight: 600; margin-bottom: 12px; }
.vac-dates { font-size: .82rem; margin: 8px 0 0; }
.vac-piste { height: 9px; background: var(--bordure); border-radius: 99px; overflow: hidden; }
.vac-remplie {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #fb923c, #f59e0b);
  transition: width .6s ease;
}
.vac-pastille { margin-right: 6px; }
.ligne-passee { opacity: .5; }

.carte-invite {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; font-size: .92rem;
}

/* ───────── Rappel d'examen ───────── */

.ech-proche .ech-quand { background: #fee2e2; color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .ech-proche .ech-quand { background: #5c1414; color: #fecaca; }
}
.ech-mot { margin: 12px 0 0; font-size: .9rem; font-weight: 500; }

/* ───────── Simulateur ───────── */

.carte-simu {
  background: linear-gradient(135deg, var(--violet-pale), var(--carte) 68%);
  border-color: color-mix(in srgb, var(--violet) 24%, var(--bordure));
}
.simu-cmd { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; margin: 16px 0 6px; }
.simu-choix { flex: 1 1 220px; }
.simu-curseur { flex: 2 1 300px; display: flex; align-items: center; gap: 10px; }
.simu-bornes { color: var(--texte-doux); font-size: .8rem; font-weight: 700; }

.simu-curseur input[type=range] {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 8px; border-radius: 99px; background: var(--bordure); outline: none; margin: 0;
}
.simu-curseur input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%; cursor: grab;
  background: var(--violet); border: 3px solid var(--carte);
  box-shadow: 0 2px 8px rgba(109,94,252,.45);
}
.simu-curseur input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; cursor: grab;
  background: var(--violet); border: 3px solid var(--carte);
  box-shadow: 0 2px 8px rgba(109,94,252,.45);
}
.simu-curseur input[type=range]:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 30%, transparent);
}

.simu-phrase { margin: 14px 0 4px; font-size: .95rem; }
.simu-phrase output { font-weight: 800; color: var(--violet); font-variant-numeric: tabular-nums; }
.simu-resultat { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.simu-chiffre {
  font-size: 2.6rem; font-weight: 780; letter-spacing: -.04em; line-height: 1;
  font-variant-numeric: tabular-nums; transition: color .25s;
}
.simu-detail { color: var(--texte-doux); font-size: .9rem; font-weight: 600; }
.simu-piste {
  position: relative; height: 10px; background: var(--bordure);
  border-radius: 99px; margin: 16px 0 0;
}
.simu-remplie { height: 100%; border-radius: 99px; transition: width .25s ease, background .25s; }
.simu-seuil {
  position: absolute; top: -4px; left: 60%; width: 2px; height: 18px;
  background: var(--rouge); border-radius: 2px;
}

@media (max-width: 620px) {
  .carte-vacances { gap: 12px; }
  .vac-emoji { font-size: 32px; }
  .simu-chiffre { font-size: 2.6rem; }
  .simu-cmd { gap: 12px; }
}

/* ───────── Saisie flash : 3 gestes, pas 6 champs ─────────
   Cibles ≥ 44 px : c'est fait au pouce, sur un téléphone, en classe. */

.carte-flash {
  border-color: color-mix(in srgb, var(--violet) 32%, var(--bordure));
  box-shadow: var(--ombre-forte);
}
.flash-titre { font-size: 1.15rem; margin-bottom: 14px; }

.flash-etape {
  display: block; margin: 16px 0 8px;
  color: var(--texte-doux); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.flash-etape:first-of-type { margin-top: 0; }

.pastilles { display: flex; flex-wrap: wrap; gap: 8px; }

/* Branche : de vraies cases radio, donc ça marche même sans JavaScript. */
.pastille-choix { position: relative; cursor: pointer; margin: 0; }
.pastille-choix input {
  position: absolute; opacity: 0; width: 0; height: 0; margin: 0;
}
.pastille-choix span {
  display: flex; align-items: center; gap: 6px;
  min-height: 42px; padding: 0 13px; border-radius: 999px;
  border: 2px solid var(--bordure); background: var(--carte);
  color: var(--texte); font-size: .92rem; font-weight: 600;
  transition: .15s; white-space: nowrap;
}
.pastille-choix span::before {
  content: ''; width: 11px; height: 11px; border-radius: 50%;
  background: var(--teinte); flex: none;
}
.pastille-choix:hover span { border-color: var(--teinte); }
.pastille-choix input:checked + span {
  border-color: var(--teinte);
  background: color-mix(in srgb, var(--teinte) 14%, var(--carte));
  box-shadow: 0 3px 12px color-mix(in srgb, var(--teinte) 34%, transparent);
}
.pastille-choix input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--violet) 45%, transparent); outline-offset: 2px;
}

/* Note : une rangée de gros boutons, plus le champ libre pour les quarts de point. */
.pastilles-notes { align-items: center; }
.pastille-note {
  min-width: 47px; min-height: 42px; padding: 0 9px;
  border-radius: 12px; border: 2px solid var(--bordure);
  background: var(--carte); color: var(--texte);
  font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: .12s;
}
.pastille-note.bonne:hover { border-color: var(--vert); color: var(--vert); }
.pastille-note.basse:hover { border-color: var(--orange); color: var(--orange); }
.pastille-note.actif {
  border-color: var(--violet); background: var(--violet); color: #fff;
  box-shadow: 0 4px 14px rgba(109,94,252,.38); transform: translateY(-1px);
}
.pastille-libre { margin: 0; }
.pastille-libre input {
  width: 92px; min-height: 44px; margin: 0; text-align: center;
  font-size: 1rem; font-weight: 700; border-width: 2px; border-radius: 12px;
  font-variant-numeric: tabular-nums;
}

.flash-details { margin: 18px 0 16px; }
.flash-details summary {
  cursor: pointer; color: var(--texte-doux); font-size: .85rem; font-weight: 600;
  padding: 6px 0;
}
.flash-details summary:hover { color: var(--violet); }
.flash-details .form-grille { margin-top: 12px; }

.btn-large { width: 100%; padding: 12px 20px; font-size: .95rem; }

@media (max-width: 620px) {
  .pastille-note   { min-width: 46px; font-size: .95rem; }
  .pastille-libre input { width: 78px; }
  .pastille-choix span  { font-size: .88rem; padding: 0 13px; }
}

/* ───────── Analyses ───────── */

.chiffres-cles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 7px; margin-bottom: 11px;
}
.cle {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--r-m);
  padding: 9px 11px; box-shadow: var(--ombre);
  display: flex; flex-direction: column; gap: 1px;
}
.cle-val {
  font-size: 1.38rem; font-weight: 780; letter-spacing: -.035em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.cle-lbl { color: var(--texte-doux); font-size: .74rem; font-weight: 600; line-height: 1.3; }

.grille-mois { opacity: .45; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; }

/* ───────── Agenda ───────── */

.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 2px; border-bottom: 1px solid var(--bordure);
  font-size: .88rem;
}
.agenda li:last-child { border-bottom: none; }
.ag-date {
  color: var(--texte-doux); font-size: .76rem; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 74px;
}
.ag-quoi { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-note {
  font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.ag-note.bonne { background: #dcfce7; color: #15803d; }
.ag-note.basse { background: #fee2e2; color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .ag-note.bonne { background: #0a4726; color: #bbf7d0; }
  .ag-note.basse { background: #5c1414; color: #fecaca; }
}

/* ───────── Cartes de branche : plus serrées ───────── */

.grille-matieres { grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 12px; }
.carte-matiere   { padding: 16px 17px 15px; padding-top: 18px; }
.carte-matiere .cm-phrase { margin-top: 9px; font-size: .85rem; }
.carte-matiere .jauge     { margin-top: 11px; }
.carte-matiere .cm-pied   { margin-top: 11px; }
.carte-matiere .compteur  { margin-top: 11px; padding: 8px 11px; }
.carte-matiere .cm-note   { font-size: 1.75rem; }
.section-titre { margin: 16px 0 8px; }
.duo-graph { gap: 14px; }
.carte { margin-bottom: 11px; }

@media (max-width: 620px) {
  .chiffres-cles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cle-val { font-size: 1.4rem; }
  .ag-date { min-width: 62px; font-size: .72rem; }
}

/* ───────── Listing des branches en LIGNES ─────────
   Grille nommée : une ligne dense sur écran large, empilée sur téléphone. */

.bloc-groupe { padding-bottom: 12px; }
.grp-tete {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.grp-tete h2 { margin: 0; }
.grp-moyenne {
  font-size: 1.4rem; font-weight: 780; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}

.lignes-branches { list-style: none; margin: 0; padding: 0; }

.ligne-branche {
  display: grid; align-items: center; gap: 10px;
  grid-template-columns:
    minmax(120px, 1.6fr)   /* nom     */
    58px                   /* moyenne */
    minmax(80px, 1fr)      /* avance  */
    104px                  /* +/-     */
    70px                   /* groupe  */
    76px                   /* requis  */
    64px;                  /* actions */
  padding: 9px 4px;
  border-bottom: 1px solid var(--bordure);
}
.ligne-branche:last-child { border-bottom: none; }

.lb-nom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-nom a {
  color: var(--texte); font-weight: 650; font-size: .93rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-moyenne {
  font-size: 1.25rem; font-weight: 780; text-align: right;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}

.lb-avance { display: flex; align-items: center; gap: 7px; }
.lb-jauge {
  flex: 1; height: 6px; background: var(--bordure); border-radius: 99px;
  overflow: hidden; min-width: 34px;
}
.lb-jauge span { display: block; height: 100%; border-radius: 99px; }
.lb-compte {
  color: var(--texte-doux); font-size: .76rem; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.lb-examens { display: flex; align-items: center; gap: 5px; justify-content: center; }
.lb-examens form { margin: 0; }
.lb-examens strong {
  min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; font-size: .95rem;
}
.lb-examens .btn-rond { width: 30px; height: 30px; font-size: 16px; }

.lb-groupe { display: flex; gap: 4px; }
.lb-groupe form { margin: 0; }
.mini-grp {
  min-width: 32px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--bordure); background: var(--carte); color: var(--texte-doux);
  font: inherit; font-size: .78rem; font-weight: 800; transition: .12s;
}
.mini-grp:hover { border-color: var(--violet); color: var(--violet); }
.mini-grp.actif { background: var(--violet); border-color: var(--violet); color: #fff; }

.lb-requis { text-align: right; }
.rq {
  font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--violet); white-space: nowrap;
}
.rq.ok     { color: var(--vert); }
.rq.ko     { color: var(--gris); }
.rq.neutre { color: var(--texte-doux); font-weight: 500; }

.lb-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.lb-actions form { margin: 0; }
.lb-reglages summary {
  list-style: none; cursor: pointer; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--bordure); color: var(--texte-doux); font-size: 14px;
}
.lb-reglages summary::-webkit-details-marker { display: none; }
.lb-reglages summary:hover { border-color: var(--violet); color: var(--violet); }
.lb-panneau {
  position: absolute; left: 0; right: 0; z-index: 5; margin-top: 8px;
  background: var(--carte); border: 1px solid var(--violet);
  border-radius: var(--r-m); padding: 16px; box-shadow: var(--ombre-forte);
}
.lb-reglages[open] { position: static; }
.ligne-branche { position: relative; }

.btn-supp {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--bordure); background: var(--carte);
  font-size: 13px; transition: .12s;
}
.btn-supp:hover { border-color: var(--rouge); background: color-mix(in srgb, var(--rouge) 12%, var(--carte)); }

@media (max-width: 900px) {
  .ligne-branche {
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas:
      "nom     moy   moy    moy"
      "avance  ex    grp    act";
    gap: 8px 10px; padding: 12px 4px;
  }
  .lb-nom     { grid-area: nom; }
  .lb-moyenne { grid-area: moy; font-size: 1.35rem; }
  .lb-avance  { grid-area: avance; }
  .lb-examens { grid-area: ex; }
  .lb-groupe  { grid-area: grp; }
  .lb-actions { grid-area: act; }
  .lb-requis  { display: none; }
}

/* ───────── Livret ───────── */

.livret {
  background: var(--carte); border: 1px solid var(--bordure);
  border-radius: var(--r-l); padding: 26px 28px; box-shadow: var(--ombre);
}
.lv-tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
  padding-bottom: 14px; border-bottom: 2px solid var(--bordure);
}
.lv-tete h1 { margin-bottom: 2px; }

.lv-table { min-width: 480px; }
.lv-table th, .lv-table td { padding: 9px 10px; }
.lv-branche { display: flex; align-items: center; gap: 8px; }
.lv-branche a { color: var(--texte); font-weight: 600; }

.lv-groupe th {
  background: var(--violet-pale); color: var(--violet);
  font-size: .8rem; text-transform: uppercase; letter-spacing: .07em;
  padding: 8px 10px; border-radius: 8px 8px 0 0; border-bottom: none;
}
.note-cell { font-weight: 700; font-variant-numeric: tabular-nums; }
.note-cell.bonne { color: var(--vert); }
.note-cell.basse { color: var(--rouge); }
.note-cell.fort  { font-size: 1.08rem; font-weight: 800; }
.vide { color: var(--texte-doux); }
.coef { color: var(--texte-doux); font-size: .85rem; }

.lv-total td {
  border-top: 1px solid var(--bordure); font-weight: 700;
  background: color-mix(in srgb, var(--violet) 5%, transparent);
}
.lv-general td {
  border-top: 2px solid var(--violet); font-weight: 800; font-size: 1.02rem;
  padding-top: 12px;
}
.lv-arrondi td { color: var(--texte-doux); font-size: .85rem; border-bottom: none; }
.lv-pied { margin-top: 16px; }

@media print {
  .entete, .pied, .lv-tete button, .lv-pied { display: none !important; }
  body    { background: #fff; }
  .page   { padding: 0; max-width: none; }
  .livret { border: none; box-shadow: none; padding: 0; }
  .lv-table { min-width: 0; }
  .note-cell.bonne { color: #000; }
  .note-cell.basse { color: #000; font-style: italic; }
}

/* ───────── Bande des moyennes de groupe ───────── */

.bande-groupes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.bg-carte {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--r-m);
  padding: 12px 15px; box-shadow: var(--ombre); color: var(--texte);
  display: flex; flex-direction: column; gap: 1px; transition: .15s;
}
.bg-carte:hover { border-color: var(--violet); text-decoration: none; box-shadow: var(--ombre-forte); }
.bg-nom { color: var(--texte-doux); font-size: .74rem; font-weight: 700;
          text-transform: uppercase; letter-spacing: .05em; }
.bg-val { font-size: 1.45rem; font-weight: 780; line-height: 1.05;
          letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.bg-sem { color: var(--texte-doux); font-size: .76rem; font-variant-numeric: tabular-nums; }
.bg-livret {
  align-items: center; justify-content: center; text-align: center;
  font-weight: 700; color: var(--violet);
  border-style: dashed; background: var(--violet-pale);
}

/* ───────── Calendrier des vacances ───────── */

.ruban { width: 100%; height: auto; display: block; overflow: visible; }
.ruban-piste { fill: var(--bordure); opacity: .38; }
.ruban-mois  { stroke: var(--carte); stroke-width: 1; opacity: .5; }
.ruban-emoji { font-size: 19px; text-anchor: middle; }
.ruban-today { stroke: var(--violet); stroke-width: 2.5; stroke-linecap: round; }
.ruban-today-pt  { fill: var(--violet); }
.ruban-today-txt { fill: var(--violet); font-size: 10.5px; font-weight: 700; text-anchor: middle; }

.grille-vac {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 9px; margin-bottom: 11px;
}
.vac-carte {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--r-l);
  padding: 13px 11px; box-shadow: var(--ombre); text-align: center;
  display: flex; flex-direction: column; gap: 3px; transition: .15s;
}
.vac-carte:hover { transform: translateY(-2px); box-shadow: var(--ombre-forte); }
.vc-emoji  { font-size: 27px; line-height: 1.1; margin-bottom: 4px; }
.vac-carte h3 { margin: 0; font-size: .96rem; }
.vc-dates  { margin: 0; color: var(--texte-doux); font-size: .8rem; font-variant-numeric: tabular-nums; }
.vc-duree  { margin: 0; font-weight: 700; font-size: .84rem; }
.vc-detail { margin: 6px 0 0; color: var(--texte-doux); font-size: .72rem; line-height: 1.35; }
.vc-etat {
  margin-top: 8px; align-self: center; padding: 4px 12px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; background: var(--violet-pale); color: var(--violet);
}
.vac-carte.passee   { opacity: .5; }
.vac-carte.passee .vc-etat { background: var(--bordure); color: var(--texte-doux); }
.vac-carte.en-cours { border-color: var(--vert); border-width: 2px; }
.vac-carte.en-cours .vc-etat { background: #dcfce7; color: #15803d; }
@media (prefers-color-scheme: dark) {
  .vac-carte.en-cours .vc-etat { background: #0a4726; color: #bbf7d0; }
}

.bloc-edition > summary {
  cursor: pointer; font-weight: 700; font-size: .95rem; padding: 4px 0; color: var(--texte);
}
.bloc-edition > summary:hover { color: var(--violet); }
.bloc-edition[open] > summary { margin-bottom: 16px; padding-bottom: 12px;
                                border-bottom: 1px solid var(--bordure); }
.sous-titre { margin: 20px 0 10px; font-size: .95rem; }
.champ-emoji { width: 62px; text-align: center; font-size: 1.05rem; }

/* ───────── Ventilation en groupes ───────── */

.carte-ventilation {
  border-color: color-mix(in srgb, var(--violet) 30%, var(--bordure));
  background: linear-gradient(135deg, var(--violet-pale), var(--carte) 72%);
}
.noms-groupes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.ventilation {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 8px; margin-bottom: 16px;
}
.vt-ligne {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; background: var(--carte);
  border: 1px solid var(--bordure); border-radius: var(--r-m);
}
.vt-nom { display: flex; align-items: center; gap: 8px; font-weight: 600;
          font-size: .9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.vt-choix { display: flex; gap: 4px; flex: none; }
.vt-opt { position: relative; margin: 0; cursor: pointer; }
.vt-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.vt-opt span {
  display: block; padding: 7px 12px; border-radius: 8px; min-height: 34px;
  border: 1px solid var(--bordure); background: var(--carte);
  color: var(--texte-doux); font-size: .78rem; font-weight: 700;
  white-space: nowrap; transition: .12s;
}
.vt-opt:hover span { border-color: var(--violet); color: var(--violet); }
.vt-opt input:checked + span {
  background: var(--violet); border-color: var(--violet); color: #fff;
}
.vt-opt input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--violet) 45%, transparent); outline-offset: 2px;
}
.vt-lien { margin-left: 14px; }

/* En-tête de colonnes du listing */
.lb-entete {
  display: grid; gap: 10px;
  grid-template-columns: minmax(120px,1.6fr) 58px minmax(80px,1fr) 104px 70px 76px 64px;
  padding: 0 4px 7px; border-bottom: 2px solid var(--bordure); margin-bottom: 2px;
  color: var(--texte-doux); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.lb-entete .num { text-align: right; }
@media (max-width: 900px) { .lb-entete { display: none; } }

/* ───────── Listing en lecture seule, stylo pour éditer ───────── */

.r-edit { display: none; }
tr.edition .r-vue  { display: none; }
tr.edition .r-edit { display: inline-block; }
tr.edition .col-actions .r-edit { display: flex; gap: 6px; justify-content: flex-end; }
tr.edition { background: color-mix(in srgb, var(--violet) 7%, transparent); }
tr.edition td { padding-top: 9px; padding-bottom: 9px; }

.table-notes td { padding: 9px 8px; }
.note-forte { font-weight: 800; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.note-forte.sous-barre { color: var(--rouge); }
.puce-sem {
  background: var(--bordure); color: var(--texte-doux);
  padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800;
}
.champ-sem     { width: 72px; }
.champ-branche { width: 150px; }

.btn-stylo {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--bordure); background: var(--carte);
  font-size: 15px; transition: .12s;
}
.btn-stylo:hover { border-color: var(--violet); background: var(--violet-pale); }
.col-actions { text-align: right; }
.cadenas { font-size: 15px; opacity: .55; }
.ligne-verrouillee { opacity: .72; }

/* ───────── Verrous de semestre ───────── */

.verrous { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.verrous form { margin: 0; }
.verrou {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--bordure); background: var(--carte); color: var(--texte);
  font: inherit; font-size: .84rem; font-weight: 700; transition: .15s;
}
.verrou em { font-style: normal; font-weight: 500; color: var(--texte-doux); font-size: .78rem; }
.verrou:hover { border-color: var(--violet); }
.verrou.ferme {
  background: color-mix(in srgb, var(--orange) 13%, var(--carte));
  border-color: color-mix(in srgb, var(--orange) 45%, var(--bordure));
}
.verrou-info { font-size: .8rem; margin-left: auto; }

/* ───────── Moyennes imposées au livret ───────── */

.note-cell.imposee {
  text-decoration: underline dotted currentColor 2px;
  text-underline-offset: 4px; cursor: help;
}
.ex-imposee {
  text-decoration: underline dotted var(--texte-doux) 2px; text-underline-offset: 3px;
}

@media (max-width: 620px) {
  .verrou-info { margin-left: 0; width: 100%; }
  .champ-branche { width: 120px; }
}

/* ───────── L'échelle de couleur des notes ─────────
   La teinte arrive du PHP via --n : une seule source pour toute l'app. */

.pastille-note {
  border-color: color-mix(in srgb, var(--n) 32%, var(--bordure));
  color: var(--n);
}
.pastille-note:hover {
  border-color: var(--n);
  background: color-mix(in srgb, var(--n) 10%, var(--carte));
  transform: translateY(-1px);
}
.pastille-note.actif {
  background: var(--n); border-color: var(--n); color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--n) 55%, transparent);
  transform: translateY(-2px);
}

/* Le 6 ne se mélange pas au dégradé : il est en or. */
.pastille-note.en-or {
  border-color: #e0b63a;
  color: #a3760f;
  background: linear-gradient(150deg, #fff8e1, #ffeeb8 55%, #ffe08a);
  box-shadow: 0 2px 8px rgba(200, 150, 30, .25);
}
.pastille-note.en-or:hover { transform: translateY(-2px) scale(1.03); }
.pastille-note.en-or.actif {
  color: #fff; border-color: #b8860b;
  background: linear-gradient(150deg, #f6c84c, #d99b12 60%, #b8860b);
  box-shadow: 0 6px 22px rgba(200, 150, 30, .6);
  animation: eclat-or 1.6s ease-in-out infinite;
}
@keyframes eclat-or {
  0%, 100% { box-shadow: 0 6px 22px rgba(200, 150, 30, .60); }
  50%      { box-shadow: 0 6px 30px rgba(255, 200,  60, .95); }
}
@media (prefers-color-scheme: dark) {
  .pastille-note.en-or { background: linear-gradient(150deg, #3d3113, #4d3d13); color: #f6c84c; }
}

.ag-note {
  background: color-mix(in srgb, var(--n) 16%, transparent);
  color: var(--n);
}
.ag-note.en-or {
  background: linear-gradient(140deg, #fff3cd, #ffe08a);
  color: #8a6508; box-shadow: 0 1px 6px rgba(200, 150, 30, .35);
}
.note-forte.en-or { color: #b8860b !important; text-shadow: 0 0 14px rgba(255, 200, 60, .5); }

/* ───────── Un 6 : feux d'artifice ───────── */

#feux {
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none; width: 100vw; height: 100vh;
}

.fete-fond {
  position: fixed; inset: 0; z-index: 95;
  display: grid; place-items: center; padding: 22px;
  background: rgba(23, 19, 48, .58);
  backdrop-filter: blur(4px);
  animation: fete-entree .3s ease both;
}
.fete-fond.parti { animation: fete-sortie .35s ease both; }
@keyframes fete-entree { from { opacity: 0; } to { opacity: 1; } }
@keyframes fete-sortie { to { opacity: 0; } }

.fete-carte {
  background: var(--carte); border-radius: 26px; padding: 34px 30px 28px;
  max-width: 380px; width: 100%; text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .38);
  border: 2px solid #e0b63a;
  animation: fete-pop .45s cubic-bezier(.18, 1.3, .5, 1) both;
}
@keyframes fete-pop {
  from { transform: scale(.75) translateY(24px); opacity: 0; }
  to   { transform: scale(1) translateY(0);      opacity: 1; }
}

.fete-six {
  width: 92px; height: 92px; margin: 0 auto 16px;
  display: grid; place-items: center;
  font-size: 54px; font-weight: 800; color: #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd76a, #d99b12 55%, #b8860b);
  box-shadow: 0 8px 28px rgba(200, 150, 30, .6), inset 0 2px 8px rgba(255, 255, 255, .55);
  animation: six-tourne 3.5s ease-in-out infinite;
}
@keyframes six-tourne {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50%      { transform: rotate(5deg)  scale(1.05); }
}

.fete-carte h2 {
  font-size: 1.6rem; letter-spacing: -.02em; margin-bottom: 6px;
  background: linear-gradient(90deg, #b8860b, #f0b429, #b8860b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fete-quoi { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.fete-mot  { color: var(--texte-doux); font-size: .92rem; margin-bottom: 20px; }

@media (prefers-reduced-motion: reduce) {
  .fete-carte, .fete-six, .fete-fond { animation: none !important; }
  .pastille-note.en-or.actif { animation: none !important; }
}

.version {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  border-radius: 999px; background: var(--bordure); color: var(--texte-doux);
  font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ───────── L'exigence en couleur ─────────
   Échelle INVERSÉE : bas = vert (large), haut = rouge (il faut cartonner). */

.rq { color: var(--e, var(--violet)); }
.rq.neutre { color: var(--texte-doux); font-weight: 500; }
.rq.ko     { color: var(--gris); }

/* ───────── Ruban lisible ───────── */

.ruban-bande { fill: var(--texte); opacity: .035; }
.ruban-mois  { stroke: var(--texte-doux); stroke-width: 1; opacity: .18; }
.ruban-emoji { font-size: 17px; text-anchor: middle; }
.ruban-nom   { font-size: 9.5px; text-anchor: middle; fill: #fff; font-weight: 700; }

/* ───────── Un peu plus jeune ───────── */

.carte-matiere:hover, .cle:hover, .mini-carte:hover { transform: translateY(-1px); }
.cle, .mini-carte, .carte-matiere { transition: transform .14s ease, box-shadow .14s ease; }

.hero-chiffre {
  background: linear-gradient(115deg, var(--teinte), color-mix(in srgb, var(--teinte) 55%, #a78bfa));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.badge { letter-spacing: .015em; }
.btn-primaire:active, .pastille-note:active, .btn-large:active { transform: translateY(1px) scale(.99); }

.entete { border-bottom: 2px solid var(--bordure); }
.logo-rond { animation: logo-flotte 5s ease-in-out infinite; }
@keyframes logo-flotte {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-2px) rotate(-3deg); }
}
@media (prefers-reduced-motion: reduce) { .logo-rond { animation: none; } }

/* ───────── Pied de la saisie flash : action à droite, pas pleine largeur ───────── */

.flash-pied {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 16px; padding-top: 13px;
  border-top: 1px solid var(--bordure);
}
.flash-pied .btn { padding: 10px 30px; font-size: .92rem; }

/* Les 13 branches doivent tenir sans occuper la moitié de l'écran. */
.pastille-choix span { min-height: 38px; padding: 0 12px; font-size: .87rem; }
.pastille-note { min-width: 44px; min-height: 40px; font-size: .95rem; }
.pastille-libre input { width: 76px; min-height: 40px; }
.flash-etape { margin: 13px 0 7px; font-size: .72rem; }
.carte-flash .form-grille { gap: 11px; }

@media (max-width: 620px) {
  .flash-pied { flex-direction: column-reverse; align-items: stretch; }
  .flash-pied .btn { width: 100%; padding: 13px 20px; }
  .flash-pied .lien-discret { text-align: center; }
}

/* ───────── Micro-graphiques ───────── */

.spark { width: 74px; height: 22px; display: block; overflow: visible; }
.spark-4 { stroke: var(--rouge); stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; }
.spark-vide { color: var(--texte-doux); font-size: .8rem; }

.cm-droite { display: flex; align-items: center; gap: 9px; }
.cm-droite .spark { width: 62px; }
.lb-spark { display: flex; align-items: center; }
.lb-spark .spark { width: 100%; max-width: 84px; }

.duo-vue { display: grid; grid-template-columns: 1fr 210px; gap: 11px; }
.carte-donut { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.carte-donut h2 { align-self: flex-start; }
.donut-txt { margin: 2px 0 0; font-size: .82rem; }
.graph-positions { overflow: visible; }

/* La ligne de branche accueille la tendance */
.ligne-branche, .lb-entete {
  grid-template-columns:
    minmax(110px, 1.5fr) 54px 86px minmax(70px, .9fr) 100px 68px 74px 62px;
}
@media (max-width: 1000px) {
  .duo-vue { grid-template-columns: 1fr; }
  .carte-donut { flex-direction: row; gap: 16px; }
  .carte-donut h2 { align-self: center; }
}
@media (max-width: 900px) {
  .ligne-branche {
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas:
      "nom     moy   moy   moy"
      "spark   spark spark spark"
      "avance  ex    grp   act";
  }
  .lb-spark { grid-area: spark; }
  .lb-spark .spark { max-width: none; width: 100%; height: 26px; }
}
