/* ============================================================
   B&B Pilot — Composants UI communs (refonte Concurrence/Référentiel)
   Fusionne concurrence-mobile.css ; z-index cales sur l'existant
   (topbar:1001, showModal():9999) pour zero regression visuelle.
   ============================================================ */

:root {
  --z-bar: 800;        /* barre d'enregistrement collee en bas (mobile) */
  --z-menu-overlay: 900; /* reserve panneau mobile (sheet), distinct du vrai .bbp-sidenav (z-index 999) */
  --z-modal: 9999;     /* aligne sur showModal() existant - reste au-dessus de topbar (1001) et anciennes modales (3000) */
  --z-toast: 10000;    /* toujours au-dessus d'une modale ouverte */
}

/* ---------- Toasts (showToast(), app.js) ---------- */
.bbp-toaster {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: var(--z-toast);
  max-width: 360px;
}

.bbp-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  padding: 12px 14px;
  font-size: 13px;
  animation: bbpToastIn .25s ease;
}
@keyframes bbpToastIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.bbp-toast--success .bbp-toast__icon { color: #22c55e; }
.bbp-toast--danger  .bbp-toast__icon { color: #ef4444; }
.bbp-toast--info    .bbp-toast__icon { color: #378ADD; }

.bbp-toast__icon { flex: none; margin-top: 1px; }
.bbp-toast__body { flex: 1; min-width: 0; }
.bbp-toast__msg  { color: #1a1a1a; line-height: 1.4; }

.bbp-toast__action {
  flex: none; background: none; border: none; color: #2B5CFF;
  font-weight: 600; font-size: 12px; cursor: pointer; padding: 0; margin-top: 1px;
  white-space: nowrap;
}
.bbp-toast__action:hover { text-decoration: underline; }

.bbp-toast__close {
  flex: none; background: none; border: none; color: #999; cursor: pointer;
  padding: 0; margin-top: 1px; line-height: 0;
}
.bbp-toast__close:hover { color: #555; }

@media (max-width: 640px) {
  .bbp-toaster {
    left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom));
    max-width: none;
  }
}

/* ============================================================
   Ci-dessous : contenu de concurrence-mobile.css (fusionne)
   ============================================================ */

@media (max-width: 640px) {

  /* Zones tactiles : 44px minimum */
  .conc-page button,
  .conc-page select,
  .conc-page input[type="text"],
  .conc-chip { min-height: 44px; }

  /* En-tête : sélecteur de set pleine largeur sous le titre */
  .conc-header { flex-direction: column; align-items: stretch; }
  .conc-header select { width: 100%; }

  /* Indicateurs : 2 colonnes */
  .conc-kpis { grid-template-columns: 1fr 1fr; }

  /* Filtres : localité + bouton filtres sur une ligne, rayon dessous */
  .conc-filters { grid-template-columns: minmax(0, 1fr) auto; }
  .conc-filters .conc-radius { grid-column: 1 / -1; order: 3; }

  /* Barre d'outils : Liste/Carte et onglets sur deux colonnes égales */
  .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .conc-search, .conc-sort { flex: 1 1 100%; }

  /* Lignes : bouton d'action en icône seule, sous-ligne réduite */
  .conc-row { grid-template-columns: minmax(0, 1fr) auto 44px; gap: 8px; }
  .conc-row .act-label { display: none; }
  .conc-row .meta-type, .conc-row .meta-source { display: none; }

  /* Fiche carte : panneau glissant en bas au lieu de la bulle */
  .conc-fiche {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-width: none; transform: none;
    border-radius: 16px 16px 0 0;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
  }

  /* Panneau de composition : remplacé par une barre collée en bas */
  .conc-compo { display: none; }
  .conc-bar {
    position: sticky; bottom: 0; z-index: var(--z-bar);
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid rgba(0,0,0,.08);
  }
  /* Le détail (stats, transfert, supprimer) s'ouvre en panneau depuis la barre */
  .conc-bar-sheet { position: fixed; inset: auto 0 0 0; z-index: var(--z-modal); }
}

@media (min-width: 641px) {
  .conc-bar { display: none; }
}

/* ============================================================
   Concurrence — layout desktop (classes ajoutees pour permettre
   la surcharge mobile ci-dessous sans !important sur le grid)
   ============================================================ */
.conc-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.conc-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
}

@media (max-width: 640px) {
  /* Zones tactiles 44px minimum sur toute la page Concurrence */
  #tab1 button,
  #tab1 select,
  #tab1 input[type="text"],
  #tab1 input[type="number"] {
    min-height: 44px;
  }

  /* Indicateurs : 2 colonnes au lieu de 4 */
  .conc-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Filtres + resultats : colonne unique (filtres au-dessus) */
  .conc-layout {
    grid-template-columns: 1fr;
  }

  /* Panneau Composition du set : boutons qui passent a la ligne */
  .conc-panel-actions {
    flex-wrap: wrap;
  }
  .conc-panel-actions button {
    flex: 1 1 auto;
  }

  /* Carte : hauteur reduite sur petit ecran (min-height JS 440px sinon) */
  #conc_map_wrap {
    min-height: 320px !important;
  }
}

