:root {
    color-scheme: light;
    --bg: #f5f3ff;
    --bg-deep: #1e1b4b;
    --panel: #ffffff;
    --panel-soft: #faf5ff;
    --text: #1e1b4b;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --success: #059669;
    --success-bg: #d1fae5;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --shadow: 0 18px 60px rgba(124, 58, 237, 0.08);
    --shadow-hover: 0 24px 80px rgba(124, 58, 237, 0.15);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, 0.08), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(167, 139, 250, 0.06), transparent 32rem),
        linear-gradient(180deg, #faf5ff 0%, var(--bg) 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { 
    color: var(--primary); 
    text-decoration: none; 
    font-weight: 600;
    transition: color 0.2s ease;
}

a:hover { 
    color: var(--primary-dark); 
}

h1, h2, h3, p { margin-top: 0; }

h1 { 
    font-size: clamp(2rem, 4vw, 3rem); 
    letter-spacing: -0.04em; 
    line-height: 1.1; 
    margin-bottom: 1rem;
    font-weight: 800;
}

h2 { 
    font-size: 1.5rem; 
    letter-spacing: -0.02em; 
    font-weight: 700;
    margin-bottom: 0.75rem;
}

h3 { 
    font-size: 1.125rem; 
    letter-spacing: -0.01em; 
    font-weight: 600;
    margin-bottom: 0.5rem;
}

p { 
    color: var(--muted); 
    line-height: 1.7; 
}

/* Navigation */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    backdrop-filter: blur(20px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--bg-deep));
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.3);
    font-weight: 900;
    font-size: 0.875rem;
    letter-spacing: -0.05em;
}

.brand-text strong { 
    display: block; 
    font-size: 1rem;
    font-weight: 700;
}

.brand-text small { 
    display: block; 
    color: var(--muted); 
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Hero Card */
.hero-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--bg-deep) 100%);
    color: #fff;
    border: none;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.3), transparent 70%);
    pointer-events: none;
}

.hero-card h2 {
    color: #fff;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.hero-card p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.125rem;
    position: relative;
    z-index: 1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.06);
}

.stat-label {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-trend {
    font-size: 0.875rem;
    font-weight: 600;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.button-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.25);
}

.button-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

.button-secondary {
    background: rgba(124, 58, 237, 0.08);
    color: var(--primary);
}

.button-secondary:hover {
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary-dark);
}

.button-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
}

.button-ghost:hover {
    background: var(--panel-soft);
    color: var(--text);
    border-color: var(--primary-light);
}

/* Forms */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 0.9375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--panel-soft);
}

th {
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: var(--panel-soft);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-neutral {
    background: #f3f4f6;
    color: var(--muted);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    border: 2px dashed var(--line);
    border-radius: 16px;
    background: var(--panel-soft);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin-bottom: 0;
}

/* Utilities */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .nav-links {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
    }
    
    .container {
        padding: 1.5rem 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.stat-card {
    animation: fadeIn 0.4s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--panel-soft);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
