/* =========================================================
   BrocManager — style.core.css
   Nettoyé et réorganisé — suppression des doublons
   Date: 2025-12-27
   =========================================================
   SOMMAIRE:
   1. TOKENS — LIGHT MODE
   2. TOKENS — DARK MODE
   3. RESET / BASE
   4. LAYOUT GLOBAL (shell / sidebar / topbar)
   5. SIDEBAR NAVIGATION & ACCORDÉON
   6. TOPBAR & MENU UTILISATEUR
   7. BADGES & PILLS
   8. TITRES & TYPO
   9. BOUTONS
   10. CARTES / BLOCS
   11. ICÔNES RONDES (.quick-icon)
   12. FORMULAIRES
   13. QR TILES & UPLOAD
   14. DASHBOARD - ACCÈS RAPIDES
   15. LISTE ARTICLES - CARTES PRODUITS
   16. FILTRES & TRI
   17. TABLEAUX
   18. DARK MODE - OVERRIDES TAILWIND
   19. RESPONSIVE - MOBILE
   20. FOCUS STATES - ACCESSIBILITÉ
   21. UTILITAIRES

   ========================================================= */

/* =========================================================
   1. TOKENS — LIGHT MODE
   ========================================================= */

:root {
    /* ----- Fonds ----- */
    --bm-bg: #f3f4f6;
    --bm-bg-card: #ffffff;
    --bm-bg-soft: #e5e7eb;
    --bm-bg-dark-alt: #2f3b49;

    /* ----- Fonds structure ----- */
    --bm-menu-bg: #ffffff;
    --bm-topbar-bg: #ffffff;
    --bm-shell-bg: #f3f4f6;

    /* ----- Texte ----- */
    --bm-text-strong: #111827;
    --bm-text-main: #374151;
    --bm-text-muted: #94a3b8;
    --bm-text-white: #ffffff;

    /* ----- Couleur principale ----- */
    --bm-primary: #22c55e;
    --bm-primary-hover: #16a34a;
    --bm-primary-soft: rgba(34, 197, 94, 0.12);
    --bm-primary-rgb: 34, 197, 94;

    /* ----- Couleur secondaire (bleu) ----- */
    --bm-secondary: #3056d3;
    --bm-secondary-hover: #2545b8;
    --bm-secondary-soft: rgba(48, 86, 211, 0.12);
    --bm-secondary-rgb: 48, 86, 211;

    /* ----- Bordures ----- */
    --bm-border: rgba(148, 163, 184, 0.18);
    --bm-border-soft: #e5e7eb;
    --bm-border-subtle: #d1d5db;

    /* ----- Icônes / inputs ----- */
    --bm-icon-circle: #e5e7eb;
    --bm-icon-color: #64748b;
    --bm-input-bg: var(--bm-bg-soft);
    --bm-input-border: var(--bm-border-soft);

    /* ----- Sidebar ----- */
    --bm-sidebar-text: var(--bm-text-main);
    --bm-sidebar-text-hover: #3E5F62;
    --bm-sidebar-active-bg: var(--bm-primary);
    --bm-sidebar-submenu-bg: rgba(255, 255, 255, 0.05);
    --bm-sidebar-divider: rgba(148, 163, 184, 0.10);

    /* ----- Boutons icônes ----- */
    --bm-btn-icon-bg: var(--bm-icon-circle);
    --bm-btn-icon-bg-hover: #dfe4ee;
    --bm-btn-icon-color: var(--bm-primary);

    /* ----- Layout ----- */
    --bm-sidebar-width: 290px;
    --bm-header-height: 90px;

    /* ----- Border radius ----- */
    --bm-radius-sm: 4px;
    --bm-radius-md: 8px;
    --bm-radius-lg: 12px;
    --bm-radius-full: 999px;

    /* ----- Shadows ----- */
    --bm-shadow-card: 0 18px 40px rgba(15, 23, 42, 0.05);
    --bm-shadow-card-hover: 0 20px 45px rgba(15, 23, 42, 0.08);
    --bm-shadow-dropdown: 0 18px 40px rgba(15, 23, 42, 0.12);
    --bm-shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
    --bm-shadow-topbar: inset 0 -1px 0 rgba(15, 23, 42, 0.08);

    /* ----- Transitions ----- */
    --bm-transition: 0.15s ease;
    --bm-transition-fast: 0.1s ease;
    --bm-transition-medium: 0.2s ease-out;

    /* ----- Focus ----- */
    --bm-focus-ring: 0 0 0 2px rgba(34, 197, 94, 0.15);


    /* ----- Table Kit (tables) ----- */
    --bm-table-head-bg: var(--bm-bg-soft);
    --bm-table-row-hover-bg: #f8fafc; /* proche Tailwind hover:bg-slate-50 */
    --bm-table-row-focus-bg: #f8fafc;
    --bm-table-row-focus-border: rgba(var(--bm-primary-rgb), 0.22);
    --bm-table-zebra-bg: rgba(15, 23, 42, 0.02);
    --bm-table-sticky-divider: 1px 0 0 var(--bm-border-soft);
    --bm-table-row-transition: 0.12s ease;

    
    --bm-table-cell-px: 16px;   /* padding horizontal standard */
    --bm-table-cell-py: 10px;    /* padding vertical standard */

    --bm-table-cell-px-compact: 12px;
    --bm-table-cell-py-compact: 6px;


    /* ----- Badges : statuts articles (LIGHT) ----- */
    --bm-status-vente-bg: var(--bm-primary-soft);
    --bm-status-vente-color: var(--bm-primary);
    --bm-status-vente-border: rgba(var(--bm-primary-rgb), 0.35);

    --bm-status-stock-bg: rgba(62, 95, 98, 0.12);
    --bm-status-stock-color: #3E5F62;
    --bm-status-stock-border: rgba(62, 95, 98, 0.30);

    --bm-status-vendu-bg: rgba(148, 163, 184, 0.18);
    --bm-status-vendu-color: #475569;
    --bm-status-vendu-border: rgba(148, 163, 184, 0.38);

    --bm-status-autre-bg: rgba(148, 163, 184, 0.18);
    --bm-status-autre-color: #475569;
    --bm-status-autre-border: rgba(148, 163, 184, 0.38);

    /* ----- Badges événements ----- */
    --bm-badge-inscrit-bg: rgba(33, 150, 83, 0.1);
    --bm-badge-inscrit-color: #219653;
    --bm-badge-reserve-bg: rgba(48, 86, 211, 0.1);
    --bm-badge-reserve-color: #3056d3;
    --bm-badge-annule-bg: rgba(211, 64, 83, 0.12);
    --bm-badge-annule-color: #d34053;
    --bm-badge-autre-bg: rgba(255, 167, 11, 0.1);
    --bm-badge-autre-color: #ffa70b;

    /* ----- Quick icon ----- */
    --bm-quick-icon-bg: rgba(48, 86, 211, 0.06);
    --bm-quick-icon-border: rgba(148, 163, 184, 0.35);

    /* ----- Charts (palette) ----- */
--bm-chart-warning: #ffa70b;
--bm-chart-neutral: #94a3b8;

    /* ----- Charts (palette standard) ----- */
    --bm-chart-primary: var(--bm-primary);
    --bm-chart-secondary: var(--bm-secondary);

    /* Aligné avec tes statuts inventaire */
    --bm-chart-stock: var(--bm-status-stock-color);  /* #3E5F62 en light */
    --bm-chart-vendu: var(--bm-status-vendu-color);  /* #475569 en light */

    /* Neutre / warning cohérents UI */
    --bm-chart-neutral: #94a3b8;
    --bm-chart-warning: #ffa70b;

    /* Fills (zones / aires) */
    --bm-chart-fill-primary: rgba(var(--bm-primary-rgb), 0.12);
    --bm-chart-fill-secondary: rgba(var(--bm-secondary-rgb), 0.12);



    /* ----- Inventaire row ----- */
    --bm-inventaire-hover-bg: var(--bm-primary-soft);
    --bm-inventaire-hover-border: var(--bm-primary);
}





/* =========================================================
   2. TOKENS — DARK MODE
   ========================================================= */

