/* ============================================================
   GESTOR PRO DE SUSCRIPCIONES — Design System
   Premium Dark Theme with Glassmorphism
   ============================================================ */

/* ============ CSS VARIABLES ============ */
:root {
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Spacing */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --mobile-nav-height: 68px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.15);
}

/* ============ DARK THEME (default) ============ */
[data-theme="dark"] {
  --bg-body: #07070d;
  --bg-primary: #0b0b14;
  --bg-secondary: #10101c;
  --bg-card: rgba(22, 22, 38, 0.7);
  --bg-card-solid: #161626;
  --bg-card-hover: rgba(30, 30, 52, 0.8);
  --bg-input: rgba(15, 15, 28, 0.8);
  --bg-input-focus: rgba(20, 20, 36, 0.9);
  --bg-sidebar: rgba(10, 10, 20, 0.95);
  --bg-header: rgba(10, 10, 20, 0.85);
  --bg-dropdown: rgba(18, 18, 32, 0.98);
  --bg-modal: rgba(16, 16, 30, 0.98);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-tooltip: rgba(30, 30, 52, 0.95);
  --bg-badge: rgba(99, 102, 241, 0.15);
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-hover: rgba(255, 255, 255, 0.12);
  --border-color-focus: rgba(99, 102, 241, 0.5);
  --border-color-subtle: rgba(255, 255, 255, 0.03);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-disabled: #475569;
  --text-inverse: #0f172a;
  
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-active: #4f46e5;
  --primary-subtle: rgba(99, 102, 241, 0.12);
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --success: #10b981;
  --success-hover: #34d399;
  --success-subtle: rgba(16, 185, 129, 0.12);
  --success-glow: rgba(16, 185, 129, 0.25);
  
  --warning: #f59e0b;
  --warning-hover: #fbbf24;
  --warning-subtle: rgba(245, 158, 11, 0.12);
  
  --danger: #ef4444;
  --danger-hover: #f87171;
  --danger-subtle: rgba(239, 68, 68, 0.12);
  
  --info: #3b82f6;
  --info-hover: #60a5fa;
  --info-subtle: rgba(59, 130, 246, 0.12);

  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-orange: #f97316;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
  --gradient-danger: linear-gradient(135deg, #ef4444, #f97316);
  --gradient-warning: linear-gradient(135deg, #f59e0b, #f97316);
  --gradient-card: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.04));
  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-dark: linear-gradient(180deg, rgba(11,11,20,0) 0%, rgba(11,11,20,1) 100%);
  
  /* Glass */
  --glass-bg: rgba(16, 16, 30, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 12px;

  --scrollbar-track: rgba(255,255,255,0.02);
  --scrollbar-thumb: rgba(255,255,255,0.08);
  --scrollbar-thumb-hover: rgba(255,255,255,0.15);
}

/* ============ LIGHT THEME ============ */
[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-primary: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-solid: #ffffff;
  --bg-card-hover: rgba(241, 245, 249, 0.9);
  --bg-input: rgba(241, 245, 249, 0.8);
  --bg-input-focus: rgba(255, 255, 255, 0.9);
  --bg-sidebar: rgba(255, 255, 255, 0.98);
  --bg-header: rgba(255, 255, 255, 0.9);
  --bg-dropdown: rgba(255, 255, 255, 0.98);
  --bg-modal: rgba(255, 255, 255, 0.98);
  --bg-overlay: rgba(0, 0, 0, 0.4);
  --bg-tooltip: rgba(15, 23, 42, 0.95);
  --bg-badge: rgba(99, 102, 241, 0.1);
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 0, 0, 0.15);
  --border-color-focus: rgba(99, 102, 241, 0.5);
  --border-color-subtle: rgba(0, 0, 0, 0.04);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-disabled: #cbd5e1;
  --text-inverse: #f8fafc;
  
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --primary-active: #4338ca;
  --primary-subtle: rgba(79, 70, 229, 0.08);
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --success: #059669;
  --success-hover: #10b981;
  --success-subtle: rgba(5, 150, 105, 0.08);
  --success-glow: rgba(5, 150, 105, 0.15);
  
  --warning: #d97706;
  --warning-hover: #f59e0b;
  --warning-subtle: rgba(217, 119, 6, 0.08);
  
  --danger: #dc2626;
  --danger-hover: #ef4444;
  --danger-subtle: rgba(220, 38, 38, 0.08);
  
  --info: #2563eb;
  --info-hover: #3b82f6;
  --info-subtle: rgba(37, 99, 235, 0.08);

  --accent-purple: #9333ea;
  --accent-pink: #db2777;
  --accent-cyan: #0891b2;
  --accent-orange: #ea580c;
  
  --gradient-primary: linear-gradient(135deg, #4f46e5, #7c3aed);
  --gradient-success: linear-gradient(135deg, #059669, #0891b2);
  --gradient-danger: linear-gradient(135deg, #dc2626, #ea580c);
  --gradient-warning: linear-gradient(135deg, #d97706, #ea580c);
  --gradient-card: linear-gradient(135deg, rgba(79,70,229,0.04), rgba(124,58,237,0.02));
  --gradient-hero: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
  --gradient-dark: linear-gradient(180deg, rgba(248,250,252,0) 0%, rgba(248,250,252,1) 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-blur: 12px;

  --scrollbar-track: rgba(0,0,0,0.02);
  --scrollbar-thumb: rgba(0,0,0,0.1);
  --scrollbar-thumb-hover: rgba(0,0,0,0.2);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

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

img { max-width: 100%; display: block; }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 2rem; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; letter-spacing: -0.015em; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* ============ APP LAYOUT ============ */
#app {
  min-height: 100vh;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

.page-content {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-logo-text {
  flex: 1;
  min-width: 0;
}

.sidebar-logo-text h2 {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gradient-primary);
  border-radius: 0 3px 3px 0;
}

.sidebar-link svg,
.sidebar-link .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link.active .nav-icon {
  opacity: 1;
}

.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

/* ============ HEADER ============ */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  z-index: 90;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  transition: left var(--transition-base);
}

.header-search {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-fast);
}

.header-search input:focus {
  border-color: var(--border-color-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.header-search .kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.header-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-header);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.header-user:hover {
  background: var(--bg-card);
  border-color: var(--border-color);
}

.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
}

.header-user-info {
  display: flex;
  flex-direction: column;
}

.header-user-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.header-user-role {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ============ MOBILE NAV ============ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(var(--glass-blur));
  z-index: 100;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 3px 3px;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
}

.mobile-nav-item .badge-dot {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: var(--danger);
  border-radius: 50%;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}

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

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 2px 8px var(--success-glow);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--success-glow);
}

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

.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--gradient-warning);
  color: white;
}

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

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-subtle);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-sm svg { width: 15px; height: 15px; }

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-xl {
  padding: 16px 32px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--glass-blur));
  transition: all var(--transition-base);
}

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

