/* ═══════════════════════════════════════════════════════════════
   BusinessOS Design System
   Modern SaaS foundation — "This is where your company runs"
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ─── Color Palette ─── */
  --color-primary-50: #EEF2FF;
  --color-primary-100: #E0E7FF;
  --color-primary-200: #C7D2FE;
  --color-primary-300: #A5B4FC;
  --color-primary-400: #818CF8;
  --color-primary-500: #6366F1;
  --color-primary-600: #4F46E5;
  --color-primary-700: #4338CA;
  --color-primary-800: #3730A3;
  --color-primary-900: #312E81;

  --color-success-50: #F0FDF4;
  --color-success-100: #DCFCE7;
  --color-success-500: #22C55E;
  --color-success-600: #16A34A;
  --color-success-700: #15803D;

  --color-warning-50: #FFFBEB;
  --color-warning-100: #FEF3C7;
  --color-warning-400: #FBBF24;
  --color-warning-500: #F59E0B;
  --color-warning-600: #D97706;

  --color-error-50: #FEF2F2;
  --color-error-100: #FEE2E2;
  --color-error-500: #EF4444;
  --color-error-600: #DC2626;
  --color-error-700: #B91C1C;

  --color-info-50: #F0F9FF;
  --color-info-100: #E0F2FE;
  --color-info-500: #0EA5E9;
  --color-info-600: #0284C7;
  --color-info-700: #0369A1;

  --color-purple-50: #FAF5FF;
  --color-purple-500: #A855F7;
  --color-purple-600: #9333EA;

  --color-surface-50: #F8FAFC;
  --color-surface-100: #F1F5F9;
  --color-surface-200: #E2E8F0;
  --color-surface-300: #CBD5E1;

  /* ─── Semantic Colors ─── */
  --color-bg: #F8FAFC;
  --color-card: #FFFFFF;
  --color-sidebar: #0F172A;
  --color-sidebar-hover: #1E293B;
  --color-sidebar-text: #94A3B8;
  --color-sidebar-text-hover: #F1F5F9;
  --color-sidebar-active: #6366F1;
  --color-text: #0F172A;
  --color-text-secondary: #64748B;
  --color-text-tertiary: #94A3B8;
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;

  /* ─── Typography ─── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* ─── Spacing ─── */
  --space-0: 0;
  --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-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ─── Border Radius ─── */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* ─── Shadows ─── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.04);
  --shadow-colored: 0 10px 15px -3px rgba(99, 102, 241, 0.2), 0 4px 6px -4px rgba(99, 102, 241, 0.1);

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

  /* ─── Z-Index Scale ─── */
  --z-dropdown: 50;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-popover: 400;
  --z-toast: 500;
}

/* ═══════════════════════════════════════════════════════════════
   Base Reset & Defaults
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-text);
}

a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════════════════════════════
   Focus Ring — Accessible Focus States
   ═══════════════════════════════════════════════════════════════ */

.focus-ring:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

.focus-ring-inset:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: -2px;
}

/* ═══════════════════════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════════════════════ */

.page { padding: var(--space-8); max-width: 1400px; }
.page-header { margin-bottom: var(--space-6); }
.page-title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.025em; color: var(--color-text); }
.page-subtitle { font-size: var(--text-sm); color: var(--color-text-secondary); margin-top: var(--space-1); }
.section-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-4); color: var(--color-text); }
.section-subtitle { font-size: var(--text-sm); color: var(--color-text-secondary); margin-bottom: var(--space-4); }

