:root {
    --sidebar-width: 260px;
}

body {
    margin: 0;
}

.layout {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.layout-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    text-decoration: none;
    color: inherit;
    background: none;
    border: none;
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 0.4rem;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-shell {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid #e8e8e8;
    background: #fafafa;
    overflow: hidden;
    max-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
}

.sidebar-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding: 0.5rem 0.35rem;
    min-height: 2.75rem;
}

.sidebar-brand {
    font-weight: 700;
    text-decoration: none;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    padding-right: 0.35rem;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 0.75rem 2rem;
}

.sidebar-quick {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e8e8e8;
}

.sidebar-group {
    margin-bottom: 1.1rem;
}

.sidebar-group-title {
    margin: 0 0 0.35rem;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #888;
}

.sidebar-group-links {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.5rem;
    text-decoration: none;
    color: inherit;
    border-radius: 0.4rem;
    font-size: 0.92rem;
    line-height: 1.3;
}

.sidebar-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-link.is-active {
    background: rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

.sidebar-link-icon {
    flex-shrink: 0;
    width: 1.4em;
    text-align: center;
}

.sidebar-link-title {
    min-width: 0;
    word-break: break-word;
}

@media screen and (max-width: 767px) {
    .layout {
        display: block;
    }

    .layout-main {
        padding-top: 3rem;
    }

    /* closed: floating ≡ [+ potyk.io], content not shifted */
    .sidebar-shell {
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-height: none;
        height: auto;
        z-index: 50;
        border: none;
        background: transparent;
        overflow: visible;
        align-self: auto;
    }

    .sidebar-bar {
        padding: 0;
        min-height: 0;
        background: transparent;
        border-radius: 0;
    }

    body:not(.menu-open) .sidebar-nav {
        display: none;
    }

    /* open: full-screen overlay */
    body.menu-open {
        overflow: hidden;
    }

    body.menu-open .sidebar-shell {
        inset: 0;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        max-height: none;
        background: #fff;
        border: none;
        overflow: hidden;
        border-radius: 0;
    }

    body.menu-open .sidebar-bar {
        padding: 0.75rem 0.75rem 0.5rem;
        min-height: 2.75rem;
        border-bottom: 1px solid #e8e8e8;
        background: transparent;
        border-radius: 0;
    }

    body.menu-open .sidebar-nav {
        display: block;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem 1rem 3rem;
    }
}

@media screen and (min-width: 768px) {
    body.menu-collapsed .layout-main {
        padding-top: 3rem;
    }

    body.menu-collapsed .sidebar-shell {
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        width: auto;
        max-height: none;
        height: auto;
        z-index: 50;
        border: none;
        background: transparent;
        overflow: visible;
        align-self: auto;
    }

    body.menu-collapsed .sidebar-bar {
        padding: 0;
        min-height: 0;
        background: transparent;
        border-radius: 0;
    }

    body.menu-collapsed .sidebar-nav {
        display: none;
    }
}
