/* Application shell: sidebar, top bar, content area, and the guest layout. */

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100dvh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: var(--topbar-h);
    padding: 0 var(--sp-4);
    color: var(--sidebar-text-active);
    font-weight: 600;
    font-size: var(--fs-lg);
    letter-spacing: 0.01em;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--r-md);
    background: var(--accent);
    color: var(--text-inverse);
    font-size: var(--fs-sm);
    font-weight: 700;
}

.nav {
    padding: var(--sp-2);
    list-style: none;
}

.nav__heading {
    padding: var(--sp-4) var(--sp-3) var(--sp-1);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    color: inherit;
    text-decoration: none;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.nav__link:hover {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.nav__link[aria-current="page"] {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    font-weight: 500;
}

.nav__link .icon { opacity: 0.85; }

.sidebar__footer {
    margin-top: auto;
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--fs-xs);
    opacity: 0.6;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: var(--topbar-h);
    padding: 0 var(--sp-5);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__title {
    font-size: var(--fs-lg);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__spacer { flex: 1; }

.btn.sidebar-toggle { display: none; }

.content {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--sp-5);
    flex: 1;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}

.page-header__title { font-size: var(--fs-2xl); }
.page-header__subtitle { color: var(--text-muted); margin-top: var(--sp-1); }

.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    .app { grid-template-columns: minmax(0, 1fr); }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 40;
        width: min(var(--sidebar-w), 85vw);
        transform: translateX(-100%);
        transition: transform var(--dur);
        visibility: hidden;
    }

    .app[data-sidebar="open"] .sidebar {
        transform: none;
        visibility: visible;
        box-shadow: var(--shadow-2);
    }

    .app[data-sidebar="open"] .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgb(0 0 0 / 0.45);
        border: 0;
        padding: 0;
    }

    .btn.sidebar-toggle { display: inline-flex; }
    .topbar { padding: 0 var(--sp-3); }
    .content { padding: var(--sp-4) var(--sp-3); }
    .page-header__title { font-size: var(--fs-xl); }
}

/* Guest layout (login, password reset, error pages). */

.guest {
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: var(--sp-5) var(--sp-4);
}

.guest__panel {
    width: 100%;
    max-width: 26rem;
}

.guest__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.guest__footer {
    margin-top: var(--sp-5);
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--text-muted);
}

.error-code {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-text);
    letter-spacing: -0.02em;
}
