/* Responsive : tablette et mobile */
@media (max-width: 991.98px) {
    :root { --sidebar-w: 280px; }
    body.sidebar-collapsed { --sidebar-w: 280px; }
    .sidebar { transform: translateX(-100%); box-shadow: 6px 0 24px rgba(0,0,0,.3); }
    .kpi-col { flex: 0 0 auto; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(17,19,24,.5); z-index: 1035; }
    .topbar { left: 0; padding: 0 .85rem; }
    .topbar-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
    .topbar-logo { display: block; }
    .app-content { margin-left: 0; padding: 1.1rem; }
    .sidebar-collapse-btn { display: none; }
    .sidebar { width: min(82vw, 280px); }
    .sidebar .nav-link { justify-content: flex-start; padding: .8rem .9rem; margin-bottom: 6px; }
    .sidebar .nav-link i { width: 1.6rem; }
    .sidebar .nav-link span { display: inline; }
    body.sidebar-collapsed .nav-link { justify-content: flex-start; }
    body.sidebar-collapsed .nav-link span, body.sidebar-collapsed .sidebar-section { display: revert; }
    body.sidebar-collapsed .sidebar-brand img { content: normal; }
}
@media (max-width: 767.98px) {
    .topbar-search { display: none; }
    .store-btn { max-width: 150px; padding: .25rem .55rem; }
    .store-btn-text small { display: none; }
    .store-btn .store-caret { display: none; }
    .page-head .btn { flex: 0 0 auto; }
    .product-detail-actions { gap: .5rem !important; }
    .product-detail-actions .btn { flex: 1 1 calc(50% - .5rem); min-height: 42px; }
    .product-detail-actions .product-download-btn { display: none !important; }
    .detail-photo { max-width: 220px; width: 100%; }
    .detail-photo-empty { min-height: 220px; }
}
/* Panier : lignes empilées sur mobile (aucun défilement horizontal) */
@media (max-width: 767.98px) {
    .cart-table thead { display: none; }
    .cart-table, .cart-table tbody { display: block; }
    .cart-table tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "nom act" "ref prix" "qty tot"; gap: .4rem .75rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
    .cart-table td { display: block; padding: 0 !important; border: 0 !important; text-align: left !important; background: transparent !important; }
    .cart-table .c-nom { grid-area: nom; } .cart-table .c-act { grid-area: act; }
    .cart-table .c-ref { grid-area: ref; align-self: center; }
    .cart-table .c-prix { grid-area: prix; text-align: right !important; align-self: center; }
    .cart-table .c-qty { grid-area: qty; } .cart-table .c-tot { grid-area: tot; text-align: right !important; align-self: center; }
    .cart-table .c-empty { grid-column: 1 / -1; }
    .cart-table tr.stock-error-row { display: block; padding: 0 0 .85rem; margin-top: -.5rem; }
    .cart-table tr.stock-error-row td { display: block; }
}
@media (max-width: 575.98px) {
    .chart-box { height: 280px; }
    .stats-filters .form-select-sm, .stats-filters .form-control-sm { min-width: 0; width: 100%; }
    .stats-filters .d-flex > div { flex: 1 1 100%; }
    .seg { width: 100%; } .seg-btn { flex: 1; justify-content: center; font-size: .78rem; padding: .4rem .4rem; }
    .app-content { padding: .85rem; }
    h1, .h1 { font-size: 1.35rem; }
    .kpi .stat-value { font-size: 1.15rem; }
    .kpi .stat-icon { width: 42px; height: 42px; font-size: 1.05rem; }
    .kpi .card-body { gap: .6rem; padding: .85rem .7rem; }
    .quick-grid { grid-template-columns: 1fr; }
    .table { font-size: .82rem; }
    .toast-stack { right: .5rem; left: .5rem; width: auto; }
}
@media print {
    .topbar, .sidebar, .sidebar-backdrop, .app-footer, .no-print, .toast-stack { display: none !important; }
    .app-content { margin: 0 !important; padding: 0 !important; }
    .app-wrapper { padding-top: 0; }
    body { background: #fff; }
}

/* =====================================================================
   Liste des produits : cartes sur mobile et tablette étroite (< 768 px)
   Le tableau desktop n'est pas modifié.
   ===================================================================== */
.compatibility-thumb {
    width: 42px; height: 42px; object-fit: cover; border-radius: 10px; background: var(--gray-100); flex-shrink: 0;
}
.compatibility-thumb-empty {
    display: flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--gray-500); border: 1px solid var(--border);
}

