/* inspecteur.css — L'INSPECTEUR (composants/inspecteur.js), la barre de
   droite, symétrique de la latérale : un ton sous le papier, un filet à
   gauche. Ce qu'on a choisi s'y ouvre ; la case reste à sa place, cernée de
   bleu. Rangé à droite sur écran large (320 px), PAR-DESSUS la vue sur
   tablette, une feuille qui monte du bas sur téléphone.
   UNE SEULE ÉCHELLE pour tout ce qui s'y pose — la fiche d'un bloc
   (fiche-depliee : .fl-*) comme les panneaux (.insp-*) : les variables --i-*
   ci-dessous, que le téléphone agrandit pour le doigt ; aucune règle n'écrit
   de taille à la main.
   Ici aussi, ce qui se resserre quand la vue perd de la place : la tête de
   page (@container barre). */

.inspecteur {
  display: none; flex: none; flex-direction: column; width: 320px;
  position: sticky; top: 0; height: 100dvh; z-index: 20; overflow: hidden;
  background: var(--laterale); border-left: 1px solid var(--trait);
  font-size: var(--i-corps);
}
/* l'échelle : la gouttière, les corps de texte, les hauteurs (sur :root, pour
   qu'une propriété ou une section posée hors de l'inspecteur la trouve aussi) */
:root {
  --i-g: 16px;          /* la gouttière à gauche */
  --i-titre: 19px;      /* le titre de la tête */
  --i-corps: 13.5px;    /* une valeur, une ligne de liste */
  --i-texte: 13px;      /* un texte courant dans une section (le programme, une pièce) */
  --i-petit: 12px;      /* le surtitre, le nom d'une propriété, la tête d'une section */
  --i-nom: 84px;        /* la colonne des noms */
  --i-ligne: 32px;      /* une propriété, la tête d'une section, une ligne de liste */
  --i-ctrl: 28px;       /* une valeur qu'on touche, un compteur */
  --i-puce: 26px;       /* une puce, un « + » en pointillés */
  --i-mini: 24px;       /* le petit rond au bout d'une ligne (×, livre, ⋯) */
  --i-rond: 30px;       /* la croix de la tête, le « + » d'une section */
  --i-bouton: 32px;     /* un geste du pied */
}
#app[data-inspecteur='range'] .inspecteur { display: flex; }
.inspecteur > * { flex: 1 1 auto; min-height: 0; }
/* la fiche d'un bloc du Journal arrive dans son enveloppe (journal-fiche) */
.inspecteur > .journal-fiche { display: flex; flex-direction: column; }
.inspecteur > .journal-fiche > .fiche-depliee { flex: 1 1 auto; min-height: 0; }
/* « Replier l'inspecteur » : en haut, sur son bord intérieur, comme « Replier
   la barre » de la latérale ; la tête de ce qu'il montre lui fait place */
.insp-replier { display: none; position: absolute; top: 10px; left: 8px; z-index: 3; width: var(--i-rond); height: var(--i-rond); }
.insp-replier:hover { background: var(--creux-2); }
.inspecteur[data-repliable] > .insp-replier { display: inline-flex; }
.inspecteur[data-repliable] :is(.fl-surtitre, .insp-haut) { padding-left: calc(var(--i-rond) + 2px); }
/* replié : une colonne fine qui ne garde que son rond, comme la latérale en icônes */
#app[data-inspecteur='rail'] .inspecteur { display: flex; width: 56px; }
#app[data-inspecteur='rail'] .insp-replier { left: 13px; }
/* la case choisie reste à sa place, cernée de bleu (Semaine : le bloc, l'atelier) */
.sem-bloc[aria-current='true'], .sem-atelier[aria-current='true'] { box-shadow: inset 0 0 0 2px var(--accent); z-index: 2; }

/* ————— l'anatomie, la même pour la fiche et les panneaux : une tête fixe,
   un corps qui défile, un pied fixe ————— */
.inspecteur .fiche-depliee { margin: 0; border: none; border-radius: 0; box-shadow: none; background: transparent; overflow: hidden; }
.insp { display: flex; flex-direction: column; min-height: 0; }

