/* ==========================================================================
   Design Tokens — ShopMa CRM v2.0 (Phase 0: Luxe Spa rebrand)
   All colors, spacing, typography, shadows, radius, transitions, z-index.
   Spec: docs/superpowers/specs/2026-04-21-phase-0-design-system-design.md
   ========================================================================== */

:root {
  /* ------------------------------------------------------------------
     Color: Cream slot — REPOINTED to cool clean neutrals
     (page bg, sidebar, borders). Names kept stable for back-compat.
     2026-05-31: Luxe-Spa warm beige → high-contrast cool neutral.
     ------------------------------------------------------------------ */
  --cream-50:  #F8FAFB;
  --cream-100: #F0F2F5;
  --cream-200: #EAEDF1;
  --cream-300: #E1E5EA;
  --cream-500: #C7CDD6;
  --cream-700: #6B7686;
  --cream-900: #3C4654;

  /* ------------------------------------------------------------------
     Color: Espresso slot — REPOINTED to neutral dark (text/contrast).
     ------------------------------------------------------------------ */
  --espresso-50:  #F4F6F8;
  --espresso-100: #E1E5EA;
  --espresso-300: #AAB3BF;
  --espresso-500: #6B7686;
  --espresso-700: #3C4654;
  --espresso-900: #15202B;

  /* ------------------------------------------------------------------
     Color: Gold slot — REPOINTED to indigo (accent / emphasis).
     ------------------------------------------------------------------ */
  --gold-50:  #EFF4FE;
  --gold-100: #DBEAFE;
  --gold-300: #93B4F7;
  --gold-500: #2563EB;
  --gold-700: #1E40AF;
  --gold-900: #1E3A8A;

  /* ------------------------------------------------------------------
     Color: Brass slot — REPOINTED to indigo (primary CTA / interactive).
     ------------------------------------------------------------------ */
  --brass-50:  #EFF4FE;
  --brass-100: #DBEAFE;
  --brass-300: #93B4F7;
  --brass-500: #2563EB;
  --brass-700: #1D4ED8;
  --brass-900: #1E3A8A;

  /* ------------------------------------------------------------------
     Color: Sage slot — REPOINTED to clean green (success, positive).
     ------------------------------------------------------------------ */
  --sage-50:  #DCFCE7;
  --sage-100: #BBF7D0;
  --sage-300: #86EFAC;
  --sage-500: #22C55E;
  --sage-700: #15803D;
  --sage-900: #14532D;

  /* ------------------------------------------------------------------
     Color: Semantic — Surfaces & Borders
     (Names are STABLE — values are what changed.)
     ------------------------------------------------------------------ */
  --color-bg:           var(--cream-50);     /* #FBF9F4 page background */
  --color-surface:      #FFFFFF;             /* card / panel */
  --color-surface-alt:  var(--cream-100);    /* hover / subtle */
  --color-sidebar:      #FFFFFF;             /* clean white sidebar */
  --color-sidebar-text:        var(--espresso-700);     /* sidebar item label */
  --color-sidebar-text-active: var(--color-primary);    /* sidebar active item — indigo */
  --color-sidebar-hover:       var(--cream-100);         /* sidebar item hover bg */
  --color-sidebar-active-bg:   var(--color-primary-light); /* sidebar active item bg — indigo soft */
  --color-border:       var(--cream-300);    /* hairline */
  --color-border-dark:  var(--cream-500);    /* stronger border */
  --color-divider:      var(--cream-100);

  /* ------------------------------------------------------------------
     Color: Semantic — Text
     ------------------------------------------------------------------ */
  --color-text:           var(--espresso-900); /* #1F1A16 body */
  --color-text-secondary: var(--espresso-700); /* #3D332C */
  --color-text-muted:     #6B7686;             /* cool grey — high-contrast on white */
  --color-text-inverse:   var(--cream-50);     /* on dark bg */
  --color-text-on-primary: #FFFFFF;             /* text on filled colored buttons (brass/sage/danger) */

  /* ------------------------------------------------------------------
     Color: Semantic — Brand & Action
     ------------------------------------------------------------------ */
  --color-primary:        var(--brass-500);   /* #2563EB indigo CTA */
  --color-primary-light:  var(--brass-100);
  --color-primary-hover:  var(--brass-700);
  --color-primary-ring:   rgba(37, 99, 235, 0.25);

  --color-accent:         var(--gold-500);    /* indigo — emphasis */
  --color-accent-soft:    var(--gold-50);     /* badge bg */
  --color-accent-strong:  var(--gold-700);

  /* ------------------------------------------------------------------
     Color: Semantic — Status
     ------------------------------------------------------------------ */
  --color-success:       var(--sage-700);    /* #15803D */
  --color-success-light: var(--sage-50);
  --color-success-hover: var(--sage-900);
  --color-success-ring:  rgba(22, 163, 74, 0.20);

  --color-danger:        #DC2626;             /* clean red */
  --color-danger-light:  #FEE2E2;
  --color-danger-hover:  #B91C1C;
  --color-danger-ring:   rgba(220, 38, 38, 0.22);

  --color-warning:       #D97706;             /* amber (kept) */
  --color-warning-light: #FEF3C7;
  --color-warning-hover: #B45309;
  --color-warning-ring:  rgba(217, 119, 6, 0.20);

  --color-info:          #0EA5E9;             /* sky — distinct from indigo primary */
  --color-info-light:    #E0F2FE;
  --color-info-hover:    #0369A1;
  --color-info-ring:     rgba(14, 165, 233, 0.20);

  /* ------------------------------------------------------------------
     Spacing (4px base) — UNCHANGED
     ------------------------------------------------------------------ */
  --space-0:  0;
  --space-px: 1px;
  --space-0-5: 0.125rem;
  --space-1:  0.25rem;
  --space-1-5: 0.375rem;
  --space-2:  0.5rem;
  --space-2-5: 0.625rem;
  --space-3:  0.75rem;
  --space-3-5: 0.875rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-7:  1.75rem;
  --space-8:  2rem;
  --space-9:  2.25rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ------------------------------------------------------------------
     Typography
     ------------------------------------------------------------------ */
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas,
    'Courier New', monospace;

  --text-xs:   0.6875rem;   /* 11px */
  --text-sm:   0.78125rem;  /* 12.5px */
  --text-base: 0.84375rem;  /* 13.5px */
  --text-md:   0.90625rem;  /* 14.5px */
  --text-lg:   1rem;        /* 16px */
  --text-xl:   1.125rem;    /* 18px */
  --text-2xl:  1.25rem;     /* 20px */
  --text-3xl:  1.625rem;    /* 26px */
  --text-4xl:  2rem;        /* 32px */

  --leading-none:    1;
  --leading-tight:   1.25;
  --leading-snug:    1.375;
  --leading-normal:  1.55;  /* was 1.5 — extra room for vi diacritics */
  --leading-relaxed: 1.7;

  --font-light:    300;
  --font-regular:  400;
  --font-medium:   500;     /* default body weight */
  --font-semibold: 600;
  --font-bold:     700;

  --tracking-tight:  -0.025em;
  --tracking-normal: 0;
  --tracking-wide:   0.025em;
  --tracking-label:  1.2px;  /* uppercase labels */

  /* ------------------------------------------------------------------
     Shadows — softer, warmer (less cool-blue tinted)
     ------------------------------------------------------------------ */
  --shadow-xs:  0 1px 2px rgba(20, 30, 45, 0.05);
  --shadow-sm:  0 1px 3px rgba(20, 30, 45, 0.08), 0 1px 2px rgba(20, 30, 45, 0.05);
  --shadow-md:  0 4px 6px -1px rgba(20, 30, 45, 0.10), 0 2px 4px -2px rgba(20, 30, 45, 0.06);
  --shadow-lg:  0 10px 15px -3px rgba(20, 30, 45, 0.10), 0 4px 6px -4px rgba(20, 30, 45, 0.06);
  --shadow-xl:  0 20px 25px -5px rgba(20, 30, 45, 0.12), 0 8px 10px -6px rgba(20, 30, 45, 0.06);
  --shadow-2xl: 0 25px 50px -12px rgba(20, 30, 45, 0.22);
  --shadow-inner: inset 0 2px 4px 0 rgba(20, 30, 45, 0.06);

  /* ------------------------------------------------------------------
     Border Radius — UNCHANGED
     ------------------------------------------------------------------ */
  --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;

  /* ------------------------------------------------------------------
     Transitions — UNCHANGED
     ------------------------------------------------------------------ */
  --transition-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:   200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:   300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ------------------------------------------------------------------
     Z-Index — UNCHANGED
     ------------------------------------------------------------------ */
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-sidebar:   300;
  --z-topbar:    400;
  --z-overlay:   500;
  --z-modal:     600;
  --z-toast:     700;
  --z-tooltip:   800;

  /* ------------------------------------------------------------------
     Layout Constants
     ------------------------------------------------------------------ */
  --sidebar-width:           232px;  /* was 260px — tighter */
  --sidebar-collapsed-width: 64px;
  --topbar-height:           56px;
  --content-max-width:       1400px;
  --content-padding:         var(--space-7);  /* 28px — was space-6 */
  --card-padding:            var(--space-5);
}