@media (min-width: 768px) {
    .more-filters.collapse { display: contents !important; }
    .more-filters-row { display: contents; }
}
@media (max-width: 767.98px) {
    .products-filters { position: sticky; top: var(--topbar-h); z-index: 20; background: #f4f5f7; margin-left: -.85rem; margin-right: -.85rem; padding: .5rem .85rem .25rem; }
    .products-filters .form-control, .products-filters .form-select { min-height: 46px; border-radius: 12px; }
    .more-filters-row { padding-top: .25rem; }
    .chip-row { margin-left: -.85rem; margin-right: -.85rem; padding-left: .85rem; padding-right: .85rem; }

    .products-card { border: 0; background: transparent; box-shadow: none; }
    .products-card .card-header { background: transparent !important; border: 0; padding: .25rem 0 .5rem; }
    .products-card .card-footer { background: transparent !important; border: 0; padding: .75rem 0 0; }
    .products-card .table-responsive { overflow: visible; }
    .products-table, .products-table tbody { display: block; width: 100%; }
    .products-table thead { display: block; }
    .products-table thead tr { display: block; padding: 0 .25rem .5rem; }
    .products-table thead th { display: none; border: 0; padding: 0; background: transparent; }
    .products-table thead th:first-child { display: block; }

    .products-table tbody tr:not(.empty-row) {
        display: grid; grid-template-columns: 68px minmax(0, 1fr) 40px;
        grid-template-areas: "photo nom menu" "photo meta meta" "photo prix stock";
        column-gap: .8rem; row-gap: .15rem; align-items: center;
        background: var(--white); border: 1px solid var(--border); border-radius: 18px; padding: .7rem .5rem .7rem .7rem; margin-bottom: .7rem;
        box-shadow: 0 2px 8px rgba(17, 19, 24, .06); position: relative;
    }
    .products-table tbody tr.is-inactive { opacity: .72; background: #f1f3f5; }
    .products-table tbody tr.row-selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(217, 0, 0, .15); }
    .products-table tbody tr td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; text-align: left !important; width: auto !important; }
    .products-table .c-ref, .products-table .c-cat, .products-table .c-mag, .products-table .c-statut { display: none !important; }
    .products-table .c-photo { grid-area: photo; align-self: start; }
    .products-table .p-thumb { width: 68px; height: 68px; border-radius: 12px; }
    .products-table .p-thumb-empty { font-size: 1.5rem !important; background: var(--gray-100); }
    .products-table .c-nom { display: contents !important; }
    .products-table .c-nom strong { grid-area: nom; align-self: end; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 1rem; line-height: 1.25; }
    .products-table .c-nom .m-meta { grid-area: meta; align-self: center; margin: 0; font-size: .78rem; }
    .products-table .c-prix { grid-area: prix; align-self: end; font-weight: 700; font-size: .95rem; color: var(--primary-dark); white-space: nowrap; }
    .products-table .c-stock { grid-area: stock; align-self: end; justify-self: end; padding-right: .4rem !important; }
    .products-table .c-actions { grid-area: menu; align-self: start; justify-self: end; }
    /* Sélection : petite case posée sur le coin de la vignette */
    .products-table .c-check { position: absolute; left: calc(.7rem + 4px); top: calc(.7rem + 4px); z-index: 2; line-height: 0; }
    .products-table .c-check .form-check-input { width: 1.2rem; height: 1.2rem; margin: 0; border-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
    .products-table tbody tr.empty-row { display: block; }
    .select-bar { bottom: .75rem; }

    .compatibility-mobile-trigger { display: flex !important; margin: 0 0 1rem; min-height: 48px; }
    .compatibility-form-panel { display: none !important; }
    .compatibility-list-wrap { padding-left: 0 !important; padding-right: 0 !important; }
    .compatibility-table, .compatibility-table tbody { display: block; width: 100%; }
    .compatibility-table thead { display: none; }
    .compatibility-table tbody tr {
        display: grid; grid-template-columns: 64px minmax(0, 1fr) auto;
        grid-template-areas: "product product action" "type type action" "level level level";
        gap: .4rem .7rem; align-items: center; background: var(--white); border: 1px solid var(--border); border-radius: 18px; padding: .7rem .7rem .65rem; margin-bottom: .7rem; box-shadow: 0 2px 8px rgba(17, 19, 24, .06);
    }
    .compatibility-table tbody tr td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; text-align: left !important; width: auto !important; }
    .compatibility-table .compatibility-product { grid-area: product; }
    .compatibility-table .compatibility-product .d-flex { align-items: center !important; gap: .7rem !important; }
    .compatibility-table .compatibility-thumb {
        width: 54px; height: 54px; object-fit: cover; border-radius: 10px; background: var(--gray-100); flex-shrink: 0;
    }
    .compatibility-table .compatibility-thumb-empty {
        display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--gray-500); border: 1px solid var(--border);
    }
    .compatibility-table .compatibility-name-wrap { min-width: 0; }
    .compatibility-table .compatibility-name { display: block; font-weight: 700; line-height: 1.3; }
    .compatibility-table .compatibility-meta { display: block; margin-top: .15rem; color: var(--gray-500); font-size: .74rem; line-height: 1.4; }
    .compatibility-table .compatibility-meta i { margin-right: .35rem; font-size: .7rem; color: var(--gray-500); }
    .compatibility-table .compatibility-reference, .compatibility-table .compatibility-stock { display: none !important; }
    .compatibility-table .compatibility-type { grid-area: type; font-size: .75rem; color: var(--gray-500); }
    .compatibility-table .compatibility-level { grid-area: level; justify-self: start; }
    .compatibility-table .compatibility-action { grid-area: action; justify-self: end; align-self: center; }
    .compatibility-table .compatibility-action form { display: inline-block; }
    .compatibility-table .compatibility-action .btn { padding: .35rem .6rem; min-height: 36px; }
    .compatibility-table .compatibility-action .btn-outline-danger {
        border-radius: 10px; background: #fff; color: var(--danger); border-color: rgba(220, 53, 69, .2);
    }
    .compatibility-table .compatibility-level .badge { font-size: .72rem; }

    .modal-dialog { margin: .75rem; }
    .modal-content { border: 0; border-radius: 22px; overflow: hidden; box-shadow: 0 18px 50px rgba(17, 19, 24, .2); }
    .modal-header { padding: .9rem 1rem .8rem; border-bottom: 1px solid var(--border); }
    .modal-header .btn-close { margin: 0; }
    .modal-title { font-size: 1.05rem; font-weight: 700; }
    .modal-body { padding: 1rem; }
    .modal-body .row { --bs-gutter-y: .75rem; }
    .modal-body .form-label { display: block; margin-bottom: .38rem; color: var(--gray-600); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
    .modal-body .form-control, .modal-body .form-select { min-height: 48px; border-radius: 12px; border: 1px solid #dfe4eb; background: #fff; box-shadow: none; }
    .modal-body .form-control:focus, .modal-body .form-select:focus { border-color: rgba(217, 0, 0, .35); box-shadow: 0 0 0 .24rem rgba(217, 0, 0, .08); }
    .modal-footer { padding: 0 1rem 1rem; border: 0; gap: .65rem; }
    .modal-footer .btn { flex: 1; min-height: 46px; border-radius: 12px; }
    .modal-footer .btn-outline-secondary { background: #f3f5f7; border-color: #e0e4ea; }
    .modal-body { max-height: calc(78vh - 90px); overflow-y: auto; }
}
@media (min-width: 768px) {
    .compatibility-mobile-trigger { display: none !important; }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .products-table tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: .75rem; }
    .products-table tbody tr.empty-row { grid-column: 1 / -1; }
}

/* Menu « ⋮ » : cibles tactiles confortables sur mobile */
@media (max-width: 767.98px) {
    .row-menu-btn { width: 40px; height: 40px; }
    .row-menu-list { min-width: 240px; }
    .row-menu-list .dropdown-item { min-height: 46px; }
}

/* =====================================================================
   En-tête (topbar) adaptatif : de 280 px (petit mobile) à 4K.
   Aucun élément ne déborde : les blocs peuvent rétrécir, le nom du
   magasin se tronque, puis ne reste que l'icône sur très petit écran.
   ===================================================================== */
.topbar { min-width: 0; max-width: 100vw; }
.topbar-actions { min-width: 0; flex-shrink: 0; }
.topbar-search { min-width: 0; }
.store-switch { min-width: 0; }
.store-btn { min-width: 0; }
.user-toggle { flex-shrink: 0; }
.topbar .dropdown-menu { max-width: calc(100vw - 1rem); }
.topbar .dropdown-menu.p-0 { min-width: 0 !important; width: 280px; }

/* Tablette large : le champ de recherche garde une largeur raisonnable */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .topbar { padding: 0 1rem; gap: .5rem; }
    .topbar-search input { height: 40px; }
    .store-btn { max-width: 200px; }
}

