/* =====================================================================
   BCG_GESTION — Design de l'application (s'appuie sur Bootstrap 5.3)
   Les couleurs viennent du thème actif (App\Support\Theme → <style id="bcg-theme">) ;
   les valeurs ci-dessous ne servent qu'en secours (pages d'impression, thème absent).
   ===================================================================== */
:root {
  --bcg-primaire: #4f46e5; --bcg-primaire-rgb: 79, 70, 229; --bcg-primaire-fonce: #4239c0; --bcg-primaire-clair: #edecfc;
  --bcg-primaire-texte: #4f46e5; --bcg-sur-primaire: #fff; --bcg-accent: #f59e0b; --bcg-sur-accent: #111827;
  --bcg-fond: #f5f6fa; --bcg-surface: #fff; --bcg-surface-2: #f8f9fc; --bcg-surface-3: #eef0f5;
  --bcg-bordure: #e6e8ef; --bcg-texte: #1d2433; --bcg-texte-doux: #667085;
  --bcg-ombre: 0 1px 2px rgba(16,24,40,.04), 0 2px 8px rgba(16,24,40,.06); --bcg-ombre-forte: 0 12px 32px rgba(16,24,40,.14);
  --bcg-succes: #067647; --bcg-succes-fond: #e7f6ed; --bcg-danger: #b42318; --bcg-danger-fond: #fdecec;
  --bcg-avert: #93590a; --bcg-avert-fond: #fef3dc; --bcg-info: #0b6aa2; --bcg-info-fond: #e5f2fa;
  --bcg-neutre: #475467; --bcg-neutre-fond: #eef0f4; --bcg-surbrillance: #fff6d6;
  --bcg-menu-fond: #fff; --bcg-menu-texte: #475467; --bcg-menu-texte-actif: #4f46e5; --bcg-menu-actif: #edecfc;
  --bcg-menu-survol: #f8f9fc; --bcg-menu-groupe: #98a2b3; --bcg-menu-bordure: #e6e8ef; --bcg-menu-repere: #4f46e5;

  --bcg-sidebar-largeur: 264px;
  --bcg-rayon: .75rem;
  --bcg-rayon-petit: .55rem;
  --bcg-transition: .15s ease;
}

/* Bootstrap suit le thème */
:root, [data-bs-theme] {
  --bs-primary: var(--bcg-primaire);
  --bs-primary-rgb: var(--bcg-primaire-rgb);
  --bs-body-bg: var(--bcg-fond);
  --bs-body-color: var(--bcg-texte);
  --bs-secondary-color: var(--bcg-texte-doux);
  --bs-tertiary-bg: var(--bcg-surface-2);
  --bs-border-color: var(--bcg-bordure);
  --bs-border-radius: var(--bcg-rayon-petit);
  --bs-border-radius-lg: var(--bcg-rayon);
  --bs-link-color: var(--bcg-primaire-texte);
  --bs-link-hover-color: var(--bcg-primaire-fonce);
  --bs-link-color-rgb: var(--bcg-primaire-rgb);
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-focus-ring-color: rgba(var(--bcg-primaire-rgb), .25);
}

body { font-size: .925rem; background: var(--bcg-fond); color: var(--bcg-texte); -webkit-font-smoothing: antialiased; }
::selection { background: rgba(var(--bcg-primaire-rgb), .2); }
a { color: var(--bcg-primaire-texte); }
.text-secondary { color: var(--bcg-texte-doux) !important; }
.small, small { font-size: .82em; }
kbd { font-size: .72em; background: var(--bcg-surface-3); color: var(--bcg-texte); box-shadow: inset 0 -1px 0 var(--bcg-bordure); }

/* ---------- Boutons */
.btn { font-weight: 500; border-radius: var(--bcg-rayon-petit); transition: background var(--bcg-transition), border-color var(--bcg-transition), box-shadow var(--bcg-transition); }
.btn-primary { --bs-btn-bg: var(--bcg-primaire); --bs-btn-border-color: var(--bcg-primaire); --bs-btn-color: var(--bcg-sur-primaire);
  --bs-btn-hover-bg: var(--bcg-primaire-fonce); --bs-btn-hover-border-color: var(--bcg-primaire-fonce); --bs-btn-hover-color: var(--bcg-sur-primaire);
  --bs-btn-active-bg: var(--bcg-primaire-fonce); --bs-btn-active-border-color: var(--bcg-primaire-fonce); --bs-btn-active-color: var(--bcg-sur-primaire);
  --bs-btn-disabled-bg: var(--bcg-primaire); --bs-btn-disabled-border-color: var(--bcg-primaire); --bs-btn-disabled-color: var(--bcg-sur-primaire);
  box-shadow: 0 1px 2px rgba(16,24,40,.08), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-outline-primary { --bs-btn-color: var(--bcg-primaire-texte); --bs-btn-border-color: var(--bcg-primaire); --bs-btn-hover-bg: var(--bcg-primaire);
  --bs-btn-hover-border-color: var(--bcg-primaire); --bs-btn-hover-color: var(--bcg-sur-primaire); --bs-btn-active-bg: var(--bcg-primaire);
  --bs-btn-active-border-color: var(--bcg-primaire); --bs-btn-active-color: var(--bcg-sur-primaire); }
.btn-light { --bs-btn-bg: var(--bcg-surface); --bs-btn-border-color: var(--bcg-bordure); --bs-btn-color: var(--bcg-texte);
  --bs-btn-hover-bg: var(--bcg-surface-2); --bs-btn-hover-border-color: var(--bcg-bordure); --bs-btn-hover-color: var(--bcg-texte);
  --bs-btn-active-bg: var(--bcg-surface-3); --bs-btn-active-border-color: var(--bcg-bordure); --bs-btn-active-color: var(--bcg-texte); }
.btn-outline-secondary { --bs-btn-color: var(--bcg-texte); --bs-btn-border-color: var(--bcg-bordure); --bs-btn-hover-bg: var(--bcg-surface-2);
  --bs-btn-hover-color: var(--bcg-texte); --bs-btn-hover-border-color: var(--bcg-bordure); --bs-btn-active-bg: var(--bcg-surface-3); --bs-btn-active-color: var(--bcg-texte); }
.btn-success { --bs-btn-bg: #12b76a; --bs-btn-border-color: #12b76a; --bs-btn-hover-bg: #039855; --bs-btn-hover-border-color: #039855;
  --bs-btn-disabled-bg: #12b76a; --bs-btn-disabled-border-color: #12b76a; }
.btn-link { --bs-btn-color: var(--bcg-primaire-texte); --bs-btn-hover-color: var(--bcg-primaire-fonce); }
.btn-icon { width: 2.25rem; height: 2.25rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.bcg-btn-fantome { --bs-btn-color: var(--bcg-texte); --bs-btn-hover-bg: var(--bcg-surface-2); --bs-btn-active-bg: var(--bcg-surface-3);
  --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; --bs-btn-active-border-color: transparent; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: rgba(var(--bcg-primaire-rgb), .6); box-shadow: 0 0 0 .22rem rgba(var(--bcg-primaire-rgb), .18); }

/* ---------- Structure : menu latéral */
.bcg-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--bcg-sidebar-largeur); background: var(--bcg-menu-fond);
  color: var(--bcg-menu-texte); overflow-y: auto; z-index: 1030; transition: transform .2s; border-right: 1px solid var(--bcg-menu-bordure);
  scrollbar-width: thin; scrollbar-color: var(--bcg-menu-bordure) transparent; }
.bcg-sidebar .marque { display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.25rem 1rem; color: var(--bcg-menu-texte-actif);
  font-weight: 800; font-size: 1.05rem; text-decoration: none; letter-spacing: -.01em; }
.bcg-sidebar .marque .slogan { display: block; font-size: .72rem; font-weight: 500; color: var(--bcg-menu-groupe); letter-spacing: 0; }
.bcg-sidebar .marque .logo { width: 2.3rem; height: 2.3rem; border-radius: .7rem; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--bcg-primaire), var(--bcg-accent)); color: #fff; box-shadow: 0 4px 12px rgba(var(--bcg-primaire-rgb), .35); flex-shrink: 0; }
.bcg-sidebar .marque .logo-image { width: 2.3rem; height: 2.3rem; object-fit: contain; border-radius: .6rem; background: #fff; }
.bcg-sidebar nav { padding: 0 .75rem; }
.bcg-sidebar .groupe { padding: 1.1rem .75rem .4rem; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--bcg-menu-groupe); }
.bcg-sidebar .nav-link { color: var(--bcg-menu-texte); padding: .5rem .75rem; margin: 1px 0; display: flex; align-items: center; gap: .7rem;
  border-radius: var(--bcg-rayon-petit); font-weight: 500; position: relative; transition: background var(--bcg-transition), color var(--bcg-transition); }
.bcg-sidebar .nav-link:hover { color: var(--bcg-menu-texte-actif); background: var(--bcg-menu-survol); }
.bcg-sidebar .nav-link.active { color: var(--bcg-menu-texte-actif); background: var(--bcg-menu-actif); font-weight: 600; }
.bcg-sidebar .nav-link.active::before { content: ""; position: absolute; left: -.75rem; top: .45rem; bottom: .45rem; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--bcg-menu-repere); }
.bcg-sidebar .nav-link .bi { font-size: 1.1rem; width: 1.25rem; text-align: center; opacity: .9; }

.bcg-main { margin-left: var(--bcg-sidebar-largeur); min-height: 100vh; display: flex; flex-direction: column; }
.bcg-topbar { height: var(--bcg-topbar-h, 64px); background: color-mix(in srgb, var(--bcg-surface) 85%, transparent); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--bcg-bordure); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 1020; }
.bcg-contenu { padding: 1.75rem var(--bcg-marge-page, 2rem) 2.5rem; flex: 1; width: 100%; max-width: var(--bcg-largeur-max, 1680px); margin: 0 auto; }
.bcg-tuile { width: 2.1rem; height: 2.1rem; border-radius: var(--bcg-rayon-petit); background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte);
  display: inline-grid; place-items: center; flex-shrink: 0; }
