/*
  ═══════════════════════════════════════════════════════════
   PROOF CRM — DESIGN TOKENS v1.0
   Spatial UI + Modern Glassmorphism
   Single source of truth for all visual properties.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ui-scale: 1; /* 0.85=small, 1=standard, 1.25=Hugh Mungus */
  --laser-glow: #B95CE4; /* Default laser beam color */
}

/* ─── Smooth Theme Transition ─── */
*,
*::before,
*::after {
  transition: background-color 0.3s ease,
              color 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease;
}

/* ─── CSS Custom Properties: Dark Mode (Default) ─── */
:root,
:root[data-theme="dark"] {
  /* ── Core Surfaces ── */
  --surface-0: #1A1522;          /* Deepest background (page) */
  --surface-1: #1F1A2C;          /* Elevated surface (cards) */
  --surface-2: #252036;          /* Higher elevation (modals, drawers) */
  --surface-3: #2E2842;          /* Highest elevation (dropdowns, tooltips) */
  --surface-glass: rgba(31, 26, 44, 0.72);  /* Glass base */
  --surface-glass-hover: rgba(37, 32, 54, 0.85);
  --overlay-bg: rgba(26, 21, 34, 0.92);

  /* ── Borders & Dividers ── */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.20);
  --border-active: rgba(0, 229, 255, 0.45);   /* Brighter neon cyan for focus */
  --border-orange: rgba(255, 125, 0, 0.45);   /* Proof brand accent */

  /* ── Typography ── */
  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #6b7b8d;
  --text-inverse: #1A1522;
  --text-heading: #ffffff;
  --text-accent: #00e5ff;        /* Brighter neon cyan for highlights */
  --text-success: #34d399;
  --text-warning: #fbbf24;
  --text-danger: #f87171;
  --text-brand: #B95CE4;         /* Proof Construction orange */

  /* ── Typography Scale ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --text-xs: 0.65rem;
  --text-sm: 0.78rem;
  --text-base: 0.88rem;
  --text-md: 1.0rem;
  --text-lg: 1.15rem;
  --text-xl: 1.35rem;
  --text-2xl: 1.6rem;
  --text-3xl: 2.0rem;
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ── Spacing Scale (4px base) ── */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ── Radii ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow-cyan: 0 0 20px rgba(0, 229, 255, 0.20);
  --shadow-glow-orange: 0 0 20px rgba(255, 125, 0, 0.20);
  --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.65);

  /* ── Card Elevation (for hover transitions) ── */
  --card-shadow: 0 1px 3px rgba(0,0,0,0.25);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,0.45);
  --card-border: 1px solid var(--glass-border);

  /* ── Border Weights ── */
  --border-hairline: 0.5px;
  --border-thin: 1px;
  --border-medium: 2px;

  /* ── Pill Input Tokens ── */
  --input-pill-radius: 9999px;
  --input-pill-bg: rgba(255,255,255,0.05);
  --input-pill-border: var(--border-subtle);
  --input-pill-focus-border: var(--brand);
  --input-pill-focus-glow: 0 0 0 3px rgba(185,92,228,0.20);

  /* ── Empty State Tokens ── */
  --empty-icon-size: 2.5rem;
  --empty-text-color: var(--text-muted);
  --empty-bg: rgba(255,255,255,0.02);

  /* ── Brand Colors ── */
  --brand: #7c3aed;
  --brand-hover: #D480F5;
  --brand-dim: rgba(185, 92, 228, 0.15);
  --brand-light: #D4A0F5;
  --accent-cyan: #00F0FF;
  --accent-cyan-dim: rgba(0, 229, 255, 0.12);
  --accent-teal: #40E8D8;
  --accent-blue: #3b82f6;
  --accent-blue-dim: rgba(59, 130, 246, 0.10);
  --accent-green: #34d399;
  --accent-green-dim: rgba(52, 211, 153, 0.10);
  --accent-amber: #fbbf24;
  --accent-amber-dim: rgba(251, 191, 36, 0.10);
  --accent-red: #f87171;
  --accent-red-dim: rgba(248, 113, 113, 0.10);
  --accent-purple: #a78bfa;
  --accent-purple-dim: rgba(167, 139, 250, 0.10);

  /* ── Status / Semantic ── */
  --status-draft: #64748b;
  --status-active: #3b82f6;
  --status-won: #34d399;
  --status-lost: #f87171;
  --status-on-hold: #fbbf24;
  --status-scheduled: #a78bfa;

  /* ── Glassmorphism Engine ── */
  --blur-glass-sm: blur(8px);
  --blur-glass-md: blur(16px);
  --blur-glass-lg: blur(24px);
  --glass-bg: rgba(15, 23, 41, 0.65);
  --glass-bg-heavy: rgba(10, 14, 23, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-highlight: rgba(255, 255, 255, 0.03);

  /* ── Scrims / Overlays ── */
  --scrim: rgba(10, 14, 23, 0.70);
  --scrim-heavy: rgba(10, 14, 23, 0.90);

  /* ── Micro-interaction Tokens ── */
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --duration-snap: 150ms;
  --duration-fluid: 300ms;
  --duration-slow: 500ms;

  /* ── Layout ── */
  --header-height: 52px;         /* Top bar height */
  --sidebar-width: 220px;        /* Expanded sidebar width */
  --sidebar-collapsed: 56px;     /* Collapsed icon-only sidebar */
  --nav-mobile-height: 64px;     /* Bottom mobile nav bar */
  --content-max: 1400px;
  --touch-target: 48px;
  --touch-spacing: 8px;

  /* ── Legacy Aliases (backward compat with existing template inline styles) ── */
  --bg: var(--surface-0);
  --bg-elevated: var(--surface-1);
  --card: var(--surface-1);
  --card-hover: var(--surface-2);
  --border: var(--border-default);
  --border-light: var(--border-strong);
  --text: var(--text-primary);
  --brand-soft: var(--brand-dim);
  --brand-glow: rgba(255, 125, 0, 0.30);
  --danger: var(--text-danger);
  --success: var(--text-success);
  --warning: var(--text-warning);
  --info: var(--accent-blue);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --radius: var(--radius-lg);
  --radius-xs: var(--radius-sm);
  --transition: var(--ease-smooth);
  --topbar-h: var(--header-height);
  --sidebar-w: var(--sidebar-width);
}

