/* ═════════════════════════════════════════════════════════════════════════════
   ДОМКОМ — WORLD-CLASS COMPONENT LIBRARY
   Stripe-level UI/UX with sophisticated animations & micro-interactions
   ═════════════════════════════════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────────────────────────────────
   CSS VARIABLES — Extended Design Tokens
   ──────────────────────────────────────────────────────────────────────────── */
:root {
  /* Core Colors */
  --color-bg: #ecf1f4;
  --color-bg-accent: #d9e9e6;
  --color-bg-cool: #dbe4f5;
  --color-surface: #ffffff;
  --color-surface-soft: #f6fafc;
  --color-surface-elevated: #ffffff;
  --color-text: #16242f;
  --color-text-muted: #506676;
  --color-text-subtle: #8a9aa8;
  --color-border: #c7d3dc;
  --color-border-light: #e1e8ed;
  
  /* Primary Palette — Refined Teal */
  --color-primary: #0f766e;
  --color-primary-strong: #0a5c57;
  --color-primary-light: #14b8a6;
  --color-primary-subtle: #ccfbf1;
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-success-subtle: #d1fae5;
  --color-success-text: #047857;
  --color-warning: #f59e0b;
  --color-warning-subtle: #fef3c7;
  --color-warning-text: #b45309;
  --color-error: #ef4444;
  --color-error-subtle: #fee2e2;
  --color-error-text: #b91c1c;
  --color-info: #3b82f6;
  --color-info-subtle: #dbeafe;
  --color-info-text: #1d4ed8;
  
  /* Extended Spacing Scale */
  --space-px: 1px;
  --space-0-5: 2px;
  --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;
  
  /* Border Radius Scale */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;
  
  /* Shadow Scale — Sophisticated Depth */
  --shadow-xs: 0 1px 2px rgba(15, 30, 40, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 30, 40, 0.08), 0 1px 2px rgba(15, 30, 40, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 30, 40, 0.08), 0 2px 4px -2px rgba(15, 30, 40, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 30, 40, 0.08), 0 4px 6px -4px rgba(15, 30, 40, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 30, 40, 0.08), 0 8px 10px -6px rgba(15, 30, 40, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(15, 30, 40, 0.25);
  --shadow-inner: inset 0 2px 4px rgba(15, 30, 40, 0.04);
  --shadow-glow: 0 0 20px rgba(15, 118, 110, 0.3);
  
  /* Animation Timing */
  --dur-instant: 0ms;
  --dur-fast: 150ms;
  --dur-normal: 250ms;
  --dur-slow: 350ms;
  --dur-slower: 500ms;
  
  /* Easing Functions — Professional Motion */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.2, 0.72, 0.2, 1);
  
  /* Typography Scale */
  --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;
  
  /* Layout — inherits container tiers from site.css */
  /* --container is defined in site.css as var(--container-default) */
  --header-height: 64px;
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;
  --z-toast: 10000;
}

/* ────────────────────────────────────────────────────────────────────────────
   DARK MODE OVERRIDES
   components.css :root block redefines color vars after site.css's
   [data-theme="dark"] block; this section re-applies dark values so they
   win in the cascade.
   ──────────────────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-bg-accent: #1e293b;
  --color-bg-cool: #1e293b;
  --color-surface: #1e293b;
  --color-surface-soft: #334155;
  --color-surface-elevated: #1e293b;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-subtle: #64748b;
  --color-border: #334155;
  --color-border-light: #1e293b;
  --color-primary: #14b8a6;
  --color-primary-strong: #2dd4bf;
  --color-primary-light: #5eead4;
  --color-primary-subtle: #042f2e;
  --color-success: #34d399;
  --color-success-subtle: #064e3b;
  --color-success-text: #34d399;
  --color-warning: #fbbf24;
  --color-warning-subtle: #78350f;
  --color-warning-text: #fbbf24;
  --color-error: #f87171;
  --color-error-subtle: #7f1d1d;
  --color-error-text: #f87171;
  --color-info: #60a5fa;
  --color-info-subtle: #1e3a8a;
  --color-info-text: #60a5fa;
}

/* ────────────────────────────────────────────────────────────────────────────
   RESET & BASE
   ──────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* ────────────────────────────────────────────────────────────────────────────
   ANIMATION KEYFRAMES
   ──────────────────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

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

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

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

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

@keyframes pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

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

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(15, 118, 110, 0.3); }
  50% { box-shadow: 0 0 20px rgba(15, 118, 110, 0.6); }
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

/* ────────────────────────────────────────────────────────────────────────────
   UTILITY CLASSES — Animation
   ──────────────────────────────────────────────────────────────────────────── */
