/* ==========================================================================
   XPRO DESIGN SYSTEM - MODE MÉTIER HAUTE DENSITÉ & RESPONSIVE MULTI-DEVICE
   Version: 2.0.0 (Compact ERP / Desktop, Tablette, Mobile)
   ========================================================================== */

/* ==========================================================================
   1. Base & Variables Métier
   ========================================================================== */
:root {
    --xpro-violet: #3b36db;
    --xpro-violet-hover: #2e2ab0;
    --xpro-violet-light: #e0e0fc;
    --xpro-bg: #f8fafc;
    --xpro-surface: #ffffff;
    --xpro-text-main: #0f172a;
    --xpro-text-muted: #64748b;
    --xpro-border: #e2e8f0;
    --xpro-border-dark: #cbd5e1;
    --xpro-radius: 6px;

    /* Dimensions d'interface condensées (Mode Métier) */
    --sidebar-width: 230px;
    --sidebar-mini-width: 52px;
    --topbar-height: 42px;
    --subheader-height: 38px;

    /* Espacements métiers utiles (Zéro gaspillage de pixels) */
    --xpro-body-padding: 6px 10px 10px 10px;
    --xpro-card-padding: 8px 10px;
    --xpro-gutter: 8px;

    /* Contrôles & Typographie */
    --xpro-control-height: 28px;
    --xpro-font-size-base: 11.5px;
    --xpro-font-size-table: 0.76rem;
    --xpro-table-cell-padding-y: 3.5px;
    --xpro-table-cell-padding-x: 5px;
}

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

body {
    background-color: var(--xpro-bg);
    color: var(--xpro-text-main);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: var(--xpro-font-size-base);
    line-height: 1.35;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   2. Sidebar & Navigation (Compacte & Toggleable)
   ========================================================================== */
.xpro-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--xpro-border);
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 1050;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width, transform;
}