/* ═══════════════════════════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
  width: 260px;
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition-slow);
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar.collapsed { width: 72px; }

.sidebar-logo {
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-logo-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  overflow: hidden;
}
.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.sidebar-logo-icon svg { width: 20px; height: 20px; color: #fff; }
.sidebar-logo h1 { color: #fff; font-size: var(--text-base); font-weight: 700; white-space: nowrap; letter-spacing: -0.025em; }
.sidebar-logo p { font-size: var(--text-2xs); color: var(--color-sidebar-text); margin-top: 1px; white-space: nowrap; }

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--color-sidebar-text);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-normal);
}
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.sidebar-nav {
  flex: 1;
  padding: var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-sidebar-text);
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  margin-bottom: 1px;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.06);
  color: var(--color-sidebar-text-hover);
}
.sidebar-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--color-primary-300);
}
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-primary-400);
  border-radius: 0 2px 2px 0;
}
.sidebar-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-link span { transition: opacity var(--transition-fast); }
.sidebar.collapsed .sidebar-link span { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: var(--space-2); }
.sidebar.collapsed .sidebar-link.active::before { left: -12px; }

.sidebar-tooltip {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1E293B;
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.sidebar-tooltip::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #1E293B;
}
.sidebar.collapsed .sidebar-link:hover .sidebar-tooltip { opacity: 1; }

.sidebar-section-label {
  padding: var(--space-4) var(--space-3) var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-section-label {
  text-align: center;
  padding: var(--space-3) var(--space-1) var(--space-1);
  font-size: 0;
}
.sidebar.collapsed .sidebar-section-label::after {
  content: '---';
  font-size: 0.5rem;
  color: rgba(255,255,255,0.15);
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: var(--space-2) var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════
   Top Header
   ═══════════════════════════════════════════════════════════════ */

.top-header {
  height: 64px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  flex-shrink: 0;
}

.header-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  width: 320px;
  transition: all var(--transition-fast);
}
.header-search:focus-within {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px var(--color-primary-50);
  background: var(--color-card);
}
.header-search input {
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--color-text);
  outline: none;
  width: 100%;
  font-family: inherit;
}
.header-search input::placeholder { color: var(--color-text-tertiary); }
.header-search kbd {
  font-size: var(--text-2xs);
  font-family: var(--font-sans);
  color: var(--color-text-tertiary);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}
.header-icon-btn:hover {
  background: var(--color-surface-100);
  color: var(--color-text);
}
.header-icon-btn svg { width: 20px; height: 20px; }
.header-icon-btn .notification-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-error-500);
  border: 2px solid var(--color-card);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.header-user:hover { background: var(--color-surface-100); }