.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 20px 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color-subtle);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

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

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon.primary { background: var(--primary-subtle); color: var(--primary); }
.stat-icon.success { background: var(--success-subtle); color: var(--success); }
.stat-icon.warning { background: var(--warning-subtle); color: var(--warning); }
.stat-icon.danger { background: var(--danger-subtle); color: var(--danger); }
.stat-icon.info { background: var(--info-subtle); color: var(--info); }

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-change {
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-dot-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: var(--success-subtle); color: var(--success); }
.badge-success .badge-dot-indicator { background: var(--success); }

.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-warning .badge-dot-indicator { background: var(--warning); }

.badge-danger { background: var(--danger-subtle); color: var(--danger); }
.badge-danger .badge-dot-indicator { background: var(--danger); }

.badge-info { background: var(--info-subtle); color: var(--info); }
.badge-info .badge-dot-indicator { background: var(--info); }

.badge-primary { background: var(--primary-subtle); color: var(--primary); }
.badge-primary .badge-dot-indicator { background: var(--primary); }

.badge-neutral {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}
.badge-neutral .badge-dot-indicator { background: var(--text-muted); }

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-color-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  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='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.7rem;
  color: var(--danger);
  margin-top: 4px;
}

/* Password toggle */
.input-with-action {
  position: relative;
}

.input-with-action .form-input {
  padding-right: 80px;
}

.input-action-btns {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 2px;
}

.input-action-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.input-action-btn:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.input-action-btn svg { width: 15px; height: 15px; }

/* ============ TABLES ============ */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color-subtle);
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background: var(--bg-card-hover);
}

.data-table .cell-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.table-empty svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.3;
}

.table-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.pagination-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

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

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