.animate-fadeIn { animation: fadeIn var(--dur-normal) var(--ease-out); }
.animate-fadeInUp { animation: fadeInUp var(--dur-normal) var(--ease-out); }
.animate-fadeInDown { animation: fadeInDown var(--dur-normal) var(--ease-out); }
.animate-fadeInScale { animation: fadeInScale var(--dur-normal) var(--ease-out); }
.animate-slideInRight { animation: slideInRight var(--dur-normal) var(--ease-out); }
.animate-slideInLeft { animation: slideInLeft var(--dur-normal) var(--ease-out); }
.animate-scaleIn { animation: scaleIn var(--dur-normal) var(--ease-spring); }
.animate-bounceIn { animation: bounceIn var(--dur-slow) var(--ease-spring); }
.animate-shake { animation: shake var(--dur-normal) var(--ease-in-out); }
.animate-pulse { animation: pulse 2s var(--ease-in-out) infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-float { animation: float 3s var(--ease-in-out) infinite; }
.animate-glow { animation: glow 2s var(--ease-in-out) infinite; }

.animation-delay-100 { animation-delay: 100ms; }
.animation-delay-200 { animation-delay: 200ms; }
.animation-delay-300 { animation-delay: 300ms; }
.animation-delay-400 { animation-delay: 400ms; }
.animation-delay-500 { animation-delay: 500ms; }

/* ────────────────────────────────────────────────────────────────────────────
   TOAST NOTIFICATION SYSTEM
   ──────────────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 400px;
  width: calc(100% - var(--space-12));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-light);
  animation: slideInRight var(--dur-normal) var(--ease-spring), fadeIn var(--dur-normal) var(--ease-out);
  transition: all var(--dur-fast) var(--ease-out);
}

.toast.toast-exit {
  animation: slideOutRight var(--dur-fast) var(--ease-in) forwards;
}

@keyframes slideOutRight {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
}

.toast-success .toast-icon { background: var(--color-success-subtle); color: var(--color-success); }
.toast-error .toast-icon { background: var(--color-error-subtle); color: var(--color-error); }
.toast-warning .toast-icon { background: var(--color-warning-subtle); color: var(--color-warning); }
.toast-info .toast-icon { background: var(--color-info-subtle); color: var(--color-info); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.toast-message {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease-out);
}

.toast-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: 0 0 0 var(--radius-lg);
  transition: width linear;
}

/* ────────────────────────────────────────────────────────────────────────────
   MODAL DIALOGS
   ──────────────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 40, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-out);
}

.modal-backdrop.modal-open {
  opacity: 1;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - var(--space-12));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  transition: all var(--dur-slow) var(--ease-spring);
}

.modal-backdrop.modal-open .modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.modal-title {
  font-family: "Unbounded", sans-serif;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--dur-fast) var(--ease-out);
}

.modal-close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface-soft);
}

/* Modal Sizes */
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-full { max-width: calc(100vw - var(--space-12)); }

/* ────────────────────────────────────────────────────────────────────────────
   DROPDOWN MENUS
   ──────────────────────────────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all var(--dur-fast) var(--ease-spring);
  overflow: hidden;
}

.dropdown-menu.dropdown-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-menu-left { right: auto; left: 0; }
.dropdown-menu-center { right: 50%; transform: translateX(50%) translateY(-10px) scale(0.95); }
.dropdown-menu-center.dropdown-open { transform: translateX(50%) translateY(0) scale(1); }

.dropdown-header {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-subtle);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.dropdown-item:hover {
  background: var(--color-bg);
}

.dropdown-item:active {
  background: var(--color-bg-accent);
}

.dropdown-item-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
}

.dropdown-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-2) 0;
}

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

.tooltip-trigger {
  cursor: help;
}

.tooltip-content {
  position: absolute;
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-3);
  background: var(--color-text);
  color: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-md);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--dur-fast) var(--ease-out);
  pointer-events: none;
}

.tooltip-content::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--color-text);
  transform: rotate(45deg);
}

.tooltip-content.tooltip-top {
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
}

.tooltip-content.tooltip-top::before {
  bottom: -4px;
  left: 50%;
  margin-left: -4px;
}

.tooltip-content.tooltip-bottom {
  top: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
}

.tooltip-content.tooltip-bottom::before {
  top: -4px;
  left: 50%;
  margin-left: -4px;
}

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

/* ────────────────────────────────────────────────────────────────────────────
   TOGGLE SWITCHES
   ──────────────────────────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--dur-fast) var(--ease-out);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-spring);
}

.toggle-input:checked + .toggle-track {
  background: var(--color-primary);
}

.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(22px);
}

.toggle-input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.3);
}

.toggle-input:disabled + .toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-label {
  font-size: var(--text-sm);
  color: var(--color-text);
  user-select: none;
}

/* Toggle Sizes */
.toggle-sm .toggle-track { width: 36px; height: 20px; }
.toggle-sm .toggle-thumb { width: 14px; height: 14px; }
.toggle-sm .toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }

