/* ===== Site frame — centered narrow column (spaces-style) ===== */

:root {
    --site-frame: 1040px;
    --site-sidebar-w: 190px;
    --topbar-h: 58px;
    --bottom-nav-h: 65px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    background: #050208;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
}

.topbar {
    background: linear-gradient(180deg, #1a0829 0%, #120422 100%);
    border-bottom: 1px solid rgba(188, 19, 254, 0.15);
}

.site-shell {
    display: flex;
    align-items: flex-start;
    width: 100%;
    max-width: var(--site-frame);
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    background: rgba(11, 4, 18, 0.98);
}

.site-content {
    flex: 1;
    min-width: 0;
}

.site-content > main {
    display: block;
    min-width: 0;
    width: 100%;
}

/* ── Sidebar ── */
.site-sidebar {
    display: none;
    width: var(--site-sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 58px;
    align-self: flex-start;
    max-height: calc(100vh - 66px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 8px 14px 10px;
    border-right: 1px solid rgba(188, 19, 254, 0.12);
    background: rgba(14, 5, 24, 0.98);
}

.site-sidebar__head {
    padding: 0 8px 8px;
}

.site-sidebar__title {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42);
}

.site-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-sidebar__link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.86);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
    transition: background 0.15s ease;
}

.site-sidebar__link:hover {
    background: rgba(188, 19, 254, 0.09);
    color: #fff;
}

.site-sidebar__link.is-active {
    background: rgba(188, 19, 254, 0.16);
    border-color: rgba(188, 19, 254, 0.32);
    color: #fff;
}

.site-sidebar__icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    color: #d9b8ff;
    font-size: 12px;
}

.site-sidebar__link.is-active .site-sidebar__icon {
    background: linear-gradient(135deg, #8e24aa, #bc13fe);
    color: #fff;
}

@media (min-width: 1200px) {
    .site-shell {
        border-left: 1px solid rgba(188, 19, 254, 0.12);
        border-right: 1px solid rgba(188, 19, 254, 0.12);
        min-height: calc(100vh - var(--topbar-h));
    }

    .site-sidebar {
        display: block;
    }

    .site-content {
        padding: 10px 14px 24px 12px;
    }
}

@media (max-width: 1199px) {
    body {
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
        min-height: 100vh;
        padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
    }

    .topbar {
        flex-shrink: 0;
        width: 100%;
    }

    .topbar__frame {
        max-width: none;
        border: none !important;
    }

    .site-shell {
        flex: 1 0 auto;
        max-width: none;
        width: 100%;
        min-height: 0;
        background: transparent;
        border: none;
    }

    .site-content {
        width: 100%;
        max-width: 100%;
        padding: 0 12px 16px;
        overflow-x: clip;
    }

    .site-content > main {
        min-height: auto;
        overflow-x: clip;
    }

    .main-footer {
        flex-shrink: 0;
        width: 100%;
        margin-top: auto;
        position: relative;
        z-index: 1;
    }
}
