/* Primitive scales, theme roles, then shared component decisions. */
:root {
  --color-brand-500: var(--figma-color-brand-primary-400);
  --color-brand-600: var(--figma-color-brand-primary-300);
  --color-brand-300: #b2adff;
  --color-brand-100: var(--figma-color-brand-primary-100);
  --color-white: var(--figma-color-utility-white);
  --color-ink-900: var(--figma-color-neutral-900);
  --color-ink-600: var(--figma-color-neutral-800);
  --color-ink-400: var(--figma-color-neutral-700);
  --color-ink-950: #10141d; /* Dark library canvas. */
  --color-green-600: var(--figma-color-support-green-400);
  --color-red-600: var(--figma-color-support-red-400);
  --color-amber-700: var(--figma-color-support-orange-400);
  --color-blue-600: var(--figma-color-support-blue-400);
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-40: 40px;
  --space-48: 48px;
  --space-64: 64px;
  --radius-8: 8px;
  --radius-12: 12px;
  --radius-16: 16px;
  --radius-20: 20px;
  --radius-24: 24px;
  --radius-pill: 999px;
  --font-ui: Dana, Tahoma, sans-serif;
  --font-code: ui-monospace, monospace;
  --text-caption: 12px;
  --text-body: 14px;
  --text-label: 16px;
  --text-title: 20px;
  --text-heading: 24px;
  --text-display: 32px;
  --line-body: 1.8;
  --line-title: 1.35;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-demibold: 600;
  --weight-bold: 700;
  --border-width: 1px;
  --shadow-float: 0 8px 28px rgb(10 31 68 / 10%);
  --shadow-overlay: 0 16px 48px rgb(10 31 68 / 20%);
  --motion-fast: 150ms;
  --motion-panel: 250ms;
  --ease-panel: ease-in-out;
  --breakpoint-mobile: 760px;
  --breakpoint-tablet: 1024px;
  --control-sm: 36px;
  --control-md: 44px;
  --control-lg: 48px;
  --button-radius: var(--radius-12);
  --field-radius: var(--radius-12);
  --panel-radius: var(--radius-16);
  --focus-width: 2px;
  color-scheme: light;
  --theme-canvas: var(--figma-background-surface);
  --theme-surface: var(--figma-background-surface);
  --theme-surface-muted: var(--figma-background-light);
  --theme-surface-raised: var(--figma-background-surface);
  --theme-text: var(--figma-text-main);
  --theme-text-secondary: var(--figma-text-lable);
  --theme-text-muted: var(--figma-text-description);
  --theme-border: var(--figma-line-divider);
  --theme-divider: var(--figma-line-divider);
  --theme-hover: var(--figma-background-light);
  --theme-active: var(--figma-background-primary);
  --theme-focus: var(--figma-line-focus);
  --theme-disabled: var(--figma-background-dark);
  --theme-disabled-text: var(--figma-text-disable);
  --theme-brand: var(--figma-button-primary-default);
  --theme-brand-hover: var(--figma-button-primary-hover);
  --theme-primary-disabled: var(--figma-button-primary-disable);
  --theme-danger-disabled: var(--figma-button-error-disable);
  --theme-primary-text: var(--figma-text-primary);
  --theme-on-brand: var(--figma-text-inverse);
  --theme-success: var(--figma-semantic-success-base);
  --theme-warning: var(--figma-semantic-warning-base);
  --theme-error: var(--figma-semantic-error-base);
  --theme-info: var(--figma-semantic-info-base);
  --theme-danger-solid: var(--figma-button-error-default);
  --theme-danger-hover: var(--figma-button-error-hover);
  --theme-warning-solid: var(--figma-button-warning-default);
  --theme-success-solid: var(--figma-button-success-default);
  --theme-tint-primary: var(--figma-background-primary);
  --theme-tint-success: var(--figma-semantic-success-subtle);
  --theme-tint-warning: var(--figma-semantic-warning-subtle);
  --theme-tint-error: var(--figma-semantic-error-subtle);
  --theme-tint-info: var(--figma-semantic-info-subtle);
  --theme-shadow: var(--color-ink-900);
  --theme-overlay: rgba(10,31,68,.45);
  --theme-scrollbar: #c8ccd6;
  --theme-icon: var(--figma-icons-default);
  --theme-icon-hover: var(--figma-icons-hover);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-canvas: var(--color-ink-950);
  --theme-surface: #181e29;
  --theme-surface-muted: #202837;
  --theme-surface-raised: #252e3e;
  --theme-text: #edf1f8;
  --theme-text-secondary: #bec9dc;
  --theme-text-muted: #a3afc4;
  --theme-border: #65748f;
  --theme-divider: #303c51;
  --theme-hover: #293449;
  --theme-active: #34305a;
  --theme-focus: var(--color-brand-300);
  --theme-disabled: #303b4e;
  --theme-disabled-text: #a3afc4;
  --theme-brand: var(--figma-button-primary-default);
  --theme-brand-hover: #756eff;
  --theme-primary-disabled: var(--theme-disabled);
  --theme-danger-disabled: var(--theme-disabled);
  --theme-primary-text: var(--color-brand-300);
  --theme-on-brand: var(--figma-text-inverse);
  --theme-success: #83dfa0;
  --theme-warning: #ffc46b;
  --theme-error: #ff9298;
  --theme-info: #9dc1ff;
  --theme-danger-solid: #bd2940;
  --theme-danger-hover: color-mix(in srgb,var(--theme-danger-solid) 90%,var(--figma-color-utility-black));
  --theme-warning-solid: #885400;
  --theme-success-solid: #196e39;
  --theme-tint-primary: #2b2949;
  --theme-tint-success: #19372b;
  --theme-tint-warning: #3e3020;
  --theme-tint-error: #402632;
  --theme-tint-info: #21334c;
  --theme-shadow: var(--figma-color-utility-black);
  --theme-overlay: rgba(5,9,16,.72);
  --theme-scrollbar: #596882;
  --theme-icon: #b2bfd4;
  --theme-icon-hover: var(--theme-text-secondary);
  --shadow-float: 0 8px 28px rgb(0 0 0 / 28%);
  --shadow-overlay: 0 16px 48px rgb(0 0 0 / 42%);
}

/* Shared control roles. Dark mode is the existing library palette. */
:root {
  --control-auth: 56px;
  --auth-radius: var(--radius-16);
  --field-border: var(--figma-line-divider);
  --field-border-disabled: var(--figma-line-disable);
  --field-border-error: var(--figma-line-error);
  --field-border-success: var(--figma-line-success);
  --state-primary-text: var(--figma-text-primary);
  --state-success-text: var(--figma-semantic-success-base);
  --state-error-text: var(--figma-semantic-error-base);
  --state-info-text: var(--figma-semantic-info-base);
}
:root[data-theme="dark"] {
  --field-border: #74839f;
  --field-border-disabled: transparent;
  --field-border-error: var(--theme-error);
  --field-border-success: var(--theme-success);
  --state-primary-text: var(--theme-primary-text);
  --state-success-text: var(--theme-success);
  --state-error-text: var(--theme-error);
  --state-info-text: var(--theme-info);
}