/* ─── Light Mode Overrides ─── */
:root {
  /* CRM standalone template tokens */
  --nav-height: 60px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
  /* ── Core Surfaces ── */
  --surface-0: #f0f2f6;
  --surface-1: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f4;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --surface-glass-hover: rgba(255, 255, 255, 0.95);
  --overlay-bg: rgba(0, 0, 0, 0.72);

  /* ── Borders & Dividers ── */
  --border-subtle: rgba(0, 0, 0, 0.10);
  --border-default: rgba(0, 0, 0, 0.18);
  --border-strong: rgba(0, 0, 0, 0.30);
  --border-active: rgba(0, 150, 200, 0.60);
  --border-orange: rgba(255, 125, 0, 0.50);

  /* ── Typography ── */
  --text-primary: #0a0e17;
  --text-secondary: #1a202c;
  --text-muted: #4a5568;
  --text-inverse: #f0f4fc;
  --text-heading: #05080f;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.18);
  --shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.24);
  --shadow-xl: 0 20px 56px rgba(0, 0, 0, 0.28);
  --shadow-glow-cyan: 0 0 24px rgba(0, 180, 220, 0.20);
  --shadow-glow-orange: 0 0 24px rgba(255, 125, 0, 0.22);

  /* ── Card Elevation ── */
  --card-shadow: 0 1px 4px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 8px 28px rgba(0,0,0,0.16);
  --card-border: 1px solid var(--glass-border);

  /* ── Pill Input Tokens ── */
  --input-pill-radius: 9999px;
  --input-pill-bg: rgba(0,0,0,0.03);
  --input-pill-border: rgba(0,0,0,0.10);
  --input-pill-focus-border: var(--brand);
  --input-pill-focus-glow: 0 0 0 3px rgba(255,125,0,0.18);

  /* ── Empty State Tokens ── */
  --empty-icon-size: 2.5rem;
  --empty-text-color: var(--text-muted);
  --empty-bg: rgba(0,0,0,0.02);

  /* ── Glassmorphism ── */
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-bg-heavy: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0, 0, 0, 0.09);
  --glass-highlight: rgba(255, 255, 255, 0.50);

  /* ── Scrims ── */
  --scrim: rgba(0, 0, 0, 0.50);
  --scrim-heavy: rgba(0, 0, 0, 0.70);

  /* ── Brand dims (slightly more opaque for light) ── */
  --brand-dim: rgba(185, 92, 228, 0.10);
  --brand-light: #D480F5;
  --accent-cyan-dim: rgba(0, 180, 220, 0.10);
  --accent-teal: #00a0b4;

  /* ── Status / Semantic (light-optimized) ── */
  --status-draft: #64748b;
  --status-active: #2563eb;
  --status-won: #16a34a;
  --status-lost: #dc2626;
  --status-on-hold: #d97706;
  --status-scheduled: #7c3aed;

  /* ── Accent colors (darkened for light bg contrast) ── */
  --accent-amber: #d97706;
  --accent-amber-dim: rgba(217, 119, 6, 0.10);
  --accent-cyan: #0099aa;
  --accent-blue: #2563eb;
  --accent-blue-dim: rgba(37, 99, 235, 0.10);
  --accent-green: #16a34a;
  --accent-green-dim: rgba(22, 163, 74, 0.10);
  --accent-red: #dc2626;
  --accent-red-dim: rgba(220, 38, 38, 0.10);
  --accent-purple: #7c3aed;
  --accent-purple-dim: rgba(124, 58, 237, 0.10);

  /* ── Text accents (darkened for light bg) ── */
  --text-accent: #008899;
  --text-success: #16a34a;
  --text-warning: #b45309;
  --text-danger: #dc2626;
  --text-brand: #9333ea;

  /* ── Legacy Light Aliases ── */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --card: var(--surface-1);
  --card-hover: var(--surface-2);
  --bg: var(--surface-0);
  --bg-elevated: var(--surface-1);
  --border: var(--border-default);
  --border-light: var(--border-strong);
  --text: var(--text-primary);
  --brand-soft: var(--brand-dim);
  --brand-glow: rgba(185, 92, 228, 0.22);
  --danger: var(--text-danger);
  --success: var(--text-success);
  --warning: var(--text-warning);
  --info: var(--accent-blue);
}