body.dark-mode {
    color-scheme: dark;

    /* ----- Fonds ----- */
    --bm-bg: #1B2633;
    --bm-bg-card: rgba(148, 163, 184, 0.04);
    --bm-bg-soft: rgba(148, 163, 184, 0.04);
    --bm-bg-dark-alt: rgba(148, 163, 184, 0.04);


    /* ----- Structure ----- */
    --bm-menu-bg: #1B2633;
    --bm-topbar-bg: #1B2633;

    /* ----- Texte ----- */
    --bm-text-strong: #f9fafb;
    --bm-text-main: #d1d5db;
    --bm-text-muted: #9ca3af;

    /* ----- Bordures ----- */
    --bm-border: rgba(148, 163, 184, 0.14);
    --bm-border-soft: rgba(255, 255, 255, 0.10);
    --bm-border-subtle: rgba(148, 163, 184, 0.20);

    /* ----- Couleur principale ----- */
    --bm-primary: #22c55e;
    --bm-primary-hover: #16a34a;
    --bm-primary-soft: rgba(34, 197, 94, 0.20);
    --bm-primary-rgb: 34, 197, 94;

    /* ----- Couleur secondaire (bleu) ----- */
    --bm-secondary: #5b7fff;
    --bm-secondary-hover: #4a6ee8;
    --bm-secondary-soft: rgba(48, 86, 211, 0.35);
    --bm-secondary-rgb: 48, 86, 211;

    /* ----- Icônes / inputs ----- */
    --bm-icon-circle: var(--bm-quick-icon-bg);
    --bm-icon-color: #ffffff;
    --bm-input-bg: var(--bm-bg-soft);
    --bm-input-border: var(--bm-border-soft);

    /* ----- Sidebar ----- */
    --bm-sidebar-bg: var(--bm-topbar-bg);
    --bm-sidebar-text: #aeb7bf;
    --bm-sidebar-text-hover: #ffffff;
    --bm-sidebar-active-bg: #22c55e;
    --bm-sidebar-submenu-bg: rgba(148, 163, 184, 0.10);
    --bm-sidebar-divider: rgba(148, 163, 184, 0.10);

    /* ----- Boutons icônes ----- */
    --bm-btn-icon-bg: var(--bm-primary);
    --bm-btn-icon-bg-hover: var(--bm-primary-hover);
    --bm-btn-icon-color: #ffffff;

    /* ----- Shadows ----- */
    --bm-shadow-card: 0 18px 20px rgba(0, 0, 0, 0.05);
    --bm-shadow-card-hover: 0 22px 60px rgba(0, 0, 0, 0.42);
    --bm-shadow-dropdown: 0 18px 55px rgba(0, 0, 0, 0.50);
    --bm-shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
    --bm-shadow-topbar: inset 0 -1px 0 rgba(255, 255, 255, 0.07);

    /* ----- Focus ----- */
    --bm-focus-ring: 0 0 0 2px rgba(34, 197, 94, 0.20);


    /* ----- Table Kit (tables) ----- */
    --bm-table-head-bg: var(--bm-bg-soft);
    --bm-table-row-hover-bg: rgba(148, 163, 184, 0.06);
    --bm-table-row-focus-bg: rgba(148, 163, 184, 0.08);
    --bm-table-row-focus-border: rgba(var(--bm-primary-rgb), 0.28);
    --bm-table-zebra-bg: rgba(148, 163, 184, 0.03);
    --bm-table-sticky-divider: 1px 0 0 rgba(148, 163, 184, 0.16);
    --bm-table-row-transition: 0.12s ease;

    /* Padding standard global */
.bm-table thead th,
.bm-table tbody td{
  padding-left: var(--bm-table-cell-px);
  padding-right: var(--bm-table-cell-px);
  padding-top: var(--bm-table-cell-py);
  padding-bottom: var(--bm-table-cell-py);
  vertical-align: middle;
}



    /* ----- Badges : statuts articles (DARK) ----- */
    --bm-status-vente-bg: rgba(var(--bm-primary-rgb), 1);
    --bm-status-vente-color: #ffffff;
    --bm-status-vente-border: rgba(var(--bm-primary-rgb), 0.35);

    --bm-status-stock-bg: #8494a9;
    --bm-status-stock-color: #ffffff;
    --bm-status-stock-border: rgba(148, 163, 184, 0.28);

    --bm-status-vendu-bg: rgba(59, 75, 94, 1);
    --bm-status-vendu-color: #ffffff;
    --bm-status-vendu-border: rgba(148, 163, 184, 0.20);

    --bm-status-autre-bg: rgba(148, 163, 184, 0.12);
    --bm-status-autre-color: #cbd5e1;
    --bm-status-autre-border: rgba(148, 163, 184, 0.22);

    /* ----- Badges événements ----- */
    --bm-badge-inscrit-bg: rgba(var(--bm-primary-rgb), 1);
    --bm-badge-inscrit-color: #ffffff;
    --bm-badge-reserve-bg: rgba(148, 163, 184, 1);
    --bm-badge-reserve-color: #ffffff;
    --bm-badge-annule-bg: rgba(59, 75, 94, 1);
    --bm-badge-annule-color: #ffffff;
    --bm-badge-autre-bg: rgba(148, 163, 184, 1);
    --bm-badge-autre-color: #ffffff;

    /* ----- Quick icon ----- */
    --bm-quick-icon-bg: #2B3A4B;
    --bm-quick-icon-border: rgba(148, 163, 184, 0.20);

    /* ----- Inventaire row ----- */
    --bm-inventaire-hover-bg: rgba(148, 163, 184, 0.05);
    --bm-inventaire-hover-border: rgba(148, 163, 184, 0.07);

    /* ----- Charts (palette) ----- */
--bm-chart-warning: #ffa70b;
--bm-chart-neutral: #94a3b8;

    /* ----- Charts (palette standard) ----- */
    --bm-chart-primary: var(--bm-primary);
    --bm-chart-secondary: var(--bm-secondary);

    /* En dark, on privilégie les BG de statuts (plus lisibles que du texte blanc) */
    --bm-chart-stock: var(--bm-status-stock-bg);
    --bm-chart-vendu: var(--bm-status-vendu-bg);

    --bm-chart-neutral: #94a3b8;
    --bm-chart-warning: #ffa70b;

    /* Fills (zones / aires) */
    --bm-chart-fill-primary: rgba(var(--bm-primary-rgb), 0.22);
    --bm-chart-fill-secondary: rgba(var(--bm-secondary-rgb), 0.22);


}

/* =========================================================
   3. RESET / BASE
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--bm-text-main);
    background-color: var(--bm-bg);
}

/* Anti-flash global */
body.theme-switching *,
body.theme-switching *::before,
body.theme-switching *::after {
    transition: none !important;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--bm-text-strong);
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
}

/* Suppression des flèches sur les inputs number */
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;
}

/* =========================================================
   4. LAYOUT GLOBAL
   ========================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--bm-bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--bm-sidebar-width);
    flex-shrink: 0;
    background-color: var(--bm-topbar-bg);
    border-right: 1px solid var(--bm-border-soft);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-header {
    height: var(--bm-header-height);
    min-height: var(--bm-header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.sidebar-logo-circle {
    width: 40px;
    height: 40px;
    margin-right: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-circle svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sidebar-logo-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

/* ---------- Partie droite (topbar + contenu) ---------- */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--bm-bg);
}

.main-content {
    flex: 1;
    padding: 24px 32px 32px;
}

.page-container {
    max-width: 1120px;
    margin: 0 auto;
}

/* =========================================================
   MOBILE — App-shell + sidebar off-canvas (anti overflow global)
   ========================================================= */
@media (max-width: 767px){

  /* On limite le scroll horizontal au conteneur principal (évite effets de bord) */
  .app-shell{
    width: 100%;
    min-width: 0;
    overflow-x: clip;   /* moderne */
  }
  @supports not (overflow: clip){
    .app-shell{ overflow-x: hidden; }
  }

  /* Sidebar hors du flow en mobile */
  .sidebar{
    position: fixed !important;
    top: 0;
    left: 0 !important;
    height: 100dvh;
    width: var(--bm-sidebar-width);
    z-index: 2000;
    transform: translateX(-100%) !important;
    transition: transform var(--bm-transition);
    will-change: transform;
  }

  .sidebar.is-open,
  body.sidebar-open .sidebar{
    transform: translateX(0) !important;
  }

  .main-content{
    width: 100%;
    min-width: 0;
  }
}

/* =========================================================
   5. SIDEBAR NAVIGATION & ACCORDÉON
   ========================================================= */

