/* ==========================================================================
   Design tokens - single source of truth for colors, type, spacing, elevation.
   Theme is switched by [data-theme="light|dark"] on <html> (see js/ipas.js: ipasTheme).
   ========================================================================== */
:root {
    /* brand (indigo/blue) */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --accent-500: #0ea5e9;

    /* scale */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --topbar-h: 60px;
    --toolbar-h: 52px;
    --content-max: 1280px;

    --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

    --ease: cubic-bezier(.2, .7, .2, 1);
    --t-fast: 120ms;
    --t: 200ms;
}

/* ---------- light ---------- */
:root,
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f6fb;
    --bg-grid: #dfe4f1;
    --surface: #ffffff;
    --surface-2: #f1f4fb;
    --surface-3: #e6ebf7;
    --surface-inverse: #1e1b4b;
    --border: #e1e6f2;
    --border-strong: #c9d1e6;
    --text: #0f172a;
    --text-2: #334155;
    --text-muted: #64748b;
    --on-inverse: #eef2ff;
    --primary: var(--primary-600);
    --primary-hover: var(--primary-700);
    --primary-soft: var(--primary-50);
    --on-primary: #ffffff;
    --link: #4338ca;
    --success: #15803d;  --success-soft: #dcfce7;
    --warning: #b45309;  --warning-soft: #fef3c7;
    --danger: #dc2626;   --danger-soft: #fee2e2;
    --info: #0369a1;     --info-soft: #e0f2fe;
    --input-bg: #ffffff;
    --shadow-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .06);
    --shadow-2: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .05);
    --shadow-3: 0 20px 48px rgba(15, 23, 42, .18), 0 6px 16px rgba(15, 23, 42, .08);
    --backdrop: rgba(15, 23, 42, .45);
    --focus-ring: 0 0 0 3px rgba(79, 70, 229, .28);
}

/* ---------- dark ---------- */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0f1f;
    --bg-grid: #162040;
    --surface: #111833;
    --surface-2: #172042;
    --surface-3: #1f2a55;
    --surface-inverse: #0b1230;
    --border: #232e57;
    --border-strong: #34437a;
    --text: #e7ebfa;
    --text-2: #c3cbe8;
    --text-muted: #8e9acb;
    --on-inverse: #e7ebfa;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: rgba(129, 140, 248, .16);
    --on-primary: #0b1230;
    --link: #a5b4fc;
    --success: #4ade80;  --success-soft: rgba(74, 222, 128, .14);
    --warning: #fbbf24;  --warning-soft: rgba(251, 191, 36, .14);
    --danger: #f87171;   --danger-soft: rgba(248, 113, 113, .15);
    --info: #38bdf8;     --info-soft: rgba(56, 189, 248, .14);
    --input-bg: #0d1430;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 6px 16px rgba(0, 0, 0, .4);
    --shadow-3: 0 24px 56px rgba(0, 0, 0, .6);
    --backdrop: rgba(3, 6, 18, .66);
    --focus-ring: 0 0 0 3px rgba(129, 140, 248, .35);
}
