:root {
    color-scheme: light;

    --font-body: "Tajawal", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Alexandria", "Tajawal", system-ui, sans-serif;

    --ink-950: #072430;
    --ink-900: #0A2E3C;
    --ink-850: #0D3746;
    --ink-800: #104253;
    --ink-700: #165668;
    --ink-600: #1D6D82;

    --brand-50: #ECFAFC;
    --brand-100: #D3F3F7;
    --brand-200: #A6E7EE;
    --brand-300: #71D5E1;
    --brand-400: #38BDCE;
    --brand-500: #17A2B8;
    --brand-600: #0C7A8D;
    --brand-700: #096070;

    --mint-100: #DFF6EC;
    --mint-500: #22B98C;
    --mint-600: #0F7A5D;
    --mint-700: #0B6349;
    --sky-100: #E3F0FD;
    --sky-500: #3A93E8;
    --sky-600: #2374C4;
    --sky-700: #1A5C9E;
    --amber-100: #FDF2DC;
    --amber-500: #E2A32C;
    --amber-600: #96660F;
    --amber-700: #7A5309;
    --rose-100: #FDEAE8;
    --rose-500: #E9736A;
    --rose-600: #C0473D;
    --rose-700: #9E3A31;
    --violet-100: #EEE9FC;
    --violet-500: #8B6CE0;
    --violet-700: #5B3FB0;
    --indigo-100: #E6E9FB;
    --indigo-500: #5468D9;
    --indigo-700: #3443A3;

    --canvas: #F4FAFB;
    --canvas-tint: #EAF5F7;
    --surface: #FFFFFF;
    --surface-2: #F8FCFD;
    --surface-3: #EFF7F9;

    --text: #14303B;
    --text-muted: #5B7481;
    --text-soft: #8FA6B1;
    --on-dark: #E9F5F8;
    --on-dark-muted: #A2BAC4;

    --line: rgba(20, 48, 59, 0.08);
    --line-strong: rgba(20, 48, 59, 0.14);
    --line-brand: rgba(23, 162, 184, 0.3);

    --success: #137759;
    --success-soft: #E1F6EE;
    --warning: #8F6310;
    --warning-soft: #FDF3E0;
    --danger: #BC463C;
    --danger-soft: #FDEDEB;
    --info: #2069B2;
    --info-soft: #E8F2FC;

    --sidebar-bg: linear-gradient(195deg, #FFFFFF 0%, #EDF8FA 62%, #E4F4F7 100%);
    --sidebar-fg: #16323E;
    --sidebar-fg-muted: rgba(22, 50, 62, .68);
    --sidebar-section: rgba(22, 50, 62, .42);
    --sidebar-border: rgba(20, 48, 59, .08);
    --sidebar-hover: rgba(23, 162, 184, .1);
    --sidebar-active: linear-gradient(to left, rgba(23, 162, 184, .16), rgba(23, 162, 184, .02));
    --sidebar-icon-bg: #FFFFFF;
    --sidebar-icon-fg: var(--brand-500);
    --sidebar-icon-ring: rgba(23, 162, 184, .18);
    --sidebar-glow: rgba(56, 189, 206, .16);

    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 30px;
    --r-pill: 999px;

    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 22px;
    --sp-6: 30px;
    --sp-7: 40px;
    --sp-8: 56px;

    --shadow-xs: 0 1px 2px rgba(16, 66, 83, .05);
    --shadow-sm: 0 2px 10px -3px rgba(16, 66, 83, .1), 0 1px 2px rgba(16, 66, 83, .04);
    --shadow-md: 0 16px 34px -18px rgba(16, 66, 83, .22), 0 3px 10px rgba(16, 66, 83, .05);
    --shadow-lg: 0 32px 70px -30px rgba(10, 46, 60, .28), 0 8px 22px -14px rgba(16, 66, 83, .14);
    --shadow-brand: 0 12px 26px -12px rgba(23, 162, 184, .5);

    --ease: cubic-bezier(.32, .72, .32, 1);
    --dur: .28s;

    --sidebar-w: 268px;
    --sidebar-w-collapsed: 84px;
    --topbar-h: 74px;

    --fs-xs: .75rem;
    --fs-sm: clamp(.8rem, .77rem + .14vw, .875rem);
    --fs-base: clamp(.925rem, .89rem + .18vw, 1rem);
    --fs-md: clamp(1rem, .96rem + .22vw, 1.09rem);
    --fs-lg: clamp(1.08rem, 1.02rem + .32vw, 1.25rem);
    --fs-xl: clamp(1.25rem, 1.13rem + .6vw, 1.6rem);
    --fs-2xl: clamp(1.5rem, 1.28rem + 1.05vw, 2.15rem);
    --fs-stat: clamp(1.9rem, 1.55rem + 1.5vw, 2.75rem);
}

[data-theme="dark"] {
    color-scheme: dark;

    --canvas: #08202B;
    --canvas-tint: #0C2A36;
    --surface: #0E2E3B;
    --surface-2: #123543;
    --surface-3: #1A4051;

    --text: #E8F4F7;
    --text-muted: #A0BAC5;
    --text-soft: #7896A4;

    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .16);
    --line-brand: rgba(113, 213, 225, .32);

    --success: #3BC298;
    --success-soft: rgba(34, 185, 140, .18);
    --warning: #E8B85C;
    --warning-soft: rgba(226, 163, 44, .2);
    --danger: #F08C83;
    --danger-soft: rgba(233, 115, 106, .2);
    --info: #6FB1F0;
    --info-soft: rgba(58, 147, 232, .2);

    --sidebar-bg: linear-gradient(195deg, #114254 0%, #0B2F3E 58%, #072430 100%);
    --sidebar-fg: #E9F6F9;
    --sidebar-fg-muted: rgba(233, 246, 249, .7);
    --sidebar-section: rgba(255, 255, 255, .36);
    --sidebar-border: rgba(255, 255, 255, .08);
    --sidebar-hover: rgba(255, 255, 255, .07);
    --sidebar-active: linear-gradient(to left, rgba(56, 189, 206, .22), rgba(56, 189, 206, .03));
    --sidebar-icon-bg: rgba(255, 255, 255, .07);
    --sidebar-icon-fg: var(--brand-200);
    --sidebar-icon-ring: rgba(255, 255, 255, .08);
    --sidebar-glow: rgba(56, 189, 206, .2);

    --shadow-sm: 0 2px 10px -3px rgba(0, 0, 0, .45);
    --shadow-md: 0 16px 34px -18px rgba(0, 0, 0, .6);
    --shadow-lg: 0 36px 80px -34px rgba(0, 0, 0, .7);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--canvas);
    background-image:
        radial-gradient(940px 540px at 100% -10%, rgba(56, 189, 206, .2), transparent 60%),
        radial-gradient(760px 460px at 4% 4%, rgba(34, 185, 140, .12), transparent 58%),
        radial-gradient(820px 520px at 55% 108%, rgba(58, 147, 232, .1), transparent 62%);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.75;
    font-weight: 400;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(940px 540px at 100% -10%, rgba(56, 189, 206, .16), transparent 60%),
        radial-gradient(760px 460px at 4% 4%, rgba(34, 185, 140, .08), transparent 58%),
        radial-gradient(820px 520px at 55% 108%, rgba(58, 147, 232, .08), transparent 62%);
}

h1, h2, h3, h4, h5, h6,
.display-title {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -.01em;
    color: var(--text);
    margin: 0 0 var(--sp-3);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
h5, h6 { font-size: var(--fs-base); }

p {
    margin: 0 0 var(--sp-3);
}

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--dur) var(--ease);
}

a:hover {
    color: var(--brand-500);
}

small,
.small {
    font-size: var(--fs-sm);
}

strong,
b {
    font-weight: 700;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .9em;
    color: var(--brand-600);
}

hr {
    border: 0;
    height: 1px;
    background: var(--line);
    margin: var(--sp-5) 0;
    opacity: 1;
}

::selection {
    background: var(--brand-200);
    color: var(--ink-900);
}

:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: 3px;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: var(--r-pill);
    border: 3px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-300);
    background-clip: content-box;
}

.eyebrow {
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--brand-600);
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-soft {
    color: var(--text-soft);
}

.text-brand {
    color: var(--brand-600);
}

.hairline {
    height: 1px;
    background: linear-gradient(to left, transparent, var(--line-brand), transparent);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
