/* ── CI Color System: Orange + White / Orange + Anthracite ───────────────
   Light mode (default): white backgrounds, orange accents
   Dark  mode (OS pref or [data-theme="dark"]): near-black surfaces, orange accents
   Sidebar stays dark in both modes for strong brand contrast.
──────────────────────────────────────────────────────────────────────── */

/* ── Light mode — default ─────────────────────────────────────────────── */
:root {
    color-scheme: light dark;

    /* Brand orange */
    --accent:        #F97316;    /* Orange-500 – buttons, CTAs, highlights */
    --accent-strong: #EA580C;    /* Orange-600 – hover, borders, text on white */
    --accent-soft:   rgba(249, 115, 22, 0.10);
    --accent-soft-2: rgba(249, 115, 22, 0.18);

    /* Backgrounds */
    --bg:   #FFFFFF;
    --bg-2: #F8F8F8;
    --bg-3: #F1F1F1;

    /* Content surfaces */
    --surface:       #FFFFFF;
    --surface-solid: #FFFFFF;
    --surface-2:     #F5F5F5;
    --surface-3:     #EEEEEE;
    --surface-muted: #E5E5E5;
    --surface-soft:  #DCDCDC;
    --surface-hover: #D2D2D2;

    /* Sidebar — light mode */
    --sidebar:            #FFFFFF;
    --sidebar-2:          #FAFAFA;
    --sidebar-3:          #F3F3F3;
    --sidebar-text:       #111111;
    --sidebar-text-muted: #666666;
    --sidebar-border:     rgba(0, 0, 0, 0.08);

    /* Nav active / ripple / pill */
    --nav-active-text:    #111111;
    --nav-ripple-color:   rgba(249, 115, 22, 0.16);
    --sidebar-pill-bg:    rgba(0, 0, 0, 0.04);
    --sidebar-pill-border: rgba(0, 0, 0, 0.08);

    /* Nav item overlay colours (light sidebar uses dark-alpha) */
    --nav-icon-bg:            rgba(0, 0, 0, 0.05);
    --nav-icon-border:        rgba(0, 0, 0, 0.07);
    --nav-hover-bg:           rgba(249, 115, 22, 0.07);
    --nav-hover-border:       rgba(249, 115, 22, 0.14);
    --nav-hover-color:        #111111;
    --nav-hover-icon-bg:      rgba(249, 115, 22, 0.10);
    --nav-hover-icon-border:  rgba(249, 115, 22, 0.18);
    --nav-pill-bg:            rgba(0, 0, 0, 0.06);
    --nav-pill-border:        rgba(0, 0, 0, 0.10);
    --nav-thumb-bg:           rgba(0, 0, 0, 0.28);

    /* Borders */
    --border:        rgba(0, 0, 0, 0.09);
    --border-soft:   rgba(0, 0, 0, 0.05);
    --border-strong: rgba(0, 0, 0, 0.16);

    /* Text */
    --text-1: #111111;
    --text-2: #2E2E2E;
    --text-3: #6B6B6B;
    --text-4: #A8A8A8;

    /* Semantic status colors */
    --success:      #16A34A;
    --success-soft: rgba(22, 163, 74, 0.10);
    --warning:      #D97706;
    --warning-soft: rgba(217, 119, 6, 0.10);
    --danger:       #DC2626;
    --danger-soft:  rgba(220, 38, 38, 0.10);
    --info:         #2563EB;
    --info-soft:    rgba(37, 99, 235, 0.10);

    /* Shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.13);

    /* Radii */
    --r-xs: 4px;
    --r-sm: 7px;
    --r:    10px;
    --r-md: 13px;
    --r-lg: 16px;
    --r-xl: 20px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;

    --content-max: 1440px;
}

