/* Menu sélection d'agence — même palette sidebar, sans bordure ni puces */
#agencySelectMenu.sidebar-agency-select-menu {
    top: calc(100% + var(--space-sm)) !important;
    left: 0 !important;
    position: absolute !important;
    background: var(--sidebar-bg, #01244d) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) rgba(2, 6, 23, 0.35) !important;
    z-index: 9999 !important;
    padding: var(--space-sm) !important;
    min-width: 9rem !important;
    margin: 0 !important;
    list-style: none !important;
    display: none;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item {
    list-style: none !important;
    margin: 0 0 var(--space-xs) 0 !important;
    padding: 0 !important;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item:last-child {
    margin-bottom: 0 !important;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item::marker,
#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item::before {
    content: none !important;
    display: none !important;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.55rem 0.75rem;
    border: none !important;
    border-radius: var(--radius-sm);
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.02em;
    line-height: var(--line-height-tight);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item a:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff;
    box-shadow: none !important;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-submenu-item a:active {
    background: rgba(59, 130, 246, 0.25) !important;
    transform: none;
    box-shadow: none !important;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-agency-select-icon {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

#agencySelectMenu.sidebar-agency-select-menu .sidebar-link-text {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
}

/* Sidebar logo group */
.sidebar-logo-img-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-shrink: 0;
    min-width: 0;
}
.sidebar-logo-img {
    height: 1.75rem;
    width: auto;
    display: block;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar-logo-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 1;
}
.sidebar-logo-text {
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-display);
    letter-spacing: -0.02em;
    line-height: var(--line-height-tight);
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Sidebar agency group */
.sidebar-agency-group {
    display: flex;
    align-items: center;
    gap: var(--gap-2);
    flex-shrink: 0;
    margin-left: var(--space-sm);
    position: relative;
}

.sidebar-agency-icon {
    font-size: var(--text-sm);
}

.sidebar-agency-title {
    font-family: var(--font-sans);
    font-size: var(--text-label);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.04em;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.92);
    padding: 0.35em 0.65em;
    margin: 0;
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.1);
    border: var(--border-width-thin) solid rgba(255, 255, 255, 0.18);
}

.sidebar-agency-title:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.28);
    border-color: rgba(59, 130, 246, 0.45);
    text-decoration: none;
}

.sidebar-agency-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.2em;
    line-height: var(--sidebar-line-height-normal);
    outline: none;
}

.sidebar-agency-btn:focus-visible {
    outline: 0.125em solid rgba(255, 255, 255, 0.5);
    outline-offset: 0.125em;
}

.sidebar-agency-chevron {
    color: #fff;
    font-size: var(--sidebar-font-size-sm);
}

/* Agency select menu */
.sidebar-agency-select-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + var(--space-sm));
    z-index: 99999;
    list-style: none;
    margin: 0;
    padding: 0;
    border: none;
}

.sidebar-agency-select-icon {
    font-size: 0.85rem;
}

/* Subsubmenu modal */
.subsubmenu-modal {
    display: none;
    position: fixed;
    z-index: 30000;
    left: 15%;
    top: 8%;
    background: #fff;
    border-radius: var(--sidebar-radius-md);
    box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.15);
    padding: var(--sidebar-spacing-md);
    min-width: 18%;
    border: 0.0625em solid #e5e7eb;
}

.subsubmenu-modal-title {
    font-weight: 500;
    font-size: var(--sidebar-font-size-lg);
    line-height: var(--sidebar-line-height-tight);
    margin-bottom: var(--sidebar-spacing-xs);
}

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

.subsubmenu-modal-list-item {
    margin-bottom: var(--sidebar-spacing-xs);
}

.subsubmenu-modal-link {
    color: #1565c0;
    line-height: var(--sidebar-line-height-relaxed);
    padding: var(--sidebar-spacing-xs) 0;
    text-decoration: none;
    display: block;
    transition: color 0.15s ease;
}

.subsubmenu-modal-link:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.subsubmenu-modal-close {
    margin-top: var(--sidebar-spacing-sm);
    padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-md);
    background: #1565c0;
    color: #fff;
    border: none;
    border-radius: var(--sidebar-radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s ease;
}

.subsubmenu-modal-close:hover {
    background: #0d47a1;
}

.subsubmenu-modal-close:focus-visible {
    outline: 0.125em solid #1565c0;
    outline-offset: 0.125em;
}