.bcg-menu-themes { min-width: 16rem; }
.bcg-pastille { width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--p); flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--bcg-surface), 0 0 0 3px var(--bcg-bordure); }
.bcg-pastille[data-sombre="1"] { background: conic-gradient(var(--p) 0 50%, #161a22 50% 100%); }

@media (max-width: 991.98px) {
  .bcg-sidebar { transform: translateX(-100%); }
  .bcg-sidebar.ouverte { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .bcg-main { margin-left: 0; }
  .bcg-topbar { padding: 0 1rem; }
  .bcg-contenu { padding: 1rem; }
}

/* ---------- En-tête de page */
.bcg-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.bcg-page-header h1 { font-size: 1.6rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.bcg-page-header .sous-titre { color: var(--bcg-texte-doux); margin: .25rem 0 0; }
.bcg-page-header .breadcrumb { font-size: .78rem; margin-bottom: .4rem; --bs-breadcrumb-divider-color: var(--bcg-texte-doux); }
.bcg-page-header .breadcrumb a { color: var(--bcg-texte-doux); text-decoration: none; }
.bcg-page-header .breadcrumb a:hover { color: var(--bcg-primaire-texte); }
.bcg-page-header .breadcrumb-item.active { color: var(--bcg-texte); }

/* ---------- Cartes */
.card { --bs-card-bg: var(--bcg-surface); --bs-card-border-color: var(--bcg-bordure); --bs-card-cap-bg: var(--bcg-surface);
  border-radius: var(--bcg-rayon); box-shadow: var(--bcg-ombre); }
.card-header { font-weight: 700; padding: 1rem 1.25rem; border-bottom-color: var(--bcg-bordure); }
.card-header:first-child { border-radius: var(--bcg-rayon) var(--bcg-rayon) 0 0; }
.card-body { padding: 1.25rem; }
.list-group { --bs-list-group-bg: var(--bcg-surface); --bs-list-group-border-color: var(--bcg-bordure); --bs-list-group-color: var(--bcg-texte);
  --bs-list-group-action-hover-bg: var(--bcg-surface-2); --bs-list-group-action-hover-color: var(--bcg-texte);
  --bs-list-group-active-bg: var(--bcg-primaire); --bs-list-group-active-border-color: var(--bcg-primaire); }

.bcg-kpi { padding: 1.15rem 1.25rem; transition: transform var(--bcg-transition), box-shadow var(--bcg-transition); }
a.bcg-kpi:hover { transform: translateY(-2px); box-shadow: var(--bcg-ombre-forte); }
.bcg-kpi .libelle { color: var(--bcg-texte-doux); font-size: .8rem; font-weight: 500; }
.bcg-kpi .valeur { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bcg-kpi .bcg-avatar { border-radius: var(--bcg-rayon); }

/* ---------- Onglets de filtre */
.bcg-onglets { display: flex; gap: .25rem; border-bottom: 1px solid var(--bcg-bordure); padding: .5rem 1rem 0; overflow-x: auto; }
.bcg-onglets a { padding: .65rem .85rem; color: var(--bcg-texte-doux); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
  font-weight: 600; font-size: .88rem; margin-bottom: -1px; transition: color var(--bcg-transition); }
.bcg-onglets a:hover { color: var(--bcg-texte); }
.bcg-onglets a.active { color: var(--bcg-primaire-texte); border-bottom-color: var(--bcg-primaire); }
.bcg-onglets .compteur { background: var(--bcg-surface-3); color: var(--bcg-texte-doux); border-radius: 1rem; padding: .05rem .5rem; font-size: .72rem; margin-left: .35rem; font-weight: 600; }
.bcg-onglets a.active .compteur { background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte); }

/* ---------- Barre de filtres */
.bcg-filtres { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: 1rem 1.25rem; }
.bcg-filtres .recherche { position: relative; flex: 1 1 240px; max-width: 380px; }
.bcg-filtres .recherche .bi { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--bcg-texte-doux); }
.bcg-filtres .recherche input { padding-left: 2.3rem; }
.bcg-filtres .form-select { width: auto; }

/* ---------- Tableaux */
.table { --bs-table-bg: transparent; --bs-table-color: var(--bcg-texte); --bs-table-border-color: var(--bcg-bordure);
  --bs-table-hover-bg: var(--bcg-surface-2); --bs-table-hover-color: var(--bcg-texte); --bs-table-striped-bg: var(--bcg-surface-2); }
.table-light { --bs-table-bg: var(--bcg-surface-2); --bs-table-color: var(--bcg-texte); --bs-table-border-color: var(--bcg-bordure); }
.bcg-table { margin: 0; }
.bcg-table thead th { background: var(--bcg-surface-2); color: var(--bcg-texte-doux); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; border-bottom: 1px solid var(--bcg-bordure); border-top: 1px solid var(--bcg-bordure); white-space: nowrap; padding: .7rem 1.25rem; }
.bcg-table tbody td { padding: .85rem 1.25rem; vertical-align: middle; border-color: var(--bcg-bordure); }
.bcg-table tbody tr { transition: background var(--bcg-transition); }
.bcg-table tbody tr:hover > td { background: var(--bcg-surface-2); }
.bcg-table tbody tr:last-child td { border-bottom: 0; }
.bcg-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bcg-table th a { color: inherit; text-decoration: none; }
.bcg-table th a:hover { color: var(--bcg-primaire-texte); }
.bcg-table .actions { width: 1%; white-space: nowrap; text-align: right; }
.bcg-table-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .85rem 1.25rem; border-top: 1px solid var(--bcg-bordure); color: var(--bcg-texte-doux); font-size: .85rem; }
.bcg-table-footer .pagination { margin: 0; }
.pagination { --bs-pagination-bg: var(--bcg-surface); --bs-pagination-border-color: var(--bcg-bordure); --bs-pagination-color: var(--bcg-texte);
  --bs-pagination-hover-bg: var(--bcg-surface-2); --bs-pagination-hover-color: var(--bcg-primaire-texte); --bs-pagination-hover-border-color: var(--bcg-bordure);
  --bs-pagination-active-bg: var(--bcg-primaire); --bs-pagination-active-border-color: var(--bcg-primaire); --bs-pagination-active-color: var(--bcg-sur-primaire);
  --bs-pagination-disabled-bg: var(--bcg-surface); --bs-pagination-disabled-border-color: var(--bcg-bordure); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(var(--bcg-primaire-rgb), .2); }

/* ---------- Avatars / identité */
.bcg-avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte);
  display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.bcg-avatar-plein { background: linear-gradient(135deg, var(--bcg-primaire), var(--bcg-primaire-fonce)); color: var(--bcg-sur-primaire); }
.bcg-identite { display: flex; align-items: center; gap: .8rem; }
.bcg-identite .bcg-avatar { border-radius: var(--bcg-rayon-petit); }
.bcg-identite .nom { font-weight: 600; color: var(--bcg-texte); text-decoration: none; }
.bcg-identite .nom:hover { color: var(--bcg-primaire-texte); }
.bcg-identite .detail { color: var(--bcg-texte-doux); font-size: .8rem; }

/* ---------- Badges de statut (pastille + point) */
.badge { font-weight: 600; padding: .38em .7em; border-radius: 2rem; font-size: .72rem; letter-spacing: .01em; }
[class*="badge-soft-"] { display: inline-flex; align-items: center; gap: .35em; }
[class*="badge-soft-"]::before { content: ""; width: .42em; height: .42em; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-soft-success { background: var(--bcg-succes-fond); color: var(--bcg-succes); }
.badge-soft-danger { background: var(--bcg-danger-fond); color: var(--bcg-danger); }
.badge-soft-warning { background: var(--bcg-avert-fond); color: var(--bcg-avert); }
.badge-soft-info { background: var(--bcg-info-fond); color: var(--bcg-info); }
.badge-soft-primary { background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte); }
.badge-soft-secondary { background: var(--bcg-neutre-fond); color: var(--bcg-neutre); }
.text-success { color: var(--bcg-succes) !important; }
.text-danger { color: var(--bcg-danger) !important; }
.text-warning { color: var(--bcg-avert) !important; }

/* ---------- Alertes */
.alert { border-radius: var(--bcg-rayon); border-width: 1px; }
.alert-success { --bs-alert-bg: var(--bcg-succes-fond); --bs-alert-color: var(--bcg-succes); --bs-alert-border-color: transparent; }
.alert-danger { --bs-alert-bg: var(--bcg-danger-fond); --bs-alert-color: var(--bcg-danger); --bs-alert-border-color: transparent; }
.alert-warning { --bs-alert-bg: var(--bcg-avert-fond); --bs-alert-color: var(--bcg-avert); --bs-alert-border-color: transparent; }
.alert-info { --bs-alert-bg: var(--bcg-info-fond); --bs-alert-color: var(--bcg-info); --bs-alert-border-color: transparent; }

/* ---------- État vide */
.bcg-vide { text-align: center; padding: 2.5rem 1rem; color: var(--bcg-texte-doux); }
.bcg-vide .bi { font-size: 1.6rem; display: inline-grid; place-items: center; width: 3.5rem; height: 3.5rem; margin-bottom: .75rem;
  border-radius: 1rem; background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte); }
.bcg-vide .fw-semibold { color: var(--bcg-texte); }

/* ---------- Formulaires & modales */
.form-control, .form-select { --bs-body-bg: var(--bcg-surface); border-color: var(--bcg-bordure); border-radius: var(--bcg-rayon-petit);
  background-color: var(--bcg-surface); color: var(--bcg-texte); padding-top: .48rem; padding-bottom: .48rem; }
.form-control::placeholder { color: var(--bcg-texte-doux); opacity: .75; }
.form-control:disabled, .form-select:disabled { background-color: var(--bcg-surface-2); }
.input-group-text { background: var(--bcg-surface-2); border-color: var(--bcg-bordure); color: var(--bcg-texte-doux); border-radius: var(--bcg-rayon-petit); }
.form-label { font-weight: 600; font-size: .82rem; margin-bottom: .35rem; color: var(--bcg-texte); }
.form-label .requis { color: var(--bcg-danger); margin-left: .15rem; }
.form-text { font-size: .76rem; color: var(--bcg-texte-doux); }
.form-check-input { border-color: var(--bcg-bordure); background-color: var(--bcg-surface); }
.form-check-input:checked { background-color: var(--bcg-primaire); border-color: var(--bcg-primaire); }
.modal { --bs-modal-bg: var(--bcg-surface); --bs-modal-border-color: var(--bcg-bordure); --bs-modal-border-radius: 1rem; --bs-modal-header-border-color: var(--bcg-bordure);
  --bs-modal-footer-border-color: var(--bcg-bordure); --bs-modal-box-shadow: var(--bcg-ombre-forte); }