/* -------- Nav container -------- */
.sidebar-nav {
    padding: 16px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* -------- Titres de section (si utilisés) -------- */
.sidebar-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 500;
    color: var(--bm-sidebar-text);
    margin: 10px 8px 4px;
    padding: 8px 12px;
    border-radius: var(--bm-radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--bm-transition), color var(--bm-transition);
}

.sidebar-section-title::after {
    content: "▾";
    font-size: 16px;
    line-height: 1;
    margin-left: 8px;
    color: inherit;
    transition: transform var(--bm-transition), opacity var(--bm-transition);
}

.sidebar-section-title.is-collapsed::after {
    transform: rotate(-90deg);
    opacity: 0.6;
}

/* Hover niveau principal = vert */
.sidebar-section-title:hover {
    background-color: var(--bm-sidebar-active-bg);
    color: var(--bm-sidebar-text-hover);
}

/* -------- Liens principaux -------- */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--bm-radius-sm);
    color: var(--bm-sidebar-text);
    font-size: 15px;
    font-weight: 500;
    background-color: transparent;
    transition: background-color var(--bm-transition), color var(--bm-transition);
}

.sidebar-link.is-hidden {
    display: none;
}

.sidebar-link:hover {
    background-color: var(--bm-sidebar-active-bg);
    color: var(--bm-sidebar-text-hover);
}

.sidebar-link.is-active {
    background-color: var(--bm-sidebar-active-bg);
    color: var(--bm-sidebar-text-hover);
}

.sidebar-link-text {
    white-space: nowrap;
}

/* Anti-override (Tailwind / hover bg) — UNIQUEMENT niveau principal */
.sidebar .sidebar-link:hover,
.sidebar .sidebar-section-title:hover,
.sidebar .sidebar-group-header:hover {
    background-color: var(--bm-sidebar-active-bg) !important;
    color: var(--bm-sidebar-text-hover) !important;
}

/* -------- Accordéon (groupe) -------- */
.sidebar-group {
    margin-top: 8px;
}

.sidebar-group-header {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--bm-radius-sm);
    color: var(--bm-sidebar-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    gap: 10px;
    transition: background-color var(--bm-transition), color var(--bm-transition), box-shadow var(--bm-transition);
}

.sidebar-group-header:hover {
    background-color: var(--bm-sidebar-active-bg);
    color: var(--bm-sidebar-text-hover);
}

.sidebar-group-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-group-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-group-chevron {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: transform var(--bm-transition), opacity var(--bm-transition);
}

/* Groupe ouvert = vert (niveau principal) */
.sidebar-group.is-open > .sidebar-group-header {
    background-color: var(--bm-sidebar-active-bg);
    color: var(--bm-sidebar-text-hover);
}

.sidebar-group.is-open .sidebar-group-icon {
    color: var(--bm-sidebar-text-hover);
}

.sidebar-group.is-open .sidebar-group-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* -------- Sous-menu -------- */
.sidebar-submenu {
    display: none;
    margin-top: 2px;
    padding-bottom: 4px;
}

.sidebar-group.is-open > .sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Sous-liens */
.sidebar-sub-link {
    display: block;
    padding: 6px 12px 6px 42px;
    border-radius: var(--bm-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--bm-sidebar-text);
    text-decoration: none;
    background: transparent;
    transition: background-color var(--bm-transition), color var(--bm-transition);
}

/* Hover/Focus/Active sous-menu = variable (donc rgba en dark) */
.sidebar-sub-link:hover,
.sidebar-sub-link:focus-visible {
    background-color: var(--bm-sidebar-submenu-bg);
    color: var(--bm-sidebar-text-hover);
}

/* Actif sous-menu = même fond (pas de vert) */
.sidebar-sub-link.is-active,
.sidebar-sub-link[aria-current="page"] {
    background-color: var(--bm-sidebar-submenu-bg);
    color: var(--bm-sidebar-text-hover);
    font-weight: 600;
}

/* Anti-override (Tailwind) — sous-menu : on force la bonne variable, PAS le vert */
.sidebar .sidebar-sub-link:hover,
.sidebar .sidebar-sub-link:focus-visible {
    background-color: var(--bm-sidebar-submenu-bg) !important;
    color: var(--bm-sidebar-text-hover) !important;
}

/* =========================================================
   6. TOPBAR & MENU UTILISATEUR
   ========================================================= */

.topbar {
    height: var(--bm-header-height);
    min-height: var(--bm-header-height);
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background-color: var(--bm-topbar-bg);
    border-bottom: none;
    box-shadow: var(--bm-shadow-topbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 260px;
    max-width: 360px;
    padding: 6px 12px;
    border-radius: var(--bm-radius-sm);
    background-color: var(--bm-bg-soft);
    border: 1px solid var(--bm-border-soft);
}

.topbar-search-icon {
    width: 16px;
    height: 16px;
    color: var(--bm-text-muted);
    flex-shrink: 0;
}

.topbar-search-input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 13px;
    color: var(--bm-text-strong);
}

.topbar-search-input::placeholder {
    color: var(--bm-text-muted);
}

.topbar-search-input:focus {
    outline: none;
}

.topbar-search:focus-within {
    border-color: var(--bm-primary);
}

.topbar-appname {
    font-size: 18px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--bm-radius-full);
    background-color: var(--bm-icon-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--bm-icon-color);
    font-size: 14px;
}

.topbar-user-email {
    font-size: 13px;
    font-weight: 500;
    color: var(--bm-text-strong);
}

.topbar-user-role {
    font-size: 11px;
    color: var(--bm-text-muted);
}

/* ---------- Menu utilisateur dropdown ---------- */
.user-menu-wrapper {
    position: relative;
}

.topbar-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 4px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.topbar-user-trigger:focus-visible {
    outline: 2px solid var(--bm-primary);
    outline-offset: 2px;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    border-radius: var(--bm-radius-lg);
    border: 1px solid var(--bm-border-subtle);
    background-color: var(--bm-topbar-bg);
    box-shadow: var(--bm-shadow-dropdown);
    z-index: 50;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--bm-radius-md);
    font-size: 13px;
    color: var(--bm-text-strong);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--bm-transition), color var(--bm-transition);
}

.user-menu-item i,
.user-menu-item svg {
    flex-shrink: 0;
    color: var(--bm-text-muted);
}

.user-menu-item:hover {
    background-color: var(--bm-bg-soft);
    color: var(--bm-text-strong);
}

.user-menu-item-danger {
    color: #b91c1c;
}

.user-menu-item-danger i,
.user-menu-item-danger svg {
    color: #b91c1c;
}

.user-menu-item-danger:hover {
    background-color: rgba(248, 113, 113, 0.12);
    color: #7f1d1d;
}

.user-menu-separator {
    height: 1px;
    margin: 4px 6px;
    background-color: var(--bm-border-soft);
}

/* ---------- Icônes du bouton de thème ---------- */
.theme-icon {
    transition: opacity var(--bm-transition);
}

.theme-icon-sun {
    display: none;
}

body.dark-mode .theme-icon-moon {
    display: none;
}

body.dark-mode .theme-icon-sun {
    display: inline-block;
}

/* =========================================================
   TOPBAR — badge notification agenda (ultra discret)
   ========================================================= */
.topbar-agenda-btn { position: relative; }