/* ═══════════════════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--color-primary-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  background: var(--color-primary-700);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-50);
  border-color: var(--color-surface-300);
}

.btn-danger {
  background: var(--color-error-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--color-error-700);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--color-success-600);
  color: #fff;
}
.btn-success:hover { background: var(--color-success-700); }

.btn-ghost {
  color: var(--color-text-secondary);
  background: transparent;
}
.btn-ghost:hover {
  background: var(--color-surface-100);
  color: var(--color-text);
}

.btn-danger-ghost {
  color: var(--color-error-600);
  background: transparent;
}
.btn-danger-ghost:hover {
  background: var(--color-error-50);
}

.btn-sm { padding: var(--space-1-5) var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-md); }
.btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }
.btn-icon { padding: var(--space-2); }
.btn-icon.btn-sm { padding: var(--space-1-5); }

/* ═══════════════════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════════════════ */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-surface-300);
}
.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.card-body { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════
   Stat Cards
   ═══════════════════════════════════════════════════════════════ */

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}
.stat-card-accent-blue { background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-300)); }
.stat-card-accent-green { background: linear-gradient(90deg, var(--color-success-500), #4ADE80); }
.stat-card-accent-amber { background: linear-gradient(90deg, var(--color-warning-500), #FCD34D); }
.stat-card-accent-red { background: linear-gradient(90deg, var(--color-error-500), #F87171); }
.stat-card-accent-purple { background: linear-gradient(90deg, var(--color-purple-500), #C084FC); }

.stat-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  margin-top: var(--space-1);
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  margin-top: var(--space-2);
}
.stat-change-up { color: var(--color-success-600); }
.stat-change-down { color: var(--color-error-600); }
.stat-change-neutral { color: var(--color-text-tertiary); }

.stat-card-gradient {
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.stat-card-gradient::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}
.stat-card-gradient .stat-label { color: rgba(255,255,255,0.8); }
.stat-card-gradient .stat-value { color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   Form Elements
   ═══════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: var(--space-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-1-5);
}
.form-label-optional {
  font-weight: 400;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--color-error-600);
  margin-top: var(--space-1);
}

.input {
  width: 100%;
  padding: var(--space-2-5) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-card);
  transition: all var(--transition-fast);
  outline: none;
  font-family: inherit;
}
.input:focus {
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px var(--color-primary-50);
}
.input::placeholder { color: var(--color-text-tertiary); }
.input-error {
  border-color: var(--color-error-500);
}
.input-error:focus {
  box-shadow: 0 0 0 3px var(--color-error-50);
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

textarea.input { resize: vertical; min-height: 80px; }

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .input {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.input-group .btn {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  border-left: none;
}

.input-icon-wrapper {
  position: relative;
}
.input-icon-wrapper .input {
  padding-left: var(--space-10);
}
.input-icon-wrapper svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-tertiary);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════
   Badges
   ═══════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2-5);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-primary { background: var(--color-primary-50); color: var(--color-primary-700); }
.badge-success { background: var(--color-success-50); color: var(--color-success-700); }
.badge-warning { background: var(--color-warning-50); color: #92400E; }
.badge-danger { background: var(--color-error-50); color: var(--color-error-700); }
.badge-info { background: var(--color-info-50); color: var(--color-info-700); }
.badge-purple { background: var(--color-purple-50); color: var(--color-purple-600); }
.badge-neutral { background: var(--color-surface-100); color: var(--color-text-secondary); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-dot-green { background: var(--color-success-500); }
.badge-dot-amber { background: var(--color-warning-500); }
.badge-dot-red { background: var(--color-error-500); }
.badge-dot-blue { background: var(--color-primary-500); }

/* ═══════════════════════════════════════════════════════════════
   Avatar
   ═══════════════════════════════════════════════════════════════ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: var(--text-2xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md { width: 40px; height: 40px; font-size: var(--text-sm); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-base); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-lg); }

.avatar-group {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
}
.avatar-group .avatar {
  border: 2px solid var(--color-card);
  margin-left: -8px;
}
.avatar-group .avatar:last-child { margin-left: 0; }

/* ═══════════════════════════════════════════════════════════════
   Tables
   ═══════════════════════════════════════════════════════════════ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background: var(--color-card);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table thead { border-bottom: 1px solid var(--color-border); }
.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  background: var(--color-surface-50);
}
.table td {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
  color: var(--color-text);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--color-surface-50); }
.table .table-empty td {
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--color-text-tertiary);
}
.table td:first-child { font-weight: 500; }

/* ═══════════════════════════════════════════════════════════════
   Links
   ═══════════════════════════════════════════════════════════════ */

.link {
  color: var(--color-primary-600);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.link:hover { color: var(--color-primary-700); text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-2xl);
  background: var(--color-surface-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.empty-state-icon svg { width: 28px; height: 28px; color: var(--color-text-tertiary); }
.empty-state h3 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.empty-state p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 360px;
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

/* ═══════════════════════════════════════════════════════════════
   Alerts / Banners
   ═══════════════════════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--color-info-50); color: var(--color-info-700); border: 1px solid var(--color-info-100); }
.alert-success { background: var(--color-success-50); color: var(--color-success-700); border: 1px solid var(--color-success-100); }
.alert-warning { background: var(--color-warning-50); color: #92400E; border: 1px solid var(--color-warning-100); }
.alert-danger { background: var(--color-error-50); color: var(--color-error-700); border: 1px solid var(--color-error-100); }

/* ═══════════════════════════════════════════════════════════════
   Tabs
   ═══════════════════════════════════════════════════════════════ */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab:hover { color: var(--color-text); }
.tab.active {
  color: var(--color-primary-600);
  border-bottom-color: var(--color-primary-600);
}
.tab svg { width: 16px; height: 16px; }
.tab-count {
  background: var(--color-surface-100);
  color: var(--color-text-secondary);
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-2xs);
  font-weight: 600;
}
.tab.active .tab-count {
  background: var(--color-primary-50);
  color: var(--color-primary-600);
}

/* ═══════════════════════════════════════════════════════════════
   Modal / Dialog
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 150ms ease-out;
}
.modal {
  background: var(--color-card);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-lg { max-width: 640px; }
.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: var(--text-lg); font-weight: 600; }
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--color-surface-100); color: var(--color-text); }
.modal-body { padding: var(--space-6); overflow-y: auto; flex: 1; }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════
   Dropdown
   ═══════════════════════════════════════════════════════════════ */

.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 200px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1-5);
  z-index: var(--z-dropdown);
  animation: fadeInDown 150ms ease-out;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--color-surface-50); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--color-text-secondary); }
.dropdown-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-1-5) 0;
}
.dropdown-item-danger { color: var(--color-error-600); }
.dropdown-item-danger svg { color: var(--color-error-600); }

/* ═══════════════════════════════════════════════════════════════
   Tooltip
   ═══════════════════════════════════════════════════════════════ */

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  z-index: var(--z-popover);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   Skeleton Loading
   ═══════════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(90deg, var(--color-surface-100) 25%, var(--color-surface-200) 50%, var(--color-surface-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-text:last-child { width: 60%; }
.skeleton-title { height: 20px; width: 40%; margin-bottom: var(--space-3); }
.skeleton-avatar { border-radius: var(--radius-full); }
.skeleton-card {
  height: 120px;
  border-radius: var(--radius-xl);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Progress Bar
   ═══════════════════════════════════════════════════════════════ */

.progress {
  height: 8px;
  background: var(--color-surface-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
  background: var(--color-primary-600);
}
.progress-bar-success { background: var(--color-success-500); }
.progress-bar-warning { background: var(--color-warning-500); }
.progress-bar-danger { background: var(--color-error-500); }

.progress-sm { height: 4px; }

/* ═══════════════════════════════════════════════════════════════
   Toast / Messages
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: var(--z-toast);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideInUp 250ms ease-out;
  min-width: 300px;
}
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast-success { background: var(--color-success-600); color: #fff; }
.toast-error { background: var(--color-error-600); color: #fff; }
.toast-info { background: var(--color-info-600); color: #fff; }
.toast-warning { background: var(--color-warning-600); color: #fff; }
.toast-default { background: #1E293B; color: #fff; }

/* ═══════════════════════════════════════════════════════════════
   Right Sidebar / Drawer
   ═══════════════════════════════════════════════════════════════ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  animation: fadeIn 200ms ease-out;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  background: var(--color-card);
  z-index: var(--z-modal);
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  animation: slideInRight 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.drawer-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-6); }
.drawer-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
}

/* ═══════════════════════════════════════════════════════════════
   Timeline
   ═══════════════════════════════════════════════════════════════ */

.timeline { position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  position: relative;
  padding-left: var(--space-8);
  padding-bottom: var(--space-6);
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-card);
  border: 2px solid var(--color-primary-500);
}
.timeline-item.note .timeline-dot { border-color: var(--color-primary-400); background: var(--color-primary-50); }
.timeline-item.email .timeline-dot { border-color: var(--color-info-500); }
.timeline-item.sms .timeline-dot { border-color: var(--color-success-500); }
.timeline-item.call .timeline-dot { border-color: var(--color-warning-500); }
.timeline-content { font-size: var(--text-sm); }

/* ═══════════════════════════════════════════════════════════════
   Kanban Board
   ═══════════════════════════════════════════════════════════════ */

.kanban { display: flex; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-4); }
.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  background: var(--color-surface-50);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
}
.kanban-header {
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kanban-cards {
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}
.kanban-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.kanban-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary-200); }

/* ═══════════════════════════════════════════════════════════════
   Command Palette / Search
   ═══════════════════════════════════════════════════════════════ */

.command-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: fadeIn 150ms ease-out;
}
.command-palette {
  width: 100%;
  max-width: 560px;
  background: var(--color-card);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  animation: scaleIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.command-palette input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--text-base);
  outline: none;
  font-family: inherit;
}
.command-palette input::placeholder { color: var(--color-text-tertiary); }
.command-palette-results { max-height: 320px; overflow-y: auto; padding: var(--space-2); }
.command-palette-item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.command-palette-item:hover, .command-palette-item.active { background: var(--color-surface-50); }

