/**
 * app.css — mise en page propre à cette appli (Graph SkolSuite).
 * Les couleurs, polices, rayons et ombres viennent des variables --ss-* de
 * /ui/v1/skolsuite-ui.css (kit partagé, chargé AVANT ce fichier) : ne jamais
 * écrire une couleur en dur quand une variable existe (le mode sombre et les
 * thèmes d'accent en dépendent).
 *
 * Règles de style de l'appli : docs/STYLE_GUIDE.md. Les commentaires ci-dessous
 * disent POURQUOI chaque bloc existe ; les numéros renvoient au guide.
 *
 * Sommaire
 *   0. Réglages de l'appli (variables locales)
 *   1. Base de page
 *   2. Tableaux et boutons-icônes
 *   3. Petits composants (langues, cases à cocher)
 *   4. Éditeur : modèles, panneaux, zone résultat
 *   5. Champs de formulaire (form-fields.js) — le cœur du guide
 *   6. Figures du moteur wiz/ (schémas, cartes mémo)
 *   7. Accueil (tableau de bord)
 *   8. Fenêtres (aide du modèle, partage + QR code)
 *   9. Mes fichiers, Graphiques et partages (dont partage élèves par type)
 *  10. Maths $…$
 *  11. Téléphone (≤ 820 px)
 */

/* ============================================================ 0. Réglages de l'appli
   Une seule source pour les mesures qui reviennent partout (guide §2).
   --f-h   : hauteur de TOUTE commande (champ, bouton −/+, bouton segmenté).
             40 px = cible tactile confortable au doigt (minimum recommandé 40–44).
   --f-fs  : taille du texte saisi. 16 px sur téléphone (voir §11) : en dessous,
             iPhone zoome toute la page dès qu'on touche un champ.
   --f-gap : espace entre deux champs. */
:root {
  --f-h: 40px;
  --f-fs: .92rem;
  --f-gap: .75rem;
}

/* ============================================================ 1. Base de page */
body { margin: 0; background: var(--ss-paper); }
.ss-wrap { min-height: 100vh; display: flex; justify-content: center; padding: 1.5rem; }
.ss-wrap-inner { width: 100%; max-width: 420px; }
.ss-card h2 { font-size: 1.05rem; font-weight: 500; margin: 1.25rem 0 .6rem; }
.ss-card ul, .ss-card ol { padding-left: 1.2rem; font-size: .9rem; line-height: 1.6; }
.ss-card li { margin-bottom: .3rem; }

/**
 * Ce qui suit N'EST PAS dans le kit partagé (/ui/v1/skolsuite-ui.css) --
 * ce sont des extensions locales à CETTE appli. Une nouvelle appli peut les
 * copier telles quelles ou les adapter -- voir docs/THEME_GUIDE.md.
 */

/* ============================================================ 2. Tableaux et boutons-icônes */
/* Tableaux : zébrures pour suivre une ligne à l'œil, en-têtes discrets. */
.ss-table { width: 100%; border-collapse: collapse; margin-bottom: .9rem; font-size: .85rem; }
.ss-table th, .ss-table td { padding: .5rem .7rem; text-align: start; border-bottom: 1px solid var(--ss-paper-line); }
.ss-table th { font-weight: 600; color: var(--ss-muted); }
.ss-table tbody tr:nth-child(even) { background: var(--ss-paper); }
[data-ss-theme="dark"] .ss-table tbody tr:nth-child(even) { background: rgba(255,255,255,.03); }
.ss-table td.ss-td-actions { text-align: end; white-space: nowrap; }
.ss-table th.ss-th-actions { text-align: end; }
.ss-table td.ss-td-center, .ss-table th.ss-th-center { text-align: center; }

