/* ============================================================
   GESTOQ — Professional UI
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --primary-light:  #eff6ff;
    --success:        #059669;
    --warning:        #d97706;
    --danger:         #dc2626;
    --info:           #0891b2;

    --sidebar-bg:     #0f172a;
    --sidebar-item:   rgba(255,255,255,.06);
    --sidebar-hover:  rgba(255,255,255,.10);
    --sidebar-active: rgba(37,99,235,.25);
    --sidebar-text:   #94a3b8;
    --sidebar-bright: #e2e8f0;
    --sidebar-head:   #475569;
    --sidebar-width:  248px;

    --topnav-h:       60px;
    --body-bg:        #f1f5f9;
    --surface:        #ffffff;
    --border:         #e2e8f0;
    --muted:          #64748b;
    --text:           #1e293b;

    --radius-sm:      6px;
    --radius:         10px;
    --radius-lg:      14px;
    --shadow-xs:      0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:      0 1px 6px rgba(0,0,0,.08);
    --shadow:         0 4px 16px rgba(0,0,0,.10);
    --shadow-md:      0 8px 30px rgba(0,0,0,.12);
    --transition:     .18s ease;
}

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

body {
    background: var(--body-bg);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
#layoutSidenav {
    display: flex;
    margin-top: var(--topnav-h); /* push below fixed topnav */
    min-height: calc(100vh - var(--topnav-h));
}
.sb-nav-fixed #layoutSidenav #layoutSidenav_nav {
    width: var(--sidebar-width);
    min-height: calc(100vh - var(--topnav-h));
    z-index: 1038;
    position: fixed;
    top: var(--topnav-h);
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition);
    flex-shrink: 0;
}
.sb-nav-fixed #layoutSidenav #layoutSidenav_content {
    padding-left: var(--sidebar-width);
    width: 100%;
    min-height: calc(100vh - var(--topnav-h));
    display: flex;
    flex-direction: column;
    transition: padding-left var(--transition);
}

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.sb-topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    z-index: 1040;
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    padding: 0 1.25rem;
}
/* Override navbar-dark text colors on white topnav */
.sb-topnav .navbar-brand,
.sb-topnav .nav-link,
.sb-topnav .btn-link { color: var(--text) !important; }
.sb-topnav .nav-link:hover { color: var(--primary) !important; background: none; }
.sb-topnav .btn-link { font-size: 1.2rem; padding: .35rem .5rem; border-radius: var(--radius-sm); }
.sb-topnav .btn-link:hover { background: var(--primary-light); color: var(--primary) !important; }
.sb-topnav .navbar-brand {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -.5px;
    color: var(--primary) !important;
    padding: 0;
}
.sb-topnav .navbar-brand span { color: var(--text); }

/* User avatar */
.avatar-sm {
    width: 34px; height: 34px;
    font-size: .75rem; font-weight: 700;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    flex-shrink: 0;
}

/* User menu */
.user-menu-btn {
    padding: .3rem .6rem;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.user-menu-btn:hover { background: var(--primary-light) !important; }
.dropdown-menu .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.dropdown-menu .dropdown-item { border-radius: var(--radius-sm); margin: 1px .3rem; padding: .45rem .75rem; font-size: .875rem; }

/* Notification bell */
.notif-bell-btn {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--muted);
    transition: all var(--transition);
    cursor: pointer;
}
.notif-bell-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.notif-bell-btn .badge {
    position: absolute;
    top: -3px; right: -3px;
    font-size: .6rem;
    padding: 2px 5px;
    border-radius: 20px;
    background: var(--danger);
    color: #fff;
    border: 2px solid var(--surface);
    font-weight: 700;
}

/* Notification dropdown */
.notif-dropdown {
    width: 380px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.notif-dropdown .dropdown-header {
    background: var(--surface);
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: .875rem;
    color: var(--text);
}
.notif-body {
    max-height: 420px;
    overflow-y: auto;
}
.notif-item {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
    display: flex; gap: .75rem; align-items: flex-start;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--primary-light); }
