/* 
 * Unified Design System - Inspired by Vercel, Framer, Apple
 * Modern tech aesthetic with calm, minimalist approach
 * Seamless flow between marketing and app
 */

:root {
  /* Color System - Refined dark theme with green accents */
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-surface: #1a1a1a;
  --bg-surface-hover: #222222;

  --border: #262626;
  --border-hover: #404040;
  --border-focus: #22c55e;

  --text: #ffffff;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --text-disabled: #525252;

  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-light: rgba(34, 197, 94, 0.1);
  --primary-glow: rgba(34, 197, 94, 0.3);

  --accent: #4ade80;
  --accent-subtle: rgba(74, 222, 128, 0.15);
  
  /* Glass morphism */
  --glass: rgba(255, 255, 255, 0.03);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  /* Spacing Scale - Consistent 8px base */
  --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;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-32: 128px;
  
  /* Typography Scale - Refined hierarchy */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  
  --h1: clamp(40px, 5.5vw, 64px);
  --h2: clamp(32px, 4.5vw, 48px);
  --h3: clamp(24px, 3.5vw, 36px);
  --h4: clamp(20px, 2.5vw, 28px);
  --h5: clamp(18px, 2vw, 22px);
  
  --line-height-tight: 1.1;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;
  
  --letter-spacing-tight: -0.03em;
  --letter-spacing-normal: -0.01em;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Shadows - Subtle depth */
  --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 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px var(--primary-glow);
  
  /* Motion - Smooth, purposeful */
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --motion-slow: 300ms;
  --motion-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --motion-ease-out: cubic-bezier(0, 0, 0.2, 1);
  
  /* Gradients - Subtle, atmospheric */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--accent));
  --gradient-bg:
    radial-gradient(900px 400px at 80% -20%, rgba(34, 197, 94, 0.12), transparent 60%),
    radial-gradient(700px 300px at 0% -10%, rgba(255, 255, 255, 0.04), transparent 65%),
    var(--bg);
  --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  
  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* Light Theme */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #f9fafb;
  --bg-surface: #f3f4f6;
  --bg-surface-hover: #e5e7eb;

  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --border-focus: #22c55e;

  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-disabled: #d1d5db;

  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-light: rgba(22, 163, 74, 0.08);
  --primary-glow: rgba(22, 163, 74, 0.2);

  --accent: #22c55e;
  --accent-subtle: rgba(34, 197, 94, 0.1);

  --glass: rgba(0, 0, 0, 0.02);
  --glass-strong: rgba(0, 0, 0, 0.04);
  --glass-border: rgba(0, 0, 0, 0.06);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 24px var(--primary-glow);

  --gradient-bg:
    radial-gradient(900px 400px at 80% -20%, rgba(22, 163, 74, 0.06), transparent 60%),
    radial-gradient(700px 300px at 0% -10%, rgba(0, 0, 0, 0.02), transparent 65%),
    var(--bg);
  --gradient-surface: linear-gradient(180deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.02));
}

/* System preference: auto-apply light when user prefers it and no explicit theme set */
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg: #ffffff;
    --bg-elevated: #f9fafb;
    --bg-surface: #f3f4f6;
    --bg-surface-hover: #e5e7eb;

    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --border-focus: #22c55e;

    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-disabled: #d1d5db;

    --primary: #16a34a;
    --primary-hover: #15803d;
    --primary-light: rgba(22, 163, 74, 0.08);
    --primary-glow: rgba(22, 163, 74, 0.2);

    --accent: #22c55e;
    --accent-subtle: rgba(34, 197, 94, 0.1);

    --glass: rgba(0, 0, 0, 0.02);
    --glass-strong: rgba(0, 0, 0, 0.04);
    --glass-border: rgba(0, 0, 0, 0.06);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 0 24px var(--primary-glow);

    --gradient-bg:
      radial-gradient(900px 400px at 80% -20%, rgba(22, 163, 74, 0.06), transparent 60%),
      radial-gradient(700px 300px at 0% -10%, rgba(0, 0, 0, 0.02), transparent 65%),
      var(--bg);
    --gradient-surface: linear-gradient(180deg, rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 0.02));
  }
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--line-height-normal);
  color: var(--text);
  background: var(--bg);
  background-image: var(--gradient-bg);
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--text);
}

h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); }
h4 { font-size: var(--h4); }
h5 { font-size: var(--h5); }

p {
  margin: 0;
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--motion-base) var(--motion-ease);
}

a:hover {
  color: var(--primary-hover);
}

/* Buttons - Unified system */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--motion-base) var(--motion-ease);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

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