.modal-header { padding: 1.1rem 1.5rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { background: var(--bcg-surface-2); border-radius: 0 0 1rem 1rem; padding: .85rem 1.5rem; }
.modal-title { font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; }
.modal-backdrop { --bs-backdrop-bg: #0b0f19; --bs-backdrop-opacity: .45; }
.dropdown-menu { --bs-dropdown-bg: var(--bcg-surface); --bs-dropdown-border-color: var(--bcg-bordure); --bs-dropdown-link-color: var(--bcg-texte);
  --bs-dropdown-link-hover-bg: var(--bcg-surface-2); --bs-dropdown-link-hover-color: var(--bcg-texte); --bs-dropdown-link-active-bg: var(--bcg-primaire-clair);
  --bs-dropdown-link-active-color: var(--bcg-primaire-texte); --bs-dropdown-divider-bg: var(--bcg-bordure); --bs-dropdown-border-radius: var(--bcg-rayon);
  --bs-dropdown-item-border-radius: var(--bcg-rayon-petit); --bs-dropdown-box-shadow: var(--bcg-ombre-forte); box-shadow: var(--bcg-ombre-forte); padding: .4rem; }
.dropdown-item { border-radius: var(--bcg-rayon-petit); padding: .45rem .7rem; }
.bcg-section-form { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bcg-primaire-texte); font-weight: 700;
  margin: 1.4rem 0 .8rem; padding-bottom: .45rem; border-bottom: 1px solid var(--bcg-bordure); }
.bcg-section-form:first-child { margin-top: 0; }
.nav-tabs { --bs-nav-tabs-border-color: var(--bcg-bordure); --bs-nav-tabs-link-active-bg: var(--bcg-surface); --bs-nav-tabs-link-active-color: var(--bcg-primaire-texte);
  --bs-nav-tabs-link-active-border-color: var(--bcg-bordure) var(--bcg-bordure) var(--bcg-surface); --bs-nav-link-color: var(--bcg-texte-doux); }

/* ---------- Fiche (page détail) */
.bcg-fiche dt { color: var(--bcg-texte-doux); font-weight: 500; font-size: .78rem; }
.bcg-fiche dd { margin-bottom: .85rem; font-weight: 500; }
.text-pre-wrap { white-space: pre-wrap; }

/* ---------- Pièces commerciales : l'aperçu reste une feuille blanche, quel que soit le thème */
.bcg-papier { padding: 2rem 2.25rem; font-size: .9rem; background: #fff; color: #1d2433; border-radius: var(--bcg-rayon); }
.bcg-papier .text-secondary { color: #667085 !important; }
.bcg-papier .table { --bs-table-color: #1d2433; --bs-table-border-color: #e6e8ef; }
.bcg-papier-titre { font-size: 1.5rem; font-weight: 800; color: var(--bcg-primaire); letter-spacing: .04em; }
.bcg-papier-destinataire { border: 1px solid #e6e8ef; border-radius: var(--bcg-rayon); padding: .75rem 1rem; }
.bcg-papier-table thead th { background: var(--bcg-primaire); color: var(--bcg-sur-primaire); font-weight: 600; font-size: .78rem; border: 0; }
.bcg-papier-table .num, .bcg-papier-totaux .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bcg-papier-ttc td { background: color-mix(in srgb, var(--bcg-primaire) 10%, #fff) !important; }
.bcg-lignes td { vertical-align: top; padding: .5rem; }
.bcg-totaux .num { text-align: right; font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bcg-lignes { min-width: 1000px; }
.bcg-lignes select[data-champ="unite_id"] { min-width: 4.75rem; }
.bcg-lignes select[data-champ="taxe_id"] { min-width: 7.5rem; }

/* ---------- Choix exclusif sur une ligne */
.bcg-choix { display: flex; flex-wrap: wrap; gap: .4rem; }
.bcg-choix .btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .65rem; font-size: .86rem; white-space: nowrap; border-radius: var(--bcg-rayon-petit); }
.btn-check:checked + .btn-outline-primary { background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte); border-color: var(--bcg-primaire); }

/* ---------- Caisse (vente au comptoir) */
.bcg-caisse #scan { font-size: 1.15rem; }
.bcg-caisse-suggestions { z-index: 20; top: 100%; max-height: 22rem; overflow-y: auto; border-radius: var(--bcg-rayon); }
.bcg-caisse td input[type=number] { min-width: 3.5rem; }
@media (max-width: 575.98px) { .bcg-caisse th[style*='9.5rem'] { width: 5rem !important; } }
.bcg-caisse-paiement { position: sticky; top: 5rem; }
.bcg-caisse-total { background: linear-gradient(135deg, var(--bcg-primaire), var(--bcg-primaire-fonce)); color: var(--bcg-sur-primaire);
  border-radius: var(--bcg-rayon); padding: 1rem 1.15rem; box-shadow: 0 8px 20px rgba(var(--bcg-primaire-rgb), .3); }
.bcg-caisse-total .text-secondary { color: inherit !important; opacity: .75; }
.bcg-caisse-total .montant { font-size: 2.2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bcg-caisse-total .montant small { font-size: 1rem; font-weight: 600; }
.bcg-caisse-mode { min-width: 7.5rem; }
.bcg-caisse-reste { font-size: 1.1rem; padding-top: .6rem; border-top: 1px dashed var(--bcg-bordure); }
.bcg-caisse-flash td { background: var(--bcg-surbrillance) !important; transition: background .3s; }
.bcg-caisse-boutons { display: flex; flex-wrap: wrap; gap: .4rem; }
.bcg-caisse-boutons .btn { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; padding: .32rem .6rem; }
@media (max-width: 1599.98px) { .bcg-caisse-boutons .btn kbd { display: none !important; } }
.bcg-caisse-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .6rem; }
.bcg-caisse-grille button { text-align: left; border: 1px solid var(--bcg-bordure); border-radius: var(--bcg-rayon); background: var(--bcg-surface); color: var(--bcg-texte);
  padding: .7rem .8rem; min-height: 5.5rem; display: flex; flex-direction: column; justify-content: space-between; transition: all var(--bcg-transition); }
.bcg-caisse-grille button:hover, .bcg-caisse-grille button:focus-visible { border-color: var(--bcg-primaire); background: var(--bcg-primaire-clair); transform: translateY(-1px); }
.bcg-caisse-grille .prix { font-weight: 800; color: var(--bcg-primaire-texte); }

/* ---------- Lecteur caméra (codes-barres / QR) */
.bcg-lecteur-video { width: 100%; min-height: 220px; background: #111; border-radius: var(--bcg-rayon); overflow: hidden; }
.bcg-lecteur-video video { width: 100% !important; height: auto !important; }
.bcg-apercu-code { min-height: 3.2rem; }
.bcg-apercu-code svg { max-width: 100%; height: auto; }
.bcg-apercu-code svg rect[style*="fill:#ffffff"], .bcg-apercu-code [data-apercu-qr] svg { background: #fff; border-radius: 4px; }

/* ---------- Choix du thème (Paramètres › Apparence) */
.bcg-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .75rem; }
.bcg-theme-carte { cursor: pointer; border: 2px solid var(--bcg-bordure); border-radius: var(--bcg-rayon); overflow: hidden; background: var(--bcg-surface); transition: border-color var(--bcg-transition), transform var(--bcg-transition); }
.bcg-theme-carte:hover { transform: translateY(-2px); }
.btn-check:checked + .bcg-theme-carte { border-color: var(--bcg-primaire); box-shadow: 0 0 0 3px rgba(var(--bcg-primaire-rgb), .2); }
.bcg-theme-carte .apercu { display: flex; height: 4.5rem; }
.bcg-theme-carte .apercu .m { width: 30%; }
.bcg-theme-carte .apercu .c { flex: 1; padding: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.bcg-theme-carte .apercu .c i { display: block; height: .4rem; border-radius: 1rem; }
.bcg-theme-carte .nom { padding: .45rem .6rem; font-size: .82rem; font-weight: 600; border-top: 1px solid var(--bcg-bordure); }

/* ---------- Page de connexion */
.bcg-connexion { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bcg-surface); }
.bcg-connexion .visuel { background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.18), transparent 45%),
  linear-gradient(140deg, var(--bcg-primaire), var(--bcg-primaire-fonce) 60%, #0b0f19); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.bcg-connexion .visuel .logo { width: 3rem; height: 3rem; border-radius: .9rem; background: rgba(255,255,255,.15); display: grid; place-items: center; font-weight: 800; font-size: 1.3rem; }
.bcg-connexion .visuel h2 { font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; max-width: 26rem; }
.bcg-connexion .visuel li { margin-bottom: .55rem; opacity: .9; }
.bcg-connexion .formulaire { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.bcg-connexion .formulaire > div { width: 100%; max-width: 380px; }
@media (max-width: 991.98px) { .bcg-connexion { grid-template-columns: 1fr; } .bcg-connexion .visuel { display: none; } }

/* Mode sombre : quelques composants Bootstrap restés clairs */
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }
[data-bs-theme="dark"] .bcg-lecteur-video { background: #000; }
@media print { .bcg-sidebar, .bcg-topbar { display: none !important; } .bcg-main { margin: 0; } body { background: #fff; } }
[data-bs-theme="dark"] input::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); }
[data-bs-theme="dark"] .form-control-color { background: var(--bcg-surface); }
.bcg-lignes input[data-champ="quantite"] { min-width: 4.75rem; }
.bcg-lignes input[data-champ="prix_unitaire"] { min-width: 7.5rem; }
.bcg-lignes input[data-champ="remise_pct"] { min-width: 4.5rem; }

/* ---------- Comptage du tiroir (billets et pièces) */
.bcg-comptage { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .5rem; }
.bcg-coupure { display: flex; align-items: center; gap: .4rem; background: var(--bcg-surface-2); border: 1px solid var(--bcg-bordure);
  border-radius: var(--bcg-rayon-petit); padding: .3rem .45rem; margin: 0; }
.bcg-coupure .valeur { font-weight: 700; min-width: 4rem; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.bcg-coupure .fois { color: var(--bcg-texte-doux); }
.bcg-coupure input { min-width: 0; }
.bcg-mouvements-liste { max-height: 12rem; overflow-y: auto; }

/* ---------- Icônes colorées (couleur nommée : config/bcg.php → apparence.couleurs_icones) */
.bcg-icone-couleur { --c: var(--bcg-primaire); display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: .45rem;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); flex-shrink: 0; }
.bcg-icone-couleur .bi { font-size: .95rem; line-height: 1; }
.bcg-caisse-boutons .btn:hover .bcg-icone-couleur { background: var(--c); color: #fff; }
.bcg-caisse-boutons .btn { padding-left: .35rem; }

/* ================================================================ Messagerie */
.bcg-messagerie { display: grid; grid-template-columns: minmax(16rem, 22rem) 1fr; gap: 1rem; height: calc(100vh - 12.5rem); min-height: 28rem; }
.bcg-messagerie > .card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.bcg-conversations .list-group { overflow-y: auto; flex: 1; }
.bcg-conv { border-left: 3px solid transparent; padding: .7rem .9rem; }
.bcg-conv .sujet { font-weight: 500; }
.bcg-conv .date, .bcg-conv .avec, .bcg-conv .apercu { font-size: .8rem; color: var(--bcg-texte-doux); }
.bcg-conv .date { white-space: nowrap; }
.bcg-conv.non-lu .sujet, .bcg-conv.non-lu .apercu { font-weight: 700; color: var(--bcg-texte); }
.bcg-conv .point { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--bcg-primaire); margin-right: .35rem; vertical-align: middle; }
.bcg-conv.active { background: var(--bcg-primaire-clair); color: var(--bcg-texte); border-color: var(--bcg-bordure); border-left-color: var(--bcg-primaire); }
.bcg-conv.active .sujet { color: var(--bcg-primaire-texte); }

.bcg-conversation-entete { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-bottom: 1px solid var(--bcg-bordure); }
.bcg-participant { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .1rem .5rem .1rem .15rem; border-radius: 1rem; background: var(--bcg-surface-2); border: 1px solid var(--bcg-bordure); }
.bcg-participant .bcg-icone-couleur { width: 1.25rem; height: 1.25rem; border-radius: 50%; }
.bcg-participant .bcg-icone-couleur .bi { font-size: .72rem; }
.bcg-conversation-fil { flex: 1; overflow-y: auto; padding: 1rem; background: var(--bcg-surface-2); }
.bcg-composer { padding: .75rem 1rem; border-top: 1px solid var(--bcg-bordure); background: var(--bcg-surface); }
.bcg-composer textarea { resize: vertical; min-height: 2.6rem; }

.bcg-fil-jour { text-align: center; margin: .75rem 0; }
.bcg-fil-jour span { font-size: .72rem; text-transform: capitalize; color: var(--bcg-texte-doux); background: var(--bcg-surface); border: 1px solid var(--bcg-bordure); padding: .15rem .7rem; border-radius: 1rem; }
.bcg-bulle-ligne { display: flex; gap: .5rem; align-items: flex-end; margin-bottom: .6rem; }
.bcg-bulle-ligne.mien { justify-content: flex-end; }
.bcg-avatar { width: 2rem !important; height: 2rem !important; border-radius: 50% !important; font-size: .7rem; font-weight: 700; }
.bcg-bulle { max-width: min(36rem, 78%); background: var(--bcg-surface); border: 1px solid var(--bcg-bordure); border-radius: 1rem 1rem 1rem .3rem; padding: .55rem .8rem; box-shadow: var(--bcg-ombre); }
.bcg-bulle-ligne.mien .bcg-bulle { background: var(--bcg-primaire); color: var(--bcg-sur-primaire); border-color: transparent; border-radius: 1rem 1rem .3rem 1rem; }
.bcg-bulle .auteur { font-size: .76rem; font-weight: 600; color: var(--bcg-primaire-texte); margin-bottom: .15rem; }
.bcg-bulle .auteur .type { font-weight: 500; color: var(--bcg-texte-doux); margin-left: .35rem; }
.bcg-bulle .texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.bcg-bulle .heure { font-size: .68rem; opacity: .7; text-align: right; margin-top: .2rem; }
.bcg-bulle .pieces { display: flex; flex-direction: column; gap: .35rem; margin-top: .4rem; }
.bcg-bulle .piece { display: flex; align-items: center; gap: .55rem; padding: .4rem .6rem; border-radius: .6rem; text-decoration: none; color: var(--bcg-texte);
  background: var(--bcg-surface-2); border: 1px solid var(--bcg-bordure); }
.bcg-bulle .piece:hover { border-color: var(--bcg-primaire); }
.bcg-bulle .piece .bi { font-size: 1.3rem; color: var(--bcg-c-rouge); }
.bcg-bulle .piece.commerciale .bi { color: var(--bcg-c-indigo); }
.bcg-bulle .piece .nom { display: block; font-weight: 500; font-size: .85rem; overflow-wrap: anywhere; }
.bcg-bulle .piece .detail { display: block; font-size: .72rem; color: var(--bcg-texte-doux); }

.bcg-destinataires { position: relative; }
.bcg-destinataires .choisis, .pieces-choisies { display: flex; flex-wrap: wrap; gap: .35rem; }
.bcg-destinataires .choisis:not(:empty) { margin-bottom: .4rem; }
.bcg-puce { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; padding: .15rem .3rem .15rem .2rem; border-radius: 1rem; background: var(--bcg-primaire-clair); border: 1px solid var(--bcg-bordure); }
.bcg-puce .bcg-icone-couleur { width: 1.3rem; height: 1.3rem; border-radius: 50%; }
.bcg-puce .bcg-icone-couleur .bi { font-size: .75rem; }
.bcg-puce button { border: 0; background: none; padding: 0 .2rem; color: var(--bcg-texte-doux); line-height: 1; }
.bcg-suggestions { z-index: 1060; max-height: 18rem; overflow-y: auto; top: 100%; }
.bcg-suggestions .list-group-item { display: flex; align-items: center; gap: .6rem; }
.bcg-suggestions .list-group-item.focus { background: var(--bcg-primaire-clair); }

.bcg-compteur { margin-left: auto; min-width: 1.25rem; padding: .1rem .4rem; border-radius: 1rem; font-size: .68rem; font-weight: 700; text-align: center;
  background: var(--bcg-accent); color: var(--bcg-sur-accent); }
.bcg-compteur:empty, .bcg-compteur[data-valeur="0"] { display: none; }
.bcg-btn-notif { position: relative; }
.bcg-btn-notif .bcg-compteur { position: absolute; top: .05rem; right: -.1rem; margin: 0; padding: .05rem .3rem; font-size: .6rem; }

@media (max-width: 991.98px) {
  .bcg-messagerie { grid-template-columns: 1fr; height: auto; }
  .bcg-messagerie.avec-fil .bcg-conversations { display: none; }
  .bcg-messagerie:not(.avec-fil) .bcg-conversation { display: none; }
  .bcg-messagerie .bcg-conversation { height: calc(100vh - 10rem); min-height: 26rem; }
}

/* ================================================================ Portail clients / fournisseurs / employés */
.bcg-portail { background: var(--bcg-fond); color: var(--bcg-texte); min-height: 100vh; }
.bcg-portail-entete { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1.25rem; background: var(--bcg-surface); border-bottom: 1px solid var(--bcg-bordure); position: sticky; top: 0; z-index: 10; }
.bcg-portail-entete .logo { width: 2.2rem; height: 2.2rem; border-radius: .7rem; display: grid; place-items: center; font-weight: 800; background: var(--bcg-primaire); color: var(--bcg-sur-primaire); flex-shrink: 0; }
.bcg-portail-entete .logo-image { width: 2.2rem; height: 2.2rem; object-fit: contain; border-radius: .6rem; }
.bcg-portail-contenu { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem; }
.bcg-portail .bcg-messagerie { height: calc(100vh - 14rem); }

/* ================================================================ Budget / plan de trésorerie */
.bcg-table-tresorerie th, .bcg-table-tresorerie td { white-space: nowrap; }
.bcg-table-tresorerie td:first-child:not([colspan]), .bcg-table-tresorerie th:first-child:not([colspan]) { position: sticky; left: 0; background: var(--bcg-surface); z-index: 1; white-space: normal; }
.bcg-table-tresorerie .bcg-cellule { min-width: 6.5rem; }
@media print { .bcg-sidebar, .bcg-topbar, .bcg-page-header .btn, .btn-group { display: none !important; } }

/* ================================================================ Menu en listes déroulantes */
.bcg-sidebar .groupe-titre { display: flex; align-items: center; gap: .6rem; width: 100%; border: 0; background: none; border-radius: .55rem;
  margin-top: .35rem; padding: .55rem .75rem; cursor: pointer; text-align: left; }
.bcg-sidebar .groupe-titre:hover { color: var(--bcg-menu-texte-actif); background: var(--bcg-menu-survol); }
.bcg-sidebar .groupe-titre:focus-visible { outline: 2px solid var(--bcg-menu-repere); outline-offset: 1px; }
.bcg-sidebar .groupe-titre .bi:not(.chevron) { font-size: .95rem; }
.bcg-sidebar .groupe-titre .chevron { font-size: .75rem; transition: transform .2s ease; }
.bcg-sidebar .groupe-titre[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.bcg-sidebar .groupe-titre.contient-actif { color: var(--bcg-menu-texte-actif); }
.bcg-sidebar .bcg-compteur-groupe { margin-left: 0; }
.bcg-sidebar .groupe-titre[aria-expanded="true"] .bcg-compteur-groupe { display: none; }
.bcg-sidebar .groupe-entrees { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.bcg-sidebar .groupe-entrees.ouvert { grid-template-rows: 1fr; }
.bcg-sidebar .groupe-contenu { overflow: hidden; min-height: 0; }
.bcg-sidebar [data-menu-deroulant] .groupe-entrees .nav-link { padding-left: 1rem; }
.bcg-sidebar .groupe-contenu .nav-link.active::before { left: -.75rem; }
@media (prefers-reduced-motion: reduce) { .bcg-sidebar .groupe-entrees, .bcg-sidebar .groupe-titre .chevron { transition: none; } }

/* ================================================================ Aperçu avant impression (dans le logiciel) */
.bcg-apercu { max-width: min(1100px, 96vw); }
.bcg-apercu .modal-body { height: calc(100vh - 7.5rem); background: #e9ecef; }
.bcg-apercu iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.bcg-apercu-chargement { position: absolute; inset: 0; display: none; place-items: center; background: rgba(233,236,239,.7); }
#modalApercu.charge .bcg-apercu-chargement { display: grid; }

/* ---------- Tableau de bord dynamique */
:root { --bcg-serie-1: #2a78d6; --bcg-serie-2: #eb6834; --bcg-serie-3: #1baf7a; }
[data-bs-theme="dark"] { --bcg-serie-1: #3987e5; --bcg-serie-2: #d95926; --bcg-serie-3: #199e70; }
.bcg-tdb-filtres .btn-outline-primary { --bs-btn-border-color: transparent; --bs-btn-color: var(--bcg-texte-doux); font-weight: 600; }
.bcg-tdb-kpi { overflow: hidden; }
.bcg-tdb-kpi .valeur { line-height: 1.2; margin-top: .1rem; }
.bcg-tendance { display: inline-flex; align-items: center; gap: .15rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
.bcg-tendance-bonne { color: var(--bcg-succes); background: var(--bcg-succes-fond); }
.bcg-tendance-mauvaise { color: var(--bcg-danger); background: var(--bcg-danger-fond); }
.bcg-tendance-neutre { color: var(--bcg-neutre); background: var(--bcg-neutre-fond); }
.bcg-sparkline { height: 38px; margin: 0 -.25rem -.35rem; }
.bcg-graphique { position: relative; }
[data-contenu-tdb].bcg-chargement { opacity: .55; transition: opacity .15s; pointer-events: none; }
.bcg-tdb-masques, .bcg-tdb-aide, .bcg-bloc-outils { display: none; }
.bcg-personnalisation .bcg-tdb-masques, .bcg-personnalisation .bcg-tdb-aide { display: block; }
.bcg-bloc-outils { position: absolute; top: .45rem; right: .45rem; z-index: 3; gap: .25rem; align-items: center; }
.bcg-personnalisation .bcg-bloc-outils { display: flex; }
.bcg-personnalisation .bcg-bloc > .card { outline: 2px dashed rgba(var(--bcg-primaire-rgb), .35); outline-offset: -2px; }
.bcg-personnalisation .bcg-bloc .stretched-link { display: none; }
.bcg-poignee { cursor: grab; color: var(--bcg-texte-doux); padding: 0 .2rem; font-size: 1.1rem; }
.bcg-bloc.bcg-deplace { opacity: .4; }
.bcg-bloc.bcg-cible > .card { outline-color: var(--bcg-primaire); outline-style: solid; }
.bcg-personnalisation .bcg-tdb-kpi .libelle, .bcg-personnalisation .card-header { padding-right: 3.6rem; }

/* ---------- Barre d'actions sur une sélection de lignes */
.bcg-selection { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem 1rem; background: rgba(var(--bcg-primaire-rgb), .08);
  border-bottom: 1px solid var(--bcg-bordure); position: sticky; top: 0; z-index: 5; }
/* ---------- Notification discrète (BCG.notifier) */
.bcg-notification { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); opacity: 0; background: var(--bcg-texte); color: var(--bcg-surface);
  border-radius: var(--bcg-rayon-petit); padding: .7rem 1.1rem; font-weight: 500; z-index: 2000; transition: transform .25s ease, opacity .25s ease;
  box-shadow: var(--bcg-ombre-forte); max-width: calc(100% - 32px); pointer-events: none; }
.bcg-notification.visible { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Photos des articles */
.bcg-photo-article { position: relative; border: 0; padding: 0; background: none; border-radius: var(--bcg-rayon); cursor: pointer; flex-shrink: 0; }
.bcg-photo-plus { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 999px; background: var(--bcg-primaire); color: var(--bcg-sur-primaire);
  font-size: .6rem; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--bcg-transition); }
.bcg-photo-article:hover .bcg-photo-plus, .bcg-photo-article:focus-visible .bcg-photo-plus { opacity: 1; }
.bcg-depot-photos { display: block; border: 2px dashed var(--bcg-bordure); border-radius: var(--bcg-rayon); padding: 1.5rem; text-align: center; cursor: pointer;
  color: var(--bcg-texte); transition: border-color var(--bcg-transition), background var(--bcg-transition); }
.bcg-depot-photos:hover, .bcg-depot-photos.survol { border-color: var(--bcg-primaire); background: rgba(var(--bcg-primaire-rgb), .06); }
.bcg-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.bcg-galerie-photo { position: relative; border-radius: var(--bcg-rayon); overflow: hidden; border: 2px solid var(--bcg-bordure); aspect-ratio: 1 / 1; background: var(--bcg-surface-2); }
.bcg-galerie-photo.principale { border-color: var(--bcg-primaire); }
.bcg-galerie-photo img { width: 100%; height: 100%; object-fit: cover; }
.bcg-galerie-badge { position: absolute; top: .4rem; left: .4rem; }
.bcg-galerie-outils { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: .25rem; padding: .35rem;
  background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.bcg-galerie-outils .btn { padding: .15rem .4rem; }

/* Périodes comptables : pastille d'état par journal et par période */
.bcg-periode { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent; font-size: .85rem; background: none; padding: 0; }
.bcg-periode.ouverte { background: var(--bcg-succes-fond); color: var(--bcg-succes); }
.bcg-periode.rouverte { background: var(--bcg-avert-fond); color: var(--bcg-avert); }
.bcg-periode.cloturee { background: var(--bcg-neutre-fond); color: var(--bcg-neutre); }
button.bcg-periode:not(:disabled) { cursor: pointer; }
button.bcg-periode:not(:disabled):hover { border-color: currentColor; }
.bcg-table-periodes td, .bcg-table-periodes th { white-space: nowrap; }
.bcg-periode { position: relative; }
.bcg-periode-nombre { position: absolute; top: -7px; right: -9px; min-width: 18px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: .62rem; line-height: 16px; font-weight: 700; background: var(--bcg-primaire); color: var(--bcg-sur-primaire); }
@media print { .bcg-sidebar, .bcg-topbar, header.bcg-entete { display: none !important; } }

/* ================================================================ Éditions comptables (balance, grand-livre) */
.bcg-edition { font-variant-numeric: tabular-nums; }
.bcg-edition table { margin: 0; font-size: .86rem; }
.bcg-edition thead th { position: sticky; top: 0; z-index: 2; background: var(--bcg-surface-2); color: var(--bcg-texte-doux); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 700; border-bottom: 1px solid var(--bcg-bordure); white-space: nowrap; }
.bcg-edition thead tr.groupes th { text-align: center; color: var(--bcg-primaire-texte); background: var(--bcg-primaire-clair); border-bottom: 0; }
.bcg-edition thead tr.groupes th + th { border-left: 2px solid var(--bcg-surface); }
.bcg-edition td, .bcg-edition th { padding: .42rem .7rem; vertical-align: middle; }
.bcg-edition td.n, .bcg-edition th.n { text-align: right; white-space: nowrap; }
.bcg-edition tbody tr.ligne:nth-child(even) td { background: var(--bcg-surface-2); }
.bcg-edition tbody tr.ligne:hover td { background: var(--bcg-surbrillance); }
.bcg-edition .sep { border-left: 1px solid var(--bcg-bordure); }
.bcg-edition .num-compte { font-weight: 700; color: var(--bcg-primaire-texte); text-decoration: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .84rem; }
.bcg-edition .num-compte:hover { text-decoration: underline; }
.bcg-edition tr.classe td { background: var(--bcg-surface-3); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bcg-texte-doux); }
.bcg-edition tr.sous-total td { font-weight: 700; border-top: 1px solid var(--bcg-bordure); background: var(--bcg-surface); }
.bcg-edition tfoot td { font-weight: 800; background: var(--bcg-primaire-clair); color: var(--bcg-texte); border-top: 2px solid var(--bcg-primaire); }
.bcg-edition tfoot tr.general td { background: var(--bcg-primaire); color: var(--bcg-sur-primaire); font-size: .95rem; }
.bcg-edition .vide { color: var(--bcg-texte-doux); opacity: .45; }
.bcg-edition .negatif { color: var(--bcg-danger); }
.bcg-edition tr.compte td { background: var(--bcg-primaire-clair); border-top: 2px solid var(--bcg-primaire); padding-top: .55rem; padding-bottom: .55rem; }
.bcg-edition tr.compte .intitule { font-weight: 700; }
.bcg-edition tr.report td { font-style: italic; color: var(--bcg-texte-doux); }
.bcg-edition tr.total-compte td { font-weight: 700; border-top: 1px dashed var(--bcg-bordure); }
.bcg-edition .badge-journal { display: inline-block; min-width: 2.4rem; text-align: center; padding: .1rem .35rem; border-radius: .35rem; font-size: .72rem; font-weight: 700;
  background: var(--bcg-neutre-fond); color: var(--bcg-neutre); }
.bcg-edition .lettre { font-weight: 700; color: var(--bcg-c-vert); }
.bcg-edition-impression { justify-content: space-between; align-items: flex-start; gap: 1rem; border: 1px solid #000; padding: .5rem .75rem; margin-bottom: .6rem; }
@media print {
  .bcg-edition thead th { position: static; background: #eee !important; color: #000; }
  .bcg-edition thead tr.groupes th { background: #ddd !important; color: #000; }
  .bcg-edition tbody tr.ligne:nth-child(even) td { background: #f5f5f5 !important; }
  .bcg-edition tr.compte td, .bcg-edition tfoot td { background: #e8e8e8 !important; color: #000 !important; border-color: #000 !important; }
  .bcg-edition table { font-size: 9.5pt; }
  .bcg-edition td, .bcg-edition th { padding: .15rem .35rem; }
  .bcg-edition .card { border: 0; box-shadow: none; }
  .bcg-kpi { border: 1px solid #ccc !important; box-shadow: none !important; padding: .4rem .6rem; }
  .bcg-kpi .bcg-avatar { display: none; }
  .bcg-page-header { display: none !important; }
  .bcg-edition tr.compte { break-after: avoid; page-break-after: avoid; }
  .bcg-edition tr { break-inside: avoid; page-break-inside: avoid; }
  .bcg-edition, .bcg-edition td, .bcg-edition th, .bcg-edition .num-compte, .bcg-edition-impression, .bcg-edition-kpis .libelle, .bcg-edition-kpis .valeur { color: #000 !important; }
  .bcg-edition td, .bcg-edition th, .bcg-edition .card { background: #fff; border-color: #bbb !important; }
  .bcg-edition .vide { opacity: .35; }
  .bcg-edition-kpis > div { flex: 0 0 25%; max-width: 25%; }
  .bcg-edition-kpis .card { background: #fff !important; }
  body, .bcg-contenu, .bcg-main { background: #fff !important; }
}

/* ================================================================ États de synthèse au format ETAFI (feuille blanche, vert) */
.bcg-etafi { background: #fff; color: #000; padding: 1rem; font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.bcg-etafi .etafi-titre { background: var(--etafi-fonce); color: var(--etafi-texte-fonce); text-align: center; font-weight: 700; font-size: 1.15rem; padding: .35rem; letter-spacing: .03em; }
.bcg-etafi .etafi-identite { width: 100%; margin: .6rem 0 .8rem; border-collapse: collapse; }
.bcg-etafi .etafi-identite td { padding: .3rem .4rem; border-bottom: 1px dotted #777; }
.bcg-etafi .etafi-identite td.lib { width: 14%; white-space: nowrap; color: #222; }
.bcg-etafi .etafi-identite td.val { width: 36%; }
.bcg-etafi .etafi-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.bcg-etafi .etafi-bilan { min-width: 1100px; }
.bcg-etafi .etafi-simple { min-width: 700px; }
.bcg-etafi .etafi-bilan td.lib { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcg-etafi .etafi-table th, .bcg-etafi .etafi-table td { border: 1px solid #000; padding: .22rem .4rem; vertical-align: middle; }
.bcg-etafi .etafi-table thead th { text-align: center; font-weight: 700; background: #fff; color: #000; }
.bcg-etafi .etafi-table thead th.vert { background: var(--etafi-fonce); color: var(--etafi-texte-fonce); }
.bcg-etafi td.ref { text-align: center; }
.bcg-etafi td.note, .bcg-etafi th.note, .bcg-etafi td.signe, .bcg-etafi th.signe { text-align: center; }
.bcg-etafi td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bcg-etafi td.fonce { background: var(--etafi-fonce); color: var(--etafi-texte-fonce); font-weight: 700; }
.bcg-etafi td.clair { background: var(--etafi-clair); font-weight: 700; }
.bcg-etafi td.gras { font-weight: 700; }
.bcg-etafi td.titre-section { text-align: center; font-weight: 700; font-style: italic; }
.bcg-etafi td.negatif { color: #c00000; }
.bcg-etafi td.fonce.negatif { color: #ffd7d7; }
/* États financiers aux couleurs du thème de la société (config bcg.etats_couleurs.theme) : clair / sombre, couleur principale */
.bcg-etafi.etafi-theme { --etafi-fonce: var(--bcg-primaire); --etafi-clair: var(--bcg-primaire-clair); --etafi-texte-fonce: var(--bcg-sur-primaire);
  --etafi-trait: color-mix(in srgb, var(--bcg-texte) 28%, transparent);
  background: var(--bcg-surface); color: var(--bcg-texte); font-family: var(--bs-font-sans-serif); border-radius: 0 0 var(--bcg-rayon) var(--bcg-rayon); }
.bcg-etafi.etafi-theme .etafi-titre { border-radius: var(--bcg-rayon-petit); background: linear-gradient(135deg, var(--bcg-primaire), var(--bcg-primaire-fonce)); }
.bcg-etafi.etafi-theme .etafi-identite td { border-bottom-color: var(--bcg-bordure); }
.bcg-etafi.etafi-theme .etafi-identite td.lib { color: var(--bcg-texte-doux); }
.bcg-etafi.etafi-theme .etafi-table th, .bcg-etafi.etafi-theme .etafi-table td { border-color: var(--etafi-trait); }
.bcg-etafi.etafi-theme .etafi-table thead th { background: var(--bcg-surface-2); color: var(--bcg-texte); }
.bcg-etafi.etafi-theme .etafi-table thead th.vert { background: var(--etafi-fonce); color: var(--etafi-texte-fonce); }
.bcg-etafi.etafi-theme td.clair { color: var(--bcg-primaire-texte); }
.bcg-etafi.etafi-theme td.negatif { color: var(--bcg-danger); }
.bcg-etafi.etafi-theme tbody tr:hover td:not(.fonce):not(.clair) { background: var(--bcg-surface-2); }
@media print { .bcg-etafi { padding: 0; } .bcg-etafi td.fonce, .bcg-etafi td.clair, .bcg-etafi th.vert, .bcg-etafi .etafi-titre { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* Cases à cocher multiples dans les formulaires */
.bcg-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .25rem 1rem; padding: .5rem .75rem;
  border: 1px solid var(--bcg-bordure); border-radius: var(--bcg-rayon); background: var(--bcg-surface-2); max-height: 220px; overflow-y: auto; }

/* =====================================================================
   v28 — Menu en barre horizontale, recherche rapide (Ctrl+K), tableaux dynamiques
   ===================================================================== */
@media (min-width: 992px) {
  body.menu-haut .bcg-sidebar { display: none; }
  body.menu-haut .bcg-main { margin-left: 0; }
}
.bcg-marque-haut { color: var(--bcg-texte); }
.bcg-marque-haut .logo { width: 2.1rem; height: 2.1rem; border-radius: .6rem; display: grid; place-items: center; font-weight: 800;
  background: var(--bcg-primaire); color: var(--bcg-sur-primaire); }
.bcg-marque-haut .logo-image { width: 2.1rem; height: 2.1rem; object-fit: contain; border-radius: .5rem; background: #fff; }
.bcg-menu-haut { position: sticky; top: var(--bcg-topbar-h, 64px); z-index: 1019; background: var(--bcg-menu-fond); border-bottom: 1px solid var(--bcg-menu-bordure); }
.bcg-menu-haut-barre { display: flex; align-items: stretch; gap: .15rem; padding: 0 1rem; white-space: nowrap; min-height: 46px; }
.bcg-menu-haut .item { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .7rem; height: 100%; border: 0; background: none;
  color: var(--bcg-menu-texte); font-size: .875rem; font-weight: 500; text-decoration: none; border-bottom: 3px solid transparent; border-radius: 0; }
.bcg-menu-haut .item:hover, .bcg-menu-haut .item[aria-expanded="true"] { color: var(--bcg-menu-texte-actif); background: var(--bcg-menu-survol); }
.bcg-menu-haut .item.actif { color: var(--bcg-menu-texte-actif); border-bottom-color: var(--bcg-menu-repere); font-weight: 600; }
.bcg-menu-haut .item .chevron { font-size: .65rem; opacity: .7; }
.bcg-menu-haut .bcg-compteur { margin-left: .1rem; }
.bcg-mega { padding: .5rem; min-width: 15rem; border-radius: var(--bcg-rayon); box-shadow: var(--bcg-ombre-forte); border-color: var(--bcg-bordure); }
.bcg-mega.deux-colonnes { columns: 2; column-gap: .5rem; min-width: 32rem; }
.bcg-mega .dropdown-item { display: flex; align-items: center; gap: .6rem; border-radius: var(--bcg-rayon-petit); padding: .45rem .65rem; break-inside: avoid; font-size: .875rem; }
.bcg-mega .dropdown-item .bi { color: var(--bcg-primaire-texte); width: 1.1rem; text-align: center; }
.bcg-mega .dropdown-item.active { background: var(--bcg-primaire-clair); color: var(--bcg-primaire-texte); font-weight: 600; }
.bcg-mega .dropdown-header { break-after: avoid; padding: .5rem .65rem .2rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.bcg-recherche-rapide { align-items: center; gap: .5rem; min-width: 15rem; color: var(--bcg-texte-doux); background: var(--bcg-surface-2);
  border: 1px solid var(--bcg-bordure); border-radius: 999px; padding: .35rem .5rem .35rem .85rem; font-size: .875rem; }
.bcg-recherche-rapide:hover { border-color: var(--bcg-primaire); color: var(--bcg-texte); }
.bcg-recherche-rapide kbd, .bcg-palette kbd { background: var(--bcg-surface-3); color: var(--bcg-texte-doux); border: 1px solid var(--bcg-bordure); font-size: .7rem; padding: .1rem .35rem; }
.bcg-palette { max-width: 640px; margin-top: 8vh; }
.bcg-palette .modal-content { border-radius: var(--bcg-rayon); overflow: hidden; }
.bcg-palette input[type=search] { font-size: 1.05rem; }
.bcg-palette .list-group-item { display: flex; align-items: center; gap: .7rem; border: 0; border-radius: var(--bcg-rayon-petit); cursor: pointer; }
.bcg-palette .list-group-item.choisi { background: var(--bcg-primaire-clair); }
.bcg-palette .list-group-item .bi:first-child { color: var(--bcg-primaire-texte); width: 1.2rem; text-align: center; }
.bcg-palette .groupe-pal { font-size: .75rem; color: var(--bcg-texte-doux); margin-left: auto; }
.bcg-palette .etoile { border: 0; background: none; color: var(--bcg-texte-doux); padding: 0 .25rem; }
.bcg-palette .etoile.on { color: var(--bcg-accent); }
.bcg-palette .section-pal { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bcg-texte-doux); padding: .5rem .75rem .2rem; }

/* Tableaux : outils (colonnes, densité), en-têtes collants, rechargement sans quitter la page */
.bcg-outils-table { display: flex; justify-content: flex-end; gap: .35rem; padding: .35rem .75rem 0; }
.bcg-outils-table .btn { color: var(--bcg-texte-doux); }
.bcg-table.compacte > :not(caption) > * > * { padding-top: .3rem; padding-bottom: .3rem; }
.table-responsive:has(> .bcg-table) { max-height: none; }
.bcg-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bcg-surface-2); }
[data-liste].chargement .table-responsive { opacity: .5; transition: opacity .15s; pointer-events: none; }
.bcg-col-cachee { display: none !important; }
.bcg-lignes-selection { display: none; align-items: center; gap: .5rem; padding: .5rem .75rem; background: var(--bcg-primaire-clair); border-radius: var(--bcg-rayon-petit); margin: .5rem .75rem 0; }
form.bcg-modifie .modal-footer::before, form.bcg-modifie > .card-footer::before { content: "●"; color: var(--bcg-accent); margin-right: auto; font-size: .8rem; }
@media print { .bcg-menu-haut, .bcg-outils-table { display: none !important; } }

/* v28 — cases « module » (modules, inscription, abonnement) */
.module input:checked + label { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); color: var(--bs-body-color); }
.module input:not(:checked) + label .bi-check-circle-fill { opacity: 0; }
.bcg-bandeau-abonnement.bcg-bandeau-bas { margin: 1.5rem 0 0; opacity: .9; }
.bcg-bandeau-abonnement { display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; border-radius: .6rem; margin-bottom: 1rem; font-size: .9rem; }

/* =====================================================================
   v30 — Style « Professionnel compact » (préférence « style » = compact)
   Plus d'informations à l'écran : marges, champs, tableaux et cartes resserrés, bordures fines.
   ===================================================================== */
.bcg-menu-compte { max-height: calc(100vh - 5rem); overflow-y: auto; min-width: 19rem; }
body.style-compact { --bcg-topbar-h: 52px; --bcg-rayon: .5rem; --bcg-rayon-petit: .375rem; --bcg-ombre: 0 1px 2px rgba(16,24,40,.05);
  font-size: .845rem; }
body.style-compact .bcg-topbar { padding: 0 1rem; gap: .5rem; }
body.style-compact .bcg-topbar .bcg-avatar { width: 1.9rem; height: 1.9rem; font-size: .72rem; }
body.style-compact .bcg-tuile { width: 1.8rem; height: 1.8rem; }
body.style-compact .bcg-menu-haut-barre { min-height: 40px; padding: 0 .75rem; }
body.style-compact .bcg-menu-haut .item { padding: .4rem .6rem; font-size: .82rem; }
body.style-compact .bcg-contenu { padding-top: 1rem; padding-bottom: 1.5rem; }
body.style-compact .bcg-page-header { margin-bottom: .9rem; gap: .6rem; align-items: center; }
body.style-compact .bcg-page-header h1 { font-size: 1.22rem; font-weight: 700; letter-spacing: -.01em; }
body.style-compact .bcg-page-header .sous-titre { font-size: .8rem; margin-top: .1rem; }
body.style-compact .bcg-page-header .breadcrumb { font-size: .72rem; margin-bottom: .2rem; }
body.style-compact .card { box-shadow: none; }
body.style-compact .card-header { padding: .55rem .85rem; font-size: .84rem; font-weight: 600; background: var(--bcg-surface-2); }
body.style-compact .card-body { padding: .85rem; }
body.style-compact .card-footer { padding: .55rem .85rem; }
body.style-compact .row.g-3 { --bs-gutter-x: .75rem; --bs-gutter-y: .65rem; }
body.style-compact .row.g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: .9rem; }
body.style-compact .bcg-kpi { padding: .65rem .85rem; }
body.style-compact .bcg-kpi .libelle { font-size: .72rem; }
body.style-compact .bcg-kpi .valeur { font-size: 1.15rem; font-weight: 700; }
body.style-compact .btn { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .82rem; }
body.style-compact .btn-sm { --bs-btn-padding-y: .18rem; --bs-btn-padding-x: .45rem; --bs-btn-font-size: .76rem; }
body.style-compact .btn-lg { --bs-btn-padding-y: .5rem; --bs-btn-padding-x: 1rem; --bs-btn-font-size: .95rem; }
body.style-compact .btn-icon { width: 1.9rem; height: 1.9rem; }
body.style-compact .form-control, body.style-compact .form-select { padding-top: .3rem; padding-bottom: .3rem; font-size: .84rem; min-height: calc(1.5em + .6rem + 2px); }
body.style-compact .form-select { padding-right: 2rem; background-position: right .55rem center; }
body.style-compact .form-control-sm, body.style-compact .form-select-sm { padding-top: .18rem; padding-bottom: .18rem; font-size: .78rem; min-height: 0; }
body.style-compact .form-label { font-size: .74rem; margin-bottom: .2rem; font-weight: 600; color: var(--bcg-texte-doux); }
body.style-compact .form-text { font-size: .7rem; margin-top: .15rem; }
body.style-compact .input-group-text { padding-top: .3rem; padding-bottom: .3rem; font-size: .8rem; }
body.style-compact .bcg-section-form { margin: 1rem 0 .55rem; padding-bottom: .3rem; font-size: .66rem; }
body.style-compact .bcg-filtres { padding: .55rem .85rem; gap: .4rem; }
body.style-compact .bcg-onglets { padding: .25rem .75rem 0; }
body.style-compact .bcg-onglets a { padding: .45rem .65rem; font-size: .8rem; }
body.style-compact .bcg-table thead th { padding: .45rem .75rem; font-size: .65rem; }
body.style-compact .bcg-table tbody td { padding: .42rem .75rem; }
body.style-compact .bcg-table-footer { padding: .5rem .85rem; font-size: .78rem; }
body.style-compact .bcg-avatar { width: 1.8rem; height: 1.8rem; font-size: .7rem; }
body.style-compact .bcg-identite { gap: .55rem; }
body.style-compact .bcg-identite .detail { font-size: .72rem; }
body.style-compact .badge { font-size: .66rem; padding: .3em .6em; }
body.style-compact .alert { padding: .5rem .85rem; font-size: .82rem; }
body.style-compact .bcg-bandeau-abonnement { padding: .35rem .75rem; font-size: .8rem; margin-bottom: .75rem; }
body.style-compact .modal-header { padding: .7rem 1rem; }
body.style-compact .modal-title { font-size: 1rem; font-weight: 700; }
body.style-compact .modal-body { padding: 1rem; }
body.style-compact .modal-footer { padding: .55rem 1rem; }
body.style-compact .dropdown-item { padding: .35rem .6rem; font-size: .82rem; }
body.style-compact .bcg-fiche dd { margin-bottom: .55rem; }
body.style-compact .bcg-vide { padding: 1.5rem 1rem; }
body.style-compact .list-group-item { padding: .45rem .8rem; }
body.style-compact .bcg-papier { padding: 1.5rem; }

/* =====================================================================
   v30 — Formulaires dans un panneau latéral (préférence « formulaire » = panneau)
   Les fenêtres de saisie (composant <x-modal>) s'ouvrent à droite, sur toute la hauteur, la liste reste visible.
   ===================================================================== */
body.formulaire-panneau .bcg-modal-formulaire { --bs-modal-margin: 0; }
body.formulaire-panneau .bcg-modal-formulaire .modal-dialog { position: fixed; top: 0; right: 0; bottom: 0; margin: 0; height: 100%; max-width: 100vw;
  width: min(var(--bcg-panneau-defaut, 620px), 100vw); transform: translateX(100%); transition: transform .22s ease-out; }
body.formulaire-panneau .bcg-modal-formulaire .modal-dialog.modal-sm { width: min(var(--bcg-panneau-sm, 440px), 100vw); }
body.formulaire-panneau .bcg-modal-formulaire .modal-dialog.modal-lg { width: min(var(--bcg-panneau-lg, 820px), 100vw); }
body.formulaire-panneau .bcg-modal-formulaire .modal-dialog.modal-xl { width: min(var(--bcg-panneau-xl, 1080px), 100vw); }
body.formulaire-panneau .bcg-modal-formulaire.show .modal-dialog { transform: none; }
body.formulaire-panneau .bcg-modal-formulaire .modal-content { height: 100%; max-height: 100%; border: 0; border-left: 1px solid var(--bcg-bordure);
  border-radius: 0; box-shadow: -12px 0 32px rgba(16,24,40,.16); }
body.formulaire-panneau .bcg-modal-formulaire .modal-header { background: var(--bcg-surface-2); }
body.formulaire-panneau .bcg-modal-formulaire .modal-body { overflow-y: auto; flex: 1 1 auto; }
body.formulaire-panneau .bcg-modal-formulaire .modal-footer { border-radius: 0; justify-content: flex-start; flex-direction: row-reverse; }
body.formulaire-panneau .bcg-modal-formulaire .modal-footer .btn-primary { min-width: 9rem; }
body.formulaire-panneau .modal-backdrop.show { --bs-backdrop-opacity: .25; }
@media (max-width: 575.98px) { body.formulaire-panneau .bcg-modal-formulaire .modal-dialog { width: 100vw !important; } }

/* =====================================================================
   v30 — Connexion et inscription (pages d'accueil hors application)
   ===================================================================== */
.bcg-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 42%) 1fr; background: var(--bcg-surface); }
.bcg-auth-visuel { background: radial-gradient(circle at 15% 15%, rgba(255,255,255,.16), transparent 40%),
  linear-gradient(150deg, var(--bcg-primaire), var(--bcg-primaire-fonce) 55%, #0b0f19); color: #fff; padding: 2.25rem 2.5rem;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.bcg-auth-visuel .logo { width: 2.4rem; height: 2.4rem; border-radius: .6rem; background: rgba(255,255,255,.16); display: grid; place-items: center; font-weight: 800; }
.bcg-auth-visuel h2 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; max-width: 28rem; margin-bottom: .75rem; }
.bcg-auth-visuel .texte { opacity: .85; max-width: 30rem; font-size: .92rem; }
.bcg-auth-visuel .atouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-top: 1.5rem; max-width: 32rem; }
.bcg-auth-visuel .atout { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .8rem; border-radius: .6rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(4px); }
.bcg-auth-visuel .atout .bi { font-size: 1.1rem; opacity: .95; }
.bcg-auth-visuel .atout .small { opacity: .8; }
.bcg-auth-principal { display: flex; flex-direction: column; padding: 1rem 1.5rem; }
.bcg-auth-haut { display: flex; align-items: center; gap: .5rem; }
.bcg-auth-boite { width: 100%; max-width: 380px; margin: auto; padding: 1.5rem 0; }
.bcg-auth-boite h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .2rem; }
.bcg-auth-ou { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 0; color: var(--bcg-texte-doux); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.bcg-auth-ou::before, .bcg-auth-ou::after { content: ""; flex: 1; border-top: 1px solid var(--bcg-bordure); }
.bcg-auth-lien { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border: 1px solid var(--bcg-bordure); border-radius: var(--bcg-rayon-petit);
  color: var(--bcg-texte); text-decoration: none; transition: border-color var(--bcg-transition), background var(--bcg-transition); }
.bcg-auth-lien > .bi:first-child { font-size: 1.15rem; color: var(--bcg-primaire-texte); width: 2rem; height: 2rem; display: grid; place-items: center;
  border-radius: .45rem; background: var(--bcg-primaire-clair); }
.bcg-auth-lien:hover { border-color: var(--bcg-primaire); background: var(--bcg-surface-2); color: var(--bcg-texte); }
@media (max-width: 991.98px) { .bcg-auth { grid-template-columns: 1fr; } .bcg-auth-visuel { display: none; } }

/* Inscription en étapes */
.bcg-assistant { max-width: 1180px; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
/* Création d'entreprise dans la mise en page de la connexion : panneau de présentation fixe à gauche, assistant à droite */
.bcg-auth-large { grid-template-columns: minmax(300px, 34%) 1fr; }
.bcg-auth-large .bcg-auth-visuel { position: sticky; top: 0; height: 100vh; }
.bcg-auth-large .bcg-auth-visuel .atouts { grid-template-columns: 1fr; }
.bcg-auth-large .bcg-assistant { width: 100%; max-width: 980px; padding: 1.25rem 0 2rem; }
.bcg-auth-large .bcg-assistant .card { box-shadow: none; }
.bcg-activite { display: flex; align-items: center; gap: .65rem; height: 100%; padding: .6rem .75rem; border: 1px solid var(--bcg-bordure); border-radius: var(--bcg-rayon-petit);
  background: var(--bcg-surface); cursor: pointer; line-height: 1.25; transition: border-color .15s, background .15s; }
.bcg-activite > .bi { font-size: 1.15rem; width: 2.1rem; height: 2.1rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .5rem;
  background: var(--bcg-surface-2); color: var(--bcg-primaire-texte); }
.bcg-activite:hover { border-color: var(--bcg-primaire); }
.btn-check:checked + .bcg-activite { border-color: var(--bcg-primaire); background: color-mix(in srgb, var(--bcg-primaire) 7%, var(--bcg-surface)); box-shadow: 0 0 0 1px var(--bcg-primaire); }
.btn-check:checked + .bcg-activite > .bi { background: var(--bcg-primaire); color: var(--bcg-sur-primaire); }
.btn-check:focus-visible + .bcg-activite { outline: 2px solid var(--bcg-primaire); outline-offset: 2px; }
.bcg-assistant-titre { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .2rem; }
@media (max-width: 1199.98px) { .bcg-auth-large .bcg-etapes button .det { display: none; } }
@media (max-width: 991.98px) { .bcg-auth-large { grid-template-columns: minmax(0, 1fr); } .bcg-auth-large .bcg-auth-visuel { display: none; } }
@media (max-width: 575.98px) {
  .bcg-auth-principal { padding: .75rem 1rem; }
  .bcg-auth-large .bcg-auth-haut { flex-wrap: wrap; }
  .bcg-auth-large .bcg-etapes button:not(.active) { flex: 0 0 auto; }
  .bcg-auth-large .bcg-etapes button:not(.active) .lib { display: none; }
  .bcg-auth-large .bcg-assistant .card-body { padding: 1rem !important; }
}
.bcg-assistant-entete { display: flex; align-items: center; gap: .6rem; padding: .25rem 0 1rem; }
.bcg-assistant-entete .logo { width: 2rem; height: 2rem; border-radius: .5rem; display: grid; place-items: center; font-weight: 800; background: var(--bcg-primaire); color: var(--bcg-sur-primaire); }
.bcg-etapes { display: flex; gap: .4rem; margin-bottom: .9rem; counter-reset: etape; }
.bcg-etapes button { flex: 1; display: flex; align-items: center; gap: .55rem; text-align: left; border: 1px solid var(--bcg-bordure); background: var(--bcg-surface);
  border-radius: var(--bcg-rayon-petit); padding: .5rem .7rem; color: var(--bcg-texte-doux); font-size: .8rem; position: relative; overflow: hidden; }
.bcg-etapes button .num { width: 1.6rem; height: 1.6rem; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .75rem;
  background: var(--bcg-surface-3); color: var(--bcg-texte-doux); }
.bcg-etapes button .lib { font-weight: 600; color: var(--bcg-texte); display: block; line-height: 1.2; }
.bcg-etapes button[disabled] { opacity: .65; cursor: default; }
.bcg-etapes button.active { border-color: var(--bcg-primaire); box-shadow: inset 0 -3px 0 var(--bcg-primaire); }
.bcg-etapes button.active .num { background: var(--bcg-primaire); color: var(--bcg-sur-primaire); }
.bcg-etapes button.faite .num { background: var(--bcg-succes-fond); color: var(--bcg-succes); }
.bcg-etapes button.erreur { border-color: var(--bcg-danger); }
.bcg-assistant .etape-titre { font-size: 1.05rem; font-weight: 700; margin-bottom: .15rem; }
.bcg-assistant.js .etape:not(.active) { display: none; }
.bcg-assistant-pied { display: flex; align-items: center; gap: .5rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--bcg-bordure); }
.bcg-recap dt { font-weight: 500; color: var(--bcg-texte-doux); font-size: .78rem; }
.bcg-recap dd { margin-bottom: .45rem; font-weight: 600; }
@media (max-width: 767.98px) { .bcg-etapes button .det { display: none; } }

/* v32 — enregistrement en cours (formulaire bloqué) et avertissement d'expiration de session */
form.bcg-enregistrement .modal-body { opacity: .7; pointer-events: none; transition: opacity .15s; }
.bcg-expiration { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 2000; margin: 0; }
.bcg-photo-apercu { width: 4.5rem; height: 4.5rem; border-radius: .6rem; border: 1px dashed var(--bcg-bordure); background: var(--bcg-surface-2);
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0; color: var(--bcg-texte-doux); font-size: 1.6rem; }
.bcg-photo-apercu img { width: 100%; height: 100%; object-fit: cover; }
.bcg-photo { width: 2.1rem; height: 2.1rem; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bcg-surface-3); }
.bcg-photo-grande { width: 7rem; height: 7rem; border-radius: .8rem; object-fit: cover; border: 3px solid var(--bcg-surface); box-shadow: var(--bcg-ombre); }

/* v43 — Messages de confirmation qui disparaissent seuls : barre de temps restant (en pause au survol) */
.bcg-alerte-auto { position: relative; overflow: hidden; }
.bcg-alerte-auto::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .35;
  transform-origin: left; animation: bcg-alerte-temps var(--bcg-duree, 5000ms) linear forwards; }
.bcg-alerte-auto.en-pause::after { animation-play-state: paused; }
@keyframes bcg-alerte-temps { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .bcg-alerte-auto::after { animation: none; } }

/* v47 — Indicatif téléphonique devant les numéros */
.bcg-indicatif { flex: 0 0 4.6rem !important; width: 4.6rem !important; text-align: center; padding-left: .35rem; padding-right: .35rem; }
.input-group > .bcg-indicatif[hidden] { display: none; }

/* v48 — Listes défilantes : lignes de colis (en-tête et total toujours visibles), colis scannés */
.table-responsive.bcg-tableau-defilant, .bcg-tableau-defilant { max-height: 22rem; overflow: auto; }
.bcg-tableau-defilant thead th { position: sticky; top: 0; z-index: 2; background: var(--bcg-surface-2, var(--bs-tertiary-bg)); }
.bcg-tableau-defilant tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--bcg-surface, var(--bs-body-bg)); box-shadow: 0 -1px 0 var(--bcg-bordure); }
.bcg-liste-defilante { max-height: 65vh; overflow-y: auto; }

/* ---- v71 : pièce ouverte dans une fenêtre au-dessus de la liste (iframe) : sans menu ni barre du haut */
html.bcg-en-fenetre .bcg-sidebar, html.bcg-en-fenetre .bcg-topbar, html.bcg-en-fenetre .bcg-menu-haut,
html.bcg-en-fenetre .bcg-pied-fixe, html.bcg-en-fenetre .bcg-page-header .breadcrumb, html.bcg-en-fenetre [data-cache-en-fenetre] { display: none !important; }
html.bcg-en-fenetre .bcg-main { margin-left: 0 !important; }
html.bcg-en-fenetre .bcg-contenu { padding-top: 1rem; padding-bottom: 1rem; }
.modal-piece .modal-dialog { max-width: min(1500px, 96vw); }
.modal-piece .modal-content { height: 92vh; }
.modal-piece iframe { width: 100%; height: 100%; border: 0; border-radius: 0 0 var(--bs-modal-border-radius) var(--bs-modal-border-radius); }

/* ---- v71 : lignes des pièces — Article et Désignation côte à côte, tous les champs alignés en haut, liste défilante */
.table-responsive.bcg-lignes-defilante { max-height: var(--bcg-lignes-hauteur, 10rem) !important; overflow: auto; }
.bcg-lignes-defilante thead th { position: sticky; top: 0; z-index: 6; background: var(--bcg-surface-2, var(--bs-tertiary-bg)); }
.bcg-lignes > tbody > tr > td { vertical-align: top !important; }
.bcg-lignes td[data-montant] { padding-top: .85rem !important; }
.bcg-lignes .btn-description { padding-inline: .5rem; }
.bcg-lignes .btn-description.actif { color: var(--bcg-primaire); }


/* v87 — titres de rubrique dans les menus en liste (barre latérale, menu classique) : Opérations, Suivi et états, Documents, Paramétrage */
.titre-rubrique-menu { display: flex; align-items: center; gap: .4rem; padding: .55rem .9rem .2rem; font-size: .66rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.titre-rubrique-menu:first-child { padding-top: .25rem; }
.titre-rubrique-menu .bi { font-size: .8rem; opacity: .8; }
.bcg-mega .titre-rubrique-menu { grid-column: 1 / -1; }

/* Connexion perdue / rétablie */
.bcg-reseau-coupe { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 2000; max-width: calc(100% - 2rem);
  background: #842029; color: #fff; padding: .55rem 1rem; border-radius: .5rem; font-size: .875rem; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.2); }
.bcg-reseau-coupe.bcg-reseau-ok { background: #0f5132; }
/* Mode consultation : boutons d'enregistrement désactivés */
.bcg-consultation-off { cursor: not-allowed; }

/* Arabe (de droite à gauche) : montants, nombres et dates gardent leur sens de lecture */
[dir="rtl"] .num, [dir="rtl"] .valeur, [dir="rtl"] td.n, [dir="rtl"] .montant, [dir="rtl"] .bcg-kpi .valeur, [dir="rtl"] [data-montant],
[dir="rtl"] .text-end.fw-semibold, [dir="rtl"] input[type=number], [dir="rtl"] input[type=date] { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .num, [dir="rtl"] td.n { text-align: left; }

/* v125 : en-têtes figés — titre, fil d'Ariane et boutons de la page restent visibles en faisant défiler (application et plateforme).
   --bcg-haut : hauteur de la barre du haut et du menu (mesurée par bcg.js) ; --bcg-entete-h : hauteur de l'en-tête de la page. */
@media (min-width: 768px) and (min-height: 560px) {
  .bcg-contenu > .bcg-page-header, main > .bcg-page-header, .bcg-page-header.bcg-fige {
    position: sticky; top: var(--bcg-haut, 64px); z-index: 1010; background: var(--bcg-fond);
    padding-top: .6rem; padding-bottom: .6rem; margin-top: -.6rem; margin-bottom: .9rem;
    box-shadow: 0 8px 12px -12px rgba(0, 0, 0, .25);
  }
  .bcg-onglets-plateforme { position: sticky; top: calc(var(--bcg-haut, 64px) + var(--bcg-entete-h, 0px)); z-index: 1009; background: var(--bcg-fond); padding: .3rem 0; }
  html.bcg-en-fenetre .bcg-page-header { top: 0 !important; }
}
@media print { .bcg-page-header, .bcg-onglets-plateforme { position: static !important; box-shadow: none !important; } }

/* v125 : messages de succès / d'erreur en fenêtre au centre */
.bcg-message-fenetre .modal-content { border: 0; border-radius: 1rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.bcg-message-fenetre .bcg-message-icone { width: 3.2rem; height: 3.2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.bcg-message-fenetre .bcg-message-barre { height: 3px; background: currentColor; opacity: .35; animation: bcg-barre linear forwards; }
@keyframes bcg-barre { from { width: 100%; } to { width: 0; } }

/* v2.1.11 : menu « ⋯ » de l'en-tête toujours au-dessus du contenu de la page (en-tête non figé : petite fenêtre, page en fenêtre, zoom) */
@media (max-width: 767.98px), (max-height: 559.98px) { .bcg-page-header:has(.dropdown-menu.show) { position: relative; z-index: 1045; } }
@media (min-width: 768px) and (min-height: 560px) { .bcg-page-header:has(.dropdown-menu.show) { z-index: 1045; } }
.bcg-page-header .dropdown-menu { z-index: 1046; min-width: 12rem; max-height: 70vh; overflow-y: auto; }
.bcg-page-header .dropdown-menu > li > form { margin: 0; }
.bcg-page-header .dropdown-menu > li > form > .dropdown-item { width: 100%; text-align: left; background: none; border: 0; }

/* v2.1.53 : photo des employés dans les listes du personnel */
.bcg-photo-employe { flex-shrink: 0; }
.bcg-employe-cellule { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.bcg-employe-cellule > div { min-width: 0; }
@media print { .bcg-employe-cellule .bcg-photo-employe { width: 1.6rem !important; height: 1.6rem !important; } }
.bcg-employe-cellule .fw-semibold, .bcg-employe-cellule > div > a:first-child { white-space: nowrap; }

/* v2.1.66 : pages du logiciel imprimées (états, listes, éditions) : polices réduites, en-têtes de tableau comme les PDF */
@media print {
  body { font-size: 10.5px; }
  .bcg-main .table { font-size: 9pt; }
  .bcg-main .table > thead > tr > th { background: #1e1b4b !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bcg-main h1, .bcg-main .h1, .bcg-page-header h1 { font-size: 1.35rem; }
}
