/* ═══════════════════════════════════════════════════════════════════════
   BMDSpoke — Design System (fidèle à MonEcole base.html)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: linear-gradient(135deg, #0f172a, #1e293b);
    --border-light: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent-indigo: #6366f1;
    --accent-blue: #2563eb;
    --accent-teal: #0d9488;
    --accent-emerald: #059669;
    --accent-amber: #f59e0b;
    --accent-rose: #e11d48;
    --topbar-height: 50px;
    --subbar-height: 44px;
    --logo-corner-height: calc(var(--topbar-height) + var(--subbar-height));
    --sidebar-width: 250px;
}

* { -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    height: 100vh; height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #f1f5f9;
}

/* ================= LAYOUT PRINCIPAL APPLICATION ================= */
.bmd-app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background: #f1f5f9;
}

/* ================= HEADER : COIN LOGO + PILE DES 2 BARRES ================= */
.bmd-header-container {
    display: flex;
    flex-direction: row;
    height: calc(var(--topbar-height) + var(--subbar-height));
    width: 100%;
    flex-shrink: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Coin Logo couvrant la hauteur des deux barres (même background que barre 1) */
.bmd-logo-corner {
    width: 104px;
    height: 100%;
    background: var(--bg-header);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 8px;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid #e2e8f0;
    box-sizing: border-box;
}
.bmd-logo-corner-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}
/* Boîte blanche arrondie pour faire ressortir le logo PNG transparent sans l'assombrir */
.bmd-logo-box {
    background: #ffffff;
    border-radius: 10px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.bmd-logo-box:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.bmd-logo-corner-img {
    max-height: 68px;
    max-width: 74px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* Pile des 2 barres horizontales à droite du logo */
.bmd-bars-stack {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    height: 100%;
}

/* ================= 1. PREMIÈRE BARRE HORIZONTALE (Top bar) ================= */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-header);
    color: #f8fafc;
    display: flex;
    align-items: center;
    padding: 0 1.25rem 0 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 1001;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
    box-sizing: border-box;
    gap: 12px;
}

/* Module à droite du logo */
.topbar-identity {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.topbar-module-name {
    font-size: 1.02rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

/* Sidebar Toggle Button (visible dans context bar) */
.sidebar-toggle-btn {
    background: none;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #94a3b8;
}

.top-bar .search-bar { flex: 0 1 360px; position: relative; margin-left: auto; margin-right: 12px; }
.top-bar .search-bar input {
    width: 100%; padding: 0.4rem 1rem 0.4rem 2.4rem;
    border: 1px solid #475569; border-radius: 10px;
    background: rgba(255,255,255,0.08); font-size: 0.8rem; color: #f1f5f9;
    transition: all 0.2s; outline: none;
}
.top-bar .search-bar input:focus {
    border-color: #60a5fa; background: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 3px rgba(96,165,250,0.2);
}
.top-bar .search-bar input::placeholder { color: #94a3b8; }
.top-bar .search-bar i {
    position: absolute; left: 0.85rem; top: 50%;
    transform: translateY(-50%); color: #94a3b8; font-size: 0.78rem;
}

/* Topbar Année Widget */
.topbar-annee-widget {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(129, 140, 248, 0.35);
    border-radius: 9px;
    padding: 3px 8px 3px 10px;
    position: relative;
    height: 34px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.topbar-annee-widget:hover {
    background: rgba(99, 102, 241, 0.28);
    border-color: #818cf8;
}
.topbar-annee-widget .annee-icon {
    font-size: 0.8rem;
    color: #a5b4fc;
}
.topbar-annee-widget .topbar-annee-select {
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    padding-right: 18px;
    -webkit-appearance: none;
    appearance: none;
}
.topbar-annee-widget .topbar-annee-select option {
    background: #1e293b;
    color: #ffffff;
    font-weight: 600;
    padding: 6px;
}
.topbar-annee-widget .annee-chevron {
    position: absolute;
    right: 8px;
    pointer-events: none;
    font-size: 0.55rem;
    color: #a5b4fc;
}

/* ================= MAIN CONTAINER ================= */
.me-main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 6px 12px 6px 0;
    background: #f1f5f9;
    min-height: 0;
    height: calc(100vh - var(--topbar-height));
}

/* ================= BARRE 2 : TOP CONTEXT & STATS BAR ================= */
.me-top-context-bar {
    height: var(--subbar-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 1.25rem 0 0.85rem;
    box-sizing: border-box;
    z-index: 1000;
    flex-shrink: 0;
    margin-bottom: 0 !important;
}

.me-context-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    min-width: 0;
}

.etab-context-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 450px;
}
    max-width: 450px;
}

.me-context-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin-left: auto !important;
    flex-shrink: 0;
}