.notif-item.unread { background: #f0f7ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-item-icon {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: .9rem;
}
.notif-item-text .notif-title { font-weight: 600; font-size: .8rem; color: var(--text); margin: 0 0 2px; }
.notif-item-text .notif-msg  { font-size: .78rem; color: var(--muted); margin: 0; line-height: 1.4; }
.notif-item-text .notif-time { font-size: .72rem; color: var(--muted); opacity: .75; }
.notif-footer {
    padding: .65rem 1rem;
    border-top: 1px solid var(--border);
    background: #fafafa;
    text-align: center;
    font-size: .8rem;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--sidebar-bg);
}

/* ── Brand / Logo ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.sidebar-brand-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.sidebar-brand-name {
    display: block;
    font-size: .95rem;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: -.3px;
    line-height: 1.2;
}
.sidebar-brand-sub {
    display: block;
    font-size: .68rem;
    color: var(--sidebar-text);
    font-weight: 400;
    letter-spacing: .02em;
}

/* ── Navigation ── */
.sidebar-nav {
    flex: 1;
    padding: .75rem 0 .5rem;
    display: flex;
    flex-direction: column;
}

/* Section headings */
.side-heading {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .9rem 1.25rem .3rem;
    margin-top: .25rem;
}
.side-heading span {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--sidebar-head);
    white-space: nowrap;
    flex-shrink: 0;
}
.side-heading-line {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.06);
    border-radius: 1px;
}

/* Nav links */
.side-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .875rem;
    margin: 1px .625rem;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: .845rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    border: none;
    background: transparent;
    width: calc(100% - 1.25rem);
    cursor: pointer;
    text-align: left;
    position: relative;
    border-left: 2px solid transparent;
}
.side-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-bright);
    border-left-color: rgba(255,255,255,.2);
}
.side-link.active {
    background: rgba(37,99,235,.18);
    color: #93c5fd;
    font-weight: 600;
    border-left-color: var(--primary);
}

/* Colored icon badge */
.side-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
    transition: transform var(--transition);
}
.side-link:hover .side-icon { transform: scale(1.08); }

/* Collapse arrow */
.side-arrow {
    font-size: .65rem;
    transition: transform var(--transition);
    opacity: .45;
    flex-shrink: 0;
}
.side-link[aria-expanded="true"] .side-arrow {
    transform: rotate(90deg);
    opacity: .8;
}

/* Notification badge */
.side-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Submenu */
.side-sub {
    padding: .2rem .625rem .4rem 1.625rem;
}
.side-sub-link {
    display: flex;
    align-items: center;
    padding: .38rem .75rem;
    margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: .82rem;
    font-weight: 400;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    border-left: 2px solid transparent;
}
.side-sub-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-bright);
}
.side-sub-link.active {
    background: rgba(37,99,235,.15);
    color: #93c5fd;
    font-weight: 600;
    border-left-color: var(--primary);
}

/* ── Mini-stats widget ── */
.side-stats-widget {
    display: flex;
    align-items: stretch;
    margin: .3rem .625rem .5rem;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--radius);
    overflow: hidden;
}
.side-stat-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .55rem .4rem;
    text-decoration: none;
    transition: background var(--transition);
    min-width: 0;
    cursor: pointer;
}
.side-stat-cell:hover {
    background: rgba(255,255,255,.07);
}
.side-stat-sep {
    width: 1px;
    background: rgba(255,255,255,.07);
    flex-shrink: 0;
}
.side-stat-num {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--sidebar-bright);
    letter-spacing: -.5px;
}
.side-stat-lbl {
    display: block;
    font-size: .6rem;
    font-weight: 500;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: .04em;
    text-align: center;
    margin-top: 2px;
    line-height: 1.3;
}
/* Colour states */
.side-stat-warn  .side-stat-num { color: #fbbf24; }
.side-stat-warn:hover            { background: rgba(251,191,36,.08) !important; }
.side-stat-alert .side-stat-num { color: #f59e0b; }
.side-stat-alert:hover           { background: rgba(245,158,11,.08) !important; }
.side-stat-danger .side-stat-num { color: #f87171; }
.side-stat-danger:hover           { background: rgba(248,113,113,.08) !important; }

/* ── User footer ── */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .875rem 1rem .875rem 1.125rem;
    border-top: 1px solid rgba(255,255,255,.06);
    background: rgba(0,0,0,.2);
    flex-shrink: 0;
    margin-top: auto;
}
.sidebar-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: var(--sidebar-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.sidebar-user-role {
    font-size: .7rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-logout {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--sidebar-text);
    font-size: .95rem;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
    text-decoration: none;
}
.sidebar-logout:hover {
    background: rgba(220,38,38,.2);
    color: #f87171;
}

/* Scrollbar visible sur le conteneur de la sidebar */
.sb-nav-fixed #layoutSidenav #layoutSidenav_nav::-webkit-scrollbar {
    width: 5px;
}
.sb-nav-fixed #layoutSidenav #layoutSidenav_nav::-webkit-scrollbar-track {
    background: rgba(255,255,255,.04);
}
.sb-nav-fixed #layoutSidenav #layoutSidenav_nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.18);
    border-radius: 3px;
}
.sb-nav-fixed #layoutSidenav #layoutSidenav_nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.32);
}