.btn-ghost:hover {
  background: var(--glass);
  color: var(--text);
  border-color: var(--border);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

/* Cards - Consistent elevation */
.card {
  background: var(--gradient-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--motion-base) var(--motion-ease);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Containers */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 768px) {
  .shell {
    padding: 0 var(--space-4);
  }
}

/* Section spacing */
.section {
  padding: var(--space-32) 0;
}

@media (max-width: 768px) {
  .section {
    padding: var(--space-16) 0;
  }
}

/* Grid system */
.grid {
  display: grid;
  gap: var(--space-6);
}

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

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

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

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

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

/* Utility classes */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--motion-slow) var(--motion-ease-out);
}

/* Focus & Accessibility */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 420px;
}

@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 72px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text);
  pointer-events: auto;
  cursor: pointer;
  animation: toastIn var(--motion-slow) var(--motion-ease-out) forwards;
  backdrop-filter: blur(12px);
}

.toast.toast-removing {
  animation: toastOut var(--motion-base) var(--motion-ease) forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.toast-success { border-color: rgba(34, 197, 94, 0.4); }
.toast-success .toast-icon { color: #86efac; }
.toast-error { border-color: rgba(239, 68, 68, 0.4); }
.toast-error .toast-icon { color: #fca5a5; }
.toast-warning { border-color: rgba(234, 179, 8, 0.4); }
.toast-warning .toast-icon { color: #fde047; }
.toast-info { border-color: rgba(34, 197, 94, 0.4); }
.toast-info .toast-icon { color: #6ee7b7; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(24px); }
}

/* Loading Skeletons */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-hover) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-heading {
  height: 28px;
  width: 50%;
  margin-bottom: 16px;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

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

/* Empty States */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  max-width: 400px;
  margin: 0 auto;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-6);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.badge-warning {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.badge-info {
  background: rgba(34, 197, 94, 0.15);
  color: #6ee7b7;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* ──────────────────────────────────────────
   FORM CONTROLS — Consistent, animated
   ────────────────────────────────────────── */
.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  line-height: var(--line-height-normal);
  transition: border-color var(--motion-base) var(--motion-ease),
              box-shadow var(--motion-base) var(--motion-ease),
              background var(--motion-base) var(--motion-ease);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-muted);
  transition: color var(--motion-base) var(--motion-ease);
}

.form-control:hover {
  border-color: var(--border-hover);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15), var(--shadow-sm);
  background: var(--bg-surface);
}

.form-control:focus::placeholder {
  color: var(--text-disabled);
}

.form-control.is-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-control.is-success {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  transition: color var(--motion-base) var(--motion-ease);
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-group:focus-within .form-label {
  color: var(--primary);
}

.form-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Labels inside form groups inherit design system styling */
.form-group > label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-group:focus-within > label {
  color: var(--primary);
}

/* Safety net: bare inputs/selects/textareas inside forms inherit .form-control styles */
.form-group input:not([type="checkbox"]):not([type="radio"]):not(.form-control),
.form-group select:not(.form-control),
.form-group textarea:not(.form-control) {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  line-height: var(--line-height-normal);
  transition: border-color var(--motion-base) var(--motion-ease),
              box-shadow var(--motion-base) var(--motion-ease);
  outline: none;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):not(.form-control):focus,
.form-group select:not(.form-control):focus,
.form-group textarea:not(.form-control):focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15), var(--shadow-sm);
  background: var(--bg-surface);
}

.form-error {
  font-size: var(--text-xs);
  color: #fca5a5;
  margin-top: var(--space-1);
  animation: shakeX 0.4s var(--motion-ease);
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* ──────────────────────────────────────────
   LOADING STATES — Spinners, button loading
   ────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

/* ──────────────────────────────────────────
   STAGGERED ANIMATIONS — Lists, grids
   ────────────────────────────────────────── */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.animate-in {
  animation: slideUp var(--motion-slow) var(--motion-ease-out) both;
}

.stagger-list > * {
  animation: slideUp var(--motion-slow) var(--motion-ease-out) both;
}

.stagger-list > *:nth-child(1) { animation-delay: 0ms; }
.stagger-list > *:nth-child(2) { animation-delay: 50ms; }
.stagger-list > *:nth-child(3) { animation-delay: 100ms; }
.stagger-list > *:nth-child(4) { animation-delay: 150ms; }
.stagger-list > *:nth-child(5) { animation-delay: 200ms; }
.stagger-list > *:nth-child(6) { animation-delay: 250ms; }
.stagger-list > *:nth-child(7) { animation-delay: 300ms; }
.stagger-list > *:nth-child(8) { animation-delay: 350ms; }
.stagger-list > *:nth-child(n+9) { animation-delay: 400ms; }

/* ──────────────────────────────────────────
   DROPDOWN & POPOVER ANIMATIONS
   ────────────────────────────────────────── */
@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.dropdown-animated {
  animation: dropdownIn var(--motion-base) var(--motion-ease-out);
  transform-origin: top center;
}

.popover-animated {
  animation: popoverIn var(--motion-base) var(--motion-ease-out);
  transform-origin: bottom center;
}

/* ──────────────────────────────────────────
   TABLE ENHANCEMENTS
   ────────────────────────────────────────── */
.data-table tbody tr {
  transition: background var(--motion-fast) var(--motion-ease),
              transform var(--motion-fast) var(--motion-ease);
}

.data-table tbody tr:hover {
  background: rgba(34, 197, 94, 0.06);
}

.data-table tbody tr:active {
  background: rgba(34, 197, 94, 0.1);
}

.data-table a {
  transition: color var(--motion-fast) var(--motion-ease);
}

/* ──────────────────────────────────────────
   LINK UNDERLINE ANIMATION
   ────────────────────────────────────────── */
.link-animated {
  position: relative;
  text-decoration: none;
}

.link-animated::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width var(--motion-base) var(--motion-ease);
}

.link-animated:hover::after {
  width: 100%;
}

/* ──────────────────────────────────────────
   GRADIENT BORDER — Featured/highlighted
   ────────────────────────────────────────── */
.gradient-border {
  position: relative;
  border: none !important;
  background: var(--bg-surface);
  isolation: isolate;
}

.gradient-border::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-primary);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ──────────────────────────────────────────
   TOOLTIP
   ────────────────────────────────────────── */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--motion-fast) var(--motion-ease),
              transform var(--motion-fast) var(--motion-ease);
  z-index: var(--z-dropdown);
}