/* Header search icon (sur fond bleu) */
.header-search-icon {
    font-size: var(--sidebar-font-size-lg);
    color: rgba(255, 255, 255, 0.7);
}

/* Header search results */
.header-search {
    position: relative;
}

.header-search-results {
    position: absolute;
    top: calc(100% + 0.5em);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 95vw;
    width: auto;
    min-width: clamp(40rem, 50rem, 95vw);
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
    background: #fff;
    border: 0.0625em solid #eee;
    border-radius: var(--sidebar-radius-lg);
    box-shadow: 0 0.25em 1.25em rgba(30,41,59,0.12), 0 0.125em 0.5em rgba(59,130,246,0.1);
}

/* Classes pour gérer l'état de la dropdown */
.header-search-results.is-hidden {
    display: none !important;
}

.header-search-results.is-open {
    display: flex;
}

/* Styles pour les résultats de recherche - Layout vertical centré */
.header-search-results.horizontal-search-results.is-open {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: var(--sidebar-spacing-lg);
}

/* Amélioration de l'apparence des résultats vides */
.header-search-results:empty::before {
    content: '';
}

.header-search-results > div:only-child {
    text-align: center;
    padding: var(--sidebar-spacing-md);
    color: #888;
}

.search-results-horizontal-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2em;
    width: 100%;
    align-items: flex-start;
    justify-content: center;
}

.search-results-horizontal-col {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    flex: 1 1 auto;
    min-width: clamp(12rem, 15rem, 20vw);
    max-width: 25rem;
}

.search-results-horizontal-title {
    font-weight: 500;
    color: #1565c0;
    margin-bottom: 0.75em;
    font-size: 1.1em;
    border-bottom: 0.125em solid #e3eefd;
    padding-bottom: 0.5em;
    text-align: left;
}

.search-result-item {
    padding: 0.625em 0.875em;
    cursor: pointer;
    border-radius: 0.375em;
    transition: all 0.2s ease;
    border-left: 0.1875em solid transparent;
    margin-bottom: 0.25em;
}

.search-result-item:hover {
    background: #e3eefd;
    color: #0d47a1;
    border-left-color: #1565c0;
    transform: translateX(0.125em);
}