/* la tête : le surtitre et sa croix, le titre, une ligne de repères */
.inspecteur :is(.fl-tete, .insp-tete) { flex: none; display: flex; flex-direction: column; gap: 2px; padding: 10px 8px 8px var(--i-g); }
.inspecteur :is(.fl-surtitre, .insp-haut) { display: flex; align-items: center; gap: 4px; min-height: var(--i-rond); font-size: var(--i-petit); font-weight: 800; color: var(--encre-3); }
.insp-sorte { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inspecteur :is(.fl-surtitre, .insp-haut) .rond { width: var(--i-rond); height: var(--i-rond); color: var(--encre-3); }
.inspecteur :is(.fl-surtitre, .insp-haut) .rond:hover { background: var(--creux-2); color: var(--encre); }
.inspecteur :is(.fl-titre, .insp-titre) { margin: 0; padding-right: 8px; font-size: var(--i-titre); line-height: 1.25; overflow-wrap: anywhere; }
/* le titre qui se renomme sur place : un texte, le creux au survol, la feuille et le bleu en saisie */
.inspecteur :is(.fl-tete .titre-champ, .insp-titre-champ) {
  width: calc(100% + 6px - 8px); height: auto; min-height: 0; margin-left: -6px; padding: 1px 6px;
  border-color: transparent; background: transparent;
  font-family: var(--police-titre); font-size: var(--i-titre); font-weight: 700; line-height: 1.25; text-overflow: ellipsis;
}
.inspecteur :is(.fl-tete .titre-champ, .insp-titre-champ):hover { background: var(--creux-2); border-color: transparent; }
.inspecteur :is(.fl-tete .titre-champ, .insp-titre-champ):focus { background: var(--feuille); border-color: var(--accent); }
.insp-sous { font-size: var(--i-petit); font-weight: 600; color: var(--encre-3); }
.inspecteur .fl-ligne { gap: 4px 8px; padding-right: 8px; }
.inspecteur .fl-ligne:empty { display: none; }
.inspecteur .fl-ligne .compteur { margin-left: 0; }
.inspecteur .fl-ligne .puce { min-height: 22px; font-size: var(--i-petit); }
.inspecteur .fl-lie { display: inline-flex; align-items: center; gap: 4px; margin-left: 0; font-size: var(--i-petit); font-weight: 700; color: var(--encre-3); }
/* le geste bleu d'un objet ouvert (un modèle), sous son titre */
.insp-action { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.inspecteur .insp-action .bouton { height: var(--i-bouton); padding: 0 12px; font-size: var(--i-texte); }

/* le corps : ce qui défile ; ses blocs l'un sous l'autre, au même pas */
.inspecteur :is(.fl-corps, .insp-corps) {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 0 12px 16px var(--i-g); border-top: none; scrollbar-width: thin;
}

/* le pied : ses gestes à gauche, Supprimer seul à droite */
.inspecteur :is(.fl-pied, .insp > .insp-pied) { flex: none; display: flex; align-items: center; flex-wrap: nowrap; gap: 4px; padding: 8px 10px 8px var(--i-g); border-top: 1px solid var(--trait); }
.inspecteur :is(.fl-pied, .insp-pied) .bouton { height: var(--i-bouton); padding: 0 12px; font-size: var(--i-texte); }
.inspecteur :is(.fl-pied, .insp-pied) .rond { width: var(--i-bouton); height: var(--i-bouton); color: var(--encre-2); }
.inspecteur :is(.fl-pied, .insp-pied) .rond:hover { background: var(--creux-2); }
.inspecteur .fl-pied:has(> .rond.danger) > .pousse { display: none; }
.inspecteur :is(.fl-pied, .insp-pied) > .rond.danger { margin-left: auto; }
.insp-pied { font-size: var(--i-petit); font-weight: 600; color: var(--encre-3); line-height: 1.45; }
.insp-pied kbd { font: 700 11px var(--police); background: var(--creux-2); border-radius: 5px; padding: 1px 5px; color: var(--encre-2); }

/* ————— une PROPRIÉTÉ : son nom à gauche, sa valeur à droite, toutes sur la même hauteur ————— */
.insp-props { display: flex; flex-direction: column; margin: 0; }
.insp-prop { display: grid; grid-template-columns: var(--i-nom) minmax(0, 1fr); align-items: center; gap: 8px; min-height: var(--i-ligne); }
.insp-prop > dt { font-size: var(--i-petit); font-weight: 700; color: var(--encre-3); }
.insp-prop > dd { margin: 0; display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; min-width: 0; font-weight: 650; color: var(--encre); }
.insp-prop > dd > * { min-width: 0; }
.insp-prop-haute { align-items: start; }
.insp-prop-haute > dt { padding-top: calc((var(--i-ligne) - 1.3em) / 2); }
.insp-prop-haute > dd { flex-wrap: wrap; padding: 2px 0; }
/* des noms plus longs (les horaires) : la colonne des noms s'élargit */
.insp-props-larges > .insp-prop { grid-template-columns: calc(var(--i-nom) + 34px) minmax(0, 1fr); }

/* une VALEUR, quelle qu'elle soit (un menu, un horaire, un champ, une heure,
   une liste déroulante) : le même corps, la même graisse, la même hauteur ;
   sans cadre, le creux au survol ; grise quand elle est vide */
.insp-valeur, .inspecteur .fiche-horaire, .inspecteur .fiche-discipline, .insp-champ.champ,
.inspecteur .insp-prop input[type='time'].champ, .inspecteur .insp-prop select.champ {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  height: var(--i-ctrl); min-height: var(--i-ctrl); padding: 0 8px; margin-left: -8px;
  border: 1px solid transparent; border-radius: 999px; background-color: transparent;
  font-family: var(--police); font-size: var(--i-corps); font-weight: 650; line-height: 1.2; color: var(--encre); text-align: left;
}
.insp-valeur:hover, .inspecteur .fiche-horaire:hover, .inspecteur .fiche-discipline:hover, .insp-champ.champ:hover,
.inspecteur .insp-prop input[type='time'].champ:hover, .inspecteur .insp-prop select.champ:hover { background-color: var(--creux-2); color: var(--encre); border-color: transparent; }
.insp-valeur > span, .insp-valeur-texte { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-valeur > svg, .inspecteur .fiche-discipline > svg { flex: none; color: var(--encre-3); }
.insp-valeur.vide, .insp-valeur.gris { color: var(--encre-3); font-weight: 600; }
a.insp-valeur { text-decoration: none; }
.inspecteur .fiche-discipline .point-discipline { margin-right: 0; }
.inspecteur .fiche-discipline > span:not(.point-discipline) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-champ.champ { width: calc(100% + 8px); text-overflow: ellipsis; }
.insp-champ.champ::placeholder { color: var(--encre-4); font-weight: 500; }
:is(.insp-champ.champ, .inspecteur .insp-prop input[type='time'].champ):focus { background: var(--feuille); border-color: var(--accent); outline: none; }
.inspecteur .insp-prop input[type='time'].champ { width: auto; padding: 0 6px 0 8px; font-variant-numeric: tabular-nums; }
.inspecteur .insp-prop select.champ { width: auto; padding-right: 28px; field-sizing: content; }
.insp-lu { font-weight: 650; color: var(--encre); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-lu.vide { color: var(--encre-3); font-weight: 600; }
.insp-deduit { font-size: var(--i-petit); font-weight: 600; color: var(--encre-3); }
/* l'horaire d'un bloc : le début, la fin en gris ; la durée au bout, sur la craie */
.inspecteur .insp-creneau > dd { flex-wrap: nowrap; gap: 4px; }
.inspecteur .fiche-horaire { flex: none; gap: 0.3em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inspecteur .fiche-horaire-fin { color: var(--encre-3); font-weight: 600; }
.inspecteur .compteur { flex: none; height: var(--i-ctrl); padding: 0 1px; gap: 0; border: none; border-radius: 999px; background: var(--creux-2); }
.inspecteur .compteur button { width: calc(var(--i-ctrl) - 2px); height: calc(var(--i-ctrl) - 2px); color: var(--encre-3); }
.inspecteur .compteur button:hover { background: var(--feuille); color: var(--encre); }
.inspecteur .compteur button svg { width: 14px; height: 14px; }
.inspecteur .compteur output { min-width: 46px; font-size: var(--i-corps); font-weight: 650; color: var(--encre); }
/* une valeur et son geste (Appeler, Écrire) sur la même ligne */
.insp-prop > dd > .rond { flex: none; width: var(--i-ctrl); height: var(--i-ctrl); color: var(--encre-3); }
.insp-prop > dd > .rond:hover { background: var(--creux-2); color: var(--accent-texte); }
/* deux heures (ou une heure et une durée) côte à côte */
.insp-duo { display: flex; align-items: center; gap: 2px; min-width: 0; }
.insp-duo > span { flex: none; color: var(--encre-3); font-size: var(--i-petit); font-weight: 600; padding: 0 2px; }
.insp-duo > .champ { width: auto; flex: 0 1 auto; margin-left: 0; }
.insp-duo > .champ:first-child { margin-left: -8px; }
.insp-duo input[type='number'].champ { width: 52px; }
/* les heures d'une grille : sans l'icône d'horloge (un clic sur l'heure suffit), pour tenir sur une ligne */
.insp-duo input[type='time'].champ { padding: 0 4px; }
.insp-duo input[type='time']::-webkit-calendar-picker-indicator { display: none; }
.inspecteur .insp-prop .puces { display: flex; flex-wrap: wrap; gap: 4px; }
.inspecteur .insp-prop .puce, .inspecteur .puces > button.puce { min-height: var(--i-puce); padding: 0 10px; font-size: var(--i-texte); }
.inspecteur .segments { max-width: 100%; }
.inspecteur .segments button { height: calc(var(--i-ctrl) - 4px); font-size: var(--i-texte); }
/* une valeur faite de liens (les classes que tient une personne), l'un sous l'autre */
.insp-liens { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 4px 0; }
.insp-liens .lien-bouton { text-align: left; font-size: var(--i-corps); font-weight: 650; }

/* ————— une SECTION : sa tête (chevron, titre, compte, « + »), un filet au-dessus ————— */
.insp-section { display: flex; flex-direction: column; border-top: 1px solid var(--trait); padding-top: 2px; }
.insp-section-tete { display: flex; align-items: center; gap: 2px; min-height: var(--i-ligne); margin: 0 -6px; }
.insp-section-titre { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: var(--i-ctrl); padding: 0 6px; border: none; border-radius: 8px; background: none; text-align: left; font: 800 var(--i-petit) var(--police); color: var(--encre-3); }
.insp-section-titre:hover { background: var(--creux-2); color: var(--encre-2); }
.insp-section-titre > svg { flex: none; transition: transform 150ms; }
.insp-section[data-plie] .insp-section-titre > svg { transform: rotate(-90deg); }
.insp-compte { min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--creux-2); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; color: var(--encre-2); }
.insp-geste-rond.rond { width: var(--i-rond); height: var(--i-rond); color: var(--encre-3); }
.insp-geste-rond.rond:hover { background: var(--creux-2); color: var(--accent-texte); }
.insp-section-corps { display: flex; flex-direction: column; gap: 6px; padding: 0 0 6px; min-width: 0; }
.insp-section-corps:empty { display: none; }
.insp-section[data-plie] .insp-section-corps { display: none; }
.insp-section.survol { background: var(--accent-doux); border-radius: var(--rayon-s); }
/* une sous-tête dans une section (les horaires propres à un niveau) */
.insp-sous-tete { display: flex; align-items: center; gap: 4px; min-height: var(--i-ctrl); margin-top: 4px; font-size: var(--i-petit); font-weight: 800; color: var(--encre-3); }
.insp-sous-tete > .pousse { min-width: 0; }
/* une section de fiche à l'ancienne (sectionFiche) : son titre au-dessus, comme une tête de section */
.inspecteur .fiche-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 6px 0; border-top: 1px solid var(--trait); }
.inspecteur .fl-corps > .fiche-section:first-child { border-top: none; }
.inspecteur .fiche-section > .section-titre, .inspecteur .section-titre { padding-top: 0; font-family: var(--police); font-size: var(--i-petit); font-weight: 800; color: var(--encre-3); }
.inspecteur .fiche-contenu { gap: 6px; }
.inspecteur .fiche-contenu > :is(input[type='time'], .champ-date, select.champ) { min-width: 0; }

/* ————— une LIGNE de liste (une personne, une classe, un critère, un bloc choisi) ————— */
.insp-ligne { display: flex; align-items: center; gap: 8px; min-height: var(--i-ligne); width: calc(100% + 12px); margin: 0 -6px; padding: 0 6px; border: none; border-radius: var(--rayon-s); background: none; text-align: left; font: inherit; color: inherit; text-decoration: none; }
button.insp-ligne:hover, a.insp-ligne:hover, div.insp-ligne:has(> .insp-ligne-ouvrir:hover) { background: var(--creux-2); }
.insp-ligne .ligne-texte { flex: 1; min-width: 0; }
.insp-ligne > .rond { flex: none; width: var(--i-mini); height: var(--i-mini); color: var(--encre-3); }
.insp-ligne > svg { flex: none; color: var(--encre-3); }
.insp-ligne > .insp-champ.champ { flex: 1; width: auto; margin-left: 0; }
.insp-ligne-ouvrir { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: var(--i-ctrl); padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.insp-ligne-ouvrir[aria-expanded='true'] .tronque:first-child { color: var(--accent-texte); }
/* une personne dépliée : ses propriétés dans un creux, sous sa ligne */
.insp-deplie { display: flex; flex-direction: column; gap: 0; margin: 0 0 4px; padding: 2px 8px 6px 10px; border-radius: var(--rayon-s); background: var(--creux); }
.insp-deplie .insp-prop { grid-template-columns: calc(var(--i-nom) + 8px) minmax(0, 1fr); }
.insp-deplie-pied { display: flex; justify-content: flex-end; gap: 4px; padding-top: 4px; }
.insp-note.champ { min-height: 54px; }
/* le rang d'un critère, devant son nom */
.insp-rang { flex: none; width: 18px; text-align: right; font-size: var(--i-petit); font-weight: 800; color: var(--encre-3); font-variant-numeric: tabular-nums; }
/* une liste qu'on coche d'un clic (les absents du jour) */
.insp-case { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1.5px solid var(--trait-fort); border-radius: 5px; color: var(--feuille); }
.insp-coche[aria-checked='true'] .insp-case { background: var(--accent); border-color: var(--accent); }
.insp-coche[aria-checked='true'] .tronque { color: var(--encre-3); text-decoration: line-through; }

/* ————— des PUCES : le matériel, les modalités, « + » en pointillés ————— */
.insp-puces { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.insp-puce { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: var(--i-puce); padding: 0 2px 0 10px; border-radius: 999px; background: var(--feuille); box-shadow: 0 0 0 1px var(--trait); font-size: var(--i-texte); font-weight: 650; color: var(--encre-2); }
.insp-puce > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-puce > button { flex: none; width: calc(var(--i-puce) - 4px); height: calc(var(--i-puce) - 4px); border: none; border-radius: 999px; background: none; color: var(--encre-3); display: flex; align-items: center; justify-content: center; padding: 0; }
.insp-puce > button:hover { background: var(--creux-2); color: var(--encre); }
.insp-puce-plus { display: inline-flex; align-items: center; gap: 4px; height: var(--i-puce); min-width: var(--i-puce); padding: 0 10px 0 7px; border: 1px dashed var(--trait-fort); border-radius: 999px; background: none; font-size: var(--i-texte); font-weight: 600; color: var(--encre-3); }
.insp-puce-plus:only-child, .insp-puce-plus:not(:has(span)) { padding: 0; justify-content: center; }
.insp-puce-plus:hover { border-style: solid; border-color: var(--accent-bord); background: var(--accent-doux); color: var(--accent-texte); }
.inspecteur .fiche-contenu > .puces { flex-wrap: nowrap; gap: 6px; }
.inspecteur .puces { gap: 4px; }
.inspecteur :is(.puce-plus, .puce-suite) { flex: none; min-height: var(--i-puce); font-size: var(--i-texte); }
.inspecteur .puce-plus { padding: 0 10px 0 7px; }
.inspecteur .puce-suite { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.inspecteur .puce-suite > button { padding: 0 10px 0 8px; font-size: var(--i-texte); }
.inspecteur .puce-suite > .puce-suite-autres { padding: 0 8px; }

/* ————— le programme d'un bloc : des lignes serrées, le retrait d'un cran plus court ————— */
.inspecteur .ref-ligne { min-height: var(--i-mini); gap: 4px; padding-left: calc(var(--profondeur, 0) * 12px); font-size: var(--i-texte); line-height: 1.35; }
.inspecteur .ref-ligne > .pousse { padding: calc((var(--i-mini) - 1.35em) / 2) 0; }
.inspecteur .ref-ligne small { font-size: var(--i-petit); }
.inspecteur .ref-ligne > svg.ico { margin-top: calc((var(--i-mini) - 14px) / 2); width: 14px; height: 14px; }
.inspecteur .ref-ligne .rond { width: var(--i-mini); height: var(--i-mini); margin-top: 0; }
.inspecteur .ref-ligne .rond svg { width: 14px; height: 14px; }
.inspecteur .ref-entete { padding: 4px 0 0 calc(var(--profondeur, 0) * 12px); font-size: var(--i-petit); }

/* ————— la note : la barre d'outils sur une ligne, collée au champ (⌘Z annule, ses deux boutons partent) ————— */
.inspecteur .editeur-riche { gap: 0; border: 1px solid var(--trait-fort); border-radius: var(--rayon); background: var(--feuille); }
.inspecteur .editeur-riche:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.inspecteur .editeur-riche-barre { flex-wrap: nowrap; gap: 1px; padding: 3px 4px; border-bottom: 1px solid var(--trait); overflow-x: auto; scrollbar-width: none; }
.inspecteur .editeur-riche-btn { flex: none; width: var(--i-mini); height: var(--i-mini); border-color: transparent; background: transparent; }
.inspecteur .editeur-riche-btn:hover, .inspecteur .editeur-riche-btn.actif { background: var(--creux-2); border-color: transparent; }
.inspecteur .editeur-riche-btn-large { width: auto; padding: 0 3px; }
.inspecteur .editeur-riche-btn[title='Annuler'], .inspecteur .editeur-riche-btn[title='Rétablir'] { display: none; }
.inspecteur .editeur-riche-sep { margin: 4px 3px; }
.inspecteur .editeur-riche-zone { padding: 7px 10px; border: none; border-radius: 0 0 var(--rayon) var(--rayon); background: transparent; font-size: var(--i-corps); }
.inspecteur .editeur-riche-zone:focus { outline: none; }
.inspecteur :is(textarea.champ, .bilan .champ) { font-size: var(--i-corps); }

/* ————— les pièces jointes : une ligne serrée ; le dépôt, de petits gestes ————— */
.insp-section-corps:has(> .piece) { gap: 0; }
.inspecteur .piece { min-height: var(--i-ligne); gap: 0; margin: 0 -6px; padding: 0 0 0 6px; border: none; border-radius: 8px; background: none; }
.inspecteur .piece:hover { background: var(--creux-2); }
.inspecteur .piece-ouvrir { gap: 7px; }
.inspecteur .piece .tuile { width: 20px; height: 20px; border-radius: 6px; background: none; color: var(--encre-3); }
.inspecteur .piece .tuile svg { width: 15px; height: 15px; }
.inspecteur .piece .ligne-texte { margin: 0 4px 0 7px; }
.inspecteur .piece .champ-sur-place { font-size: var(--i-corps); }
.inspecteur .piece-detail { display: none; }
.inspecteur .piece .rond.petit, .inspecteur .piece-impr { width: var(--i-ctrl); min-width: var(--i-ctrl); height: var(--i-ctrl); color: var(--encre-3); }
.inspecteur .piece-impr[data-etat='imprimer'] { width: auto; color: var(--accent-texte); }
.inspecteur .piece-retirer:hover { background: var(--danger-doux); color: var(--danger); }
.inspecteur .depot { display: flex; flex-direction: column; gap: 6px; padding: 7px 8px; font-size: var(--i-petit); color: var(--encre-3); }
.inspecteur .depot-gestes { display: flex; flex-wrap: wrap; gap: 4px; }
.inspecteur .depot .bouton.petit { height: var(--i-puce); padding: 0 9px; gap: 5px; font-size: var(--i-texte); }
.inspecteur .depot .bouton.petit svg { width: 14px; height: 14px; }
.inspecteur .champ-materiel { height: var(--i-ctrl); min-height: var(--i-ctrl); }

/* ————— le carnet de la journée : ses têtes comme celles des sections, le bilan en petit ————— */
.inspecteur .carnet-section { gap: 4px; border-top: 1px solid var(--trait); padding-top: 6px; }
.inspecteur .carnet-section-tete { min-height: var(--i-mini); }
.inspecteur .carnet-bilan { grid-column: auto; }
.inspecteur .carnet-ligne { min-height: var(--i-ligne); font-size: var(--i-corps); font-weight: 600; }
.inspecteur .taches { gap: 4px; }
.inspecteur :is(.tache, .tache-plus) { min-height: var(--i-puce); height: auto; font-size: var(--i-texte); }
.inspecteur .bilans { grid-template-columns: minmax(0, 1fr); gap: 10px; border-top: none; padding-top: 0; margin-top: 0; }
.inspecteur .bilan { gap: 6px; }
/* les deux bilans en onglets : les onglets à gauche, les humeurs et le geste de l'onglet à droite */
.inspecteur .bilan-tete { justify-content: space-between; min-height: var(--i-ligne); gap: 6px; }
.inspecteur .bilan-tete .section-titre { font-size: var(--i-petit); }
.inspecteur .bilan-tete .bouton { height: var(--i-ctrl); padding: 0 9px; font-size: var(--i-texte); }
.inspecteur .bilan-tete > .rond.petit { width: var(--i-ctrl); height: var(--i-ctrl); color: var(--encre-3); }
.bilan-onglets { flex: 0 1 auto; flex-wrap: nowrap; min-width: 0; padding: 2px; }
.bilan-onglets button { height: calc(var(--i-ctrl) - 4px); min-width: 0; padding: 0 9px; overflow: hidden; text-overflow: ellipsis; font-size: var(--i-petit); font-weight: 700; color: var(--encre-3); }
.bilan-onglets button[aria-selected='true'] { background: var(--feuille); color: var(--encre); box-shadow: 0 0 0 1px var(--trait-fort); }
.inspecteur .humeurs { gap: 4px; }
.inspecteur .humeurs button { width: var(--i-ctrl); height: var(--i-ctrl); background: var(--creux-2); }
.inspecteur .humeurs button:not([aria-pressed='true']):hover { background: var(--creux-3); }
.inspecteur .humeurs button svg { width: 17px; height: 17px; }
.inspecteur .bilan :is(textarea, .champ) { min-height: 56px; }

/* ————— plusieurs cases choisies ————— */
.insp-choisis { background: var(--feuille); border: 1px solid var(--trait); border-radius: var(--rayon); }
.insp-choisi { display: flex; align-items: center; gap: 8px; min-height: var(--i-ligne); padding: 0 4px 0 12px; font-size: var(--i-corps); font-weight: 650; }
.insp-choisi + .insp-choisi { border-top: 1px solid var(--trait); }
.insp-choisi .rond { width: var(--i-mini); height: var(--i-mini); color: var(--encre-3); }
.insp-heure { flex: none; font: 700 var(--i-texte) var(--police-titre); color: var(--encre-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.insp-gestes { display: flex; flex-direction: column; gap: 0; margin-inline: -6px; }
.insp-geste { display: flex; align-items: center; gap: 10px; min-height: var(--i-ligne); padding: 0 8px; border: none; border-radius: 10px; background: none; text-align: left; font: 650 var(--i-corps) var(--police); color: var(--encre-2); }
.insp-geste:hover { background: var(--creux-2); color: var(--encre); }
.insp-geste > svg { color: var(--encre-3); }
.insp-geste.danger, .insp-geste.danger > svg { color: var(--danger); }
.insp-geste.danger:hover { background: var(--danger-doux); }

/* le mode « choisir plusieurs » : une coche ronde sur chaque case, un bandeau en tête de la vue */
.en-choix :is(.carte, .sem-atelier, .fr-etape)[data-choix] { position: relative; }
.en-choix :is(.carte, .groupe-tete)[data-choix] { padding-left: 46px; }
.en-choix [data-choix]::after {
  content: ''; position: absolute; left: 14px; top: 15px; width: 20px; height: 20px; border-radius: 999px;
  border: 1.5px solid var(--trait-fort); background: var(--feuille);
  display: flex; align-items: center; justify-content: center; font: 900 12px/1 var(--police); color: var(--sur-accent);
}
.en-choix :is(.sem-bloc, .sem-atelier)[data-choix] { padding-right: 24px; }
.en-choix .sem-bloc[data-choix]::after, .en-choix .sem-atelier[data-choix]::after { left: auto; right: 4px; top: 4px; width: 16px; height: 16px; font-size: 10px; }
.en-choix .sem-atelier[data-choix]::after { top: 3px; }
.en-choix [data-choix].choisi::after, .en-choix [data-choix][aria-current='true']::after { content: '✓'; background: var(--accent); border-color: var(--accent); }
.en-choix .carte-gestes { display: none; }
.bandeau-choix {
  position: sticky; top: calc(var(--tete-haut, 0px) + 8px); z-index: 6; display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--accent-doux); color: var(--accent-texte); font-weight: 700; font-size: 13.5px;
}
.bandeau-choix .pousse { color: var(--encre-2); font-weight: 600; }
.bandeau-choix .bouton { height: 30px; font-size: 13px; }

/* ————— tablette : par-dessus la vue, le temps d'une fiche ————— */
@media (max-width: 1099px) {
  .inspecteur {
    display: flex; position: fixed; right: 0; top: 0; bottom: 0; height: auto; width: min(360px, 92vw); z-index: 40;
    border-left-color: var(--trait-fort);
    transform: translateX(102%); visibility: hidden;
    transition: transform var(--glisse), visibility 0s linear 300ms;
  }
  #app[data-inspecteur='dessus'] .inspecteur { transform: none; visibility: visible; transition: transform var(--glisse); }
}

/* ————— téléphone : une FEUILLE qui monte du bas, le temps d'une fiche —————
   sur un voile ; sa poignée en haut, sa tête fixe, son corps qui défile, son
   pied toujours visible ; posée au-dessus du clavier (--clavier, geste-feuille.js).
   Presque toute la hauteur de l'écran, quel que soit ce qu'elle porte, sur
   un voile, la page arrêtée derrière. Tirée vers le bas (--tire), elle suit
   le doigt. La même anatomie qu'à droite, à l'échelle du doigt : des lignes
   de 40 px, les valeurs en 16 px (un champ plus petit ferait zoomer iOS). */
.insp-poignee, .insp-voile { display: none; }
@media (max-width: 599px) {
  .inspecteur {
    left: 0; right: 0; top: auto; bottom: var(--clavier, 0px); width: auto; z-index: 46;
    height: calc(100dvh - var(--clavier, 0px) - 24px - env(safe-area-inset-top));
    border: none; border-radius: 22px 22px 0 0; box-shadow: 0 -1px 0 var(--trait-fort), 0 -12px 40px rgb(0 0 0 / 0.14);
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%);
    transition: transform var(--glisse), height var(--glisse), visibility 0s linear 300ms;
    --i-titre: 20px; --i-corps: 16px; --i-texte: 15px; --i-petit: 13px; --i-nom: 92px;
    --i-ligne: 40px; --i-ctrl: 36px; --i-puce: 32px; --i-mini: 32px; --i-rond: 36px; --i-bouton: 40px;
  }
  #app[data-inspecteur='dessus'] .inspecteur { transform: translateY(var(--tire, 0px)); transition: transform var(--glisse), height var(--glisse); }
  .inspecteur.tiree { transition: none !important; }
  /* un voile, la page derrière ne défile plus */
  #app[data-inspecteur='dessus'] .insp-voile {
    display: block; position: fixed; inset: 0; z-index: 45; border: none; padding: 0; background: var(--voile);
  }
  html:has(#app[data-inspecteur='dessus']) { overflow: hidden; }
  /* la poignée, par-dessus le haut de la tête : elle ne prend pas de ligne à elle */
  .insp-poignee { display: block; position: absolute; top: 0; left: 0; right: 0; z-index: 2; height: 14px; touch-action: none; }
  .insp-poignee::before { content: ''; position: absolute; left: 50%; top: 6px; width: 36px; height: 5px; margin-left: -18px; border-radius: 999px; background: var(--trait-fort); }
  .inspecteur :is(.fl-tete, .insp-tete) { padding-top: 14px; touch-action: none; }
  .inspecteur :is(.fl-tete, .insp-tete) :is(input, textarea, [contenteditable]) { touch-action: auto; }
  .inspecteur :is(.fl-corps, .insp-corps) { padding-right: var(--i-g); overscroll-behavior: contain; }
  .inspecteur :is(.fl-surtitre, .insp-haut) .rond { display: inline-flex; }
  /* une valeur trop large (l'horaire et sa durée) passe sur deux lignes plutôt que de se chevaucher */
  .inspecteur .insp-prop > dd { flex-wrap: wrap; row-gap: 2px; }
  .inspecteur .insp-prop-haute > dt, .inspecteur .insp-prop > dt { font-size: 14px; }
  .inspecteur .insp-case { width: 22px; height: 22px; }
  .inspecteur .editeur-riche-btn { width: var(--i-mini); height: var(--i-mini); }
  .inspecteur .champ { font-size: 16px; }
  .inspecteur :is(.fl-pied, .insp > .insp-pied) { padding: 8px 12px 8px var(--i-g); }
}
@media (prefers-reduced-motion: reduce) { .inspecteur { transition: none !important; } }
@media print { .inspecteur { display: none !important; } }

/* ————— la tête de page, resserrée quand la vue perd de la place —————
   d'abord ce qui règle la journée s'efface (la puce et le rond « faite » :
   l'inspecteur et le « ⋯ » les portent), puis l'action se réduit à un rond
   bleu ; les contrôles gardent leurs 36 px ; le titre, lui, ne bouge pas. Les rubriques restent en pastilles tant qu'elles tiennent
   sur la ligne : elles ne passent en menu que quand elle déborde vraiment
   (barre-espace.js, resserrer) */
.vue > .barre-vue { container: barre / inline-size; }
@container barre (max-width: 1060px) {
  .be-ligne > .puce-reglage.se-replie, .be-ligne .jour-tete { display: none; }
}
@container barre (max-width: 940px) {
  .be-ligne { gap: 10px; }
  .be-ligne > .barre-droite { gap: 4px; }
}
@container barre (max-width: 900px) {
  .be-ligne .be-action-lib { display: none; }
  .barre-vue .be-ligne .barre-droite .bouton.principal.be-action-large { width: 36px; min-width: 0; height: 36px; padding: 0; margin-left: 4px; }
}