/* ─── Crew & Detail Page Tokens (referenced by standalone templates) ─── */
:root {
  --text-dim: var(--text-muted);
  --orange: var(--brand);
  --orange-dim: var(--brand-dim);
  --orange-light: var(--brand-light);
  --orange-dark: #cc6400;
  --green: var(--text-success);
  --red: var(--text-danger);
  --yellow: var(--text-warning);
  --gray: var(--text-secondary);
  --dark: var(--surface-0);
  --dark-2: var(--surface-1);
  --dark-3: var(--surface-2);
  --white: var(--text-primary);
  --black: #000000;
  --charcoal: #1a1a2e;
  --light-gray: var(--text-secondary);
  --surface: var(--surface-1);
  --surface-hover: var(--surface-2);
  --card-border: var(--border-default);
  --bg-card: var(--card);
  --text-main: var(--text-primary);
  --text-light: var(--text-secondary);
  --heading: var(--text-heading);
  --font-heading: var(--font-sans);
  --font-body: var(--font-sans);
  --shadow: var(--shadow-md);
  --quickbar-bg: var(--surface-2);
  --task-border: var(--border-default);
  --task-card-bg: var(--card);
  --task-glow: var(--shadow-glow-cyan);
  --task-hover-border: var(--border-active);
  --transition-fast: var(--duration-snap);
}

/* ═══════════════════════════════════════════════════════════════
   LEGACY ALIASES — Phase 2.A CSS Consolidation
   Maps tokens.css & crew-theme.css variables to unified tokens.
   Remove when all templates use canonical --surface-* / --text-*.
   ═══════════════════════════════════════════════════════════════ */

/* ── tokens.css aliases ── */
:root {
  --color-primary:       var(--brand);
  --color-primary-hover: var(--brand-hover);
  --color-primary-press: var(--brand-press);
  --color-primary-soft:  var(--brand-soft);
  --color-on-primary:    var(--text-inverse);
  --color-canvas:        var(--surface-0);
  --color-surface-1:     var(--surface-1);
  --color-surface-2:     var(--surface-2);
  --color-surface-3:     var(--surface-3);
  --color-ink-primary:   var(--text-primary);
  --color-ink-secondary: var(--text-secondary);
  --color-ink-muted:     var(--text-muted);
  --color-ink-heading:   var(--text-heading);
  --color-border-subtle: var(--border-subtle);
  --color-border-default: var(--border-default);
  --color-border-strong: var(--border-strong);
}

/* ── crew-theme.css aliases (dark + light) ── */
:root,
:root[data-theme="dark"] {
  --pf-bg:              var(--surface-0);
  --pf-bg-elevated:     var(--surface-1);
  --pf-surface:         var(--surface-1);
  --pf-surface2:        var(--surface-2);
  --pf-border:          var(--border-subtle);
  --pf-border-hi:       var(--border-default);
  --pf-border-accent:   var(--border-orange);
  --pf-accent:          var(--brand);
  --pf-accent-glow:     var(--shadow-glow-orange);
  --pf-accent-grad:     linear-gradient(135deg, var(--brand), var(--brand-press));
  --pf-text:            var(--text-primary);
  --pf-text-secondary:  var(--text-secondary);
  --pf-text-muted:      var(--text-muted);
  --pf-text-heading:    var(--text-heading);
}

:root[data-theme="light"] {
  --pf-bg:              var(--surface-0);
  --pf-bg-elevated:     var(--surface-1);
  --pf-surface:         var(--surface-1);
  --pf-surface2:        var(--surface-2);
  --pf-text:            var(--text-primary);
  --pf-text-secondary:  var(--text-secondary);
  --pf-text-muted:      var(--text-muted);
  --pf-text-heading:    var(--text-heading);
}
