*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Page Layout */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Sidebar + Main Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: 260px;
    background: var(--secondary);
    color: var(--white);
    padding: var(--space-6) 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-brand {
    padding: 0 var(--space-6) var(--space-6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: var(--space-4);
}

.sidebar-brand h1 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--white);
}

.sidebar-brand span {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 0 var(--space-3);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--gray-300);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    font-size: var(--text-sm);
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: var(--white);
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-user {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
}

.sidebar-user-name {
    font-size: var(--text-sm);
    color: var(--gray-200);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-8);
    max-width: 1200px;
    min-width: 0;
    overflow-x: hidden;
}

.main-content.full-width {
    max-width: none;
}

/* Page Header */
.page-header {
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.page-header p {
    color: var(--gray-500);
    font-size: var(--text-base);
}

/* Auth Layout (login/signup) */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
    padding: var(--space-4);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--space-8);
    color: var(--white);
}

.auth-logo h1 {
    font-size: var(--text-3xl);
    font-weight: 800;
}

.auth-logo span {
    color: var(--accent);
}

.auth-logo p {
    color: var(--gray-300);
    margin-top: var(--space-2);
    font-size: var(--text-sm);
}

.auth-tagline {
    font-size: var(--text-xl) !important;
    font-weight: 600;
    color: var(--white) !important;
    margin-top: var(--space-3) !important;
}

.auth-subtitle {
    font-size: var(--text-sm) !important;
    color: var(--gray-400) !important;
    margin-top: var(--space-1) !important;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
}

.auth-tabs {
    display: flex;
    margin-bottom: var(--space-6);
    border-bottom: 2px solid var(--gray-200);
}

.auth-tab {
    flex: 1;
    padding: var(--space-3);
    text-align: center;
    font-weight: 600;
    color: var(--gray-400);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: var(--text-base);
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 200;
    background: var(--secondary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}