.topbar-notif-badge{
  position:absolute; top:-4px; right:-4px;
  height:14px; min-width:14px; padding:0 3px;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:9999px; background:var(--bm-primary); color:#fff;
  font-size:9px; font-weight:700; line-height:1;
  pointer-events:none;
  box-shadow:0 0 0 2px var(--bm-bg-topbar, var(--bm-bg-body, #fff));



  /* détache visuellement du fond sans connaître la couleur exacte de la topbar */
  box-shadow: 0 0 0 2px var(--bm-bg-topbar, var(--bm-bg-body, #fff));
}


/* =========================================================
   TOPBAR — Popover rappels agenda (desktop only via JS)
   Version ULTRA COMPACTE (liste)
   ========================================================= */

.topbar-agenda-wrap{
  position: relative;
  display: inline-flex;
}

.bm-popover.bm-popover--agenda{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, 92vw);
  background: var(--bm-bg);
  border: 1px solid var(--bm-border-subtle);
  border-radius: var(--bm-radius-lg);
  box-shadow: var(--bm-shadow-card);
  z-index: 80;
  overflow: hidden;
}

/* Head */
.bm-popover--agenda .bm-popover-head{
  padding: 8px 10px;
  border-bottom: 1px solid var(--bm-border-subtle);
}

.bm-popover--agenda .bm-popover-title{
  font-size: 13px;
  font-weight: 700;
  color: var(--bm-text-strong);
  margin: 0;
}

.bm-popover--agenda .bm-popover-subtitle{
  font-size: 11px;
  color: var(--bm-text-muted);
  margin: 2px 0 0;
}

/* Body */
.bm-popover--agenda .bm-popover-body{
  padding: 6px 6px 4px;
  max-height: 260px;
  overflow: auto;
}

.bm-popover--agenda .bm-popover-empty{
  font-size: 12px;
  color: var(--bm-text-muted);
  padding: 6px;
  margin: 0;
}

/* Liste compacte (sans "cartes") */
.bm-popover--agenda .bm-popover-list{
  list-style: none;
  margin: 0;
  padding: 0;
}

.bm-popover--agenda .bm-popover-row{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px;
  border-bottom: 1px solid var(--bm-border-subtle);
}

.bm-popover--agenda .bm-popover-row:last-child{
  border-bottom: 0;
}

.bm-popover--agenda .bm-popover-row:hover{
  background: var(--bm-bg-soft);
}

.bm-popover--agenda .bm-popover-link{
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-decoration: none;
}

.bm-popover--agenda .bm-popover-row-title{
  font-size: 12px;
  font-weight: 600;
  color: var(--bm-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-popover--agenda .bm-popover-row-meta{
  font-size: 11px;
  color: var(--bm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bm-popover--agenda .bm-popover-row.is-seen{
  opacity: 0.55;
}

.bm-popover--agenda .bm-popover-row-action{
  flex: 0 0 auto;
}

.bm-popover--agenda .bm-popover-seen-btn{
  width: 28px;
  height: 28px;
}

.bm-popover--agenda .bm-popover-seen-btn:disabled{
  opacity: 0.35;
  cursor: default;
}

/* Actions (footer) */
.bm-popover--agenda .bm-popover-actions{
  padding: 8px 10px;
  border-top: 1px solid var(--bm-border-subtle);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}



/* =========================================================
   7. BADGES & PILLS (harmonisé + compatible legacy)
   ========================================================= */

/* ---------- Base (badge/pill) ---------- */
.bm-badge,
.badge-status,
.badge-event,
.event-state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--bm-radius-sm);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}

/* Icônes dans les badges : taille cohérente */
.bm-badge i[data-lucide],
.bm-badge svg,
.badge-status i[data-lucide],
.badge-status svg,
.badge-event i[data-lucide],
.badge-event svg,
.event-state-badge i[data-lucide],
.event-state-badge svg {
  width: 12px;
  height: 12px;
  color: currentColor;
}

/* ---------- Badges "standards" (avec bordure) ---------- */
.bm-badge,
.badge-status {
  border: 1px solid transparent;

  /* Valeurs par défaut (si aucune variante n'est appliquée) */
  background-color: var(--bm-badge-bg, rgba(148, 163, 184, 0.12));
  color: var(--bm-badge-color, var(--bm-text-main));
  border-color: var(--bm-badge-border, rgba(148, 163, 184, 0.35));
}

/* ---------- Badges événement (sans bordure) ---------- */
.badge-event,
.event-state-badge {
  border: none;
  background-color: var(--bm-badge-bg, rgba(148, 163, 184, 0.12));
  color: var(--bm-badge-color, var(--bm-text-main));
}

/* Badge état événement : radius spécifique */
.event-state-badge {
  border-radius: var(--bm-radius-sm);
}

/* =========================================================
   NOUVEAU — Mode "outline only" (sans background)
   Usage : outils/finances/registre/autres -> ajouter .bm-badge-outline
   Ex : <span class="bm-badge bm-badge-outline">Outil</span>
   ========================================================= */
.bm-badge-outline,
.badge-status.bm-badge-outline {
  --bm-badge-bg: transparent;
  background-color: transparent !important;
  /* garde la couleur + bordure via les variables */
}

/* Variante outline "neutre" (si tu veux une option explicite) */
.bm-badge-outline-muted {
  --bm-badge-bg: transparent;
  --bm-badge-color: var(--bm-text-muted);
  --bm-badge-border: rgba(148, 163, 184, 0.35);
  background-color: transparent !important;
}

/* =========================================================
   Variantes génériques .bm-badge-* (sémantiques)
   ========================================================= */

/* Primary (couleur marque) */
.bm-badge-primary {
  --bm-badge-bg: rgba(34, 197, 94, 0.12);
  --bm-badge-color: var(--bm-primary);
  --bm-badge-border: rgba(34, 197, 94, 0.45);
}

/* Success */
.bm-badge-success {
  --bm-badge-bg: rgba(34, 197, 94, 0.12);
  --bm-badge-color: var(--bm-primary);
  --bm-badge-border: rgba(34, 197, 94, 0.45);
}

/* Warning (ambre) */
.bm-badge-warning {
  --bm-badge-bg: rgba(245, 158, 11, 0.14);
  --bm-badge-color: #b45309;
  --bm-badge-border: rgba(245, 158, 11, 0.45);
}

/* Danger (rouge) */
.bm-badge-danger {
  --bm-badge-bg: rgba(211, 64, 83, 0.12);
  --bm-badge-color: #d34053;
  --bm-badge-border: rgba(211, 64, 83, 0.45);
}

/* ---------- Variantes "soft" ---------- */
.bm-badge-primary-soft {
  --bm-badge-bg: rgba(34, 197, 94, 0.07);
  --bm-badge-color: var(--bm-primary);
  --bm-badge-border: rgba(34, 197, 94, 0.28);
}

.bm-badge-success-soft {
  --bm-badge-bg: rgba(34, 197, 94, 0.07);
  --bm-badge-color: var(--bm-primary);
  --bm-badge-border: rgba(34, 197, 94, 0.28);
}

.bm-badge-warning-soft {
  --bm-badge-bg: rgba(245, 158, 11, 0.08);
  --bm-badge-color: #b45309;
  --bm-badge-border: rgba(245, 158, 11, 0.28);
}

.bm-badge-danger-soft {
  --bm-badge-bg: rgba(211, 64, 83, 0.08);
  --bm-badge-color: #b91c1c;
  --bm-badge-border: rgba(185, 28, 28, 0.28);
}

/* =========================================================
   Compat / Legacy : statuts articles (commerce / gestion)
   Doit rester MAINTENU dans les tableaux liés aux articles
   ========================================================= */
.badge-en-vente {
  --bm-badge-bg: var(--bm-status-vente-bg);
  --bm-badge-color: var(--bm-status-vente-color);
  --bm-badge-border: var(--bm-status-vente-border);
}

.badge-en-stock {
  --bm-badge-bg: var(--bm-status-stock-bg);
  --bm-badge-color: var(--bm-status-stock-color);
  --bm-badge-border: var(--bm-status-stock-border);
}

.badge-vendu {
  --bm-badge-bg: var(--bm-status-vendu-bg);
  --bm-badge-color: var(--bm-status-vendu-color);
  --bm-badge-border: var(--bm-status-vendu-border);
}

.badge-autre {
  --bm-badge-bg: var(--bm-status-autre-bg);
  --bm-badge-color: var(--bm-status-autre-color);
  --bm-badge-border: var(--bm-status-autre-border);
}

/* =========================================================
   Badge état événement (variables déjà existantes chez toi)
   Doit rester MAINTENU dans les tableaux liés aux événements
   ========================================================= */
.event-state-badge--inscrit {
  background-color: var(--bm-badge-inscrit-bg);
  color: var(--bm-badge-inscrit-color);
}

.event-state-badge--reserve {
  background-color: var(--bm-badge-reserve-bg);
  color: var(--bm-badge-reserve-color);
}

.event-state-badge--annule {
  background-color: var(--bm-badge-annule-bg);
  color: var(--bm-badge-annule-color);
}

.event-state-badge--autre {
  background-color: var(--bm-badge-autre-bg);
  color: var(--bm-badge-autre-color);
}

/* =========================================================
   NOUVEAU — Badges Alertes (gestion_articles/alertes.php)
   - "À recréer" (rouge) = même rouge que --bm-badge-annule-color
   - "À relancer" (orange) = même orange que --bm-chart-warning
   ========================================================= */

/* À recréer (rouge) */
.bm-badge-alert-recreer,
.badge-alert-recreer {
  --bm-badge-bg: rgba(211, 64, 83, 0.12);
  --bm-badge-color: var(--bm-badge-annule-color, #d34053);
  --bm-badge-border: rgba(211, 64, 83, 0.45);
}

/* À relancer (orange) */
.bm-badge-alert-relancer,
.badge-alert-relancer {
  --bm-badge-bg: rgba(255, 167, 11, 0.14);
  --bm-badge-color: var(--bm-chart-warning, #ffa70b);
  --bm-badge-border: rgba(255, 167, 11, 0.45);
}


/* ---------- Meta pill ---------- */
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--bm-radius-full);
    border: 1px solid var(--bm-border);
    font-size: 11px;
    color: var(--bm-text-muted);
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.meta-pill i[data-lucide],
.meta-pill svg {
    width: 12px;
    height: 12px;
    color: currentColor;
}

/* =========================================================
   8. TITRES & TYPO
   ========================================================= */

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.page-title i,
.page-title svg,
.page-title .lucide {
    color: var(--bm-primary);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--bm-text-muted);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    color: var(--title-color, var(--bm-text-strong));
}

.card-title--admin {
    --title-color: #ffffff;
}

.card-title i,
.card-title svg,
.card-title .lucide {
    width: 18px;
    height: 18px;
    color: var(--bm-primary);
}

.card-subtitle {
    font-size: 12px;
    color: var(--bm-text-muted);
}

.text-strong {
    color: var(--bm-text-strong);
}

.text-body {
    color: var(--bm-text-main);
}

.text-muted {
    color: var(--bm-text-muted);
}

.text-primary {
    color: var(--bm-primary);
}

.text-meta {
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--bm-text-muted);
}

.index-title {
    color: var(--bm-text-strong);
}

.note-text {
    font-size: 12px;
    font-style: italic;
    color: var(--bm-text-muted);
}

.note-text-blanc {
    font-size: 12px;
    font-style: italic;
    color: var(--bm-text-white);
}

/* Références / codes (tableaux, listes, badges) */
.bm-ref{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}
.bm-ref-pill{
  display:inline-flex;
  align-items:center;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--bm-border-soft);
  background: var(--bm-bg-soft);
  color: var(--bm-text-muted);
  font-size: 12px;
}

/* =========================================================
   9. BOUTONS
   ========================================================= */

.btn-primary,
.btn-secondary,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--bm-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color var(--bm-transition), color var(--bm-transition), box-shadow var(--bm-transition), transform var(--bm-transition-fast);
    background: transparent;
}

.btn-compact {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--bm-radius-sm);
}

.btn-primary {
    background-color: var(--bm-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--bm-primary-hover);
}

.btn-secondary {
    background-color: var(--bm-primary);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: var(--bm-primary-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--bm-text-strong);
    box-shadow: 0 0 0 1px var(--bm-border-soft);
}

.btn-outline:hover {
    background-color: var(--bm-bg-soft);
}

/* ---------- Boutons icônes ---------- */
.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--bm-radius-full);
    background-color: var(--bm-btn-icon-bg);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--bm-transition), border-color var(--bm-transition), transform var(--bm-transition-fast);
}

