/* ==========================================================================
   Gabarit de l'application et composants d'écran.
   Charge après design.css et n'utilise que ses jetons.
   ========================================================================== */

/* --- Entête ------------------------------------------------------------ */

.entete {
  position: relative; z-index: 30;
  display: flex; align-items: center; gap: var(--e-4);
  height: var(--h-entete); padding: 0 var(--e-4);
  background: var(--surface); border-bottom: 1px solid var(--trait);
}

.entete__marque { display: flex; align-items: center; gap: var(--e-3); min-width: 0; }

.entete__sceau {
  width: 30px; height: 30px; flex: none; border-radius: var(--r-rond);
  background:
    radial-gradient(circle at 34% 30%, var(--accent) 0 22%, transparent 23%),
    radial-gradient(circle at 66% 30%, var(--branche-2) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 68%, var(--branche-3) 0 22%, transparent 23%),
    var(--surface-3);
  border: 1px solid var(--trait-fort);
}

.entete__titre { font-size: var(--t-base); letter-spacing: .01em; white-space: nowrap; }
.entete__sous-titre {
  margin: 0; font-size: var(--t-xs); color: var(--encre-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.entete__actions { display: flex; gap: var(--e-1); margin-left: auto; }

.recherche-declencheur {
  display: flex; align-items: center; gap: var(--e-2);
  flex: 0 1 460px; min-width: 0; margin: 0 auto;
  height: 34px; padding: 0 var(--e-2) 0 var(--e-3);
  background: var(--surface-2); color: var(--encre-3);
  border: 1px solid var(--trait); border-radius: var(--r);
  cursor: pointer; font-size: var(--t-sm); text-align: left;
  transition: border-color var(--duree-1) var(--courbe), background var(--duree-1) var(--courbe);
}
.recherche-declencheur:hover { border-color: var(--trait-fort); background: var(--surface); }
.recherche-declencheur span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recherche-declencheur .icone { width: 15px; height: 15px; flex: none; }

.icone--sombre { display: none; }
:root[data-theme="dark"] .icone--clair { display: none; }
:root[data-theme="dark"] .icone--sombre { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icone--clair { display: none; }
  :root:not([data-theme="light"]) .icone--sombre { display: block; }
}

/* --- Châssis ------------------------------------------------------------ */

.chassis {
  display: flex; height: calc(100vh - var(--h-entete)); overflow: hidden;
}

.rail {
  display: flex; flex-direction: column; flex: none;
  width: var(--l-rail); padding: var(--e-2) 0;
  background: var(--surface); border-right: 1px solid var(--trait);
  overflow-y: auto; overflow-x: hidden;
}
.rail__liste { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--e-2); }

.rail__lien {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: var(--e-2) 2px; border-radius: var(--r);
  color: var(--encre-3); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; background: transparent; width: 100%;
  transition: background var(--duree-1) var(--courbe), color var(--duree-1) var(--courbe);
}
.rail__lien:hover { background: var(--surface-3); color: var(--encre); }
.rail__lien[aria-current="page"] {
  background: var(--accent-doux); color: var(--accent-encre);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}
.rail__lien .icone { width: 20px; height: 20px; }
.rail__etiquette { font-size: 10px; line-height: 1.15; text-align: center; letter-spacing: .01em; }

.rail__pied { margin-top: auto; padding: var(--e-3) var(--e-2) var(--e-1); }
.rail__mention {
  margin: 0; font-size: 9px; line-height: 1.3; text-align: center;
  color: var(--encre-muette); text-transform: uppercase; letter-spacing: .06em;
}

.contenu { flex: 1; min-width: 0; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.contenu > * { min-height: 0; }

/* Les vues qui défilent le déclarent ; l'arbre et la carte occupent tout. */
.vue-defilante { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.vue-pleine { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.page { max-width: 1180px; margin: 0 auto; padding: var(--e-6) var(--e-5) var(--e-8); }
.page--large { max-width: 1480px; }
.page--lecture { max-width: 720px; }

.page__entete { margin-bottom: var(--e-5); }
.page__titre { font-size: var(--t-xl); letter-spacing: -.01em; }
.page__chapeau {
  margin-top: var(--e-2); max-width: 68ch;
  color: var(--encre-2); font-size: var(--t-md); line-height: var(--interligne);
}

.section { margin-top: var(--e-7); }
.section__titre {
  display: flex; align-items: baseline; gap: var(--e-3);
  margin-bottom: var(--e-2); font-size: var(--t-lg); letter-spacing: -.005em;
}
.section__note { margin-bottom: var(--e-4); color: var(--encre-3); font-size: var(--t-sm); max-width: 76ch; }

/* --- Tiroir de fiche ---------------------------------------------------- */

.tiroir {
  flex: none; width: var(--l-tiroir); max-width: 92vw;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--trait);
  box-shadow: var(--ombre-3);
  animation: tiroir-entre var(--duree-2) var(--courbe);
}
@keyframes tiroir-entre { from { transform: translateX(24px); opacity: 0; } }

.tiroir[hidden] { display: none; }

.tiroir__barre {
  display: flex; align-items: center; gap: var(--e-2);
  padding: var(--e-2) var(--e-2) var(--e-2) var(--e-4);
  border-bottom: 1px solid var(--trait); flex: none;
}
.tiroir__fil {
  flex: 1; min-width: 0; font-size: var(--t-xs); color: var(--encre-3);
  text-transform: uppercase; letter-spacing: .07em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tiroir__outils { display: flex; gap: 2px; }
.tiroir__corps { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

/* --- Fiche personne ----------------------------------------------------- */

.fiche__chef {
  padding: var(--e-5) var(--e-4) var(--e-4);
  border-bottom: 1px solid var(--trait);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.fiche__nom { font-size: var(--t-lg); line-height: 1.2; }
.fiche__prenoms { display: block; font-size: var(--t-sm); font-weight: var(--graisse-normale); color: var(--encre-2); }
.fiche__vie { margin-top: var(--e-2); color: var(--encre-2); font-size: var(--t-sm); }
.fiche__puces { display: flex; flex-wrap: wrap; gap: var(--e-2); margin-top: var(--e-3); }

.fiche__bloc { padding: var(--e-4); border-bottom: 1px solid var(--trait); }
.fiche__bloc:last-child { border-bottom: 0; }
.fiche__bloc-titre {
  display: flex; align-items: center; justify-content: space-between; gap: var(--e-2);
  margin-bottom: var(--e-3); font-size: var(--t-xs); font-weight: var(--graisse-forte);
  text-transform: uppercase; letter-spacing: .08em; color: var(--encre-3);
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; border-radius: var(--r-rond);
  font-size: var(--t-xs); font-weight: var(--graisse-forte); letter-spacing: .02em;
  color: var(--encre-avatar, var(--surface)); background: var(--fond, var(--encre-muette));
  border: 2px solid var(--surface);
}
.avatar--grand { width: 46px; height: 46px; font-size: var(--t-base); }
.avatar--petit { width: 24px; height: 24px; font-size: 9px; border-width: 1.5px; }

/* --- Vignette de personne (élément de liste réutilisé partout) ---------- */

.pers {
  display: flex; align-items: center; gap: var(--e-3); width: 100%;
  padding: var(--e-2) var(--e-3); border-radius: var(--r);
  background: transparent; border: 1px solid transparent;
  text-align: left; cursor: pointer; color: inherit;
  transition: background var(--duree-1) var(--courbe);
}
.pers:hover { background: var(--surface-3); }
.pers.actif { background: var(--accent-doux); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.pers__texte { min-width: 0; flex: 1 1 auto; }
/* Bloc et non en ligne : la troncature à l'ellipse n'agit pas sur une boîte
   en ligne, et deux spans en ligne se chevauchent dès que la place manque. */
.pers__nom {
  display: block; font-size: var(--t-sm); font-weight: var(--graisse-moyenne);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pers__detail {
  display: block; font-size: var(--t-xs); color: var(--encre-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pers__suffixe { flex: none; font-size: var(--t-xs); color: var(--encre-muette); }

.pers-liste { display: flex; flex-direction: column; gap: 1px; }

/* --- Tuiles de chiffres ------------------------------------------------- */

.tuiles { display: grid; gap: var(--e-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.tuile {
  padding: var(--e-4); background: var(--surface);
  border: 1px solid var(--trait); border-radius: var(--r-lg);
}
.tuile__valeur {
  font-size: var(--t-2xl); font-weight: var(--graisse-forte);
  line-height: 1; letter-spacing: -.02em;
  /* chiffres proportionnels : un grand nombre isolé ne s'aligne sur rien */
}
.tuile__libelle { margin-top: var(--e-2); font-size: var(--t-sm); color: var(--encre-2); }
.tuile__note { margin-top: var(--e-1); font-size: var(--t-xs); color: var(--encre-muette); }
.tuile--cliquable {
  cursor: pointer; width: 100%; text-align: left; font: inherit; color: inherit;
  transition: border-color var(--duree-1) var(--courbe);
}
.tuile--cliquable:hover { border-color: var(--encre-muette); }

/* --- Graphiques --------------------------------------------------------- */

.graphique {
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: var(--r-lg); padding: var(--e-4);
  display: flex; flex-direction: column; min-width: 0;
}
.graphique__entete { margin-bottom: var(--e-3); }
.graphique__titre { font-size: var(--t-base); font-weight: var(--graisse-forte); }
.graphique__question { margin-top: 2px; font-size: var(--t-sm); color: var(--encre-3); }
.graphique__corps { position: relative; min-width: 0; }
.graphique__pied {
  margin-top: var(--e-3); padding-top: var(--e-3);
  border-top: 1px solid var(--trait);
  font-size: var(--t-xs); color: var(--encre-muette); line-height: 1.45;
}
.graphique svg { display: block; width: 100%; height: auto; overflow: visible; }

.graphique .grille line { stroke: var(--grille); stroke-width: 1; shape-rendering: crispEdges; }
.graphique .axe path, .graphique .axe line { stroke: var(--ligne-base); shape-rendering: crispEdges; }
.graphique .axe text { fill: var(--encre-muette); font-size: 11px; font-variant-numeric: tabular-nums; }
.graphique .titre-axe { fill: var(--encre-3); font-size: 11px; }
.graphique .etiquette-directe { fill: var(--encre-2); font-size: 11px; font-weight: var(--graisse-moyenne); }

.legende { display: flex; flex-wrap: wrap; gap: var(--e-2) var(--e-4); margin-top: var(--e-3); }
.legende__item { display: inline-flex; align-items: center; gap: var(--e-2); font-size: var(--t-xs); color: var(--encre-2); cursor: default; }
.legende__marque { width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--fond); }
.legende__item[data-inactif="1"] { opacity: .35; }
.legende--cliquable .legende__item { cursor: pointer; }

.bascule-table {
  align-self: flex-start; margin-top: var(--e-2);
  font-size: var(--t-xs); color: var(--encre-3);
  background: none; border: 0; cursor: pointer; padding: var(--e-1) 0;
  text-decoration: underline; text-underline-offset: .2em;
}
.bascule-table:hover { color: var(--encre); }

.table-donnees { width: 100%; border-collapse: collapse; font-size: var(--t-sm); margin-top: var(--e-2); }
.table-donnees th, .table-donnees td {
  padding: var(--e-2) var(--e-3); text-align: left;
  border-bottom: 1px solid var(--trait);
}
.table-donnees th { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--encre-3); font-weight: var(--graisse-moyenne); }
.table-donnees td.nombre, .table-donnees th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
.table-donnees tbody tr:hover { background: var(--surface-2); }
.table-conteneur { max-height: 340px; overflow: auto; }

/* --- Scène (arbre, carte) ----------------------------------------------- */

.scene { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--plan); }
.scene svg { display: block; width: 100%; height: 100%; }
.scene canvas { display: block; width: 100%; height: 100%; }

.scene__flottant {
  position: absolute; z-index: 5; pointer-events: auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--trait); border-radius: var(--r-lg);
  box-shadow: var(--ombre-2);
}
.scene__flottant--bg { left: var(--e-3); bottom: var(--e-3); padding: var(--e-3); max-width: 300px; }
.scene__flottant--bd { right: var(--e-3); bottom: var(--e-3); padding: var(--e-2); }
.scene__flottant--hd { right: var(--e-3); top: var(--e-3); padding: var(--e-3); max-width: 280px; }

.scene__vide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--encre-3); font-size: var(--t-sm); text-align: center; padding: var(--e-6);
}

/* Un panneau vide reste un rectangle opaque posé sur le dessin : tant qu'il
   n'a rien à dire, il ne prend pas de place. */
.scene__flottant:empty,
.scene__vide:empty,
.legende:empty { display: none; }

/* --- Infobulle ---------------------------------------------------------- */

.infobulle {
  position: fixed; z-index: 200; pointer-events: none;
  max-width: 320px; padding: var(--e-2) var(--e-3);
  background: var(--surface); color: var(--encre);
  border: 1px solid var(--trait-fort); border-radius: var(--r);
  box-shadow: var(--ombre-3); font-size: var(--t-sm); line-height: 1.4;
}
.infobulle[hidden] { display: none; }
.infobulle__titre { font-weight: var(--graisse-forte); }
.infobulle__ligne { display: flex; justify-content: space-between; gap: var(--e-4); color: var(--encre-2); font-size: var(--t-xs); }
.infobulle__valeur { font-variant-numeric: tabular-nums; }

/* --- Palette de recherche ----------------------------------------------- */

.palette { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-start; justify-content: center; }
.palette[hidden] { display: none; }
.palette__voile { position: absolute; inset: 0; background: var(--voile); }
.palette__boite {
  position: relative; margin-top: 10vh; width: min(620px, 92vw);
  max-height: 70vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--trait-fort);
  border-radius: var(--r-xl); box-shadow: var(--ombre-4); overflow: hidden;
  animation: palette-entre var(--duree-2) var(--courbe);
}
@keyframes palette-entre { from { transform: translateY(-8px) scale(.99); opacity: 0; } }

.palette__saisie { display: flex; align-items: center; gap: var(--e-3); padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--trait); }
.palette__saisie input {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font-size: var(--t-md); outline: none;
}
.palette__saisie input::-webkit-search-cancel-button { display: none; }
.palette__resultats { flex: 1; overflow-y: auto; padding: var(--e-2); }

.palette__item {
  display: flex; align-items: center; gap: var(--e-3); width: 100%;
  padding: var(--e-2) var(--e-3); border-radius: var(--r);
  background: none; border: 0; cursor: pointer; text-align: left; color: inherit;
}
.palette__item[aria-selected="true"] { background: var(--accent-doux); }
.palette__item-texte { min-width: 0; flex: 1 1 auto; }
.palette__item-titre { display: block; font-size: var(--t-sm); font-weight: var(--graisse-moyenne); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette__item-detail { display: block; font-size: var(--t-xs); color: var(--encre-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette__genre {
  flex: none; font-size: 9px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--encre-muette); border: 1px solid var(--trait); border-radius: var(--r-sm);
  padding: 1px 5px;
}
.palette__pied {
  display: flex; gap: var(--e-4); align-items: center;
  padding: var(--e-2) var(--e-4); border-top: 1px solid var(--trait);
  font-size: var(--t-xs); color: var(--encre-muette);
}
.palette__pied span:last-child { margin-left: auto; }

/* --- Visionneuse de documents ------------------------------------------- */

.visionneuse {
  position: fixed; inset: 0; z-index: 400;
  display: flex; flex-direction: column; background: var(--surface-inverse);
}
.visionneuse[hidden] { display: none; }
.visionneuse__barre {
  display: flex; align-items: center; gap: var(--e-3); flex: none;
  padding: var(--e-2) var(--e-3);
  background: color-mix(in srgb, var(--surface-inverse) 88%, var(--encre-inverse));
  border-bottom: 1px solid rgba(128, 128, 128, .28);
  color: var(--encre-inverse);
}
.visionneuse__titre { flex: 1; min-width: 0; font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visionneuse__outils { display: flex; align-items: center; gap: var(--e-1); flex: none; }
.visionneuse__outils .bouton-fantome, .visionneuse__outils .bouton-icone { color: var(--encre-inverse); }
.visionneuse__outils .bouton-fantome:hover, .visionneuse__outils .bouton-icone:hover { background: rgba(128, 128, 128, .22); color: var(--encre-inverse); }
.visionneuse__niveau { min-width: 4.5em; text-align: center; font-size: var(--t-xs); font-variant-numeric: tabular-nums; opacity: .8; }
.visionneuse__scene { flex: 1; overflow: hidden; position: relative; cursor: grab; touch-action: none; }

/* Mode texte : rien à zoomer, rien à faire glisser. La scène rend la molette,
   le toucher et le curseur à leur usage normal, et les commandes d'image
   disparaissent au lieu de rester présentes sans effet. */
.visionneuse--texte .visionneuse__scene { cursor: auto; touch-action: auto; }
.visionneuse--texte [data-zoom],
.visionneuse--texte #visionneuse-zoom,
.visionneuse--texte #visionneuse-rotation { display: none; }
.visionneuse__scene.saisi { cursor: grabbing; }
.visionneuse__scene img {
  position: absolute; top: 0; left: 0; transform-origin: 0 0;
  max-width: none; user-select: none; -webkit-user-drag: none;
}
.visionneuse__pied {
  flex: none; padding: var(--e-3) var(--e-4);
  background: color-mix(in srgb, var(--surface-inverse) 88%, var(--encre-inverse));
  border-top: 1px solid rgba(128, 128, 128, .28);
  color: var(--encre-inverse); font-size: var(--t-xs); line-height: 1.5;
  max-height: 28vh; overflow-y: auto;
}
/* Le pied de la visionneuse est toujours sur --surface-inverse : son encre
   secondaire doit donc s'inverser avec le thème, pas rester grise en dur. */
.visionneuse__pied .discret { color: color-mix(in srgb, var(--encre-inverse) 68%, var(--surface-inverse)); }

/* --- Modale ------------------------------------------------------------- */

.modale { position: fixed; inset: 0; z-index: 320; display: flex; align-items: center; justify-content: center; }
.modale[hidden] { display: none; }
.modale__voile { position: absolute; inset: 0; background: var(--voile); }
.modale__boite {
  position: relative; width: min(640px, 92vw); max-height: 80vh;
  display: flex; flex-direction: column; gap: var(--e-4);
  padding: var(--e-5); background: var(--surface);
  border: 1px solid var(--trait-fort); border-radius: var(--r-xl); box-shadow: var(--ombre-4);
}
.modale__corps { overflow-y: auto; }
.modale__boite .bouton { align-self: flex-end; }

/* --- Galerie de documents ----------------------------------------------- */

.galerie { display: grid; gap: var(--e-4); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.doc {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: var(--r-lg); cursor: pointer; text-align: left;
  color: inherit; padding: 0;
  transition: border-color var(--duree-1) var(--courbe), transform var(--duree-1) var(--courbe);
}
.doc:hover { border-color: var(--encre-muette); transform: translateY(-2px); }
.doc__image {
  aspect-ratio: 4 / 3; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.doc__image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc__substitut { color: var(--encre-muette); font-size: var(--t-xs); text-align: center; padding: var(--e-3); }
.doc__corps { padding: var(--e-3); display: flex; flex-direction: column; gap: var(--e-1); }
.doc__genre { font-size: var(--t-xs); color: var(--encre-3); text-transform: uppercase; letter-spacing: .06em; }
.doc__titre { font-size: var(--t-sm); font-weight: var(--graisse-moyenne); line-height: 1.35; }
.doc__meta { font-size: var(--t-xs); color: var(--encre-muette); }

/* --- Récits -------------------------------------------------------------- */

.recit-carte {
  display: flex; flex-direction: column; gap: var(--e-2);
  padding: var(--e-5); background: var(--surface);
  border: 1px solid var(--trait); border-left: 3px solid var(--teinte, var(--accent));
  border-radius: var(--r-lg); cursor: pointer; text-align: left; color: inherit;
  transition: border-color var(--duree-1) var(--courbe), box-shadow var(--duree-1) var(--courbe);
}
.recit-carte:hover { box-shadow: var(--ombre-2); }
.recit-carte__periode { font-size: var(--t-xs); color: var(--encre-muette); letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.recit-carte__titre { font-size: var(--t-md); font-weight: var(--graisse-forte); line-height: 1.25; }
.recit-carte__accroche { font-size: var(--t-sm); color: var(--encre-2); line-height: 1.5; }
.recit-carte__themes { display: flex; flex-wrap: wrap; gap: var(--e-1); margin-top: var(--e-1); }

.recit-corps {
  font-family: var(--police-lecture); font-size: var(--t-md);
  line-height: var(--interligne-lecture); color: var(--encre);
}
.recit-corps p { margin-bottom: var(--e-4); }
.recit-corps p:first-of-type::first-letter {
  float: left; font-size: 3.1em; line-height: .84; padding: .04em .09em 0 0;
  color: var(--accent-encre); font-weight: var(--graisse-forte);
}

.encadre {
  padding: var(--e-4); border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--trait);
  border-left: 3px solid var(--teinte, var(--encre-muette));
  font-size: var(--t-sm); line-height: 1.55;
}
.encadre--etabli { --teinte: var(--bon); }
.encadre--ouvert { --teinte: var(--attention); }
.encadre__titre {
  font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .07em;
  color: var(--encre-3); margin-bottom: var(--e-2); font-weight: var(--graisse-forte);
}
.encadre ul { display: flex; flex-direction: column; gap: var(--e-2); }
.encadre li { padding-left: var(--e-4); position: relative; }
.encadre li::before {
  content: ""; position: absolute; left: 0; top: .55em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--teinte, var(--encre-muette));
}

/* --- Frise --------------------------------------------------------------- */

.frise { position: relative; padding-left: var(--e-6); }
.frise::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--trait); border-radius: 1px;
}
.frise__item { position: relative; padding-bottom: var(--e-4); }
.frise__item:last-child { padding-bottom: 0; }
.frise__point {
  position: absolute; left: calc(-1 * var(--e-6) + 2px); top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--teinte, var(--encre-muette));
}
.frise__date { font-size: var(--t-xs); color: var(--encre-3); font-variant-numeric: tabular-nums; }
.frise__titre { font-size: var(--t-sm); font-weight: var(--graisse-moyenne); }
.frise__detail { font-size: var(--t-xs); color: var(--encre-3); margin-top: 2px; }

/* --- Preuve -------------------------------------------------------------- */

.preuve {
  padding: var(--e-3); border-radius: var(--r);
  border: 1px solid var(--trait); background: var(--surface-2);
  border-left: 3px solid var(--pastille, var(--encre-muette));
}
.preuve + .preuve { margin-top: var(--e-2); }
.preuve__fait { font-size: var(--t-sm); font-weight: var(--graisse-moyenne); }
.preuve__extrait {
  margin-top: var(--e-2); padding-left: var(--e-3);
  border-left: 2px solid var(--trait); font-size: var(--t-sm);
  color: var(--encre-2); font-style: italic;
}
.preuve__meta { margin-top: var(--e-2); display: flex; flex-wrap: wrap; gap: var(--e-2); align-items: center; }
.preuve__raison { margin-top: var(--e-2); font-size: var(--t-xs); color: var(--encre-3); line-height: 1.5; }

.ref-source {
  font-size: var(--t-xs); color: var(--encre-3); line-height: 1.5;
  padding: var(--e-2) var(--e-3); background: var(--surface-3);
  border-radius: var(--r-sm); font-family: var(--police);
}
.ref-source strong { color: var(--encre-2); font-weight: var(--graisse-moyenne); }

/* --- Barre de progression ------------------------------------------------ */

.jauge { height: 6px; background: var(--surface-3); border-radius: var(--r-rond); overflow: hidden; }
.jauge__remplissage { height: 100%; border-radius: var(--r-rond); background: var(--teinte, var(--accent)); }

/* --- États vides et erreurs ---------------------------------------------- */

.vide {
  padding: var(--e-7) var(--e-4); text-align: center;
  color: var(--encre-3); font-size: var(--t-sm);
}
.panneau-erreur {
  margin: var(--e-6); padding: var(--e-5);
  border: 1px solid var(--critique); border-left-width: 3px;
  border-radius: var(--r-lg); background: var(--surface);
}
.panneau-erreur h2 { color: var(--critique); margin-bottom: var(--e-2); }

/* --- Adaptations étroites ------------------------------------------------ */

@media (max-width: 1100px) {
  :root { --l-tiroir: 380px; }
}
@media (max-width: 860px) {
  .entete { gap: var(--e-2); padding: 0 var(--e-2); }
  .entete__sous-titre, .recherche-declencheur span, .recherche-declencheur kbd { display: none; }
  .recherche-declencheur { flex: 0 0 auto; width: 34px; justify-content: center; padding: 0; }
  .chassis { flex-direction: column; }
  .rail {
    width: 100%; flex-direction: row; padding: 0;
    border-right: 0; border-bottom: 1px solid var(--trait);
    overflow-x: auto; overflow-y: hidden;
  }
  .rail__liste { flex-direction: row; padding: var(--e-1) var(--e-2); }
  .rail__lien { min-width: 68px; }
  .rail__pied { display: none; }
  .tiroir {
    position: fixed; inset: auto 0 0 0; width: 100%; max-width: none;
    height: 72vh; border-left: 0; border-top: 1px solid var(--trait-fort);
    border-radius: var(--r-xl) var(--r-xl) 0 0; z-index: 100;
  }
  .page { padding: var(--e-4) var(--e-3) var(--e-7); }
}
