:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-primary-dark: #1e40af;

  --color-success: #16a34a;
  --color-success-hover: #15803d;
  --color-success-light: #dcfce7;

  --color-warning: #f59e0b;
  --color-warning-hover: #d97706;
  --color-warning-light: #fef3c7;

  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-light: #fef2f2;

  --color-info: #0891b2;
  --color-info-hover: #0e7490;
  --color-info-light: #cffafe;

  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  --color-white: #ffffff;
  --color-black: #000000;

  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-bg-tertiary: #f3f4f6;
  --color-bg-inverse: #1f2937;

  --color-text-primary: #111827;
  --color-text-secondary: #4b5563;
  --color-text-tertiary: #6b7280;
  --color-text-inverse: #ffffff;
  --color-text-muted: #9ca3af;

  --color-border-light: #e5e7eb;
  --color-border-medium: #d1d5db;
  --color-border-dark: #9ca3af;
  --color-border-focus: #2563eb;

  --color-sidebar-bg: #ffffff;
  --color-sidebar-border: #e5e7eb;
  --color-sidebar-item-hover: #f3f4f6;
  --color-sidebar-item-active: #dbeafe;
  --color-sidebar-item-active-text: #1d4ed8;
  --color-sidebar-text: #374151;
  --color-sidebar-text-muted: #6b7280;

  --color-header-bg: #ffffff;
  --color-header-border: #e5e7eb;
  --color-header-text: #111827;

  /* Semantic aliases used by shared ForgeAI components. */
  --color-surface-raised: #ffffff;
  --color-surface-hover: #f9fafb;
  --color-text-on-primary: #ffffff;
  --color-focus-ring: rgba(37, 99, 235, 0.22);

  --color-overlay: rgba(0, 0, 0, 0.7);
  --color-modal-bg: #ffffff;

  --font-family-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  --spacing-0: 0;
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;
  --spacing-20: 5rem;
  --spacing-24: 6rem;

  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  --shadow-focus: 0 0 0 3px rgba(37, 99, 235, 0.15);

  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  --z-index-dropdown: 100;
  --z-index-sticky: 200;
  --z-index-fixed: 300;
  --z-index-modal-backdrop: 400;
  --z-index-modal: 500;
  --z-index-popover: 600;
  --z-index-tooltip: 700;
  --z-index-toast: 800;

  --sidebar-width: 260px;
  --sidebar-width-collapsed: 72px;
  --sidebar-width-mobile: 280px;
  --header-height: 64px;
  --header-height-mobile: 56px;

  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;

  --container-max-width: 1400px;
  --content-max-width: 1200px;

  --input-height: 40px;
  --input-height-sm: 32px;
  --input-height-lg: 48px;
  --button-height: 40px;
  --button-height-sm: 32px;
  --button-height-lg: 48px;

  --control-radius: var(--radius-md);
  --control-min-width: 40px;

  --focus-ring: 0 0 0 3px var(--color-primary-light);
  --focus-ring-offset: 2px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-light: #1e3a5f;
    --color-primary-dark: #60a5fa;

    --color-success: #22c55e;
    --color-success-hover: #4ade80;
    --color-success-light: #14532d;

    --color-warning: #fbbf24;
    --color-warning-hover: #fcd34d;
    --color-warning-light: #78350f;

    --color-danger: #ef4444;
    --color-danger-hover: #f87171;
    --color-danger-light: #7f1d1d;

    --color-info: #06b6d4;
    --color-info-hover: #22d3ee;
    --color-info-light: #164e63;

    --color-gray-50: #111827;
    --color-gray-100: #1f2937;
    --color-gray-200: #374151;
    --color-gray-300: #4b5563;
    --color-gray-400: #6b7280;
    --color-gray-500: #9ca3af;
    --color-gray-600: #d1d5db;
    --color-gray-700: #e5e7eb;
    --color-gray-800: #f3f4f6;
    --color-gray-900: #f9fafb;

    --color-bg-primary: #111827;
    --color-bg-secondary: #1f2937;
    --color-bg-tertiary: #374151;
    --color-bg-inverse: #f9fafb;

    --color-text-primary: #f9fafb;
    --color-text-secondary: #e5e7eb;
    --color-text-tertiary: #d1d5db;
    --color-text-inverse: #111827;
    --color-text-muted: #9ca3af;

    --color-border-light: #374151;
    --color-border-medium: #4b5563;
    --color-border-dark: #6b7280;
    --color-border-focus: #3b82f6;

    --color-sidebar-bg: #1f2937;
    --color-sidebar-border: #374151;
    --color-sidebar-item-hover: #374151;
    --color-sidebar-item-active: #1e3a5f;
    --color-sidebar-item-active-text: #93c5fd;
    --color-sidebar-text: #e5e7eb;
    --color-sidebar-text-muted: #9ca3af;

    --color-header-bg: #1f2937;
    --color-header-border: #374151;
    --color-header-text: #f9fafb;
    --color-surface-raised: #1f2937;
    --color-surface-hover: #374151;
    --color-text-on-primary: #ffffff;
    --color-focus-ring: rgba(96, 165, 250, 0.3);

    --color-overlay: rgba(0, 0, 0, 0.7);
    --color-modal-bg: #1f2937;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.15);
  }
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

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

:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