/* Responsive pour les résultats de recherche */
@media (max-width: 43.75em) {
    .header-search-results {
        min-width: calc(100vw - 2.5em);
        max-width: calc(100vw - 2.5em);
        left: 1.25em;
        transform: none;
        padding: var(--sidebar-spacing-md);
    }
    
    .search-results-horizontal-row {
        flex-direction: column;
        gap: 1.5em;
    }
    
    .search-results-horizontal-col {
        min-width: 100%;
        max-width: 100%;
        gap: 0.375em;
    }
    
    .search-results-horizontal-title {
        font-size: 1em;
        margin-bottom: 0.625em;
        padding-bottom: 0.375em;
    }
    
    .search-result-item {
        padding: 0.5em 0.75em;
        font-size: 0.95em;
    }
}
/* Remontée supplémentaire des sous-menus pour mobile */
@media (max-width: 37.5rem) {
    .submenu {
        top: 70% !important;
    }
    .sidebar-submenu {
        top: 0 !important;
    }
}
/* Old navbar container - kept for compatibility if used elsewhere */
.navbar-container {
    background-color: #001f3f;
    color: white;
    padding: var(--sidebar-spacing-md);
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.navbar-title {
    color: white;
}

.navbar {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    width: 100%;
}

/* Old submenu styles - kept for compatibility */
.submenu {
    display: none;
    position: absolute;
    top: 90%;
    left: 0;
    background-color: #003366;
    list-style: none;
    margin: 0;
    padding: var(--sidebar-spacing-md);
    min-width: 60% !important;
    z-index: 1000;
    border-radius: var(--sidebar-radius-md);
}

.submenu-item a {
    color: white;
    text-decoration: none;
    padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
    display: block;
    line-height: var(--sidebar-line-height-relaxed);
    border-radius: var(--sidebar-radius-sm);
    transition: background 0.18s ease;
}

.submenu-item a:hover {
    background-color: #004080;
}

/* Sidebar provider : wrapper flex, aucun décalage en haut */
.sidebar-provider {
    display: flex;
    min-height: 100vh;
    width: 100%;
    padding-top: 0;
    margin-top: 0;
}

.sidebar {
    width: var(--sidebar-width-expanded);
    background: var(--sidebar-bg);
    color: #e2e8f0;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 0.2em 0.8em rgba(0, 0, 0, 0.08);
    padding-bottom: var(--pad-3);
    overflow-x: hidden;
    overflow-y: visible;
    transition: width 0.2s ease;
    font-size: var(--sidebar-font-size-base);
    max-height: 100vh;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .menu-text,
.sidebar.collapsed .sidebar-agency-title,
.sidebar.collapsed .sidebar-user-text {
    opacity: 0;
    overflow: hidden;
    width: 0;
    height: 0;
    padding: 0;
    margin: 0;
    position: absolute;
    white-space: nowrap;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-logo-img-group { 
    justify-content: center; 
    gap: 0;
}

.sidebar.collapsed .menu-item .menu-link { 
    justify-content: center; 
}

.sidebar.collapsed .menu-chevron { 
    display: none; 
}

.sidebar.collapsed .menu-badge {
    display: none;
}

.sidebar.collapsed .sidebar-nav ul { 
    width: 100%; 
}

.sidebar.collapsed .sidebar-search-icon {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    left: auto;
    transform: none;
}

.sidebar.collapsed .sidebar-agency-group {
    display: none;
}

.sidebar.collapsed .sidebar-user-avatar {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: var(--pad-2);
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

/* Sidebar header : logo + toggle en haut */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap-3);
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    flex-shrink: 0;
    min-width: 0;
    overflow: visible;
}

.sidebar-header .sidebar-toggle-header {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    padding: 0;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: var(--border-width-thin) solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sidebar-header .sidebar-toggle-header:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.sidebar-header .sidebar-toggle-icon {
    font-size: 0.75rem;
}

.sidebar.collapsed .sidebar-header .sidebar-toggle-icon {
    transform: rotate(180deg);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0;
    margin: 0;
    color: #fff;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
    overflow: visible;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: visible;
    padding-top: var(--sidebar-spacing-md); /* 16px - harmonisé */
}
.sidebar-nav ul {
    list-style: none;
    width: 91%;
}
.sidebar-nav ul > li {
    margin-bottom: var(--sidebar-spacing-sm); /* 12px - harmonisé */
    padding: var(--sidebar-spacing-xs) 0; /* 8px 0 - harmonisé */
}
/* === Menu Item: structure à 3 zones === */
.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: var(--menu-border-width) solid rgba(255, 255, 255, 0.3);
    border-radius: var(--sidebar-radius-lg);
    box-shadow: var(--menu-box-shadow-base);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    background: rgba(255, 255, 255, 0.02);
}

.menu-item:hover {
    box-shadow: var(--menu-box-shadow-hover);
}

.menu-item:active {
    box-shadow: var(--menu-box-shadow-active);
    transform: translateY(0.125em);
}

/* Zone cliquable: icône + texte */
.menu-link {
    display: flex;
    align-items: center;
    gap: var(--menu-icon-text-gap);
    padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
    color: #e2e8f0;
    text-decoration: none;
    font-size: var(--sidebar-font-size-base);
    line-height: var(--sidebar-line-height-normal);
    font-weight: 500;
    flex: 1 1 auto;
    min-height: 2.5em;
    border-radius: var(--sidebar-radius-lg);
    transition: background 0.18s ease, color 0.18s ease;
    outline: none;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.menu-link:focus-visible {
    outline: 0.125em solid rgba(255, 255, 255, 0.6);
    outline-offset: 0.125em;
    box-shadow: 0 0 0 0.25em rgba(59, 130, 246, 0.3);
}

.menu-link:active {
    background: rgba(255, 255, 255, 0.08);
}

/* Icône */
.menu-icon {
    font-size: var(--sidebar-font-size-lg);
    width: 1.375em;
    text-align: center;
    flex-shrink: 0;
}

/* Texte */
.menu-text {
    flex: 1 1 auto;
    font-size: var(--sidebar-font-size-base);
    line-height: var(--sidebar-line-height-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge */
.menu-badge {
    margin-left: var(--sidebar-spacing-xs);
    font-size: var(--sidebar-font-size-sm);
    font-weight: 500;
    line-height: var(--sidebar-line-height-tight);
    border-radius: var(--sidebar-radius-lg);
    padding: 0.25em 0.5em;
    background: #ef4444;
    color: #fff;
    flex-shrink: 0;
}

/* Zone chevron: bouton séparé */
.menu-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #e2e8f0;
    cursor: pointer;
    padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
    font-size: var(--sidebar-font-size-md);
    min-width: 2.5em;
    min-height: 2.5em;
    border-radius: var(--sidebar-radius-lg);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
    flex-shrink: 0;
    outline: none;
}

.menu-chevron:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(0.125em);
}

.menu-chevron:focus-visible {
    outline: 0.125em solid rgba(255, 255, 255, 0.6);
    outline-offset: 0.125em;
    box-shadow: 0 0 0 0.25em rgba(59, 130, 246, 0.3);
}

.menu-chevron:active {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(0.0625em) scale(0.95);
}

/* Wrapper */
.sidebar-link-wrapper {
    width: 100%;
}

/* Active state */
.menu-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 500;
}

/* === Sous-menus === */
.sidebar-submenu {
    position: absolute;
    left: calc(100% + var(--sidebar-spacing-xs));
    top: -8%;
    background: #01244d;
    border-radius: var(--sidebar-radius-lg);
    box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.25);
    z-index: 9999;
    padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
    border: var(--menu-border-width) solid rgba(255, 255, 255, 0.15);
}

.sidebar-submenu-item {
    margin-bottom: var(--sidebar-spacing-sm);
}

.sidebar-submenu-item:last-child {
    margin-bottom: 0;
}

/* Submenu avec wrapper pour items avec chevron */
.submenu-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--menu-text-chevron-gap);
    border: var(--menu-border-width) solid rgba(255, 255, 255, 0.2);
    border-radius: var(--sidebar-radius-md);
    padding: 0.25em;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.18s ease;
}

