:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --sidebar-bg: #1a1d2e;
    --sidebar-hover: #252837;
    --sidebar-active: #2563eb;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --transition-speed: 0.3s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --fab-size: 44px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1039;
    opacity: 0;
    transition: opacity var(--transition-speed) var(--transition-ease);
}

.sidebar-overlay.visible {
    opacity: 1;
}

.pro-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    transition: transform var(--transition-speed) var(--transition-ease),
    width var(--transition-speed) var(--transition-ease);
    z-index: 1040;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform, width;
}

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

.sidebar-header {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 70px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.sidebar-title {
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.pro-sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-track { background: transparent; }
.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-section-title {
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1.5rem 1.25rem 0.5rem;
    white-space: nowrap;
    transition: opacity var(--transition-speed);
}

.pro-sidebar.collapsed .menu-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.menu-item {
    margin: 0.2rem 0.5rem;
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    gap: 1rem;
}

.menu-link:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

.menu-link.active {
    background: var(--sidebar-active);
    color: var(--text-primary);
}

.menu-icon {
    width: 20px;
    height: 20px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-text {
    flex: 1;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.pro-sidebar.collapsed .menu-text { opacity: 0; width: 0; overflow: hidden; }

.menu-badge {
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.45rem;
    border-radius: 12px;
    font-weight: 700;
    white-space: nowrap;
}

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

.menu-arrow {
    font-size: 0.8rem;
    transition: transform var(--transition-speed);
}

.menu-link.expanded .menu-arrow { transform: rotate(90deg); }
.pro-sidebar.collapsed .menu-arrow { display: none; }

.menu-tooltip {
    position: absolute;
    left: calc(100% + 10px);
    top: 0;
    transform: scale(0.96);
    transform-origin: left top;
    background: #22263d;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 10px;
    white-space: nowrap;
    min-width: 170px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1050;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.menu-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 16px;
    border: 6px solid transparent;
    border-right-color: #22263d;
}

.menu-tooltip-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.9rem;
}

.menu-tooltip-icon {
    width: 28px;
    height: 28px;
    background: var(--sidebar-active);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.menu-tooltip-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.menu-tooltip-badge {
    background: #ef4444;
    color: white;
    font-size: 0.62rem;
    padding: 0.1rem 0.42rem;
    border-radius: 10px;
    font-weight: 700;
}

.menu-tooltip-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 0;
}

.menu-tooltip-children {
    list-style: none;
    padding: 0.35rem 0;
    margin: 0;
}

.menu-tooltip-children li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.45rem 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    transition: background 0.15s, color 0.15s;
}

.menu-tooltip-children li a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.menu-tooltip-children li a i {
    font-size: 0.85rem;
    opacity: 0.7;
}

.pro-sidebar.collapsed .menu-item:hover .menu-tooltip {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease;
}

.submenu.expanded { max-height: 800px; }

.submenu .menu-link {
    padding-left: 3rem;
    font-size: 0.9rem;
}

.pro-sidebar.collapsed .submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--sidebar-bg);
    min-width: 200px;
    border-radius: 8px;
    margin-left: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    max-height: 0;
    padding: 0;
    overflow: hidden;
    transition: max-height 0.2s ease, padding 0.2s ease;
}

.pro-sidebar.collapsed .menu-item:hover > .submenu {
    max-height: 600px;
    padding: 0.5rem 0;
}

.pro-sidebar.collapsed .submenu .menu-link { padding-left: 1rem; }

.sidebar-toggle {
    position: fixed;
    left: calc(var(--sidebar-width) - 20px);
    top: 20px;
    width: 40px;
    height: 40px;
    background: var(--sidebar-bg);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left var(--transition-speed) var(--transition-ease),
    background 0.2s, transform 0.2s;
    z-index: 1041;
}

.pro-sidebar.collapsed ~ .sidebar-toggle {
    left: calc(var(--sidebar-collapsed-width) - 20px);
}

.sidebar-toggle:hover {
    background: var(--sidebar-active);
    transform: scale(1.1);
}

.fab-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    width: var(--fab-size);
    height: var(--fab-size);
    background: var(--sidebar-bg);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.25rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1042;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: background 0.2s, transform 0.15s;
}

.fab-toggle:hover { background: var(--sidebar-active); transform: scale(1.05); }
.fab-toggle:active { transform: scale(0.95); }

.page-wrapper {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-speed) var(--transition-ease);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.pro-sidebar.collapsed ~ .sidebar-toggle ~ .page-wrapper,
.pro-sidebar.collapsed ~ .page-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.75rem;
    height: var(--header-height, 64px);
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

.header-page-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1d2e;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 0.72rem;
    color: #94a3b8;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    margin: 0 0.4rem;
    color: #cbd5e1;
    font-size: 0.7rem;
}

.breadcrumb-item a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-item a:hover { color: var(--sidebar-active); }

.breadcrumb-item a i {
    font-size: 0.72rem;
    margin-right: 3px;
}