.toggle-lg .toggle-track { width: 60px; height: 32px; }
.toggle-lg .toggle-thumb { width: 26px; height: 26px; }
.toggle-lg .toggle-input:checked + .toggle-track .toggle-thumb { transform: translateX(28px); }

/* ────────────────────────────────────────────────────────────────────────────
   CHECKBOXES & RADIOS
   ──────────────────────────────────────────────────────────────────────────── */
.checkbox,
.radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.checkbox-input,
.radio-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.checkbox-box::after {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--color-surface);
  border-radius: 2px;
  opacity: 0;
  transform: scale(0);
  transition: all var(--dur-fast) var(--ease-spring);
}

.checkbox-input:checked + .checkbox-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-input:checked + .checkbox-box::after {
  opacity: 1;
  transform: scale(1);
}

.checkbox-input:focus-visible + .checkbox-box {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.3);
}

.radio-circle {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.radio-circle::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  opacity: 0;
  transform: scale(0);
  transition: all var(--dur-fast) var(--ease-spring);
}

.radio-input:checked + .radio-circle {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.radio-input:checked + .radio-circle::after {
  opacity: 1;
  transform: scale(1);
}

.radio-input:focus-visible + .radio-circle {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.3);
}

/* ────────────────────────────────────────────────────────────────────────────
   SEGMENTED CONTROL
   ──────────────────────────────────────────────────────────────────────────── */
.segmented-control {
  display: inline-flex;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  gap: var(--space-1);
}

