:root {
    --cms-bg: #0b1020;
    --cms-bg-soft: #11182b;
    --cms-panel: #151d31;
    --cms-panel-soft: #1a243b;
    --cms-border: rgba(255, 255, 255, 0.08);
    --cms-text: #f5f7ff;
    --cms-text-soft: #9aa6bd;
    --cms-primary: #4f7cff;
    --cms-primary-hover: #6b91ff;
    --cms-danger: #ff5f6d;
    --cms-radius: 18px;
    --cms-sidebar-width: 280px;
    --cms-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--cms-bg);
}

body.cms-body {
    margin: 0;
    min-height: 100vh;
    color: var(--cms-text);
    background:
        radial-gradient(
            circle at top right,
            rgba(79, 124, 255, 0.10),
            transparent 32%
        ),
        var(--cms-bg);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.cms-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--cms-sidebar-width) minmax(0, 1fr);
}

.cms-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--cms-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(12, 17, 31, 0.96);
    border-right: 1px solid var(--cms-border);
    backdrop-filter: blur(18px);
}

.cms-sidebar-header {
    min-height: 86px;
    padding: 18px 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--cms-border);
}

.cms-logo {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--cms-text);
    text-decoration: none;
}

.cms-logo-mark {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background:
        linear-gradient(
            135deg,
            #5c84ff,
            #315bd8
        );
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(79, 124, 255, 0.28);
}

.cms-logo-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cms-logo-text strong {
    font-size: 1rem;
    line-height: 1.1;
}

.cms-logo-text small {
    max-width: 150px;
    overflow: hidden;
    color: var(--cms-text-soft);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-sidebar-close {
    display: none;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    color: var(--cms-text);
    background: rgba(255, 255, 255, 0.06);
    font-size: 1.5rem;
    cursor: pointer;
}

.cms-navigation {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
}

.cms-navigation-group + .cms-navigation-group {
    margin-top: 24px;
}

.cms-navigation-title {
    display: block;
    margin: 0 10px 8px;
    color: #6f7b93;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cms-navigation-link {
    position: relative;
    min-height: 46px;
    margin-top: 5px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: 13px;
    color: #b7c1d4;
    text-decoration: none;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.cms-navigation-link:hover {
    color: var(--cms-text);
    background: rgba(255, 255, 255, 0.055);
    transform: translateX(2px);
}

.cms-navigation-link.is-active {
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            rgba(79, 124, 255, 0.28),
            rgba(79, 124, 255, 0.12)
        );
    box-shadow: inset 0 0 0 1px rgba(106, 145, 255, 0.20);
}

.cms-navigation-icon {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.055);
    font-weight: 800;
}

.cms-navigation-badge {
    margin-left: auto;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: #ffffff;
    background: var(--cms-primary);
    font-size: 0.74rem;
    font-weight: 800;
}

.cms-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--cms-border);
}

.cms-sidebar-user {
    min-width: 0;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 11px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
}

.cms-sidebar-user img,
.cms-topbar-user img {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.10);
    border-radius: 50%;
    background: var(--cms-panel-soft);
}

.cms-sidebar-user div,
.cms-topbar-user div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cms-sidebar-user strong,
.cms-topbar-user strong {
    overflow: hidden;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cms-sidebar-user span,
.cms-topbar-user span {
    color: var(--cms-text-soft);
    font-size: 0.76rem;
}

.cms-logout-link {
    margin-top: 10px;
    min-height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #ff9ca5;
    background: rgba(255, 95, 109, 0.09);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 700;
    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.cms-logout-link:hover {
    color: #ffffff;
    background: rgba(255, 95, 109, 0.18);
}

.cms-main {
    min-width: 0;
    grid-column: 2;
    display: flex;
    flex-direction: column;
}

.cms-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 86px;
    padding: 14px clamp(18px, 3vw, 36px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--cms-border);
    background: rgba(11, 16, 32, 0.82);
    backdrop-filter: blur(18px);
}

.cms-topbar-left,
.cms-topbar-right {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cms-menu-button {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--cms-border);
    border-radius: 13px;
    color: var(--cms-text);
    background: rgba(255, 255, 255, 0.04);
    font-size: 1.2rem;
    cursor: pointer;
}

.cms-page-heading {
    min-width: 0;
}

.cms-page-heading span {
    display: block;
    margin-bottom: 3px;
    color: var(--cms-text-soft);
    font-size: 0.75rem;
    font-weight: 700;
}

.cms-page-heading h1 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: clamp(1.15rem, 2vw, 1.55rem);
    line-height: 1.15;
}

.cms-topbar-notification {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--cms-border);
    border-radius: 13px;
    color: var(--cms-text);
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.cms-topbar-notification strong {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #ffffff;
    background: var(--cms-primary);
    font-size: 0.65rem;
}

.cms-topbar-user {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cms-content {
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    padding: clamp(18px, 3vw, 36px);
    flex: 1;
}

.cms-footer {
    min-height: 68px;
    padding: 18px clamp(18px, 3vw, 36px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--cms-border);
    color: var(--cms-text-soft);
    font-size: 0.8rem;
}

.cms-footer p {
    margin: 0;
}

.cms-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(3px);
}

.cms-overlay.is-visible {
    display: block;
}

@media (max-width: 1023px) {
    .cms-layout {
        display: block;
    }

    .cms-sidebar {
        width: min(88vw, 320px);
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: var(--cms-shadow);
    }

    .cms-sidebar.is-open {
        transform: translateX(0);
    }

    .cms-sidebar-close,
    .cms-menu-button {
        display: grid;
        place-items: center;
    }

    .cms-main {
        min-width: 0;
    }

    .cms-topbar {
        min-height: 76px;
    }
}

@media (max-width: 680px) {
    .cms-topbar {
        padding: 12px 14px;
    }

    .cms-content {
        padding: 16px 14px 24px;
    }

    .cms-topbar-user div {
        display: none;
    }

    .cms-topbar-notification {
        width: 40px;
        height: 40px;
    }

    .cms-footer {
        padding: 16px 14px;
        flex-direction: column;
        align-items: flex-start;
    }
}