/* ═══════════════════════════════════════════════════════════════════════
   NEDIA Tech — Design System (Fidèle à base.html & bmdspoke.css de RH)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: linear-gradient(135deg, #0f172a, #1e293b);
    --border-light: #e2e8f0;
    --border: #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;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --accent-subtle: rgba(37, 99, 235, 0.08);
    --topbar-height: 50px;
    --subbar-height: 44px;
    --logo-corner-height: calc(var(--topbar-height) + var(--subbar-height));
    --sidebar-width: 250px;

    /* Status */
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --success-border: rgba(5, 150, 105, 0.2);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --warning-border: rgba(217, 119, 6, 0.2);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.08);
    --danger-border: rgba(239, 68, 68, 0.2);
    --info: #0284c7;
    --info-bg: rgba(2, 132, 199, 0.08);
    --info-border: rgba(2, 132, 199, 0.2);

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 9999px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.18s;
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-accent { color: var(--accent) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }

/* ============================================================================
   LOGIN SCREEN
   ============================================================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-header);
    position: relative;
    overflow: hidden;
    z-index: 10000;
}

.login-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.login-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-light);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.login-logo .logo-icon {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
}

.login-brand h1 {
    font-size: 1.45rem;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: #64748b;
    font-size: 0.85rem;
}

.login-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin-top: 1.5rem;
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */
.form-group {
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.form-group label, .form-label {
    display: block;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    height: 27px;
    padding: 2px 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    color: #0f172a;
    font-family: inherit;
    font-size: 0.78rem;
    outline: none;
    transition: all var(--duration) var(--ease);
    box-sizing: border-box;
}

.form-group textarea,
textarea.form-control {
    height: auto;
    min-height: 48px;
    padding: 4px 8px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.form-row > .form-group {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.form-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 0.74rem;
    margin-bottom: 6px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.15rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.btn-outline-secondary {
    background: #ffffff;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.btn-outline-secondary:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
}
.btn-danger:hover {
    box-shadow: 0 3px 8px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    border-radius: var(--radius-xs);
}

.btn-block { width: 100%; }

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   LAYOUT PRINCIPAL APPLICATION (FIDÈLE À BASE.HTML DE RH)
   ============================================================================ */
.bmd-app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-body);
}

/* ================= 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 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-initials-badge {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: 0.05em;
    border-radius: 8px;
    user-select: none;
    text-transform: uppercase;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* 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;
}

/* Search */
.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 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;
}

/* ================= 2. DEUXIÈME BARRE HORIZONTALE (Context & Stats) ================= */
.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;
}

.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;
}

.etab-context-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    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 {
    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-amber { background: linear-gradient(135deg, #d97706, #fbbf24); }

/* ================= 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;
}

.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;
}

/* ================= ACCORDION SIDEBAR STYLES (CENTRÉ VERTICALEMENT) ================= */
.me-sidebar-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    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;
}

/* ── 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-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 {
    background: #f8fafc;
    padding: 4px 6px 5px 2px;
    border-top: 1px solid rgba(99, 102, 241, 0.12);
}

.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;
}

/* 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;
    cursor: pointer;
    width: 100%;
}
.me-logout-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

/* ================= SIDEBAR MINI / REPLIÉE (COMME RH / MONÉCOLE) ================= */
.bmd-main-area.sidebar-collapsed .me-sidebar-col {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    padding: 6px 0 6px 6px !important;
}

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

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

.bmd-main-area.sidebar-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);
}

.bmd-main-area.sidebar-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 {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

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

.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 {
    display: none !important;
}

.bmd-main-area.sidebar-collapsed .me-sb-footer {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 6px 0 0;
}
.bmd-main-area.sidebar-collapsed .me-logout-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}
.bmd-main-area.sidebar-collapsed .me-logout-btn span {
    display: none !important;
}

/* ================= WORKSPACE (ZONE DE TRAVAIL ULTRA-COMPACTE & ÉLÉGANTE) ================= */
.me-workspace {
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 6px 12px 14px 12px;
    box-sizing: border-box;
    overflow-y: auto;
}

.me-workspace::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.me-workspace::-webkit-scrollbar-track {
    background: transparent;
}
.me-workspace::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.me-workspace::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.me-content-area, .content-area, .page-content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 6px;
    padding: 1px 0;
}

.page-title, h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.71rem;
    margin: 1px 0 0 0;
    line-height: 1.2;
}

.page-actions, .header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