/* ============ MODALS ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--transition-fast);
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--transition-spring);
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-full { max-width: 95vw; max-height: 95vh; }

.modal-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-color-subtle);
}

.modal-header h3 {
  font-size: 1.15rem;
}

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

.modal-close:hover {
  background: var(--danger-subtle);
  color: var(--danger);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-color-subtle);
}

/* ============ TOASTS ============ */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight var(--transition-spring);
  pointer-events: auto;
  max-width: 380px;
  font-size: 0.85rem;
}

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-danger { border-left: 3px solid var(--danger); }
.toast-danger .toast-icon { color: var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.toast.hide {
  animation: slideOutRight var(--transition-fast) forwards;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.tab .tab-count {
  background: var(--bg-card);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
}

.tab.active .tab-count {
  background: var(--primary-subtle);
  color: var(--primary);
}

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.page-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ FILTERS BAR ============ */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-search {
  position: relative;
  min-width: 240px;
  flex: 1;
  max-width: 360px;
}

.filter-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.filter-search input:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.filter-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.filter-select {
  padding: 9px 34px 9px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  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='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

/* ============ STAT GRID ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* ============ QUICK ACTIONS ============ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}

.quick-action-btn:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 4px 20px var(--primary-glow);
  color: var(--text-primary);
}

.quick-action-btn .qa-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-action-btn .qa-icon svg { width: 22px; height: 22px; }

.quick-action-btn span {
  font-size: 0.78rem;
  font-weight: 600;
}

/* ============ PLATFORM CARDS ============ */
.platforms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.platform-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  transition: opacity var(--transition-fast);
}

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

.platform-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.platform-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.platform-card-info h4 {
  font-size: 1rem;
  font-weight: 700;
}

.platform-card-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.platform-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color-subtle);
}

.platform-stat {
  text-align: center;
}

.platform-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.platform-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ============ QUICK SALE WIZARD ============ */
.wizard {
  max-width: 600px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
  padding: 0 16px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.wizard-step.active .wizard-step-number {
  background: var(--gradient-primary);
  border-color: var(--primary);
  color: white;
}

.wizard-step.completed .wizard-step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.wizard-step-line {
  width: 40px;
  height: 2px;
  background: var(--border-color);
  border-radius: 1px;
}

.wizard-step.completed + .wizard-step-line,
.wizard-step.active + .wizard-step-line {
  background: var(--primary);
}

.wizard-step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: none;
}

.wizard-content {
  padding: 0;
}

.wizard-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.wizard-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

/* ============ DELIVERY MESSAGE ============ */
.delivery-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}

