/* App layout */
.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100dvh;
}

/* Sidebar */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-6) 0;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

.sidebar-logo svg {
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-logo-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.sidebar-bottom {
    margin-top: auto;
    padding: var(--space-4) var(--space-3) 0;
    border-top: 1px solid var(--border);
}

/* Nav items */
.nav-section {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 0 var(--space-2) var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-dim);
    color: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
}

/* Main content */
.main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-8);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-size: var(--text-base);
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.content {
    padding: var(--space-8);
    flex: 1;
}

/* Auth gate */
.auth-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background: var(--bg);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-10);
    width: min(420px, 90vw);
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.auth-logo-text {
    font-size: var(--text-lg);
    font-weight: 700;
}

.auth-logo-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.auth-card h2 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.auth-card p {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
}

/* Responsive */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        bottom: 0;
        z-index: 50;
        width: 220px;
        height: 100dvh;
        transition: left var(--transition);
    }

    .sidebar.open {
        left: 0;
    }

    .content {
        padding: var(--space-4);
    }

    .topbar {
        padding: var(--space-4);
    }

    #mobile-menu-btn {
        display: flex !important;
    }
}