.btn-icon .icon,
.btn-icon i,
.btn-icon svg {
    width: 16px;
    height: 16px;
    color: var(--bm-btn-icon-color);
}

.btn-icon:hover {
    background-color: var(--bm-btn-icon-bg-hover);
    border-color: var(--bm-primary-soft);
}

/* Bouton burger : caché par défaut sur desktop */
.btn-icon.mobile-menu-toggle {
    display: none;
}

/* ---------- Actions discrètes (pas vertes au repos) ---------- */
.btn-icon.btn-icon--quiet {
    background: transparent;
    border: 1px solid var(--bm-border-subtle);
    color: var(--bm-text-muted);
}

.btn-icon.btn-icon--quiet:hover {
    background: var(--bm-primary);
    border-color: var(--bm-border-subtle);
    color: var(--bm-text-strong);
}

.btn-icon.btn-icon--quiet:focus-visible {
    outline: 2px solid var(--bm-primary);
    outline-offset: 1px;
}

.btn-icon.btn-icon--quiet i[data-lucide],
.btn-icon.btn-icon--quiet svg {
    width: 16px;
    height: 16px;
}

/* BTN-ICON "QUIET" avec libellé (forme bouton) */
.btn-icon.btn-icon--wide {
    width: auto;
    padding: 0 10px;
    gap: 8px;
    height: 34px;
    border-radius: var(--bm-radius-md);
}

.btn-icon.btn-icon--wide .icon,
.btn-icon.btn-icon--wide i[data-lucide],
.btn-icon.btn-icon--wide svg {
    width: 16px;
    height: 16px;
}

.btn-icon-label {
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

/* Afficher seulement à partir du desktop (sm et +) */
.bm-desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .bm-desktop-only {
        display: var(--bm-show-display, inline-flex);
    }
}

/* Afficher seulement en mobile */
.bm-mobile-only {
    display: var(--bm-show-display, inline-flex);
}

@media (min-width: 768px) {
    .bm-mobile-only {
        display: none;
    }
}

/* style.boutons.preuves depot grisés */
.btn-icon--disabled {
  opacity: .22;
  filter: grayscale(1);
  cursor: not-allowed;
}


/* =========================================================
   BrocManager — DENSITÉ (desktop only)
   - Objectif : listes/tableaux plus compacts sans casser le mobile
   ========================================================= */

@media (min-width: 768px) {

  /* Variante compacte pour les boutons icônes (desktop seulement) */
  .btn-icon.btn-icon--dense {
    min-width: 28px;
    min-height: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
  }

  /* Supporte les <i class="icon"> + le SVG lucide */
  .btn-icon.btn-icon--dense .icon,
  .btn-icon.btn-icon--dense svg {
    width: 16px;
    height: 16px;
  }
}

/* btn-pill-quiet — global */
.btn-pill-quiet{
  border-radius: 4px;
  border: 1px solid var(--bm-border-soft);
  background: transparent;
  color: var(--bm-text-strong);
  padding: 6px 10px;
  line-height: 1;
  transition: background-color var(--bm-transition), border-color var(--bm-transition), transform var(--bm-transition);
}

.btn-pill-quiet:hover,
.btn-pill-quiet:focus-visible{
  background: var(--bm-primary);
  border-color: var(--bm-border);
  color: #fff;
}

.btn-pill-quiet:active{ transform: translateY(1px); }
.btn-pill-quiet i,
.btn-pill-quiet .lucide,
.btn-pill-quiet svg{ width:16px; height:16px; }

/* Agenda */
/* Aujourd’hui = vert Broc */
.bm-cal-today{
  border: 1px solid var(--bm-primary);
}
.bm-cal-today-pill{
  border-color: var(--bm-primary);
  color: var(--bm-primary);
}


