/* Design tokens. Light is the default; dark follows the OS unless the user picked a theme (html[data-theme]). */
:root {
    color-scheme: light;

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.75rem;
    --leading: 1.5;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-8: 3rem;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Layout and density (console-ux.md §3.1, CDPR-0140): data pages use the full width, tables
       are compact, and only forms keep a readable maximum width. */
    --topbar-height: 3rem;
    --sidebar-width: 12rem;
    --sidebar-rail-width: 3.5rem;
    --content-max-form: 48rem;
    --page-pad-y: var(--space-4);
    --page-pad-x: var(--space-5);
    --table-cell-y: var(--space-2);
    --table-cell-x: var(--space-3);
    --icon-size: 1.125rem;

    --color-bg: #f6f7f9;
    --color-surface: #ffffff;
    --color-surface-2: #eef0f4;
    --color-border: #d9dde4;
    --color-text: #1b1f27;
    --color-text-muted: #5b6475;
    --color-accent: #2f5bd3;
    --color-accent-hover: #2349b0;
    --color-accent-text: #ffffff;
    --color-accent-soft: #e6ecfb;
    --color-danger: #c42b2b;
    --color-danger-soft: #fbe9e9;
    --color-warning: #8a5a00;
    --color-warning-soft: #fdf3dc;
    --color-success: #1d7a46;
    --color-success-soft: #e3f4ea;
    --color-info-soft: #e6f1fb;
    --color-focus: #2f5bd3;
    --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --color-bg: #11141a;
        --color-surface: #181c24;
        --color-surface-2: #212632;
        --color-border: #2f3542;
        --color-text: #e6e9ef;
        --color-text-muted: #9aa3b5;
        --color-accent: #7c9cf5;
        --color-accent-hover: #9bb3f8;
        --color-accent-text: #0d1220;
        --color-accent-soft: #232d48;
        --color-danger: #f07b7b;
        --color-danger-soft: #3a1f22;
        --color-warning: #e8b85c;
        --color-warning-soft: #362c18;
        --color-success: #6cd39a;
        --color-success-soft: #1a3226;
        --color-info-soft: #1c2a3a;
        --color-focus: #9bb3f8;
        --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #11141a;
    --color-surface: #181c24;
    --color-surface-2: #212632;
    --color-border: #2f3542;
    --color-text: #e6e9ef;
    --color-text-muted: #9aa3b5;
    --color-accent: #7c9cf5;
    --color-accent-hover: #9bb3f8;
    --color-accent-text: #0d1220;
    --color-accent-soft: #232d48;
    --color-danger: #f07b7b;
    --color-danger-soft: #3a1f22;
    --color-warning: #e8b85c;
    --color-warning-soft: #362c18;
    --color-success: #6cd39a;
    --color-success-soft: #1a3226;
    --color-info-soft: #1c2a3a;
    --color-focus: #9bb3f8;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
}