.segmented-item {
  position: relative;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.segmented-item:hover {
  color: var(--color-text);
}

.segmented-item.segmented-active {
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

/* ────────────────────────────────────────────────────────────────────────────
   BADGES & TAGS
   ──────────────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
}

.badge-primary { background: var(--color-primary-subtle); color: var(--color-primary-strong); }
.badge-success { background: var(--color-success-subtle); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-subtle); color: var(--color-warning-text); }
.badge-error { background: var(--color-error-subtle); color: var(--color-error-text); }
.badge-info { background: var(--color-info-subtle); color: var(--color-info-text, #1d4ed8); }
.badge-neutral { background: var(--color-bg); color: var(--color-text-muted); }

/* Status Badge Variants */
.badge-status {
  position: relative;
  padding-left: var(--space-4);
}

.badge-status::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.badge-status-active::before { background: var(--color-success); box-shadow: 0 0 0 2px var(--color-success-subtle); }
.badge-status-pending::before { background: var(--color-warning); }
.badge-status-inactive::before { background: var(--color-text-subtle); }

/* ────────────────────────────────────────────────────────────────────────────
   PROGRESS INDICATORS
   ──────────────────────────────────────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

.progress-indeterminate .progress-bar {
  width: 40%;
  animation: progress-indeterminate 1.5s linear infinite;
}

.progress-sm { height: 4px; }
.progress-lg { height: 12px; }

/* Circular Progress */
.progress-circle {
  position: relative;
  width: 60px;
  height: 60px;
}

.progress-circle svg {
  transform: rotate(-90deg);
}

.progress-circle-bg {
  fill: none;
  stroke: var(--color-bg);
  stroke-width: 4;
}

.progress-circle-fill {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--dur-slow) var(--ease-out);
}

.progress-circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
}

/* ────────────────────────────────────────────────────────────────────────────
   SPINNERS & LOADERS
   ──────────────────────────────────────────────────────────────────────────── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 1.5px; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

/* Dots Loader */
.loader-dots {
  display: inline-flex;
  gap: 4px;
}

.loader-dots span {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  animation: loader-dots 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loader-dots {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ────────────────────────────────────────────────────────────────────────────
   SKELETON LOADING STATES
   ──────────────────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg) 25%, var(--color-border-light) 50%, var(--color-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 80%;
  margin-bottom: 0;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-3);
}

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

.skeleton-image {
  width: 100%;
  aspect-ratio: 16/9;
}

.skeleton-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
}

/* ────────────────────────────────────────────────────────────────────────────
   TABS — Enhanced
   ──────────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: var(--space-6);
}

.tab {
  position: relative;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

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

.tab.tab-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab.tab-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

/* Pill Tabs */
.tabs-pill {
  border-bottom: none;
  background: var(--color-bg);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
}

.tabs-pill .tab {
  border-bottom: none;
  margin-bottom: 0;
  border-radius: var(--radius-md);
}

.tabs-pill .tab.tab-active {
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

/* ────────────────────────────────────────────────────────────────────────────
   ACCORDION
   ──────────────────────────────────────────────────────────────────────────── */
.accordion {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--color-border-light);
}

.accordion-item:last-child {
  border-bottom: none;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: none;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
  text-align: left;
}

.accordion-header:hover {
  background: var(--color-surface-soft);
}

.accordion-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--dur-normal) var(--ease-spring);
}

.accordion-item.accordion-open .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-normal) var(--ease-out);
}

.accordion-item.accordion-open .accordion-content {
  max-height: 500px;
}

.accordion-body {
  padding: 0 var(--space-5) var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* ────────────────────────────────────────────────────────────────────────────
   STEPPER / WIZARD
   ──────────────────────────────────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.step-indicator {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease-out);
}

.step-complete .step-indicator {
  background: var(--color-success);
  color: white;
}

.step-active .step-indicator {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 0 0 4px var(--color-primary-subtle);
}

.step-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.step-active .step-label {
  color: var(--color-text);
  font-weight: 600;
}

.step-connector {
  width: 40px;
  height: 2px;
  background: var(--color-border);
  transition: background var(--dur-fast) var(--ease-out);
}

.step-complete + .step-connector,
.step-complete .step-connector {
  background: var(--color-success);
}

/* ────────────────────────────────────────────────────────────────────────────
   CHIPS & TAGS INPUT
   ──────────────────────────────────────────────────────────────────────────── */
.chips-input {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  min-height: 44px;
}

.chip-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--color-primary-subtle);
  color: var(--color-primary-strong);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
}

.chip-remove {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: currentColor;
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0.6;
  transition: opacity var(--dur-fast);
}

.chip-remove:hover {
  opacity: 1;
}

.chips-input input {
  flex: 1;
  min-width: 100px;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--color-text);
  outline: none;
}

