/* kdg-* Design Tokens */
:root {
  /* --- Color: canvas --- */
  --kdg-color-canvas: #f6f6f7;
  --kdg-color-surface: #ffffff;
  --kdg-color-raised: #ffffff;
  --kdg-color-overlay: rgba(15, 15, 17, 0.45);

  /* --- Color: text --- */
  --kdg-color-text-primary: #1f2024;
  --kdg-color-text-secondary: #5b6068;
  --kdg-color-text-tertiary: #8a8f99;
  --kdg-color-text-inverse: #ffffff;
  --kdg-color-text-link: #2b6cff;

  /* --- Color: border --- */
  --kdg-color-border-subtle: #ececef;
  --kdg-color-border-strong: #d9d9de;
  --kdg-color-border-focus: #2b6cff;

  /* --- Color: brand --- */
  --kdg-color-brand-primary: #ff5555;
  --kdg-color-brand-primary-hover: #ff3d3d;
  --kdg-color-brand-primary-soft: #fff1f1;
  --kdg-color-brand-secondary: #303030;

  /* --- Color: state --- */
  --kdg-color-state-success: #1f9d55;
  --kdg-color-state-success-soft: #e6f6ec;
  --kdg-color-state-warning: #b97400;
  --kdg-color-state-warning-soft: #fff4d6;
  --kdg-color-state-danger: #d93025;
  --kdg-color-state-danger-soft: #fdecea;
  --kdg-color-state-info: #1f6feb;
  --kdg-color-state-info-soft: #e6f0fd;
  --kdg-color-state-neutral: #6b7280;
  --kdg-color-state-neutral-soft: #f1f1f4;

  /* --- Type: family --- */
  --kdg-font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --kdg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* --- Type: scale (1.2 ratio, body 14) --- */
  --kdg-font-size-2xs: 0.6875rem;  /* 11 */
  --kdg-font-size-xs:  0.75rem;    /* 12 */
  --kdg-font-size-sm:  0.8125rem;  /* 13 */
  --kdg-font-size-md:  0.875rem;   /* 14 */
  --kdg-font-size-lg:  1rem;       /* 16 */
  --kdg-font-size-xl:  1.125rem;   /* 18 */
  --kdg-font-size-2xl: 1.375rem;   /* 22 */
  --kdg-font-size-3xl: 1.75rem;    /* 28 */
  --kdg-font-size-4xl: 2.25rem;    /* 36 */

  /* --- Type: weight --- */
  --kdg-font-weight-regular: 400;
  --kdg-font-weight-medium:  500;
  --kdg-font-weight-semibold: 600;
  --kdg-font-weight-bold:    700;

  /* --- Type: line-height --- */
  --kdg-line-height-tight: 1.2;
  --kdg-line-height-snug:  1.35;
  --kdg-line-height-base:  1.5;
  --kdg-line-height-loose: 1.7;

  /* --- Space: 4-pt grid --- */
  --kdg-space-0: 0;
  --kdg-space-1: 0.25rem;  /* 4 */
  --kdg-space-2: 0.5rem;   /* 8 */
  --kdg-space-3: 0.75rem;  /* 12 */
  --kdg-space-4: 1rem;     /* 16 */
  --kdg-space-5: 1.25rem;  /* 20 */
  --kdg-space-6: 1.5rem;   /* 24 */
  --kdg-space-7: 2rem;     /* 32 */
  --kdg-space-8: 2.5rem;   /* 40 */
  --kdg-space-9: 3rem;     /* 48 */
  --kdg-space-10: 4rem;    /* 64 */

  /* --- Radius --- */
  --kdg-radius-xs: 4px;
  --kdg-radius-sm: 6px;
  --kdg-radius-md: 10px;
  --kdg-radius-lg: 14px;
  --kdg-radius-xl: 20px;
  --kdg-radius-pill: 999px;

  /* --- Shadow --- */
  --kdg-shadow-elev-0: none;
  --kdg-shadow-elev-1: 0 1px 2px rgba(15, 17, 21, 0.04), 0 1px 3px rgba(15, 17, 21, 0.05);
  --kdg-shadow-elev-2: 0 4px 12px rgba(15, 17, 21, 0.08), 0 2px 4px rgba(15, 17, 21, 0.04);
  --kdg-shadow-elev-3: 0 12px 32px rgba(15, 17, 21, 0.12), 0 4px 8px rgba(15, 17, 21, 0.06);
  --kdg-shadow-focus-ring: 0 0 0 3px rgba(43, 108, 255, 0.18);

  /* --- Motion --- */
  --kdg-duration-fast:   120ms;
  --kdg-duration-base:   200ms;
  --kdg-duration-slow:   320ms;
  --kdg-ease-out:        cubic-bezier(0.2, 0.7, 0.2, 1);
  --kdg-ease-in:         cubic-bezier(0.7, 0, 0.84, 0);
  --kdg-ease-in-out:     cubic-bezier(0.5, 0, 0.5, 1);

    --kdg-t-fast: var(--kdg-duration-fast) var(--kdg-ease-out);
  --kdg-t-base: var(--kdg-duration-base) var(--kdg-ease-out);
  --kdg-t-slow: var(--kdg-duration-slow) var(--kdg-ease-out);

  /* --- Z-index scale --- */
  --kdg-z-base:    1;
  --kdg-z-sticky:  100;
  --kdg-z-overlay: 800;
  --kdg-z-modal:   900;
  /* Toast sits above modals/drawers (incl. the hardcoded rsvp drawer @1050
     and add-guest modal @1060) so notifications are never hidden behind an
     edit sidebar. Stays below tooltip/help @1100. */
  --kdg-z-toast:   1090;
  --kdg-z-tooltip: 1100;

  /* --- Layout --- */
  --kdg-layout-header-height: 56px;
  --kdg-layout-tabs-height:    48px;
  --kdg-layout-rail-width:     240px;
  --kdg-layout-rail-width-collapsed: 48px;
  --kdg-layout-context-width:  300px;
  --kdg-layout-max-width:      1480px;
  --kdg-layout-gutter:         var(--kdg-space-6);

    --kdg-warm-canvas:    #fafaf7;
  --kdg-warm-surface:   #ffffff;
  --kdg-warm-border:    rgba(15, 23, 42, 0.06);
  --kdg-warm-surface-hover: rgba(15, 23, 42, 0.02);
  --kdg-brand-soft:     rgba(109, 40, 217, 0.12);
  --kdg-ts-radius-card: 14px;
  --kdg-ts-shadow-card: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --kdg-brand-gradient: linear-gradient(135deg, #7c5cff 0%, #ff6aa9 100%);
  --kdg-ts-font-display: 'Instrument Serif', Georgia, serif;
  --kdg-ts-font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --kdg-duration-fast: 0ms;
    --kdg-duration-base: 0ms;
    --kdg-duration-slow: 0ms;
  }
}