/* ═══════════════════════════════════════════════════════════════
   Scrollbar
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-surface-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

/* ═══════════════════════════════════════════════════════════════
   Gradient Utilities
   ═══════════════════════════════════════════════════════════════ */

.gradient-primary { background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-400)); }
.gradient-success { background: linear-gradient(135deg, var(--color-success-600), #4ADE80); }
.gradient-warning { background: linear-gradient(135deg, var(--color-warning-500), #FCD34D); }
.gradient-danger { background: linear-gradient(135deg, var(--color-error-600), #F87171); }
.gradient-info { background: linear-gradient(135deg, var(--color-info-600), #38BDF8); }
.gradient-purple { background: linear-gradient(135deg, #7C3AED, #A78BFA); }
.gradient-emerald { background: linear-gradient(135deg, #059669, #34D399); }
.gradient-cyan { background: linear-gradient(135deg, #0891B2, #22D3EE); }
.gradient-amber { background: linear-gradient(135deg, #D97706, #FCD34D); }
.gradient-rose { background: linear-gradient(135deg, #E11D48, #FB7185); }
.gradient-slate { background: linear-gradient(135deg, #334155, #64748B); }
.gradient-sidebar { background: linear-gradient(180deg, #0F172A 0%, #1E293B 50%, #0F172A 100%); }

.text-gradient-primary {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════════════════════════
   Icon Containers
   ═══════════════════════════════════════════════════════════════ */

.icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}
.icon-container svg { width: 20px; height: 20px; }
.icon-container-sm { width: 32px; height: 32px; }
.icon-container-sm svg { width: 16px; height: 16px; }
.icon-container-lg { width: 48px; height: 48px; }
.icon-container-lg svg { width: 24px; height: 24px; }

.icon-primary { background: rgba(99, 102, 241, 0.1); color: var(--color-primary-600); }
.icon-success { background: rgba(34, 197, 94, 0.1); color: var(--color-success-600); }
.icon-warning { background: rgba(245, 158, 11, 0.1); color: var(--color-warning-600); }
.icon-danger { background: rgba(239, 68, 68, 0.1); color: var(--color-error-600); }
.icon-info { background: rgba(14, 165, 233, 0.1); color: var(--color-info-600); }
.icon-purple { background: rgba(168, 85, 247, 0.1); color: var(--color-purple-500); }
.icon-emerald { background: rgba(5, 150, 105, 0.1); color: #059669; }
.icon-amber { background: rgba(217, 119, 6, 0.1); color: #D97706; }
.icon-rose { background: rgba(225, 29, 72, 0.1); color: #E11D48; }
.icon-cyan { background: rgba(8, 145, 178, 0.1); color: #0891B2; }
.icon-slate { background: rgba(51, 65, 85, 0.1); color: #334155; }

/* ═══════════════════════════════════════════════════════════════
   Glow Effects
   ═══════════════════════════════════════════════════════════════ */

.glow-primary { box-shadow: 0 0 20px rgba(99, 102, 241, 0.15); }
.glow-success { box-shadow: 0 0 20px rgba(34, 197, 94, 0.15); }
.glow-info { box-shadow: 0 0 20px rgba(14, 165, 233, 0.15); }
.glow-warning { box-shadow: 0 0 20px rgba(245, 158, 11, 0.15); }
.glow-danger { box-shadow: 0 0 20px rgba(239, 68, 68, 0.15); }

/* ═══════════════════════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fade-in { animation: fadeIn var(--transition-normal) ease-out; }
.animate-fade-in-up { animation: fadeInUp 300ms ease-out; }
.animate-fade-in-down { animation: fadeInDown 300ms ease-out; }
.animate-scale-in { animation: scaleIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-slide-in-up { animation: slideInUp 300ms ease-out; }
.animate-slide-in-down { animation: slideInDown 300ms ease-out; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Staggered children animations */
.stagger-children > * { animation: fadeInUp 300ms ease-out both; }
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }

/* ═══════════════════════════════════════════════════════════════
   Typography Utilities
   ═══════════════════════════════════════════════════════════════ */

.text-2xs { font-size: var(--text-2xs); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-primary { color: var(--color-primary-600); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-success { color: var(--color-success-600); }
.text-danger { color: var(--color-error-600); }
.text-warning { color: var(--color-warning-600); }
.text-mono { font-family: var(--font-mono); }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-wide { letter-spacing: 0.025em; }

/* ═══════════════════════════════════════════════════════════════
   Spacing Utilities
   ═══════════════════════════════════════════════════════════════ */

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.space-y-1 > * + * { margin-top: var(--space-1); }
.space-y-2 > * + * { margin-top: var(--space-2); }
.space-y-3 > * + * { margin-top: var(--space-3); }
.space-y-4 > * + * { margin-top: var(--space-4); }
.space-y-5 > * + * { margin-top: var(--space-5); }
.space-y-6 > * + * { margin-top: var(--space-6); }
.space-y-8 > * + * { margin-top: var(--space-8); }

/* ═══════════════════════════════════════════════════════════════
   Flex / Grid Utilities
   ═══════════════════════════════════════════════════════════════ */

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-1 { flex: 1; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.shrink-0 { flex-shrink: 0; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ═══════════════════════════════════════════════════════════════
   Width / Height / Overflow
   ═══════════════════════════════════════════════════════════════ */

.w-full { width: 100%; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.min-w-0 { min-width: 0; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* ═══════════════════════════════════════════════════════════════
   Dividers / Borders
   ═══════════════════════════════════════════════════════════════ */

.border { border: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border-light); }
.border-b { border-bottom: 1px solid var(--color-border-light); }
.border-l-4 { border-left-width: 4px; }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ═══════════════════════════════════════════════════════════════
   Backgrounds
   ═══════════════════════════════════════════════════════════════ */

.bg-white { background: var(--color-card); }
.bg-surface { background: var(--color-bg); }
.bg-primary-50 { background: var(--color-primary-50); }
.bg-success-50 { background: var(--color-success-50); }
.bg-warning-50 { background: var(--color-warning-50); }
.bg-error-50 { background: var(--color-error-50); }

/* ═══════════════════════════════════════════════════════════════
   Visibility / Display
   ═══════════════════════════════════════════════════════════════ */

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Lucide Icon Defaults
   ═══════════════════════════════════════════════════════════════ */

[data-lucide] {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: var(--z-overlay);
    width: 260px;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .sidebar-collapse-btn { display: none; }
  .sidebar .sidebar-tooltip { display: none; }

  .page { padding: var(--space-4); }
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
  .top-header { padding: 0 var(--space-4); }
  .header-search { width: 100%; max-width: 200px; }
  .drawer { width: 100%; }
  .modal { margin: var(--space-4); }
}

@media (max-width: 480px) {
  .page { padding: var(--space-3); }
  .card-body { padding: var(--space-4); }
  .stat-card { padding: var(--space-4); }
}

/* ═══════════════════════════════════════════════════════════════
   Print Styles
   ═══════════════════════════════════════════════════════════════ */

@media print {
  .sidebar, .top-header, .toast-container { display: none !important; }
  .page { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