.breadcrumb-item--active span {
    color: #1a1d2e;
    font-weight: 600;
    cursor: default;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.header-action-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.header-action-btn:hover {
    background: #f1f5f9;
    color: #1a1d2e;
}

.header-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;


}

.header-badge:empty { display: none; }

.header-separator {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    margin: 0 4px;
    flex-shrink: 0;
}

.page-body {
    flex: 1;
    padding: 1.75rem;
    min-height: 0;
}

.page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.9rem 1.75rem;
    background: #ffffff;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.footer-left { flex: 1; min-width: 160px; }

.footer-copy {
    font-size: 0.78rem;
    color: #94a3b8;
}

.footer-copy strong {
    color: #64748b;
    font-weight: 600;
}

.footer-center { flex-shrink: 0; }

.footer-version {
    font-size: 0.72rem;
    color: #cbd5e1;
    font-family: monospace;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.footer-right { flex: 1; display: flex; justify-content: flex-end; }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0;
}

.footer-links li { display: flex; align-items: center; }

.footer-links li + li::before {
    content: '·';
    margin: 0 0.5rem;
    color: #cbd5e1;
    font-size: 0.8rem;
}

.footer-links a {
    font-size: 0.78rem;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.15s;
}

.footer-links a:hover { color: var(--sidebar-active); }

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.sidebar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin: 0.5rem 0.5rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
    flex-shrink: 0;
}

.sidebar-user:hover { background: var(--sidebar-hover); }

.sidebar-user.open {
    background: rgba(37, 99, 235, 0.15);
    border-color: rgba(37, 99, 235, 0.3);
}

.user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--sidebar-active);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.user-avatar--sm {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 0.75rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.pro-sidebar.collapsed .user-info { opacity: 0; width: 0; overflow: hidden; }

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-chevron {
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.25s var(--transition-ease), opacity var(--transition-speed);
    flex-shrink: 0;
}

.sidebar-user.open .user-chevron { transform: rotate(180deg); }
.pro-sidebar.collapsed .user-chevron { opacity: 0; width: 0; overflow: hidden; }

.user-dropdown-portal {
    position: fixed;
    z-index: 2000;
    background: #22263d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
    min-width: 220px;
    overflow: hidden;


    opacity: 0;
    pointer-events: none;
    transform: translateY(6px) scale(0.98);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.user-dropdown-portal.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.8rem 1rem;
}

.user-dropdown-identity {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.user-dropdown-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-email {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

.user-dropdown-menu {
    list-style: none;
    padding: 0.35rem 0;
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.user-dropdown-item i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.user-dropdown-item--danger { color: #f87171; }
.user-dropdown-item--danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

@media (min-width: 768px) and (max-width: 991px) {
    .pro-sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar-title,
    .menu-text,
    .menu-badge,
    .menu-arrow,
    .menu-section-title,
    .user-info,
    .user-chevron { opacity: 0; width: 0; height: 0; padding: 0; overflow: hidden; }

    .menu-section-title { margin: 0; }

    .sidebar-toggle {
        left: calc(var(--sidebar-collapsed-width) - 20px);
        display: none;
    }


    .page-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }


    .header-page-title { display: none; }

    .menu-item:hover .menu-tooltip {
        opacity: 1;
        pointer-events: auto;
        transform: scale(1);
    }

    .submenu {
        position: absolute;
        left: 100%;
        top: 0;
        background: var(--sidebar-bg);
        min-width: 200px;
        border-radius: 8px;
        margin-left: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        max-height: 0;
        padding: 0;
    }

    .menu-item:hover > .submenu {
        max-height: 600px;
        padding: 0.5rem 0;
    }

    .submenu .menu-link { padding-left: 1rem; }


    .user-dropdown {
        left: calc(100% + 10px);
        right: auto;
        bottom: 0;
        min-width: 220px;
        transform-origin: bottom left;
    }
}

@media (max-width: 767px) {

    .sidebar-toggle { display: none !important; }


    .fab-toggle { display: flex; }


    .pro-sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);

        transition: transform var(--transition-speed) var(--transition-ease);
    }


    .pro-sidebar.mobile-open {
        transform: translateX(0);
    }


    .sidebar-overlay {
      /*display: block;*/
    }


    .page-wrapper {
        margin-left: 0;
    }


    .page-body {
        padding: 1rem;
        padding-top: calc(var(--fab-size) + 20px);
    }


    .page-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.4rem;
        padding: 0.85rem 1rem;
    }

    .footer-left,
    .footer-right { flex: none; }

    .footer-right { justify-content: center; }


    .page-header {
        padding: 0 1rem;
        height: 56px;
    }

    .submenu {
        position: static;
        margin-left: 0;
        box-shadow: none;
        background: transparent;
    }

    .submenu.expanded { max-height: 800px; }
    .submenu .menu-link { padding-left: 3rem; }
    .menu-tooltip { display: none; }
}
