.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg-app);
    color: var(--text-primary);
}

body.auth { }
body.unauth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-app);
}
body.unauth main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    width: 100%;
}

body.auth {
    padding-left: 260px;
}

/* content wrapper */
.content-wrapper { width: 100%; }
body.unauth .content-wrapper {
    width: auto;
    max-width: 960px;
    margin: 0 auto;
}

aside.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--bg-surface-1);
    border-right: 1px solid var(--border-color);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.sidebar .logo-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar .logo-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar .logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar .user-section {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar .sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    transition: all 0.2s;
}
.sidebar .sidebar-link:hover { background: var(--row-hover-soft); color: var(--text-primary); }
.sidebar .sidebar-link.active { background: var(--row-selected-soft); color: var(--text-primary); }

.sidebar nav {
    flex: 1;
    overflow-y: auto;
}

main.content {
    flex: 1;
    margin-left: 0;
    padding: 24px;
    width: 100%;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-surface-1) 0%, rgba(115, 2, 255, 0.08) 100%);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.header-bar {
    background: var(--bg-surface-1);
    border-bottom: var(--border-width) solid var(--border-color);
    backdrop-filter: blur(6px);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-content {
    background: var(--bg-surface-1);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
}

/* Theme switch */
.theme-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin: 12px 16px;
    border-radius: 10px;
    background: var(--surface-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #4b5563;
    transition: 0.3s;
    border-radius: 999px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
input:checked + .slider {
    background-color: var(--primary);
}
input:checked + .slider:before {
    transform: translateX(20px);
}