/* ==================================================================
   Back-compat aliases for short/alternate token names used by JS
   page templates. These resolve to the canonical design tokens so
   pre-existing inline style="background:var(--bg-secondary,#fff)"
   patterns render warm instead of cool fallback hex.
   Long-term plan: migrate consumers to the canonical names and
   remove this block in a subsequent refactor.
   ================================================================== */
:root {
  /* Surface shortnames */
  --bg-secondary:  var(--color-surface-alt);
  --bg-tertiary:   var(--color-surface-alt);
  --bg-muted:      var(--cream-100);
  --border-color:  var(--color-border);

  /* Text shortnames */
  --text-tertiary: var(--color-text-muted);
  --text-primary:  var(--color-text);
  --text-muted:    var(--color-text-muted);

  /* Status shortnames */
  --danger:        var(--color-danger);
  --danger-500:    var(--color-danger);
  --danger-600:    var(--color-danger-hover);
  --danger-light:  var(--color-danger-light);
  --danger-soft:   var(--color-danger-light);

  --success:       var(--color-success);
  --success-500:   var(--color-success);
  --success-600:   var(--color-success-hover);
  --success-light: var(--color-success-light);
  --success-soft:  var(--color-success-light);

  --warning:       var(--color-warning);
  --warning-500:   var(--color-warning);
  --warning-light: var(--color-warning-light);
  --warning-soft:  var(--color-warning-light);

  --info:          var(--color-info);
  --info-500:      var(--color-info);
  --info-light:    var(--color-info-light);
  --info-soft:     var(--color-info-light);
}