.submenu-item-wrapper:hover {
    background: rgba(255, 255, 255, 0.05);
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: var(--menu-icon-text-gap);
    color: #e2e8f0;
    text-decoration: none;
    padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm);
    border-radius: var(--sidebar-radius-md);
    font-size: var(--sidebar-font-size-base);
    line-height: var(--sidebar-line-height-normal);
    font-weight: 500;
    flex: 1 1 auto;
    transition: background 0.18s ease, color 0.18s ease;
    outline: none;
}

.submenu-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.submenu-link:focus-visible {
    outline: 0.125em solid rgba(255, 255, 255, 0.5);
    outline-offset: 0.125em;
}

.submenu-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #e2e8f0;
    cursor: pointer;
    padding: var(--sidebar-spacing-xs);
    font-size: var(--sidebar-font-size-sm);
    min-width: 2em;
    min-height: 2em;
    border-radius: var(--sidebar-radius-md);
    transition: background 0.18s ease, transform 0.18s ease;
    flex-shrink: 0;
    outline: none;
}

.submenu-chevron:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(0.125em);
}

.submenu-chevron:focus-visible {
    outline: 0.125em solid rgba(255, 255, 255, 0.5);
    outline-offset: 0.125em;
}

.submenu-chevron:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.95);
}

/* Items simples de sous-menu sans chevron */
.sidebar-submenu-item a {
    display: flex;
    align-items: center;
    gap: var(--menu-icon-text-gap);
    color: #e2e8f0;
    text-decoration: none;
    padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-md);
    border-radius: var(--sidebar-radius-lg);
    font-size: var(--sidebar-font-size-base);
    line-height: var(--sidebar-line-height-normal);
    font-weight: 500;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
    border: var(--menu-border-width) solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 0.125em 0.25em rgba(0, 0, 0, 0.1);
    outline: none;
}

.sidebar-submenu-item a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.15);
}

.sidebar-submenu-item a:focus-visible {
    outline: 0.125em solid rgba(255, 255, 255, 0.5);
    outline-offset: 0.125em;
}

.sidebar-submenu-item a:active {
    box-shadow: 0 0.0625em 0.125em rgba(0, 0, 0, 0.08);
    transform: translateY(0.0625em);
}

/* Sidebar search : icône intégrée dans le champ */
.sidebar-search-wrap {
    position: relative;
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-lg);
    flex-shrink: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.sidebar-search {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
    border-radius: var(--radius-sm);
    border: none;
    padding: 0;
    min-height: 2.5rem;
    box-shadow: none;
}

.sidebar-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    z-index: 1;
}

.sidebar-search-input {
    width: 100%;
    flex: 1;
    min-width: 0;
    border: var(--border-width-thin) solid var(--sidebar-input-border);
    background: var(--sidebar-input-bg);
    color: #f1f5f9;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-body);
    line-height: var(--line-height-normal);
    outline: none;
    padding: 0.65rem 0.85rem 0.65rem 2.35rem;
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
    font-weight: var(--font-weight-body);
}