/* Tablette / mobile (menu en tiroir) */
@media (max-width: 991.98px) {
    .topbar { gap: .5rem; }
    .topbar-logo { flex-shrink: 1; min-width: 0; display: flex; align-items: center; }
    .topbar-logo img { height: 34px; max-width: 100%; object-fit: contain; }
    .topbar-menu-btn { flex-shrink: 0; }
    .topbar-actions { margin-left: auto; gap: .35rem; }
    .topbar .dropdown-menu { position: absolute; }
}

/* Mobile */
@media (max-width: 575.98px) {
    :root { --topbar-h: 58px; }
    .topbar { padding: 0 max(.55rem, env(safe-area-inset-right)) 0 max(.55rem, env(safe-area-inset-left)); gap: .4rem; }
    .topbar-menu-btn { width: 38px; height: 38px; }
    .topbar-logo img { height: 30px; }
    .topbar-actions { gap: .2rem; }
    .icon-btn { width: 38px; height: 38px; font-size: 1.05rem; }
    .avatar { width: 34px; height: 34px; font-size: .85rem; }
    .user-toggle { padding: .1rem; }
    .store-btn { max-width: 118px; gap: .4rem; padding: .25rem .5rem; }
    .store-btn-text strong { font-size: .78rem; }
    .topbar .dropdown-menu { font-size: .85rem; }
}

