/* =============================================================================================
   barre.css — Lot « Barre du haut discrète » (23/11/2026)

   Jérôme : « mets-la dans les mêmes couleurs que le menu à gauche, rends-la plus fine et
   discrète. » La barre prend le navy du menu de gauche — ses variables, jamais une valeur
   recopiée — et forme avec lui un seul cadre en L. Une ligne : 56 px sur PC, 48 px au téléphone.

   Le menu de gauche n'est PAS modifié : seule sa position suit la nouvelle hauteur de la barre
   (`top` et `height`), sans quoi il laisserait un vide de 20 px sous elle.

   Aucun violet, aucun rose, aucun lilas : navy, blanc, gris clair, bleu → cyan, vert, orange,
   rouge (pour l'état). Bornée à `.topbar` et à ses classes propres (`barre-*`, `etat-point`,
   `compte-*`, `pilule-*`).
   ============================================================================================= */

:root { --barre-hauteur: 56px; }

header.topbar {
  min-height: var(--barre-hauteur);
  height: var(--barre-hauteur);
  display: flex;
  align-items: center;
  gap: 0 16px;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(90deg,
      var(--navy) 0%,
      color-mix(in srgb, var(--navy-soft) 70%, var(--navy)) 100%);
  border-bottom: 1px solid color-mix(in srgb, #fff 12%, var(--navy));
  box-shadow: 0 2px 10px rgba(16, 38, 63, 0.18);
  backdrop-filter: none;
}

/* Le menu de gauche suit la barre : position seulement, et seulement là où styles.css le cale
   sous la barre (au-delà de 1320 px). En dessous, il se place lui-même (en haut à 0, puis en bande,
   puis en barre du bas au téléphone) : n'y rien changer. */
@media (min-width: 1321px) {
  .side-nav { top: var(--barre-hauteur); height: calc(100vh - var(--barre-hauteur)); }
}

/* --- Gauche : logo + qui je suis, sur une ligne ------------------------------------------------ */
header.topbar .brand-block { flex: 1 1 auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
header.topbar .brand-block > .contexte-basculer { margin-inline: auto; }
header.topbar .brand-block > div { min-width: 0; }
header.topbar .brand-mark-small { width: 34px; height: 34px; font-size: 0.72rem; border-radius: 9px;
  background: color-mix(in srgb, #fff 14%, var(--navy)); color: #fff; box-shadow: none; }
header.topbar #role-actif { margin: 0; font-size: 0.98rem; font-weight: 700; line-height: 1.2; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.topbar .contexte-fil { display: none; }
header.topbar .navigation-toggle { width: 40px; height: 40px; border-color: color-mix(in srgb, #fff 24%, transparent);
  background: transparent; color: #fff; }

/* --- Centre : la pilule de contexte -------------------------------------------------------------- */
header.topbar .contexte-basculer {
  display: inline-flex; align-items: center; gap: 6px; max-width: min(46vw, 420px); min-height: 36px;
  padding: 0 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, #fff 26%, transparent);
  background: color-mix(in srgb, #fff 10%, transparent); color: #fff; font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
}
header.topbar .contexte-basculer:hover { background: color-mix(in srgb, #fff 18%, transparent); }
header.topbar .contexte-basculer[aria-expanded="true"] { border-color: var(--accent-cyan); }
header.topbar .pilule-texte { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.topbar .contexte-basculer[hidden] { display: none; }

/* Le panneau : les mêmes sélecteurs, sous la pilule, fermés tant qu'on ne les demande pas. */
header.topbar .context-controls {
  position: absolute; top: calc(var(--barre-hauteur) - 4px); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 24px)); display: none; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; padding: 14px; border-radius: 14px; background: #fff; color: var(--ink, var(--navy));
  border: 1px solid var(--line); box-shadow: 0 14px 34px rgba(16, 38, 63, 0.22); z-index: 50;
}
header.topbar.contexte-ouvert .context-controls:not([hidden]) { display: grid; }
header.topbar .context-controls label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  align-content: start; min-width: 0;
  color: var(--muted); font-size: 0.8rem; }
header.topbar .context-controls select { width: 100%; min-width: 0; min-height: 44px; }
header.topbar .context-controls label[data-un-seul] select { display: none; }
header.topbar .context-controls .pilule-nom-seul { display: block; margin-top: 6px; color: var(--navy);
  font-weight: 700; font-size: 0.95rem; }

/* --- Droite : icônes discrètes -------------------------------------------------------------------- */
header.topbar .status-cluster { flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
header.topbar .etat-point { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%;
  cursor: help; }
header.topbar .etat-point::before { content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent-vert, var(--green)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-vert, var(--green)) 30%, transparent); }
header.topbar .etat-point[data-etat="orange"]::before { background: var(--accent-orange);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-orange) 30%, transparent); }
header.topbar .etat-point[data-etat="rouge"]::before { background: #e5484d;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.3); }
header.topbar .barre-icone { position: relative; width: 44px; height: 44px; min-width: 44px; padding: 0;
  display: inline-grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: #fff; }
header.topbar .barre-icone[hidden] { display: none; }
header.topbar .barre-icone:hover { background: color-mix(in srgb, #fff 12%, transparent); }
header.topbar .barre-icone .count-badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; font-size: 0.7rem; line-height: 18px; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--accent-cyan)); }
header.topbar .barre-icone .count-badge[hidden] { display: none; }

header.topbar .compte-barre { position: relative; }
header.topbar .compte-rond { width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid;
  place-items: center; cursor: pointer; background: transparent; padding: 0; }
header.topbar .compte-rond #compte-initiales { width: 34px; height: 34px; border-radius: 50%; display: inline-grid;
  place-items: center; font-weight: 800; font-size: 0.8rem; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--accent-cyan)); }
header.topbar .compte-rond[aria-expanded="true"] #compte-initiales { box-shadow: 0 0 0 2px #fff; }
header.topbar .compte-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; display: grid;
  padding: 6px; border-radius: 12px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 14px 34px rgba(16, 38, 63, 0.22); z-index: 55; }
header.topbar .compte-menu[hidden] { display: none; }
header.topbar .compte-menu-item { min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; text-align: left;
  background: transparent; color: var(--navy); font-weight: 600; font-size: 0.92rem; cursor: pointer; text-decoration: none; }
header.topbar .compte-menu-item:hover, header.topbar .compte-menu-item:focus-visible { background: var(--blue-soft); }

/* Les deux pastilles d'état restent pour les lecteurs d'écran seulement. `button.status-pill`
   (styles.css) leur rendait hauteur et marges : on les remet hors du flux, ici. */
header.topbar .status-pill.sr-only { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Focus visible sur le navy : un contour cyan, lisible. */
header.topbar :is(button, [tabindex="0"]):focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

/* Le panneau des nouvelles reste ancré à droite, sous la barre. */
header.topbar .nouvelles-panel { top: calc(var(--barre-hauteur) - 4px); }

/* --- Téléphone : une ligne, 48 px ------------------------------------------------------------------ */
@media (max-width: 760px) {
  :root { --barre-hauteur: 48px; }
  header.topbar { gap: 0 6px; padding: 0 6px; }
  header.topbar .brand-block { gap: 6px; }
  header.topbar .brand-block > .contexte-basculer { margin-inline: 0; }
  header.topbar #role-actif { display: none; }
  header.topbar .brand-mark-small { width: 30px; height: 30px; }
  header.topbar .contexte-basculer { max-width: 100%; min-height: 34px; padding: 0 10px; font-size: 0.85rem; }
  header.topbar .context-controls { grid-template-columns: 1fr; left: 12px; right: 12px; transform: none; width: auto; }
  /* « Équipe A ▾ » : l'équipe seule ; le club et la saison sont dans le panneau. */
  header.topbar .pilule-texte:has(.pilule-equipe) :is(.pilule-club, .pilule-saison, .pilule-sep) { display: none; }
  /* La rangée ne défile plus (quelques icônes) : défiler rognait le menu du compte. */
  header.topbar .status-cluster { gap: 0; overflow: visible; }
  header.topbar .compte-menu .compte-menu-item { min-height: 44px; padding: 0 12px; font-size: 0.92rem; }
  header.topbar .etat-point { width: 32px; }
}
