/* css/tokens.css — 단일 디자인 토큰 원천
   light 기본 + [data-theme="dark"] 오버라이드.
   기존 --navy/--teal/--red/--surface/--text1 등 레거시 별칭을 그대로 제공하여
   HTML 인라인 style과 JS의 var(--*) 참조가 호환 유지됨. */

:root {
  /* ── 원시 팔레트 (테마 불변) ── */
  --c-navy-700: #1e40af;
  --c-navy-600: #2563eb;
  --c-navy-500: #3b82f6;
  --c-navy-400: #60a5fa;
  --c-emerald-700: #047857;
  --c-emerald-600: #059669;
  --c-emerald-500: #10b981;
  --c-emerald-300: #6ee7b7;
  --c-emerald-100: #d1fae5;
  --c-amber-600: #d97706;
  --c-amber-500: #f59e0b;
  --c-amber-300: #fcd34d;
  --c-amber-100: #fef3c7;
  --c-red-600: #dc2626;
  --c-red-500: #ef4444;
  --c-red-300: #fca5a5;
  --c-red-100: #fee2e2;
  --c-blue-600: #2563eb;
  --c-blue-500: #3b82f6;
  --c-blue-300: #93c5fd;
  --c-blue-100: #dbeafe;
  --c-violet-600: #7c3aed;
  --c-violet-500: #8b5cf6;
  --c-indigo-500: #6366f1;
  --c-indigo-400: #818cf8;

  /* 보존: css-version.js palette 토큰 (applyCustomerPalette가 덮어쓸 수 있음) */
  --premium-active: #005aaa;
  --premium-normal: #005aaa;
  --renewal-text: #b83232;
  --renewal-bg: #ffe8e8;
  --important-bg: #0a9e82;
  --table-border: #e8e8e8;

  /* ── 의미 토큰 (light 기본) ── */
  --brand: #1e40af;
  --brand-hover: #2563eb;
  --brand-soft: #dbeafe;
  --brand-soft-rgb: 37, 99, 235;

  --accent: var(--brand);
  --accent-soft: #ede9fe;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-solid: #7c3aed;

  --success: #059669;
  --success-hover: #047857;
  --success-soft: #d1fae5;
  --success-border: #10b981;

  --warning: #d97706;
  --warning-soft: #fef3c7;
  --warning-border: #f59e0b;

  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --danger-border: #ef4444;

  --info: #2563eb;
  --info-soft: #dbeafe;
  --info-border: #93c5fd;

  --renewal: #b83232;
  --important: #0a9e82;

  /* 표면/텍스트/보더 (light) */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --border-light: #e8e8e8;

  --text-1: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --text-4: #9ca3af;

  /* gray 스케일 (auth.css가 var(--gray-*) 참조) */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* ── 레거시 호환 별칭 ── */
  --primary: 0 0 0;
  --primary-light: 181 181 181;
  --primary-dark: 0 0 0;
  --navy: var(--brand);
  --navy2: #2563eb;
  --navy3: #3b82f6;
  --teal: var(--success);
  --teal2: var(--success-hover);
  --teal-bg: var(--success-soft);
  --teal-border: var(--success-border);
  --amber: var(--warning);
  --amber-bg: var(--warning-soft);
  --amber-border: var(--warning-border);
  --red: var(--danger);
  --red-bg: var(--danger-soft);
  --red-border: var(--danger-border);
  --blue: var(--info);
  --blue-bg: var(--info-soft);
  --blue-border: var(--info-border);
  --surface1: var(--surface);
  --surface2: var(--surface-2);
  --surface3: var(--surface-3);
  --border2: var(--border-strong);
  --text1: var(--text-1);
  --text2: var(--text-2);
  --text3: var(--text-3);
  --text4: var(--text-4);
  --emph: var(--brand);
  --warn: var(--warning);

  /* ── 스페이스 스케일 (4px 베이스) ── */
  --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;

  /* ── 타이포 스케일 ── */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 15px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --leading-tight: 1.4;
  --leading-normal: 1.6;
  --leading-loose: 1.7;

  /* ── 반경 스케일 ── */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  /* ── 그림자 스케일 ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.12);

  /* ── 타이포그래피 ── */
  --font-sans: 'Noto Sans KR', 'Pretendard', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --font: var(--font-sans);

  /* ── z-index 스케일 ── */
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-overlay: 2000;
  --z-modal: 9000;
  --z-toast: 9999;

  /* ── 트랜지션 ── */
  --transition-fast: 0.15s ease;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;

  --focus-ring: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

/* ── 다크 테마 오버라이드 ── */
[data-theme="dark"] {
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --brand-soft: rgba(59, 130, 246, 0.15);
  --brand-soft-rgb: 59, 130, 246;

  --accent: var(--brand);
  --accent-soft: rgba(167, 139, 250, 0.15);
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  --accent-solid: #a78bfa;

  --success: #10b981;
  --success-hover: #34d399;
  --success-soft: rgba(16, 185, 129, 0.15);
  --success-border: #6ee7b7;

  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --warning-border: #fcd34d;

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --danger-border: #fca5a5;

  --info: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.15);
  --info-border: #93c5fd;

  --renewal: #f87171;
  --important: #34d399;

  --bg: #000000;
  --surface: #111111;
  --surface-2: #1a1a1a;
  --surface-3: #222222;
  --border: #333333;
  --border-strong: #444444;
  --border-light: #2a2a2a;

  --text-1: #ffffff;
  --text-2: #cccccc;
  --text-3: #888888;
  --text-4: #555555;

  --gray-50: #1a1a1a;
  --gray-100: #222222;
  --gray-200: #333333;
  --gray-300: #444444;
  --gray-400: #555555;
  --gray-500: #666666;
  --gray-600: #888888;
  --gray-700: #aaaaaa;
  --gray-800: #cccccc;
  --gray-900: #eeeeee;
  --gray-950: #f8f8f8;

  /* 레거시 별칭 다크값 (var() 참조가 자동 추종하지만 명시로 안전) */
  --navy: #2563eb;
  --navy2: #3b82f6;
  --navy3: #60a5fa;
  --teal: #10b981;
  --teal2: #059669;
  --teal-bg: rgba(16, 185, 129, 0.15);
  --teal-border: #6ee7b7;
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.15);
  --amber-border: #fcd34d;
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.15);
  --red-border: #fca5a5;
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.15);
  --blue-border: #93c5fd;
  --surface1: #111111;
  --surface2: #1a1a1a;
  --surface3: #222222;
  --border2: #444444;
  --text1: #ffffff;
  --text2: #cccccc;
  --text3: #888888;
  --text4: #555555;
  --emph: #3b82f6;
  --warn: #f59e0b;

  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 32px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
