html, body {
    font-family: 'Manrope', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* ── Barlow Condensed pour les titres ───────────────────── */
h1, h2, h3, h4, h5, h6,
.mud-typography-h1, .mud-typography-h2,
.mud-typography-h3, .mud-typography-h4,
.mud-typography-h5, .mud-typography-h6 {
    font-family: 'Barlow Condensed', Roboto, sans-serif !important;
}

/* ── MudPaper shadows ───────────────────────────────────── */
.mud-paper         { box-shadow: 0 2px 8px  rgba(0,0,0,0.14) !important; }
.mud-elevation-2   { box-shadow: 0 3px 10px rgba(0,0,0,0.18) !important; }
.mud-elevation-3   { box-shadow: 0 4px 14px rgba(0,0,0,0.22) !important; }

/* ── MudChip arrondi ────────────────────────────────────── */
.mud-chip { border-radius: 6px !important; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar             { width: 5px; height: 5px; }
::-webkit-scrollbar-track       { background: transparent; }
::-webkit-scrollbar-thumb       { background: rgba(155,89,232,0.30); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(155,89,232,0.55); }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR NAV — .sb-nav-*
   ═══════════════════════════════════════════════════════════ */

.sb-nav {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
}

/* Nav link */
.sb-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 2px 8px;
    border-radius: 12px;
    color: #E8DEFF;
    text-decoration: none !important;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.sb-nav-link:hover {
    background: #6C3F96;
    color: white;
    text-decoration: none !important;
}

.sb-nav-link--active {
    background: #7348A3 !important;
    color: white !important;
}

.sb-nav-link--active .sb-nav-icon svg {
    stroke: white !important;
}

/* Lucide icon inside nav */
.sb-nav-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sb-nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: #E8DEFF;
    stroke-width: 1.75;
    fill: none;
}

.sb-nav-link:hover .sb-nav-icon svg {
    stroke: white;
}

/* Nav text */
.sb-nav-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section label */
.sb-nav-section {
    font-size: 0.60rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #C4A8F0;
    padding: 10px 20px 4px;
    white-space: nowrap;
}

/* Mini mode: center icon, hide text */
#esb-sb:not(.esb-sidebar--open) .sb-nav-link {
    justify-content: center;
    padding: 10px;
    margin: 3px 8px;
}

/* ── Lucide icon dans les boutons sidebar ───────────────── */
.esb-sb-lucide {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esb-sb-lucide svg {
    width: 20px;
    height: 20px;
    stroke: #E8DEFF;
    stroke-width: 1.75;
    fill: none;
}

.esb-sb-icon-btn:hover .esb-sb-lucide svg {
    stroke: white;
}

/* ═══════════════════════════════════════════════════════════ */

/* ── Blazor validation ──────────────────────────────────── */
.valid.modified:not([type=checkbox]) { outline: 1px solid #2E7D32; }
.invalid                             { outline: 1px solid #C62828; }
.validation-message                  { color: #C62828; }

.blazor-error-boundary {
    background: #C62828;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Une erreur s'est produite."
}

#blazor-error-ui {
    background: #C4881A;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #1A0D36;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════
   ESB TABLE — style datagrid unifié
   ═══════════════════════════════════════════════════════════ */

/* Paper container */
.esb-table-card {
    border-radius: 16px !important;
    overflow: hidden;
}

/* Header cells */
.esb-table .mud-table-head th {
    font-size: 0.70rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em;
    color: var(--mud-palette-text-secondary) !important;
    padding: 10px 16px !important;
    border-bottom: 2px solid var(--mud-palette-lines-default) !important;
    white-space: nowrap;
}

/* Data cells */
.esb-table .mud-table-body td {
    padding: 13px 16px !important;
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    font-size: 0.875rem;
}

/* Last row — no bottom border */
.esb-table .mud-table-body tr:last-child td {
    border-bottom: none !important;
}

/* Row hover tint */
.esb-table .mud-table-body tr:hover td {
    background: rgba(155, 89, 232, 0.06) !important;
}

/* Toolbar */
.esb-table .mud-toolbar {
    padding: 12px 16px !important;
    min-height: 56px;
}

/* ── Icônes Lucide dans les tables ──────────────────────── */

/* Icônes dans boutons d'action (modifier, supprimer…) */
.esb-action-icon {
    width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.esb-action-icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}

/* Icônes dans boutons de toolbar */
.esb-btn-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    margin-right: 5px;
    vertical-align: text-bottom;
}
.esb-btn-icon svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Icônes dans chips */
.esb-chip-icon {
    width: 13px;
    height: 13px;
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    vertical-align: middle;
}
.esb-chip-icon svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Icônes inline (dans texte / tooltips) */
.esb-inline-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 3px;
}
.esb-inline-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Icônes dans titres de page */
.esb-title-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    vertical-align: middle;
}
.esb-title-icon svg {
    width: 26px;
    height: 26px;
    stroke: var(--mud-palette-primary);
    stroke-width: 1.75;
    fill: none;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT — .esb-layout, .esb-sidebar, .esb-main …
   ═══════════════════════════════════════════════════════════ */

/* ── Outer layout ─────────────────────────────────────────── */
.esb-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--mud-palette-background);
    padding: 10px;
    gap: 10px;
    box-sizing: border-box;
}