.sidebar-search-input:focus {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 0.1875rem rgba(59, 130, 246, 0.18);
}

.sidebar-search:focus-within .sidebar-search-icon {
    color: rgba(255, 255, 255, 0.85);
}

.sidebar.collapsed .sidebar-search-wrap {
    padding: 0 var(--pad-2);
}

.sidebar.collapsed .sidebar-search-input {
    width: 0;
    padding: 0;
    opacity: 0;
}

/* Résultats de recherche sidebar */
.sidebar-search-results {
    position: absolute;
    left: var(--pad-3);
    right: var(--pad-3);
    top: 100%;
    margin-top: var(--gap-2);
    background: #1e293b;
    border-radius: var(--sidebar-radius-md);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.3);
    max-height: min(70vh, 22rem);
    overflow-y: auto;
    z-index: 1000;
    padding: var(--pad-2);
}

.sidebar-search-results.is-hidden {
    display: none;
}

.sidebar-search-results.is-open {
    display: block;
}

.sidebar-search-results .search-results-horizontal-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pad-3);
}

.sidebar-search-results .search-results-horizontal-col {
    min-width: 10rem;
    flex: 1;
}

.sidebar-search-results .search-results-horizontal-title {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--gap-2);
    font-size: var(--sidebar-font-size-sm);
}

.sidebar-search-results .search-result-item {
    padding: var(--pad-2) var(--pad-3);
    cursor: pointer;
    border-radius: var(--sidebar-radius-sm);
    color: #e2e8f0;
    font-size: var(--sidebar-font-size-sm);
}

.sidebar-search-results .search-result-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Sidebar footer : bloc utilisateur (initiales + nom) */
.sidebar-footer {
    margin-top: auto;
    padding: var(--pad-3);
    border-top: var(--menu-border-width) solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: var(--gap-3);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--gap-3);
}

.sidebar-user-avatar {
    width: var(--avatar-sm);
    height: var(--avatar-sm);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
}

.sidebar-user-initials {
    display: block;
}

.sidebar-user-name {
    font-size: var(--text-sm);
    color: #e2e8f0;
    line-height: var(--sidebar-line-height-tight);
}

/* Header bleu collé au haut du viewport (aligné à droite de la sidebar) */
.header-navbar {
    position: fixed;
    left: var(--sidebar-width-expanded);
    top: 0;
    right: 0;
    width: calc(100% - var(--sidebar-width-expanded));
    height: var(--header-height);
    background: var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--pad-3);
    border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.15);
    z-index: 90;
    transition: left 0.2s ease, width 0.2s ease;
}

body.sidebar-collapsed .header-navbar {
    left: var(--sidebar-width-collapsed);
    width: calc(100% - var(--sidebar-width-collapsed));
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--sidebar-input-bg);
    border-radius: var(--sidebar-radius-lg);
    border: 0.0625rem solid var(--sidebar-input-border);
    padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm);
    min-width: 25%;
    font-size: var(--sidebar-font-size-lg);
    color: #e2e8f0;
    gap: var(--sidebar-spacing-sm);
}
.header-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--sidebar-font-size-lg);
    line-height: var(--sidebar-line-height-normal);
    width: 60%;
    color: #e2e8f0;
    padding: var(--sidebar-spacing-xs);
}
.header-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--sidebar-spacing-md);
}
.header-btn {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: var(--sidebar-spacing-sm);
    font-size: var(--sidebar-font-size-xl);
    line-height: var(--sidebar-line-height-normal);
    border-radius: var(--sidebar-radius-sm);
    transition: background 0.18s;
    color: #e2e8f0;
}
.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.header-btn .notif-dot {
    position: absolute;
    top: var(--sidebar-spacing-xs);
    right: var(--sidebar-spacing-xs);
    width: 0.5em;
    height: 0.5em;
    background: #ef4444;
    border-radius: 50%;
    border: 0.0625em solid #fff;
}
.header-user {
    display: flex;
    align-items: center;
    gap: var(--sidebar-spacing-sm);
    background: #fff;
    border-radius: var(--sidebar-radius-xl);
    padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-md) var(--sidebar-spacing-xs) var(--sidebar-spacing-xs);
    box-shadow: 0 0.1% 0.4% rgba(0,0,0,0.04);
}
.header-avatar {
    width: 2.5rem; 
    height: 2.5rem;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: var(--sidebar-font-size-xl);
    line-height: var(--sidebar-line-height-tight);
    margin-right: var(--sidebar-spacing-sm);
    flex-shrink: 0;
}
.header-username {
    font-weight: 500;
    color: #222;
    font-size: var(--sidebar-font-size-lg);
    line-height: var(--sidebar-line-height-normal);
}
#agencyModal.sidebar-submenu {
    display: none;
    position: absolute;
    min-width: 20%;
    background: #01244d;
    border-radius: var(--sidebar-radius-lg);
    box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.2);
    padding: var(--sidebar-spacing-md);
    z-index: 9999;
    max-height: 30%;
    overflow-y: auto;
}