/* ── Sidebar close button (mobile only) ── */
.sidebar-close-btn {
    display: none;
    width: 28px; height: 28px;
    align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: var(--sidebar-text);
    border: none;
    cursor: pointer;
    font-size: .9rem;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: auto;
}
.sidebar-close-btn:hover { background: rgba(220,38,38,.22); color: #f87171; }

/* ── Backdrop (mobile) ── */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.52);
    z-index: 1037;
    cursor: pointer;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* ── Desktop : mode icône-seulement ── */
@media (min-width: 993px) {
    body.sidebar-collapsed #layoutSidenav_nav { width: 68px !important; }
    body.sidebar-collapsed #layoutSidenav_content { padding-left: 68px !important; }

    body.sidebar-collapsed .sidebar-brand-text,
    body.sidebar-collapsed .side-heading,
    body.sidebar-collapsed .side-stats-widget,
    body.sidebar-collapsed .side-badge,
    body.sidebar-collapsed .side-arrow,
    body.sidebar-collapsed .side-sub,
    body.sidebar-collapsed .sidebar-user-info,
    body.sidebar-collapsed .sidebar-close-btn { display: none !important; }

    body.sidebar-collapsed .side-link > span:not(.side-icon) { display: none !important; }
    body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 1rem .625rem; }
    body.sidebar-collapsed .side-link {
        justify-content: center;
        padding: .55rem 0;
        margin: 2px .5rem;
        width: calc(100% - 1rem);
    }
    body.sidebar-collapsed .sidebar-user { justify-content: center; padding: .875rem .625rem; gap: 0; }
    body.sidebar-collapsed .sidebar-logout { display: flex !important; }

    /* Tooltips en mode icône */
    body.sidebar-collapsed .side-link { position: relative; }
    body.sidebar-collapsed .side-link[data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 14px);
        top: 50%; transform: translateY(-50%);
        background: #1e293b;
        color: #f1f5f9;
        font-size: .78rem; font-weight: 600;
        padding: .35rem .85rem;
        border-radius: 6px;
        white-space: nowrap;
        z-index: 9999;
        pointer-events: none;
        box-shadow: 0 4px 16px rgba(0,0,0,.3);
        border: 1px solid rgba(255,255,255,.08);
    }
    body.sidebar-collapsed .side-link[data-tooltip]:hover::before {
        content: '';
        position: absolute;
        left: calc(100% + 7px);
        top: 50%; transform: translateY(-50%);
        border: 6px solid transparent;
        border-right-color: #1e293b;
        z-index: 9999;
        pointer-events: none;
    }
}