/* ────────────────────────────────────────────────────────────────────────────
   EMPTY STATES
   ──────────────────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

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

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 320px;
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

/* ────────────────────────────────────────────────────────────────────────────
   ALERTS
   ──────────────────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
}

.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.alert-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.alert-success { background: var(--color-success-subtle); border-color: rgba(16, 185, 129, 0.2); }
.alert-success .alert-icon { color: var(--color-success); }

.alert-error { background: var(--color-error-subtle); border-color: rgba(239, 68, 68, 0.2); }
.alert-error .alert-icon { color: var(--color-error); }

.alert-warning { background: var(--color-warning-subtle); border-color: rgba(245, 158, 11, 0.2); }
.alert-warning .alert-icon { color: var(--color-warning); }

.alert-info { background: var(--color-info-subtle); border-color: rgba(59, 130, 246, 0.2); }
.alert-info .alert-icon { color: var(--color-info); }

/* ────────────────────────────────────────────────────────────────────────────
   DATA TABLE ENHANCEMENTS
   ──────────────────────────────────────────────────────────────────────────── */
.table-container {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface-soft);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

.table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface-soft);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr {
  transition: background var(--dur-fast) var(--ease-out);
}

.table tbody tr:hover {
  background: var(--color-bg);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Sortable Headers */
.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--color-text);
}

.table th .sort-icon {
  margin-left: var(--space-1);
  opacity: 0.3;
  transition: opacity var(--dur-fast);
}

.table th.sort-asc .sort-icon,
.table th.sort-desc .sort-icon {
  opacity: 1;
  color: var(--color-primary);
}

/* Selection */
.table-row-selected {
  background: var(--color-primary-subtle) !important;
}

/* ────────────────────────────────────────────────────────────────────────────
   PAGINATION
   ──────────────────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.page-btn:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-border-light);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-btn.page-active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ────────────────────────────────────────────────────────────────────────────
   BUTTON ENHANCEMENTS
   ──────────────────────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  overflow: hidden;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-strong));
  color: white;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-border-light);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-error);
  filter: brightness(1.1);
}

/* Button Sizes */
.btn-xs { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: var(--text-base); }

/* Button with Loading State */
.btn-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.btn-primary.btn-loading::after {
  border-top-color: white;
}

/* Button Icon Only */
.btn-icon {
  padding: var(--space-2);
  width: 40px;
  height: 40px;
}

.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-icon.btn-lg { width: 48px; height: 48px; }

/* ────────────────────────────────────────────────────────────────────────────
   INPUT ENHANCEMENTS
   ──────────────────────────────────────────────────────────────────────────── */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-left: var(--space-10);
}

.input-group-icon {
  position: absolute;
  left: var(--space-3);
  color: var(--color-text-subtle);
  pointer-events: none;
}

.input-group-action {
  position: absolute;
  right: var(--space-2);
}

/* Floating Label Input */
.input-floating {
  position: relative;
}

.input-floating .input {
  padding-top: var(--space-5);
  padding-bottom: var(--space-2);
}

.input-floating label {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  font-size: var(--text-base);
  pointer-events: none;
  transition: all var(--dur-fast) var(--ease-out);
}

.input-floating .input:focus ~ label,
.input-floating .input:not(:placeholder-shown) ~ label {
  top: var(--space-3);
  transform: translateY(0);
  font-size: var(--text-xs);
  color: var(--color-primary);
}

/* Input States */
.input-error {
  border-color: var(--color-error) !important;
  background: var(--color-error-subtle) !important;
}

.input-success {
  border-color: var(--color-success) !important;
  background: var(--color-success-subtle) !important;
}

.input-hint {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  margin-top: var(--space-1);
}

.input-error-text {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* ────────────────────────────────────────────────────────────────────────────
   CARD ENHANCEMENTS
   ──────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-fast) var(--ease-out);
  overflow: hidden;
}

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

.card-interactive {
  cursor: pointer;
}

.card-interactive:active {
  transform: translateY(0);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-soft);
  border-top: 1px solid var(--color-border-light);
}

