/* ── LA BARRE DE COCKPIT (Barre.jsx) ─────────────────────────────────────
   Toute la navigation est à gauche, à la manière de l'app Claude : les
   modules, et sous chacun ses pages. La barre tient la hauteur de la fenêtre
   et reste en place quand la page défile ; repliée, elle ne garde que ses
   icônes, et les pages d'un module se lisent au survol.

   CETTE FEUILLE EST LA MÊME DANS LES TROIS APPLICATIONS de Cockpit ET SUR LES
   PAGES DE SON ACCUEIL (erp/site, où `barre.js` construit la barre sans
   React), qui n'ont pas toutes la même palette. Elle prend donc ses couleurs de l'application qui
   l'accueille — celles de Compta médecins et de Fournisseurs (`--surface`,
   `--trait`…), sinon celles de Claude Bernard (`--card`, `--line`…) — et ne
   compte sur AUCUN style de l'application pour ses boutons et ses liens :
   tout ce qu'un `button { … }` global pourrait leur donner est remis ici. */
.cadre { display: flex; align-items: flex-start; min-height: 100vh; }
.cadre > :not(.barre-cockpit) { flex: 1 1 auto; min-width: 0; }

.barre-cockpit {
  --b-fond: var(--surface, var(--card, #f7f8fa));
  --b-volant: var(--fond, var(--card, #ffffff));
  --b-trait: var(--trait, var(--line, #e4e4e7));
  --b-survol: var(--trait-fin, rgba(0, 0, 0, .055));
  --b-texte: var(--texte, var(--ink, #18181b));
  --b-discret: var(--discret, var(--ink-soft, #6b7280));
  --b-accent: var(--accent, #35477f);
  --b-accent-pale: var(--accent-pale, var(--accent-soft, #e8ecf6));
  /* Le rouge du logo : le repère de la page courante, et rien d'autre. */
  --b-marque: var(--marque, #dc5056);

  position: sticky; top: 0; flex: none; width: 15rem; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: .35rem; padding: .7rem .5rem;
  box-sizing: border-box; z-index: 30;
  background: var(--b-fond); border-right: 1px solid var(--b-trait);
  color: var(--b-texte); font-size: .9rem; line-height: 1.35; text-align: left;
}
.barre-cockpit.repliee { width: 3.3rem; }
.barre-cockpit *, .barre-cockpit *::before { box-sizing: border-box; }

.barre-tete { display: flex; align-items: center; justify-content: space-between; padding: 0 .15rem .2rem .55rem; min-height: 2rem; }
.barre-cockpit.repliee .barre-tete { justify-content: center; padding: 0 0 .2rem; }
.barre-cockpit .barre-marque { font-weight: 700; font-size: 1.02rem; color: var(--b-texte); text-decoration: none; }
/* LE LOGO DE COCKPIT, à la place du mot (Xavier, 28/11/2026). Deux calques :
   le bleu — le « C » et le mot — est un MASQUE, peint d'une couleur tirée de
   celle du texte de l'application : le bleu du logo sur fond clair, un bleu
   clair sur fond sombre, sans que la barre ait à savoir quel thème est en
   place. La croix rouge, elle, est une image. */
.barre-logo { position: relative; display: block; height: 1.8rem; aspect-ratio: 488 / 120; }
.barre-logo > i { position: absolute; inset: 0; }
.barre-logo-bleu {
  background: color-mix(in srgb, var(--b-texte, #18181b) 45%, #4d6dd1);
  -webkit-mask: url('./cockpit-bleu.png') center / contain no-repeat;
  mask: url('./cockpit-bleu.png') center / contain no-repeat;
}
.barre-logo-rouge { background: url('./cockpit-rouge.png') center / contain no-repeat; }
.barre-cockpit a.barre-marque:hover .barre-logo { opacity: .8; }
.barre-cockpit a.barre-marque:hover { color: var(--b-accent); }
.barre-cockpit .barre-bouton {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; min-height: 0;
  margin: 0; padding: 0; border: none; border-radius: 6px; background: none; box-shadow: none;
  color: var(--b-discret); cursor: pointer;
}
.barre-cockpit .barre-bouton:hover { background: var(--b-survol); color: var(--b-texte); box-shadow: none; }

.barre-liste { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
/* AUCUNE LIGNE NE SE TASSE quand la liste déborde et défile (Xavier,
   28/11/2026 : « Accueil doit être dimensionné comme les autres sections »).
   « Accueil » est posé directement dans la liste, et une ligne n'a pas de
   hauteur minimale : avec plusieurs groupes ouverts, c'est elle qui cédait la
   place — écrasée à mi-hauteur —, les groupes gardant la leur. */
.barre-liste > * { flex: none; }
.barre-cockpit.repliee .barre-liste { overflow: visible; }
.barre-pied { display: flex; flex-direction: column; gap: 1px; border-top: 1px solid var(--b-trait); padding-top: .45rem; }
.barre-groupe { position: relative; display: flex; flex-direction: column; gap: 1px; }

.barre-cockpit .barre-ligne {
  display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 0; margin: 0;
  padding: .42rem .55rem; border: none; border-radius: 6px; background: none; box-shadow: none;
  color: var(--b-discret); font: inherit; font-weight: 400; letter-spacing: normal; text-transform: none;
  text-align: left; text-decoration: none; cursor: pointer;
}
.barre-cockpit .barre-ligne:hover { background: var(--b-survol); color: var(--b-texte); box-shadow: none; }
.barre-cockpit .barre-ligne.courant { color: var(--b-texte); font-weight: 600; }
/* Une ligne qui EST la page regardée — « Accueil », « Administration », le
   compte : sur les pages de l'accueil de Cockpit, où l'on n'est dans aucun module. */
.barre-cockpit .barre-ligne.actif { background: var(--b-accent-pale); color: var(--b-accent); font-weight: 600; }
.barre-icone { flex: none; display: block; }
.barre-nom { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* L'en-tête d'un groupe : le nom du module, qui mène à sa première page, et
   à sa droite le chevron, qui déplie ou replie le groupe sans changer de page. */
.barre-entete { display: flex; align-items: center; gap: 2px; }
.barre-cockpit .barre-entete > .barre-ligne { flex: 1 1 auto; width: auto; min-width: 0; }
.barre-cockpit .barre-deplier { flex: none; width: 1.75rem; height: 1.9rem; }
.barre-chevron { flex: none; display: inline-flex; color: var(--b-discret); transition: transform .12s; }
.barre-chevron.ouvert { transform: rotate(90deg); }

.barre-pages { display: flex; flex-direction: column; gap: 1px; padding: 0 0 .25rem 2.05rem; }
.barre-cockpit .barre-page {
  display: block; padding: .32rem .55rem; border-radius: 6px;
  color: var(--b-discret); font-weight: 400; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barre-cockpit .barre-page:hover { background: var(--b-survol); color: var(--b-texte); }
.barre-cockpit .barre-page.actif {
  background: var(--b-accent-pale); color: var(--b-accent); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--b-marque);
}
.barre-cockpit .barre-ligne:focus-visible, .barre-cockpit .barre-page:focus-visible,
.barre-cockpit .barre-bouton:focus-visible, .barre-cockpit .barre-marque:focus-visible {
  outline: 2px solid var(--b-accent); outline-offset: 1px;
}
.barre-initiales {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--b-accent-pale); color: var(--b-accent); font-size: .68rem; font-weight: 700;
}

/* Repliée : les icônes seules, centrées ; le nom se lit au survol. */
.barre-cockpit.repliee .barre-nom, .barre-cockpit.repliee .barre-chevron { display: none; }
.barre-cockpit.repliee .barre-ligne { justify-content: center; padding: .5rem 0; }
.barre-cockpit.repliee .barre-ligne.courant { background: var(--b-accent-pale); color: var(--b-accent); }
.barre-volant {
  display: none; position: absolute; left: calc(100% + .35rem); top: -.3rem; z-index: 40;
  min-width: 11.5rem; padding: .35rem; flex-direction: column; gap: 1px;
  background: var(--b-volant); border: 1px solid var(--b-trait); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
/* Un pont invisible entre l'icône et le volant : le pointeur ne tombe pas dans le vide en chemin. */
.barre-volant::before { content: ''; position: absolute; left: -.45rem; top: 0; bottom: 0; width: .45rem; }
.barre-groupe:hover > .barre-volant, .barre-groupe:focus-within > .barre-volant { display: flex; }
.barre-volant-titre { padding: .25rem .55rem .3rem; font-weight: 600; color: var(--b-texte); }
