/* Design tokens — light/dark via [data-theme] + prefers-color-scheme */

:root {
  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, Segoe UI, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-xs: 11px;
  --text-sm: 12.5px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;
  --text-4xl: 36px;
  --text-5xl: 48px;

  --leading-tight: 1.2;
  --leading-snug: 1.4;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 56px;
  --container-max: 1440px;

  /* z-index */
  --z-base: 0;
  --z-sticky: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 1100;

  /* Transitions */
  --t-fast: 120ms;
  --t-base: 180ms;
  --t-slow: 280ms;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* ===== LIGHT ===== */
:root,
[data-theme="light"] {
  color-scheme: light;

  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ededee;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  --text-inverse: #ffffff;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-soft-hover: #e0e7ff;
  --on-primary: #ffffff;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --success-text: #166534;
  --warning: #ca8a04;
  --warning-soft: #fef9c3;
  --warning-text: #854d0e;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-text: #991b1b;
  --info: #0ea5e9;
  --info-soft: #e0f2fe;
  --info-text: #075985;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-xl: 0 20px 40px -8px rgba(15, 23, 42, .12), 0 8px 16px -8px rgba(15, 23, 42, .08);

  --scrim: rgba(15, 23, 42, .55);

  --focus-ring: 0 0 0 3px rgba(79, 70, 229, .25);
}

/* ===== DARK ===== */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #09090b;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --surface-3: #27272a;
  --border: #2f2f33;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --text-inverse: #18181b;

  --primary: #818cf8;
  --primary-hover: #6366f1;
  --primary-soft: #1e1b4b;
  --primary-soft-hover: #312e81;
  --on-primary: #18181b;

  --success: #22c55e;
  --success-soft: #052e1c;
  --success-text: #86efac;
  --warning: #eab308;
  --warning-soft: #2d2406;
  --warning-text: #fde047;
  --danger: #ef4444;
  --danger-soft: #2b0a0a;
  --danger-text: #fca5a5;
  --info: #38bdf8;
  --info-soft: #082f49;
  --info-text: #7dd3fc;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .35), 0 4px 8px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, .55);

  --scrim: rgba(0, 0, 0, .65);

  --focus-ring: 0 0 0 3px rgba(129, 140, 248, .35);
}

/* respeita preferência do SO quando data-theme="auto" */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    color-scheme: dark;
    --bg: #09090b;
    --surface: #18181b;
    --surface-2: #1f1f23;
    --surface-3: #27272a;
    --border: #2f2f33;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;
    --text-inverse: #18181b;
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-soft: #1e1b4b;
    --primary-soft-hover: #312e81;
    --on-primary: #18181b;
    --success: #22c55e;
    --success-soft: #052e1c;
    --success-text: #86efac;
    --warning: #eab308;
    --warning-soft: #2d2406;
    --warning-text: #fde047;
    --danger: #ef4444;
    --danger-soft: #2b0a0a;
    --danger-text: #fca5a5;
    --info: #38bdf8;
    --info-soft: #082f49;
    --info-text: #7dd3fc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .35), 0 4px 8px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, .55);
    --scrim: rgba(0, 0, 0, .65);
    --focus-ring: 0 0 0 3px rgba(129, 140, 248, .35);
  }
}