/* ── Dark mode — OS preference ────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;

        /* Brand orange shifts slightly lighter for dark surfaces */
        --accent:        #FB923C;    /* Orange-400 */
        --accent-strong: #F97316;    /* Orange-500 */
        --accent-soft:   rgba(251, 146, 60, 0.13);
        --accent-soft-2: rgba(251, 146, 60, 0.22);

        --bg:   #0E0E0E;
        --bg-2: #141414;
        --bg-3: #1A1A1A;

        --surface:       #1C1C1C;
        --surface-solid: #1C1C1C;
        --surface-2:     #252525;
        --surface-3:     #2E2E2E;
        --surface-muted: #383838;
        --surface-soft:  #424242;
        --surface-hover: #4C4C4C;

        --sidebar:            #0E0E0E;
        --sidebar-2:          #121212;
        --sidebar-3:          #181818;
        --sidebar-text:       #F0F0F0;
        --sidebar-text-muted: #777777;
        --sidebar-border:     rgba(255, 255, 255, 0.06);

        --nav-active-text:    #ffffff;
        --nav-ripple-color:   rgba(255, 255, 255, 0.14);
        --sidebar-pill-bg:    rgba(255, 255, 255, 0.04);
        --sidebar-pill-border: rgba(255, 255, 255, 0.06);

        --nav-icon-bg:            rgba(255, 255, 255, 0.07);
        --nav-icon-border:        rgba(255, 255, 255, 0.09);
        --nav-hover-bg:           rgba(255, 255, 255, 0.10);
        --nav-hover-border:       rgba(255, 255, 255, 0.10);
        --nav-hover-color:        #ffffff;
        --nav-hover-icon-bg:      rgba(255, 255, 255, 0.12);
        --nav-hover-icon-border:  rgba(255, 255, 255, 0.13);
        --nav-pill-bg:            rgba(255, 255, 255, 0.11);
        --nav-pill-border:        rgba(255, 255, 255, 0.16);
        --nav-thumb-bg:           rgba(255, 255, 255, 0.50);

        --border:        rgba(255, 255, 255, 0.08);
        --border-soft:   rgba(255, 255, 255, 0.05);
        --border-strong: rgba(255, 255, 255, 0.14);

        --text-1: #EFEFEF;
        --text-2: #C8C8C8;
        --text-3: #858585;
        --text-4: #525252;

        --success:      #22C55E;
        --success-soft: rgba(34, 197, 94, 0.13);
        --warning:      #F59E0B;
        --warning-soft: rgba(245, 158, 11, 0.13);
        --danger:       #F87171;
        --danger-soft:  rgba(248, 113, 113, 0.13);
        --info:         #60A5FA;
        --info-soft:    rgba(96, 165, 250, 0.13);

        --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.32);
        --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.38);
        --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.44);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.52);
    }
}

/* ── Manual theme overrides (for future toggle) ───────────────────────── */
[data-theme="dark"] {
    color-scheme: dark;

    --accent:        #FB923C;
    --accent-strong: #F97316;
    --accent-soft:   rgba(251, 146, 60, 0.13);
    --accent-soft-2: rgba(251, 146, 60, 0.22);

    --bg:   #0E0E0E;
    --bg-2: #141414;
    --bg-3: #1A1A1A;

    --surface:       #1C1C1C;
    --surface-solid: #1C1C1C;
    --surface-2:     #252525;
    --surface-3:     #2E2E2E;
    --surface-muted: #383838;
    --surface-soft:  #424242;
    --surface-hover: #4C4C4C;

    --sidebar:            #0E0E0E;
    --sidebar-2:          #121212;
    --sidebar-3:          #181818;
    --sidebar-text:       #F0F0F0;
    --sidebar-text-muted: #777777;
    --sidebar-border:     rgba(255, 255, 255, 0.06);

    --nav-active-text:    #ffffff;
    --nav-ripple-color:   rgba(255, 255, 255, 0.14);
    --sidebar-pill-bg:    rgba(255, 255, 255, 0.04);
    --sidebar-pill-border: rgba(255, 255, 255, 0.06);

    --nav-icon-bg:            rgba(255, 255, 255, 0.07);
    --nav-icon-border:        rgba(255, 255, 255, 0.09);
    --nav-hover-bg:           rgba(255, 255, 255, 0.10);
    --nav-hover-border:       rgba(255, 255, 255, 0.10);
    --nav-hover-color:        #ffffff;
    --nav-hover-icon-bg:      rgba(255, 255, 255, 0.12);
    --nav-hover-icon-border:  rgba(255, 255, 255, 0.13);
    --nav-pill-bg:            rgba(255, 255, 255, 0.11);
    --nav-pill-border:        rgba(255, 255, 255, 0.16);
    --nav-thumb-bg:           rgba(255, 255, 255, 0.50);

    --border:        rgba(255, 255, 255, 0.08);
    --border-soft:   rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text-1: #EFEFEF;
    --text-2: #C8C8C8;
    --text-3: #858585;
    --text-4: #525252;

    --success:      #22C55E;
    --success-soft: rgba(34, 197, 94, 0.13);
    --warning:      #F59E0B;
    --warning-soft: rgba(245, 158, 11, 0.13);
    --danger:       #F87171;
    --danger-soft:  rgba(248, 113, 113, 0.13);
    --info:         #60A5FA;
    --info-soft:    rgba(96, 165, 250, 0.13);

    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.32);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.38);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.44);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.52);
}

/* ── Reset ────────────────────────────────────────────────────────────── */

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

html, body {
    height: 100%;
    height: 100dvh;
}

html {
    background: var(--bg);
}

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(ellipse at 72% 0%, rgba(249, 115, 22, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 0% 100%, rgba(249, 115, 22, 0.03) 0%, transparent 40%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
    color: var(--text-1);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow: hidden;
}

button, input, select, textarea {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

img, svg {
    display: block;
    max-width: 100%;
}

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

.skip-link {
    position: absolute;
    top: -100%;
    left: 12px;
    z-index: 500;
    background: var(--accent);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 0 0 var(--r-sm) var(--r-sm);
    font-size: 13px;
    font-weight: 600;
    transition: top 0.14s ease;
}
.skip-link:focus {
    top: 0;
    outline: none;
}

:focus-visible {
    outline: 2px solid rgba(249, 115, 22, 0.80);
    outline-offset: 2px;
}
