:root {
    --bg: #0f172a;
    --bg-elev: #1e293b;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ============ AUTH PAGES ============ */
.auth-body {
    background: radial-gradient(circle at 20% 20%, #1e293b, #0f172a 60%);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
}
.auth-wrapper { width: 100%; max-width: 440px; }
.auth-brand { text-align: center; margin-bottom: 32px; }
.brand-logo {
    font-size: 28px; font-weight: 800; color: #fff;
    letter-spacing: -.02em; margin-bottom: 8px;
}
.brand-tagline { color: #94a3b8; font-size: 13px; }
.auth-card {
    background: #fff; border-radius: 20px;
    padding: 36px; box-shadow: var(--shadow-lg);
}
.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.auth-footer { text-align: center; color: #64748b; font-size: 12px; margin-top: 24px; }
.auth-link { color: var(--primary); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.form-row-between {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; font-size: 13px;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-muted); }
.checkbox-label input { accent-color: var(--primary); }

/* ============ FORMS ============ */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-weight: 600; margin-bottom: 6px;
    font-size: 13px; color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 14px;
    transition: all .15s ease; background: #fff;
    color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.form-group input:disabled { background: #f8fafc; color: var(--text-muted); cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 11px 20px; border: none; border-radius: 10px;
    font-weight: 600; font-size: 14px; transition: all .15s ease;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary); color: #fff; width: 100%;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 8px 16px rgba(99,102,241,.3); }
.btn-primary:active { transform: translateY(0); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }

/* ============ ALERTS ============ */
.alert {
    padding: 12px 16px; border-radius: 10px; margin-bottom: 20px;
    font-size: 13px; font-weight: 500; border: 1px solid transparent;
}
.alert-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

/* ============ APP SHELL ============ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; background: var(--bg);
    color: #cbd5e1; display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 22px 24px; font-weight: 800; color: #fff;
    font-size: 18px; border-bottom: 1px solid #1e293b;
}
.logo-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: linear-gradient(135deg, #818cf8, #6366f1);
    box-shadow: 0 0 12px rgba(129,140,248,.8);
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px; margin-bottom: 4px;
    color: #94a3b8; font-weight: 500; font-size: 14px;
    transition: all .15s ease;
}
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.sidebar-footer {
    padding: 16px; border-top: 1px solid #1e293b;
}
.user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-weight: 700; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.user-mini-info { min-width: 0; }
.user-mini-info strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-info small { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.logout-link {
    display: block; text-align: center; padding: 8px;
    border-radius: 8px; background: #1e293b; color: #f87171;
    font-size: 12px; font-weight: 600; transition: all .15s;
}
.logout-link:hover { background: #7f1d1d; color: #fff; }

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1; margin-left: 260px; padding: 32px;
    min-height: 100vh;
}
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; gap: 16px;
}
.topbar h1 { font-size: 24px; font-weight: 700; }
.topbar-user { color: var(--text-muted); font-size: 14px; }
.menu-toggle {
    display: none; background: #fff; border: 1px solid var(--border);
    width: 40px; height: 40px; border-radius: 10px;
    font-size: 18px;
}

/* ============ STATS ============ */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-bottom: 28px;
}
.stat-card {
    background: #fff; border-radius: var(--radius);
    padding: 22px; display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-icon.purple { background: #eef2ff; }
.stat-icon.green  { background: #ecfdf5; color: var(--success); }
.stat-icon.blue   { background: #eff6ff; }
.stat-icon.orange { background: #fff7ed; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ============ PANEL ============ */
.panel {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); border: 1px solid var(--border);
    margin-bottom: 24px; overflow: hidden;
}
.panel-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.panel-header h2 { font-size: 16px; font-weight: 700; }
.panel-body { padding: 24px; }
.panel-body.no-pad { padding: 0; }

/* ============ ACTIVITY ============ */
.activity-list { list-style: none; }
.activity-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.activity-list li:last-child { border-bottom: none; }
.activity-dot {
    width: 10px; height: 10px; border-radius: 50%; background: var(--primary);
    margin-top: 6px; flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}
.activity-info { flex: 1; font-size: 13px; }
.activity-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 13px 20px; text-align: left; border-bottom: 1px solid #f1f5f9; }
.table th { background: #f8fafc; font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }
.table tbody tr:hover { background: #f8fafc; }
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.badge-admin, .badge-moderator { background: var(--primary-light); color: var(--primary-hover); }
.badge-user { background: #f1f5f9; color: var(--text-muted); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.muted { color: var(--text-muted); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-content { margin-left: 0; padding: 20px; }
    .menu-toggle { display: flex; align-items: center; justify-content: center; }
    .form-grid { grid-template-columns: 1fr; }
}