.sidebar-logo { 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    gap: 8px; 
    padding: 7px 12px;
    height: var(--topbar-height);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--xpro-violet);
    border-bottom: 1px solid var(--xpro-border);
    flex-shrink: 0;
}
.sidebar-logo-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.logo-icon {
    background: var(--xpro-violet);
    color: white;
    width: 26px; 
    height: 26px;
    display: flex; 
    justify-content: center; 
    align-items: center;
    border-radius: 6px; 
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.logo-text { 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
}
.logo-text strong { 
    font-size: 0.95rem; 
    line-height: 1.1; 
    letter-spacing: -0.02em;
}
.logo-text small { 
    font-size: 0.58rem; 
    color: var(--xpro-text-muted); 
    white-space: nowrap;
}

/* Bouton pour épingler/réduire la sidebar en Desktop */
.sidebar-pin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--xpro-text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}
.sidebar-pin-btn:hover {
    background: var(--xpro-bg);
    color: var(--xpro-violet);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
    min-height: 0;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.nav-list { list-style: none; padding: 0; margin: 0; }

.nav-group {
    margin-bottom: 2px;
}
.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 12px);
    margin: 6px 6px 2px 6px;
    padding: 5px 8px 5px 10px;
    border: none;
    border-left: 3px solid var(--xpro-violet);
    border-radius: 4px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 0.70rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #334155;
    transition: all 0.15s ease;
}
.nav-group-toggle:hover {
    background: #f1f5f9;
    color: var(--xpro-violet);
}
.nav-group-toggle.collapsed {
    background: transparent;
    border-left-color: #cbd5e1;
    color: var(--xpro-text-muted);
}
.nav-group-toggle.collapsed:hover {
    background: #f8fafc;
    border-left-color: var(--xpro-violet);
    color: var(--xpro-text-main);
}
.chevron-icon {
    font-size: 0.60rem;
    color: var(--xpro-text-muted);
    transition: transform 0.2s ease, color 0.15s ease;
}
.nav-group-toggle:hover .chevron-icon {
    color: var(--xpro-violet);
}
.nav-group-toggle.collapsed .chevron-icon {
    transform: rotate(-90deg);
}
.nav-group-menu {
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}
.nav-group-menu.collapse {
    max-height: 0;
    opacity: 0;
}
.nav-group-menu.show {
    max-height: 800px;
    opacity: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 16px;
    margin: 1px 6px;
    border-radius: 5px;
    color: var(--xpro-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.76rem;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
}
.nav-link:hover {
    background: var(--xpro-bg);
    color: var(--xpro-text-main);
}
.nav-link.active {
    background: var(--xpro-violet-light);
    color: var(--xpro-violet);
    font-weight: 700;
}
.nav-link i {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.nav-link-text {
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge-root-hidden {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
}
.nav-link.link-root-hidden {
    opacity: 0.85;
    border-left: 2px dashed #f59e0b;
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--xpro-border);
    border-radius: 6px;
    background: #fff;
    color: var(--xpro-text-main);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
    background: var(--xpro-bg);
    border-color: var(--xpro-violet);
    color: var(--xpro-violet);
}
.sidebar-toggle-btn.is-collapsed {
    background: #ede9fe;
    border-color: var(--xpro-violet);
    color: var(--xpro-violet);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
    backdrop-filter: blur(2px);
    transition: opacity 0.25s ease;
}
.sidebar-overlay.active {
    display: block;
}

.sidebar-footer {
    padding: 6px 10px;
    font-size: 0.60rem;
    color: var(--xpro-text-muted);
    border-top: 1px solid var(--xpro-border);
    flex-shrink: 0;
}

/* ==========================================================================
   3. Main Content & Layout
   ========================================================================== */
.xpro-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.xpro-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Mode Plein Écran / Sidebar Réduite (Desktop Pin) --- */
.sidebar-collapsed .xpro-sidebar {
    width: var(--sidebar-mini-width);
}
.sidebar-collapsed .xpro-main {
    margin-left: var(--sidebar-mini-width);
}
.sidebar-collapsed .sidebar-logo {
    padding: 7px 6px;
    justify-content: center;
}
.sidebar-collapsed .logo-text,
.sidebar-collapsed .sidebar-pin-btn,
.sidebar-collapsed .sidebar-footer,
.sidebar-collapsed .chevron-icon,
.sidebar-collapsed .nav-link-text {
    display: none !important;
}
.sidebar-collapsed .nav-group-toggle {
    justify-content: center;
    width: calc(100% - 8px);
    margin: 4px;
    padding: 5px 0;
    border-left: none;
}
.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 6px 0;
    margin: 1px 4px;
}

/* --- Topbar Haute Densité --- */
.xpro-topbar {
    background: #ffffff;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--xpro-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-wrapper i {
    position: absolute;
    left: 10px;
    color: var(--xpro-text-muted);
    font-size: 0.80rem;
    pointer-events: none;
}
.search-wrapper input {
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 10px 4px 28px;
    width: 240px;
    height: var(--xpro-control-height);
    font-size: 0.74rem;
    font-weight: 500;
    transition: all 0.2s ease;
}
.search-wrapper input:focus {
    background: #ffffff;
    border-color: var(--xpro-violet);
    box-shadow: 0 0 0 2px var(--xpro-violet-light);
    outline: none;
    width: 280px;
}

/* --- Subheader Haute Densité --- */
.xpro-subheader {
    background: #ffffff;
    padding: 4px 12px;
    border-bottom: 1px solid var(--xpro-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
}
.dashboard-title h1 {
    font-size: 0.92rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    color: var(--xpro-text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.dashboard-title p {
    font-size: 0.67rem;
    color: var(--xpro-text-muted);
    margin: 0;
    line-height: 1.1;
}

/* --- Barre de filtres ultra-dense --- */
.filters-bar { 
    display: flex; 
    gap: 6px; 
    align-items: center; 
    flex-wrap: nowrap;
}
.xpro-filter-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--xpro-border);
    border-radius: 5px;
    padding: 0 6px;
    height: var(--xpro-control-height);
    transition: border-color 0.15s ease;
}
.xpro-filter-wrapper:hover {
    border-color: var(--xpro-border-dark);
}
.xpro-filter-wrapper i {
    color: var(--xpro-text-muted);
    font-size: 0.75rem;
    margin-right: 4px;
}
.xpro-filter-select {
    border: none;
    background: transparent;
    padding: 2px 18px 2px 0;
    height: 100%;
    outline: none;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--xpro-text-main);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
    background-size: 7px auto;
}

/* --- Contenu Principal (Mode Métier) --- */
.xpro-body {
    padding: var(--xpro-body-padding);
    flex: 1;
    min-height: 0;
}

/* ==========================================================================
   4. Cartes Métiers & Conteneurs (Zéro Gaspillage)
   ========================================================================== */
.xpro-card, .card-metier {
    background: var(--xpro-surface);
    border-radius: var(--xpro-radius);
    padding: var(--xpro-card-padding);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--xpro-border);
    margin-bottom: 6px;
}