/* Bouton-icône (renommer, supprimer, QR…) : carré, info-bulle via title. */
.ss-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; margin-inline-start: .25rem;
  border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm);
  background: #fff; color: var(--ss-ink); cursor: pointer;
  transition: background .15s, border-color .15s;
}
[data-ss-theme="dark"] .ss-icon-btn { background: #131C2E; }
.ss-icon-btn:hover { background: var(--ss-paper); border-color: var(--ss-ochre); }
.ss-icon-btn svg { width: 15px; height: 15px; }
.ss-icon-btn.ss-icon-danger { color: #DC2626; }
.ss-icon-btn.ss-icon-danger:hover { background: #FEE2E2; border-color: #DC2626; }
.ss-icon-btn.ss-icon-success { color: #16A34A; }
.ss-icon-btn.ss-icon-success:hover { background: #DCFCE7; border-color: #16A34A; }
.ss-icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================ 3. Petits composants */
/* Formulaires multilingues : une petite grille FR/EN/DE/ES/AR sous un même champ. */
.ss-lang-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.ss-lang-item { flex: 1; min-width: 110px; }
.ss-lang-tag { font-size: .7rem; color: var(--ss-muted); display: block; margin-bottom: .2rem; }
/* Grille de cases à cocher (sélection multiple depuis un référentiel). */
.ss-checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem .8rem; margin-top: .3rem; }

/* ============================================================ 4. Éditeur : modèles, panneaux, zone résultat */
/* Rangée des modèles : pastilles, la pastille active est pleine. */
.editeur-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.2rem; }
.modele-btn {
  padding: .45rem .9rem; border: 1px solid var(--ss-paper-line); border-radius: 999px;
  background: var(--ss-chalk); color: var(--ss-ink); font-size: .84rem; cursor: pointer;
}
.modele-btn:hover { border-color: var(--ss-slate); }
.modele-btn.active { background: var(--ss-slate); border-color: var(--ss-slate); color: #fff; font-weight: 600; }
/* lien « Guide » en fin de rangée : pointillés = il mène ailleurs, ce n'est pas un modèle */
.modele-btn-link { border-style: dashed; text-decoration: none; opacity: .85; }
.modele-btn-link:hover { opacity: 1; }
/* en-tête « modèle actif + ? » au-dessus du formulaire */
.editeur-modele-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; font-size: .82rem; color: var(--ss-muted); }
#custom-mount-container { padding: 0; }

/* Deux panneaux côte à côte (formulaire | résultat), empilés sur téléphone (§11).
   min-width: 0 sur les panneaux (guide §4) : sans lui, un panneau prend la largeur
   de son contenu le plus large (tableau à 7 colonnes) et la page dépasse l'écran. */
.editeur-workspace { display: flex; gap: 1.2rem; min-width: 0; flex-wrap: wrap; }
.editeur-pane {
  flex: 1 1 280px; min-width: 0;
  border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm); overflow: hidden;
}
.editeur-pane-head {
  display: flex; justify-content: space-between; align-items: center; padding: .5rem .8rem;
  background: var(--ss-chalk); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ss-muted); font-weight: 600; border-bottom: 1px solid var(--ss-paper-line);
}
/* zone résultat : jamais plus large que son panneau ; ce qui est large (tableau)
   défile DANS sa propre boîte (.lb-calc-wrap), pas la page entière */
.editeur-preview-wrap { padding: 1.2rem; display: flex; justify-content: center; min-width: 0; }
.editeur-preview-wrap > #preview-container { flex: 1 1 auto; min-width: 0; max-width: 100%; }
.editeur-modele-note { margin: 0 .8rem .8rem; }
.editeur-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 .8rem .8rem; }
.editeur-save-link { display: none; margin: 0 .8rem .8rem; word-break: break-all; }
.editeur-save-link.show { display: block; }
/* bandeau d'erreur : masqué tant que afficherErreur() n'a pas ajouté .show.
   JAMAIS de style="display:none" en ligne sur cet élément (LESSONS_LEARNED #11). */
