.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 5;
    overflow: hidden;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 4px 8px 16px;
}

.brand div {
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.brand strong {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.brand span {
    color: var(--muted);
    font-size: 0.78rem;
}

.brand-mark {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--accent);
}

.workspace-name {
    margin: 0 10px 14px;
    color: var(--muted);
    font-size: 0.82rem;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.nav-link {
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.is-active {
    background: var(--bg-elev);
    color: var(--text);
}

.sidebar-foot {
    margin-top: auto;
    display: grid;
    gap: 2px;
    padding-top: 12px;
}

.sidebar-setup {
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.sidebar-foot form {
    margin: 0;
}

.sidebar-foot .btn {
    justify-content: flex-start;
    width: 100%;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    text-align: left;
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 28px 0;
}

.topbar-start,
.topbar-end {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar .brand {
    padding: 0;
}

.brand-inline {
    color: inherit;
}

.topbar-context {
    color: var(--text);
    font-weight: 500;
    font-size: 13px;
}

.user-chip {
    color: var(--muted);
    font-size: 0.78rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content {
    padding: 22px 28px 56px;
}

.nav-toggle,
.nav-button,
.nav-scrim {
    display: none;
}

@media (max-width: 860px) {
    .nav-button {
        display: inline-flex;
        width: 34px;
        height: 34px;
        border-radius: 8px;
        border: 1px solid var(--line);
        align-items: center;
        justify-content: center;
        background: transparent;
    }

    .nav-button span,
    .nav-button span::before,
    .nav-button span::after {
        display: block;
        width: 16px;
        height: 1.5px;
        background: var(--text);
        position: relative;
    }

    .nav-button span::before,
    .nav-button span::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .nav-button span::before { top: -5px; }
    .nav-button span::after { top: 5px; }

    .sidebar {
        position: fixed;
        z-index: 20;
        background: var(--bg-sidebar);
        transform: translateX(-105%);
        transition: transform 0.18s ease;
    }

    .nav-toggle:checked ~ .shell .sidebar {
        transform: none;
    }

    .nav-toggle:checked ~ .shell .nav-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 15;
        cursor: pointer;
    }

    .content,
    .topbar {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
}