/* ==================================================================
   THEME: Blue (cool, clean) — overrides semantic tokens only.
   Activated via <html data-theme="blue">.
   ================================================================== */
:root[data-theme="blue"] {
  --color-bg:           #F4F8FD;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #E9F1FB;
  --color-sidebar:      #2956A8;
  --color-sidebar-text:        #FFFFFF;
  --color-sidebar-text-active: #FFFFFF;
  --color-sidebar-hover:       #3A67B7;
  --color-sidebar-active-bg:   #1E4485;
  --color-border:       #C9DAEC;
  --color-border-dark:  #94B0CD;
  --color-divider:      #E9F1FB;

  --color-text:           #0F2540;
  --color-text-secondary: #1F3A5F;
  --color-text-muted:     #5A748F;
  --color-text-inverse:   #F4F8FD;
  --color-text-on-primary: #FFFFFF;

  --color-primary:        #2F6BCC;
  --color-primary-light:  #D4E4F8;
  --color-primary-hover:  #1F55A8;
  --color-primary-ring:   rgba(47, 107, 204, 0.20);

  --color-accent:         #14B8E6;
  --color-accent-soft:    #DAF1FA;
  --color-accent-strong:  #0E92B8;

  --color-success:       #15803D;
  --color-success-light: #DCFCE7;
  --color-success-hover: #14532D;
  --color-success-ring:  rgba(21, 128, 61, 0.20);

  --color-info:          #3B82F6;
  --color-info-light:    #DBEAFE;
  --color-info-hover:    #1D4ED8;
  --color-info-ring:     rgba(59, 130, 246, 0.20);
}

/* ==================================================================
   THEME: Navy (deep, premium) — overrides semantic tokens only.
   Activated via <html data-theme="navy">.
   ================================================================== */
:root[data-theme="navy"] {
  --color-bg:           #EEF1F6;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #DEE5EF;
  --color-sidebar:      #1B2A4E;
  --color-sidebar-text:        #C7D1E3;
  --color-sidebar-text-active: #FFFFFF;
  --color-sidebar-hover:       #2B3D67;
  --color-sidebar-active-bg:   #2B3D67;
  --color-border:       #C2CCDA;
  --color-border-dark:  #8A99B0;
  --color-divider:      #DEE5EF;

  --color-text:           #0A1330;
  --color-text-secondary: #1B2A4E;
  --color-text-muted:     #5A6680;
  --color-text-inverse:   #F0F4FA;
  --color-text-on-primary: #FFFFFF;

  --color-primary:        #1B2A4E;
  --color-primary-light:  #D4DAE6;
  --color-primary-hover:  #0E1937;
  --color-primary-ring:   rgba(27, 42, 78, 0.22);

  --color-accent:         #C39A48;
  --color-accent-soft:    #F5EAD0;
  --color-accent-strong:  #8F6E2D;

  --color-success:       #1F6B4D;
  --color-success-light: #D6EFE2;
  --color-success-hover: #134B36;
  --color-success-ring:  rgba(31, 107, 77, 0.20);

  --color-info:          #3B5A99;
  --color-info-light:    #DCE5F5;
  --color-info-hover:    #25406F;
  --color-info-ring:     rgba(59, 90, 153, 0.20);
}

