/* ============================================
   🍔 APP SIDEBAR OFFCANVAS - NUOVO MENU
   Non usa .navbar, non usa .main-content,
   non sposta calendario/grafici/widget.
   ============================================ */

.app-topbar {
    min-height: 54px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1040;
    background: #fff;
}

.app-sidebar-toggle:hover {
    background: #f8f9fa;
}

.app-sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 0.15rem rgba(13,110,253,.25);
}

.app-sidebar-toggler-line {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(33,37,41,0.75);
    border-radius: 2px;
}


.app-sidebar-wrapper {
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: none;
}

.app-sidebar-wrapper.open {
    pointer-events: auto;
}

.app-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 3001;
}

.app-sidebar-wrapper.open .app-sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 315px;
    max-width: 86vw;
    height: 100vh;
    background: #fff;
    z-index: 3002;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 18px rgba(0,0,0,0.18);
    border-right: 1px solid #e9ecef;
}

.app-sidebar-wrapper.open .app-sidebar {
    transform: translateX(0);
}

body.app-sidebar-open {
    overflow: hidden;
}

.app-sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: #faf5ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-sidebar-user-info {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.app-sidebar-nav {
    padding: 0.5rem 0 1rem;
}

.app-sidebar-link,
.app-sidebar-sublink,
.app-sidebar-nested-link {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    text-align: left;
    color: #495057;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    border-left: 4px solid transparent;
}

.app-sidebar-link {
    padding: 0.72rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
}

.app-sidebar-sublink {
    padding: 0.62rem 1.25rem 0.62rem 2.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.app-sidebar-nested-link {
    padding: 0.55rem 1.25rem 0.55rem 3.7rem;
    font-weight: 500;
    font-size: 0.86rem;
}

.app-sidebar-link:hover,
.app-sidebar-sublink:hover,
.app-sidebar-nested-link:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.app-sidebar-link.active {
    background: #f8f9fa;
    color: #495057;
    border-left-color: #7b2cbf;
}

.app-sidebar-sublink.active,
.app-sidebar-nested-link.active {
    background: #ffe7e7;
    color: #dc3545;
    border-left-color: #dc3545;
    font-weight: 700;
}

.app-sidebar-menu-button {
    cursor: pointer;
}

.app-sidebar-chevron {
    transition: transform 0.2s ease;
    font-size: 0.9rem;
}

.app-sidebar-menu-button[aria-expanded="true"] .app-sidebar-chevron {
    transform: rotate(180deg);
}

.app-sidebar-submenu,
.app-sidebar-submenu-nested {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.app-sidebar-submenu.open {
    max-height: 900px;
}

.app-sidebar-submenu-nested.open {
    max-height: 300px;
}

.app-sidebar-divider {
    height: 1px;
    background: #e9ecef;
    margin: 0.65rem 1rem;
}

.app-sidebar-section-title {
    padding: 0.4rem 1.25rem;
    font-size: 0.72rem;
    font-weight: 800;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 576px) {
    .app-sidebar {
        width: 86vw;
    }
}

/* ============================================
   🍔 TOPBAR SIDEBAR
   ============================================ */

.app-sidebar-topbar {
    min-height: 58px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 1042;
}

.app-sidebar-topbar-inner {
    min-height: 58px;
    width: 100%;
    display: grid;
    grid-template-columns: 52px 1fr 52px;
    align-items: center;
    padding-left: 2rem;
    padding-right: 2rem;
}

.app-sidebar-topbar-left{
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.app-sidebar-topbar-center{
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.app-sidebar-topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.app-sidebar-brand {
    font-weight: 800;
    color: #0d6efd;
    text-decoration: none;
    white-space: nowrap;
}

.app-sidebar-brand:hover {
    color: #0a58ca;
}

/* Hamburger stile Bootstrap */
.app-sidebar-toggle {
    width: 42px;
    height: 38px;
    padding: 6px 8px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 0.375rem;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.app-sidebar-toggle:hover {
    background: #f8f9fa;
}

.app-sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 0.15rem rgba(13,110,253,.25);
}

.app-sidebar-toggler-line {
    display: block;
    width: 22px;
    height: 2px;
    background: rgba(33,37,41,0.75);
    border-radius: 2px;
}

/* Notifiche */
.app-sidebar-notif-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 0.375rem;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.app-sidebar-notif-btn:hover {
    background: #e9ecef;
}