/* Très petit écran : seulement l'icône du magasin (le nom reste dans le menu déroulant) */
@media (max-width: 419.98px) {
    .store-btn { width: 38px; height: 38px; max-width: 38px; padding: 0; justify-content: center; border-radius: 10px; }
    .store-btn .store-btn-text { display: none; }
}
@media (max-width: 339.98px) {
    .topbar-logo img { height: 26px; }
    .topbar-menu-btn, .icon-btn { width: 34px; height: 34px; }
    .store-btn { width: 34px; height: 34px; max-width: 34px; }
    .avatar { width: 30px; height: 30px; }
}

/* Menu latéral : écran court (paysage) ou très étroit */
@media (max-height: 520px) {
    .sidebar-brand { padding: .4rem .8rem; }
    .sidebar-brand img { max-height: 44px; }
    .sidebar-section { padding-top: .5rem; }
    .sidebar .nav-link { padding-top: .5rem; padding-bottom: .5rem; }
}
@media (max-width: 991.98px) {
    .sidebar { max-width: 100vw; }
    .sidebar-panel { overscroll-behavior: contain; }
    .sidebar-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; max-height: 100%; }
}

/* Contenu : jamais de défilement horizontal de la page */
html, body { max-width: 100%; }
html { overflow-x: hidden; }
body { overflow-x: hidden; }
@supports (overflow: clip) { body { overflow-x: clip; } }   /* clip ne crée pas de conteneur de défilement : les éléments « sticky » (filtres, total du carnet) fonctionnent */
.app-content img, .app-content canvas, .app-content video { max-width: 100%; }
.app-footer { flex-direction: column; align-items: flex-start; }
@media (min-width: 768px) { .app-footer { flex-direction: row; align-items: center; } }
@media (min-width: 1700px) { .app-content { padding-left: 2.25rem; padding-right: 2.25rem; } }

/* Entre tablette portrait et petit desktop : le champ de recherche reste utilisable */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .topbar-search { min-width: 170px; }
    .store-btn { max-width: 170px; }
    .store-btn-text small { display: none; }
    .store-btn .store-caret { display: none; }
    .topbar .user-meta, .topbar .user-toggle > .fa-chevron-down { display: none !important; }
}

