/* ===== Styles partages entre les modules Inventaire et Livraison =====
   Ce fichier regroupe tout ce qui etait duplique entre style.css et
   livraison.css: polices, variables de couleur, fond de page, en-tete de
   site, messages flash et boutons de base. Les deux modules chargent cette
   feuille avant leur propre feuille specifique (style.css / livraison.css),
   qui ne contient plus que les regles propres a chacun. */

@font-face {
  font-family: "Futurastd";
  src: url("https://cdn.prod.website-files.com/67eed6094fc7e6a39406f3d5/67efc2b3e11efd203b7af203_FuturaStd-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Futurastd Book";
  src: url("https://cdn.prod.website-files.com/67eed6094fc7e6a39406f3d5/67efc2b3e4acde8f5d96adff_FuturaStd-Book.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f1f4f6;
  --panel: #ffffff;
  --text: #0f1720;
  --muted: #4b5b65;
  --accent: #228f9d;
  --accent-soft: #dceef1;
  --brand-dark: #0a0a0a;
  --brand-white: #ffffff;
  --danger: #b42318;
  --success: #17795e;
  --warning: #f59e0b;
  --line: #d5dfe4;
  --radius: 12px;
  --z-bg: -1;
  --z-base-raised: 1;
  --z-sticky: 10;
  --z-popover: 80;
  --z-toast: 120;
  --z-modal: 200;
  --z-dropdown: 1000;
  --z-dropdown-panel: 1001;
  --z-dropdown-combobox: 1002;
  --z-dropdown-active-card: 2500;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  /* 16px minimum: en dessous, iOS zoome au focus des champs. */
  font: 16px/1.45 "Futurastd Book", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 16% 2%, #fefefe 0%, #f8fbfc 30%, transparent 36%),
              radial-gradient(circle at 92% 8%, #d6eaef 0%, transparent 32%),
              linear-gradient(180deg, #f6f9fb 0%, var(--bg) 38%),
              var(--bg);
  -webkit-text-size-adjust: 100%;
}

.bg-shape {
  position: fixed;
  z-index: var(--z-bg);
  border-radius: 999px;
  filter: blur(22px);
  opacity: 0.45;
}

.bg-a {
  width: 280px;
  height: 280px;
  background: #cde5eb;
  top: -70px;
  left: -50px;
}

.bg-b {
  width: 320px;
  height: 320px;
  background: #b4dce3;
  right: -80px;
  top: 80px;
}

/* ---------- En-tete de site (commun aux deux modules) ---------- */

.site-header {
  padding: 14px clamp(16px, 5vw, 56px);
  padding-top: max(14px, env(safe-area-inset-top));
  display: grid;
  gap: 10px;
  border-bottom: 1px solid #1f3f45;
  background: linear-gradient(180deg, #141414 0%, #0a0a0a 100%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.site-header-top {
  display: flex;
  align-items: center;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-white);
  text-decoration: none;
}

.site-logo {
  height: clamp(24px, 3.2vw, 34px);
  width: auto;
  display: block;
}

.site-brand-text {
  font-family: "Futurastd", "Avenir Next", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.86rem;
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: 100%;
  /* overflow-x: auto rogne aussi en vertical : marge pour le translateY du survol */
  padding-block: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-group::-webkit-scrollbar {
  display: none;
}

.nav-link {
  text-decoration: none;
  color: var(--brand-white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-family: "Futurastd", "Avenir Next", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-link-button {
  width: auto;
  min-width: 0;
}

.nav-lock-form {
  margin: 0;
}

.nav-link:hover {
  border-color: var(--accent);
  background: rgba(34, 143, 157, 0.2);
  color: var(--brand-white);
  transform: translateY(-1px);
}

.nav-link.is-active {
  background: var(--accent);
  color: var(--brand-white);
  border-color: var(--accent);
}

.nav-cta {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--brand-white);
  font-weight: 600;
}

.nav-cta:hover,
.nav-cta.is-active {
  background: #176f7b;
  color: var(--brand-white);
  border-color: #176f7b;
}

.active-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  background: rgba(34, 143, 157, 0.2);
  border-color: rgba(34, 143, 157, 0.5);
  color: var(--brand-white);
}

.active-profile-badge:hover,
.active-profile-badge:focus-visible {
  background: rgba(34, 143, 157, 0.28);
  border-color: rgba(34, 143, 157, 0.65);
  color: var(--brand-white);
}

.profile-badge-icon {
  font-size: 1rem;
  line-height: 1;
}

/* Nom toujours visible : l'élargir au survol faisait passer la nav sur deux
   lignes, le badge fuyait le curseur et l'effet clignotait en boucle. */
.profile-badge-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Ancienne regle `.site-header a:not(.nav-link) { color: #fff }` retiree: elle
   blanchissait aussi les liens des panneaux clairs (menu des modules et menu
   mobile), qui devenaient invisibles sur fond blanc. Chaque zone declare
   maintenant sa propre couleur; le bandeau sombre la declare plus bas. */

.site-header.entete .entete-marque,
.site-header.entete .entete-onglet {
  color: rgba(255, 255, 255, 0.74);
}

.site-header.entete .entete-outil {
  color: var(--brand-white);
}

/* ---------- Messages flash (communs) ---------- */

.flash-list {
  display: grid;
  gap: 8px;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.flash.success {
  border-color: #93d4c1;
  background: #edf9f5;
}

.flash.error {
  border-color: #f3a9a3;
  background: #fff3f2;
}

/* ---------- Etiquette et aide de champ (communs) ---------- */
/* Inventaire: .filter-label / .field-hint. Livraison: .liv-champ > span /
   .liv-aide. Meme traitement typographique dans les deux modules. */

.filter-label,
.liv-champ > span {
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.field-hint,
.liv-aide {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

/* ---------- Panneau / carte generique (communs) ---------- */

.panel,
.liv-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--panel);
}

.panel h2 {
  margin-top: 0;
}

/* ---------- En-tete de page (commun a tous les modules) ----------
   Une seule forme d'un bout a l'autre de l'application: titre, sous-titre,
   puis les actions a droite. Aucun module ne redessine sa propre barre. */

.page-barre {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-titre {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.page-sous-titre {
  margin: 4px 0 0;
  color: var(--muted);
}

.page-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Barre d'une section dans une page (h2 + actions), sous l'en-tete .page-barre. */

.section-barre {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.section-barre h2 {
  margin: 0;
}

/* ---------- Boutons (communs) ----------
   `<button>` et les liens `.btn*` partagent exactement la meme forme: sinon un
   lien d'action parait tantot en lien bleu, tantot en bouton d'une autre taille
   selon le module. Chaque variante porte la forme complete, donc l'ordre des
   classes dans le gabarit n'a pas d'importance. */

button,
.btn,
.btn-secondary,
.btn-danger,
.btn-sm,
.btn-bloc,
.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, filter 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:hover:not(:disabled):not([disabled]),
.btn:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-sm:hover,
.btn-bloc:hover,
.btn-quiet:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(10, 37, 64, 0.12);
}

button:focus-visible,
.btn:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-sm:focus-visible,
.btn-bloc:focus-visible,
.btn-quiet:focus-visible,
.page-btn:focus-visible,
.icon-btn:focus-visible,
.qty-btn:focus-visible,
.btn-profile-delete:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled,
button[disabled],
.btn[aria-disabled="true"],
.btn-secondary[aria-disabled="true"],
.btn-danger[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Champs de saisie: focus commun (communs) ---------- */
/* Inventaire applique cet etat via .dropdown-toggle/inputs generiques;
   Livraison via .liv-champ input/.liv-input. Meme anneau d'accent. */

.liv-champ input:focus,
.liv-champ select:focus,
.liv-champ textarea:focus,
.liv-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* ---------- Tableaux (communs) ---------- */
/* Inventaire: .table-wrap + th/td generiques. Livraison: .liv-table-wrap +
   .liv-table th/td. Meme conteneur arrondi et meme entete grise en
   majuscules dans les deux modules. */

.table-wrap,
.liv-table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--accent-soft) transparent;
  border-radius: 14px;
}

.liv-table-wrap {
  border: 1px solid var(--line);
  background: var(--panel);
}

.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

table,
.liv-table {
  width: 100%;
  border-collapse: collapse;
}

th,
td,
.liv-table th,
.liv-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.liv-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f7fafb;
  white-space: nowrap;
}

.liv-table tr:last-child td {
  border-bottom: 0;
}

/* ---------- Etat vide (communs) ---------- */
/* Inventaire: .table-meta + ligne "Aucun ...". Livraison: .liv-vide, deja en
   carte pointillee. On aligne .liv-vide sur le meme radius que .panel. */

.liv-vide {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.btn-secondary,
.btn-sm.btn-secondary,
.btn-quiet {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.btn-secondary:hover:not(:disabled):not([disabled]),
.btn-sm.btn-secondary:hover,
.btn-quiet:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent), #fff 55%);
}

/* Filtre actif: meme repere visuel dans les quatre modules. */
.btn-secondary.is-actif {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Un bouton secondaire garde son fond blanc meme quand il est un <button>. */
button.btn-secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

button.btn-secondary:hover:not(:disabled):not([disabled]) {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent), #fff 55%);
  filter: none;
}

button.danger,
button.btn-danger,
.btn-danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

button.btn-danger:hover:not(:disabled):not([disabled]),
.btn-danger:hover {
  filter: brightness(0.95);
}

/* Petit bouton: meme forme, gabarit reduit. */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.88rem;
}

/* Bouton pleine largeur: telephone, formulaires. */
.btn-bloc {
  width: 100%;
}

/* ---------- En-tete: adaptation mobile commune ---------- */

@media (max-width: 719px) {
  .site-header {
    gap: 8px;
  }

  .site-nav {
    display: grid;
    gap: 6px;
    margin-inline: calc(-1 * clamp(16px, 5vw, 56px));
  }

  .nav-group {
    width: 100%;
    padding: 4px clamp(16px, 5vw, 56px) 8px;
  }

  .nav-link,
  .btn,
  .page-actions .btn,
  .page-actions button {
    min-height: 44px;
  }

  .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ---------- En-tete fin: onglets de module + panneau (Inventaire, Ventes, Ramassage) ----------
   Le bandeau fait 44 px: il porte l'identite, les modules et le compte.
   Les pages d'un module vivent dans un panneau qui s'ouvre sous le bandeau.
   Ne pas descendre a trois niveaux: une page trop specialisee devient un
   onglet dans la page elle-meme. Les quatre modules passent par ce meme
   partiel (templates/_entete_nav.html). */

.site-header.entete {
  /* Neutralise la disposition en grille de .site-header, qui sert a Livraison. */
  display: block;
  padding: 0;
  gap: 0;
}

.entete-barre {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 clamp(12px, 4vw, 32px);
}

.entete-marque {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex: 0 0 auto;
  padding-right: 4px;
}

.entete-marque .site-logo {
  height: 24px;
}

.entete-logo-carre {
  display: none;
  width: 24px;
  height: 24px;
}

/* Le cadenas ne sert que lorsque le libelle est masque. */
.entete-verrou-icone {
  display: none;
}

.entete-marque .site-brand-text {
  font-size: 0.72rem;
}

.entete-onglets {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 6px;
}

.entete-onglets::-webkit-scrollbar {
  display: none;
}

/* Onglet de module: un lien qui navigue + un chevron qui ouvre ses pages.
   Deux cibles distinctes, comme Carbon: le libelle mene a la page, le chevron
   ouvre le sous-menu et ne navigue pas. */
.entete-onglet-groupe {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: none;
  transition: background 140ms ease;
}

.entete-onglet-groupe:hover {
  background: rgba(255, 255, 255, 0.09);
}

.entete-onglet-groupe.is-active {
  background: rgba(34, 143, 157, 0.24);
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.entete-onglet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 4px 4px 11px;
  border-radius: 8px 0 0 8px;
  background: none;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.8rem;
  font-family: "Futurastd", "Avenir Next", sans-serif;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.entete-onglet-groupe:hover .entete-onglet,
.entete-onglet-groupe.is-active .entete-onglet {
  color: var(--brand-white);
}

.entete-onglet-groupe.is-active .entete-onglet {
  font-weight: 600;
}

.entete-onglet-fleche {
  display: inline-grid;
  place-items: center;
  width: 26px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.entete-onglet-fleche:hover,
.entete-onglet-fleche[aria-expanded="true"] {
  color: var(--brand-white);
}

.entete-onglet-fleche .entete-fleche {
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 140ms ease;
}

.entete-onglet-fleche[aria-expanded="true"] .entete-fleche {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.entete-outils {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.entete-outil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--brand-white);
  font: inherit;
  font-size: 0.76rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.entete-outil:hover,
.entete-outil[aria-expanded="true"] {
  border-color: var(--accent);
  background: rgba(34, 143, 157, 0.22);
  color: var(--brand-white);
}

.entete-outil-cercle {
  width: 30px;
  padding: 0;
  font-size: 0.95rem;
}

.entete-outil .profile-badge-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entete-badge {
  display: inline-grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Panneau du module ---------- */

.entete-panneau {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: min(70vh, 540px);
  overflow-y: auto;
  padding: 12px clamp(12px, 4vw, 32px) 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.entete-panneau[hidden] {
  display: none;
}

.entete-panneau-tete {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.entete-panneau-tete a {
  margin-left: auto;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
}

.entete-panneau-tete a:hover {
  text-decoration: underline;
}

.entete-colonnes {
  display: grid;
  /* Nombre de colonnes fixe par palier: auto-fit donnait six colonnes etroites
     pour Ventes, illisibles. Quatre familles cote a cote se lisent d'un coup. */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 22px;
  align-items: start;
}

@media (max-width: 1100px) {
  .entete-colonnes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .entete-colonnes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.entete-famille-titre {
  padding: 4px 9px 3px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.entete-lien {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  /* Fond clair: la couleur vient d'ici, pas du bandeau sombre. */
  color: var(--text);
  font-size: 0.83rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entete-lien:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.entete-lien[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.entete-lien .entete-badge {
  background: var(--accent);
}

.entete-systeme {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.entete-systeme a {
  padding: 4px 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: none;
}

.entete-systeme a:hover {
  background: var(--accent-soft);
  color: var(--text);
}

/* Le bandeau est sticky: le panneau doit rester sous lui, pas sous le contenu. */
.site-header.entete {
  position: sticky;
}

/* ---------- En-tete: mobile ---------- */

@media (max-width: 719px) {
  .entete-barre {
    gap: 4px;
    padding: 0 clamp(8px, 3vw, 16px);
  }

  /* La marque cede la place aux modules: le K carre remplace le logotype
     complet, qui faisait 138 px sur 390 et ecrasait la rangee d'onglets. */
  .entete-marque .site-brand-text {
    display: none;
  }

  .entete-marque {
    gap: 0;
    padding-right: 0;
  }

  .entete-marque .entete-logo-complet {
    display: none;
  }

  .entete-logo-carre {
    display: block;
  }

  /* Verrouiller passe en icone: le libelle complet coutait 68 px. */
  .entete-verrou-texte {
    display: none;
  }

  .entete-verrou-icone {
    display: inline;
  }

  .entete-outil-verrou {
    width: 34px;
    padding: 0;
    font-size: 0.9rem;
  }

  .entete-outil-cercle {
    width: 34px;
  }

  /* La rangee d'onglets garde la priorite: elle ne doit jamais etre ecrasee
     sous une largeur ou un libelle de module devient illisible. */
  .entete-onglets {
    flex: 1 1 auto;
    min-width: 0;
  }

  .entete-onglet {
    min-height: 34px;
    padding: 4px 3px 4px 9px;
    font-size: 0.76rem;
  }

  .entete-onglet-fleche {
    min-height: 34px;
    width: 24px;
  }

  /* Libelles conserves sur mobile: des icones seules obligent a deviner, et
     NN/g mesure une baisse d'usage. La rangee defile plutot que de les perdre.
     La marque et le nom du compte cedent la place aux modules. */

  .entete-outil .profile-badge-name {
    display: none;
  }

  /* Pastille ronde: l'icone seule, sans largeur qui depend du nom. */
  a.entete-outil[aria-label^="Compte"] {
    width: 34px;
    padding: 0;
    font-size: 1rem;
  }

  .entete-colonnes {
    grid-template-columns: 1fr;
  }

  .entete-panneau {
    max-height: 76vh;
  }
}

@media (max-width: 420px) {
  .entete-onglet .entete-fleche {
    display: none;
  }

  .entete-onglet-groupe.is-active .entete-onglet {
    padding-inline: 7px 2px;
  }

  /* Verrouiller reste accessible mais sans occuper la place du profil. */
  .entete-outil-verrou {
    padding: 0 8px;
    font-size: 0.72rem;
  }
}

/* ---------- En-tete: navigation mobile (sous 720 px) ----------
   Quatre onglets de module ne tiennent pas sur un telephone: meme sans les
   icones et les chevrons, la rangee demandait 374 px pour 263 px disponibles.
   On remplace donc la rangee par un seul bouton qui nomme le module courant,
   et le menu s'ouvre en liste verticale: cibles de 44 px, libelles toujours
   visibles, un seul niveau deplie a la fois. */

/* Le bouton mobile n'existe pas sur grand ecran. */
.entete-menu,
.entete-mobile {
  display: none;
}

@media (max-width: 719px) {
  .entete-onglets {
    display: none;
  }

  .entete-menu {
    display: inline-flex;
    align-items: center;
    /* La regle generique `button` centre son contenu: ici le libelle doit
       s'aligner a gauche, comme les autres zones du bandeau. */
    justify-content: flex-start;
    gap: 7px;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--brand-white);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
  }

  .entete-menu[aria-expanded="true"] {
    border-color: var(--accent);
    background: rgba(34, 143, 157, 0.24);
  }

  .entete-menu-icone {
    flex: 0 0 auto;
    font-size: 0.95rem;
    opacity: 0.85;
  }

  .entete-menu-libelle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
  }

  .entete-menu-nom {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
  }

  /* Le panneau mobile occupe l'ecran sous le bandeau: aucun menu flottant qui
     laisserait deviner ce qu'il y a derriere. */
  .entete-mobile {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 21;
    max-height: calc(100dvh - 44px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 0 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
  }

  .entete-mobile[hidden] {
    display: none;
  }

  .entete-mobile-module {
    border-bottom: 1px solid var(--line);
  }

  .entete-mobile-module > summary {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 0 16px;
    color: var(--text);
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
  }

  .entete-mobile-module > summary::-webkit-details-marker {
    display: none;
  }

  .entete-mobile-module[open] > summary {
    color: var(--accent);
    background: var(--accent-soft);
  }

  .entete-mobile-nom {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Repere discret: on sait dans quel module on se trouve. */
  .entete-mobile-ici {
    flex: 0 0 auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .entete-mobile-lien {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px 0 34px;
    color: var(--text);
    font-size: 0.86rem;
    text-decoration: none;
  }

  .entete-mobile-lien:active {
    background: var(--accent-soft);
  }

  .entete-mobile-lien.est-ici {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 3px 0 0 0 var(--accent);
  }

  .entete-mobile .entete-famille-titre {
    padding: 8px 16px 2px 20px;
    color: var(--muted);
    font-size: 0.66rem;
  }

  .entete-mobile-systeme {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 10px 16px 0;
    margin-top: 6px;
    border-top: 1px solid var(--line);
  }

  .entete-mobile-systeme a,
  .entete-mobile-systeme button {
    /* 44 px: cible tactile recommandee (WCAG 2.5.5). */
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font: inherit;
    font-size: 0.8rem;
    text-decoration: none;
    cursor: pointer;
  }

  .entete-mobile-systeme form {
    margin: 0;
  }

  /* Le menu mobile n'a pas besoin des grands panneaux par module. */
  .entete-panneau {
    display: none !important;
  }
}