/* ── Mobile sidebar ── */
@media (max-width: 992px) {
    .sb-nav-fixed #layoutSidenav #layoutSidenav_nav {
        width: 0;
        overflow: hidden;
        transition: width .28s cubic-bezier(.4,0,.2,1);
        box-shadow: none;
    }
    .sb-nav-fixed #layoutSidenav #layoutSidenav_content { padding-left: 0 !important; }

    body.sidebar-open #layoutSidenav_nav {
        width: var(--sidebar-width) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        box-shadow: 6px 0 28px rgba(0,0,0,.38);
    }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .sidebar-close-btn { display: flex !important; }
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
main.container-fluid {
    padding: 1.5rem 1.75rem;
    flex: 1;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.page-header h4 {
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0 0 .15rem;
    color: var(--text);
}
.page-header .breadcrumb {
    font-size: .8rem;
    margin: 0;
    padding: 0;
    background: none;
}
.breadcrumb-item + .breadcrumb-item::before { color: var(--muted); }
.breadcrumb-item a { color: var(--primary); }
.breadcrumb-item.active { color: var(--muted); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: .875rem 1.25rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}
.card-body { padding: 1.25rem; }
.card-footer {
    background: #fafafa;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
    padding: .75rem 1.25rem;
}

/* ============================================================
   KPI / STAT CARDS
   ============================================================ */
.stat-card {
    border: none !important;
    border-radius: var(--radius-lg) !important;
    padding: 1.375rem 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow) !important;
    text-decoration: none !important;
    display: block;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md) !important;
    color: #fff;
}
.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.12) 0%, transparent 70%);
    pointer-events: none;
}
.stat-card .stat-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3.5rem;
    opacity: .18;
    line-height: 1;
}
.stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: .35rem;
    letter-spacing: -1px;
}
.stat-card .stat-label {
    font-size: .8rem;
    font-weight: 500;
    opacity: .88;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.stat-card .stat-sub {
    font-size: .78rem;
    opacity: .75;
    margin-top: .35rem;
}

/* Gradient presets */
.bg-grad-blue    { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }
.bg-grad-green   { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.bg-grad-orange  { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }
.bg-grad-red     { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }
.bg-grad-violet  { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }
.bg-grad-cyan    { background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%); }
.bg-grad-teal    { background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%); }
.bg-grad-rose    { background: linear-gradient(135deg, #e11d48 0%, #be123c 100%); }
.bg-grad-slate   { background: linear-gradient(135deg, #475569 0%, #334155 100%); }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    font-size: .875rem;
    color: var(--text);
    margin: 0;
}
.table thead th {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    padding: .75rem 1rem;
    background: #fafafa;
    white-space: nowrap;
}
.table tbody td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: #f8faff; }
.table tbody tr.table-warning { background: #fffbeb !important; }
.table tbody tr.table-warning:hover { background: #fef3c7 !important; }
.table tbody tr.table-danger { background: #fff5f5 !important; }

/* DataTables wrapper */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .35rem .75rem;
    font-size: .85rem;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    outline: none;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .3rem .5rem;
    font-size: .85rem;
    color: var(--text);
}
.dataTables_wrapper .dataTables_info { font-size: .8rem; color: var(--muted); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--radius-sm) !important;
    padding: .25rem .6rem !important;
    font-size: .8rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current) {
    background: var(--primary-light) !important;
    border-color: var(--border) !important;
    color: var(--primary) !important;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-size: .72rem;
    font-weight: 600;
    padding: .28em .65em;
    border-radius: 20px;
    letter-spacing: .02em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    padding: .45rem 1rem;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.btn-sm {
    border-radius: var(--radius-sm);
    font-size: .8rem;
    padding: .3rem .65rem;
}
.btn-lg {
    border-radius: var(--radius-lg);
    font-size: .95rem;
    padding: .6rem 1.4rem;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(5,150,105,.3); }
.btn-danger:hover  { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(220,38,38,.3); }
.btn-outline-primary:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) !important; box-shadow: none !important; }

/* Icon-only buttons */
.btn-icon {
    width: 34px; height: 34px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center; justify-content: center;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    color: var(--text);
    padding: .475rem .875rem;
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    background: var(--surface);
}
.form-control::placeholder { color: #94a3b8; }
.form-label {
    font-weight: 600;
    font-size: .8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .35rem;
}
.required-field::after { content: ' *'; color: var(--danger); }
.form-text { font-size: .78rem; color: var(--muted); }

/* Input group */
.input-group .form-control { border-radius: var(--radius); }
.input-group-text {
    border-color: var(--border);
    background: #f8fafc;
    color: var(--muted);
    font-size: .85rem;
}

/* Select2 override */
.select2-container--bootstrap-5 .select2-selection {
    border-color: var(--border) !important;
    border-radius: var(--radius) !important;
    font-size: .875rem !important;
    min-height: 38px !important;
    padding: .375rem .75rem !important;
}
.select2-container--bootstrap-5 .select2-selection:focus,
.select2-container--bootstrap-5.select2-container--focus .select2-selection {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12) !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-md) !important;
    font-size: .875rem !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
    background: var(--primary) !important;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--radius);
    border: none;
    font-size: .875rem;
    padding: .875rem 1.125rem;
}
.alert-info    { background: #eff6ff; color: #1d4ed8; border-left: 4px solid #2563eb; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid #059669; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #d97706; }
.alert-danger  { background: #fff5f5; color: #991b1b; border-left: 4px solid #dc2626; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header .modal-title { font-weight: 700; font-size: 1rem; }
.modal-body { padding: 1.5rem; }
.modal-footer {
    border-top: 1px solid var(--border);
    padding: .875rem 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   TIMELINE (audit trail)
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: .625rem;
    top: .5rem;
    bottom: .5rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--border));
    border-radius: 1px;
}
.timeline-item {
    position: relative;
    padding-bottom: 1.1rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.45rem;
    top: .3rem;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item .timeline-body {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .65rem .875rem;
    font-size: .83rem;
}

/* ============================================================
   STOCK INDICATORS
   ============================================================ */
.stock-low  { color: var(--danger);  font-weight: 700; }
.stock-ok   { color: var(--success); font-weight: 600; }
.stock-warn { color: var(--warning); font-weight: 600; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted { color: var(--muted) !important; }
.fw-semibold { font-weight: 600; }
.fw-bold { font-weight: 700; }

/* Section divider */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
}
.empty-state i { font-size: 3rem; opacity: .25; display: block; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; margin: 0; }

/* Code inline */
code {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 4px;
    padding: .1em .45em;
    font-size: .85em;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* QR wrapper */
.qr-wrapper {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: inline-block;
    box-shadow: var(--shadow-sm);
}

/* Multi-step forms */
.form-steps .step { display: none; }
.form-steps .step.active { display: block; }

/* Step indicator */
.step-indicator {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.step-indicator .step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.step-indicator .step-dot.active { background: var(--primary); color: #fff; }
.step-indicator .step-dot.done  { background: var(--success); color: #fff; }
.step-indicator .step-line { flex: 1; height: 2px; background: var(--border); border-radius: 1px; }

/* ============================================================
   NOTIFICATIONS PAGE
   ============================================================ */
.notif-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.nfb-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .85rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.nfb-btn:hover { border-color: var(--primary); color: var(--primary); }
.nfb-btn.active { background: var(--fc, var(--primary)); border-color: var(--fc, var(--primary)); color: #fff; }
.nfb-count {
    background: rgba(0,0,0,.12);
    border-radius: 10px;
    font-size: .7rem;
    padding: 1px 6px;
    font-weight: 700;
    line-height: 1.4;
}
.nfb-btn.active .nfb-count { background: rgba(255,255,255,.25); }

.notif-group-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem 1.25rem;
    background: #fafafa;
    border-bottom: 1px solid var(--border);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
}
.notif-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.notif-row {
    display: flex;
    align-items: flex-start;
    gap: .875rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background var(--transition);
    color: var(--text);
}
.notif-row:last-child   { border-bottom: none; }
.notif-row:hover        { background: var(--primary-light); }
.notif-row.notif-unread { background: #f0f7ff; }
.notif-row.notif-unread:hover { background: #dbeafe; }

.notif-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title   { font-weight: 600; font-size: .875rem; color: var(--text); margin-bottom: 2px; }
.notif-msg     { font-size: .8rem; color: var(--muted); line-height: 1.45; }
.notif-meta    { flex-shrink: 0; text-align: right; }
.notif-time    { font-size: .72rem; color: var(--muted); white-space: nowrap; }

/* ============================================================
   DASHBOARD
   ============================================================ */

/* Welcome banner */
.dash-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.5rem;
    box-shadow: var(--shadow-xs);
    flex-wrap: wrap;
}
.dash-welcome-left  { display: flex; align-items: center; gap: .875rem; }
.dash-welcome-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.dash-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.dash-greeting    { font-size: 1rem; font-weight: 600; color: var(--text); }
.dash-role-line   { display: flex; align-items: center; gap: .4rem; margin-top: .2rem; flex-wrap: wrap; }
.dash-date        { font-size: .8rem; color: var(--muted); }
.dash-quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Alerte retard (strip) */
.dash-alert-strip {
    display: flex;
    align-items: center;
    gap: .875rem;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    flex-wrap: wrap;
}
.dash-alert-strip .das-icon {
    width: 34px; height: 34px; border-radius: 50%;
    background: #fee2e2; color: var(--danger);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.dash-alert-strip .das-body   { flex: 1; min-width: 0; }
.dash-alert-strip .das-subs   { display: block; font-size: .78rem; color: var(--muted); margin-top: 1px; }

/* Action queue */
.dash-action-section { border-bottom: 1px solid var(--border); }
.dash-action-section:last-child { border-bottom: none; }
.das-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.1rem;
    background: #fafafa;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.das-row {
    display: flex;
    align-items: center;
    padding: .6rem 1.1rem;
    border-bottom: 1px solid var(--border);
    gap: .5rem;
    transition: background var(--transition);
}
.das-row:last-child  { border-bottom: none; }
.das-row:hover       { background: #f8faff; }
.das-row-late        { background: #fff5f5 !important; }
.das-row-late:hover  { background: #fee2e2 !important; }
.das-row-main        { flex: 1; min-width: 0; font-size: .875rem; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.das-row-right       { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }

/* Mouvements récents */
.dash-mov-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.1rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.dash-mov-row:last-child { border-bottom: none; }
.dash-mov-row:hover      { background: #f8faff; }
.dash-mov-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem; flex-shrink: 0;
}
.dash-mov-body    { flex: 1; min-width: 0; }
.dash-mov-title   { font-size: .84rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-mov-meta    { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.dash-mov-qty     { font-size: .85rem; font-weight: 700; flex-shrink: 0; min-width: 50px; text-align: right; }
.qty-pos          { color: var(--success); }
.qty-neg          { color: var(--danger); }

/* Stock alerts (right column) */
.dash-stock-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.dash-stock-row:last-child { border-bottom: none; }
.dash-stock-info {
    min-width: 80px; max-width: 110px;
    display: flex; flex-direction: column; flex-shrink: 0;
}
.dash-stock-info .fw-semibold { font-size: .82rem; }
.dash-stock-info .small       { font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-stock-bar-wrap { flex: 1; min-width: 0; }

/* Quick access grid */
.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}
.dqg-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .75rem .4rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 500;
    gap: .35rem;
    transition: all var(--transition);
    text-align: center;
}
.dqg-item i      { font-size: 1.25rem; }
.dqg-item:hover  { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ============================================================
   PRINT
   ============================================================ */
.print-header { display: none; }

@media print {
    .sb-topnav, #layoutSidenav_nav, .no-print, footer { display: none !important; }
    #layoutSidenav_content { padding: 0 !important; }
    body { background: #fff !important; font-size: 12px; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
    .print-header { display: block !important; }
    .table th, .table td { padding: .4rem .6rem !important; }
    a { color: inherit !important; text-decoration: none !important; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    main.container-fluid { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start !important; gap: .75rem; }
    .stat-card .stat-value { font-size: 1.75rem; }
    .notif-dropdown { width: 100vw; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}

/* ============================================================
   FOCUS VISIBLE (accessibility)
   ============================================================ */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.btn:focus-visible { box-shadow: 0 0 0 3px rgba(37,99,235,.3); outline: none; }
