:root {
    --bg: #0f172a;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #eef2ff;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 80% -10%, #e0e7ff 0%, transparent 60%),
        var(--surface-alt);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.brand {
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    color: var(--text);
}
.nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.nav a {
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
}
.nav a:hover { color: var(--text); }
.nav-user {
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Layout */
.main-content {
    flex: 1;
    padding: 2.5rem 1.25rem;
}
.hero { margin-bottom: 2rem; }
.hero h1 { font-size: 2rem; margin: 0 0 0.35rem; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.card-header h2 { font-size: 1.15rem; margin: 0; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat { display: flex; flex-direction: column; gap: 0.35rem; }
.stat-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.25rem; font-weight: 700; }

/* Auth cards */
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 420px;
    margin: 2rem auto;
}
.auth-card h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }

/* Forms */
form label, .form-row label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 1rem 0 0.4rem;
}
input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: var(--surface-alt);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
    background: #fff;
}
.form-row ul { color: var(--danger); font-size: 0.85rem; margin: 0.4rem 0 0; padding-left: 1.1rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-block { width: 100%; margin-top: 1.5rem; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table thead th {
    text-align: left;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 0.75rem; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Flash */
.flash {
    padding: 0.85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}
.flash-error, .flash-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.flash-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }

/* Utilities */
.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
a { color: var(--primary-dark); }