/* === RESPONSIVE: Base (petits / moyens écrans) === */
.sidebar-nav {
    padding-top: var(--sidebar-spacing-sm);
}

.sidebar-nav ul > li {
    margin-bottom: var(--sidebar-spacing-xs);
    padding: var(--sidebar-spacing-xs) 0;
}

/* === BREAKPOINT 1: Écrans moyens (>= 56.25em / ~900px) === */
@media (min-width: 56.25em) {
    :root {
        --menu-icon-text-gap: 2.5%;
        --menu-text-chevron-gap: 2%;
    }
    
    .menu-item {
        border-width: 0.0625em;
    }
    
    .menu-link {
        padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
    }
    
    .menu-chevron {
        padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
        min-width: 2.75em;
    }
    
    .sidebar-nav ul > li {
        margin-bottom: var(--sidebar-spacing-sm);
    }
}

/* === BREAKPOINT 2: Grands écrans (>= 87.5em / ~1400px) === */
@media (min-width: 87.5em) {
    :root {
        --menu-icon-text-gap: 3%;
        --menu-text-chevron-gap: 2.5%;
    }
    
    .sidebar-nav {
        padding-top: var(--sidebar-spacing-lg);
    }
    
    .sidebar-nav ul > li {
        margin-bottom: var(--sidebar-spacing-lg);
        padding: var(--sidebar-spacing-sm) 0;
    }
    
    .menu-item {
        border-width: 0.0625em;
        box-shadow: 0 0.15em 0.3em rgba(255, 255, 255, 0.12);
    }
    
    .menu-item:hover {
        box-shadow: 0 0.3em 0.6em rgba(255, 255, 255, 0.18);
    }
    
    .menu-link {
        padding: var(--sidebar-spacing-md) var(--sidebar-spacing-lg);
        min-height: 3em;
    }
    
    .menu-chevron {
        padding: var(--sidebar-spacing-md) var(--sidebar-spacing-lg);
        min-width: 3em;
        min-height: 3em;
    }
    
    .sidebar-submenu-item a {
        gap: var(--menu-icon-text-gap);
        padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
    }
}

/* === BREAKPOINT 3: Petits écrans (<= 37.5em / ~600px) === */
@media (max-width: 37.5em) {
    :root {
        --sidebar-font-size-base: clamp(0.75rem, 1.5vw + 0.3rem, 0.9rem);
        --sidebar-font-size-sm: clamp(0.7rem, 1.4vw + 0.25rem, 0.8rem);
        --sidebar-font-size-md: clamp(0.85rem, 1.6vw + 0.4rem, 1rem);
        --sidebar-font-size-lg: clamp(0.95rem, 1.7vw + 0.5rem, 1.1rem);
        --menu-icon-text-gap: 1.5%;
        --menu-text-chevron-gap: 1%;
    }
    
    .menu-item {
        border-width: 0.0625em;
    }
    
    .menu-link {
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm);
        min-height: 2em;
        gap: 1%;
    }
    
    .menu-icon {
        width: 1.2em;
        font-size: clamp(0.9rem, 1.5vw + 0.4rem, 1rem);
    }
    
    .menu-text {
        font-size: clamp(0.75rem, 1.5vw + 0.3rem, 0.85rem);
        max-width: 80%;
    }
    
    .menu-chevron {
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm);
        min-width: 2em;
        min-height: 2em;
        font-size: clamp(0.8rem, 1.4vw + 0.35rem, 0.95rem);
    }
    
    .sidebar-nav ul > li {
        margin-bottom: 0.25em;
        padding: 0.25em 0;
    }
    
    .sidebar-submenu {
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm);
        min-width: 70%;
    }
    
    .submenu-item-wrapper {
        padding: 0.125em;
    }
    
    .submenu-link {
        padding: 0.25em 0.5em;
        gap: 1%;
    }
}

