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

html {
    scroll-behavior: smooth;
}

::selection {
    background: rgba(114, 124, 245, 0.18);
    color: var(--color-text);
}

:root {
    /* ── Colors ─────────────────────────────────── */
    --color-primary:      #727cf5;
    --color-primary-dark: #6169d0;
    --color-primary-light:#eef0fe;
    --color-accent:       #0acf97;

    --color-success:      #0acf97;
    --color-success-light:#e6f9f4;
    --color-danger:       #fa5c7c;
    --color-danger-light: #fff0f3;
    --color-warning:      #ffbc00;
    --color-warning-light:#fffbeb;
    --color-info:         #39afd1;
    --color-info-light:   #f0f9ff;

    --color-background:   #f2f5fb;
    --color-surface:      #ffffff;
    --color-surface-2:    #f8fafc;
    --color-surface-3:    #eef2f7;

    --color-text:         #313a46;
    --color-text-muted:   #8391a2;
    --color-text-light:   #adb5bd;
    --color-border:       #eef2f7;
    --color-border-2:     #dee2e6;

    --color-sidebar:      #ffffff;
    --color-sidebar-hover:#f8fafc;
    --color-sidebar-text: #6c757d;

    /* ── Spacing ─────────────────────────────────── */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Legacy aliases */
    --primary:        var(--color-primary);
    --primary-dark:   var(--color-primary-dark);
    --success:        var(--color-success);
    --danger:         var(--color-danger);
    --warning:        var(--color-warning);
    --background:     var(--color-background);
    --surface:        var(--color-surface);
    --text-primary:   var(--color-text);
    --text-secondary: var(--color-text-muted);
    --border:         var(--color-border);
    --sidebar-bg:     var(--color-sidebar);
    --sidebar-text:   var(--color-sidebar-text);
    --space-xs:       var(--space-1);
    --space-sm:       var(--space-2);
    --space-md:       var(--space-4);
    --space-lg:       var(--space-6);
    --space-xl:       var(--space-8);

    /* ── Typography ──────────────────────────────── */
    --font-main:    'Inter', system-ui, sans-serif;
    --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;

    --text-2xs:   0.6875rem;   /* 11px */
    --text-xs:    0.75rem;     /* 12px */
    --text-sm:    0.8125rem;   /* 13px */
    --text-base:  0.875rem;    /* 14px */
    --text-md:    0.9375rem;   /* 15px */
    --text-lg:    1rem;        /* 16px */
    --text-xl:    1.125rem;    /* 18px */
    --text-2xl:   1.375rem;    /* 22px */
    --text-3xl:   1.625rem;    /* 26px */
    --text-4xl:   2rem;        /* 32px */

    /* ── Radius ──────────────────────────────────── */
    --radius-xs:  4px;
    --radius-sm:  6px;
    --radius-md:  8px;
    --radius:     10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-2xl: 28px;
    --radius-full:9999px;

    /* ── Shadows ─────────────────────────────────── */
    --shadow-xs:       0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:       0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:          0 3px 8px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-md:       0 6px 14px -2px rgba(0,0,0,0.07), 0 3px 6px -2px rgba(0,0,0,0.04);
    --shadow-lg:       0 12px 24px -4px rgba(0,0,0,0.08), 0 5px 10px -3px rgba(0,0,0,0.04);
    --shadow-premium:  0 8px 16px -3px rgba(0,0,0,0.05), 0 3px 6px -2px rgba(0,0,0,0.02), 0 0 0 1px rgba(0,0,0,0.025);
    --shadow-floating: 0 20px 40px -8px rgba(0,0,0,0.08), 0 8px 16px -4px rgba(0,0,0,0.03);
    --shadow-glow:     0 0 0 3px rgba(114, 124, 245, 0.2), 0 4px 12px rgba(114, 124, 245, 0.15);
    --shadow-inset:    inset 0 1px 3px rgba(0,0,0,0.06);

    /* ── Glass ───────────────────────────────────── */
    --glass-bg:     rgba(255,255,255,0.75);
    --glass-border: rgba(255,255,255,0.6);
    --glass-blur:   14px;

    /* ── Transitions ─────────────────────────────── */
    --transition:      all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark mode ───────────────────────────────────── */
[data-theme="dark"] {
    --color-primary:       #818cf8;
    --color-primary-dark:  #6366f1;
    --color-primary-light: rgba(129, 140, 248, 0.12);
    --color-accent:        #34d399;

    --color-success:       #34d399;
    --color-success-light: rgba(52, 211, 153, 0.12);
    --color-danger:        #f87171;
    --color-danger-light:  rgba(248, 113, 113, 0.12);
    --color-warning:       #fbbf24;
    --color-warning-light: rgba(251, 191, 36, 0.12);
    --color-info:          #60c8e8;
    --color-info-light:    rgba(96, 200, 232, 0.12);

    --color-background:    #0f1117;
    --color-surface:       #181b25;
    --color-surface-2:     #1e2130;
    --color-surface-3:     #252840;

    --color-text:          #e2e8f0;
    --color-text-muted:    #7a849c;
    --color-text-light:    #4e596e;
    --color-border:        #252840;
    --color-border-2:      #2e3350;

    --color-sidebar:       #13161f;
    --color-sidebar-hover: #1e2130;
    --color-sidebar-text:  #7a849c;

    --shadow-xs:       0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm:       0 1px 4px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
    --shadow:          0 3px 8px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.2);
    --shadow-md:       0 6px 14px -2px rgba(0,0,0,0.45), 0 3px 6px -2px rgba(0,0,0,0.25);
    --shadow-lg:       0 12px 24px -4px rgba(0,0,0,0.5), 0 5px 10px -3px rgba(0,0,0,0.3);
    --shadow-premium:  0 8px 16px -3px rgba(0,0,0,0.4), 0 3px 6px -2px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.04);
    --shadow-floating: 0 20px 40px -8px rgba(0,0,0,0.6), 0 8px 16px -4px rgba(0,0,0,0.3);
    --shadow-glow:     0 0 0 3px rgba(129, 140, 248, 0.25), 0 4px 12px rgba(129, 140, 248, 0.2);
    --shadow-inset:    inset 0 1px 3px rgba(0,0,0,0.4);

    --glass-bg:     rgba(24, 27, 37, 0.8);
    --glass-border: rgba(255,255,255,0.06);
    --glass-blur:   14px;
}

/* ── Base ────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

body {
    font-family:             var(--font-main);
    background:              var(--color-background);
    color:                   var(--color-text);
    font-size:               var(--text-base);
    line-height:             1.55;
    -webkit-font-smoothing:  antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
}

/* ── Page fade-in ────────────────────────────────── */
.main-content {
    animation: pageIn 0.3s ease-out both;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