/* Liste Stocks sur mobile : une carte courte par produit (photo, nom, stock, menu) */
@media (max-width: 767.98px) {
    .stocks-card { border: 0; background: transparent; box-shadow: none; }
    .stocks-card .card-footer { background: transparent !important; border: 0; padding: .75rem 0 0; }
    .stocks-card .table-responsive { overflow: visible; }
    .stocks-table, .stocks-table tbody { display: block; width: 100%; }
    .stocks-table thead { display: none; }
    .stocks-table tbody tr:not(.empty-row) {
        display: grid; grid-template-columns: 68px minmax(0, 1fr) 40px;
        grid-template-areas: "photo nom menu" "photo meta meta" "photo stock stock";
        column-gap: .8rem; row-gap: .2rem; align-items: center;
        background: var(--white); border: 1px solid var(--border); border-radius: 18px; padding: .7rem .5rem .7rem .7rem; margin-bottom: .7rem;
        box-shadow: 0 2px 8px rgba(17, 19, 24, .06);
    }
    .stocks-table tbody tr.is-inactive { opacity: .72; background: #f1f3f5; }
    .stocks-table tbody tr td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; text-align: left !important; width: auto !important; }
    .stocks-table .c-ref, .stocks-table .c-cat, .stocks-table .c-mag, .stocks-table .c-seuil, .stocks-table .c-etat { display: none !important; }
    .stocks-table .c-photo { grid-area: photo; align-self: start; }
    .stocks-table .p-thumb { width: 68px; height: 68px; border-radius: 12px; }
    .stocks-table .p-thumb-empty { font-size: 1.5rem !important; background: var(--gray-100); }
    .stocks-table .c-nom { display: contents !important; }
    .stocks-table .c-nom strong { grid-area: nom; align-self: end; display: block; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.25; }
    .stocks-table .c-nom .m-meta { grid-area: meta; align-self: center; margin: 0; font-size: .78rem; }
    .stocks-table .c-stock { grid-area: stock; align-self: end; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-weight: 400; }
    .stocks-table .c-actions { grid-area: menu; align-self: start; justify-self: end; }
    .stocks-table tbody tr.empty-row { display: block; }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .stocks-table tbody { display: grid; grid-template-columns: 1fr 1fr; column-gap: .75rem; }
    .stocks-table tbody tr.empty-row { grid-column: 1 / -1; }
}


/* =====================================================================
   Tableaux -> cartes sur mobile (voir assets/js/table-mobile.js)
   Chaque ligne = une carte lisible, sans défilement horizontal ni colonne cachée.
   Le tableau desktop n'est pas modifié.
   ===================================================================== */