#err-banner { display: none; }
#err-banner.show { display: block; }
.editeur-json-preview { border-top: 1px solid var(--ss-paper-line); }
.editeur-json-preview summary { padding: .5rem .8rem; font-size: .78rem; color: var(--ss-muted); cursor: pointer; }
.editeur-json-preview pre { margin: 0; padding: .8rem; background: var(--ss-ink); color: #E8EDF4; font-size: .76rem; max-height: 180px; overflow: auto; }

/* ============================================================ 5. Champs de formulaire
   Générés par assets/js/form-fields.js à partir des manifests (type, size, min,
   max, step…). Règle d'or (guide §3) : UN CHAMP A LA TAILLE DE CE QU'ON Y TAPE.
   Les champs se rangent côte à côte (flex-wrap) : n, p et k tiennent sur une
   ligne ; seuls les champs de texte long occupent toute la largeur. */
#form-container {
  padding: 1rem; max-height: 520px; overflow-y: auto;
  display: flex; flex-wrap: wrap; gap: var(--f-gap) 1rem; align-items: flex-start;
}
#form-container > input[type=hidden] { display: none; }

/* Largeur du bloc champ selon « size » : full = toute la ligne, sinon juste ce qu'il faut. */
.f-field { margin: 0; min-width: 0; }
.f-size-full { flex: 1 1 100%; }
.f-size-xs, .f-size-s, .f-size-m, .f-size-l, .f-size-auto { flex: 0 1 auto; max-width: 100%; }

/* Étiquette : casse normale et courte (« n (épreuves) ») — les MAJUSCULES sont plus
   lentes à lire et prennent 20 % de place en plus. L'explication va dans « hint ». */
.f-field > label { display: block; font-size: .8rem; font-weight: 600; color: var(--ss-ink); margin-bottom: .3rem; }
.f-hint { font-size: .72rem; color: var(--ss-muted); margin-top: .3rem; line-height: 1.35; }
/* aide courte sur la ligne de l'étiquette : « n (épreuves) · de 1 à 1000 » */
.f-hint-inline { font-weight: 400; color: var(--ss-muted); font-size: .74rem; margin-left: .4rem; }
.f-hint-inline::before { content: "· "; }