/* ================= SEGMENTED CONTROLS & TABS (COMPACTS) ================= */
.nedia-segmented-control, .cp-tabs-bar, .catalog-tabs, .settings-tabs {
    display: inline-flex !important;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: #e2e8f0;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid #cbd5e1;
    height: 26px;
}

.segmented-pill, .catalog-tab, .settings-tab, .cp-tab-btn {
    padding: 1px 8px;
    height: 22px;
    border: none;
    background: transparent;
    color: #475569;
    font-weight: 600;
    font-size: 0.73rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.segmented-pill:hover, .catalog-tab:hover, .settings-tab:hover, .cp-tab-btn:hover {
    color: #1e293b;
    background: rgba(255, 255, 255, 0.5);
}

.segmented-pill.active, .catalog-tab.active, .settings-tab.active, .cp-tab-btn.active {
    background: #ffffff !important;
    color: #2563eb !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

/* ================= CARDS & KPI (ULTRA COMPACTS) ================= */
.card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.15s ease;
    margin-bottom: 6px;
}

.card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
    margin: -8px -12px 6px -12px;
    background: #fcfdfe;
    gap: 6px;
}

.card-header-left, .card-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.card-header h2, .card-header h3, .card-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 5px;
    margin-bottom: 6px;
}

.kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 48px;
}

.kpi-card:hover {
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}

.kpi-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}