@media (max-width: 767.98px) {
    .table-responsive.stack-wrap { overflow: visible; padding: .65rem .65rem .1rem; }
    .is-stack, .is-stack tbody, .is-stack tfoot, .is-stack tr { display: block; width: 100%; box-sizing: border-box; }
    .is-stack thead { display: none; }
    .is-stack { font-size: .9rem; border: 0; --bs-table-bg: transparent; }
    .is-stack tbody tr {
        background: var(--white, #fff); border: 1px solid var(--border); border-radius: 12px;
        padding: .5rem .85rem; margin: 0 0 .6rem; box-shadow: 0 1px 2px rgba(17, 19, 24, .05);
    }
    .is-stack tbody tr.table-active, .is-stack tbody tr.row-selected { border-color: var(--primary); }
    .is-stack tfoot tr { background: var(--gray-100); border-radius: 12px; padding: .5rem .85rem; margin: 0 0 .6rem; }
    .is-stack td, .is-stack th {
        display: flex; justify-content: space-between; align-items: baseline; gap: .75rem;
        padding: .3rem 0 !important; border: 0 !important; background: transparent !important;
        box-shadow: none !important; text-align: right !important; width: auto !important; min-width: 0;
    }
    .is-stack td.td-empty { display: none !important; }
    .is-stack td.text-nowrap, .is-stack .text-nowrap { white-space: normal !important; }
    .is-stack td[data-label]:not(.td-main):not(.td-full)::before {
        content: attr(data-label); flex: 0 0 36%; max-width: 40%; text-align: left;
        font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--gray-500);
    }
    .is-stack .td-v { flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
    .is-stack td.td-main {
        display: block; text-align: left !important; font-weight: 700; font-size: .98rem;
        padding: .15rem 0 .45rem !important; margin-bottom: .2rem; border-bottom: 1px solid var(--border) !important;
        overflow-wrap: anywhere;
    }
    .is-stack td.td-full { display: block; text-align: left !important; overflow-wrap: anywhere; }
    .is-stack td.td-actions {
        justify-content: flex-end; flex-wrap: wrap; align-items: center; gap: .4rem;
        margin-top: .3rem; padding-top: .55rem !important; border-top: 1px dashed var(--border) !important;
    }
    .is-stack td.td-actions .btn { min-height: 38px; }
    .is-stack td.td-actions form { display: inline-block; margin: 0; }
}


/* =====================================================================
   Adaptation au navigateur et à la taille de l'écran (PC, tablette, mobile)
   Compléments : aucun changement du design sur ordinateur.
   ===================================================================== */
/* iPhone/iPad : pas d'agrandissement automatique du texte en paysage */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Tactile : pas de délai ni de zoom au double appui sur les boutons et liens */
a, button, .btn, label, select, summary, [role="button"] { touch-action: manipulation; }

/* Hauteur réelle de l'écran sur mobile (la barre d'adresse du navigateur monte/descend) */
@supports (height: 100dvh) {
    .app-wrapper, .auth-wrapper { min-height: 100dvh; }
}

/* Mobile : champs à 16 px minimum, sinon Safari (iPhone) zoome la page à chaque saisie */
@media (max-width: 767.98px) {
    .form-control, .form-select, .form-control-sm, .form-select-sm,
    input[type="text"], input[type="search"], input[type="number"], input[type="tel"],
    input[type="email"], input[type="password"], input[type="date"], input[type="datetime-local"], textarea {
        font-size: 16px;
    }
}

/* Tableau empilé en cartes : plus de largeur minimale (ex. lignes de la facture) */
@media (max-width: 767.98px) {
    .is-stack { min-width: 0 !important; table-layout: auto; }
}

/* Contenus longs : jamais de débordement horizontal (noms, références, adresses) */
.app-content h1, .app-content h2, .app-content h3, .card-header, .panel-head h2 { overflow-wrap: anywhere; }
.app-content pre, .app-content code { white-space: pre-wrap; overflow-wrap: anywhere; }
.app-content iframe, .app-content svg { max-width: 100%; }

/* ===== Barre de navigation du bas (mobile / tablette) - voir includes/bottomnav.php ===== */
.bottom-nav { display: none; }
@media (max-width: 991.98px) {
    :root { --bottomnav-h: 62px; }
    .bottom-nav {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
        padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
        background: #fff; border-top: 1px solid var(--border, #e5e7eb); box-shadow: 0 -4px 18px rgba(17, 19, 24, .07);
    }
    .bn-item {
        flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        padding: 0; border: 0; background: transparent; color: #6b7280; text-decoration: none; position: relative;
        font-size: .68rem; font-weight: 500; line-height: 1.1; -webkit-tap-highlight-color: transparent; cursor: pointer;
    }
    .bn-item:hover { color: #374151; }
    .bn-item:focus-visible { outline: 2px solid #d90000; outline-offset: -4px; border-radius: 12px; }
    .bn-ico { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 26px; font-size: 1.2rem; }
    .bn-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
    .bn-item.active { color: #d90000; font-weight: 600; }
    .bn-item.active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: #d90000; }
    /* Bouton central « Scanner » mis en avant */
    .bn-scan .bn-ico { width: 52px; height: 52px; margin-top: -22px; border-radius: 50%; background: #d90000; color: #fff; font-size: 1.35rem; box-shadow: 0 6px 16px rgba(217, 0, 0, .38); border: 3px solid #fff; box-sizing: content-box; }
    .bn-scan.active .bn-ico { background: #b30000; }
    .bn-scan.active::before { display: none; }
    .bn-scan { color: #d90000; }
    .bn-badge { position: absolute; top: -4px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #111318; color: #fff; font-size: .66rem; line-height: 18px; text-align: center; font-weight: 700; }

    /* Le contenu et les éléments fixes ne passent pas sous la barre */
    body.app-page .app-content { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px) + 1rem); }
    .cn-wa-fab { bottom: calc(var(--bottomnav-h) + 1rem + env(safe-area-inset-bottom, 0px)); }
    .qrg-selbar, .select-bar { bottom: calc(var(--bottomnav-h) + .75rem + env(safe-area-inset-bottom, 0px)); }
    .qrg-toast { bottom: calc(var(--bottomnav-h) + 1rem + env(safe-area-inset-bottom, 0px)); }
    .pwa-install { bottom: calc(var(--bottomnav-h) + .75rem + env(safe-area-inset-bottom, 0px)); }
    html.kb-open .bottom-nav { display: none; }
    html.kb-open body.app-page .app-content { padding-bottom: 1rem; }
}
@media print { .bottom-nav { display: none !important; } }