.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ──────────────────────────────────────────
   SCROLLBAR — Minimal, dark themed
   ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ──────────────────────────────────────────
   COUNTER ANIMATION — Animated numbers
   ────────────────────────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.counter-animate {
  animation: countUp 0.6s var(--motion-ease-out) both;
}

/* ──────────────────────────────────────────
   GLOW EFFECT — Subtle hover glow
   ────────────────────────────────────────── */
.glow-hover {
  transition: box-shadow var(--motion-base) var(--motion-ease);
}

.glow-hover:hover {
  box-shadow: var(--shadow-md), 0 0 20px rgba(34, 197, 94, 0.15);
}

/* ──────────────────────────────────────────
   DIVIDER
   ────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-6) 0;
  border: none;
}

/* ──────────────────────────────────────────
   BREADCRUMB
   ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--motion-fast) var(--motion-ease);
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb-sep {
  color: var(--text-disabled);
  font-size: var(--text-xs);
}

/* ──────────────────────────────────────────
   ADDITIONAL UTILITIES
   ────────────────────────────────────────── */
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.w-full { width: 100%; }
.min-w-0 { min-width: 0; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ──────────────────────────────────────────
   MOBILE OPTIMIZATION
   ────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Responsive tables: horizontal scroll with snap */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
  .data-table thead,
  .data-table tbody,
  .data-table tr { display: revert; }
  .data-table th,
  .data-table td {
    padding: 12px 12px;
    font-size: 14px;
    white-space: nowrap;
  }
  .data-table th:first-child,
  .data-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-surface); }

  /* Bigger touch targets on buttons */
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; padding: 8px 12px; }

  /* Cards: less padding on mobile */
  .card { padding: var(--space-4); }

  /* Page headers: tighter spacing */
  .page-header { margin-bottom: 16px; }
  .page-header h1 { font-size: 24px; }

  /* Forms: ensure 16px to prevent iOS zoom */
  .form-control { font-size: 16px; padding: 12px 14px; min-height: 44px; }
  select.form-control { min-height: 44px; }

  /* Same sizing for bare inputs inside form groups (safety net) */
  .form-group input:not([type="checkbox"]):not([type="radio"]):not(.form-control),
  .form-group select:not(.form-control),
  .form-group textarea:not(.form-control) {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
  }

  /* Empty states: less vertical padding */
  .empty-state { padding: var(--space-8) var(--space-4); }
  .empty-state-icon { width: 44px; height: 44px; }

  /* Stack action buttons */
  .quick-actions { flex-direction: column; }
  .quick-actions .btn { width: 100%; justify-content: center; }
}

/* Touch devices: remove hover transforms that feel janky */
@media (hover: none) {
  .card:hover { transform: none; }
  .data-table tbody tr:hover { background: transparent; }
  .data-table tbody tr:active { background: rgba(34, 197, 94, 0.08); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