/* ── Sidebar shell ─────────────────────────────────────────── */
.esb-sidebar {
    flex-shrink: 0;
    width: 66px;
    height: 100%;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #2D1068 0%, #5C2A8A 55%, #7040B8 100%);
    box-shadow: 0 8px 32px rgba(45, 16, 104, 0.50);
    transition: width 0.25s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
    z-index: 200;
}

.esb-sidebar--open {
    width: 240px;
}

/* ── Header ───────────────────────────────────────────────── */
.esb-sb-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 14px 12px 12px;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: 68px;
}

.esb-sb-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}

.esb-sb-brand {
    display: flex;
    flex-direction: column;
    line-height: 1;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.esb-sb-brand-name {
    font-family: 'Barlow Condensed', Roboto, sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: white;
    letter-spacing: 0.05em;
    line-height: 1;
}

.esb-sb-brand-sub {
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-top: 2px;
}

/* ── Icon buttons (generic) ─────────────────────────────── */
.esb-sb-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.0);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    padding: 0;
}

.esb-sb-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.esb-sb-icon {
    font-size: 1.25rem !important;
    color: rgba(255, 255, 255, 0.80) !important;
}

.ml-auto { margin-left: auto; }

/* ── Nav area ─────────────────────────────────────────────── */
.esb-sb-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: none;
}

.esb-sb-nav::-webkit-scrollbar { display: none; }

/* ── Footer ───────────────────────────────────────────────── */
.esb-sb-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* User card (expanded mode) */
.esb-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
}

.esb-user-card:hover {
    background: rgba(255, 255, 255, 0.10);
}

.esb-user-name {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* ── Main content area ────────────────────────────────────── */
.esb-main {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    border-radius: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(155, 89, 232, 0.35) transparent;
}

/* ── Mobile topbar — hidden on desktop ───────────────────── */
.esb-topbar {
    display: none;
}

.esb-topbar-brand {
    flex: 1;
    font-family: 'Barlow Condensed', Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: white;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* ── Mobile drawer — always fixed, off-screen ────────────── */
.esb-mobile-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 300;
    background: linear-gradient(160deg, #2D1068 0%, #5C2A8A 55%, #7040B8 100%);
    box-shadow: 4px 0 32px rgba(45, 16, 104, 0.5);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
    flex-direction: column;
}

.esb-mobile-drawer--open {
    transform: translateX(0);
}

/* ── Mobile backdrop ─────────────────────────────────────── */
.esb-mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    z-index: 250;
    backdrop-filter: blur(2px);
}

/* ── Bottom nav — hidden on desktop ──────────────────────── */
.esb-bottomnav {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE  ≤ 640 px
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

    .esb-layout {
        flex-direction: column;
        padding: 0;
        gap: 0;
    }

    /* Hide desktop sidebar */
    .esb-sidebar {
        display: none !important;
    }

    /* Show topbar */
    .esb-topbar {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 0 8px 0 4px;
        height: 56px;
        flex-shrink: 0;
        background: linear-gradient(160deg, #2D1068 0%, #5C2A8A 100%);
        z-index: 100;
        box-shadow: 0 2px 12px rgba(45, 16, 104, 0.4);
    }

    /* Main: full width, space for bottom nav */
    .esb-main {
        border-radius: 0;
        height: auto;
        flex: 1;
        min-height: 0;
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    /* Show mobile drawer */
    .esb-mobile-drawer {
        display: flex;
    }

    /* Show bottom nav */
    .esb-bottomnav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(60px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: linear-gradient(160deg, #2D1068 0%, #5C2A8A 100%);
        border-top: 1px solid rgba(255, 255, 255, 0.14);
        z-index: 100;
        box-shadow: 0 -2px 16px rgba(45, 16, 104, 0.35);
    }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV — .esb-bn-*
   ═══════════════════════════════════════════════════════════ */

.esb-bn-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: rgba(255, 255, 255, 0.52);
    text-decoration: none !important;
    font-size: 0.60rem;
    font-weight: 600;
    padding: 6px 2px;
    transition: color 0.15s;
    letter-spacing: 0.02em;
}

.esb-bn-link:hover,
.esb-bn-link.esb-bn-link--active {
    color: white;
}

.esb-bn-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.esb-bn-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}
