:root {
    --brand: #4338ca;
    --brand-dark: #3730a3;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Auth pages (login/signup) --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.auth-card h1 {
    font-size: 1.4rem;
    margin: 0 0 4px;
}

.auth-card .sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--brand);
    outline-offset: -1px;
}

.btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

.btn:hover { background: var(--brand-dark); text-decoration: none; }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.foot-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- App shell (post-login) --- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: #1e1b4b;
    color: #e0e7ff;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar .brand {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0 20px 20px;
    color: #fff;
}

.sidebar nav a {
    display: block;
    padding: 10px 20px;
    color: #c7d2fe;
    font-size: 0.9rem;
}

.sidebar nav a:hover, .sidebar nav a.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.main {
    flex: 1;
    padding: 32px;
}

.main h1 { margin-top: 0; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