/* Toutes les commandes ont la même hauteur (--f-h) : la ligne reste alignée. */
.f-field input[type=text], .f-field select {
  height: var(--f-h); width: 100%; padding: 0 .65rem; box-sizing: border-box;
  border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm);
  font-size: var(--f-fs); font-family: inherit; background: #fff; color: var(--ss-ink);
}
[data-ss-theme="dark"] .f-field input[type=text], [data-ss-theme="dark"] .f-field select { background: #131C2E; }
.f-field input:focus, .f-field select:focus { outline: 2px solid var(--ss-slate); outline-offset: 1px; }
/* select : largeur de son contenu (pas 100 %), mais jamais plus que la ligne */
.f-type-select select { width: auto; min-width: 8rem; max-width: 100%; }

/* Largeurs fixes en « ch » (1 ch = largeur d'un chiffre) + marge intérieure :
   xs ≈ 6 chiffres (n, k, 0,25), s ≈ 9 (1/6, 12,5), m ≈ 16, l ≈ 24. */
.f-field input.f-w-xs, .f-row-fields input.f-w-xs { width: calc(6ch + 1.3rem); }
.f-field input.f-w-s,  .f-row-fields input.f-w-s  { width: calc(9ch + 1.3rem); }
.f-field input.f-w-m,  .f-row-fields input.f-w-m  { width: calc(16ch + 1.3rem); }
.f-field input.f-w-l,  .f-row-fields input.f-w-l  { width: calc(24ch + 1.3rem); }
/* nombres : chiffres alignés, centrés dans leur petite case */
.f-input-num { text-align: center; font-variant-numeric: tabular-nums; }

/* Champ numérique avec − / + : on règle au doigt sans ouvrir le clavier. */
.f-num { display: inline-flex; align-items: stretch; }
.f-num input[type=text] { border-radius: 0; border-left: 0; border-right: 0; }
.f-step {
  flex: none; width: var(--f-h); height: var(--f-h); padding: 0;
  border: 1px solid var(--ss-paper-line); background: var(--ss-chalk); color: var(--ss-slate);
  font-size: 1.15rem; font-weight: 700; line-height: 1; cursor: pointer;
  touch-action: manipulation;           /* pas de zoom au double appui sur téléphone */
}
.f-step:first-child { border-radius: var(--ss-radius-sm) 0 0 var(--ss-radius-sm); }
.f-step:last-child  { border-radius: 0 var(--ss-radius-sm) var(--ss-radius-sm) 0; }
.f-step:hover { background: #EAF1FD; }
.f-step:active { background: var(--ss-slate); color: #fff; }
[data-ss-theme="dark"] .f-step { background: #1B2740; }

/* Curseur + case (ex. n de 1 à 1000) : le curseur prend la place libre, la case
   reste petite à droite pour la valeur exacte. */
.f-range { display: flex; align-items: center; gap: .6rem; }
.f-slider {
  flex: 1 1 140px; min-width: 0; height: var(--f-h); margin: 0;
  accent-color: var(--ss-slate);        /* curseur aux couleurs du thème, sans CSS spécifique navigateur */
  cursor: pointer; touch-action: pan-y; /* glisser horizontalement = régler, verticalement = défiler */
}

/* Select court (≤ 3 options courtes) : boutons côte à côte, un seul appui. */
.f-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm); overflow: hidden; }
.f-seg-btn {
  min-height: var(--f-h); padding: 0 .85rem; border: 0; border-left: 1px solid var(--ss-paper-line);
  background: #fff; color: var(--ss-ink); font: inherit; font-size: .85rem; cursor: pointer; touch-action: manipulation;
}
.f-seg-btn:first-of-type { border-left: 0; }
.f-seg-btn.on { background: var(--ss-slate); color: #fff; font-weight: 600; }
[data-ss-theme="dark"] .f-seg-btn:not(.on) { background: #131C2E; }

/* Listes répétables (points, séries, fonctions…) : une ligne par élément. */
.f-section-label { flex: 1 1 100%; font-size: .74rem; font-weight: 700; color: var(--ss-muted); margin: .4rem 0 0; padding-top: .8rem; border-top: 1px solid var(--ss-paper-line); text-transform: uppercase; letter-spacing: .03em; }
#form-container > div[id^="list-"] { flex: 1 1 100%; min-width: 0; }
.f-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; background: var(--ss-chalk); border-radius: var(--ss-radius-sm); padding: .5rem; }
.f-row-fields { flex: 1; display: flex; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.f-row-fields > div { flex: 1 1 auto; min-width: 0; }
.f-row-fields label { display: block; font-size: .7rem; color: var(--ss-muted); margin-bottom: .15rem; font-weight: 600; }
.f-row-fields input, .f-row-fields select { width: 100%; height: 36px; box-sizing: border-box; padding: 0 .5rem; border: 1px solid var(--ss-paper-line); border-radius: 6px; font-size: var(--f-fs); font-family: inherit; }
.f-row-remove { flex: none; width: 32px; height: 32px; border-radius: 6px; border: 1px solid #F3C9C7; background: #FDEDEC; color: var(--ss-error); cursor: pointer; }
.f-add-btn { flex: 1 1 100%; min-height: 38px; padding: .45rem .7rem; border-radius: var(--ss-radius-sm); border: 1px dashed var(--ss-slate); background: #EAF1FD; color: var(--ss-slate); font-size: .82rem; font-weight: 600; cursor: pointer; width: 100%; }
.f-add-btn:hover { background: #DCE9FC; }
.f-img-preview { max-width: 100%; max-height: 110px; border-radius: 8px; border: 1px solid var(--ss-paper-line); margin-top: .5rem; display: block; }

/* ============================================================ 6. Figures du moteur wiz/
   Les figures SVG se dessinent à la largeur RÉELLE de leur zone (wiz/core.js),
   donc leurs textes gardent leur taille sur téléphone. Ici : les types rendus en
   HTML (schémas, cartes mémo). */
.viz { max-width: 100%; }
.viz svg { max-width: 100%; height: auto; }
.dg { font-size: .92rem; }
.dg-t { font-weight: 700; color: var(--ss-slate); margin: 0 0 .6rem; }
.dg-chain { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.dg-chain b { background: var(--ss-chalk); border: 1px solid var(--ss-slate); color: var(--ss-slate); padding: .2rem .6rem; border-radius: 6px; }
.dg-lk { display: flex; align-items: center; gap: .4rem; }
.dg-lk s { color: var(--ss-ochre); text-decoration: none; font-weight: 700; }
.dg-ol { margin: 0; padding-left: 1.3rem; }
.dg-ol li { margin: .3rem 0; }
.dg-loop { color: var(--ss-muted); font-style: italic; margin: .6rem 0 0; }
.dg-hub { background: #EAF1FD; border: 1px solid var(--ss-slate); border-radius: var(--ss-radius-sm); padding: .6rem .8rem; margin-bottom: .6rem; }
.dg-hub span { display: block; font-size: .68rem; text-transform: uppercase; color: var(--ss-muted); }
.dg-hub b { color: var(--ss-slate); }
.dg-ul { margin: 0; padding-left: 1.3rem; }
.dg-ul li { margin: .25rem 0; }
.vz-cap { color: var(--ss-muted); font-size: .78rem; margin-top: .6rem; }
.vz-h { font-weight: 700; color: var(--ss-slate); margin-bottom: .6rem; }
/* cartes mémo : retournement 3D ; jeu d'association en deux colonnes */
.vz-fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.vz-fc { perspective: 800px; height: 84px; border: none; background: none; cursor: pointer; padding: 0; }
.vz-fc-in { position: relative; width: 100%; height: 100%; display: block; transition: transform .5s; transform-style: preserve-3d; }
.vz-fc.flip .vz-fc-in { transform: rotateY(180deg); }
.vz-fc-f, .vz-fc-b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: .5rem; border-radius: 8px; backface-visibility: hidden; font-size: .82rem; }
.vz-fc-f { background: var(--ss-chalk); border: 1px solid var(--ss-slate); color: var(--ss-slate); font-weight: 600; }
.vz-fc-b { background: var(--ss-slate); color: #fff; transform: rotateY(180deg); }
.vz-match { display: flex; gap: 1.2rem; }
.vz-col { flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.vz-mi { padding: .5rem .6rem; border-radius: 7px; border: 1px solid var(--ss-paper-line); background: #fff; text-align: start; cursor: pointer; font-size: .82rem; }
.vz-mi.sel { border-color: var(--ss-slate); background: #EAF1FD; }
.vz-mi.ok { border-color: var(--ss-success); background: #E4F6EE; color: var(--ss-success); }
.vz-mi.bad { border-color: var(--ss-error); background: #FDEDEC; }
.vz-mi:disabled { cursor: default; opacity: .85; }

/* ============================================================ 7. Accueil (home.php) */
.ss-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.ss-dash-card {
  display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm);
  box-shadow: var(--ss-shadow-sm); transition: transform .12s, box-shadow .12s; position: relative;
}
[data-ss-theme="dark"] .ss-dash-card { background: #131C2E; }
.ss-dash-card:hover { transform: translateY(-2px); box-shadow: var(--ss-shadow); }
.ss-dash-icon {
  flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--ss-chalk); color: var(--ss-slate);
  display: flex; align-items: center; justify-content: center;
}
.ss-dash-icon svg { width: 20px; height: 20px; }
.ss-dash-title { font-weight: 700; font-size: .95rem; margin-bottom: .25rem; color: var(--ss-ink); }
.ss-dash-desc { font-size: .8rem; color: var(--ss-muted); line-height: 1.5; }
.ss-dash-quota { position: absolute; bottom: .7rem; right: 1.1rem; left: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.ss-dash-quota-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--ss-paper-line); overflow: hidden; }
.ss-dash-quota-bar span { display: block; height: 100%; background: var(--ss-slate); }
.ss-dash-quota-txt { font-size: .68rem; color: var(--ss-muted); white-space: nowrap; }

/* ============================================================ 8. Fenêtres */
/* Aide du modèle (models/<id>/aide.md, rendu par SsMath.markdown) : fenêtre
   centrée, défile à l'intérieur si le texte est long. */
.aide-modele-overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,26,40,.45); z-index: 100;
  align-items: center; justify-content: center; padding: 1.5rem;
}
.aide-modele-overlay.show { display: flex; }
.aide-modele-box {
  position: relative; background: #fff; border-radius: var(--ss-radius); max-width: 560px; width: 100%;
  max-height: 80vh; overflow-y: auto; padding: 2rem 1.8rem 1.6rem; box-shadow: var(--ss-shadow); box-sizing: border-box;
}
[data-ss-theme="dark"] .aide-modele-box { background: #131C2E; }
.aide-modele-close { position: absolute; top: .8rem; right: .8rem; }
.aide-modele-body h1 { font-size: 1.15rem; margin: 0 0 .8rem; color: var(--ss-slate); }
.aide-modele-body h2 { font-size: .95rem; margin: 1.2rem 0 .5rem; color: var(--ss-ink); }
.aide-modele-body p, .aide-modele-body li { font-size: .88rem; line-height: 1.6; color: var(--ss-ink); }
.aide-modele-body code { background: var(--ss-chalk); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }
.aide-modele-body ul { padding-left: 1.3rem; }

/* Partage aux élèves (assets/js/share-dialog.js) : lien /e-<slug> + QR code. */
.share-overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,26,40,.5); z-index: 110;
  align-items: center; justify-content: center; padding: 1.5rem;
}
.share-overlay.show { display: flex; }
.share-box {
  position: relative; background: #fff; border-radius: var(--ss-radius); max-width: 440px; width: 100%;
  max-height: 92vh; overflow-y: auto; padding: 1.8rem 1.6rem 1.4rem; box-shadow: var(--ss-shadow); text-align: center; box-sizing: border-box;
}
[data-ss-theme="dark"] .share-box { background: #131C2E; }
.share-close { position: absolute; top: .8rem; right: .8rem; }
.share-box h2 { margin: 0 0 .2rem; font-size: 1.1rem; }
.share-label { margin: 0 0 1rem; font-weight: 600; color: var(--ss-ink); }
/* fond blanc forcé, même en mode sombre : un QR code se lit en noir sur blanc */
.share-qr { width: 220px; max-width: 100%; margin: 0 auto 1rem; background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--ss-paper-line); }
.share-qr svg { display: block; width: 100%; height: auto; }
.share-link { display: flex; gap: .5rem; margin-bottom: .8rem; }
.share-url { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; padding: .5rem .6rem; border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm); background: var(--ss-chalk); color: var(--ss-ink); }
.share-note { font-size: .76rem; text-align: left; margin-bottom: 1rem; }
.share-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.share-actions .ss-btn { text-decoration: none; }
/* « Afficher en grand » : QR projeté au tableau, lisible depuis le fond de la classe */
.share-projection .share-box { max-width: min(92vw, 820px); }
.share-projection .share-qr { width: min(70vh, 80vw); }
.share-projection .share-url { font-size: 1.15rem; text-align: center; }
.share-projection .share-note { display: none; }

/* ============================================================ 9. Mes fichiers, Graphiques et partages */
/* Interrupteur « Élèves » : gris = non partagé, vert = lien actif. */
.mf-share { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.mf-share-btn { font: inherit; font-size: .74rem; font-weight: 600; border-radius: 999px; padding: .2rem .65rem; cursor: pointer; border: 1px solid var(--ss-paper-line); background: transparent; color: var(--ss-muted); }
.mf-share-btn.on { border-color: transparent; background: #E3F5EC; color: #146C48; }
[data-ss-theme="dark"] .mf-share-btn.on { background: rgba(31,157,107,.2); color: #7FD9B0; }
.mf-share-btn:hover { border-color: var(--ss-slate); }
.mf-share-none { color: var(--ss-muted); font-size: .8rem; }

/* Graphiques et partages : filtres, compteurs, tableau qui défile dans sa boîte. */
.gr-new { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.gr-new select { max-width: 240px; }
.gr-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.gr-filters input[type=search] { flex: 1 1 220px; min-width: 0; max-width: 360px; }
.gr-filters select { flex: 0 1 200px; }
.gr-filters input[type=search], .gr-filters select, .gr-new select {
  padding: .45rem .6rem; border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm);
  font-size: var(--f-fs); font-family: inherit; background: #fff; color: var(--ss-ink); height: var(--f-h); box-sizing: border-box;
}
[data-ss-theme="dark"] .gr-filters input[type=search], [data-ss-theme="dark"] .gr-filters select, [data-ss-theme="dark"] .gr-new select { background: #131C2E; }
.gr-filters input:focus, .gr-filters select:focus, .gr-new select:focus { outline: 2px solid var(--ss-slate); outline-offset: 1px; }
.gr-scope { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--ss-ochre-deep); background: var(--ss-ochre-soft); padding: .35rem .7rem; border-radius: 999px; cursor: pointer; }
.gr-stats { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; margin-bottom: 1rem; }
.gr-stat { background: var(--ss-chalk); border-radius: var(--ss-radius-sm); padding: .6rem .9rem; display: flex; flex-direction: column; min-width: 130px; }
.gr-stat-v { font-size: 1.35rem; font-weight: 700; color: var(--ss-ink); line-height: 1.2; }
.gr-stat-l { font-size: .74rem; color: var(--ss-muted); }
.gr-stat-on .gr-stat-v { color: var(--ss-success); }
.gr-stop-all { margin-inline-start: auto; align-self: center; }
.gr-flash { margin-bottom: .8rem; }
.gr-table-wrap { overflow-x: auto; }
.gr-table td { vertical-align: middle; }
.gr-row-on td:first-child { box-shadow: inset 3px 0 0 var(--ss-success); }   /* liseré vert = partagé */
.gr-rename { display: flex; gap: .3rem; align-items: center; }
.gr-rename input { min-width: 110px; width: 100%; border: 1px solid transparent; background: transparent; padding: 3px 5px; border-radius: 5px; font: inherit; color: inherit; }
.gr-rename input:hover, .gr-rename input:focus { border-color: var(--ss-paper-line); }
.gr-model { font-size: .78rem; font-weight: 600; color: var(--ss-slate); background: var(--ss-chalk); border-radius: 999px; padding: .15rem .6rem; white-space: nowrap; }
.gr-link { display: inline-flex; align-items: center; gap: .2rem; }
.gr-link-url { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; white-space: nowrap; }
.gr-muted { color: var(--ss-muted); font-size: .8rem; }
.gr-nowrap { white-space: nowrap; }
.gr-empty { text-align: center; padding: 2rem 1rem; }
.gr-empty p { margin: 0 0 .5rem; }

/* Partage élèves PAR TYPE DE GRAPHE (2.1.h, pages/partials/graphiques-rows.php).
   Une tuile par type : vert = autorisé (les graphiques de ce type ont leur lien
   élève), gris = interdit. Cliquable pour l'administrateur seulement. */
.gr-types { border: 1px solid var(--ss-paper-line); border-radius: var(--ss-radius-sm); padding: .9rem 1rem 1rem; margin-bottom: 1.2rem; background: var(--ss-chalk); }
.gr-types-head h2 { margin: 0 0 .25rem; font-size: 1rem; }
.gr-types-head .ss-hint { margin: 0 0 .8rem; font-size: .8rem; }
.gr-types-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.gr-type {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: start;
  padding: .55rem .7rem; border-radius: var(--ss-radius-sm); border: 1px solid var(--ss-paper-line);
  background: #fff; color: var(--ss-ink); font: inherit; min-height: 64px; box-sizing: border-box;
}
[data-ss-theme="dark"] .gr-type { background: #131C2E; }
.gr-type-name { font-weight: 600; font-size: .86rem; line-height: 1.25; }
.gr-type-state { font-size: .72rem; font-weight: 700; color: var(--ss-muted); }
.gr-type-count { font-size: .72rem; color: var(--ss-muted); }
.gr-type.on { border-color: #9ED9BF; background: #F1FAF5; }
.gr-type.on .gr-type-state { color: #146C48; }
[data-ss-theme="dark"] .gr-type.on { background: rgba(31,157,107,.14); border-color: rgba(31,157,107,.5); }
[data-ss-theme="dark"] .gr-type.on .gr-type-state { color: #7FD9B0; }
.gr-type-btn { cursor: pointer; touch-action: manipulation; transition: border-color .15s, box-shadow .15s; }
.gr-type-btn:hover { border-color: var(--ss-slate); box-shadow: var(--ss-shadow-sm); }
.gr-type-btn:focus-visible { outline: 2px solid var(--ss-slate); outline-offset: 2px; }

/* Nom d'un graphique dans les tableaux : affiché MIS EN FORME (maths $…$ rendues
   par KaTeX), le crayon ouvre la case pour renommer. Une case de saisie ne peut
   pas afficher de formule : la montrer en permanence cachait le rendu. */
.gr-name { display: flex; align-items: center; gap: .3rem; }
.gr-name-view { overflow-wrap: anywhere; }
.gr-col-name .gr-rename { display: none; }
.gr-col-name.editing .gr-rename { display: flex; }
.gr-col-name.editing .gr-name { display: none; }
.gr-col-name .gr-rename input { border-color: var(--ss-paper-line); }

/* ============================================================ 10. Maths $…$ (assets/js/mathtext.js) */
.ss-math-display { display: block; text-align: center; margin: .6em 0; overflow-x: auto; overflow-y: hidden; }
/* rendu de secours sans KaTeX (hors connexion) : police mathématique du système */
.ss-math-fallback { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", Cambria, "Times New Roman", serif; white-space: nowrap; }
.ss-math-label { font-size: .86rem; color: var(--ss-ink); padding: 0 6px 2px; }    /* aperçu rendu d'un nom de graphique */
.editeur-math-hint { margin: 0 1rem .8rem; font-size: .76rem; }
/* aperçu sous un champ texte contenant $…$ (form-fields.js) : la case montre le code LaTeX,
   l'aperçu le rendu -- sans lui, le prof ne voit jamais ses formules avant la figure */
.f-math-preview { margin-top: .35rem; padding: .35rem .6rem; border-radius: var(--ss-radius-sm); background: var(--ss-chalk); font-size: .9rem; color: var(--ss-ink); overflow-x: auto; }
.editeur-math-hint code { font-size: .74rem; }

/* ============================================================ 11. Téléphone (≤ 820 px)
   Guide §5 : une colonne, rien ne dépasse l'écran, texte saisi en 16 px. */
@media (max-width: 820px) {
  :root { --f-fs: 16px; }                        /* iPhone ne zoome plus au toucher d'un champ */
  /* nowrap OBLIGATOIRE en colonne : dans un flex « wrap », chaque ligne prend la largeur
     de son contenu le plus large (le tableau à 7 colonnes), PAS celle de l'écran -> la
     page dépassait de 100 px sur téléphone (cause du rendu « moche », guide §4). */
  .editeur-workspace { flex-direction: column; flex-wrap: nowrap; }
  .editeur-pane { flex: 1 1 auto; }              /* empilés : la base 280 px deviendrait une HAUTEUR */
  .editeur-preview-wrap { padding: .8rem .6rem; }
  #form-container { max-height: none; overflow: visible; padding: .8rem; gap: .6rem .75rem; }   /* pas de défilement dans le défilement */
  /* cases numériques plus serrées : « Probabilité » et « k » tiennent sur une ligne */
  :root { --f-h: 38px; }
  .f-field input.f-w-xs, .f-row-fields input.f-w-xs { width: calc(4.5ch + .9rem); }
  .f-step { width: 36px; }
  .f-type-select select { min-width: 0; }
  .aide-modele-overlay, .share-overlay { padding: .6rem; }
  .aide-modele-box { padding: 1.6rem 1.1rem 1.2rem; max-height: 88vh; }
}
