/* ==== public/css/navigation-responsive.css */
@media (max-width: 991.98px) {
    body {
        overflow-x: hidden;
    }

    .app-layout {
        display: block;
        min-height: calc(100vh - var(--navbar-height));
        position: relative;
    }

    .sidebar,
    body.sidebar-collapsed .sidebar,
    body.sidebar-mobile-open.sidebar-collapsed .sidebar {
        display: none;
        position: absolute;
        top: var(--responsive-sidebar-scroll-offset, 0px);
        bottom: auto;
        left: 0;
        width: min(320px, calc(100vw - 3rem));
        height: calc(100vh - var(--responsive-navbar-height, var(--navbar-height)));
        min-height: 0;
        padding: 1rem 0;
        overflow-y: auto;
        border-right: 1px solid #e5e7eb;
        border-bottom: none;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
        z-index: 1090;
    }

    body.sidebar-mobile-open::before {
        content: '';
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(15, 23, 42, 0.28);
        z-index: 1080;
    }

    body.sidebar-mobile-open .sidebar {
        display: block;
    }

    body.sidebar-mobile-open.sidebar-collapsed .sidebar .accordion-button,
    body.sidebar-mobile-open.sidebar-collapsed .sidebar .sidebar-menu a {
        justify-content: flex-start;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        gap: 0.75rem;
    }

    body.sidebar-mobile-open.sidebar-collapsed .sidebar .accordion-button::after {
        display: block;
    }

    body.sidebar-mobile-open.sidebar-collapsed .sidebar .sidebar-label,
    body.sidebar-mobile-open.sidebar-collapsed .sidebar .accordion-button .sidebar-label,
    body.sidebar-mobile-open.sidebar-collapsed .sidebar .sidebar-menu a .sidebar-label {
        display: inline;
        max-width: none;
        overflow: visible;
        opacity: 1;
        white-space: normal;
    }

    .main-content {
        width: 100%;
        min-width: 0;
    }

    .sidebar-toggle {
        border: 1px solid rgba(108, 99, 255, 0.28);
        background: rgba(255, 255, 255, 0.55);
    }
}

.sidebar-toggle-responsive {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar-toggle-responsive {
        display: inline-flex;
        margin-left: 0.65rem;
        vertical-align: middle;
    }
}

/* =====================================================================
   ERP Pharma - Affichage responsive commun (PC, tablette, telephone)
   Regle : chaque page est verifiee sur ces trois formats.
   ===================================================================== */

/* Les tableaux defilent horizontalement au lieu d'ecraser les colonnes. */
.table-responsive,
.erp-standard-table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}
.table-responsive > table:has(thead th:nth-child(5)),
.erp-standard-table-responsive > table:has(thead th:nth-child(5)) {
    min-width: 760px;
}
.table-responsive > table:has(thead th:nth-child(8)),
.erp-standard-table-responsive > table:has(thead th:nth-child(8)) {
    min-width: 1080px;
}
.table-responsive > table:has(thead th:nth-child(11)),
.erp-standard-table-responsive > table:has(thead th:nth-child(11)) {
    min-width: 1280px;
}

/* Hauteur de tableau limitee seulement sur un grand ecran : ailleurs la page defile. */
@media (max-width: 991.98px), (max-height: 720px) {
    .erp-standard-table-responsive,
    #utilisateurs #usersTableMount .erp-standard-table-responsive {
        max-height: none !important;
    }
}

/* Menus deroulants (Actions) au-dessus de tout, jamais coupes par le tableau. */
.table-responsive .dropdown-menu.show,
.erp-standard-table-responsive .dropdown-menu.show {
    z-index: 1060;
}

/* Fenetres (modales) et formulaires sur telephone */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    .modal-body {
        padding: 0.85rem;
    }
    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .modal-footer > .btn {
        flex: 1 1 auto;
    }
    .main-content {
        padding-left: 0.6rem !important;
        padding-right: 0.6rem !important;
    }
    h1, .h1 { font-size: 1.45rem; }
    h2, .h2 { font-size: 1.25rem; }
}

/* Barre du haut sur telephone (T013 correction 7) : une seule ligne —
   avatar + badge de role + bouton (icone seule) ; seul le nom est cache. */
@media (max-width: 575.98px) {
    .navbar-custom .user-name { display: none; }
    .navbar-custom .btn-logout {
        padding: 0.3rem 0.5rem;
        font-size: 0;
        line-height: 1;
        min-height: 44px; /* T076i : cible tactile 44 px (32 avant) */
        min-width: 44px;
    }
    .navbar-custom .btn-logout i { font-size: 1rem; vertical-align: middle; }
}

/* La zone principale ne s'elargit jamais au-dela de l'ecran :
   ce sont les tableaux qui defilent, pas la page. */
.app-layout > .main-content,
.main-content {
    min-width: 0 !important;
    max-width: 100%;
}
@media (min-width: 992px) {
    .app-layout > .main-content {
        flex: 1 1 auto;
        width: auto;
    }
}
.erp-auto-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Onglets longs (dossier RH...) : defilement horizontal */
.nav.rh-tabs,
.nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.nav.rh-tabs .nav-link,
.nav-tabs .nav-link {
    white-space: nowrap;
    flex: 0 0 auto;
}

/* Tablette et telephone : en-tetes et barres d'outils passent a la ligne */
@media (max-width: 991.98px) {
    .page-header,
    .clients-page-header,
    .clients-header-main,
    .clients-header-tools,
    .users-page-header,
    .page-head,
    .hero,
    .card-header,
    .main-content .d-flex:not(.flex-nowrap):not(.dropdown):not(.input-group) {
        flex-wrap: wrap;
    }
    .main-content .row > [class*="col-"] {
        min-width: 0;
    }
    .main-content img,
    .main-content canvas,
    .main-content svg {
        max-width: 100%;
    }
    .page-title,
    h1 {
        overflow-wrap: anywhere;
    }
}

/* En-tete commun (Clients, Produits, Grossistes, Commandes, Utilisateurs) */
/* T012 : 768px inclus (Client.html passe son en-tete en bande defilante a 768px :
   sans cela, l'interrupteur « Afficher les inactifs » etait coupe en tablette). */
@media (max-width: 768px) {
    .clients-header-title-row,
    .clients-header-stats,
    .clients-header-main,
    .clients-header-tools {
        flex-wrap: wrap !important;
        min-width: 0 !important;
        max-width: 100%;
    }
    .clients-header-title-row > *,
    .clients-header-stats > * {
        min-width: 0;
    }
    .clients-stat {
        white-space: nowrap;
    }
    .page-title {
        white-space: normal !important;
    }
}