.kpi-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.kpi-value.accent { color: #2563eb; }
.kpi-value.success { color: #059669; }
.kpi-value.warning { color: #d97706; }
.kpi-value.danger { color: #dc2626; }

/* ================= TABLES (DENSES, COMPACTES & LISIBLES) ================= */
.table-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    margin-bottom: 6px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table, .table, .data-table, .compact-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.77rem;
    margin-bottom: 0;
}

thead, .table-light, thead tr {
    background: #f8fafc;
}

th {
    padding: 4px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    text-align: left;
    white-space: nowrap;
    line-height: 1.2;
}

td {
    padding: 4px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
    vertical-align: middle;
    line-height: 1.25;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    border-bottom: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 6px;
    background: #fcfdfe;
}

.table-header h2 {
    font-size: 0.84rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.table-filters {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.table-filters input, .table-filters select {
    padding: 2px 6px;
    height: 25px;
    font-size: 0.76rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    outline: none;
}

.money {
    font-variant-numeric: tabular-nums;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.76rem;
    font-weight: 600;
    text-align: right;
}

.table-empty {
    text-align: center;
    color: #94a3b8;
    padding: 16px 0;
    font-size: 0.76rem;
    font-style: italic;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 0.72rem;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    background: #fcfdfe;
}

.pagination-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btns button {
    height: 24px;
    padding: 1px 8px;
    font-size: 0.72rem;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btns button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* ================= BARRES DE FILTRAGE & D'ACTIONS MASSIVES ================= */
.filter-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 5px 8px;
    margin-bottom: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.filter-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 110px;
}

.filter-group label {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin: 0;
    letter-spacing: 0.04em;
}

.filter-group input, .filter-group select {
    height: 26px;
    padding: 2px 7px;
    font-size: 0.76rem;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    outline: none;
    transition: all 0.15s ease;
}

.filter-group input:focus, .filter-group select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 3px 8px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e40af;
}

/* ================= GROUPEMENT PARTENAIRES (PAR PAYS) ================= */
.partner-group {
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #ffffff;
    margin-bottom: 5px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 9px;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    border-bottom: 1px solid transparent;
}

.group-header:hover {
    background: #f1f5f9;
}

.group-header.expanded {
    background: #f1f5f9;
    border-bottom-color: #e2e8f0;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.80rem;
    font-weight: 700;
    color: #1e293b;
}

.group-chevron {
    font-size: 0.72rem;
    color: #64748b;
    width: 12px;
    display: inline-block;
}

.group-count {
    font-size: 0.65rem;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
    padding: 1px 6px;
    border-radius: 8px;
}

.group-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.check-all-label {
    font-size: 0.70rem;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.group-body {
    background: #ffffff;
}

.group-body table {
    margin-bottom: 0;
}

/* ================= DÉTAILS & FICHES RÉSUMÉES ================= */
.detail-section {
    margin-bottom: 8px;
}

.detail-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid #f1f5f9;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 10px;
    margin-bottom: 6px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    border-bottom: 1px dashed #f1f5f9;
    font-size: 0.76rem;
}

.detail-label {
    font-size: 0.67rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.detail-value {
    font-size: 0.77rem;
    color: #0f172a;
    font-weight: 600;
}

/* ================= BOUTONS COMPACTS & GROUPES ================= */
.btn {
    height: 26px;
    padding: 1px 9px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    gap: 4px;
}

.btn-sm {
    height: 23px;
    padding: 1px 6px;
    font-size: 0.71rem;
    border-radius: 4px;
    gap: 3px;
}

.btn-xs {
    height: 20px;
    padding: 0 5px;
    font-size: 0.67rem;
    border-radius: 3px;
    gap: 3px;
}

.btn-group {
    display: inline-flex;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-group .btn {
    border-radius: 0;
    margin-left: -1px;
}

.btn-group .btn:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    margin-left: 0;
}

.btn-group .btn:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.btn-outline-primary {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
}
.btn-outline-primary:hover {
    background: #eff6ff;
    border-color: #2563eb;
}

.btn-outline-info {
    background: #ffffff;
    border: 1px solid #bae6fd;
    color: #0284c7;
}
.btn-outline-info:hover {
    background: #f0f9ff;
    border-color: #0284c7;
}

.btn-outline-danger {
    background: #ffffff;
    border: 1px solid #fecaca;
    color: #dc2626;
}
.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* ================= BADGES RAFFINÉS ================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: 8px;
    font-size: 0.67rem;
    font-weight: 600;
    line-height: 1.2;
}

.badge-mini {
    font-size: 0.58rem;
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    vertical-align: middle;
    display: inline-block;
}

.badge-src {
    background: #fef3c7 !important;
    color: #b45309 !important;
    border: 1px solid #fde68a !important;
}

.badge-univ {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
}

.badge-success, .bg-success-subtle {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border: 1px solid #a7f3d0;
}

.badge-warning, .bg-warning-subtle {
    background: #fffbeb !important;
    color: #d97706 !important;
    border: 1px solid #fde68a;
}

.badge-danger, .bg-danger-subtle {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca;
}

.badge-info, .bg-info-subtle {
    background: #f0f9ff !important;
    color: #0284c7 !important;
    border: 1px solid #bae6fd;
}

.badge-primary, .bg-primary-subtle {
    background: #eff6ff !important;
    color: #2563eb !important;
    border: 1px solid #bfdbfe;
}

.badge-muted, .bg-light {
    background: #f8fafc !important;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}

.text-dark { color: #0f172a !important; }
.text-xs { font-size: 0.68rem !important; }
.text-sm { font-size: 0.76rem !important; }

/* ================= CONTROL PLANE MODULES & ROUTING ================= */
.cp-tab-pane {
    display: none;
}
.cp-tab-pane.active {
    display: block;
}

.cp-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 7px;
    margin-top: 6px;
}

.cp-module-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 7px 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cp-module-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.cp-module-card.is-authorized {
    border-left: 3px solid #10b981;
}

.cp-module-card.is-disabled {
    border-left: 3px solid #cbd5e1;
    opacity: 0.85;
}

.cp-mod-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.cp-mod-identity {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cp-mod-icon-box {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.cp-mod-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cp-mod-title {
    font-size: 0.80rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.15;
}

.cp-mod-code {
    font-size: 0.63rem;
    color: #64748b;
    font-family: monospace;
}

.cp-mod-body {
    font-size: 0.72rem;
    color: #475569;
    line-height: 1.25;
}

.cp-mod-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.70rem;
}

#dashboard-tables {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) !important;
    gap: 8px !important;
    margin-top: 6px;
}

/* ================= MODALS COMPACTES ================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
}

.modal-sm { max-width: 360px; }
.modal-md { max-width: 540px; }
.modal-lg { max-width: 800px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    background: #fcfdfe;
}

.modal-header h2, .modal-header h3 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
}

.modal-body {
    padding: 8px 12px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    padding: 6px 10px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}
.btn-close:hover { color: #1e293b; }

/* ================= TOASTS & LOADERS ================= */
.toast-container {
    position: fixed;
    bottom: 0.8rem;
    right: 0.8rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.toast {
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.toast-success { background: linear-gradient(135deg, #059669, #10b981); }
.toast-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.toast-info { background: linear-gradient(135deg, #0284c7, #38bdf8); }

.toast.leaving {
    opacity: 0;
    transform: translateY(6px);
    transition: all 0.2s ease;
}

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