/* Suppression des marges superflues imbriquées */
.xpro-card:last-child {
    margin-bottom: 0;
}

/* KPIs denses (Hauteur ramenée à 50px au lieu de 75px) */
.kpi-card { 
    display: flex; 
    align-items: center; 
    position: relative; 
    height: 52px; 
    padding: 6px 10px; 
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--xpro-border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.kpi-icon { 
    width: 28px; 
    height: 28px; 
    border-radius: 6px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 0.95rem; 
    flex-shrink: 0;
}
.kpi-icon.primary { background: var(--xpro-violet-light); color: var(--xpro-violet); }
.kpi-icon.success { background: #d1fae5; color: #10b981; }
.kpi-icon.warning { background: #fef3c7; color: #f59e0b; }
.kpi-icon.danger { background: #fee2e2; color: #ef4444; }
.kpi-icon.info { background: #e0f2fe; color: #0ea5e9; }

.kpi-details { 
    flex: 1; 
    margin-left: 8px; 
    min-width: 0;
}
.kpi-title { 
    font-size: 0.67rem; 
    color: var(--xpro-text-muted); 
    font-weight: 700; 
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-value { 
    font-size: 1.05rem; 
    font-weight: 800; 
    color: var(--xpro-text-main); 
    line-height: 1.1;
    margin-bottom: 0;
    font-variant-numeric: tabular-nums;
}
.kpi-trend { 
    font-size: 0.64rem; 
    font-weight: 700; 
    white-space: nowrap;
}
.kpi-chart { 
    position: absolute; 
    right: 6px; 
    bottom: 2px; 
    width: 48px; 
    height: 24px; 
}

/* ==========================================================================
   5. Tableaux & Grilles Métiers Ultra-Denses (25-35 lignes visibles)
   ========================================================================== */
.table-xpro,
.table-metier,
.table-journal,
.table-releve,
.recap-table {
    width: 100%;
    font-size: var(--xpro-font-size-table) !important;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
}

/* Cellules En-tête */
.table-xpro thead th,
.table-metier thead th,
.table-journal thead th,
.table-releve thead th,
.table-rapports thead th {
    position: sticky;
    top: 0;
    z-index: 9;
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    font-weight: 750;
    padding: var(--xpro-table-cell-padding-y) var(--xpro-table-cell-padding-x) !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
    border-top: none;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
}

/* Cellules Corps */
.table-xpro tbody td,
.table-metier tbody td,
.table-journal tbody td,
.table-releve tbody td,
.table-rapports tbody td,
.recap-table tbody td {
    padding: var(--xpro-table-cell-padding-y) var(--xpro-table-cell-padding-x) !important;
    border-bottom: 1px solid var(--xpro-border);
    vertical-align: middle;
    color: var(--xpro-text-main);
    line-height: 1.25;
}

/* Lignes Zébrées Subtiles & Hover */
.table-metier tbody tr:nth-of-type(odd),
.table-journal tbody tr:nth-of-type(odd),
.table-releve tbody tr:nth-of-type(odd) {
    background-color: #ffffff;
}
.table-metier tbody tr:nth-of-type(even),
.table-journal tbody tr:nth-of-type(even),
.table-releve tbody tr:nth-of-type(even) {
    background-color: #fcfdfe;
}
.table-xpro tbody tr:hover,
.table-metier tbody tr:hover,
.table-journal tbody tr:hover,
.table-releve tbody tr:hover {
    background-color: #f0f4ff !important;
}

/* Lignes de Totaux Figées en Bas (Sticky Tfoot) */
table tfoot,
.table-xpro tfoot,
.table-metier tfoot,
.table-journal tfoot,
.table-releve tfoot {
    position: sticky;
    bottom: 0;
    z-index: 10;
}
table tfoot tr,
.table-xpro tfoot tr,
.table-metier tfoot tr,
.table-journal tfoot tr,
.table-releve tfoot tr {
    position: sticky;
    bottom: 0;
}
table tfoot td,
table tfoot th,
.table-xpro tfoot td,
.table-metier tfoot td,
.table-journal tfoot td,
.table-releve tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background-color: #f1f5f9 !important;
    border-top: 2px solid #2563eb !important;
    border-bottom: none;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06);
    font-weight: 800 !important;
    font-size: 0.78rem !important;
    padding: 4px var(--xpro-table-cell-padding-x) !important;
    line-height: 1.25;
}

/* Conteneur Défilant avec Scrollbar Fine Métier */
.table-scroll-container,
.custom-scroll,
.table-responsive {
    position: relative;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.custom-scroll {
    max-height: calc(100vh - 165px);
}
.custom-scroll::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar { 
    width: 4px; 
    height: 4px; 
}
.custom-scroll::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track { 
    background: #f8fafc; 
}
.custom-scroll::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb { 
    background: #cbd5e1; 
    border-radius: 2px; 
}

/* ==========================================================================
   6. Contrôles Métiers (Boutons, Inputs, Badges à 28px)
   ========================================================================== */
.btn-xpro-primary, .btn-metier-primary {
    background-color: var(--xpro-violet);
    color: #ffffff !important;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.74rem;
    height: var(--xpro-control-height);
    padding: 3px 12px;
    border: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(59, 54, 219, 0.18);
    cursor: pointer;
    line-height: 1;
}
.btn-xpro-primary:hover, .btn-metier-primary:hover {
    background-color: var(--xpro-violet-hover);
    transform: translateY(-0.5px);
    box-shadow: 0 4px 6px rgba(59, 54, 219, 0.25);
}

.btn-xpro-toggle {
    background: #ffffff;
    color: var(--xpro-text-muted);
    border: 1px solid var(--xpro-border);
    font-size: 0.70rem;
    font-weight: 700;
    height: var(--xpro-control-height);
    padding: 2px 10px;
    border-radius: 4px;
    transition: 0.15s;
    display: inline-flex;
    align-items: center;
}
.btn-xpro-toggle:hover {
    background: var(--xpro-bg);
}
.btn-xpro-toggle.active {
    background: var(--xpro-violet);
    color: white;
    border-color: var(--xpro-violet);
}

.btn-export-excel {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    height: var(--xpro-control-height);
    padding: 2px 8px;
    border-radius: 4px;
    color: #107c41;
    border: 1px solid #107c41;
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    line-height: 1;
}
.btn-export-excel:hover {
    background-color: #107c41;
    color: #ffffff;
    border-color: #107c41;
    box-shadow: 0 2px 4px rgba(16, 124, 65, 0.2);
}

/* Badges Doux Denses */
.badge-soft-success { background-color: #d1fae5; color: #065f46; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.68rem; }
.badge-soft-danger { background-color: #fee2e2; color: #991b1b; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.68rem; }
.badge-soft-warning { background-color: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.68rem; }
.badge-soft-secondary { background-color: #f1f5f9; color: #475569; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.68rem; }
.badge-soft-primary { background-color: #e0e7ff; color: #4338ca; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.68rem; }
.badge-soft-info { background-color: #e0f2fe; color: #0ea5e9; padding: 2px 6px; border-radius: 4px; font-weight: 700; font-size: 0.68rem; }

.avatar-sm { 
    width: 24px; 
    height: 24px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 800; 
    font-size: 0.62rem; 
    color: white; 
}

/* Réduction des Gouttières Bootstrap Globales */
.g-3 { --bs-gutter-y: 8px; --bs-gutter-x: 8px; }
.g-2 { --bs-gutter-y: 6px; --bs-gutter-x: 6px; }
.mb-3 { margin-bottom: 8px !important; }
.mb-4 { margin-bottom: 10px !important; }
.py-3 { padding-top: 6px !important; padding-bottom: 6px !important; }
.py-4 { padding-top: 8px !important; padding-bottom: 8px !important; }

/* ==========================================================================
   7. Media Queries (Desktop Compact, Tablette, Mobile)
   ========================================================================== */

/* --- Tablette & Laptop Compact (768px - 1199.98px) --- */
@media (max-width: 1199.98px) {
    :root { 
        --sidebar-width: var(--sidebar-mini-width); 
    }
    
    .sidebar-toggle-btn { 
        display: flex; 
    }
    
    .xpro-sidebar {
        width: var(--sidebar-mini-width);
    }
    .xpro-sidebar .logo-text,
    .xpro-sidebar .sidebar-pin-btn,
    .xpro-sidebar .sidebar-footer,
    .xpro-sidebar .chevron-icon,
    .xpro-sidebar .nav-link-text {
        display: none !important;
    }
    .xpro-sidebar .sidebar-logo {
        padding: 7px 6px;
        justify-content: center;
    }
    .xpro-sidebar .nav-group-toggle { 
        padding: 5px 0; 
        justify-content: center; 
        width: calc(100% - 8px); 
        margin: 4px;
        border-left: none;
    }
    .xpro-sidebar .nav-link { 
        padding: 6px 0; 
        justify-content: center; 
        margin: 1px 4px; 
        gap: 0; 
    }

    .xpro-main { 
        margin-left: var(--sidebar-mini-width); 
    }
    
    .search-wrapper input { 
        width: 160px; 
    }
    
    .filters-bar {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* --- Mobile / Smartphone (< 768px) --- */
@media (max-width: 767.98px) {
    :root { 
        --sidebar-width: 0px; 
        --topbar-height: 40px;
        --xpro-body-padding: 4px 6px 6px 6px;
    }
    
    .sidebar-toggle-btn { 
        display: flex; 
    }
    
    .xpro-sidebar {
        width: 260px;
        transform: translateX(-100%);
        box-shadow: none;
    }
    .xpro-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0,0,0,0.2);
    }
    .xpro-sidebar.open .logo-text,
    .xpro-sidebar.open .nav-link-text {
        display: inline-block !important;
    }
    .xpro-sidebar.open .nav-group-toggle {
        justify-content: space-between;
        padding: 5px 8px 5px 10px;
        border-left: 3px solid var(--xpro-violet);
    }
    .xpro-sidebar.open .chevron-icon {
        display: inline-block !important;
    }
    .xpro-sidebar.open .nav-link {
        justify-content: flex-start;
        padding: 5px 10px 5px 16px;
        gap: 8px;
    }

    .xpro-main { 
        margin-left: 0 !important; 
    }
    
    .search-wrapper input { 
        width: 110px; 
    }
    
    .xpro-topbar { 
        padding: 0 8px; 
    }
    .xpro-subheader { 
        padding: 6px 8px; 
        flex-direction: column; 
        gap: 6px; 
        align-items: stretch; 
    }
    .filters-bar { 
        flex-wrap: wrap; 
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Colonnes secondaires masquables en mobile pour préserver la largeur */
    .col-hide-mobile {
        display: none !important;
    }
    
    /* KPIs en grille 2x2 compacte sur mobile */
    .kpi-card {
        height: 48px;
        padding: 4px 8px;
    }
    .kpi-title {
        font-size: 0.62rem;
    }
    .kpi-value {
        font-size: 0.95rem;
    }
    .kpi-chart {
        display: none;
    }
}