/* Pour les écrans en dessous de 1440px : désactiver totalement le scroll dans la nav
   (garde la règle pour compatibilité, mais overflow est déjà visible ci‑dessus) */
@media (max-width: 1439px) {
    .sidebar {
        overflow: visible !important;
    }
    .sidebar-nav {
        overflow: visible !important;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    /* cacher définitivement la scrollbar (au cas où) */
    .sidebar-nav::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
}

/* === BREAKPOINT 4: Écrans portables (<= 75em / ~1200px) === */
@media (max-width: 75em) {
    .navbar-container {
        padding: var(--sidebar-spacing-md);
        font-size: 90%;
    }
    
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .menu-item {
        width: 100%;
        margin-bottom: var(--sidebar-spacing-sm);
        border-width: 0.0625em;
    }
    
    .menu-link {
        padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
        gap: 1.5%;
    }
    
    .menu-chevron {
        padding: var(--sidebar-spacing-sm) var(--sidebar-spacing-md);
        min-width: 2.5em;
    }
    
    .submenu {
        min-width: 90% !important;
        padding: var(--sidebar-spacing-md);
        top: 85%;
    }
    
    .sidebar {
        width: 30%;
        min-width: 30%;
        font-size: clamp(0.85rem, 1.2vw + 0.4rem, 0.95rem);
        padding-bottom: var(--sidebar-spacing-xl);
    }
    
    .sidebar-logo {
        gap: var(--space-sm);
        padding: 0;
        font-size: inherit;
    }
    
    .sidebar-nav {
        padding-top: var(--sidebar-spacing-md);
    }
    
    .sidebar-nav ul {
        width: 100%;
        margin: 0;
    }
    
    .sidebar-nav ul > li {
        margin-bottom: var(--sidebar-spacing-sm);
        padding: var(--sidebar-spacing-xs) 0;
    }
    
    .menu-text {
        font-size: clamp(0.85rem, 1.2vw + 0.4rem, 0.95rem);
    }
    
    .menu-badge {
        margin-left: var(--sidebar-spacing-xs);
        font-size: clamp(0.75rem, 1.1vw + 0.35rem, 0.85rem);
        padding: 0.25em 0.5em;
    }
    
    .sidebar-submenu {
        left: 100%;
        padding: var(--sidebar-spacing-md) var(--sidebar-spacing-lg);
        min-width: 80%;
        top: 10%;
    }
    
    .sidebar-submenu-item a {
        gap: var(--menu-icon-text-gap);
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-md);
        font-size: clamp(0.85rem, 1.2vw + 0.4rem, 0.95rem);
    }
    
    .sidebar-user {
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm) var(--sidebar-spacing-xs) var(--sidebar-spacing-xs);
        font-size: var(--sidebar-font-size-sm);
    }
    
    .header-navbar {
        left: 30%;
        width: 70%;
        height: var(--header-height);
        padding: 0 var(--sidebar-spacing-md);
    }
    
    .header-search {
        min-width: 40%;
        font-size: var(--sidebar-font-size-md);
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-sm);
    }
    
    .header-search input {
        font-size: var(--sidebar-font-size-md);
        width: 80%;
        padding: var(--sidebar-spacing-xs);
    }
    
    .header-actions {
        gap: var(--sidebar-spacing-sm);
    }
    
    .header-btn {
        padding: var(--sidebar-spacing-sm);
        font-size: var(--sidebar-font-size-lg);
    }
    
    .header-btn .notif-dot {
        width: 0.5em;
        height: 0.5em;
    }
    
    .header-user {
        padding: var(--sidebar-spacing-xs) var(--sidebar-spacing-md) var(--sidebar-spacing-xs) var(--sidebar-spacing-xs);
        font-size: var(--sidebar-font-size-md);
    }
    
    .header-avatar {
        width: 2em;
        height: 2em;
        font-size: var(--sidebar-font-size-lg);
        margin-right: var(--sidebar-spacing-sm);
    }
    
    .header-username {
        font-size: var(--sidebar-font-size-md);
    }
    
    #agencyModal.sidebar-submenu {
        min-width: 40%;
        max-height: 50%;
        padding: var(--sidebar-spacing-md);
    }
}