.delivery-card pre {
  font-family: var(--font-family);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.delivery-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ============ SELECTION GRID ============ */
.selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.selection-item {
  padding: 16px 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.selection-item:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}

.selection-item.selected {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.selection-item .sel-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.selection-item .sel-name {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.selection-item .sel-info {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============ PROFILE SLOTS ============ */
.profile-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.profile-slot {
  padding: 14px 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-slot.free {
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--info-subtle);
}

.profile-slot.free:hover {
  border-color: var(--info);
  transform: scale(1.03);
}

.profile-slot.occupied {
  opacity: 0.4;
  cursor: not-allowed;
}

.profile-slot.selected {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: scale(1.03);
}

.profile-slot-number {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-slot-status {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ============ NOTIFICATIONS DROPDOWN ============ */
.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 480px;
  overflow-y: auto;
  background: var(--bg-dropdown);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  animation: slideDown var(--transition-fast);
}

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

.notification-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color-subtle);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.notification-item:hover {
  background: var(--bg-card-hover);
}

.notification-item.unread {
  background: var(--primary-subtle);
}

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.notif-text {
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============ SEARCH MODAL ============ */
.search-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: 250;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 20px;
  animation: fadeIn var(--transition-fast);
}

.search-modal {
  width: 100%;
  max-width: 600px;
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--transition-spring);
}

.search-modal-input {
  padding: 18px 20px 18px 52px;
  font-size: 1rem;
  border: none;
  background: transparent;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  border-bottom: 1px solid var(--border-color);
}

.search-modal-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.search-result-group {
  margin-bottom: 4px;
}

.search-result-group-title {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px 4px;
}

.search-result-item {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.search-result-info { flex: 1; }
.search-result-title { font-size: 0.85rem; font-weight: 500; }
.search-result-sub { font-size: 0.7rem; color: var(--text-muted); }

/* ============ CHART CONTAINER ============ */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.chart-canvas {
  width: 100%;
  height: 220px;
  position: relative;
}

/* Simple bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 100%;
  padding-top: 20px;
}

.bar-chart-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.bar-chart-bar {
  width: 100%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  background: var(--gradient-primary);
  transition: all var(--transition-base);
  min-height: 4px;
  position: relative;
}

.bar-chart-bar:hover {
  opacity: 0.85;
}

.bar-chart-value {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.bar-chart-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

/* Donut chart */
.donut-chart {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
}

.donut-chart svg {
  width: 160px;
  height: 160px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.donut-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ============ GRID LAYOUTS ============ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ============ LOGIN PAGE ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.login-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  top: -200px;
  right: -200px;
  animation: float 8s ease-in-out infinite;
}

.login-bg::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.15), transparent 70%);
  bottom: -200px;
  left: -200px;
  animation: float 10s ease-in-out infinite reverse;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  animation: slideUp var(--transition-slow);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: var(--shadow-glow);
}

.login-logo h1 {
  font-size: 1.4rem;
  text-align: center;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .btn {
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============ EMPTY STATES ============ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  background: var(--primary-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-state-icon svg { width: 36px; height: 36px; color: var(--primary); }

.empty-state h3 {
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 400px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* ============ DETAIL VIEW ============ */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.detail-item {
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-all;
}

/* ============ COLOR DOT FOR PLATFORMS ============ */
.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ============ ACCOUNT VISUAL ============ */
.account-profiles-bar {
  display: flex;
  gap: 3px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.account-profiles-bar .slot {
  flex: 1;
  border-radius: 3px;
  transition: all var(--transition-fast);
}

.account-profiles-bar .slot.occupied { background: var(--primary); }
.account-profiles-bar .slot.free { background: var(--border-color); }

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

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

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

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

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

.animate-fade-in { animation: fadeIn var(--transition-base); }
.animate-slide-up { animation: slideUp var(--transition-spring); }
.animate-scale-in { animation: scaleIn var(--transition-spring); }

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  animation: slideUp var(--transition-spring) forwards;
}
.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; }
.stagger-children > *:nth-child(9) { animation-delay: 400ms; }
.stagger-children > *:nth-child(10) { animation-delay: 450ms; }
.stagger-children > *:nth-child(11) { animation-delay: 500ms; }
.stagger-children > *:nth-child(12) { animation-delay: 550ms; }

/* ============ UTILITY CLASSES ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }

.cursor-pointer { cursor: pointer; }
.opacity-50 { opacity: 0.5; }
.relative { position: relative; }

/* WhatsApp / Telegram buttons */
.btn-whatsapp {
  background: #25D366;
  color: white;
}

.btn-whatsapp:hover {
  background: #20BD5A;
}

.btn-telegram {
  background: #0088cc;
  color: white;
}

.btn-telegram:hover {
  background: #007ab8;
}

/* Copy button */
.btn-copy {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-copy:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-copy.copied {
  background: var(--success-subtle);
  border-color: var(--success);
  color: var(--success);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .main-content {
    margin-left: 0;
  }

  .header {
    left: 0;
    padding: 0 16px;
  }

  .mobile-nav {
    display: block;
  }

  .main-content {
    padding-bottom: calc(var(--mobile-nav-height) + 16px);
  }

  .page-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .platforms-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filter-search {
    max-width: none;
    min-width: auto;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .header-user-info {
    display: none;
  }

  .header-search .kbd {
    display: none;
  }

  .donut-chart {
    flex-direction: column;
  }

  .notifications-dropdown {
    right: -60px;
    width: calc(100vw - 32px);
    max-width: 360px;
  }

  .quick-actions {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .quick-action-btn {
    padding: 14px 10px;
  }

  .quick-action-btn .qa-icon {
    width: 36px;
    height: 36px;
  }

  .quick-action-btn span {
    font-size: 0.7rem;
  }

  .detail-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 1.2rem;
  }

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

  .stat-card {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .platforms-grid {
    grid-template-columns: 1fr;
  }

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

  .modal {
    margin: 8px;
    border-radius: var(--radius-lg);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .login-card {
    padding: 28px 24px;
    margin: 16px;
  }

  .wizard-steps {
    padding: 0;
  }

  .wizard-step-line {
    width: 20px;
  }

  #toast-root {
    bottom: calc(var(--mobile-nav-height) + 12px);
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: none;
  }

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

  .bar-chart-bar {
    max-width: 28px;
  }
}

/* ============ HAMBURGER MENU ============ */
.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.hamburger:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.hamburger svg {
  width: 22px;
  height: 22px;
}

@media (max-width: 1024px) {
  .hamburger {
    display: flex;
  }
}

/* ============ SIDEBAR OVERLAY ============ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 99;
}

.sidebar-overlay.visible {
  display: block;
}

/* ============ MESSAGE TEMPLATE EDITOR ============ */
.template-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.template-preview {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.7;
  min-height: 200px;
}

.template-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.template-var {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: monospace;
}

.template-var:hover {
  background: var(--primary);
  color: white;
}

@media (max-width: 768px) {
  .template-editor {
    grid-template-columns: 1fr;
  }
}

/* ============ ACCOUNT EXPANDED CARDS ============ */
.account-exp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
  transition: all var(--transition-base);
}

.account-exp-card:hover {
  border-color: var(--border-color-hover);
}

.account-exp-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.account-exp-platform {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 140px;
  white-space: nowrap;
}

.account-exp-platform .platform-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.account-exp-creds {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  flex-wrap: wrap;
}

.account-exp-cred {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

.account-exp-cred .cred-label {
  color: var(--text-muted);
  font-weight: 500;
}

.account-exp-cred .input-with-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px 8px;
}

.account-exp-cred .cred-value {
  display: inline-block;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
}

.account-exp-cred .input-action-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-exp-cred .input-action-btn:hover {
  background: var(--primary-subtle);
  color: var(--primary);
}

.account-exp-cred .input-action-btn svg {
  width: 12px;
  height: 12px;
}

.account-exp-cred .cred-hidden {
  color: var(--text-muted);
  letter-spacing: 2px;
}

.account-exp-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.account-exp-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: rgba(99, 102, 241, 0.04);
  border-bottom: 1px solid var(--border-color-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.account-exp-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Profile table inside account */
.account-exp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.account-exp-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.account-exp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color-subtle);
  vertical-align: middle;
  white-space: nowrap;
}

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

.account-exp-table tr:hover td {
  background: var(--bg-card-hover);
}

.account-exp-table tr.profile-free td {
  opacity: 0.6;
}

.account-exp-table tr.profile-free:hover td {
  opacity: 1;
}

/* Alert badges in table */
.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.alert-ok {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.alert-critical {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.alert-expired {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-free {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
  font-weight: 500;
}

/* Action buttons in profile table */
.profile-actions {
  display: flex;
  gap: 4px;
}

.profile-action-btn {
  padding: 4px 10px;
  height: 26px;
  border-radius: var(--radius-sm);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.72rem;
  font-weight: 600;
}

.profile-action-btn svg {
  width: 14px;
  height: 14px;
}

.profile-action-btn.action-copy {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.profile-action-btn.action-copy:hover {
  background: rgba(16, 185, 129, 0.3);
}

.profile-action-btn.action-edit {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}
.profile-action-btn.action-edit:hover {
  background: rgba(245, 158, 11, 0.3);
}

.profile-action-btn.action-sell {
  background: rgba(99, 102, 241, 0.15);
  color: #6366f1;
}
.profile-action-btn.action-sell:hover {
  background: rgba(99, 102, 241, 0.3);
}

.profile-action-btn.action-clean {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.profile-action-btn.action-clean:hover {
  background: rgba(239, 68, 68, 0.3);
}

.profile-action-btn.action-wa {
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
}
.profile-action-btn.action-wa:hover {
  background: rgba(37, 211, 102, 0.3);
}

/* Client history modal */
.client-history-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.client-history-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.client-history-info {
  flex: 1;
  min-width: 0;
}

.client-history-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.client-history-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.client-history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.client-stat-mini {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.client-stat-mini .csm-value {
  font-size: 1.2rem;
  font-weight: 800;
}

.client-stat-mini .csm-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.history-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-section-title .hs-count {
  background: var(--primary-subtle);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
}

@media (max-width: 1024px) {
  .account-exp-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .account-exp-creds {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .account-exp-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .account-exp-table {
    font-size: 0.75rem;
  }

  .account-exp-table th,
  .account-exp-table td {
    padding: 8px 8px;
  }

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

@media (max-width: 480px) {
  .account-exp-header {
    padding: 12px 14px;
  }

  .account-exp-meta {
    padding: 6px 14px;
    gap: 8px;
  }
}

/* ============ PRINT STYLES ============ */
@media print {
  .sidebar, .header, .mobile-nav, #toast-root { display: none !important; }
  .main-content { margin-left: 0 !important; padding-top: 0 !important; }
  .card { break-inside: avoid; }
  body { background: white; color: black; }
}