/* ============================================================
   Slider (input type=range) — absent de vanilla.css, style maison
   aligne sur les tokens B&B Pilot
   ============================================================ */
.bbp-slider {
  width: 100%;
  accent-color: var(--primary, #2B5CFF);
  height: 4px;
  cursor: pointer;
  margin: 8px 0 2px;
}

/* ============================================================
   Pastille de selection de Set (header Concurrence)
   ============================================================ */
.conc-set-pill {
  border-radius: var(--radius-pill, 999px);
  background: var(--surface-card, #fff);
  border: 1px solid var(--border-subtle, #e1e6f0);
  padding-left: 40px;
}
.conc-set-pill-select {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: var(--radius-pill, 999px) !important;
  font-weight: var(--weight-semibold, 600);
  padding-right: 32px !important;
}

/* ============================================================
   Panneau "Composition du set" : colle en bas de l'ecran,
   ne recouvre jamais les cartes (voir .has-conc-panel ci-dessous)
   ============================================================ */
#conc_panel_composition {
  position: fixed !important;
  left: 0; right: 0; bottom: 0;
  z-index: 500;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
  margin: 0 !important;
  box-shadow: 0 -6px 20px rgba(15, 23, 41, 0.10) !important;
  max-height: 40vh;
  overflow-y: auto;
}
#conc_panel_composition > * {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}
body.has-conc-panel .container {
  padding-bottom: 130px;
}

@media (max-width: 640px) {
  #conc_panel_composition { padding: var(--space-3) var(--space-4) !important; }
  body.has-conc-panel .container { padding-bottom: 160px; }
}

/* ============================================================
   V32 - Concurrence mobile : plus de defilement horizontal
   ============================================================ */
@media (max-width: 640px) {
  #tab1 { max-width: 100%; overflow-x: clip; }
  #tab1 input, #tab1 select { box-sizing: border-box; max-width: 100%; }
  #tab1 .bbp-input-wrap:has(> #conc_search) { flex: 1 1 100%; min-width: 0 !important; width: 100%; }
  #conc_selection_bar { flex-wrap: wrap; width: 100%; }
  #conc_selection_bar .bbp-btn { flex: 1 1 auto; }
}


/* ============================================================
   V32 - Concurrence : barre de filtres encadree, 3 lignes en mobile
   ============================================================ */
@media (max-width: 640px) {
  .conc-zone-filtres .conc-barre-filtres { grid-template-columns: minmax(0, 1fr) !important; }
  .conc-zone-filtres .conc-barre-filtres > div:last-child { display: flex; width: 100%; }
  .conc-zone-filtres .conc-barre-filtres > div:last-child .bbp-btn { flex: 1 1 0; min-width: 0; justify-content: center; }
  #conc_filtres_avances { grid-template-columns: 1fr !important; }
}


/* ============================================================
   V32 - Concurrence mobile : zone repliable + Filtres en modale
   ============================================================ */
#conc_filtres_voile, .conc-sheet-tete, .conc-sheet-pied, .conc-zone-entete { display: none; }
@media (max-width: 640px) {
  .conc-zone-filtres { z-index: auto !important; }
  .conc-zone-entete { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    background: none; border: none; padding: 0; cursor: pointer; text-align: left; min-height: 44px; font: inherit; color: inherit; }
  .conc-zone-chevron { transition: transform .2s; flex-shrink: 0; }
  .conc-zone-filtres:not(.est-fermee) .conc-zone-entete { margin-bottom: var(--space-3); }
  .conc-zone-filtres:not(.est-fermee) .conc-zone-chevron { transform: rotate(180deg); }
  .conc-zone-filtres.est-fermee .conc-barre-filtres,
  .conc-zone-filtres.est-fermee #conc_filtres_avances { display: none !important; }
  #conc_filtres_voile.ouvert { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 950; }
  #conc_filtres_avances { position: fixed !important; left: 0; right: 0; bottom: 0; top: auto; z-index: 960; max-height: 82vh; overflow-y: auto;
    background: var(--surface-card, #fff); border-radius: 16px 16px 0 0; border-top: none !important; margin: 0 !important;
    padding: 0 16px !important; grid-template-columns: 1fr !important; box-shadow: 0 -8px 24px rgba(0,0,0,.18); }
  .conc-sheet-tete { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    background: var(--surface-card, #fff); padding: 14px 0 8px; font-weight: 700; color: var(--text-strong); }
  .conc-sheet-pied { display: block; order: 99; position: sticky; bottom: 0; background: var(--surface-card, #fff);
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
}


/* V32 - Concurrence : resultats dans un cadre, comme le Referentiel */
#conc_results .conc-res-carte > div:last-child { border-bottom: none !important; }


/* ============================================================
   V32 - Concurrence : barre d'outils collante (ordinateur)
   ============================================================ */
@media (min-width: 641px) {
  #conc_barre { position: sticky; top: var(--conc-haut, 0px); z-index: 4; background: var(--surface-card, #fff); padding: var(--space-2) 0; }
}
#conc_map_wrap { position: relative; z-index: 0; }
/* V44i : les onglets Dans le set / À ajouter / Tous sont un contrôle segmenté du design system (.bbp-seg) */

/* ============================================================
   V32 - Menu en rail sur ordinateur : icônes seules quand il est fermé
   ============================================================ */
@media (min-width: 768px) {
  .bbp-sidenav { transition: transform .45s ease, width .3s ease; }
  body:not(.sidebar-open) .bbp-sidenav { transform: translateX(0); width: 64px; overflow-x: hidden; }
  body:not(.sidebar-open) .container { margin-left: 64px; }
  body:not(.sidebar-open) .bbp-sidenav-list { padding: 8px 6px; }
  body:not(.sidebar-open) .bbp-sidenav-link { justify-content: center; gap: 0; padding: 10px 0; }
  body:not(.sidebar-open) .bbp-sidenav-link > span:not(.bbp-sidenav-icon),
  body:not(.sidebar-open) .bbp-sidenav-chevron,
  body:not(.sidebar-open) .bbp-sidenav-submenu { display: none; }
  body:not(.sidebar-open) .bbp-sidenav-icon { width: auto; font-size: 18px; }
}

/* ============================================================
   V33 - Heatmap : cases du Calendrier (design system, couleurs de tension conservées)
   ============================================================ */
#heatmapGrid { gap: var(--space-2, 6px); }
.hm-jour { text-align: center; font-size: var(--text-xs, 11px); font-weight: 600; color: var(--text-muted, #6b7280); padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.hm-jour .hm-court { display: none; }
.hm-cell { position: relative; min-height: 78px; padding: 6px 7px; border-radius: var(--radius-md, 8px); border: 1px solid var(--border-subtle, #e5e7eb); background: #f3f4f6; color: var(--text-body, #374151); cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-family: var(--font-sans, inherit); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.hm-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow-md, 0 4px 10px rgba(0,0,0,.12)); }
.hm-cell--vide { opacity: .75; }
.hm-cell--faible { border-style: dashed; background: #e5e7eb; }
.hm-cell--tension { border-color: transparent; color: #fff; }
.hm-cell--today { border: 2px solid var(--primary, #2563eb); }
.hm-cell__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 4px; }
.hm-cell__day { font-size: var(--text-xs, 11px); font-weight: 800; }
.hm-cell--today:not(.hm-cell--tension) .hm-cell__day { color: var(--primary, #2563eb); }
.hm-cell__prix { font-family: var(--font-mono, ui-monospace, monospace); font-variant-numeric: tabular-nums; font-size: var(--text-base, 15px); font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.hm-cell__pp { font-size: 11px; font-weight: 500; opacity: .9; }
.hm-cell__meta { font-size: 10.5px; line-height: 1.25; opacity: .92; }
.hm-cell__vac { display: inline-flex; align-items: center; gap: 2px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill, 9px); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); font-size: 10px; font-weight: 700; color: #1a1a1a; line-height: 1; white-space: nowrap; }
@media (max-width: 640px) {
  #heatmapGrid { gap: 3px; }
  .hm-jour .hm-long { display: none; }
  .hm-jour .hm-court { display: inline; }
  .hm-cell { min-height: 54px; padding: 3px 3px 4px; border-radius: 6px; align-items: center; text-align: center; }
  .hm-cell__top { width: 100%; }
  .hm-cell__prix { font-size: 12px; font-weight: 700; margin-top: auto; }
  .hm-cell__pp, .hm-cell__meta, .hm-cell__zones { display: none; }
  .hm-cell__vac { height: 14px; padding: 0 2px; font-size: 9px; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
  .hm-cell:hover { transform: none; box-shadow: none; }
}

/* ============================================================
   V33 - Heatmap : détail des établissements d'un jour
   ============================================================ */
#heatmapDetailTitle { font-family: var(--font-display, inherit); font-size: var(--text-lg, 17px); font-weight: 700; color: var(--text-strong, #111); margin: 0 0 var(--space-3, 12px); }
#heatmapDetailTitle::first-letter { text-transform: uppercase; }
.hmd-vide { color: var(--text-muted, #999); font-size: 13px; }
.hmd-resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: var(--space-4, 16px); }
.hmd-resume div { background: #f8f9fa; border-radius: 8px; padding: 8px 10px; }
.hmd-resume small { display: block; color: var(--text-muted, #6b7280); font-size: 11px; }
.hmd-resume b { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; font-size: var(--text-base, 15px); color: var(--text-strong, #111); }
.hmd-liste { display: flex; flex-direction: column; }
.hmd-etab { padding: var(--space-3, 12px) 0; border-top: 1px solid var(--border-subtle, #e5e7eb); }
.hmd-etab:first-child { border-top: 0; padding-top: 0; }
.hmd-etab__haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hmd-etab__id { flex: 1; min-width: 0; }
.hmd-etab__nom { font-weight: 600; color: var(--text-strong, #111); font-size: var(--text-sm, 14px); }
.hmd-muted { color: var(--text-muted, #6b7280); font-size: 12px; }
.hmd-etab__note { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.hmd-etab__prix { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.hmd-prix { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; font-size: var(--text-base, 15px); font-weight: 600; color: var(--text-strong, #111); white-space: nowrap; }
.hmd-pp { font-size: 12px; font-weight: 500; color: var(--text-muted, #6b7280); }
.hmd-etab__dates { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--text-muted, #6b7280); }
.hmd-etab__dates b { color: var(--text-body, #374151); font-weight: 600; }
.hmd-ch { margin-top: 8px; overflow-x: auto; }
.hmd-ch table { width: 100%; border-collapse: collapse; font-size: 12px; }
.hmd-ch th { text-align: left; font-weight: 600; font-size: 11px; color: var(--text-muted, #6b7280); padding: 4px 8px; border-bottom: 1px solid var(--border-subtle, #e5e7eb); white-space: nowrap; }
.hmd-ch td { padding: 5px 8px; border-bottom: 1px solid #f1f2f4; color: var(--text-body, #374151); }
.hmd-ch .hmd-num { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hmd-ch tr.is-dup td { background: rgba(245, 158, 11, .08); }
.hmd-dup { margin-right: 4px; cursor: help; }
.hmd-complet { margin-top: 8px; color: var(--danger, #dc2626); font-size: 12px; font-weight: 600; }
@media (max-width: 640px) {
  .hmd-etab__haut { flex-direction: column; gap: 6px; }
  .hmd-etab__prix { flex-direction: row; align-items: center; }
  .hmd-ch table { min-width: 460px; }
}

/* V33 - Heatmap : détail, fiches plus visibles (cartes, bande de statut, tri) */
#heatmapDetail { background: #f4f5f7; }
.hmd-resume div { background: #fff; border: 1px solid var(--border-subtle, #e5e7eb); }
.hmd-liste { gap: 10px; }
.hmd-etab, .hmd-etab:first-child { background: #fff; border: 1px solid var(--border-subtle, #e5e7eb); border-left: 4px solid #d1d5db; border-radius: var(--radius-md, 10px); padding: 12px 14px; box-shadow: 0 1px 2px rgba(15, 23, 41, .06); }
.hmd-etab.hmd-etab--dispo { border-left-color: #22c55e; }
.hmd-etab.hmd-etab--complet { border-left-color: #dc2626; }
.hmd-etab--complet, .hmd-etab--vide { background: #fcfcfd; }
.hmd-etab__nom { font-size: 15px; font-weight: 700; }
.hmd-prix { font-size: 17px; }
.hmd-etab--complet .hmd-prix, .hmd-etab--vide .hmd-prix { color: var(--text-muted, #9ca3af); }

/* V33 - Tuiles d'information alignées sur les indicateurs de Concurrence et du Référentiel
   (valeur en haut, libellé en dessous, contenu centré) : détail du jour, panneau d'info, Évolution */
.hmd-resume .hm-kpi, .hm-chiffres .hm-kpi, .evo-chiffres .hm-kpi {
  display: flex; flex-direction: column-reverse; justify-content: center; gap: 2px;
  text-align: center; padding: var(--space-3, 12px) var(--space-4, 16px); background: #fff;
}
.hmd-resume .hm-kpi b, .hm-chiffres .hm-kpi b, .evo-chiffres .hm-kpi b {
  display: block; font-family: inherit; font-size: var(--text-xl, 20px); font-weight: var(--weight-bold, 700);
  color: var(--text-strong); line-height: 1.2;
}
.hmd-resume .hm-kpi small, .hm-chiffres .hm-kpi small, .evo-chiffres .hm-kpi small {
  display: block; font-size: var(--text-xs, 12px); color: var(--text-muted);
}

/* V33 - Panneau d'info unique du Calendrier : 8 cartes plus petites */
#hm_info_grille .hm-chiffres, #hm_courbe .hm-chiffres { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 6px; }
#hm_info_grille .hm-chiffres .hm-kpi, #hm_courbe .hm-chiffres .hm-kpi { padding: 8px 10px; }
#hm_info_grille .hm-chiffres .hm-kpi b, #hm_courbe .hm-chiffres .hm-kpi b { font-size: var(--text-lg, 17px); }
#hm_info_grille .hm-chiffres .hm-kpi small, #hm_courbe .hm-chiffres .hm-kpi small { font-size: 11px; line-height: 1.25; }

/* V33 - Veille > Indexation : formulaire sur le design system */
.idx-grille { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4, 16px); margin-bottom: var(--space-4, 16px); }
.idx-opt { font-weight: 400; color: var(--text-muted, #6b7280); }
@media (max-width: 640px) { .idx-grille { grid-template-columns: 1fr; } }

/* V33 - Veille > Indexation : suggestions et resultats de recherche */
.idx-sug { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; color: var(--text-strong, #111); cursor: pointer; }
.idx-sug:hover, .idx-sug:focus-visible { background: var(--primary-soft, #eef3ff); outline: none; }
.idx-sug--vide { color: var(--text-muted, #6b7280); cursor: default; }
.idx-sug--vide:hover { background: none; }
.idx-vide { text-align: center; color: var(--text-muted, #6b7280); padding: 24px 12px; font-size: 13px; }
.idx-erreur { color: var(--danger, #dc2626); padding: 12px; font-size: 13px; }
.idx-res { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-subtle, #e5e7eb); border-radius: var(--radius-md, 10px); background: #fff; margin-bottom: 8px; }
.idx-res.is-deja { opacity: .6; background: #fafafa; }
.idx-res .bbp-check { margin-top: 2px; flex-shrink: 0; }
.idx-res__photo { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #f3f4f6; display: block; }
.idx-res__corps { flex: 1; min-width: 0; }
.idx-res__nom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; font-size: 14px; color: var(--text-strong, #111); }
.idx-res__nom label { cursor: pointer; }
.idx-res__meta { font-size: 12px; color: var(--text-muted, #6b7280); margin: 2px 0 4px; }
.idx-res__desc { font-size: 12px; color: var(--text-body, #374151); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* V33 - Veille > Historique et suivi d'indexation */
.hist-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hist-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted, #6b7280); padding: 10px 12px; border-bottom: 1px solid var(--border-subtle, #e5e7eb); white-space: nowrap; }
.hist-table td { padding: 10px 12px; border-bottom: 1px solid #f1f2f4; color: var(--text-body, #374151); vertical-align: middle; }
.hist-table tr:last-child td { border-bottom: 0; }
.hist-table .num { text-align: center; font-variant-numeric: tabular-nums; }
.hist-table .muted, .hist-etab .muted { color: var(--text-muted, #6b7280); font-size: 12px; }
.hist-table .fort, .hist-etab .fort { font-weight: 600; color: var(--text-strong, #111); }
.hist-etab { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f1f2f4; font-size: 13px; }
.hist-etab:last-child { border-bottom: 0; }
/* V44q : Historique en passages */
/* V45b : suggestions du point de référence (Concurrence admin) : récents, Propriétés, Adresses et communes */
.conc-pts { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; z-index: 100; max-height: 340px; overflow-y: auto; padding: 4px;
  background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md, 8px); box-shadow: var(--shadow-md); }
.conc-pts__titre { padding: 8px 10px 4px; font-size: var(--text-xs, 12px); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.conc-pts__item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm, 6px); cursor: pointer; }
.conc-pts__item svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--text-muted); }
.conc-pts__item:hover, .conc-pts__item.is-active { background: var(--ink-50, #f5f6f8); }
.conc-pts__txt { display: flex; flex-direction: column; min-width: 0; color: var(--text-strong); font-size: var(--text-sm, 14px); }
.conc-pts__txt small { color: var(--text-muted); font-size: var(--text-xs, 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conc-pts__vide { padding: 10px; color: var(--text-muted); font-size: var(--text-sm, 14px); }
/* V44x : barre de Concurrence admin alignée sur l'espace client (onglets, puis recherche pleine largeur, tri, Liste / Carte) */
.conc-barre2 { display: flex; flex-direction: column; gap: var(--space-2, 8px); margin-bottom: 10px; }
.conc-barre2__ligne { display: flex; align-items: center; gap: var(--space-2, 8px); flex-wrap: wrap; }
.conc-barre2__recherche { flex: 1 1 260px; min-width: 200px; }
@media (max-width: 640px) {
  .conc-barre2__ligne > .bbp-select-wrap { flex: 1 1 40%; }
}
/* V44v : bouton carré à icône seule (le design system n'en a pas) ; actions de ligne discrètes des listes Concurrence,
   pour réserver le bouton principal bleu à « Enregistrer » et à la barre de sélection */
.bbp-btn.bbp-btn--icone { width: var(--_h); min-width: var(--_h); padding: 0; justify-content: center; }
.bbp-btn--icone.is-ajout { color: var(--primary); }
.bbp-btn--icone.is-ajout:hover:not(:disabled) { background: var(--primary-soft, #eaf1ff); border-color: var(--primary); }
.hist-src { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.hist-src--b { background: #e7f1fb; color: #1d4f91; }
.hist-src--a { background: #fbebeb; color: #a3262b; }
.hist-pb { font-size: 12px; color: #92400e; margin-top: 2px; }
.hist-pbbox { border-left: 3px solid #d97706; padding: 4px 10px; margin: 10px 0; font-size: 13px; }
.hist-pbbox ul { margin: 4px 0 0; padding-left: 18px; }
.hist-table--large { min-width: 760px; }
.hist-quand { white-space: nowrap; }
.hist-note { color: var(--text-muted, #6b7280); font-size: 13px; }

/* V33 - Reglages sur le design system */
.reg-carte { margin-bottom: var(--space-4, 16px); }
.reg-titre { margin-bottom: var(--space-4, 16px); }
.reg-grille { display: grid; gap: var(--space-4, 16px); }
.reg-grille--2 { grid-template-columns: 1fr 1fr; }
.reg-grille--3 { grid-template-columns: repeat(3, 1fr); }
.reg-compteur { display: flex; align-items: center; gap: 10px; }
.reg-compteur__val { font-family: var(--font-mono, monospace); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; min-width: 28px; text-align: center; color: var(--text-strong, #111); }
.reg-aide { display: block; margin-top: var(--space-3, 12px); }
.reg-fichier { font: inherit; font-size: 13px; color: var(--text-body, #374151); padding: 6px 0; }
.reg-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.reg-statut { display: inline-block; font-size: 13px; color: var(--success, #16a34a); }
@media (max-width: 640px) {
  .reg-grille--2 { grid-template-columns: 1fr; }
  .reg-grille--3 { grid-template-columns: 1fr 1fr; }
}

/* V41g : le panneau « Composition du set » commence après le menu (rail 64 px fermé, 260 px ouvert) */
@media (min-width: 768px) {
  #conc_panel_composition { left: 64px; transition: left .45s ease; }
  body.sidebar-open #conc_panel_composition { left: 260px; }
}

/* V44l : barre de multisélection de Concurrence (même présentation que celle du Référentiel), au-dessus du panneau Composition */
#conc_lot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 510; box-sizing: border-box;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  padding-bottom: calc(var(--space-3, 12px) + env(safe-area-inset-bottom, 0px));
  background: var(--surface-card, #fff); border-top: 1px solid var(--border-subtle, #e5e7eb);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
}
.conc-lot-ligne { display: flex; align-items: center; gap: var(--space-2, 8px); flex-wrap: wrap; max-width: 1400px; margin: 0 auto; }
#conc_lot_nb { color: var(--text-strong); font-size: var(--text-sm, 13px); }
.conc-lot-espace { flex: 1 1 auto; }
body.has-conc-panel.has-conc-lot #conc_panel_composition { box-shadow: none !important; border-radius: 0 !important; }
@media (min-width: 768px) {
  #conc_lot { left: 64px; transition: left .45s ease; }
  body.sidebar-open #conc_lot { left: 260px; }
}
@media (max-width: 640px) {
  #conc_lot .bbp-btn { flex: 1 1 40%; }
  #conc_lot_nb { flex: 1 1 100%; }
  .conc-lot-espace { display: none; }
}

/* ---------- V45c : fiche établissement (fiche-etab.js), commune admin et espace client ----------
   Panneau à droite sur ordinateur, feuille du bas sur mobile. z-index : au-dessus de la topbar (1001),
   sous showModal() (9999) pour que les confirmations restent visibles par-dessus. */
.bbp-fiche { position: fixed; inset: 0; z-index: 2000; }
.bbp-fiche__fond { position: absolute; inset: 0; background: rgba(15, 23, 42, .38); opacity: 0; transition: opacity var(--dur, .2s) var(--ease-out, ease); }
.bbp-fiche__panneau { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); display: flex; flex-direction: column;
  background: var(--surface-card); box-shadow: var(--shadow-xl); transform: translateX(100%); transition: transform var(--dur, .2s) var(--ease-out, ease); }
.bbp-fiche.is-ouvert .bbp-fiche__fond { opacity: 1; }
.bbp-fiche.is-ouvert .bbp-fiche__panneau { transform: none; }
body.has-bbp-fiche { overflow: hidden; }
.bbp-fiche__defile { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.bbp-fiche__fermer { position: absolute; top: var(--space-3); right: var(--space-3); z-index: 2; width: 36px; height: 36px; border-radius: var(--radius-pill);
  border: 0; background: rgba(255, 255, 255, .92); color: var(--text-strong); display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm); }
.bbp-fiche__fermer svg { width: 18px; height: 18px; }
.bbp-fiche__fermer:hover { background: var(--white, #fff); }
.bbp-fiche__fermer:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.bbp-fiche__chargement { padding: var(--space-12) var(--space-6); color: var(--text-muted); text-align: center; font-size: var(--text-sm); }
.bbp-fiche__photo { position: relative; aspect-ratio: 16 / 10; background: var(--surface-sunken); overflow: hidden; }
.bbp-fiche__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bbp-fiche__sansphoto { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: var(--text-sm); }
.bbp-fiche__src { position: absolute; left: var(--space-3); bottom: var(--space-3); padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); box-shadow: var(--shadow-sm); }
.bbp-fiche__src--b { background: var(--blue-50); color: var(--blue-700); }
.bbp-fiche__src--a { background: #ffe4e6; color: #be123c; }   /* mêmes couleurs que hmPastilleSource (app.js) */
.bbp-fiche__corps { padding: var(--space-5) var(--space-5) var(--space-6); }
.bbp-fiche__nom { margin: 0; font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--text-strong); line-height: var(--leading-snug, 1.3); }
.bbp-fiche__meta { margin: var(--space-1) 0 0; color: var(--text-muted); font-size: var(--text-sm); }
.bbp-fiche__ligne { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }
.bbp-fiche__ligne .bbp-btn { margin-left: auto; }
.bbp-fiche__muted { color: var(--text-muted); font-size: var(--text-sm); }
.bbp-fiche__section { margin-top: var(--space-6); }
.bbp-fiche__section h3 { margin: 0 0 var(--space-3); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--tracking-caps, .06em); }
.bbp-fiche__section p { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--text-body); line-height: var(--leading-relaxed, 1.55); }
.bbp-fiche__vide { background: var(--surface-sunken); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); color: var(--text-muted) !important; }
.bbp-fiche__tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-3); }
.bbp-fiche__tuile { background: var(--surface-sunken); border-radius: var(--radius-md); padding: var(--space-3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bbp-fiche__tuile b { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.bbp-fiche__tuile span { font-size: var(--text-xs); color: var(--text-muted); }
.bbp-fiche__tuile small { font-size: var(--text-2xs); color: var(--text-faint); }
.bbp-fiche__tuile b small.bbp-fiche__sur { font-size: var(--text-sm); color: var(--text-muted); font-weight: var(--weight-medium); }
.bbp-fiche__liste { margin: 0; padding-left: var(--space-5); font-size: var(--text-sm); color: var(--text-body); }
.bbp-fiche__liste li { margin-bottom: 2px; }
.bbp-fiche__desc { white-space: pre-line; }
.bbp-fiche__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bbp-fiche__chips span { font-size: var(--text-xs); background: var(--surface-sunken); color: var(--text-body); border-radius: var(--radius-pill); padding: 3px 10px; }
/* V46a : Sets d'une fiche (admin) — aperçu dans la fiche et fenêtre complète */
.bbp-fiche__sets { display: flex; flex-direction: column; }
.bbp-fiche__set { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--border-subtle); }
.bbp-fiche__set:first-child { border-top: 0; }
.bbp-fiche__set.is-archive { opacity: .6; }
.bbp-fiche__set-txt { flex: 1; min-width: 0; }
.bbp-fiche__set-nom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); }
.bbp-fiche__set-sous { font-size: var(--text-xs); color: var(--text-muted); margin-top: 1px; overflow-wrap: anywhere; }
.bbp-fsets__outils { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-2); }
.bbp-fsets__outils .bbp-input { flex: 1 1 220px; min-width: 0; }
.bbp-fsets__outils .bbp-select { flex: 0 1 200px; }
.bbp-fsets__liste { max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.bbp-fsets__groupe { padding: var(--space-2) 0; border-top: 1px solid var(--border-subtle); }
.bbp-fsets__groupe:first-child { border-top: 0; }
.bbp-fsets__tete { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-strong); }
.bbp-fsets__tete b { overflow-wrap: anywhere; }
.bbp-fsets__groupe .bbp-fiche__set { padding-left: var(--space-3); border-top: 0; }
.bbp-fsets__pages { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-3); }
.bbp-fsets__pages:empty { display: none; }
.bbp-fiche__pied { padding: var(--space-3) var(--space-5) calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border-subtle); background: var(--surface-card); }
@media (max-width: 720px) {
  .bbp-fiche__panneau { top: auto; left: 0; width: 100%; max-height: 92vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(100%); overflow: hidden; }
  .bbp-fiche__photo { aspect-ratio: 16 / 9; }
}
@media (prefers-reduced-motion: reduce) { .bbp-fiche__panneau, .bbp-fiche__fond { transition: none; } }

/* Vignette des listes (Concurrence admin et espace client) : la ligne entière ouvre la fiche */
.bbp-vignette { width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-sunken); display: block; }
.bbp-vignette--vide { display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.bbp-ligne-fiche { cursor: pointer; transition: background var(--dur-fast, .12s); }
.bbp-ligne-fiche:hover { background: var(--surface-sunken); }
.bbp-ligne-fiche:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--border-focus); }
@media (max-width: 520px) { .bbp-vignette { width: 48px; height: 48px; } }

/* ---------- V45e : case à cocher du design system sans habillage HTML (input seul) ----------
   Même rendu que .bbp-check__box (vanilla.css), avec l'état « en partie » (input.indeterminate) pour les cases de groupe.
   Couleur modifiable par case : style="--cb: #FF5A5F" (Airbnb). */
input[type="checkbox"].bbp-cb {
  -webkit-appearance: none; appearance: none; flex: none; box-sizing: border-box;
  width: 20px; height: 20px; margin: 0; cursor: pointer; vertical-align: middle;
  border: 1.5px solid var(--border-strong); border-radius: 6px; background: var(--surface-card) no-repeat center / 14px 14px;
  transition: background-color var(--dur-fast, .12s) var(--ease-out, ease), border-color var(--dur-fast, .12s) var(--ease-out, ease);
}
input[type="checkbox"].bbp-cb:hover:not(:disabled) { border-color: var(--ink-400); }
input[type="checkbox"].bbp-cb:checked,
input[type="checkbox"].bbp-cb:indeterminate { background-color: var(--cb, var(--primary)); border-color: var(--cb, var(--primary)); }
input[type="checkbox"].bbp-cb:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
input[type="checkbox"].bbp-cb:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E");
}
input[type="checkbox"].bbp-cb:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
input[type="checkbox"].bbp-cb:disabled { opacity: .5; cursor: not-allowed; }

/* V46c : page « Connexions » (admin Settings › Sécurité, espace client › Compte) */
.cx { display: flex; flex-direction: column; gap: var(--space-5); }
.cx-bloc h3 { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); }
.cx-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-2); }
.cx-muted { margin: 2px 0 0; color: var(--text-muted); font-size: var(--text-xs); }
.cx-vide { margin: 0; background: var(--surface-sunken); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); color: var(--text-muted); font-size: var(--text-sm); }
.cx-liste { display: flex; flex-direction: column; }
.cx-ligne { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--border-subtle); }
.cx-ligne:first-child { border-top: 0; }
.cx-txt { flex: 1; min-width: 0; }
.cx-nom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); }
.cx-sous { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; }
.cx-pages { display: flex; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-3); flex-wrap: wrap; }
.cx-credit { margin: 0; font-size: var(--text-2xs, 11px); color: var(--text-faint); }
.cx-credit a { color: inherit; }
.cx-msg { margin: 0; font-size: var(--text-sm); }
.cx-msg:empty { display: none; }
.cx-msg.is-ok { color: var(--green-700, #15803d); }
.cx-msg.is-err { color: var(--danger, #dc2626); }
/* V46c : bloc « Mon compte » repliable en haut d'Administration › Journal */
.adm-moncompte { margin-bottom: var(--space-4, 16px); }
.adm-moncompte > summary { cursor: pointer; font-weight: var(--weight-semibold); color: var(--text-strong); list-style-position: inside; }
.adm-moncompte > summary span { font-weight: var(--weight-regular, 400); color: var(--text-muted); font-size: var(--text-sm); }
.adm-check-moi { white-space: nowrap; }   /* V46e */
/* V46f : changer son mot de passe (espace client › Compte) */
.esp-cmdp__titre { margin: 0 0 var(--space-3, 12px); font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); }
.esp-cmdp { display: flex; flex-direction: column; gap: var(--space-3, 12px); max-width: 420px; }
.esp-cmdp__note { margin: 0; font-size: var(--text-xs); color: var(--text-muted); }
.esp-cmdp__msg { margin: 0; font-size: var(--text-sm); }
.esp-cmdp__msg:empty { display: none; }
.esp-cmdp__msg.is-ok { color: var(--green-700, #15803d); }
.esp-cmdp__msg.is-err { color: var(--danger, #dc2626); font-weight: var(--weight-semibold); }
#compte_rub_mdp[hidden], #compte_rub_connexions[hidden], #compte_rub_profil[hidden] { display: none !important; }   /* V46g, V47b */

/* V47b : menu du compte en haut à droite (compte-ui.js), commun à l'espace client et à l'administration */
.bbp-compte { position: relative; }
.bbp-compte__btn { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--border-subtle, #e4e7eb);
  border-radius: 999px; background: var(--surface-card, #fff); color: var(--text-strong); font: inherit; font-weight: var(--weight-semibold, 600); cursor: pointer; }
.bbp-compte__btn:hover { background: var(--ink-50, #f5f6f8); }
.bbp-compte__btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.bbp-compte__btn .bbp-avatar { --_s: 28px; }
.bbp-compte__prenom { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bbp-compte__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; max-width: calc(100vw - 32px); z-index: 50;
  background: var(--surface-card, #fff); border: 1px solid var(--border-subtle, #e4e7eb); border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-lg); padding: 6px; }
.bbp-compte__tete { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border-subtle, #e4e7eb); margin-bottom: 6px; }
.bbp-compte__tete .bbp-avatar { --_s: 36px; }
.bbp-compte__nom { font-weight: var(--weight-semibold, 600); color: var(--text-strong); }
.bbp-compte__email { font-size: var(--text-xs, 12px); color: var(--text-muted); word-break: break-all; }
.bbp-compte__item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--radius-md, 10px);
  background: none; color: var(--text-body); font: inherit; font-size: var(--text-sm, 14px); text-decoration: none; cursor: pointer; }
.bbp-compte__item:hover, .bbp-compte__item:focus-visible { background: var(--ink-50, #f5f6f8); outline: none; color: var(--text-strong); }
.bbp-compte__item--sortie { color: var(--danger, #dc2626); }
.bbp-compte__sep { height: 1px; background: var(--border-subtle, #e4e7eb); margin: 6px 0; }
@media (max-width: 640px) { .bbp-compte__prenom { display: none; } .bbp-compte__btn { padding: 3px; } .bbp-compte__btn > svg { display: none; } }
/* V47c : dans la barre du haut de l'admin, le menu du compte ne doit pas être coupé (overflow-x: auto sur mobile) */
.topbar-menu:has(.bbp-compte) { overflow: visible; }
.topbar-menu .bbp-compte { margin-left: auto; }