/* ────────────────────────────────────────────────────────────────────────────
   DASHBOARD WIDGETS
   ──────────────────────────────────────────────────────────────────────────── */
.stat-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: var(--space-2);
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
}

.stat-change-positive { color: var(--color-success); }
.stat-change-negative { color: var(--color-error); }

/* Sparkline Container */
.stat-sparkline {
  height: 40px;
  margin-top: var(--space-3);
}

/* ────────────────────────────────────────────────────────────────────────────
   CHARTS & VISUALIZATIONS
   ──────────────────────────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 200px;
  padding: var(--space-4);
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.chart-bar-fill {
  width: 100%;
  background: linear-gradient(to top, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--dur-slow) var(--ease-out);
  min-height: 4px;
}

.chart-bar-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Mini Chart for Stats */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}

.mini-chart-bar {
  flex: 1;
  background: var(--color-primary);
  border-radius: 1px;
  opacity: 0.6;
  transition: opacity var(--dur-fast);
}

.mini-chart-bar:hover {
  opacity: 1;
}

/* ────────────────────────────────────────────────────────────────────────────
   AVATAR GROUPS
   ──────────────────────────────────────────────────────────────────────────── */
.avatar-group {
  display: flex;
  align-items: center;
}

.avatar-group .avatar {
  border: 2px solid var(--color-surface);
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

.avatar-more {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-surface);
  margin-left: -8px;
}

/* ────────────────────────────────────────────────────────────────────────────
   TIMELINE
   ──────────────────────────────────────────────────────────────────────────── */
.timeline-vertical {
  position: relative;
  padding-left: var(--space-8);
}

.timeline-vertical::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-6);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -27px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

.timeline-dot-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.timeline-dot-complete {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.timeline-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.timeline-time {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  margin-bottom: var(--space-1);
}

.timeline-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.timeline-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ────────────────────────────────────────────────────────────────────────────
   RESPONSIVE UTILITIES
   ──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    top: var(--space-4);
    width: auto;
  }
  
  .toast {
    animation: fadeInUp var(--dur-normal) var(--ease-spring);
  }
  
  .modal {
    margin: var(--space-4);
    max-height: calc(100vh - var(--space-8));
  }
  
  .stepper {
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }
  
  .step-label {
    display: none;
  }
  
  .step-connector {
    width: 20px;
  }
}

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

/* ────────────────────────────────────────────────────────────────────────────
   FOCUS VISIBLE ENHANCEMENTS
   ──────────────────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}


/* ────────────────────────────────────────────────────────────────────────────
   DARK MODE SUPPORT
   ──────────────────────────────────────────────────────────────────────────── */

[data-theme="dark"] {
  /* Modal backdrop darker in dark mode */
  --modal-backdrop-bg: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .tooltip-content {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

[data-theme="dark"] .tooltip-content::before {
  background: var(--color-surface-soft);
}

[data-theme="dark"] .reaction-picker {
  background: var(--color-surface);
  border-color: var(--color-border);
}

/* Chart adjustments for dark mode */
[data-theme="dark"] .chart-bar-fill {
  background: linear-gradient(to top, var(--color-primary), var(--color-primary-light));
}

/* Message bubble adjustments for dark mode */
[data-theme="dark"] .message:not(.message-own) .message-bubble {
  background: var(--color-surface-soft);
  border-color: var(--color-border);
}

[data-theme="dark"] .message-own .message-bubble {
  background: var(--color-primary);
}

/* QR code container - always white so black QR modules stay readable in dark mode */
[data-theme="dark"] .qr-code {
  background: white;
}

/* Activity icons better contrast in dark mode */
[data-theme="dark"] .activity-icon-request { background: rgba(20, 184, 166, 0.2); }
[data-theme="dark"] .activity-icon-message { background: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .activity-icon-user { background: rgba(16, 185, 129, 0.2); }
[data-theme="dark"] .activity-icon-system { background: rgba(245, 158, 11, 0.2); }