/* ================= COMPACT HERO STAT CARDS ================= */
.me-hero-stats-row,
.stats-hero-compact {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
}
.hero-card-compact {
    background: #ffffff;
    border-radius: 6px;
    padding: 2px 8px;
    min-width: 85px;
    height: 30px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.hero-card-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}
.hero-card-compact .hc-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    color: #fff;
    flex-shrink: 0;
}
.hero-card-compact .hc-info {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}
.hero-card-compact .hc-value {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.3px;
}
.hero-card-compact .hc-label {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #64748b;
}

/* Hero Compact Gradients */
.hc-blue { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.hc-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.hc-emerald { background: linear-gradient(135deg, #059669, #34d399); }
.hc-teal { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.hc-rose { background: linear-gradient(135deg, #e11d48, #fb7185); }
.hc-amber { background: linear-gradient(135deg, #d97706, #fbbf24); }
.hc-indigo { background: linear-gradient(135deg, #4338ca, #6366f1); }
.hc-orange { background: linear-gradient(135deg, #ea580c, #fb923c); }

/* ================= LAYOUT : SIDEBAR + WORKSPACE ================= */
.me-layout {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* ================= ZONE CORPS (SIDEBAR + WORKSPACE) ================= */
.bmd-main-area {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.me-sidebar-col {
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 0 6px 6px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    z-index: 100;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, padding 0.25s ease;
}

/* ================= SIDEBAR MINI / REPLIÉE (ICÔNES SEULES — COMME IMAGE 2) ================= */
.bmd-main-area.sidebar-collapsed .me-sidebar-col,
.me-sidebar-col.collapsed {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    padding: 6px 0 6px 6px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.bmd-main-area.sidebar-collapsed .me-sidebar,
.me-sidebar-col.collapsed .me-sidebar {
    width: 100% !important;
    padding: 8px 4px !important;
    align-items: center;
    border-radius: 10px;
}

.bmd-main-area.sidebar-collapsed .me-accordion-list,
.me-sidebar-col.collapsed .me-accordion-list {
    width: 100%;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.bmd-main-area.sidebar-collapsed .me-accordion-group,
.me-sidebar-col.collapsed .me-accordion-group {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.15s ease;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}
.bmd-main-area.sidebar-collapsed .me-accordion-group:hover,
.me-sidebar-col.collapsed .me-accordion-group:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.bmd-main-area.sidebar-collapsed .me-accordion-group.open,
.me-sidebar-col.collapsed .me-accordion-group.open {
    border: 1.5px solid #6366f1;
    box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

.bmd-main-area.sidebar-collapsed .me-accordion-header,
.me-sidebar-col.collapsed .me-accordion-header {
    width: 100%;
    height: 100%;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.bmd-main-area.sidebar-collapsed .me-acc-left,
.me-sidebar-col.collapsed .me-acc-left {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.bmd-main-area.sidebar-collapsed .me-mod-icon-badge,
.me-sidebar-col.collapsed .me-mod-icon-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Cacher texte, flèches et corps de l'accordéon en mode replié */
.bmd-main-area.sidebar-collapsed .me-mod-title,
.bmd-main-area.sidebar-collapsed .me-acc-right,
.bmd-main-area.sidebar-collapsed .me-chevron,
.bmd-main-area.sidebar-collapsed .me-accordion-body,
.me-sidebar-col.collapsed .me-mod-title,
.me-sidebar-col.collapsed .me-acc-right,
.me-sidebar-col.collapsed .me-chevron,
.me-sidebar-col.collapsed .me-accordion-body {
    display: none !important;
}

/* Footer déconnexion en mode replié : icône centrée */
.bmd-main-area.sidebar-collapsed .me-sb-footer,
.me-sidebar-col.collapsed .me-sb-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 6px 0 0;
}
.bmd-main-area.sidebar-collapsed .me-logout-btn,
.me-sidebar-col.collapsed .me-logout-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}
.bmd-main-area.sidebar-collapsed .me-logout-btn span,
.me-sidebar-col.collapsed .me-logout-btn span {
    display: none !important;
}
.bmd-main-area.sidebar-collapsed .me-logout-btn i,
.me-sidebar-col.collapsed .me-logout-btn i {
    font-size: 1.1rem;
    margin: 0;
}

.me-sidebar {
    width: 100%;
    margin: 0;
    flex: 1;
    min-height: 0;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 6px;
    box-sizing: border-box;
}
.me-sidebar::-webkit-scrollbar { width: 3px; }
.me-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.me-workspace {
    flex: 1;
    min-width: 0;
    background: #f1f5f9;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 6px 12px 6px 8px;
    box-sizing: border-box;
    overflow: hidden;
}

/* ================= ACCORDION SIDEBAR STYLES (CENTRÉ VERTICALEMENT) ================= */
.me-sidebar-inner {
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centré au milieu verticalement */
    height: 100%;
    min-height: 0;
    position: relative;
}
.me-accordion-list {
    margin-top: auto;
    margin-bottom: auto;
    max-height: calc(100% - 50px);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 2px;
}

/* ── COLLAPSED MODULE GROUP ── */
.me-accordion-group.collapsed {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.me-accordion-group.collapsed:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transform: translateY(-1px);
}
.me-accordion-group.collapsed .me-accordion-header {
    background: #ffffff;
    padding: 5px 8px;
    border-radius: 8px;
}
.me-accordion-group.collapsed .me-mod-title {
    color: #1e293b;
    font-weight: 600;
    font-size: 0.76rem;
}
.me-accordion-group.collapsed .me-chevron {
    color: #94a3b8;
    font-size: 0.55rem;
    transform: rotate(-90deg) !important;
}

/* ── OPEN / ACTIVE MODULE GROUP ── */
.me-accordion-group.open {
    background: #ffffff;
    border: 1.5px solid #6366f1;
    border-radius: 9px;
    box-shadow: 0 3px 12px rgba(99, 102, 241, 0.12);
    margin-bottom: 3px;
    overflow: hidden;
}
.me-accordion-group.open > .me-accordion-header {
    background: linear-gradient(135deg, #4338ca 0%, #6366f1 100%) !important;
    padding: 6px 9px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 2px 6px rgba(67, 56, 202, 0.2);
}
.me-accordion-group.open > .me-accordion-header .me-mod-title {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: -0.2px;
}
.me-accordion-group.open > .me-accordion-header .me-chevron {
    color: #ffffff !important;
    font-weight: 800;
    font-size: 0.55rem;
    transform: rotate(0deg) !important;
}
.me-accordion-group.open > .me-accordion-header .me-mod-icon-badge {
    background: rgba(255, 255, 255, 0.25) !important;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.me-accordion-group.open > .me-accordion-header .me-mod-icon-badge i {
    color: #ffffff !important;
}

/* ── ACCORDION HEADER (BASE) ── */
.me-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    transition: all 0.15s ease;
}
.me-acc-left {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.me-mod-icon-badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.65rem;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.me-mod-icon-badge.mod-rh { background: linear-gradient(135deg, #4338ca, #6366f1); }
.me-mod-icon-badge.mod-scolarite { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.me-mod-icon-badge.mod-offreformation { background: linear-gradient(135deg, #ea580c, #fb923c); }
.me-mod-icon-badge.mod-enseignements { background: linear-gradient(135deg, #f97316, #fb923c); }
.me-mod-icon-badge.mod-evaluations { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.me-mod-icon-badge.mod-notes { background: linear-gradient(135deg, #8b5cf6, #c084fc); }
.me-mod-icon-badge.mod-evaluations-notes { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.me-mod-icon-badge.mod-comptabilite,
.me-mod-icon-badge.mod-recouvrement { background: linear-gradient(135deg, #059669, #34d399); }
.me-mod-icon-badge.mod-administration { background: linear-gradient(135deg, #3b82f6, #60a5fa); }

.me-mod-title {
    font-size: 0.76rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.me-acc-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.me-chevron {
    font-size: 0.55rem;
    color: #94a3b8;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── ACCORDION BODY & NESTED ITEMS ── */
.me-accordion-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
}
.me-accordion-group.open > .me-accordion-body {
    max-height: 1200px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    display: block !important;
    background: #f8fafc;
    padding: 4px 6px 5px 2px;
    border-top: 1px solid rgba(99, 102, 241, 0.12);
}
.me-accordion-group.collapsed > .me-accordion-body {
    max-height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.me-sub-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 14px;
    padding-left: 8px;
    border-left: 2px solid #cbd5e1;
}
.me-sub-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 7px;
    font-size: 0.70rem;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: all 0.15s ease;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    margin: 1px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    position: relative;
}
.me-sub-item:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.08);
}
.me-sub-item.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
    transform: translateX(2px);
}
.me-sub-item.active .cs-icon,
.me-sub-item.active .cs-label,
.me-sub-item.active .cs-arrow {
    color: #ffffff !important;
}
.me-sub-item .cs-icon {
    font-size: 0.68rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.me-sub-item .cs-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.me-sub-item .cs-arrow {
    font-size: 0.55rem;
    font-weight: 700;
    color: #94a3b8;
    margin-left: auto;
    opacity: 0.7;
    transition: transform 0.15s ease;
}
.me-sub-item:hover .cs-arrow {
    transform: translateX(2px);
    color: #4f46e5;
    opacity: 1;
}
.me-sub-item.active .cs-arrow {
    transform: translateX(2px);
    color: #ffffff;
    opacity: 1;
}

/* Sidebar Footer */
.me-sb-footer {
    padding-top: 8px;
    margin-top: auto;
    border-top: 1px solid #e2e8f0;
}
.me-logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.12);
    transition: all 0.2s ease;
}
.me-logout-btn:hover {
    background: rgba(239,68,68,0.12);
    color: #dc2626;
}

/* ================= RESPONSIVE ================= */
.sidebar-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1049; opacity: 0; transition: opacity 0.3s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ================= SIDEBAR MODULES TOGGLE (desktop: cache/montre uniquement les modules) ================= */
.me-sidebar.modules-hidden .me-accordion-list {
    display: none;
}
.me-sidebar.modules-hidden {
    justify-content: center;
    background: #f1f5f9;
}

@media (max-width: 992px) {
    .bmd-app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: var(--topbar-height) auto minmax(0, 1fr);
    }
    .top-bar { grid-column: 1 / -1; grid-row: 1 / 2; }
    .me-top-context-bar { grid-column: 1 / 2; grid-row: 2 / 3; }
    .me-workspace { grid-column: 1 / 2; grid-row: 3 / 4; }
    .me-sidebar-col {
        position: fixed; top: 0; left: 0; height: 100vh;
        transform: translateX(-100%); padding: 0.75rem 0.5rem;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3); z-index: 1050;
        background: #f1f5f9; max-height: 100vh;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .me-sidebar-col.open { transform: translateX(0); }
    .me-sidebar { max-height: calc(100vh - 2rem); }
    .top-bar .search-bar { display: none; }
    .me-top-context-bar { flex-direction: column; align-items: flex-start; }
    .me-context-right { width: 100%; justify-content: flex-start; }
}
@media (max-width: 768px) {
    .me-main-container { padding: 8px 10px 16px; }
    .me-top-context-right { justify-content: flex-start; }
    .hero-card-compact { min-width: 120px; flex: 1; }
}
@media print {
    .top-bar, .me-sidebar, .sidebar-overlay, .hamburger-btn { display: none !important; }
    .me-main-container { padding: 0 !important; overflow: visible !important; }
    .me-workspace { width: 100% !important; }
}

/* ================= LOADER & TOAST ================= */
.loader-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.9); z-index: 9999; display: none;
    align-items: center; justify-content: center; flex-direction: column; gap: 1rem;
}
.loader-overlay.active { display: flex; }

.toast-container {
    position: fixed; top: 1rem; right: 1rem; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px;
}
.custom-toast {
    background: white; border-radius: 10px; padding: 10px 16px;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 0.82rem;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ================= CONTENT AREA — TABLES, TABS ================= */
.content-area, .me-content-area {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 8px 10px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    overflow: visible;
}

/* Tab navigation */
.tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.tab-btn {
    padding: 5px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s ease;
    border-radius: 6px 6px 0 0;
}
.tab-btn:hover {
    color: #334155;
    background: rgba(99, 102, 241, 0.05);
}
.tab-btn.active {
    color: #4338ca;
    border-bottom-color: #4338ca;
    background: rgba(99, 102, 241, 0.08);
}

/* Data Table Container with scroll */
.data-table-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    -webkit-overflow-scrolling: touch;
}
.data-table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.data-table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Data tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.data-table th {
    background: #4f46e5;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 6px 8px;
    border-bottom: 2px solid #4338ca;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}
.data-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
}
.data-table tbody tr {
    transition: background 0.12s ease;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}
.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}
.data-table tbody tr:nth-child(even):hover {
    background: #f1f5f9;
}

/* Search bar above tables */
.search-filter-bar {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.search-filter-bar input[type="text"] {
    flex: 1;
    min-width: 160px;
    height: 30px;
    padding: 3px 8px 3px 26px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: 0.74rem;
    outline: none;
    transition: border-color 0.15s;
}
.search-filter-bar input[type="text"]:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}
.search-filter-bar .btn,
.search-filter-bar select {
    height: 30px;
    padding: 2px 8px;
    font-size: 0.74rem;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Column Toggle Dropdown & Controls */
.col-toggle-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    z-index: 100;
}
.col-toggle-btn {
    height: 30px;
    padding: 2px 9px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.74rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.col-toggle-btn:hover {
    border-color: #6366f1;
    color: #4f46e5;
    background: #f8fafc;
}
.col-toggle-btn.active {
    border-color: #6366f1;
    color: #ffffff;
    background: #4f46e5;
}
.col-toggle-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
    min-width: 210px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 99999 !important;
}
.col-toggle-dropdown.open {
    display: block !important;
}
.col-toggle-dropdown .ct-header {
    padding: 5px 12px 6px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 3px;
}
.col-toggle-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 0.75rem;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.12s ease;
    font-weight: 500;
    user-select: none;
    margin: 0;
}
.col-toggle-dropdown label:hover {
    background: #eef2ff;
    color: #4338ca;
}
.col-toggle-dropdown input[type="checkbox"] {
    accent-color: #4f46e5;
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
}

/* Page sizer */
.page-sizer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #64748b;
}
.page-sizer select {
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.72rem;
    outline: none;
}

/* Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
}
.badge-actif { background: #dcfce7; color: #166534; }
.badge-inactif { background: #fef2f2; color: #991b1b; }
.badge-conge { background: #fef3c7; color: #92400e; }