/* Tablette (768-991 px) : l'en-tete des pages Base de donnees passe a la ligne si la place manque (T004). */
@media (max-width: 991.98px) {
    .clients-header-title-row,
    .clients-header-stats {
        flex-wrap: wrap !important;
        min-width: 0 !important;
        max-width: 100%;
    }
}

/* Pagination : passe a la ligne sur petit ecran */
.pagination {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

/* T060 : sur tablette, un nom long (ex. « Responsable commandes ») faisait deborder la barre du haut
   de quelques pixels (768 px) : nom et role tronques avec « … » (titre complet au survol inutile : le
   meme nom est dans Mon profil). */
@media (min-width: 576px) and (max-width: 991.98px) {
    .navbar-custom .user-menu,
    .navbar-custom .user-info { min-width: 0; }
    .navbar-custom .user-name,
    .navbar-custom .user-role {
        max-width: 11rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* T017 : sur telephone, le bloc nom / role de la barre du haut est masque
   partout (certaines pages le faisaient deja) pour laisser la place a la
   cloche de notifications sans debordement. */
@media (max-width: 575.98px) {
    .navbar-custom .user-info {
        display: none;
    }
}

/* =====================================================================
   Filtre de colonne type Excel (standard ERP, toutes les pages)
   ===================================================================== */
.erp-xf-btn,
.history-filter-button {
    border: 0;
    background: transparent;
    color: #6b7280;
    padding: 0 0.15rem;
    margin-left: 0.2rem;
    line-height: 1;
    border-radius: 4px;
    vertical-align: middle;
}
.erp-xf-btn:hover,
.history-filter-button:hover { background: #e5e7eb; color: #111827; }
/* T014 (correction 1) : colonne filtree = PASTILLE ROSE a entonnoir MARINE,
   identique sur tous les tableaux (contraste 9:1). Les !important battent les
   selecteurs a id des pages (ex. #table-employes .rh-filter-button i). */
.erp-xf-btn.is-active,
.rh-filter-button.is-filtered .bi,
.erp-standard-table-page__filter-button.is-filtered .bi,
.clients-table th.is-filtered .clients-table-header .bi,
.history-filter-button.is-active {
    background: var(--erp-rose, #f0a1c4) !important;
    color: var(--erp-marine, #02054f) !important;
    border-radius: 999px;
    padding: 2px 5px;
}
.erp-xf-btn.is-active,
.history-filter-button.is-active { padding: 2px 4px; }
/* T076i (2e essai, point 5d) : sur tablette et téléphone (ou écran tactile), chaque cible tactile fait au moins
   44 × 44 px : bouton du filtre d'en-tête (15 × 11 px avant ; marges négatives en hauteur : l'en-tête ne grandit pas),
   boutons de la barre du haut, boutons à icône, petits boutons. */
@media (max-width: 991.98px), (pointer: coarse) {
    .erp-xf-btn,
    .history-filter-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin-top: -12px;
        margin-bottom: -12px;
    }
    .sidebar-toggle,
    .erp-notif-bell,
    .btn-logout,
    .btn-icon,
    .btn-sm,
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    .nav-tabs .nav-link,
    .suivi-onglet,
    .grat-onglet {
        min-height: 44px;
    }
}
.erp-xf-menu {
    position: fixed;
    z-index: 2100;
    width: min(300px, calc(100vw - 16px));
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    display: none;
    font-size: 0.8125rem;
    text-align: left;
    font-weight: 400;
}
.erp-xf-menu.is-open { display: block; }
.erp-xf-menu .erp-xf-sort { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.erp-xf-menu .erp-xf-sort .btn { flex: 1 1 0; font-size: 0.78rem; }
.erp-xf-menu .erp-xf-values {
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.4rem 0;
    margin-top: 0.5rem;
}
.erp-xf-menu .erp-xf-values label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.2rem 0;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}
.erp-xf-menu .erp-xf-values label[hidden] { display: none; }
.erp-xf-menu .erp-xf-text { overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; }
.erp-xf-menu .erp-xf-count { color: #9ca3af; font-size: 0.72rem; }
.erp-xf-menu .erp-xf-footer { display: flex; gap: 0.4rem; justify-content: space-between; align-items: center; margin-top: 0.6rem; flex-wrap: wrap; }
.erp-xf-menu .erp-xf-footer .btn { font-size: 0.78rem; }
.erp-xf-summary { font-size: 0.8rem; color: var(--erp-marine, #02054f); margin: 0.25rem 0 0.4rem; }
/* T014 : « Ajouter la selection actuelle au filtre » (visible pendant une recherche) */
.erp-xf-menu .erp-xf-add {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
    cursor: pointer;
    color: var(--erp-marine, #02054f);
}
.erp-xf-menu .erp-xf-add[hidden] { display: none; }
/* T014 : sur telephone, le menu devient un panneau en bas d'ecran, boutons larges */
@media (max-width: 575.98px) {
    .erp-xf-menu.is-sheet {
        left: 0 !important;
        right: 0;
        top: auto !important;
        bottom: 0;
        width: 100vw;
        max-height: 80dvh;
        display: none;
        border-radius: 14px 14px 0 0;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
    }
    .erp-xf-menu.is-sheet.is-open { display: block; }
    .erp-xf-menu.is-sheet .erp-xf-values { max-height: 42dvh; }
    .erp-xf-menu.is-sheet .btn,
    .erp-xf-menu.is-sheet input[type="search"] { min-height: 44px; }
    .erp-xf-menu.is-sheet .erp-xf-values label { min-height: 36px; }
}

/* T032 : les fenetres (modales) passent TOUJOURS au-dessus de la barre du haut
   (sticky, z-index 1100) et du menu tiroir (1080-1090). Sans cela, sur telephone,
   le titre et la croix de fermeture etaient caches sous la barre. Le panneau des
   notifications (2300) et le filtre Excel (2100) restent au-dessus des fenetres. */
.modal { z-index: 1200; }
.modal-backdrop { z-index: 1190; }
.modal .dropdown-menu.show,
.modal .select2-container--open { z-index: 1210; }
.toast-container { z-index: 1250; }
@media (max-width: 575.98px) {
    /* Hauteur limitee a l'ecran : en-tete et pied fixes, seul le corps defile. */
    .modal-dialog-scrollable .modal-content,
    .modal-dialog .modal-content {
        max-height: 100dvh;
    }
    .modal-dialog .modal-header {
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--erp-fond, #fff);
    }
}

/* T032 (correction 7) : pied de fenetre (toutes tailles).
   - Quand un <form> enveloppe corps + pied (Contacts, Produits, Grossistes...),
     le formulaire devient lui aussi une colonne : seul le corps defile et le pied
     reste sous le dernier champ, sans jamais le recouvrir ni sortir de l'ecran.
   - Fond opaque + trait en haut (la regle de erp-theme.css est dans une @layer et
     perdait contre Bootstrap : le pied etait transparent).
   - Le pied etant hors de la zone qui defile, une petite marge basse suffit
     (pas besoin d'une marge egale a la hauteur du pied). */
.modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.modal-content > form > .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.modal-content > .modal-footer,
.modal-content > form > .modal-footer {
    flex-shrink: 0;
    background-color: var(--erp-surface, #fff);
    border-top: 1px solid var(--erp-bordure, #eceef3);
}
@media (max-width: 575.98px) {
    .modal-dialog .modal-content {
        overflow: hidden;
    }
    .modal-content > .modal-body,
    .modal-content > form > .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
    }
    .modal-content > .modal-footer,
    .modal-content > form > .modal-footer {
        box-shadow: 0 -6px 12px -8px rgba(15, 23, 42, 0.18);
        z-index: 2;
    }
}

/* T032 : fenetres maison (.form-modal) sur telephone - la barre de boutons
   (Annuler / Enregistrer) reste collee en bas de l'ecran pendant le defilement. */
@media (max-width: 575.98px) {
    .form-modal .erp-form-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -6px 12px -8px rgba(15, 23, 42, 0.18);
    }
}

/* ==== public/css/erp-formulaire.css */
/* T092a — Charte « interface simple » (ERP_PHARMA_STANDARD_MENU_UI_UX.md) : grille de formulaire, étapes numérotées,
   action principale fixe, cas rares (bouton « … », pastilles), fenêtre commune, rond d'aide « ? ». Chargé sur toutes les
   pages, avant erp-theme.css (server/http/gabarits.js) ; à part car erp-theme.css atteindrait la limite de 800 lignes. */

/* Grille de 12 colonnes : libellés sur une ligne, champs de 48 px, tout aligné en haut (donc champs alignés entre eux).
   Téléphone : un champ par ligne ; tablette : deux par ligne (erp-t-12 = toute la ligne) ; PC : largeur demandée. */
.erp-grille {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
.erp-grille > * {
  grid-column: 1 / -1;
  min-width: 0;
  position: relative;
}
@media (min-width: 576px) {
  .erp-grille > .erp-c-3,
  .erp-grille > .erp-c-4,
  .erp-grille > .erp-c-6 {
    grid-column: span 6;
  }
  /* T092b (maquette) : 7 + 5 dès la tablette. */
  .erp-grille > .erp-c-5 {
    grid-column: span 5;
  }
  .erp-grille > .erp-c-7 {
    grid-column: span 7;
  }
  .erp-grille > .erp-t-12 {
    grid-column: 1 / -1;
  }
}
@media (min-width: 1200px) {
  .erp-grille > .erp-c-3 {
    grid-column: span 3;
  }
  .erp-grille > .erp-c-4 {
    grid-column: span 4;
  }
  .erp-grille > .erp-c-6 {
    grid-column: span 6;
  }
  .erp-grille > .erp-c-8 {
    grid-column: span 8;
  }
}
.erp-libelle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.75rem;
  margin-bottom: 0.25rem;
  min-width: 0;
}
.erp-libelle-action {
  margin-left: auto;
  flex: 0 0 auto;
}
.erp-libelle .form-label {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.erp-champ > .form-label {
  display: block;
  min-height: 1.75rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.erp-champ .form-control,
.erp-champ .form-select,
.erp-champ .input-group > .btn {
  min-height: 48px;
}

/* Étapes numérotées : le numéro passe en ✓ quand l'étape est complète (ErpEtapes.marquer). */
.erp-etape {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--erp-fond, #fff);
  border: 1px solid var(--erp-bordure, #eceef3);
  border-radius: var(--erp-rayon-carte, 14px);
}
.erp-etape-tete {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.875rem;
}
.erp-etape-titre {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.erp-etape-numero {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--erp-bordure, #eceef3);
  color: var(--erp-texte-2, #4c4d6b);
  font-size: 0.8rem;
  font-weight: 700;
}
.erp-etape.est-faite .erp-etape-numero {
  background: #e3f5ec;
  color: #0b6640;
  font-size: 0;
}
.erp-etape.est-faite .erp-etape-numero::before {
  content: "✓";
  font-size: 0.85rem;
}

/* T092b (maquette) : choix unique en boutons accolés. L'input couvre son libellé (clavier, lecteur d'écran, clic direct). */
.erp-segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--erp-bordure-controle, #8a8ca3);
  border-radius: var(--erp-rayon-bouton, 10px);
}
.erp-segment {
  position: relative;
  min-width: 0;
}
.erp-segment + .erp-segment {
  border-left: 1px solid var(--erp-bordure-champ, #dfe2ea);
}
.erp-segment input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.erp-segment label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 48px;
  padding: 0.375rem 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.erp-segment input:checked + label {
  background: var(--erp-rose, #f0a1c4);
  color: var(--erp-marine, #02054f);
}
.erp-segment input:focus-visible + label {
  outline: 3px solid var(--erp-marine, #02054f);
  outline-offset: -3px;
}
.erp-segment input:disabled {
  cursor: not-allowed;
}
.erp-segment input:disabled + label {
  background: #f6f7f9;
  color: #6b6d84;
}
@media (max-width: 575.98px) {
  .erp-segments {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .erp-segment:nth-child(odd) {
    border-left: 0;
  }
  .erp-segment:nth-child(n + 3) {
    border-top: 1px solid var(--erp-bordure-champ, #dfe2ea);
  }
}

/* Action principale toujours visible : dans le panneau de droite sur PC, barre fixe en bas sur tablette / téléphone.
   Pas d'animation d'ouverture sur sa page : un transform sur un parent décalerait la barre pendant 0,3 s. */
.section-container:has(.erp-barre-action) {
  animation: none;
}
.erp-barre-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
@media (max-width: 1199.98px) {
  .erp-barre-action {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    padding: 0.55rem 1rem calc(0.55rem + env(safe-area-inset-bottom));
    background: var(--erp-fond, #fff);
    border-top: 1px solid var(--erp-bordure, #eceef3);
    box-shadow: 0 -4px 12px rgba(2, 5, 79, 0.08);
  }
  body.agir-pour-actif .erp-barre-action {
    bottom: 56px;
  }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .erp-barre-action {
    left: 280px;
  }
  body.sidebar-collapsed .erp-barre-action {
    left: 72px;
  }
}

/* Cas rare : bouton discret « … » qui ouvre une fenêtre, puis pastille retirable. */
.btn.erp-btn-plus {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.875rem;
  border-color: var(--erp-bordure-champ, #dfe2ea);
  background: var(--erp-fond, #fff);
  color: var(--erp-texte-2, #4c4d6b);
  font-size: 0.9rem;
  font-weight: 400;
  white-space: nowrap;
}
.btn.erp-btn-plus:hover,
.btn.erp-btn-plus:focus-visible,
.btn.erp-btn-plus.show {
  border-color: var(--erp-bordure-controle, #8a8ca3);
  background: var(--erp-fond, #fff);
  color: var(--erp-marine, #02054f);
}
.erp-lien-discret {
  padding: 0 0.25rem;
  min-height: 28px;
  border: 0;
  background: none;
  color: var(--erp-marine, #02054f);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.erp-pastilles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.erp-pastille {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  max-width: 100%;
  min-height: 30px;
  padding: 0.1rem 0.7rem;
  border-radius: 999px;
  background: var(--erp-rose-doux, #fdf2f7);
  color: var(--erp-marine, #02054f);
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.erp-pastille:has(.erp-pastille-retirer) {
  padding-right: 0.15rem;
}
.erp-pastille-retirer {
  position: relative;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font-size: 1.05rem;
  line-height: 1;
}
.erp-pastille-retirer:hover {
  background: var(--erp-rose, #f0a1c4);
}
@media (pointer: coarse) {
  .erp-pastille-retirer::after {
    content: "";
    position: absolute;
    inset: -9px;
  }
}

/* T092b : menu « … Plus » (ErpPlus) ; cible d'un lien de Mes actions (ErpCible). */
.erp-plus .dropdown-item {
  min-height: 44px;
  white-space: normal;
}
.erp-cible {
  outline: 3px solid var(--erp-rose, #f0a1c4);
  outline-offset: 2px;
  scroll-margin-top: calc(var(--erp-navbar-hauteur, 64px) + 1rem);
}

/* T096b : toute fenêtre <dialog> ouverte en modale est centrée. La remise à zéro « * { margin: 0 } » d'erp-base.css
   lui retirait la marge automatique du navigateur : fenêtre collée en haut à gauche (documents RH, Agir pour, dossier). */
dialog:modal {
  margin: auto;
}

/* Fenêtre commune (ErpFenetre.confirmer), à la place de window.confirm. */
.erp-fenetre {
  width: min(28rem, calc(100vw - 2rem));
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--erp-bordure, #eceef3);
  border-radius: var(--erp-rayon-carte, 14px);
  color: var(--erp-marine, #02054f);
}
.erp-fenetre::backdrop {
  background: rgba(2, 5, 79, 0.35);
}
.erp-fenetre-titre {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.erp-fenetre-message {
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
}
.erp-fenetre-pied {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* T092a : rond d'aide « ? » (public/js/commun/aide.js) : 20 px à l'écran, zone de toucher de 44 px. */
.erp-aide {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1.5px solid var(--erp-texte-2);
  border-radius: 50%;
  background: var(--erp-fond);
  color: var(--erp-texte-2);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}
.erp-aide::after {
  content: "";
  position: absolute;
  inset: -12px;
}
.erp-aide:hover,
.erp-aide[aria-expanded="true"] {
  border-color: var(--erp-marine);
  background: var(--erp-marine);
  color: #fff;
}
.erp-aide-bulle {
  position: fixed;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  width: max-content;
  max-width: min(20rem, calc(100vw - 16px));
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--erp-marine);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(2, 5, 79, 0.25);
  animation: erp-aide-entree 0.12s ease-out;
}
.erp-aide-bulle::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: calc(var(--erp-aide-fleche, 50%) - 6px);
  width: 12px;
  height: 12px;
  background: inherit;
  transform: rotate(45deg);
}
.erp-aide-bulle.est-dessous::after {
  top: -5px;
  bottom: auto;
}
.erp-aide-texte {
  min-width: 0;
  overflow-wrap: anywhere;
}
.erp-aide-texte p {
  margin: 0;
}
.erp-aide-texte p + p {
  margin-top: 0.35rem;
}
.erp-aide-fermer {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: -0.5rem -0.7rem -0.5rem 0;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
}
.erp-aide-vivant {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@keyframes erp-aide-entree {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .erp-aide-bulle {
    animation: none;
  }
}

/* T092c : champ de la fenêtre commune (ErpFenetre.demander). */
.erp-fenetre-champ {
  margin-bottom: 1rem;
}
/* T125 : choix de la fenêtre commune (ErpFenetre.choisir) : une carte par choix, 48 px au moins. */
.erp-fenetre-option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  min-height: 48px;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--erp-bordure, #eceef3);
  border-radius: 10px;
  cursor: pointer;
}
.erp-fenetre-option:has(input:checked) {
  border-color: var(--erp-marine, #02054f);
  background: rgba(2, 5, 79, 0.04);
}
.erp-fenetre-option .form-check-input {
  flex: 0 0 auto;
  margin-top: 0.2rem;
}
.erp-fenetre-option small {
  display: block;
  color: #5b6070;
  overflow-wrap: anywhere;
}

/* T092c : haut de page figé (public/js/commun/haut-fige.js). Un élément collé par sa page reste à sa place s'il n'y a pas assez de hauteur. */
html {
  scroll-padding-top: calc(var(--erp-fige-bas, 58px) + 0.5rem);
}
.erp-fige {
  position: sticky !important;
  z-index: 900;
}
.erp-fige-ouvert {
  display: contents;
}
.erp-entete-fige {
  position: relative;
  z-index: 5;
  /* T096b : l'en-tête suit le doigt sans trembler (couche à part, déplacée par la carte graphique). */
  will-change: transform;
  backface-visibility: hidden;
}
.erp-entete-fige.is-fige th,
.erp-entete-collee.is-fige th {
  background-color: var(--erp-header, #f4f6f8);
  box-shadow: 0 2px 3px rgba(15, 23, 42, 0.12);
}
/* T097 (point 11) : tableau qui tient en largeur : la zone ne défile pas sur le côté (« visible », jamais « hidden »),
   l'en-tête est collé par le navigateur sous le haut figé (sans script, donc sans retard au doigt). */
.table-responsive.erp-zone-collee,
.erp-standard-table-responsive.erp-zone-collee,
.erp-zone-collee {
  overflow: visible !important;
}
.erp-entete-collee {
  position: sticky;
  top: var(--erp-fige-bas, 0px);
  z-index: 5;
}
.main-content .clients-filter-row:not(.erp-fige),
#produits .clients-sticky-panel:not(.erp-fige) {
  position: static;
}
.erp-standard-table-card {
  overflow: clip;
}
@media print {
  .erp-fige {
    position: static !important;
  }
  .erp-entete-fige {
    transform: none !important;
  }
  .erp-entete-collee {
    position: static;
  }
}

/* T094 (point 6) : message de succès commun (window.ErpSucces, public/js/commun/interface.js) : au milieu de
   l'écran, petit, semi-transparent, 1 seconde ; ne bloque aucun clic. */
.erp-succes {
  position: fixed;
  left: 50%;
  top: 40%;
  z-index: 3000;
  max-width: min(92vw, 420px);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(25, 135, 84, 0.82);
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%);
  transition: opacity 0.15s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.erp-succes.est-visible {
  opacity: 1;
  visibility: visible;
}
@media (prefers-reduced-motion: reduce) {
  .erp-succes {
    transition: none;
  }
}

/* T096b — restes de la charte T092 (essai 3) : champs de saisie et filtres de 48 px sur toutes les pages (Suivi,
   Gratuités, Mes BDA, Sectorisation, Produits, Grossistes, Clients, Objectifs, dossier administratif RH, Véhicules,
   demande de congé…), dans la page comme dans ses fenêtres. Les champs DANS un tableau (quantités, lignes) gardent
   leur taille (« :not(td *) ») : la ligne du tableau ne double pas de hauteur. */
.main-content .form-control:not(textarea):not(td *),
.main-content .form-select:not(td *),
.modal .form-control:not(textarea):not(td *),
.modal .form-select:not(td *),
.form-modal .form-control:not(textarea):not(td *),
.form-modal .form-select:not(td *),
dialog .form-control:not(textarea):not(td *),
dialog .form-select:not(td *) {
  min-height: 48px;
}

/* T136 : champs numériques sans petites flèches, sur tout le site (un chiffre s'écrit au clavier ; molette et flèches
   ↑ / ↓ neutralisées par public/js/commun/interface.js). Chrome / Edge / Safari, puis Firefox. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ==== public/css/erp-theme.css */
/* =============================================================================
   ERP Pharma — Thème « Flamant Santé — blanc » + responsive moderne (T013)
   Référence : docs/design/maquette-flamant.html (style 6 validé par Aymen le 17/10/2026).
   Chargé sur TOUTES les pages APRÈS Bootstrap et après le CSS propre à chaque page
   (injecté avant </head> par server/http/gabarits.js).

   Organisation :
   1) @layer erp-base / erp-composants / erp-pages : les règles NOUVELLES (polices,
      pastilles d'état, tiroir du menu, utilitaires responsive). Les couches évitent
      tout conflit : une page peut les surcharger sans !important.
   2) Section « SURCHARGES DE L'EXISTANT » (hors couche, en fin de fichier) : les
      re-colorages de styles déjà écrits SANS couche dans dashboard_css et les pages.
      Une règle posée dans une couche perd toujours face à une règle hors couche :
      ces surcharges doivent donc rester hors couche pour gagner. C'est voulu.
   ========================================================================== */

/* --------- Police DM Sans (hébergée dans le projet : public/fonts/) --------- */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/dev/fonts/DMSans-Variable-latin.woff2?v=ynLSvOqPTap4Pb36") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/dev/fonts/DMSans-Variable-latin-ext.woff2?v=XRjTHSOtph6-4dWJ") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@layer erp-base, erp-composants, erp-pages;

/* ============================== 1. BASE ==================================== */
@layer erp-base {
  :where(html) {
    -webkit-text-size-adjust: 100%;
  }

  /* Accessibilité : repère de clavier visible, partout. */
  :where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--erp-marine, #02054f);
    outline-offset: 2px;
    border-radius: 4px;
  }

  /* Mouvements réduits : pas d'animations pour qui le demande. */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* =========================== 2. COMPOSANTS NEUFS =========================== */
@layer erp-composants {
  /* ---- Pastilles d'état (couleurs de la maquette, contraste >= 4.5:1) ---- */
  .erp-etat-non-traite { background: #fdf0e1 !important; color: #8a4500 !important; }
  .erp-etat-probleme { background: #fde2e7 !important; color: #8a1030 !important; } /* T113 */
  .erp-etat-envoye     { background: #eef1fb !important; color: #2b3a8f !important; }
  .erp-etat-en-cours   { background: #eef1fb !important; color: #2b3a8f !important; }
  .erp-etat-livre      { background: #e3f5ec !important; color: #0b6640 !important; }
  .erp-etat-annule     { background: #f1f2f5 !important; color: #3a3b5c !important; }
  .erp-etat-rupture    { background: #fbe9ec !important; color: #92203a !important; }
  .erp-etat-reste      { background: #fff3d6 !important; color: #7a5200 !important; }
  .erp-etat-defaut     { background: #f1f2f5 !important; color: #3a3b5c !important; }
  [class*="erp-etat-"] {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  /* ---- Tableau : 1re colonne figée quand le tableau défile (opt-in) ---- */
  .erp-sticky-first th:first-child,
  .erp-sticky-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--erp-fond, #fff);
    box-shadow: 1px 0 0 var(--erp-bordure, #eceef3);
  }
  .erp-sticky-first thead th:first-child {
    z-index: 3;
    background: var(--erp-tete-tableau, #fafbfc);
  }

  /* ---- Grilles d'indicateurs : s'adaptent à la place disponible ---- */
  .erp-cq {
    container-type: inline-size;
  }
  /* Correction T013 (6) : 4 cartes par ligne sur PC, 2 × 2 sur tablette et
     téléphone — jamais une carte seule en fin de ligne (3 + 1). */
  .erp-cq .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
  @container (max-width: 899.98px) {
    .erp-cq .stats-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 10px !important;
    }
  }
  .erp-cq .stat-card {
    min-width: 0;
  }
  .erp-cq .stat-value {
    overflow-wrap: anywhere;
  }

  /* ---- Tiroir du menu (tablette / téléphone) : version moderne ---- */
  @media (max-width: 991.98px) {
    body.sidebar-mobile-open {
      overflow: hidden; /* la page ne défile pas derrière le menu ouvert */
    }
    body .sidebar,
    body.sidebar-collapsed .sidebar {
      position: fixed !important;
      top: var(--responsive-navbar-height, var(--navbar-height, 58px)) !important;
      left: 0;
      bottom: auto;
      height: calc(100dvh - var(--responsive-navbar-height, var(--navbar-height, 58px))) !important;
      padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
      overscroll-behavior: contain;
    }
    body.sidebar-mobile-open::before {
      background: rgba(2, 5, 79, 0.32);
    }
  }

  /* ---- Fenêtres : plein écran sur téléphone, boutons toujours visibles ---- */
  @media (max-width: 575.98px) {
    .modal-dialog,
    .modal-dialog.modal-lg,
    .modal-dialog.modal-xl,
    .modal-dialog.modal-sm {
      margin: 0 !important;
      width: 100vw;
      max-width: 100vw !important;
      min-height: 100dvh;
      display: flex;
      align-items: stretch;
    }
    .modal-dialog .modal-content {
      border-radius: 0;
      border: 0;
      width: 100%;
      min-height: 100dvh;
      max-height: 100dvh;
      display: flex;
      flex-direction: column;
    }
    .modal-dialog .modal-body {
      flex: 1 1 auto;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    .modal-dialog .modal-header,
    .modal-dialog .modal-footer {
      flex-shrink: 0;
    }
    .modal-dialog .modal-footer {
      padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
      position: sticky;
      bottom: 0;
      background: var(--erp-fond, #fff);
    }
    /* Fenêtres « maison » (RH : .form-modal) : même traitement. */
    .form-modal .form-container {
      width: 100vw !important;
      max-width: 100vw !important;
      height: 100dvh;
      max-height: 100dvh !important;
      border-radius: 0 !important;
      overflow-y: auto;
      padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
  }
  @media (min-width: 576px) {
    .modal-dialog .modal-content {
      max-height: calc(100dvh - 3.5rem);
    }
    .modal-dialog .modal-body {
      overflow-y: auto;
    }
  }

  /* ---- Groupes de boutons (pagination du Suivi...) : passent à la ligne ---- */
  @media (max-width: 575.98px) {
    .btn-group {
      flex-wrap: wrap;
    }
  }

  /* ---- Cibles tactiles : au doigt, rien de trop petit ---- */
  @media (pointer: coarse) {
    .btn:not(.btn-sm),
    .form-control:not(.form-control-sm),
    .form-select:not(.form-select-sm),
    .page-link {
      min-height: 44px;
    }
    .btn-sm,
    .form-control-sm,
    .form-select-sm {
      min-height: 38px;
    }
    .sidebar-menu a,
    .sidebar .accordion-button,
    .dropdown-item {
      min-height: 44px;
    }
    .form-check-input {
      width: 1.3em;
      height: 1.3em;
    }
  }
}

/* ======================= 3. RÉGLAGES PAR PAGE (pilotes) ==================== */
@layer erp-pages {
  /* Les retouches propres aux 3 pages pilotes (couleurs bleues remplacées par
     les jetons) sont faites DANS leurs fichiers (Client.html, Commande.html,
     pages/rh/rh-employes.html) : leur CSS est hors couche, une règle posée ici
     ne pourrait pas le repeindre. Cette couche reste disponible pour T014. */
  .nav.rh-tabs .nav-link.active {
    background: var(--erp-rose-doux, #fdf2f7);
    color: var(--erp-marine, #02054f);
  }
}

/* =============================================================================
   SURCHARGES DE L'EXISTANT (volontairement HORS couche : une règle en couche ne
   peut pas repeindre les styles historiques écrits hors couche — voir l'en-tête).
   ========================================================================== */

/* ------------------------------ Jetons ------------------------------------ */
:root {
  /* Jetons Flamant Santé */
  --erp-rose: #f0a1c4;
  --erp-rose-survol: #e98bb5;
  --erp-rose-doux: #fdf2f7;
  --erp-marine: #02054f;
  --erp-texte-2: #4c4d6b;
  --erp-fond: #ffffff;
  --erp-bordure: #eceef3;
  --erp-bordure-champ: #dfe2ea;
  /* Correction T013 (4/8e) : bords des commandes de saisie >= 3:1 sur blanc. */
  --erp-bordure-controle: #8a8ca3;
  --erp-tete-tableau: #fafbfc;
  --erp-ligne-tableau: #f1f2f6;
  --erp-rayon-carte: 14px;
  --erp-rayon-bouton: 10px;
  --erp-police: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* T034 : textes d'état lisibles sur blanc (contraste >= 4,5:1), mêmes teintes que les pastilles erp-etat-*. */
  --erp-texte-ok: #0b6640;
  --erp-texte-attention: #7a5200;
  --erp-texte-orange: #8a4500;
  --erp-texte-alerte: #92203a;

  /* Jetons historiques (dashboard_css) re-pointés vers le thème */
  --primary: var(--erp-marine);
  --secondary: var(--erp-texte-2);
  --bg: var(--erp-fond);
  --card: var(--erp-fond);
  --dark: var(--erp-marine);
  --muted: var(--erp-texte-2);
  --border: var(--erp-bordure);
  --radius: var(--erp-rayon-carte);

  /* Variables Bootstrap 5.3 : tous les composants suivent sans réécrire les pages */
  --bs-primary: var(--erp-rose);
  --bs-primary-rgb: 240, 161, 196;
  --bs-body-bg: var(--erp-fond);
  --bs-body-color: var(--erp-marine);
  --bs-body-font-family: var(--erp-police);
  --bs-border-color: var(--erp-bordure);
  --bs-border-radius: var(--erp-rayon-bouton);
  --bs-border-radius-lg: var(--erp-rayon-carte);
  --bs-link-color: var(--erp-marine);
  --bs-link-color-rgb: 2, 5, 79;
  --bs-link-hover-color: #2b3a8f;
  --bs-link-hover-color-rgb: 43, 58, 143;
  --bs-secondary-color: var(--erp-texte-2);
  --bs-emphasis-color: var(--erp-marine);
}

body {
  font-family: var(--erp-police);
  background-color: var(--erp-fond);
  color: var(--erp-marine);
}

/* Titres de page : fluides, jamais tronqués. */
.page-title,
h1.page-title {
  font-size: clamp(1.2rem, 1rem + 1.1vw, 1.55rem);
  font-weight: 800;
  color: var(--erp-marine);
  white-space: normal;
}

/* --------------------------- Barre du haut -------------------------------- */
.navbar-custom {
  background: var(--erp-fond);
  box-shadow: none;
  border-bottom: 1px solid var(--erp-bordure);
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}
.navbar-custom .navbar-brand {
  color: var(--erp-marine) !important;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
}
/* Logo : tuile rose arrondie (repère de marque, comme la maquette). */
.navbar-custom .navbar-brand i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--erp-rose);
  color: var(--erp-marine);
  font-size: 1rem;
}
.user-avatar {
  background-color: var(--erp-rose-doux);
  color: var(--erp-marine);
  border: 1px solid var(--erp-rose);
}
.user-menu {
  color: var(--erp-marine);
}
.btn-logout {
  background-color: var(--erp-fond);
  border: 1px solid var(--erp-bordure-champ);
  color: var(--erp-marine);
  border-radius: var(--erp-rayon-bouton);
  font-weight: 600;
}
.btn-logout:hover {
  background-color: var(--erp-rose-doux);
  border-color: var(--erp-rose);
}
.sidebar-toggle,
.sidebar-toggle-responsive {
  border: 1px solid var(--erp-bordure-champ);
  background: var(--erp-fond);
  color: var(--erp-marine);
  border-radius: 10px;
}
.sidebar-toggle:hover {
  background: var(--erp-rose-doux);
  transform: none;
}
/* Très petits téléphones (<= 380 px) : barre du haut compacte, rien de coupé.
   (Hors couche : surcharge le CSS historique de la barre.) */
@media (max-width: 379.98px) {
  .navbar-custom {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }
  /* Le texte de marque laisse la place ; la tuile rose reste le logo. */
  .navbar-custom .navbar-brand {
    font-size: 0;
    gap: 0;
  }
  .navbar-custom .navbar-brand i {
    font-size: 1rem;
  }
  .navbar-inner,
  .user-menu {
    gap: 0.35rem;
  }
  .btn-logout {
    padding: 0.3rem 0.45rem;
  }
}

/* --------------------------- Menu latéral --------------------------------- */
.sidebar {
  background: var(--erp-fond);
  border-right: 1px solid var(--erp-bordure);
}
@supports (height: 100dvh) {
  @media (min-width: 992px) {
    .sidebar {
      height: calc(100dvh - var(--navbar-height));
    }
  }
}
.sidebar .accordion-button {
  font-weight: 700;
  color: var(--erp-marine);
  background: transparent;
}
.sidebar .accordion-button:not(.collapsed) {
  color: var(--erp-marine);
  background: transparent;
  box-shadow: none;
}
.sidebar-menu li {
  margin: 0 0.6rem 2px;
}
.sidebar-menu a {
  border-left: 0;
  border-radius: var(--erp-rayon-bouton);
  color: #3a3b5c;
  font-weight: 600;
  padding: 0.62rem 0.9rem;
}
.sidebar-menu a:hover {
  background-color: #f6f7fa;
  border-left-color: transparent;
  color: var(--erp-marine);
}
.sidebar-menu a.active {
  background-color: var(--erp-rose-doux);
  border-left-color: transparent;
  color: var(--erp-marine);
  font-weight: 700;
}
/* Le repère rose de l'élément actif (le « point » de la maquette). */
.sidebar-menu a i {
  color: #8a8ba6;
}
.sidebar-menu a.active i {
  color: var(--erp-rose);
}

/* ------------------------------ Boutons ----------------------------------- */
.btn {
  --bs-btn-border-radius: var(--erp-rayon-bouton);
  font-weight: 600;
}
/* Bouton principal : rose flamant, texte MARINE (jamais blanc sur rose). */
.btn-primary {
  --bs-btn-bg: var(--erp-rose);
  --bs-btn-border-color: var(--erp-rose);
  --bs-btn-color: var(--erp-marine);
  --bs-btn-hover-bg: var(--erp-rose-survol);
  --bs-btn-hover-border-color: var(--erp-rose-survol);
  --bs-btn-hover-color: var(--erp-marine);
  --bs-btn-active-bg: var(--erp-rose-survol);
  --bs-btn-active-border-color: var(--erp-rose-survol);
  --bs-btn-active-color: var(--erp-marine);
  --bs-btn-disabled-bg: #f7cbde;
  --bs-btn-disabled-border-color: #f7cbde;
  --bs-btn-disabled-color: #4c4d6b;
  --bs-btn-focus-shadow-rgb: 240, 161, 196;
  font-weight: 700;
}
.btn-outline-primary {
  --bs-btn-color: var(--erp-marine);
  --bs-btn-border-color: var(--erp-bordure-champ);
  --bs-btn-hover-color: var(--erp-marine);
  --bs-btn-hover-bg: var(--erp-rose-doux);
  --bs-btn-hover-border-color: var(--erp-rose);
  --bs-btn-active-color: var(--erp-marine);
  --bs-btn-active-bg: var(--erp-rose-doux);
  --bs-btn-active-border-color: var(--erp-rose);
  --bs-btn-focus-shadow-rgb: 240, 161, 196;
}
.btn-secondary,
.btn-outline-secondary {
  --bs-btn-focus-shadow-rgb: 76, 77, 107;
}
/* T034 : action secondaire = contour marine (Annuler, Réinitialiser, Exporter...). */
.btn-outline-secondary {
  --bs-btn-color: var(--erp-marine);
  --bs-btn-border-color: var(--erp-bordure-controle);
  --bs-btn-hover-color: var(--erp-marine);
  --bs-btn-hover-bg: var(--erp-rose-doux);
  --bs-btn-hover-border-color: var(--erp-marine);
  --bs-btn-active-color: var(--erp-marine);
  --bs-btn-active-bg: var(--erp-rose-doux);
  --bs-btn-active-border-color: var(--erp-marine);
  --bs-btn-disabled-color: var(--erp-texte-2);
  --bs-btn-disabled-border-color: var(--erp-bordure-champ);
}
/* T076f (point 15, essai réel du 01/11) : bouton GRISÉ nettement différent d'un bouton actif (fond gris, texte gris,
   bord en pointillés, curseur « interdit ») ; le survol garde le texte d'aide (title) du bouton. */
.btn:disabled,
.btn.disabled,
fieldset:disabled .btn {
  --bs-btn-disabled-bg: #e9ecef;
  --bs-btn-disabled-border-color: #adb5bd;
  --bs-btn-disabled-color: #5c636a;
  --bs-btn-disabled-opacity: 1;
  border-style: dashed;
  box-shadow: none;
}
/* Vrai bouton grisé : le curseur « interdit » et le texte d'aide au survol (un lien .disabled reste inactif). */
button.btn:disabled {
  cursor: not-allowed;
  pointer-events: auto;
}
/* Boutons-icônes des barres d'outils (import / export...) : blancs, bord fin. */
.btn-icon,
.btn-info.btn-icon,
.btn-secondary.btn-icon {
  background: var(--erp-fond);
  border: 1px solid var(--erp-bordure-champ);
  color: var(--erp-marine);
  border-radius: var(--erp-rayon-bouton);
}
.btn-icon:hover,
.btn-info.btn-icon:hover,
.btn-secondary.btn-icon:hover {
  background: var(--erp-rose-doux);
  border-color: var(--erp-rose);
  color: var(--erp-marine);
}
/* Pas de texte blanc sur rose, où que la couleur primaire soit utilisée. */
.text-bg-primary {
  background-color: var(--erp-rose) !important;
  color: var(--erp-marine) !important;
}
.bg-primary {
  background-color: var(--erp-rose) !important;
}
/* T051 : une pastille (.badge) sur fond rose a, elle aussi, son texte en marine (avant : blanc, 2:1). */
.badge.bg-primary {
  --bs-badge-color: var(--erp-marine);
  color: var(--erp-marine);
}

/* --------------------------- Champs de saisie ------------------------------ */
/* Correction T013 (4) : bords visibles (>= 3:1) sur fond blanc. */
.form-control,
.form-select {
  border-color: var(--erp-bordure-controle);
  border-radius: var(--erp-rayon-bouton);
  color: var(--erp-marine);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--erp-marine);
  box-shadow: 0 0 0 0.25rem rgba(240, 161, 196, 0.35);
}
.form-check-input {
  border-color: var(--erp-bordure-controle);
}
/* Coche / point / interrupteur : rose avec repere MARINE (jamais blanc sur rose). */
.form-check-input:checked {
  background-color: var(--erp-rose);
  border-color: var(--erp-marine);
}
.form-check-input:checked[type="checkbox"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2302054F' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
.form-check-input:checked[type="radio"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%2302054F'/%3e%3c/svg%3e");
}
.form-switch .form-check-input {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2302054F'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:focus {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2302054F'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:checked {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2302054F'/%3e%3c/svg%3e");
}
.form-check-input:focus {
  border-color: var(--erp-marine);
  box-shadow: 0 0 0 0.25rem rgba(240, 161, 196, 0.35);
}

/* ------------------------------- Cartes ------------------------------------ */
.card {
  --bs-card-border-color: var(--erp-bordure);
  --bs-card-border-radius: var(--erp-rayon-carte);
  box-shadow: none;
}
.stat-card {
  background: var(--erp-fond);
  border: 1px solid var(--erp-bordure);
  border-radius: var(--erp-rayon-carte);
  box-shadow: none;
  border-top: 1px solid var(--erp-bordure);
}
.stat-card:hover {
  box-shadow: none;
  transform: none;
  border-color: #d9dce6;
}
/* Plus de liseré coloré en haut des cartes : le repère passe en trait du bas. */
.stat-card.primary,
.stat-card.success,
.stat-card.info,
.stat-card.warning,
.stat-card.danger {
  border-top-color: var(--erp-bordure);
}
/* Le petit trait sous l'indicateur (maquette) remplace la barre du dessus. */
.stat-card::after {
  content: "";
  display: block;
  height: 4px;
  width: 40px;
  border-radius: 4px;
  background: #e6e8ef;
  margin-top: 8px;
}
.stat-card.primary::after {
  background: var(--erp-rose);
}
.stat-value {
  color: var(--erp-marine);
  font-weight: 800;
}
.stat-label {
  color: var(--erp-texte-2);
  font-weight: 500;
}

/* ------------------------------ Tableaux ----------------------------------- */
.table {
  --bs-table-hover-bg: var(--erp-tete-tableau);
  --bs-table-striped-bg: #fcfcfe;
  color: var(--erp-marine);
}
.main-content table thead th,
.table thead th,
.table > thead > tr > th {
  background: var(--erp-tete-tableau);
  color: var(--erp-texte-2);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--erp-bordure);
}
.table td,
.table th {
  border-color: var(--erp-ligne-tableau);
}

/* --------- Composants Bootstrap aux couleurs « cuites en dur » ------------- */
.pagination {
  --bs-pagination-color: var(--erp-marine);
  --bs-pagination-hover-color: var(--erp-marine);
  --bs-pagination-hover-bg: var(--erp-rose-doux);
  --bs-pagination-focus-color: var(--erp-marine);
  --bs-pagination-focus-bg: var(--erp-rose-doux);
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(240, 161, 196, 0.35);
  --bs-pagination-active-bg: var(--erp-rose);
  --bs-pagination-active-border-color: var(--erp-rose);
  --bs-pagination-active-color: var(--erp-marine);
  --bs-pagination-border-color: var(--erp-bordure-champ);
}
.nav-pills {
  --bs-nav-pills-link-active-bg: var(--erp-rose);
  --bs-nav-pills-link-active-color: var(--erp-marine);
}
.nav {
  --bs-nav-link-color: var(--erp-marine);
  --bs-nav-link-hover-color: var(--erp-marine);
}
.progress,
.progress-stacked {
  --bs-progress-bar-bg: var(--erp-rose);
  --bs-progress-bar-color: var(--erp-marine);
}
.list-group {
  --bs-list-group-active-bg: var(--erp-rose);
  --bs-list-group-active-border-color: var(--erp-rose);
  --bs-list-group-active-color: var(--erp-marine);
}
.btn-link {
  --bs-btn-color: var(--erp-marine);
  --bs-btn-hover-color: #2b3a8f;
}
/* Texte « primaire » : marine (du texte bleu clair sur blanc lirait mal). */
.text-primary {
  color: var(--erp-marine) !important;
}

/* --------------------------- Menus déroulants ------------------------------ */
.dropdown-menu {
  --bs-dropdown-border-color: var(--erp-bordure);
  --bs-dropdown-border-radius: 12px;
  --bs-dropdown-link-hover-bg: #f6f7fa;
  --bs-dropdown-link-active-bg: var(--erp-rose-doux);
  --bs-dropdown-link-active-color: var(--erp-marine);
  box-shadow: 0 10px 24px rgba(2, 5, 79, 0.08);
}

/* ------------------------------ Fenêtres ----------------------------------- */
.modal-content {
  border-radius: var(--erp-rayon-carte);
  border: 1px solid var(--erp-bordure);
}
.modal-header {
  border-bottom-color: var(--erp-bordure);
}
.modal-footer {
  border-top-color: var(--erp-bordure);
}

/* ------------------- Pastilles d'état sur l'existant ----------------------- */
/* Les classes génériques .client-badge gardent leur géométrie (pastille 999px)
   mais prennent la typo du thème ; les couleurs d'état des commandes passent
   par les classes .erp-etat-* (voir la couche erp-composants). */
.client-badge {
  font-family: var(--erp-police);
}

/* Liens d'action discrets : soulignés au survol seulement si la page le veut. */
a {
  text-decoration-color: rgba(2, 5, 79, 0.35);
}

/* L'interrupteur « Afficher les inactifs » (T012) suit le rose du thème. */
[data-erp-inactive-toggle] .form-check-input:checked {
  background-color: var(--erp-rose);
  border-color: var(--erp-rose);
}

/* Bandeau d'indicateurs de la page Clients : carte du thème. */
#clients .clients-kpis {
  background: var(--erp-fond);
  border-color: var(--erp-bordure);
  border-radius: var(--erp-rayon-carte);
}
#clients .clients-kpis .stat-card {
  border: 1px solid var(--erp-bordure);
}
/* Dans ce bandeau compact, pas de trait décoratif (lignes « libellé : valeur »). */
#clients .clients-kpis .stat-card::after {
  display: none;
}
