/* ==========================================================================
   ERP SUPERMARKET - DESIGN SYSTEM ULTRA-MODERNE (UI/UX v4.0)
   Animations fluides (Spring Physics), Glassmorphism, Micro-interactions
   & Responsive Design haute précision (Desktop, Laptop, Tablette, Mobile)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

@media screen {
    :root {
        --erp-font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
        --erp-bg-main: #f4f7fb;
        --erp-surface: #ffffff;
        --erp-text-main: #0f172a;
        --erp-text-muted: #64748b;
        --erp-border: #e2e8f0;
        --erp-primary: #06beb6;
        --erp-primary-dark: #0284c7;
        --erp-sidebar-bg: linear-gradient(165deg, #0b1120 0%, #111827 55%, #1e293b 100%);
        --erp-shadow-sm: 0 2px 10px -2px rgba(15, 23, 42, 0.05), 0 1px 4px -1px rgba(15, 23, 42, 0.03);
        --erp-shadow-md: 0 12px 28px -6px rgba(15, 23, 42, 0.08), 0 4px 12px -3px rgba(15, 23, 42, 0.04);
        --erp-shadow-lg: 0 22px 45px -10px rgba(15, 23, 42, 0.14), 0 10px 20px -6px rgba(15, 23, 42, 0.06);
        --erp-shadow-hover: 0 20px 38px -8px rgba(15, 23, 42, 0.13), 0 8px 18px -4px rgba(6, 190, 182, 0.1);
        --erp-radius-xl: 20px;
        --erp-radius-lg: 16px;
        --erp-radius-md: 12px;
        --erp-radius-sm: 8px;
        --erp-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
        --erp-ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* ==========================================================================
       1. ANIMATIONS KEYFRAMES FLUIDES
       ========================================================================== */
    @keyframes erpFadeUp {
        0% {
            opacity: 0;
            transform: translateY(16px) scale(0.99);
        }
        100% {
            opacity: 1;
            transform: none;
        }
    }

    @keyframes erpHeaderReveal {
        0% {
            opacity: 0;
            transform: translateY(-10px);
        }
        100% {
            opacity: 1;
            transform: none;
        }
    }

    @keyframes erpSubmenuReveal {
        0% {
            opacity: 0;
            transform: translateY(-6px);
        }
        100% {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes erpPulseDot {
        0%, 100% {
            transform: scale(1);
            opacity: 1;
        }
        50% {
            transform: scale(1.35);
            opacity: 0.65;
        }
    }

    @keyframes erpRippleEffect {
        to {
            transform: scale(3.5);
            opacity: 0;
        }
    }

    /* ==========================================================================
       2. TYPOGRAPHIE, FOND AMBIANT & BARRE DE PROGRESSION
       ========================================================================== */
    html {
        scroll-behavior: smooth;
    }

    html, body {
        max-width: 100vw;
        overflow-x: hidden;
        font-family: var(--erp-font) !important;
        color: var(--erp-text-main);
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        font-variant-numeric: tabular-nums;
    }

    body {
        background-color: var(--erp-bg-main);
        background-image:
            radial-gradient(at 0% 0%, rgba(6, 190, 182, 0.07) 0px, transparent 45%),
            radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.06) 0px, transparent 45%),
            radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
        background-attachment: fixed;
    }

    /* Préserver les polices d'icônes FontAwesome */
    .fa, .fas, .far, .fal, .fab, [class^="fa-"], [class*=" fa-"] {
        font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome" !important;
    }
    .fab {
        font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands" !important;
    }

    /* Barre de progression lumineuse en haut d'écran */
    #erp-top-loader {
        position: fixed;
        top: 0;
        left: 0;
        height: 3.5px;
        width: 0%;
        background: linear-gradient(90deg, #06beb6, #3b82f6, #8b5cf6, #10b981);
        background-size: 200% 100%;
        z-index: 999999;
        transition: width 0.25s var(--erp-ease-out), opacity 0.2s ease;
        opacity: 0;
        pointer-events: none;
        box-shadow: 0 0 14px rgba(6, 190, 182, 0.85);
    }
    #erp-top-loader.active {
        opacity: 1;
    }

    /* Masquer les fausses images placeholder cassées */
    img.logo[src*="via.placeholder.com"],
    img.logo[src=""] {
        display: none !important;
    }

    /* Effet d'onde tactile (Ripple) sur les boutons */
    .erp-ripple-host {
        position: relative;
        overflow: hidden;
    }
    .erp-ripple-wave {
        position: absolute;
        border-radius: 50%;
        transform: scale(0);
        animation: erpRippleEffect 0.55s ease-out;
        background: rgba(255, 255, 255, 0.38);
        pointer-events: none;
    }

    /* ==========================================================================
       3. EN-TÊTE (HEADER) GLASSMORPHISM & ANIMATION D'ENTRÉE
       ========================================================================== */
    header,
    .top-navbar {
        position: relative !important;
        z-index: 9500 !important;
        overflow: visible !important;
    }

    header {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        padding: 15px 24px !important;
        border-radius: var(--erp-radius-lg) !important;
        box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
        margin-bottom: 24px !important;
        border: 1px solid rgba(255, 255, 255, 0.18);
        animation: erpHeaderReveal 0.4s var(--erp-ease-out) both;
    }

    header .super-market-title {
        color: #ffffff !important;
        font-size: 1.45rem !important;
        font-weight: 800 !important;
        letter-spacing: -0.025em;
        line-height: 1.25 !important;
        margin: 0 !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    }

    header .header-info {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 12px !important;
        margin-left: auto !important;
        flex-wrap: wrap !important;
    }

    /* Badge utilisateur avec point lumineux "en ligne" */
    header .username {
        color: #ffffff !important;
        font-weight: 600 !important;
        font-size: 0.88rem !important;
        margin: 0 !important;
        background: rgba(255, 255, 255, 0.16);
        padding: 6px 14px 6px 12px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.25);
        backdrop-filter: blur(8px);
        display: inline-flex !important;
        align-items: center;
        gap: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }
    header .username::before {
        content: '';
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #4ade80;
        box-shadow: 0 0 8px #4ade80;
        animation: erpPulseDot 2.4s infinite ease-in-out;
        flex-shrink: 0;
    }

    header .fa-user-circle {
        color: #ffffff !important;
        opacity: 0.92;
    }

    .notifications-container,
    .notification-bell {
        position: relative !important;
        overflow: visible !important;
        z-index: 99999 !important;
    }

    header .notification-bell {
        color: #ffffff !important;
        background: rgba(255, 255, 255, 0.16) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 11px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        transition: all 0.25s var(--erp-ease-spring) !important;
        overflow: visible !important;
    }
    header .notification-bell:hover {
        background: rgba(255, 255, 255, 0.28) !important;
        transform: translateY(-2px) scale(1.04);
    }

    /* Fenêtre déroulante de notifications toujours au premier plan absolu */
    .notification-dropdown,
    .notifications-dropdown,
    #notificationsDropdown,
    #notificationDropdown,
    #notifDropdown {
        z-index: 999999 !important;
        background: #ffffff !important;
        color: #0f172a !important;
        border-radius: 16px !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: 0 25px 60px -10px rgba(15, 23, 42, 0.38), 0 10px 25px -5px rgba(15, 23, 42, 0.2) !important;
    }

    header .logout-button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 7px !important;
        background: #ffffff !important;
        color: #0f172a !important;
        border: none !important;
        padding: 8px 16px !important;
        border-radius: 11px !important;
        font-weight: 700 !important;
        font-size: 0.86rem !important;
        text-decoration: none !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14) !important;
        transition: all 0.25s var(--erp-ease-spring) !important;
        white-space: nowrap !important;
    }
    header .logout-button:hover {
        transform: translateY(-2px) !important;
        background: #f8fafc !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2) !important;
    }

    /* Bouton Hamburger (Toggle Menu Latéral) */
    .erp-menu-toggle-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        border-radius: 11px !important;
        border: 1px solid rgba(255, 255, 255, 0.32) !important;
        background: rgba(255, 255, 255, 0.18) !important;
        color: #ffffff !important;
        font-size: 1.15rem !important;
        cursor: pointer !important;
        margin-right: 4px !important;
        padding: 0 !important;
        transition: all 0.25s var(--erp-ease-spring) !important;
        backdrop-filter: blur(6px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12) !important;
        flex-shrink: 0 !important;
    }
    .erp-menu-toggle-btn:hover {
        background: rgba(255, 255, 255, 0.3) !important;
        transform: translateY(-1px) scale(1.04);
    }
    .erp-menu-toggle-btn:active {
        transform: scale(0.94);
    }
    .top-navbar .erp-menu-toggle-btn {
        background: #f1f5f9 !important;
        color: #0f172a !important;
        border: 1px solid #cbd5e1 !important;
    }

    /* ==========================================================================
       4. BARRE LATÉRALE (.menu-bar / .sidebar) LUXURY DARK & SOUS-MENUS FLUIDES
       ========================================================================== */
    .container {
        max-width: 100%;
        gap: 24px;
        align-items: flex-start;
    }

    .container > .content,
    .container > main,
    .main-content,
    .content {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        max-width: 100%;
    }

    .menu-bar {
        width: 268px;
        background: var(--erp-sidebar-bg) !important;
        padding: 20px 14px !important;
        border-radius: var(--erp-radius-xl) !important;
        box-shadow: 0 20px 45px -10px rgba(11, 17, 32, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        margin-top: 0 !important;
        flex-shrink: 0;
        transition: width 0.3s var(--erp-ease-spring),
                    min-width 0.3s var(--erp-ease-spring),
                    margin 0.3s var(--erp-ease-spring),
                    padding 0.3s var(--erp-ease-spring),
                    transform 0.3s var(--erp-ease-spring),
                    opacity 0.22s ease !important;
    }

    .menu-bar h2 {
        color: #94a3b8 !important;
        font-size: 0.78rem !important;
        font-weight: 800 !important;
        letter-spacing: 0.12em !important;
        text-transform: uppercase !important;
        text-align: left !important;
        padding: 4px 12px 14px 12px !important;
        margin: 0 0 12px 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .menu-bar .menu-item {
        color: #cbd5e1 !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        padding: 10px 12px !important;
        border-radius: 12px !important;
        margin-bottom: 6px !important;
        display: flex !important;
        align-items: center !important;
        gap: 11px !important;
        transition: all 0.24s var(--erp-ease-spring) !important;
        border: 1px solid transparent;
    }

    .menu-bar .menu-item:hover {
        background: rgba(255, 255, 255, 0.08) !important;
        color: #ffffff !important;
        transform: translateX(4px) !important;
        border-color: rgba(255, 255, 255, 0.08);
    }

    .menu-bar .menu-item.active {
        background: linear-gradient(135deg, #06beb6 0%, #2563eb 100%) !important;
        color: #ffffff !important;
        box-shadow: 0 8px 20px -4px rgba(6, 190, 182, 0.45) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
    }

    /* Pastille d'icône dans le menu latéral */
    .menu-bar .menu-item .icon {
        color: #38bdf8 !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        border-radius: 9px !important;
        background: rgba(56, 189, 248, 0.12);
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-right: 0 !important;
        font-size: 0.98em !important;
        flex-shrink: 0;
        transition: all 0.24s var(--erp-ease-spring);
    }

    .menu-bar .menu-item:hover .icon {
        background: rgba(56, 189, 248, 0.22);
        color: #7dd3fc !important;
        transform: scale(1.06);
    }

    .menu-bar .menu-item.active .icon {
        background: rgba(255, 255, 255, 0.22) !important;
        color: #ffffff !important;
    }

    /* Sous-menus déroulants 100% largeur sous l'élément parent */
    .menu-item.has-submenu {
        flex-wrap: wrap !important;
        position: relative !important;
        padding-right: 28px !important;
    }
    .menu-item.has-submenu:after {
        top: 22px !important;
        transform: none !important;
        color: #94a3b8 !important;
        transition: transform 0.25s var(--erp-ease-spring) !important;
    }
    .menu-item.has-submenu.active:after {
        transform: rotate(180deg) !important;
        color: #ffffff !important;
    }
    .menu-item.has-submenu > .submenu {
        flex: 0 0 100% !important;
        width: 100% !important;
        margin-top: 8px !important;
        background: rgba(9, 13, 24, 0.72) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 11px !important;
        padding: 6px !important;
        box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3) !important;
        animation: erpSubmenuReveal 0.24s var(--erp-ease-out) both !important;
    }
    .menu-item.has-submenu > .submenu .submenu-item {
        padding: 9px 12px !important;
        margin: 2px 0 !important;
        font-size: 0.85rem !important;
        border-radius: 8px !important;
        color: #cbd5e1 !important;
        transition: all 0.2s ease !important;
    }
    .menu-item.has-submenu > .submenu .submenu-item:hover {
        background: linear-gradient(90deg, rgba(6, 190, 182, 0.22), rgba(37, 99, 235, 0.18)) !important;
        color: #ffffff !important;
        transform: translateX(4px) !important;
    }

    /* Rétraction du menu sur grand écran (> 992px) */
    @media (min-width: 993px) {
        body.erp-sidebar-collapsed .menu-bar {
            width: 0 !important;
            min-width: 0 !important;
            padding-left: 0 !important;
            padding-right: 0 !important;
            margin-right: -24px !important;
            overflow: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
            border: none !important;
        }
        body.erp-sidebar-collapsed .sidebar {
            transform: translateX(-100%) !important;
        }
        body.erp-sidebar-collapsed .main-content {
            margin-left: 0 !important;
        }
        body.erp-sidebar-collapsed .container > .content {
            padding-left: 0 !important;
        }
    }

    /* Backdrop du tiroir mobile */
    .erp-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.62);
        backdrop-filter: blur(5px);
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.28s ease;
    }
    .erp-sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }

    /* ==========================================================================
       5. CARTES, KPIS, TABLEAUX, BOUTONS & ANIMATIONS EN CASCADE
       ========================================================================== */
    .erp-animate-in {
        animation: erpFadeUp 0.45s var(--erp-ease-out) both;
    }

    .card,
    .main-card,
    .table-card,
    .top-products {
        border-radius: var(--erp-radius-lg) !important;
        box-shadow: var(--erp-shadow-md) !important;
        border: 1px solid rgba(226, 232, 240, 0.9) !important;
        transition: transform 0.28s var(--erp-ease-spring), box-shadow 0.28s var(--erp-ease-spring) !important;
    }

    .card:hover,
    .top-products:hover {
        transform: translateY(-4px);
        box-shadow: var(--erp-shadow-hover) !important;
    }

    .kpi-card {
        border-radius: var(--erp-radius-lg) !important;
        box-shadow: var(--erp-shadow-md) !important;
        transition: transform 0.28s var(--erp-ease-spring), box-shadow 0.28s var(--erp-ease-spring) !important;
    }
    .kpi-card:hover {
        transform: translateY(-5px) scale(1.015) !important;
    }

    /* Conteneur de Tableaux Responsives & Raffinement Visuel */
    .erp-table-responsive,
    .table-container,
    .scb-table-container,
    .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        position: relative;
        border-radius: var(--erp-radius-md);
    }

    table.erp-table-wide {
        min-width: 680px;
    }
    table.erp-table-very-wide {
        min-width: 860px;
    }

    table th {
        font-weight: 700 !important;
        letter-spacing: 0.03em;
        white-space: nowrap;
    }

    table tbody tr {
        transition: background-color 0.16s ease;
    }
    table tbody tr:hover {
        background-color: rgba(6, 190, 182, 0.045) !important;
    }

    /* Champs de formulaires & boutons raffinés */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea {
        border-radius: 10px !important;
        transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
    }
    input:not([type="checkbox"]):not([type="radio"]):focus,
    select:focus,
    textarea:focus {
        border-color: #06beb6 !important;
        box-shadow: 0 0 0 3.5px rgba(6, 190, 182, 0.16) !important;
        outline: none !important;
    }

    /* Bouton flottant Retour en Haut (#erp-back-to-top) */
    #erp-back-to-top {
        position: fixed;
        bottom: 24px;
        right: 24px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        color: #ffffff;
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.3);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
        cursor: pointer;
        z-index: 9990;
        opacity: 0;
        visibility: hidden;
        transform: translateY(12px) scale(0.9);
        transition: all 0.28s var(--erp-ease-spring);
    }
    #erp-back-to-top.visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
    }
    #erp-back-to-top:hover {
        background: linear-gradient(135deg, #06beb6 0%, #0284c7 100%);
        transform: translateY(-3px) scale(1.06);
        box-shadow: 0 12px 28px rgba(6, 190, 182, 0.4);
    }

    /* Scrollbar fine pour les tableaux */
    .erp-table-responsive::-webkit-scrollbar,
    .table-container::-webkit-scrollbar,
    .scb-table-container::-webkit-scrollbar {
        height: 7px;
        width: 7px;
    }
    .erp-table-responsive::-webkit-scrollbar-track,
    .table-container::-webkit-scrollbar-track,
    .scb-table-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 4px;
    }
    .erp-table-responsive::-webkit-scrollbar-thumb,
    .table-container::-webkit-scrollbar-thumb,
    .scb-table-container::-webkit-scrollbar-thumb {
        background: #94a3b8;
        border-radius: 4px;
    }

    /* Modales responsives */
    .modal-content,
    .scb-modal,
    .modal-dialog {
        max-width: 95vw !important;
        max-height: 92vh !important;
        border-radius: var(--erp-radius-lg) !important;
    }

    /* ==========================================================================
       6. ÉCRANS D'ORDINATEURS PORTABLES (max-width: 1366px)
       ========================================================================== */
    @media (max-width: 1366px) {
        body {
            padding: 14px !important;
        }
        .menu-bar {
            width: 242px;
        }
        header .super-market-title {
            font-size: 1.3rem !important;
        }
        table th,
        table td {
            padding: 10px 9px;
            font-size: 0.87rem;
        }
    }

    /* ==========================================================================
       7. TABLETTES & PETITS ÉCRANS (max-width: 992px)
       ========================================================================== */
    @media (max-width: 992px) {
        body {
            padding: 10px !important;
        }

        .container {
            display: block !important;
            width: 100% !important;
        }

        .container > .content,
        .content {
            width: 100% !important;
            padding-left: 0 !important;
            padding-top: 8px !important;
        }

        .main-content {
            margin-left: 0 !important;
            padding: 12px !important;
            width: 100% !important;
        }

        /* Menu latéral transformé en tiroir coulissant gauche */
        .menu-bar,
        .sidebar {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            bottom: 0 !important;
            height: 100vh !important;
            width: 288px !important;
            max-width: 84vw !important;
            margin: 0 !important;
            border-radius: 0 22px 22px 0 !important;
            z-index: 9999 !important;
            overflow-y: auto !important;
            transform: translateX(-105%) !important;
            box-shadow: 14px 0 45px rgba(0, 0, 0, 0.45) !important;
        }

        body.erp-mobile-menu-open .menu-bar,
        body.erp-mobile-menu-open .sidebar {
            transform: translateX(0) !important;
        }

        .erp-drawer-close-btn {
            display: flex !important;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 11px 14px;
            margin-bottom: 14px;
            background: rgba(255, 255, 255, 0.1);
            color: #ffffff;
            border: 1px solid rgba(255, 255, 255, 0.18);
            border-radius: 11px;
            font-weight: 700;
            font-size: 0.9rem;
            cursor: pointer;
        }
    }

    @media (min-width: 993px) {
        .erp-drawer-close-btn {
            display: none !important;
        }
    }

    /* ==========================================================================
       8. POSITIONNEMENT MOBILE PRÉCIS SUR ÉCRAN DE TÉLÉPHONE (max-width: 768px)
       ========================================================================== */
    @media (max-width: 768px) {
        html,
        body {
            max-width: 100vw !important;
            overflow-x: hidden !important;
            position: relative !important;
            width: 100% !important;
            box-sizing: border-box !important;
        }

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

        body {
            padding: 8px !important;
        }

        /* Anti-débordement horizontal des conteneurs & grilles */
        .container,
        .main-container,
        .content,
        .main-content,
        .card,
        .main-card,
        .form-card,
        .form-container,
        .table-card,
        .wrap,
        form,
        fieldset {
            max-width: 100% !important;
            width: 100% !important;
            min-width: 0 !important;
            box-sizing: border-box !important;
        }

        /* Tous les conteneurs flex/grid peuvent se rétrécir sans pousser le parent vers la droite */
        div,
        section,
        article,
        main,
        nav,
        header,
        footer {
            min-width: 0;
        }

        /* Forcer toutes les grilles CSS à passer sur 1 colonne sur smartphone */
        [class*="grid"],
        [style*="display: grid"],
        [style*="display:grid"],
        .form-grid,
        .kpi-grid,
        .stats-grid,
        .filters-row,
        .cards,
        .modules-grid,
        .periode-info,
        .products {
            grid-template-columns: 1fr !important;
            max-width: 100% !important;
            min-width: 0 !important;
        }

        /* Empêcher les formulaires, inputs, boutons et selects d'exploser hors écran */
        input:not([type="checkbox"]):not([type="radio"]),
        select,
        textarea,
        button,
        .btn {
            max-width: 100% !important;
            box-sizing: border-box !important;
        }

        /* Assurer le défilement horizontal fluide des tableaux sans déborder la page */
        .erp-table-responsive,
        .table-container,
        .scb-table-container,
        .table-responsive {
            width: 100% !important;
            max-width: 100% !important;
            overflow-x: auto !important;
            -webkit-overflow-scrolling: touch !important;
            display: block !important;
            min-width: 0 !important;
        }

        /* Laisser les colonnes du tableau s'afficher normalement à l'intérieur du conteneur scrollable */
        .erp-table-responsive > table,
        .table-container > table,
        .scb-table-container > table,
        .table-responsive > table {
            max-width: none !important;
            width: 100% !important;
        }

        header {
            display: flex !important;
            flex-direction: row !important;
            flex-wrap: wrap !important;
            align-items: center !important;
            justify-content: flex-start !important;
            padding: 12px 14px !important;
            gap: 8px 10px !important;
            margin-bottom: 14px !important;
            border-radius: 15px !important;
        }

        header > div[style*="border-radius: 50%"],
        header > img.logo {
            width: 34px !important;
            height: 34px !important;
            min-width: 34px !important;
            margin-right: 2px !important;
        }
        header > div[style*="border-radius: 50%"] i {
            font-size: 1.05rem !important;
        }

        .erp-menu-toggle-btn {
            width: 38px !important;
            height: 38px !important;
            min-width: 38px !important;
            margin-right: 2px !important;
        }

        header .super-market-title {
            flex: 1 1 calc(100% - 105px) !important;
            font-size: 1.06rem !important;
            line-height: 1.25 !important;
            text-align: left !important;
            word-break: break-word;
        }

        header .header-info {
            flex: 1 1 100% !important;
            width: 100% !important;
            margin-left: 0 !important;
            margin-top: 4px !important;
            padding-top: 8px !important;
            border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
            display: flex !important;
            flex-direction: row !important;
            align-items: center !important;
            justify-content: space-between !important;
            gap: 8px !important;
        }

        header .header-info > i.fa-user-circle {
            display: none !important;
        }

        header .username {
            display: inline-flex !important;
            font-size: 0.79rem !important;
            padding: 4px 10px !important;
            max-width: 52vw;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-right: auto !important;
        }

        header .logout-button {
            padding: 6px 12px !important;
            font-size: 0.8rem !important;
            margin-left: auto !important;
        }

        .notifications-dropdown,
        #notificationsDropdown {
            position: fixed !important;
            top: 72px !important;
            left: 10px !important;
            right: 10px !important;
            width: calc(100vw - 20px) !important;
            max-width: none !important;
            max-height: 75vh !important;
            z-index: 99999 !important;
        }

        .dashboard-header,
        .scb-top-bar,
        .top-navbar {
            display: flex !important;
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 10px !important;
            padding: 14px !important;
        }

        .dashboard-title,
        .dashboard-header h2,
        .content > h2 {
            font-size: 1.25rem !important;
            line-height: 1.3 !important;
            margin-bottom: 12px !important;
        }

        .kpis,
        .kpi-grid,
        .stats-grid,
        .scb-kpi-grid,
        .cards,
        .modules-grid {
            display: grid !important;
            grid-template-columns: 1fr !important;
            gap: 12px !important;
        }

        .content div[style*="display: grid"],
        .content div[style*="display:grid"] {
            grid-template-columns: 1fr !important;
            gap: 12px !important;
        }

        .content div[style*="position: relative"] > h3 {
            padding-right: 80px !important;
            font-size: 0.85rem !important;
        }

        .kpi-value,
        .content div[style*="font-size: 2.2em"],
        .content div[style*="font-size: 2em"] {
            font-size: 1.55rem !important;
            line-height: 1.2 !important;
            word-break: break-word;
        }

        .card .card-actions,
        .scb-action-btns {
            display: flex !important;
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 8px !important;
            width: 100% !important;
        }

        .card .card-actions a,
        .card .card-actions button,
        .scb-action-btns .scb-btn,
        .access-button {
            width: 100% !important;
            justify-content: center !important;
            text-align: center !important;
            padding: 11px 14px !important;
        }

        .scb-tabs-bar {
            display: flex !important;
            flex-wrap: nowrap !important;
            overflow-x: auto !important;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 6px !important;
            gap: 8px !important;
        }
        .scb-tabs-bar .scb-tab {
            flex: 0 0 auto !important;
            white-space: nowrap !important;
            padding: 10px 14px !important;
            font-size: 0.85rem !important;
        }

        .filter-bar,
        .search-row,
        .form-row,
        .scb-form-grid,
        .scb-filter-bar form {
            display: flex !important;
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 10px !important;
        }

        .filter-bar > *,
        .search-row > *,
        .form-row > *,
        .scb-form-grid > *,
        .scb-filter-bar form > div {
            width: 100% !important;
            min-width: 0 !important;
            flex: 1 1 100% !important;
        }

        input:not([type="checkbox"]):not([type="radio"]),
        select,
        textarea {
            font-size: 15px !important;
            max-width: 100% !important;
        }

        .card,
        .main-card,
        .card-body,
        .form-container,
        .table-card,
        .top-products,
        .module-card {
            padding: 15px !important;
            border-radius: 14px !important;
        }

        .product-item {
            flex-direction: row !important;
            flex-wrap: wrap !important;
            gap: 8px !important;
            padding: 12px !important;
        }

        /* Adaptation ergonomique des boutons de pointage présence */
        .action-buttons {
            display: grid !important;
            grid-template-columns: 1fr 1fr !important;
            gap: 10px !important;
            width: 100% !important;
            max-width: 100% !important;
            box-sizing: border-box !important;
        }

        .action-buttons .btn-absent,
        .action-buttons a[href*="absent"] {
            grid-column: 1 / -1 !important;
            width: 100% !important;
            max-width: 100% !important;
            box-sizing: border-box !important;
            margin-top: 2px !important;
            text-align: center !important;
            justify-content: center !important;
        }

        .erp-mobile-scroll-hint {
            display: inline-flex !important;
            align-items: center;
            gap: 6px;
            font-size: 0.76rem;
            font-weight: 600;
            color: #475569;
            background: #f1f5f9;
            border: 1px solid #cbd5e1;
            padding: 4px 10px;
            border-radius: 999px;
            margin-bottom: 8px;
        }

        #erp-back-to-top {
            bottom: 16px;
            right: 16px;
            width: 40px;
            height: 40px;
        }
    }

    @media (min-width: 769px) {
        .erp-mobile-scroll-hint {
            display: none !important;
        }
    }

    @media (max-width: 400px) {
        header .super-market-title {
            font-size: 0.96rem !important;
        }
        header .username {
            max-width: 44vw;
            font-size: 0.75rem !important;
        }
        header .logout-button {
            padding: 5px 10px !important;
            font-size: 0.75rem !important;
        }
    }
}