.bm-cal-chip,
.bm-cal-row{
  border-left: 3px solid var(--bm-cal-accent, #5B7FFF);
  background: var(--bm-bg-soft);
}
.bm-cal-dot{
  display:inline-block;
  width:8px; height:8px; border-radius:9999px;
  background: var(--bm-cal-accent, #5B7FFF);
  margin-right:6px;
}

/* Palette whitelist */
.bm-cal-c1{ --bm-cal-accent:#5B7FFF; }
.bm-cal-c2{ --bm-cal-accent:#22c55e; }
.bm-cal-c3{ --bm-cal-accent:#F0CD07; }
.bm-cal-c4{ --bm-cal-accent:#ED520A; }
.bm-cal-c5{ --bm-cal-accent:#386F4C; }
.bm-cal-c6{ --bm-cal-accent:#C4216B; }
.bm-cal-c7{ --bm-cal-accent:#8221C4; }

.bm-cal-fallback-planned{ --bm-cal-accent:#5B7FFF; }
.bm-cal-fallback-other{ --bm-cal-accent: var(--bm-border, #cbd5e1); }



/* =========================================================
   10. CARTES / BLOCS
   ========================================================= */

.card,
.stat-card,
.product-card {
    background: var(--bm-bg-card);
    border-radius: var(--bm-radius-md);
    border: 0.3px solid var(--bm-border-subtle);
    box-shadow: var(--bm-shadow-card);
}

.stats-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stats-grid-finances {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1024px) {
    .stats-grid-finances {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.stat-card {
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.stat-subtitle {
    font-size: 12px;
    color: var(--bm-text-muted);
}

.stat-value {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.stat-card--accent {
    background: var(--bm-bg-card);
}

/* Petites cartes de synthèse */
.synth-card {
    background-color: var(--bm-bg-soft);
    border-radius: var(--bm-radius-lg);
    border: none;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.synth-card[class*="border-"] {
    border: none;
}

/* =========================================================
   EVENEMENTS — Cards (lisibilité)
   ========================================================= */

.event-when {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--bm-text-muted);
}

.event-when .event-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--bm-text-strong);
}

.event-when .event-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--bm-text-muted);
}

.bm-card-footer {
    border-top: 1px solid var(--bm-border-soft);
}

/* =========================================================
   11. ICÔNES RONDES (.quick-icon)
   ========================================================= */

.quick-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--bm-radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bm-quick-icon-bg);
    border: 1px solid var(--bm-quick-icon-border);
    flex-shrink: 0;
    color: var(--bm-icon-color);
}

.quick-icon i,
.quick-icon svg,
.quick-icon .icon {
    width: 20px;
    height: 20px;
    color: var(--bm-icon-color);
}

/* =========================================================
   12. FORMULAIRES
   ========================================================= */



/* Utilitaire .border */
.border{
  border: 1px solid var(--bm-border);
}

/* ---------------------------------------------------------
   Champs standards BrocManager (classes)
   --------------------------------------------------------- */
.input,
.input-sm,
.input-xs{
  background: var(--bm-input-bg);
  border: 1px solid var(--bm-input-border);
  color: var(--bm-text-strong);
}

/* Tailles */
.input-sm{
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--bm-radius-sm);
}

.input-xs{
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--bm-radius-sm);
}

.input::placeholder{
  color: var(--bm-text-muted);
}

/* Normalise les éléments qui portent la classe .input */
select.input,
input.input,
textarea.input{
  background: var(--bm-input-bg);
  border-color: var(--bm-input-border);
  color: var(--bm-text-strong);
}

/* ---------------------------------------------------------
   Date picker : rendu cohérent light/dark
   - couvre .dark et .dark-mode
   - couvre classe posée sur <html> OU <body>
   - couvre .input / .input-sm / .input-xs
   --------------------------------------------------------- */
input[type="date"].input,
input[type="date"].input-sm,
input[type="date"].input-xs{
  color-scheme: light;
}

body.dark-mode input[type="date"].input,
body.dark-mode input[type="date"].input-sm,
body.dark-mode input[type="date"].input-xs{
  color-scheme: dark;
}

/* Chrome / Edge / Safari : icône calendrier */
body.dark-mode input[type="date"].input::-webkit-calendar-picker-indicator,
body.dark-mode input[type="date"].input-sm::-webkit-calendar-picker-indicator,
body.dark-mode input[type="date"].input-xs::-webkit-calendar-picker-indicator{
  filter: invert(1);
  opacity: .85;
}

/* ---------------------------------------------------------
   Options des <select> en dark (menu natif)
   --------------------------------------------------------- */
body.dark-mode select.input option,
body.dark-mode select.input-sm option,
body.dark-mode select.input-xs option{
  background: var(--bm-menu-bg);
  color: var(--bm-text-strong);
}

/* ---------------------------------------------------------
   Labels (petits)
   --------------------------------------------------------- */
.label-sm{
  font-size: 12px;
  font-weight: 500;
  color: var(--bm-text-strong);
}

/* ---------------------------------------------------------
   Champs "par défaut" dans les cards
   - Objectif : si tu oublies une classe (.input/.input-sm),
     ça reste joli et cohérent.
   - MAIS : on n’écrase pas les tailles si la classe existe.
   --------------------------------------------------------- */

/* Style visuel commun (sans toucher à la taille) */
.card input[type="text"],
.card input[type="number"],
.card input[type="date"],
.card input[type="time"],
.card input[type="email"],
.card input[type="password"],
.card select,
.card textarea{
  width: 100%;
  border: 1px solid var(--bm-input-border);
  background-color: var(--bm-input-bg);
  color: var(--bm-text-strong);
  transition: border-color var(--bm-transition), box-shadow var(--bm-transition), background-color var(--bm-transition);
}

/* Taille par défaut UNIQUEMENT si aucune classe input* n’est posée */
.card input[type="text"]:not(.input):not(.input-sm):not(.input-xs),
.card input[type="number"]:not(.input):not(.input-sm):not(.input-xs),
.card input[type="date"]:not(.input):not(.input-sm):not(.input-xs),
.card input[type="time"]:not(.input):not(.input-sm):not(.input-xs),
.card input[type="email"]:not(.input):not(.input-sm):not(.input-xs),
.card input[type="password"]:not(.input):not(.input-sm):not(.input-xs),
.card select:not(.input):not(.input-sm):not(.input-xs),
.card textarea:not(.input):not(.input-sm):not(.input-xs){
  padding: 8px 10px;
  font-size: 13px;
  border-radius: var(--bm-radius-sm);
}

/* Focus */
.card input:focus,
.card select:focus,
.card textarea:focus{
  border-color: var(--bm-primary);
  background-color: var(--bm-input-bg);
}

/* Labels dans les cards + compat "tailwind-like" */
.card label,
label.block.text-sm.font-medium{
  font-size: 14px;
  font-weight: 600;
  color: var(--bm-text-strong);
}

/* Preview box */
.preview-box{
  background: var(--bm-bg-soft);
  border: 1px solid var(--bm-border);
  border-radius: var(--bm-radius-md);
}



/* =========================================================
   13. QR TILES & UPLOAD
   ========================================================= */

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
}

.qr-action {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qr-tile {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    border-radius: var(--bm-radius-md);
    background: var(--bm-bg-card);
    border: 0.5px solid var(--bm-border-subtle);
    box-shadow: var(--bm-shadow-card);
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    line-height: 1.2;
    transition: background-color var(--bm-transition), border-color var(--bm-transition), transform var(--bm-transition-fast);
}

.qr-tile:hover {
    background: var(--bm-bg-soft);
    border-color: var(--bm-border-subtle);
}

.qr-tile:active {
    transform: translateY(1px);
}

.qr-tile-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.qr-tile-sub {
    font-size: 12px;
    color: var(--bm-text-muted);
}

.qr-tile--danger {
    background: rgba(225, 29, 72, 0.10);
    border-color: rgba(225, 29, 72, 0.35);
}

.qr-tile--danger .qr-tile-title {
    color: #be123c;
}

.qr-tile--danger:hover {
    background: rgba(225, 29, 72, 0.14);
    border-color: rgba(225, 29, 72, 0.45);
}

.qr-tile[aria-disabled="true"],
.qr-tile:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.qr-preview {
    width: 160px;
    max-width: 100%;
    background: var(--bm-bg-card);
    border: 0.5px solid var(--bm-border-subtle);
    box-shadow: var(--bm-shadow-card);
    border-radius: var(--bm-radius-md);
    padding: 8px;
}

.qr-preview img {
    width: 100%;
    height: auto;
    display: block;
}

@media (min-width: 768px) {
    .qr-actions.qr-actions--stack {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .qr-actions.qr-actions--stack .qr-action {
        width: 100%;
    }

    .qr-actions.qr-actions--stack .qr-tile {
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .qr-preview {
        width: 180px;
    }
}

/* ---------- Upload tile ---------- */
.upload-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: var(--bm-bg-card);
    border-radius: var(--bm-radius-md);
    border: 0.5px solid var(--bm-border-subtle);
    box-shadow: var(--bm-shadow-card);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--bm-transition), border-color var(--bm-transition), transform var(--bm-transition-fast);
}

.upload-tile:hover {
    background: var(--bm-bg-soft);
    border-color: var(--bm-border-subtle);
}

.upload-tile:active {
    transform: translateY(1px);
}

.upload-tile__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.upload-tile__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
    line-height: 1.2;
}

.upload-tile__sub {
    font-size: 12px;
    color: var(--bm-text-muted);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* =========================================================
   14. DASHBOARD - ACCÈS RAPIDES
   ========================================================= */

.dashboard-container {
    max-width: 1120px;
    margin: 0 auto;
}

.quick-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-card {
    position: relative;
    overflow: hidden;
    background: var(--bm-bg-card);
    border-radius: var(--bm-radius-md);
    border: 1px solid var(--bm-border-subtle);
    box-shadow: var(--bm-shadow-card);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: transform var(--bm-transition), box-shadow var(--bm-transition), border-color var(--bm-transition), background-color var(--bm-transition);
}

.quick-card-main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.quick-card:hover {
    background-color: var(--bm-sidebar-active-bg);
    border-color: var(--bm-sidebar-active-bg);
    box-shadow: var(--bm-shadow-card-hover);
    transition: background-color var(--bm-transition), border-color var(--bm-transition), box-shadow var(--bm-transition), transform var(--bm-transition-fast);
}

.quick-card:hover .quick-title,
.quick-card:hover .quick-subtitle {
    color: var(--bm-sidebar-text-hover);
}

.quick-card:hover .quick-icon {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: transparent;
}

.quick-card:hover .quick-icon i,
.quick-card:hover .quick-icon svg,
.quick-card:hover .quick-icon .icon {
    color: var(--bm-sidebar-text-hover);
}

.quick-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
}

.quick-subtitle {
    font-size: 12px;
    color: var(--bm-text-muted);
}

.quick-arrow i {
    width: 18px;
    height: 18px;
    color: var(--bm-text-muted);
}

.quick-card-watermark {
    position: absolute;
    right: 12px;
    bottom: 10px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.10;
    color: rgba(148, 163, 184, .9);
}

.quick-card-watermark svg {
    width: 64px;
    height: 64px;
}

@media (min-width: 768px) {
    .quick-card-watermark svg {
        width: 78px;
        height: 78px;
    }
}

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

@media (max-width: 480px) {
    .quick-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* =========================================================
   15. LISTE ARTICLES - CARTES PRODUITS
   ========================================================= */

.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.product-photo {
    position: relative;
    background-color: transparent;
    border-bottom: 1px solid var(--bm-border-subtle);
    aspect-ratio: 16 / 9;
    max-height: 220px;
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-no-img {
    width: 100%;
    height: 100%;
    font-size: 11px;
    color: var(--bm-text-muted);
    background-color: var(--bm-bg-dark-alt);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-badge {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 4px 8px;
    border-radius: var(--bm-radius-sm);
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--bm-text-strong);
    margin-bottom: 4px;
}

.product-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.product-details {
    font-size: 12px;
    color: var(--bm-text-main);
}

.product-details p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

.product-details span:first-child {
    color: var(--bm-text-muted);
}

/* Boutons icônes dans les cartes produits */
.product-card .product-actions .btn-icon {
    background-color: var(--bm-bg-dark-alt);
    border-color: var(--bm-border-soft);
}

.product-card .product-actions .btn-icon:hover {
    background-color: var(--bm-primary);
}

.product-card .product-actions .btn-icon .icon,
.product-card .product-actions .btn-icon i,
.product-card .product-actions .btn-icon svg {
    color: var(--bm-icon-color);
}

/* =========================================================
   16. FILTRES & TRI
   ========================================================= */

.filters-box {
    background-color: var(--bm-bg-card);
    border-radius: var(--bm-radius-sm);
    border: 0.5px solid var(--bm-border-subtle);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: center;
}

.sort-btn {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: var(--bm-radius-full);
    border: 1px solid var(--bm-border-soft);
    background-color: var(--bm-bg-card);
    color: var(--bm-text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background-color var(--bm-transition), color var(--bm-transition), border-color var(--bm-transition);
}

.sort-btn.active {
    background-color: var(--bm-primary);
    color: #ffffff;
    border-color: var(--bm-primary);
}

.sort-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--bm-radius-sm);
    background-color: var(--bm-bg-soft);
    border: 1px solid var(--bm-border-soft);
}

/* Checkboxes + radios : couleur du “check” */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--bm-primary);
}


/* =========================================================
   17. TABLEAUX
   ========================================================= */

table {
    border-collapse: collapse;
}

table th,
table td {
    font-size: 12px;
}

table th {
    font-weight: 600;
}

.table-input {
    background-color: transparent;
    border-radius: var(--bm-radius-sm);
    border-color: var(--bm-border-soft);
}

.table-input-cell {
    padding-top: 4px;
    padding-bottom: 4px;
}

.bm-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    border: 1px solid var(--bm-border-soft);
    border-radius: var(--bm-radius-md);
    background: var(--bm-bg-card);
}

/* Paramétrable via variable (par défaut 760px) */
.bm-table-scroll > table {
    min-width: var(--bm-table-minw, 760px);
}

/* ROM — surbrillance focus (CSP friendly, pas d'inline style) */
.rom-focus{
  outline: 2px solid var(--bm-primary);
  outline-offset: 2px;
}

@media (min-width: 768px){
  tr.rom-focus{
    outline-offset: -2px;
  }
}

/* =========================================================
   TABLEAUX — BrocManager (composant)
   ========================================================= */

.bm-table-wrap{
  overflow-x: auto;
  border: 1px solid var(--bm-border-subtle);
  border-radius: var(--bm-radius-md);
  background: var(--bm-bg-card);
}

.bm-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px; /* réf Compas */
  line-height: 1.25;
  min-width: 860px; /* évite un tableau “écrasé” */
}


.bm-table thead th{
  padding: 8px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--bm-text-muted);
  background: var(--bm-table-head-bg);
  border-bottom: 1px solid var(--bm-border-soft);
  white-space: nowrap;
  vertical-align: bottom;
}

.bm-table tbody td{
  padding: 8px 8px;
  font-size: inherit;
  color: inherit;
  border-bottom: 1px solid var(--bm-border-soft);
  vertical-align: top;
}

.bm-table tbody tr{
  transition: background-color var(--bm-table-row-transition);
}

.bm-table tbody tr:hover{
  background: var(--bm-table-row-hover-bg);
}

.bm-table tbody tr:focus-within{
  background: var(--bm-table-row-focus-bg);
  box-shadow: inset 0 0 0 1px var(--bm-table-row-focus-border);
}

.bm-table tbody tr:last-child td{
  border-bottom: none;
}

.bm-table .is-right{ text-align: right; }
.bm-table .is-center{ text-align: center; }
.bm-table .is-nowrap{ white-space: nowrap; }

.bm-table--fixed{ table-layout: fixed; }

/* ---- Table Kit modifiers ---- */
.bm-table--compact thead th,
.bm-table--compact tbody td{
  padding: 6px 8px;
}
.bm-table--zebra tbody tr:nth-child(even){
  background: var(--bm-table-zebra-bg);
}

.bm-table--sticky-head thead th{
  position: sticky;
  top: 0;
  z-index: 2;
}

.bm-table--sticky-first thead th:first-child,
.bm-table--sticky-first tbody td:first-child{
  position: sticky;
  left: 0;
  box-shadow: var(--bm-table-sticky-divider);
}

.bm-table--sticky-first tbody td:first-child{
  z-index: 1;
  background: inherit; /* suit zebra/hover */
}

.bm-table--sticky-first thead th:first-child{
  z-index: 3;
  background: var(--bm-table-head-bg);
}



.bm-pill-code{
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--bm-radius-sm);
  border: 1px solid var(--bm-border);
  background: var(--bm-bg-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--bm-text-strong);
  white-space: nowrap;
}

.bm-truncate{
  display: block;
  max-width: var(--bm-truncate-max, 520px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bm-muted-ital{
  color: var(--bm-text-muted);
  font-style: italic;
}


/* =========================================================
   18. DARK MODE - OVERRIDES TAILWIND
   ========================================================= */

body.dark-mode .text-\[\#111827\],
body.dark-mode .text-\[\#212b36\],
body.dark-mode .text-slate-800,
body.dark-mode .text-slate-900 {
    color: var(--bm-text-strong);
}

body.dark-mode .text-\[\#4b5563\],
body.dark-mode .text-\[\#637381\],
body.dark-mode .text-slate-500,
body.dark-mode .text-slate-400,
body.dark-mode .text-gray-500 {
    color: var(--bm-text-main);
}

body.dark-mode .text-\[\#9ca3af\],
body.dark-mode .text-slate-300,
body.dark-mode .text-gray-400 {
    color: var(--bm-text-muted);
}

body.dark-mode .bg-white {
    background-color: var(--bm-bg-card);
}

body.dark-mode .card .bg-\[\#f8fafc\] {
    background-color: var(--bm-bg-soft);
}

body.dark-mode .bg-gray-50,
body.dark-mode .bg-slate-50,
body.dark-mode .bg-slate-100,
body.dark-mode .bg-slate-200 {
    background-color: var(--bm-bg-soft);
}

body.dark-mode .hover\:bg-gray-50:hover,
body.dark-mode .hover\:bg-slate-50:hover,
body.dark-mode tr.hover\:bg-gray-50:hover,
body.dark-mode tr.hover\:bg-slate-50:hover {
    background-color: var(--bm-bg-soft);
}

body.dark-mode .border-slate-100,
body.dark-mode .border-slate-200,
body.dark-mode .border-gray-200 {
    border-color: var(--bm-border-subtle);
}

/* =========================================================
   19. RESPONSIVE - MOBILE (UNIFIÉ + SIDEBAR OFF-CANVAS)
   ========================================================= */
@media (max-width: 767px) {

  body{
    overflow-x: hidden;
  }

  /* Important : si .app-shell déborde, tu peux voir du “débordement visuel”
     même sans scrollbars. Clip = propre. */
  .app-shell{
    width: 100%;
    min-width: 0;
    overflow-x: clip;
  }
  @supports not (overflow: clip){
    .app-shell{ overflow-x: hidden; }
  }

  .main-wrapper,
  .main-content{
    min-width: 0;
  }

  /* Sidebar hors-flow + plein écran */
  .sidebar{
    position: fixed !important;
    top: 0;
    left: 0 !important;
    right: 0 !important;

    height: 100vh;   /* fallback */
    height: 100dvh;  /* moderne */

    width: 100vw;
    max-width: 100vw;

    z-index: 2000;

    transform: translateX(-100%) !important;
    transition: transform var(--bm-transition);
    will-change: transform;

    overflow-x: hidden; /* sécurité */
  }

  body.sidebar-open .sidebar,
  .sidebar.is-open{
    transform: translateX(0) !important;
  }

  .sidebar-link-text{
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-logo-circle{
    width: 32px;
    height: 32px;
    margin-right: 8px;
  }

  /* ---------- Topbar mobile ---------- */
  .topbar{
    padding: 8px 12px;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 0;
    gap: 8px;
  }

  .topbar-left,
  .topbar-right{
    width: 100%;
    display: flex;
    align-items: center;
  }

  .topbar-right{
    order: 1;
    gap: 8px;
    justify-content: flex-end;
  }

  .topbar-left{
    order: 2;
    gap: 8px;
    justify-content: flex-start;
  }

  .btn-icon.mobile-menu-toggle{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .topbar-search{
    flex: 1;
    min-width: 0;
    max-width: 100%;
  }

  .topbar-user-email,
  .topbar-user-role{
    display: none;
  }

  /* ---------- Contenu mobile ---------- */
  .main-content{
    padding: 16px;
  }

  .page-container{
    max-width: 100%;
  }

  /* ---------- Tableau trajets mobile ---------- */
  /* ⚠️ Si tu as encore des overflows, remplace visible par auto */
.trajets-table-wrapper{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


  .trajets-table{
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .trajets-table th,
  .trajets-table td{
    padding: 6px 4px;
    font-size: 11px;
  }

  .trajets-table .col-ville{
    max-width: 140px;
    word-wrap: break-word;
  }

  .trajets-table .col-distance,
  .trajets-table .col-cost{
    width: 70px;
    white-space: nowrap;
  }

  .trajets-table .col-actions{
    white-space: nowrap;
  }

  /* ---------- Quick cards mobile ---------- */
  .quick-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .quick-card{
    padding: 10px 10px;
    border-radius: var(--bm-radius-md);
    box-shadow: none;
  }

  .quick-card-main{ gap: 8px; }

  .quick-icon{
    width: 32px;
    height: 32px;
  }

  .quick-title{ font-size: 13px; }
  .quick-subtitle{ font-size: 11px; }

  /* ---------- Inventaire mobile ---------- */
  .inventaire-grid{ gap: 10px; }

  .inventaire-grid .stat-card{
    padding: 10px 12px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    box-shadow: none;
    border-radius: var(--bm-radius-md);
  }

  .inventaire-grid .stat-card-header{ margin-bottom: 0; }
  .inventaire-grid .quick-icon{ width: 32px; height: 32px; }

  .inventaire-grid .stat-value{
    margin-top: 0;
    margin-left: auto;
    font-size: 20px;
  }

  /* ---------- Filtres articles mobile ---------- */
  .articles-filters-scroll{
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
  }

  .articles-filters-scroll::-webkit-scrollbar{ display: none; }

  .filters-box--articles{
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 12px;
    width: max-content;
    max-width: none;
  }

  .filters-box--articles > *{
    flex: 0 0 auto;
    flex-shrink: 0;
  }

  .filters-box--articles label,
  .filters-box--articles .label-sm,
  .filters-box--articles span{
    white-space: nowrap;
  }

  .filters-box--articles select.input-sm{ min-width: 220px; }

  /* ---------- QR tiles mobile ---------- */
  .qr-actions{ gap: 10px; }
  .qr-action{ width: 100%; }
  .qr-tile{ width: 100%; }
  .qr-preview{ width: 100%; }

  /* ---------- Actions sticky ---------- */
  .bm-actions-sticky{
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--bm-border-soft);
    background: var(--bm-bg-card);
    box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.08);
  }

  .bm-actions-sticky > a,
  .bm-actions-sticky > button{
    width: 100%;
  }

  .bm-has-sticky-actions{
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

/* =========================================================
   20. FOCUS STATES - ACCESSIBILITÉ
   ========================================================= */

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: var(--bm-primary);
    outline: none;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible {
    border-color: var(--bm-primary);
    outline: none;
}

.btn-icon:focus-visible {
    border-color: var(--bm-primary);
    border-radius: var(--bm-radius-full);
    outline: none;
}

.sidebar-link:focus-visible,
.sidebar-group-header:focus-visible,
.sidebar-sub-link:focus-visible {
    border-color: var(--bm-primary);
    outline: none;
    border: 1px solid var(--bm-primary);
}

.quick-card:focus-visible,
.inventaire-row:focus-visible {
    border-color: var(--bm-primary);
    outline: none;
}

.topbar-user-trigger:focus-visible {
    border-radius: var(--bm-radius-md);
    outline: none;
}

.user-menu-item:focus-visible {
    background-color: var(--bm-primary-soft);
    outline: none;
}

.sort-btn:focus-visible {
    border-color: var(--bm-primary);
    outline: none;
}

.tabs-pill:focus-visible {
    border-color: var(--bm-primary);
    outline: none;
}

.map-popup-btn:focus-visible {
    outline: none;
}

a:focus-visible {
    border-radius: 2px;
    outline: none;
}

/* =========================================================
   DASHBOARD — Activité du mois (mobile only, scoped)
   Objectif :
   - Icône + Titre (1 ligne)
   - Sous-texte (1 ligne)
   - Chiffre centré
   ========================================================= */

@media (max-width: 768px) {
  .dashboard-activity .stats-grid-finances {
    gap: 12px; /* plus compact */
  }

  .dashboard-activity .stat-card {
    padding: 12px 12px 14px; /* réduit la hauteur */
    gap: 6px;
    overflow: hidden; /* sécurité visuelle */
  }

  .dashboard-activity .stat-card-header {
    align-items: flex-start; /* icône alignée en haut du bloc texte */
    gap: 10px;
  }

  /* IMPORTANT: permet aux ellipsis de fonctionner dans un flex */
  .dashboard-activity .stat-card-header > div {
    min-width: 0;   /* clé anti-débordement */
    flex: 1 1 auto; /* le texte prend la place dispo */
  }

  /* Titre sur 1 ligne */
  .dashboard-activity .stat-label {
    display: block;
    max-width: 100%;
    font-size: 13px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Phrase sur 1 ligne */
  .dashboard-activity .stat-subtitle {
    display: block;
    max-width: 100%;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Chiffre centré */
  .dashboard-activity .stat-value {
    margin-top: 4px; /* au lieu de 10px */
    font-size: 24px; /* légèrement plus compact */
    line-height: 1.1;
    text-align: center;
    width: 100%;
  }
}




/* =========================================================
   21. UTILITAIRES
   ========================================================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 12px 0;
    font-size: 12px;
    color: var(--bm-text-muted);
}
