:root {
    --admin-green: #2f961b;
    --admin-green-dark: #267b17;
    --admin-sidebar: #151d2b;
    --admin-sidebar-hover: #202c3d;
    --admin-text: #263238;
    --admin-muted: #75818d;
    --admin-border: #e4e9ee;
    --admin-page-bg: #f4f6f8;
    --admin-topbar-height: 50px;
    --admin-sidebar-width: 272px;
}

html,
body {
    min-height: 100%;
}

body {
    background: var(--admin-page-bg);
    color: var(--admin-text);
}
.admin-layout {
    min-height: 100vh;
}

/* Верхняя панель */
.admin-topbar {
    position: fixed !important;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    height: var(--admin-topbar-height);
    padding: 0 24px;
    background: var(--admin-green) !important;
    box-shadow: 0 2px 10px rgb(20 50 15 / 16%);
}

.admin-brand {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 14px;
}

.admin-brand-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.admin-logo {
    display: block;
    width: auto;
    max-width: 220px;
    max-height: 48px;
}

.admin-topbar-right {
    position: absolute;
    top: 0;
    right: 24px;
    display: flex;
    align-items: center;
    height: 100%;
    color: rgb(255 255 255 / 82%);
    font-size: 13px;
}

.admin-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 30%);
    border-radius: 10px;
    background: rgb(255 255 255 / 10%);
    color: #fff;
    cursor: pointer;
}

.admin-menu-toggle .mdi {
    font-size: 23px;
}

/* Боковое меню */
.admin-sidebar {
    position: fixed !important;
    z-index: 900;
    top: var(--admin-topbar-height);
    bottom: 0;
    left: 0;
    width: var(--admin-sidebar-width);
    overflow-y: auto;
    padding-top: 0;
    background: var(--admin-sidebar) !important;
    box-shadow: 3px 0 14px rgb(12 20 32 / 8%);
    transition: transform 220ms ease;
}

.admin-sidebar .scroll-sidebar {
    height: 100%;
    overflow-y: auto;
}

.admin-sidebar #sidebarnav {
    margin: 0;
    padding: 7px 6px 14px;
    list-style: none;
}

.admin-sidebar .nav-small-cap {
    padding: 13px 14px 9px;
    color: #8d9aab;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.admin-sidebar .sidebar-item {
    margin: 3px 0;
}

.admin-sidebar .sidebar-link {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 10px 14px;
    border: 0 !important;
    border-radius: 9px;
    color: #c2cbd6 !important;
    font-size: 14px;
    line-height: 1.35;
    text-decoration: none;
    opacity: 1;
    transition: color 150ms ease, background 150ms ease;
}

.admin-sidebar .sidebar-link:hover,
.admin-sidebar .sidebar-link:focus-visible {
    outline: none;
    background: var(--admin-sidebar-hover);
    color: #fff !important;
}

.admin-sidebar .sidebar-link .mdi {
    flex: 0 0 24px;
    margin-right: 10px;
    color: #aeb8c5;
    font-size: 21px;
    text-align: center;
}

.admin-sidebar .sidebar-link:hover .mdi {
    color: #fff;
}

/* Основная область и футер */
.admin-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--admin-topbar-height));
    margin-top: var(--admin-topbar-height) !important;
    margin-left: var(--admin-sidebar-width) !important;
    padding: 0;
    background: var(--admin-page-bg);
}

.admin-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid var(--admin-border);
    background: transparent !important;
    color: var(--admin-muted);
    font-size: 13px;
    text-align: left;
}

/* Затемнение за мобильным меню */
.admin-sidebar-overlay {
    display: none;
}

/* Планшеты и телефоны */
@media (max-width: 900px) {
    :root {
        --admin-topbar-height: 50px;
    }

    .admin-topbar {
        padding-right: 10px;
        padding-left: 10px;
    }

    .admin-menu-toggle {
        display: inline-flex;
        width: 38px;
        height: 38px;
        border-radius: 8px;
    }

    .admin-topbar-right {
        right: 10px;
    }

     .admin-sidebar {
        position: fixed !important;
        top: var(--admin-topbar-height) !important;
        right: auto !important;
        bottom: 0 !important;
        left: -110vw !important;

        width: min(300px, calc(100vw - 32px)) !important;
        max-width: calc(100vw - 32px) !important;
        box-sizing: border-box !important;

        transform: none !important;
        transition: left 220ms ease !important;
        z-index: 1200 !important;
    }

    body.admin-menu-open .admin-sidebar {
        left: 0 !important;
        transform: none !important;
    }

    .admin-sidebar-overlay {
        position: fixed !important;
        z-index: 1100 !important;
        inset: var(--admin-topbar-height) 0 0 !important;
    }

    body.admin-menu-open .admin-sidebar-overlay {
        visibility: visible;
        opacity: 1;
    }

    .admin-page {
        margin-left: 0 !important;
        padding: 8px 8px 0;
    }
	
	.admin-sidebar {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        max-height: none !important;
        overflow: hidden !important;
        overscroll-behavior: contain;
    }

    .admin-sidebar .scroll-sidebar {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: calc(100vh - var(--admin-topbar-height)) !important;
        max-height: calc(100dvh - var(--admin-topbar-height)) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Узкие телефоны */
@media (max-width: 520px) {
    :root {
        --admin-topbar-height: 50px;
    }

    .admin-logo {
        max-width: 150px;
        max-height: 38px;
    }

    .admin-topbar-caption {
        display: none;
    }

    .admin-page {
        padding: 6px 6px 0;
    }

    .admin-footer {
        flex-direction: column;
        gap: 4px;
        padding: 14px 0;
        font-size: 12px;
    }
}

/* Уважение настройки сокращения анимации */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
