:root {
  /* Next UI: semantic application tokens. Legacy aliases stay below until migration ends. */
  --app-canvas: #f7f9fb;
  --app-sidebar: #ffffff;
  --app-surface: #ffffff;
  --app-surface-subtle: #f2f5f7;
  --app-surface-hover: #edf3f8;
  --app-surface-selected: #e9f3ff;
  --app-text: #17202a;
  --app-text-secondary: #343b49;
  --app-text-muted: #687181;
  --app-border: #e4e9ed;
  --app-border-strong: #d5dde3;
  --app-accent: #2389d7;
  --app-accent-hover: #1779c1;
  --app-accent-soft: #e8f4fc;
  --app-focus: rgba(35, 137, 215, .24);
  --app-success: #21875b;
  --app-success-soft: #e9f6ef;
  --app-warning: #ad7417;
  --app-warning-soft: #fff5dd;
  --app-danger: #c94a4a;
  --app-danger-soft: #fff0f0;
  --app-radius-control: 10px;
  --app-radius-card: 14px;
  --app-shadow-card: 0 1px 2px rgba(23, 32, 42, .04);
  --app-font-caption: 11px;
  --app-font-metric: 26px;

  /* Legacy component aliases. Keep one theme source while old selectors migrate. */
  --bg: var(--app-canvas);
  --panel: var(--app-surface);
  --panel-soft: var(--app-surface-subtle);
  --ink: var(--app-text);
  --muted: var(--app-text-muted);
  --text: var(--app-text-secondary);
  --line: var(--app-border);
  --blue: var(--app-accent);
  --blue-2: var(--app-accent-hover);
  --blue-soft: var(--app-accent-soft);
  --green: var(--app-success);
  --green-soft: var(--app-success-soft);
  --yellow: var(--app-warning);
  --yellow-soft: var(--app-warning-soft);
  --red: var(--app-danger);
  --red-soft: var(--app-danger-soft);
  --violet: #7c3aed;
  --shadow: var(--shadow-xl);
  --shadow-sm: var(--shadow-subtle);
  --radius: var(--app-radius-card);
  --radius-sm: var(--app-radius-control);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Colors */
  --color-stone-canvas: #fafaf9;
  --color-pure-white: #ffffff;
  --color-stone-border: #e8e6e5;
  --color-stone-muted: #d6d3d1;
  --color-ash-gray: #a8a29e;
  --color-warm-gray: #78716c;
  --color-ink-black: #0c0a09;
  --color-soot: #1c1917;
  --color-sky-wash: #c1e1f7;
  --color-cyan-signal: #3ba6f1;
  --color-cyan-edge: #3398e1;

  /* Typography */
  --font-inter: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --text-caption: 10px;
  --leading-caption: 2.3;
  --text-body-lg: 16px;
  --leading-body-lg: 1.69;
  --text-subheading: 20px;
  --leading-subheading: 1.2;
  --text-heading-sm: 32px;
  --leading-heading-sm: 1.25;
  --text-display: 52px;
  --leading-display: 1.12;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  /* Spacing */
  --spacing-unit: 4px;
  --spacing-4: 4px;
  --spacing-8: 8px;
  --spacing-12: 12px;
  --spacing-16: 16px;
  --spacing-24: 24px;
  --spacing-32: 32px;
  --spacing-40: 40px;
  --spacing-48: 48px;
  --spacing-64: 64px;
  --spacing-80: 80px;
  --spacing-96: 96px;
  --spacing-160: 160px;

  /* Layout */
  --page-max-width: 1200px;
  --section-gap: 96px;
  --card-padding: 24px;
  --element-gap: 8px;

  /* Border Radius */
  --radius-md: 4px;
  --radius-lg: 10px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Named Radii */
  --radius-tags: 9999px;
  --radius-cards: 10px;
  --radius-icons: 4px;
  --radius-inputs: 6px;
  --radius-buttons: 9999px;
  --radius-feature-card: 16px;

  /* Shadows */
  --shadow-md: rgba(0, 0, 0, 0.05) 0px 4px 16px 0px;
  --shadow-sm: rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.1) 0px 2px 4px -2px;
  --shadow-subtle: rgba(0, 0, 0, 0.05) 0px 1px 2px 0px;
  --shadow-xl: rgba(17, 12, 46, 0.12) 0px 12px 45px 0px;

  /* Surfaces */
  --surface-canvas: #fafaf9;
  --surface-card: #ffffff;
  --surface-floating-preview: #ffffff;
  --surface-inverted-section: #1c1917;
}

[data-theme="dark"] {
  --app-canvas: #171b20;
  --app-sidebar: #1d2228;
  --app-surface: #22282f;
  --app-surface-subtle: #293139;
  --app-surface-hover: #303943;
  --app-surface-selected: #20384b;
  --app-text: #f2f5f7;
  --app-text-secondary: #b6c0c9;
  --app-text-muted: #8996a2;
  --app-border: #343d46;
  --app-border-strong: #46515c;
  --app-accent: #65b8f1;
  --app-accent-hover: #7bc5f5;
  --app-accent-soft: #203b4e;
  --app-focus: rgba(101, 184, 241, .3);
  --app-success: #55b887;
  --app-success-soft: #203c30;
  --app-warning: #e0aa4d;
  --app-warning-soft: #40351f;
  --app-danger: #ef7777;
  --app-danger-soft: #442727;
  --app-shadow-card: 0 1px 2px rgba(0, 0, 0, .2);
}

[data-accent="green"] {
  --app-accent: #178a66;
  --app-accent-hover: #0f7657;
  --app-accent-soft: #e8f7f1;
  --app-focus: rgba(23, 138, 102, .24);
}

[data-accent="violet"] {
  --app-accent: #7c3aed;
  --app-accent-hover: #6d28d9;
  --app-accent-soft: #f3e8ff;
  --app-focus: rgba(124, 58, 237, .24);
}

[data-theme="dark"][data-accent="green"] {
  --app-accent: #55c59a;
  --app-accent-hover: #72d2ad;
  --app-accent-soft: #203d34;
  --app-focus: rgba(85, 197, 154, .3);
}

[data-theme="dark"][data-accent="violet"] {
  --app-accent: #a78bfa;
  --app-accent-hover: #b9a5fb;
  --app-accent-soft: #332a50;
  --app-focus: rgba(167, 139, 250, .3);
}
