:root {
  /* ============================================
     PREMIUM DESIGN SYSTEM - CLEAN & POLISHED
     ============================================ */
  
  /* Typography - Premium Font Stack */
  --font-primary: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-main: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Sora", "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", Monaco, monospace;
  
  /* Icon Sizes - Standardized */
  --icon-xs: 14px;
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 24px;
  
  /* Premium Light Theme - Softer Colors (UI-UX-Pro-Max Recommended) */
  --bg-primary: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F1F5F9;
  --bg-hover: #E2E8F0;
  
  /* Text Colors - Softer & Better Contrast */
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-muted: #CBD5E1;
  
  /* Border Colors - Subtle & Clean */
  --border-color: #e2e8f0;
  --border-subtle: rgba(226, 232, 240, 0.6);
  --border-focus: rgba(99, 102, 241, 0.3);

  /* Accent Colors - Vibrant but Smooth */
  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #818cf8;
  --accent-subtle: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* Semantic Colors */
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --error: #ef4444;
  --error-light: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.1);

  /* Premium Shadows - Ultra-Subtle Apple Style (Light Mode) */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.02), 0 1px 1px -1px rgba(0, 0, 0, 0.01);
  --shadow: 0 1px 3px -1px rgba(0, 0, 0, 0.03), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 3px 5px -1px rgba(0, 0, 0, 0.04), 0 2px 3px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 8px 12px -3px rgba(0, 0, 0, 0.05), 0 3px 5px -4px rgba(0, 0, 0, 0.02);
  --shadow-glow: 0 0 16px rgba(99, 102, 241, 0.12);
  --shadow-elevated: 0 16px 20px -5px rgba(0, 0, 0, 0.05), 0 8px 8px -5px rgba(0, 0, 0, 0.02);

  /* Border Radius - Smooth Curves */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
  --backdrop-blur: blur(16px);

  /* Transitions - Smooth & Polished */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   DARK THEME - DEEP & PREMIUM
   ============================================ */
[data-theme="dark"] {
  /* Background Colors - Deep Navy */
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #334155;
  --bg-hover: #475569;
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #64748b;
  --text-muted: #475569;
  
  /* Border Colors */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-focus: rgba(99, 102, 241, 0.3);

  /* Accent Colors - Brighter for Dark Mode */
  --accent-color: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-light: #6366f1;
  --accent-subtle: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.4);
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);

  /* Semantic Colors - Brighter for Dark Mode */
  --success: #34d399;
  --success-light: rgba(16, 185, 129, 0.15);
  --warning: #fbbf24;
  --warning-light: rgba(245, 158, 11, 0.15);
  --error: #f87171;
  --error-light: rgba(239, 68, 68, 0.15);
  --info: #60a5fa;
  --info-light: rgba(59, 130, 246, 0.15);

  /* Shadows - Stronger for Depth */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.35);
  --shadow-elevated: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

  /* Glassmorphism */
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* ============================================
   THEME PRESETS - 4 Different Color Schemes
   ============================================ */

/* PRESET CLAUDE: PREMIUM WARM NEUTRAL (Default) */
[data-theme-preset="claude"] {
  --bg-primary: #f8f6f3;
  --bg-surface: #ffffff;
  --bg-elevated: #f3efea;
  --bg-hover: #e8e1d8;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-muted: #c7ccd3;

  --border-color: #e6dfd6;
  --border-subtle: rgba(230, 223, 214, 0.65);

  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #818cf8;
  --accent-subtle: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.24);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #7c83f6 100%);

  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.52);
}

[data-theme-preset="claude"][data-theme="dark"] {
  --bg-primary: #1a1c1f;
  --bg-surface: #23262b;
  --bg-elevated: #2e3238;
  --bg-hover: #3a4048;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-muted: #64748b;

  --border-color: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);

  --accent-color: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-light: #6366f1;
  --accent-subtle: rgba(99, 102, 241, 0.16);
  --accent-glow: rgba(129, 140, 248, 0.42);
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #9ea8ff 100%);

  --glass-bg: rgba(35, 38, 43, 0.74);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* PRESET A: WARM & CREAMY */
[data-theme-preset="warm"] {
  /* Light Mode Warm Colors */
  --bg-primary: #fefcf8;
  --bg-surface: #faf7f2;
  --bg-elevated: #f5f0e8;
  --bg-hover: #ede8de;
  
  --text-primary: #1a1612;
  --text-secondary: #5c5448;
  --text-tertiary: #8b8272;
  --text-muted: #b5aa9a;
  
  --border-color: #e8e0d4;
  --border-subtle: rgba(232, 224, 212, 0.6);
  
  --accent-color: #d97706;
  --accent-hover: #b45309;
  --accent-light: #f59e0b;
  --accent-subtle: rgba(217, 119, 6, 0.08);
  --accent-glow: rgba(217, 119, 6, 0.25);
  --accent-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  
  --glass-bg: rgba(250, 247, 242, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
}

[data-theme-preset="warm"][data-theme="dark"] {
  /* Dark Mode Warm Colors */
  --bg-primary: #1a1814;
  --bg-surface: #2d2a26;
  --bg-elevated: #3d3832;
  --bg-hover: #4d4740;
  
  --text-primary: #faf6f0;
  --text-secondary: #d4cec4;
  --text-tertiary: #9a9388;
  --text-muted: #6b655c;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.05);
  
  --accent-color: #fbbf24;
  --accent-hover: #f59e0b;
  --accent-light: #fbbf24;
  --accent-subtle: rgba(251, 191, 36, 0.15);
  --accent-glow: rgba(251, 191, 36, 0.4);
  --accent-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  
  --glass-bg: rgba(45, 42, 38, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* PRESET B: COOL & MINIMAL (Default) */
[data-theme-preset="cool"] {
  /* Light Mode - Subtle Blue-Gray */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-muted: #cbd5e1;
  
  --border-color: #e2e8f0;
  --border-subtle: rgba(226, 232, 240, 0.6);
  
  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #818cf8;
  --accent-subtle: rgba(99, 102, 241, 0.08);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
}

[data-theme-preset="cool"][data-theme="dark"] {
  /* Dark Mode - Deep Slate */
  --bg-primary: #0f172a;
  --bg-surface: #1e293b;
  --bg-elevated: #334155;
  --bg-hover: #475569;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #64748b;
  --text-muted: #475569;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-subtle: rgba(255, 255, 255, 0.05);
  
  --accent-color: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-light: #6366f1;
  --accent-subtle: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.4);
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c084fc 100%);
  
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

/* PRESET C: GLASSMORPHISM */
[data-theme-preset="glass"] {
  /* Light Mode - Glass Effect */
  --bg-primary: linear-gradient(135deg, #f0f4f8 0%, #e6eef7 100%);
  --bg-surface: rgba(255, 255, 255, 0.7);
  --bg-elevated: rgba(255, 255, 255, 0.85);
  --bg-hover: rgba(255, 255, 255, 0.9);
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  
  --border-color: rgba(255, 255, 255, 0.5);
  --border-subtle: rgba(255, 255, 255, 0.3);
  
  --accent-color: #06b6d4;
  --accent-hover: #0891b2;
  --accent-light: #22d3ee;
  --accent-subtle: rgba(6, 182, 212, 0.1);
  --accent-glow: rgba(6, 182, 212, 0.3);
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.4);
  --backdrop-blur: blur(20px);
}

[data-theme-preset="glass"][data-theme="dark"] {
  /* Dark Mode - Rich Dark Glass */
  --bg-primary: linear-gradient(135deg, #0c0a1a 0%, #1a1625 100%);
  --bg-surface: rgba(30, 27, 46, 0.6);
  --bg-elevated: rgba(45, 41, 62, 0.75);
  --bg-hover: rgba(60, 55, 80, 0.85);
  
  --text-primary: #f0f0f5;
  --text-secondary: #b8b8c8;
  --text-tertiary: #808090;
  --text-muted: #585868;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  
  --accent-color: #22d3ee;
  --accent-hover: #67e8f9;
  --accent-light: #06b6d4;
  --accent-subtle: rgba(6, 182, 212, 0.2);
  --accent-glow: rgba(34, 211, 238, 0.5);
  --accent-gradient: linear-gradient(135deg, #22d3ee 0%, #60a5fa 50%, #a78bfa 100%);
  
  --glass-bg: rgba(30, 27, 46, 0.4);
  --glass-border: rgba(255, 255, 255, 0.1);
  --backdrop-blur: blur(20px);
}

/* PRESET D: HIGH CONTRAST */
[data-theme-preset="contrast"] {
  /* Light Mode - Pure White */
  --bg-primary: #ffffff;
  --bg-surface: #f5f5f5;
  --bg-elevated: #ebebeb;
  --bg-hover: #e0e0e0;
  
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-tertiary: #666666;
  --text-muted: #999999;
  
  --border-color: #cccccc;
  --border-subtle: rgba(0, 0, 0, 0.08);
  
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #3b82f6;
  --accent-subtle: rgba(37, 99, 235, 0.1);
  --accent-glow: rgba(37, 99, 235, 0.25);
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 0, 0, 0.1);
}

[data-theme-preset="contrast"][data-theme="dark"] {
  /* Dark Mode - True Black (OLED Friendly) */
  --bg-primary: #000000;
  --bg-surface: #0a0a0a;
  --bg-elevated: #141414;
  --bg-hover: #1f1f1f;
  
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-tertiary: #808080;
  --text-muted: #4d4d4d;
  
  --border-color: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);
  
  --accent-color: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #2563eb;
  --accent-subtle: rgba(59, 130, 246, 0.2);
  --accent-glow: rgba(59, 130, 246, 0.4);
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  
  --glass-bg: rgba(10, 10, 10, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* PRESET E: MIDNIGHT PURPLE */
[data-theme-preset="midnight"] {
  /* Light Mode - Soft Lavender */
  --bg-primary: #faf5ff;
  --bg-surface: #f3e8ff;
  --bg-elevated: #ede4ff;
  --bg-hover: #e4d7ff;
  
  --text-primary: #2e1065;
  --text-secondary: #5b21b6;
  --text-tertiary: #7c3aed;
  --text-muted: #a78bfa;
  
  --border-color: #ddd6fe;
  --border-subtle: rgba(221, 214, 254, 0.6);
  
  --accent-color: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-light: #8b5cf6;
  --accent-subtle: rgba(124, 58, 237, 0.08);
  --accent-glow: rgba(124, 58, 237, 0.25);
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  
  --glass-bg: rgba(250, 245, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
}

[data-theme-preset="midnight"][data-theme="dark"] {
  /* Dark Mode - Deep Purple */
  --bg-primary: #1a0b2e;
  --bg-surface: #2d1b4e;
  --bg-elevated: #3d2468;
  --bg-hover: #4c2d7a;
  
  --text-primary: #faf5ff;
  --text-secondary: #e9d5ff;
  --text-tertiary: #d8b4fe;
  --text-muted: #a855f7;
  
  --border-color: rgba(168, 85, 247, 0.2);
  --border-subtle: rgba(168, 85, 247, 0.1);
  
  --accent-color: #a855f7;
  --accent-hover: #c084fc;
  --accent-light: #7c3aed;
  --accent-subtle: rgba(168, 85, 247, 0.15);
  --accent-glow: rgba(168, 85, 247, 0.4);
  --accent-gradient: linear-gradient(135deg, #a855f7 0%, #c084fc 50%, #e879f9 100%);
  
  --glass-bg: rgba(45, 27, 78, 0.7);
  --glass-border: rgba(168, 85, 247, 0.2);
}

/* PRESET F: FOREST GREEN */
[data-theme-preset="forest"] {
  /* Light Mode - Natural Green */
  --bg-primary: #f0fdf4;
  --bg-surface: #dcfce7;
  --bg-elevated: #bbf7d0;
  --bg-hover: #86efac;
  
  --text-primary: #064e3b;
  --text-secondary: #065f46;
  --text-tertiary: #059669;
  --text-muted: #10b981;
  
  --border-color: #a7f3d0;
  --border-subtle: rgba(167, 243, 208, 0.6);
  
  --accent-color: #059669;
  --accent-hover: #047857;
  --accent-light: #10b981;
  --accent-subtle: rgba(5, 150, 105, 0.08);
  --accent-glow: rgba(5, 150, 105, 0.25);
  --accent-gradient: linear-gradient(135deg, #059669 0%, #34d399 100%);
  
  --glass-bg: rgba(240, 253, 244, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
}

[data-theme-preset="forest"][data-theme="dark"] {
  /* Dark Mode - Deep Forest */
  --bg-primary: #022c22;
  --bg-surface: #064e3b;
  --bg-elevated: #065f46;
  --bg-hover: #047857;
  
  --text-primary: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-tertiary: #6ee7b7;
  --text-muted: #34d399;
  
  --border-color: rgba(52, 211, 153, 0.2);
  --border-subtle: rgba(52, 211, 153, 0.1);
  
  --accent-color: #34d399;
  --accent-hover: #6ee7b7;
  --accent-light: #10b981;
  --accent-subtle: rgba(52, 211, 153, 0.15);
  --accent-glow: rgba(52, 211, 153, 0.4);
  --accent-gradient: linear-gradient(135deg, #34d399 0%, #6ee7b7 50%, #a7f3d0 100%);
  
  --glass-bg: rgba(6, 78, 59, 0.7);
  --glass-border: rgba(52, 211, 153, 0.2);
}

/* PRESET G: SUNSET CORAL */
[data-theme-preset="coral"] {
  /* Light Mode - Soft Coral */
  --bg-primary: #fff1f2;
  --bg-surface: #ffe4e6;
  --bg-elevated: #fecdd3;
  --bg-hover: #fda4af;
  
  --text-primary: #881337;
  --text-secondary: #be123c;
  --text-tertiary: #e11d48;
  --text-muted: #fb7185;
  
  --border-color: #fecdd3;
  --border-subtle: rgba(254, 205, 211, 0.6);
  
  --accent-color: #e11d48;
  --accent-hover: #be123c;
  --accent-light: #f43f5e;
  --accent-subtle: rgba(225, 29, 72, 0.08);
  --accent-glow: rgba(225, 29, 72, 0.25);
  --accent-gradient: linear-gradient(135deg, #e11d48 0%, #fb7185 100%);
  
  --glass-bg: rgba(255, 241, 242, 0.8);
  --glass-border: rgba(255, 255, 255, 0.5);
}

[data-theme-preset="coral"][data-theme="dark"] {
  /* Dark Mode - Deep Rose */
  --bg-primary: #4c0519;
  --bg-surface: #881337;
  --bg-elevated: #9f1239;
  --bg-hover: #be123c;
  
  --text-primary: #fff1f2;
  --text-secondary: #fecdd3;
  --text-tertiary: #fda4af;
  --text-muted: #fb7185;
  
  --border-color: rgba(251, 113, 133, 0.2);
  --border-subtle: rgba(251, 113, 133, 0.1);
  
  --accent-color: #fb7185;
  --accent-hover: #fda4af;
  --accent-light: #f43f5e;
  --accent-subtle: rgba(251, 113, 133, 0.15);
  --accent-glow: rgba(251, 113, 133, 0.4);
  --accent-gradient: linear-gradient(135deg, #fb7185 0%, #fda4af 50%, #ffe4e6 100%);
  
  --glass-bg: rgba(136, 19, 55, 0.7);
  --glass-border: rgba(251, 113, 133, 0.2);
}

/* Apply Glassmorphism backdrop blur to glass preset */
[data-theme-preset="glass"] .sidebar,
[data-theme-preset="glass"] .stat-card,
[data-theme-preset="glass"] .section,
[data-theme-preset="glass"] .modal,
[data-theme-preset="glass"] .cmp-card {
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
}

/* ===== Main Content ===== */
.main-content {
  position: relative;
}

.main-content>* {
  position: relative;
  z-index: 1;
}

/* Dark Mode Specific Overrides */
[data-theme="dark"] .sidebar {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .nav-item:hover,
[data-theme="dark"] .nav-item.active {
  background: rgba(88, 166, 255, 0.1);
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] .section,
[data-theme="dark"] .campaign-card,
[data-theme="dark"] .chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .template-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .template-card:hover {
  background: var(--bg-surface);
  border-color: var(--border-glass);
}

[data-theme="dark"] .stat-icon.sent {
  background: rgba(88, 166, 255, 0.15);
}

[data-theme="dark"] .stat-icon.opened {
  background: rgba(63, 185, 80, 0.15);
}

[data-theme="dark"] .stat-icon.clicked {
  background: rgba(210, 153, 34, 0.15);
}

[data-theme="dark"] .stat-icon.errors {
  background: rgba(248, 81, 73, 0.15);
}

[data-theme="dark"] .input-field,
[data-theme="dark"] .tool-btn,
[data-theme="dark"] .tool-select {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .input-field:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

[data-theme="dark"] .email-editor {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .modal,
[data-theme="dark"] .login-popup {
  background: var(--bg-surface);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .btn-outline:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: rgba(129, 140, 248, 0.1);
}

[data-theme="dark"] .filter-btn {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .filter-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

[data-theme="dark"] .filter-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
}

[data-theme="dark"] .list-tab {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .list-tab:hover {
  background: rgba(88, 166, 255, 0.1);
  border-color: var(--accent-color);
}

[data-theme="dark"] .list-tab.active {
  background: var(--accent-color);
  color: #ffffff;
}

[data-theme="dark"] .contacts-table th {
  background: var(--bg-elevated);
}

[data-theme="dark"] .stats-table th {
  background: var(--bg-elevated);
}

[data-theme="dark"] .user-card {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(88, 166, 255, 0.1) 100%);
}

[data-theme="dark"] .user-card:hover {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.15) 0%, rgba(88, 166, 255, 0.2) 100%);
}

[data-theme="dark"] .info-box {
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent-color);
}

[data-theme="dark"] .info-box code {
  background: rgba(88, 166, 255, 0.2);
}

[data-theme="dark"] .progress-container {
  background: var(--bg-elevated);
}

[data-theme="dark"] .quick-campaign-section {
  background: var(--bg-surface);
}

/* ==================== MODAL STYLES ==================== */
/* Modal Backdrop - Full screen overlay for centering */
.modal-backdrop {
  position: fixed;
  /* Use fixed for full viewport coverage */
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  /* Use flexbox to center the modal */
  display: flex;
  justify-content: center;
  /* Center horizontally */
  align-items: center;
  /* Center vertically */
  /* Optional: Add a subtle dark overlay */
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100000;
  /* Ensure it's above other content */
  animation: fadeIn 0.2s ease;
  /* Fade the backdrop in */
  overflow-y: auto;
  /* Allow scrolling if modal is taller than viewport */
}

/* Modal Container - Centered dialog box */
.modal {
  background: var(--bg-surface);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  outline: none;
  margin: 16px auto;

  /* --- REVISED SIZE --- */
  width: 90%;
  min-width: 320px;
  max-width: 750px;
  /* Wider */

  /* Ensure responsiveness */
  max-height: 85vh;

  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* --- REVISED ANIMATION --- */
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Wide Modal for Campaign Creation */
.modal-wide {
  max-width: 900px !important;
  width: 95% !important;
}

/* Ensure modal body scrolls properly */
.modal .modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(85vh - 140px);
}

/* --- REVISED KEYFRAME (Using a bounce-like scale-in) --- */
@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
    /* Scale in from 90% size */
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Page fade overlay for profile/account switches */
.page-fade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.25) 0%, rgba(99, 102, 241, 0.1) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.3s ease;
  backdrop-filter: brightness(0.95);
}

.page-fade-overlay.show {
  opacity: 1;
  pointer-events: auto;
  animation: fadeInOverlay 0.4s ease forwards;
}

.page-fade-overlay.hide {
  animation: fadeOutOverlay 0.4s ease forwards;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
    backdrop-filter: brightness(1);
  }

  to {
    opacity: 1;
    backdrop-filter: brightness(0.92);
  }
}

@keyframes fadeOutOverlay {
  from {
    opacity: 1;
    backdrop-filter: brightness(0.92);
  }

  to {
    opacity: 0;
    backdrop-filter: brightness(1);
  }
}

.content-fade-slide-out {
  animation: contentFadeSlideOut 0.25s ease forwards;
}

.content-fade-slide-in {
  animation: contentFadeSlideIn 0.3s ease forwards;
}

@keyframes contentFadeSlideOut {
  from {
    opacity: 1;
    transform: translateY(0px);
  }

  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes contentFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0px);
  }
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--error);
}

/* Modal Body */
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-wrap: wrap;
  border-radius: 0 0 20px 20px;
}

/* Modal Input Field */
.modal-input-field {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.modal-input-field:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ==================== END MODAL STYLES ==================== */

/* Automation Builder Modal Specific Styles */
.modal-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  outline: none;
  margin: auto;

  /* Builder needs space but should be responsive */
  width: 90%;
  max-width: 900px;
  max-height: 90vh;

  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ensure header inside modal-content is properly styled */
.modal-content .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.modal-content .modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-content .modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: 0 0 24px 24px;
}

[data-theme="dark"] .modal-backdrop,
[data-theme="dark"] .login-popup-overlay {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 8px 16px;
}

.theme-toggle:hover {
  background: var(--accent-glow);
  color: var(--accent-color);
  transform: rotate(15deg);
}

[data-theme="dark"] .theme-toggle {
  background: var(--bg-elevated);
}

/* Header Controls - Language + Theme Toggle */
.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 100;
}

/* Menu Top Controls - Compact Language + Theme in Sidebar */
.menu-top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
}

/* Compact Language Dropdown */
.lang-dropdown-wrapper {
  position: relative;
}

.account-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.account-arrow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.account-arrow-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: var(--bg-primary);
}

.account-arrow-btn .material-icons {
  font-size: 20px;
}

.profile-quick-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  top: auto;
  width: 210px;
  display: none;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  box-shadow: var(--shadow-elevated);
  z-index: 1200;
  outline: none;
}

.profile-quick-menu.open {
  display: block;
  animation: fadeIn 0.16s ease;
}

.profile-quick-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  outline: none;
}

.profile-quick-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.22);
  color: var(--accent-color);
  transform: translateX(2px);
  font-weight: 500;
}

.profile-quick-btn .material-icons {
  font-size: 17px;
  color: var(--accent-color);
}

.profile-quick-btn.danger {
  color: var(--error);
}

.profile-quick-btn.danger .material-icons {
  color: var(--error);
}

.profile-quick-divider {
  height: 1px;
  margin: 8px 4px;
  background: var(--border-color);
}

.profile-quick-lang-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 6px;
  margin-bottom: 6px;
}

.profile-quick-lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.profile-quick-lang-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: 8px;
  height: 30px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.profile-quick-lang-btn:hover {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.profile-quick-lang-btn.active {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--accent-subtle);
}

.lang-globe-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-globe-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent-color);
}

.lang-globe-btn .material-icons:first-child {
  font-size: 16px;
  color: var(--accent-color);
}

.lang-current {
  font-weight: 600;
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  z-index: 1000;
  display: none;
  min-width: 130px;
}

.lang-dropdown.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.lang-option {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.lang-option:hover {
  background: var(--bg-primary);
}

.lang-option.active {
  background: rgba(26, 115, 232, 0.1);
  color: var(--accent-color);
  font-weight: 600;
}

/* Compact Theme Toggle */
.theme-toggle-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-compact:hover {
  color: var(--accent-color);
  transform: scale(1.03);
  text-shadow: 0 0 12px var(--accent-glow);
}

.theme-toggle-compact:active {
  transform: scale(0.98);
}

.theme-toggle-compact .material-icons {
  font-size: 20px;
}

[data-theme="dark"] .theme-toggle-compact {
  background: transparent;
}

/* ============================================
   THEME PRESET SELECTOR
   ============================================ */

.theme-preset-wrapper {
  position: relative;
}

.theme-preset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.theme-preset-btn:hover {
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.1);
}

.theme-preset-btn:active {
  transform: scale(0.95);
}

.theme-preset-btn .material-icons {
  font-size: 22px;
  transition: transform 0.3s ease;
}

.theme-preset-btn:hover .material-icons {
  transform: rotate(15deg);
}

.theme-preset-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: auto;
  left: 0;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  z-index: 99999;
  padding: 16px;
  display: none;
  animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.theme-preset-dropdown.open {
  display: block;
}

.theme-preset-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-color);
  padding: 0 8px 12px;
  border-bottom: 2px solid var(--accent-subtle);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-preset-header::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-gradient);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
}

.theme-preset-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.theme-preset-option:last-child {
  margin-bottom: 0;
}

.theme-preset-option:hover {
  background: var(--bg-hover);
}

.theme-preset-option.active {
  background: var(--accent-subtle);
  border: 1px solid var(--accent-color);
}

.theme-preset-option.active .theme-preset-name {
  color: var(--accent-color);
  font-weight: 600;
}

.theme-preset-preview {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  overflow: hidden;
}

.theme-preset-option:hover .theme-preset-preview {
  transform: scale(1.05);
}

.theme-preset-option.active .theme-preset-preview {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-glow);
}

.preview-light {
  flex: 1;
  border-radius: 3px;
}

.preview-dark {
  flex: 1;
  border-radius: 3px;
}

/* Claude Preset Preview Colors */
.theme-preset-option[data-preset="claude"] .preview-light {
  background: linear-gradient(to bottom, #ffffff 50%, #f3efea 50%);
  border: 1px solid #e6dfd6;
}

.theme-preset-option[data-preset="claude"] .preview-dark {
  background: linear-gradient(to bottom, #23262b 50%, #2e3238 50%);
  border: 1px solid #3a4048;
}

/* Warm Preset Preview Colors */
.theme-preset-option[data-preset="warm"] .preview-light {
  background: linear-gradient(to bottom, #faf7f2 50%, #f5f0e8 50%);
}

.theme-preset-option[data-preset="warm"] .preview-dark {
  background: linear-gradient(to bottom, #2d2a26 50%, #3d3832 50%);
}

/* Cool Preset Preview Colors */
.theme-preset-option[data-preset="cool"] .preview-light {
  background: linear-gradient(to bottom, #ffffff 50%, #f1f5f9 50%);
}

.theme-preset-option[data-preset="cool"] .preview-dark {
  background: linear-gradient(to bottom, #1e293b 50%, #334155 50%);
}

/* Glass Preset Preview Colors */
.theme-preset-option[data-preset="glass"] .preview-light {
  background: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(240,244,248,0.8) 100%);
  border: 1px solid rgba(255,255,255,0.5);
}

.theme-preset-option[data-preset="glass"] .preview-dark {
  background: linear-gradient(135deg, rgba(30,27,46,0.6) 0%, rgba(45,41,62,0.7) 100%);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Contrast Preset Preview Colors */
.theme-preset-option[data-preset="contrast"] .preview-light {
  background: linear-gradient(to bottom, #ffffff 50%, #f5f5f5 50%);
  border: 1px solid #cccccc;
}

.theme-preset-option[data-preset="contrast"] .preview-dark {
  background: linear-gradient(to bottom, #0a0a0a 50%, #141414 50%);
  border: 1px solid #333333;
}

/* Midnight Preset Preview Colors */
.theme-preset-option[data-preset="midnight"] .preview-light {
  background: linear-gradient(to bottom, #faf5ff 50%, #f3e8ff 50%);
  border: 1px solid #ddd6fe;
}

.theme-preset-option[data-preset="midnight"] .preview-dark {
  background: linear-gradient(to bottom, #2d1b4e 50%, #3d2468 50%);
  border: 1px solid #7c3aed;
}

/* Forest Preset Preview Colors */
.theme-preset-option[data-preset="forest"] .preview-light {
  background: linear-gradient(to bottom, #f0fdf4 50%, #dcfce7 50%);
  border: 1px solid #a7f3d0;
}

.theme-preset-option[data-preset="forest"] .preview-dark {
  background: linear-gradient(to bottom, #064e3b 50%, #065f46 50%);
  border: 1px solid #34d399;
}

/* Coral Preset Preview Colors */
.theme-preset-option[data-preset="coral"] .preview-light {
  background: linear-gradient(to bottom, #fff1f2 50%, #ffe4e6 50%);
  border: 1px solid #fecdd3;
}

.theme-preset-option[data-preset="coral"] .preview-dark {
  background: linear-gradient(to bottom, #881337 50%, #9f1239 50%);
  border: 1px solid #fb7185;
}

.theme-preset-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.theme-preset-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.theme-preset-desc {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Active preset indicator dot on the palette button */
.theme-preset-btn .preset-indicator {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: all 0.3s ease;
  border: 2px solid var(--bg-surface);
}

/* Preset-specific indicator colors */
.theme-preset-btn[data-active-preset="claude"] .preset-indicator {
  background: #6366f1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.theme-preset-btn[data-active-preset="cool"] .preset-indicator {
  background: #6366f1;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.theme-preset-btn[data-active-preset="warm"] .preset-indicator {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.theme-preset-btn[data-active-preset="glass"] .preset-indicator {
  background: #06b6d4;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

.theme-preset-btn[data-active-preset="contrast"] .preset-indicator {
  background: #000000;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .theme-preset-btn[data-active-preset="contrast"] .preset-indicator {
  background: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* Midnight preset indicator */
.theme-preset-btn[data-active-preset="midnight"] .preset-indicator {
  background: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
}

/* Forest preset indicator */
.theme-preset-btn[data-active-preset="forest"] .preset-indicator {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* Coral preset indicator */
.theme-preset-btn[data-active-preset="coral"] .preset-indicator {
  background: #fb7185;
  box-shadow: 0 0 8px rgba(251, 113, 133, 0.6);
}

/* ============================================
   THEME PRESET CARDS (Settings Page)
   ============================================ */

.theme-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.theme-preset-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.theme-preset-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--accent-color);
}

.theme-preset-card:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.theme-preset-card.active {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-color), 0 8px 32px rgba(var(--primary-rgb), 0.2);
}

.theme-card-preview {
  width: 100%;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-header {
  height: 32px;
  width: 100%;
}

.preview-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-text-line {
  height: 8px;
  border-radius: 4px;
  width: 100%;
}

.preview-text-line.short {
  width: 60%;
}

.preview-button {
  height: 20px;
  border-radius: 6px;
  width: 40%;
  margin-top: 4px;
}

/* Cool Theme Preview */
.cool-preview {
  background: #f8fafc;
}

.cool-preview .preview-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.cool-preview .preview-body {
  background: #ffffff;
}

.cool-preview .preview-text-line {
  background: #e2e8f0;
}

.cool-preview .preview-button {
  background: #6366f1;
}

/* Warm Theme Preview */
.warm-preview {
  background: #faf7f2;
}

.warm-preview .preview-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.warm-preview .preview-body {
  background: #ffffff;
}

.warm-preview .preview-text-line {
  background: #e7e0d5;
}

.warm-preview .preview-button {
  background: #f59e0b;
}

/* Glass Theme Preview */
.glass-preview {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 244, 248, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-preview .preview-header {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.8) 0%, rgba(8, 145, 178, 0.9) 100%);
  backdrop-filter: blur(10px);
}

.glass-preview .preview-body {
  background: rgba(255, 255, 255, 0.7);
}

.glass-preview .preview-text-line {
  background: rgba(0, 0, 0, 0.1);
}

.glass-preview .preview-button {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

/* Contrast Theme Preview */
.contrast-preview {
  background: #ffffff;
  border: 2px solid #000000;
}

.contrast-preview .preview-header {
  background: #000000;
}

.contrast-preview .preview-body {
  background: #ffffff;
}

.contrast-preview .preview-text-line {
  background: #333333;
}

.contrast-preview .preview-button {
  background: #000000;
}

/* Midnight Theme Preview */
.midnight-preview {
  background: #f5f3ff;
}

.midnight-preview .preview-header {
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
}

.midnight-preview .preview-body {
  background: #ffffff;
}

.midnight-preview .preview-text-line {
  background: #ddd6fe;
}

.midnight-preview .preview-button {
  background: #7c3aed;
}

/* Forest Theme Preview */
.forest-preview {
  background: #f0fdf4;
}

.forest-preview .preview-header {
  background: linear-gradient(135deg, #16a34a 0%, #166534 100%);
}

.forest-preview .preview-body {
  background: #ffffff;
}

.forest-preview .preview-text-line {
  background: #d1fae5;
}

.forest-preview .preview-button {
  background: #16a34a;
}

/* Coral Theme Preview */
.coral-preview {
  background: #fff7ed;
}

.coral-preview .preview-header {
  background: linear-gradient(135deg, #f97316 0%, #fb7185 100%);
}

.coral-preview .preview-body {
  background: #ffffff;
}

.coral-preview .preview-text-line {
  background: #fed7aa;
}

.coral-preview .preview-button {
  background: #f97316;
}

/* Dark mode previews */
[data-theme="dark"] .cool-preview {
  background: #1e293b;
}

[data-theme="dark"] .cool-preview .preview-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

[data-theme="dark"] .cool-preview .preview-body {
  background: #334155;
}

[data-theme="dark"] .cool-preview .preview-text-line {
  background: #475569;
}

[data-theme="dark"] .cool-preview .preview-button {
  background: #818cf8;
}

[data-theme="dark"] .warm-preview {
  background: #2d2a26;
}

[data-theme="dark"] .warm-preview .preview-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

[data-theme="dark"] .warm-preview .preview-body {
  background: #3d3832;
}

[data-theme="dark"] .warm-preview .preview-text-line {
  background: #5c564d;
}

[data-theme="dark"] .warm-preview .preview-button {
  background: #fbbf24;
}

[data-theme="dark"] .glass-preview {
  background: linear-gradient(135deg, rgba(30, 27, 46, 0.9) 0%, rgba(45, 41, 62, 0.95) 100%);
}

[data-theme="dark"] .glass-preview .preview-header {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.9) 0%, rgba(8, 145, 178, 0.95) 100%);
}

[data-theme="dark"] .glass-preview .preview-body {
  background: rgba(45, 41, 62, 0.8);
}

[data-theme="dark"] .glass-preview .preview-text-line {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass-preview .preview-button {
  background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
}

[data-theme="dark"] .contrast-preview {
  background: #0a0a0a;
  border-color: #ffffff;
}

[data-theme="dark"] .contrast-preview .preview-header {
  background: #ffffff;
}

[data-theme="dark"] .contrast-preview .preview-body {
  background: #0a0a0a;
}

[data-theme="dark"] .contrast-preview .preview-text-line {
  background: #ffffff;
}

[data-theme="dark"] .contrast-preview .preview-button {
  background: #ffffff;
}

[data-theme="dark"] .midnight-preview {
  background: #1f1633;
}

[data-theme="dark"] .midnight-preview .preview-header {
  background: linear-gradient(135deg, #8b5cf6 0%, #5b21b6 100%);
}

[data-theme="dark"] .midnight-preview .preview-body {
  background: #2b1f46;
}

[data-theme="dark"] .midnight-preview .preview-text-line {
  background: #4c1d95;
}

[data-theme="dark"] .midnight-preview .preview-button {
  background: #a78bfa;
}

[data-theme="dark"] .forest-preview {
  background: #0f2418;
}

[data-theme="dark"] .forest-preview .preview-header {
  background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
}

[data-theme="dark"] .forest-preview .preview-body {
  background: #163123;
}

[data-theme="dark"] .forest-preview .preview-text-line {
  background: #1f3d2c;
}

[data-theme="dark"] .forest-preview .preview-button {
  background: #34d399;
}

[data-theme="dark"] .coral-preview {
  background: #2a1b14;
}

[data-theme="dark"] .coral-preview .preview-header {
  background: linear-gradient(135deg, #fb7185 0%, #f97316 100%);
}

[data-theme="dark"] .coral-preview .preview-body {
  background: #3a241b;
}

[data-theme="dark"] .coral-preview .preview-text-line {
  background: #4a2b20;
}

[data-theme="dark"] .coral-preview .preview-button {
  background: #fb7185;
}

.theme-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.theme-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.theme-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent-color);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  margin-top: 8px;
  width: fit-content;
}

.theme-card-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Smooth transitions for theme changes */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Keyboard shortcut help text styling */
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: 0 2px 0 var(--border-color);
  margin: 0 2px;
}

[data-theme="dark"] kbd {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-preset-dropdown {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

/* Animation for dropdown */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-theme="dark"] .lang-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

/* Current Plan Section */
.sidebar-plan-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  background: linear-gradient(to top, rgba(99, 102, 241, 0.05), transparent);
  margin-top: auto;
}

.plan-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  background: rgba(99, 102, 241, 0.08);
  transition: all 0.3s ease;
}

.plan-badge.pro {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.5));
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.3), inset 0 0 0 1px rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 8px 14px;
  border-radius: 12px;
  letter-spacing: 1.2px;
}

.plan-icon {
  font-size: 14px;
}

.upgrade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.4), 0 0 48px rgba(99, 102, 241, 0.2);
}

.upgrade-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 0 32px rgba(99, 102, 241, 0.6), 0 0 64px rgba(99, 102, 241, 0.3);
}

.upgrade-btn .material-icons {
  font-size: 14px;
}

.upgrade-btn.hidden {
  display: none;
}

[data-theme="dark"] .sidebar-plan-section {
  background: linear-gradient(to top, rgba(99, 102, 241, 0.1), transparent);
}



/* Profile Settings Button */
.profile-settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
}

.profile-settings-btn:hover {
  background: var(--accent-glow);
  color: var(--accent-color);
  transform: rotate(45deg);
}

.profile-settings-btn .material-icons {
  font-size: 18px;
}

/* Custom Datepicker */
.datepicker-popup {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-elevated);
  width: 280px;
  padding: 16px;
  z-index: 1000;
  display: none;
  animation: fadeIn 0.2s ease;
}

.datepicker-popup.open {
  display: block;
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.datepicker-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.datepicker-nav {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
}

.datepicker-nav:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-bottom: 8px;
}

.datepicker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.datepicker-day {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s;
}

.datepicker-day:hover:not(.empty) {
  background: var(--bg-primary);
}

.datepicker-day.selected {
  background: var(--accent-color);
  color: white;
}

.datepicker-day.today {
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
}

.datepicker-day.today.selected {
  color: white;
}

.datepicker-day.empty {
  cursor: default;
}

[data-theme="dark"] .datepicker-popup {
  background: var(--bg-elevated);
}

/* Plan Badge Pro Style */
/* Plan Badge Pro Style */
.plan-badge.pro {
  color: #fbbf24;
  /* Amber-400 for pro gold look */
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

/* Sidebar Profile Quota */
.sidebar-quota-section {
  padding: 12px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
}

.sidebar-quota-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 0 0 1px var(--border-color);
}

.sidebar-quota-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color) 0%, #a855f7 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.sidebar-quota-text {
  display: none;
}

.sidebar-sent-today {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}

.sidebar-sent-today .material-icons {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Top bar */
.top-bar {
  position: relative;
}

/* Smooth theme transition */
body,
.sidebar,
.main-content,
.stat-card,
.section,
.input-field,
.btn,
.modal,
.nav-item {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

h1,
h2,
h3,
.top-bar h1 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Improve font rendering across platforms */
body,
button,
input,
select,
textarea {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
}


.sidebar {
  width: 220px;
  /* Reduced specific width */
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 0 0 0;
  /* Removed bottom padding */
  flex-shrink: 0;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-size: 20px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.nav-menu {
  flex: 1;
  padding: 0 10px;
  /* Less side padding */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.15) transparent;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  color: var(--text-secondary);
  border-radius: 10px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-size: 12.5px;
  transition: all 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-color);
  transform: translateX(2px);
  font-weight: 500;
}

.nav-item .material-icons {
  font-size: 18px;
}

/* Nav Badge - Plan indicators */
.nav-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #0f766e;
  border: 1px solid rgba(20, 184, 166, 0.35);
  background: rgba(20, 184, 166, 0.16);
}

.nav-badge-pro {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.12);
}

.nav-badge-starter {
  color: #0ea5e9;
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(14, 165, 233, 0.12);
}

/* ── Nav Groups (collapsible sections) ── */
.nav-group {
  margin-top: 8px;
}

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 5px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.nav-group-header:hover {
  background: rgba(99, 102, 241, 0.04);
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-color, #6366f1);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.nav-group-header:hover .nav-group-label {
  opacity: 1;
}

.nav-group-chevron {
  font-size: 18px !important;
  color: var(--accent-color, #6366f1);
  opacity: 0.5;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.nav-group-header:hover .nav-group-chevron {
  opacity: 0.85;
}

.nav-group.collapsed .nav-group-chevron {
  transform: rotate(-90deg);
}

.nav-group-items {
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  opacity: 1;
}

.nav-group.collapsed .nav-group-items {
  max-height: 0;
  opacity: 0;
}

.nav-separator {
  height: 1px;
  margin: 8px 14px;
  background: var(--border-color);
  opacity: 0.5;
}

/* ── Nav Mode Toggle Button ── */
.nav-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin: 0 0 6px auto;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  opacity: 0.45;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-mode-toggle:hover {
  opacity: 0.85;
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-color);
}

.nav-mode-toggle .material-icons {
  font-size: 16px;
}

/* ── Flat Mode (default) ── */
.nav-menu.nav-flat .nav-group-header {
  display: none;
}

.nav-menu.nav-flat .nav-group {
  margin-top: 0;
}

.nav-menu.nav-flat .nav-group-items {
  max-height: none;
  opacity: 1;
}

.nav-menu.nav-flat .nav-group.collapsed .nav-group-items {
  max-height: none;
  opacity: 1;
}

.nav-menu.nav-flat .nav-separator {
  display: none;
}

.nav-menu.nav-flat .nav-item {
  padding: 6px 12px;
  font-size: 12px;
  gap: 9px;
  border-radius: 8px;
}

.nav-menu.nav-flat .nav-item .material-icons {
  font-size: 17px;
}


.user-profile {
  padding: 20px 24px 0;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.user-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 28px;
  overflow-y: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.top-bar h1 {
  font-size: 26px;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-outline:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.btn-reports-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-reports-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
  color: var(--text-primary);
}

.btn-reports-toggle.active {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.btn-schedule {
  position: relative;
  border: 1px solid transparent;
  background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
    linear-gradient(135deg, #6366f1 0%, #a855f7 100%) border-box;
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-schedule:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
  background: linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
    linear-gradient(135deg, #4f46e5 0%, #9333ea 100%) border-box;
}

.btn-schedule .material-icons {
  color: #6366f1;
}

[data-theme="dark"] .btn-reports-toggle.active {
  background: rgba(52, 211, 153, 0.12);
  border-color: var(--success);
  color: var(--success);
}

[data-theme="dark"] .btn-schedule {
  background: linear-gradient(var(--bg-elevated), var(--bg-elevated)) padding-box,
    linear-gradient(135deg, #818cf8 0%, #c084fc 100%) border-box;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .btn-schedule:hover {
  box-shadow: 0 8px 25px rgba(129, 140, 248, 0.2);
  background: linear-gradient(var(--bg-surface), var(--bg-surface)) padding-box,
    linear-gradient(135deg, #6366f1 0%, #a855f7 100%) border-box;
}

[data-theme="dark"] .btn-schedule .material-icons {
  color: #a5b4fc;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.25s;
  min-height: 100px;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  font-size: 18px;
}

.sent {
  background: #e8f0fe;
  color: var(--accent-color);
}

.opened {
  background: #e6f4ea;
  color: var(--success);
}

.clicked {
  background: #fef7e0;
  color: var(--warning);
}

.errors {
  background: #fce8e6;
  color: var(--error);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.test-email-section {
  padding: 16px;
  background: var(--bg-surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.input-field.small {
  flex: 1;
  min-width: 140px;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
}

.status {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.status.success {
  background: #e6f4ea;
  color: var(--success);
}

.status.error {
  background: #fce8e6;
  color: var(--error);
}

.view {
  display: none;
  animation: fadeIn 0.25s;
}

.view.active {
  display: block;
}


.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
}

.section {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  margin-top: 8px;
}

.table-container {
  overflow-x: auto;
  margin-top: 12px;
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
}

.contacts-table th,
.contacts-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.contacts-table th {
  font-weight: 600;
  background: #f8f9fa;
}

.help-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.tool-btn,
.tool-select,
.tool-color {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  cursor: pointer;
}

.tool-color {
  width: 40px;
  height: 32px;
  padding: 0;
}

.email-editor {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  outline: none;
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.6;
}

.templates-grid,
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.template-card,
.campaign-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.template-preview {
  height: 100px;
  margin-bottom: 12px;
  overflow: hidden;
  font-size: 13px;
}

/* MODERN MODAL POPUP STYLING */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  animation: fadeIn 0.25s ease;
  padding: 20px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal {
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: none;
  width: 94%;
  min-width: 420px;
  max-width: 880px;
  overflow: hidden;
  animation: modalScaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  margin: 16px auto;
}

/* Dark Mode Modal Override */
[data-theme="dark"] .modal {
  background: var(--bg-elevated);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}


.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  flex: 1;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--bg-primary);
  color: var(--error);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.modal-body p {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.5;
}

.modal-footer {
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
  background: transparent;
}

.modal-footer .btn {
  min-width: 80px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.modal-footer .btn-primary {
  background: var(--accent-color);
  color: white;
  border: none;
}

.modal-footer .btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 12px rgba(99, 102, 241, 0.25);
}

.modal-footer .btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.modal-footer .btn-secondary:hover {
  background: var(--border-color);
}

.modal-input-field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.modal-input-field::placeholder {
  color: var(--text-tertiary);
}

.modal-input-field:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* LIST TABS */
.list-tabs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.list-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.list-tab:hover {
  background: #e8f0fe;
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.list-tab.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.list-tab.active .list-count {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.list-count {
  background: var(--bg-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.list-delete {
  margin-left: 4px;
  font-size: 16px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.list-delete:hover {
  opacity: 1;
  color: var(--error);
}

.list-tab.add-list {
  border-style: dashed;
  background: transparent;
}

.list-tab.add-list:hover {
  background: #e8f0fe;
}

/* PROGRESS BAR */
.progress-container {
  margin-top: 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  overflow: hidden;
  height: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #34a853);
  border-radius: 8px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* CAMPAIGN STATUS BADGES */
.campaign-status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.campaign-status.pending {
  background: #fef7e0;
  color: var(--warning);
}

.campaign-status.running {
  background: #e8f0fe;
  color: var(--accent-color);
}

.campaign-status.completed {
  background: #e6f4ea;
  color: var(--success);
}

/* QUICK CAMPAIGN SECTION */
.quick-campaign-section {
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.quick-campaign-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.quick-campaign-section .form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.quick-campaign-section .input-field,
.quick-campaign-section select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 8px;
  flex: 1;
  min-width: 140px;
}

.quick-campaign-section .input-field::placeholder {
  color: var(--text-tertiary);
}

.quick-campaign-section option {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.quick-campaign-section .btn {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

/* ICON BUTTONS */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* FORM IMPROVEMENTS */
.form-group {
  margin-bottom: 12px;
}

/* Two-column form layout for wider modals */
.modal.modal-wide .modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal.modal-wide .modal-body .form-group:last-child {
  grid-column: 1 / -1;
}

/* Responsive: single column on smaller screens */
@media (max-width: 700px) {
  .modal.modal-wide .modal-body {
    grid-template-columns: 1fr;
  }

  .modal.modal-wide .modal-body .form-group:last-child {
    grid-column: auto;
  }
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.input-field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.input-field:hover {
  border-color: var(--accent-color);
  background: var(--bg-surface);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-color);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

/* MERGE TAG INFO BOX */
.info-box {
  background: #e8f0fe;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--accent-color);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.info-box .material-icons {
  font-size: 18px;
  margin-top: 1px;
}

.info-box code {
  background: rgba(26, 115, 232, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* MODERN USER PROFILE SECTION */
.profile-content-wrapper {
  width: 100%;
  margin: 0;
}

/* Quota visual sizing for profile page */
.profile-col-right .quota-visual {
  width: 140px;
  height: 140px;
}

/* Make quota percent and summary numbers more prominent */
#quota-percent-text {
  font-size: 28px;
}

.profile-grid-container {
  display: grid;
  /* two equal columns */
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  margin: 0;
}

.profile-col-left,
.profile-col-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Card base styles (applies to quota & summary cards) */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

/* Slightly tighter vertical spacing for right-column sections */
.profile-col-right>.section {
  margin-top: -6px;
}

/* Emphasize quota/account cards in the right column */
.profile-col-right .card {
  padding: 16px;
  transition: box-shadow 0.18s ease, transform 0.12s ease;
}

.profile-col-right .card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .profile-grid-container {
    grid-template-columns: 1fr;
  }
}

.user-profile-section {
  padding: 16px;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #f8f9fa 0%, #e8f0fe 100%);
}

.user-card:hover {
  background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 100%);
  transform: translateX(4px);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 11px;
  color: var(--text-secondary);
}

.expand-icon {
  color: var(--text-secondary);
  font-size: 18px;
  transition: transform 0.2s;
}

.user-card:hover .expand-icon {
  transform: translateX(2px);
}

/* LOGIN POPUP */
.login-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  animation: fadeIn 0.2s ease;
}

.login-popup {
  background: white;
  border-radius: 24px;
  width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
}

.login-logo .material-icons {
  color: var(--accent-color);
}

.login-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
}

.login-close:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.login-popup-body {
  padding: 32px 24px;
  text-align: center;
}

.login-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: white;
  overflow: hidden;
}

.login-avatar-large .material-icons {
  font-size: 40px;
}

.login-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Special avatar (for custom users like yanisbboy@gmail.com) */
.special-avatar {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
  color: white;
}

[data-theme="dark"] .special-avatar {
  background: linear-gradient(135deg, #ffb86b 0%, #3b82f6 100%);
}

.login-popup-body h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-popup-body p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-google:hover {
  background: var(--bg-primary);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.login-popup-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border-color);
}

/* Popup Accounts Section */
.popup-accounts-section {
  text-align: left;
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.popup-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
}

.popup-accounts-list::-webkit-scrollbar {
  width: 10px;
}

.popup-accounts-list::-webkit-scrollbar-track {
  background: transparent;
}

.popup-accounts-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.12));
  border-radius: 999px;
}

.popup-account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: var(--shadow-sm);
}

.popup-account-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  background: var(--bg-elevated);
}

.popup-account-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.04));
  border-color: var(--accent-color);
  box-shadow: var(--shadow-glow);
}

.popup-account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

.popup-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popup-account-avatar .material-icons {
  font-size: 20px;
}

.popup-account-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popup-account-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-account-email {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-account-check {
  color: var(--success);
  font-size: 18px;
  flex-shrink: 0;
}

[data-theme="dark"] .popup-account-item {
  background: var(--bg-elevated);
}

[data-theme="dark"] .popup-account-item:hover {
  background: rgba(88, 166, 255, 0.1);
}

/* STATISTICS PAGE */
.date-filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 16px;
  border: 1px solid transparent;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.filter-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Dark mode specific tweak for better contrast */
[data-theme="dark"] .filter-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-tertiary);
}

[data-theme="dark"] .filter-btn.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.stat-card-lg {
  position: relative;
}

.stat-trend {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 12px;
  position: absolute;
  top: 12px;
  right: 12px;
}

.stat-trend.positive {
  background: #e6f4ea;
  color: var(--success);
}

.stat-trend.negative {
  background: #fce8e6;
  color: var(--error);
}

.stat-rate {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* CHARTS */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.chart-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.chart-container {
  height: 300px;
  position: relative;
  min-height: 250px;
}

#performance-pie-chart {
  height: 300px !important;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* STATS TABLE */
.stats-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.stats-table th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-primary);
}

.stats-table tbody tr:hover {
  background: var(--bg-primary);
}

.rate-badge {
  display: inline-block;
  padding: 4px 10px;
  background: #e8f0fe;
  color: var(--accent-color);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* SIDEBAR PROFILE SECTION */
.sidebar-profile {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  position: relative;
}

.sidebar-profile-card {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(26, 115, 232, 0.08) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar-profile-card:hover {
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.1) 0%, rgba(26, 115, 232, 0.15) 100%);
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.sidebar-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar update animation */
.sidebar-profile-avatar .avatar-img {
  transition: transform 260ms ease, opacity 260ms ease;
  opacity: 1;
  transform: scale(1);
}

.sidebar-profile-avatar .avatar-img.updating {
  opacity: 0;
  transform: scale(0.92);
}

.sidebar-profile-info {
  flex: 1;
  min-width: 0;
}

.sidebar-profile-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.sidebar-profile-email {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.sidebar-profile-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-profile-sent {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sidebar-profile-sent .material-icons {
  color: var(--accent-color);
}

.sidebar-profile-expand {
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.sidebar-profile-card.expanded .sidebar-profile-expand {
  transform: rotate(180deg);
}

/* Compact profile card variants (keeps original available) */
.sidebar-profile-card.compact {
  background: transparent;
  border: none;
  padding: 8px 10px;
  box-shadow: none;
}

.sidebar-profile-header.compact-header {
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
}

.sidebar-dropdown-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-dropdown-btn:hover {
  background: var(--bg-primary);
}

.sidebar-profile-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 8px 0;
}

.sidebar-profile-email {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 200ms ease, transform 200ms ease;
}

.sidebar-profile-email.updating {
  opacity: 0;
  transform: translateY(-4px);
}

.sidebar-profile-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 200ms ease, transform 200ms ease;
}

.sidebar-profile-name.updating {
  opacity: 0;
  transform: translateY(-4px);
}

.sidebar-quota-section.compact-quota {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  border-top: none;
}

.sidebar-quota-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.sidebar-quota-bar.small {
  height: 6px;
  width: 100%;
  background: var(--bg-primary);
  border-radius: 999px;
  overflow: hidden;
}

.sidebar-quota-values {
  display: flex;
  gap: 4px;
  align-items: baseline;
  font-weight: 700;
  font-size: 12px;
  color: #ec4899;
  text-shadow: 0 0 10px rgba(236, 72, 153, 0.8), 0 0 20px rgba(236, 72, 153, 0.6);
}

.sidebar-sent-today.compact {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  font-size: 12px;
  color: #ec4899;
  text-shadow: 0 0 10px rgba(236, 72, 153, 0.8), 0 0 20px rgba(236, 72, 153, 0.6);
  white-space: nowrap;
}

.sidebar-sent-today.compact .material-icons {
  font-size: 16px;
}

.sidebar-quota-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-quota-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.sidebar-quota-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--success) 0%, var(--success) 60%, var(--warning) 85%, var(--error) 100%);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.sidebar-quota-text {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
}

.sidebar-quota-text span:first-child {
  font-weight: 700;
  color: var(--accent-color);
}

/* Account Switcher Dropdown */
.sidebar-accounts-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dropdown opening downwards (default) */
.sidebar-accounts-dropdown.open-down {
  animation: slideDown 0.2s ease;
  top: 100%;
  bottom: auto;
  margin-top: 12px;
  margin-bottom: 0;
}

/* Dropdown opening upwards */
.sidebar-accounts-dropdown.open-up {
  animation: slideUp 0.2s ease;
  bottom: 100%;
  top: auto;
  margin-bottom: 12px;
  margin-top: 0;
}

.sidebar-accounts-list {
  max-height: 240px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.sidebar-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--transition);
  margin: 6px 8px;
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.sidebar-account-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: var(--bg-primary);
}

.sidebar-account-item.active {
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  overflow: hidden;
}

.sidebar-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-account-info {
  flex: 1;
  min-width: 0;
}

.sidebar-account-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-email {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollbar aesthetics */
.sidebar-accounts-list::-webkit-scrollbar {
  width: 8px;
}

.sidebar-accounts-list::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 8px;
}

.sidebar-accounts-list::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 8px;
}

.sidebar-accounts-list::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.45);
}

/* Font rendering improvements */
.sidebar,
.sidebar * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] .sidebar-account-item {
  background: var(--bg-elevated);
}

[data-theme="dark"] .sidebar-account-item:hover {
  background: var(--bg-surface);
}

.sidebar-account-check {
  color: var(--success);
  font-size: 18px;
}

.sidebar-add-account-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border: none;
  background: var(--bg-primary);
  color: var(--accent-color);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-add-account-btn:hover {
  background: rgba(26, 115, 232, 0.1);
}

.sidebar-add-account-btn .material-icons {
  font-size: 18px;
}

/* Dark Mode for Sidebar Profile */
[data-theme="dark"] .sidebar-profile-card {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(88, 166, 255, 0.08) 100%);
}

[data-theme="dark"] .sidebar-profile-card:hover {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1) 0%, rgba(88, 166, 255, 0.15) 100%);
}

[data-theme="dark"] .sidebar-profile-avatar {
  background: var(--gradient-accent);
}

[data-theme="dark"] .sidebar-quota-section {
  border-top-color: rgba(255, 255, 255, 0.05);
}

@media (max-width: 900px) {
  .sidebar {
    width: 80px;
  }

  .sidebar .logo span:not(.material-icons),
  .sidebar .nav-item span:not(.material-icons):not(.nav-badge) {
    display: none;
  }

  .nav-group-header {
    display: none;
  }

  .nav-mode-toggle {
    display: none;
  }

  .nav-group.collapsed .nav-group-items {
    max-height: 300px;
    opacity: 1;
  }

  .nav-separator {
    margin: 6px 10px;
  }

  .main-content {
    padding: 20px;
  }

  .quick-campaign-section .form-row {
    grid-template-columns: 1fr;
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  .date-filter-group {
    flex-wrap: wrap;
  }

  .sidebar-profile-info,
  .sidebar-profile-expand,
  .sidebar-quota-section,
  .sidebar-accounts-dropdown {
    display: none;
  }

  .sidebar-profile-card {
    padding: 10px;
    justify-content: center;
  }

  .sidebar-profile-header {
    justify-content: center;
  }
}

/* PREMIUM SIDEBAR OVERRIDE */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  background: var(--glass-bg) !important;
  backdrop-filter: var(--backdrop-blur);
  border-right: 1px solid var(--glass-border) !important;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sidebar {
  background: var(--glass-bg) !important;
  border-right: 1px solid var(--glass-border) !important;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
}

/* Ensure navigation items look premium */
.nav-item {
  border-radius: 8px;
  margin-bottom: 2px;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  background: var(--accent-gradient) !important;
  box-shadow: 0 4px 12px var(--accent-glow);
  color: white !important;
  border-left: none !important;
  /* Remove old border if any */
}

.nav-item.active .material-icons {
  color: white !important;
}

/* Nav group premium styling */
[data-theme="dark"] .nav-group-label {
  color: var(--accent-color, #818cf8);
  opacity: 0.75;
}

[data-theme="dark"] .nav-group-header:hover .nav-group-label {
  opacity: 1;
}

[data-theme="dark"] .nav-group-chevron {
  color: var(--accent-color, #818cf8);
  opacity: 0.5;
}

[data-theme="dark"] .nav-group-header:hover .nav-group-chevron {
  opacity: 0.9;
}

[data-theme="dark"] .nav-group-header:hover {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .nav-separator {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-quota-section {
  background: var(--bg-surface);
}

[data-theme="dark"] .sidebar-quota-section.compact-quota {
  background: transparent !important;
  border-top: none !important;
}

.usage-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
  color: var(--text-primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  font-weight: 600;
  font-size: 12px;
}

[data-theme="dark"] .usage-badge {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.15) 0%, rgba(236, 72, 153, 0.15) 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.usage-badge .value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .usage-badge .value {
  background: #0b1220;
}

.usage-badge .sep {
  color: var(--text-secondary);
}

.usage-badge .label {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Profile Settings Layout */
.profile-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* Profile Account Selector */
#profile-accounts-selector {
  max-height: 300px;
  overflow-y: auto;
}

.profile-account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.profile-account-item:hover {
  background: var(--accent-glow);
  border-color: var(--accent-color);
}

.profile-account-item.active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.profile-account-item.active .material-icons {
  color: white;
}

.profile-account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  font-size: 20px;
  overflow: hidden;
}

.profile-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-account-info {
  flex: 1;
  min-width: 0;
}

.profile-account-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-account-email {
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-account-item.active .profile-account-email {
  opacity: 0.9;
}

.profile-card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-header-large {
  margin-bottom: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-avatar-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.profile-avatar-large {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-tertiary);
  border: 4px solid var(--bg-surface);
  box-shadow: 0 0 0 2px var(--border-color);
  overflow: hidden;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-avatar-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-color);
  color: white;
  border: 4px solid var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: var(--shadow);
}

.edit-avatar-btn:hover {
  transform: scale(1.1);
}

.edit-avatar-btn .material-icons {
  font-size: 16px;
}

.profile-info-display h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-info-display p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.profile-badge-pro {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-color);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.profile-form {
  width: 100%;
  max-width: 100%;
  text-align: left;
}

.profile-stats-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Quota Visualizer */
.quota-visualizer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.quota-visualizer-card h3 {
  font-size: 14px;
  margin-bottom: 20px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quota-circle-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 24px;
}

.quota-circle {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: var(--bg-primary);
  stroke-width: 2.5;
}

.circle-progress {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.quota-text-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
}

.quota-text-center span {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
}

.quota-text-center small {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.quota-details {
  display: flex;
  justify-content: space-around;
  font-size: 13px;
}

.quota-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.sent {
  background: var(--accent-color);
}

.dot.remaining {
  background: var(--bg-primary);
}

.mini-stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.mini-stat-row:last-child {
  border-bottom: none;
}

.mini-stat-row .material-icons {
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.1);
  padding: 8px;
  border-radius: 8px;
}

[data-theme="dark"] .profile-avatar-large {
  background: var(--bg-elevated);
  border-color: var(--bg-surface);
}

/* Automation Builder Styles */
.automation-step-card {
  background: var(--bg-primary);
  transition: all 0.2s ease;
}

.automation-step-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Email Cleaner Results */
.cleaner-results {
  margin-top: 24px;
  animation: slideDown 0.3s ease;
}

.cleaner-shell {
  padding: 0;
}

.cleaner-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 22px 0 18px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.cleaner-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cleaner-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cleaner-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #ec4899 100%);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.22);
}

.cleaner-subtitle {
  margin: 6px 0 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.cleaner-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cleaner-autosave {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.10);
  color: var(--accent-color);
  border: 1px solid rgba(99, 102, 241, 0.20);
  min-width: 70px;
}

.cleaner-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 980px) {
  .cleaner-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.cleaner-card {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

[data-theme="light"] .cleaner-card {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.06);
}

.cleaner-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.cleaner-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.cleaner-card-desc {
  margin: 6px 0 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cleaner-editor-wrap {
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.cleaner-editor {
  width: 100%;
  min-height: 260px;
  max-height: 48vh;
  padding: 14px 14px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
}

.cleaner-editor::placeholder {
  color: var(--text-tertiary);
}

.cleaner-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

@media (min-width: 520px) {
  .cleaner-options {
    grid-template-columns: 1fr 1fr;
  }
}

.cleaner-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.18s ease;
}

[data-theme="light"] .cleaner-toggle {
  background: rgba(255, 255, 255, 0.8);
}

.cleaner-toggle:hover {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.10);
  transform: translateY(-1px);
}

.cleaner-toggle input {
  display: none;
}

.cleaner-toggle-ui {
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.cleaner-toggle-ui::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--bg-surface);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  transition: all 0.2s ease;
}

.cleaner-toggle input:checked + .cleaner-toggle-ui {
  background: rgba(99, 102, 241, 0.40);
  border-color: rgba(99, 102, 241, 0.45);
}

.cleaner-toggle input:checked + .cleaner-toggle-ui::after {
  left: 17px;
  background: white;
}

.cleaner-toggle-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.cleaner-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.cleaner-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.cleaner-meta-item .material-icons {
  font-size: 18px;
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.12);
  padding: 6px;
  border-radius: 10px;
}

.cleaner-results-head {
  margin-bottom: 16px;
}

.cleaner-results-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cleaner-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

@media (min-width: 520px) {
  .cleaner-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

.cleaner-stat {
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .cleaner-stat {
  background: rgba(255, 255, 255, 0.85);
}

.cleaner-stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
}

.cleaner-stat-value.ok {
  color: #22c55e;
}

.cleaner-stat-value.bad {
  color: #ef4444;
}

.cleaner-stat-value.warn {
  color: #f59e0b;
}

.cleaner-stat-label {
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
  font-weight: 700;
}

.cleaner-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 980px) {
  .cleaner-split {
    grid-template-columns: 1fr;
  }
}

.cleaner-pane {
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  overflow: hidden;
}

.cleaner-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
}

.cleaner-pane-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}

.cleaner-pane-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cleaner-muted {
  font-size: 12px;
  color: var(--text-secondary);
}

.cleaner-output {
  width: 100%;
  min-height: 200px;
  padding: 12px 12px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
}

/* Modal Overlay */
.modal {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  width: auto;
  position: relative;
  max-height: 85vh;
  border-radius: 12px;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 90%;
  min-width: 280px;
  max-width: 450px;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-primary);
  color: var(--error);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  color: var(--text-primary);
  font-size: 14px;
}

/* Automations List */
.automations-list {
  display: grid;
  gap: 12px;
}

.automations-list .card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.automations-list .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Premium Automation UI */
.section-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
  font-weight: 400;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
  font-weight: 400;
}

.section-description-small {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
}

.section-header-with-desc {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.section-header-with-desc h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 10px;
  margin-left: 6px;
  cursor: help;
  position: relative;
  transition: all 0.2s ease;
}

.tooltip-icon:hover {
  background: var(--accent-color);
  color: white;
  transform: scale(1.05);
}

.tooltip-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  margin-bottom: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.automation-card-premium {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.automation-card-premium:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  border-color: var(--accent-color);
}

.automation-card-main h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.automation-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.automation-meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.automation-meta .material-icons {
  font-size: 16px;
}

.automation-meta .dot-sep {
  color: var(--border-color);
}

.automation-card-actions {
  display: flex;
  gap: 8px;
}

.automation-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.automation-status-badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.automation-status-badge.inactive {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
}

.automation-status-badge .material-icons {
  font-size: 14px;
}

.btn-compact {
  padding: 8px 12px;
  font-size: 13px;
  min-width: auto;
}

.btn-compact .material-icons {
  font-size: 18px;
}

.premium-input,
.premium-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  width: 100%;
}

.premium-input:focus,
.premium-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.premium-input:hover,
.premium-select:hover {
  border-color: var(--accent-color);
}

.automation-modal-content {
  max-width: 800px;
  max-height: 90vh;
}

.automation-modal-body {
  max-height: calc(90vh - 140px);
  overflow-y: auto;
  padding: 24px;
}

.automation-steps-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.automation-steps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.premium-step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.premium-step-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.step-number-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-number-badge .material-icons {
  font-size: 18px;
  color: var(--accent-color);
}

.remove-step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.remove-step-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  transform: scale(1.05);
}

.remove-step-btn .material-icons {
  font-size: 20px;
}

.step-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .step-content-grid {
    grid-template-columns: 1fr;
  }
}

.step-label {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-selector-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.time-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-input-wrapper .premium-input {
  text-align: center;
  padding: 10px 8px;
  font-weight: 600;
}

.time-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-template-section {
  margin-top: 16px;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  align-items: center;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Step UI */
.automation-step-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.automation-step-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.automation-step-card .material-icons {
  cursor: pointer;
  transition: all 0.2s;
}

.automation-step-card .material-icons:hover {
  color: var(--error);
  transform: scale(1.1);
}

/* Profile Management Sections */
.profile-layout-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-top: 20px;
}

@media (max-width: 1200px) {
  .profile-layout-grid {
    grid-template-columns: 1fr;
  }
}

.profile-card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.profile-header-large {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.profile-avatar-wrapper {
  position: relative;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  overflow: hidden;
  border: 2px solid var(--accent-color);
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-avatar-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.edit-avatar-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.profile-info-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-info-display h2 {
  margin: 0;
  font-size: 16px;
  margin-bottom: 4px;
}

.profile-info-display p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
}

.profile-badge-pro {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  width: fit-content;
}

.profile-form {
  margin-bottom: 24px;
}

.profile-form .form-group {
  margin-bottom: 16px;
}

.danger-zone {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 16px;
}

.factory-reset-card {
  position: relative;
  overflow: hidden;
}

.factory-reset-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.12) 0,
    rgba(239, 68, 68, 0.12) 8px,
    transparent 8px,
    transparent 16px
  );
  opacity: 0.35;
  pointer-events: none;
}

.factory-reset-card > * {
  position: relative;
  z-index: 1;
}

.factory-reset-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.factory-reset-btn {
  width: 100%;
  height: 56px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 14px;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.factory-reset-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 14px 32px rgba(239, 68, 68, 0.3);
}

.factory-reset-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.24);
}

.factory-reset-subtext {
  display: block;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 2px;
}

.factory-reset-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.factory-reset-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.4;
}

.settings-tabs-compact {
  max-width: 980px;
  margin: 0 auto;
}

.settings-tabs-compact .tabs-nav {
  gap: 6px;
  flex-wrap: wrap;
}

.settings-tabs-compact .tab-button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.settings-section-title {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-compact-panel {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 14px;
}

.settings-compact-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
}

.settings-compact-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* Plan Info Display in Settings */
.plan-info-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 680px) {
  .plan-info-grid {
    grid-template-columns: 1fr;
  }
}

.plan-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  min-height: 140px;
}

.plan-badge {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
  margin-bottom: 8px;
}

.plan-info-card .plan-price {
  font-size: 28px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}

.plan-info-card .plan-price span {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  display: block;
}

.plan-info-card .plan-description {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 8px;
}

.plan-info-card .plan-view-btn {
  margin-top: 12px;
  padding: 6px 12px;
  background: white;
  color: var(--brand-primary);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.plan-info-card .plan-view-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

.plan-quotas {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quota-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quota-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.quota-value {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.quota-bar {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, #14b8a6 0%, #0ea5e9 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.quota-bar.warning .quota-fill {
  background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%);
}

.quota-warning {
  display: none;
  padding: 12px;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-primary);
  gap: 8px;
  align-items: flex-start;
}

.quota-warning.show {
  display: flex;
}

.quota-warning-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.quota-warning-text {
  flex: 1;
}

.theme-pill-grid {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theme-pill-grid .theme-preset-card {
  margin: 0;
  padding: 5px 10px;
  min-height: 32px;
  border-radius: 999px;
  border-width: 1px;
  border-color: var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
}

.theme-pill-grid .theme-preset-card:hover {
  transform: none;
  box-shadow: 0 0 0 1px var(--accent-color);
}

.theme-pill-grid .theme-preset-card.active {
  border-color: var(--accent-color);
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.theme-pill-grid .theme-preset-card .active-badge {
  display: none;
  margin-left: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-color);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
}

.theme-pill-grid .theme-preset-card.active .active-badge {
  display: inline-flex;
}

.settings-inline-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.current-theme-info.compact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.current-theme-info.compact .material-icons {
  font-size: 16px;
}

.settings-mini-btn {
  min-height: 32px;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
}

.settings-toggle-row {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-toggle-row strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
}

.settings-toggle-row p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.settings-field-row {
  margin-top: 12px;
}

.settings-number-inline {
  display: grid;
  grid-template-columns: minmax(0, 180px) auto;
  align-items: center;
  gap: 8px;
}

.settings-number-inline span {
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-muted-note {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.settings-actions-right {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.support-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.support-mini-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.support-mini-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
}

.support-mini-item .material-icons {
  font-size: 16px;
  color: var(--text-secondary);
}

.support-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.support-form-card #support-form-container {
  margin-top: 10px;
}

.support-form-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.settings-toggle-list-compact {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compliance-stack {
  display: grid;
  gap: 12px;
}

.compliance-panel {
  padding: 16px;
}

.compliance-block-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compliance-row {
  margin-top: 0;
  padding: 11px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compliance-row-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.compliance-row-icon {
  font-size: 18px;
  color: var(--accent-color);
  margin-top: 1px;
  flex-shrink: 0;
}

.compliance-row strong {
  display: block;
  font-size: 12px;
  color: var(--text-primary);
}

.compliance-row p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.compliance-note {
  margin-top: 10px;
}

.compliance-note code {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text-primary);
}

.legal-document-compact h1 {
  font-size: 20px;
  margin-bottom: 6px;
}

.legal-compact-subtext {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legal-cards-grid-compact {
  gap: 10px;
}

.legal-cards-grid-compact .legal-card {
  padding: 12px;
  min-height: 92px;
}

.legal-cards-grid-compact .legal-card-content h3 {
  font-size: 14px;
  margin-bottom: 3px;
}

.legal-cards-grid-compact .legal-card-content p {
  font-size: 12px;
  line-height: 1.4;
}

.sticky-footer-compact {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sticky-footer-compact .btn {
  min-height: 32px;
  padding: 6px 12px;
}

@media (max-width: 920px) {
  .support-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .settings-inline-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-number-inline {
    grid-template-columns: 1fr;
  }

  .settings-toggle-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .compliance-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .support-form-actions,
  .settings-actions-right {
    justify-content: stretch;
  }

  .support-form-actions .btn,
  .settings-actions-right .btn {
    width: 100%;
    justify-content: center;
  }
}

.settings-notion-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.85fr);
  gap: 8px 14px;
  align-items: start;
  max-width: 880px;
  margin: 0 auto;
}

.settings-notion-header,
.settings-notion-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.settings-notion-header {
  grid-column: 1 / -1;
}

.settings-notion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-notion-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-notion-avatar-wrap {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.settings-notion-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-notion-account-copy {
  min-width: 0;
}

.settings-notion-label {
  margin: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 700;
}

.settings-notion-name {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--text-primary);
}

.settings-notion-email {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-notion-logout-btn {
  flex-shrink: 0;
  border-radius: 7px;
  min-height: 32px;
  padding: 6px 10px;
}

.settings-notion-section-head h4 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
}

.settings-notion-section-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.settings-notion-form-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.settings-notion-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-notion-field span {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 600;
}

.settings-notion-avatar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.settings-notion-field .input-field {
  min-height: 34px;
  padding: 7px 10px;
}

.settings-notion-upload-btn {
  min-width: 88px;
  border-radius: 7px;
  min-height: 32px;
  padding: 6px 10px;
  flex-shrink: 0;
}

.settings-notion-preview-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.settings-notion-preview-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.settings-notion-preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-notion-preview-copy strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
}

.settings-notion-preview-copy p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-notion-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.settings-notion-save-btn {
  border-radius: 7px;
  min-height: 32px;
  padding: 6px 10px;
}

.settings-notion-profile {
  grid-column: 1;
}

.settings-notion-intro {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.settings-save-feedback {
  min-height: 18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-align: right;
}

.settings-save-feedback.is-saving {
  color: #0f766e;
}

.settings-save-feedback.is-success {
  color: #166534;
}

.settings-save-feedback.is-error {
  color: #b91c1c;
}

.settings-notion-divider {
  grid-column: 1 / -1;
  height: 1px;
  margin: 2px 0 0;
  background: linear-gradient(90deg, transparent 0%, rgba(239, 68, 68, 0.32) 28%, rgba(239, 68, 68, 0.32) 72%, transparent 100%);
}

.settings-notion-danger {
  grid-column: 1 / -1;
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.03);
  padding: 10px 12px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.settings-notion-reset-btn {
  margin-top: 8px;
  width: auto;
  justify-content: center;
  border: 1px solid #ef4444;
  color: #b91c1c;
  background: #ffffff;
  border-radius: 6px;
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.settings-notion-reset-btn:hover {
  background: #fff5f5;
  border-color: #dc2626;
  color: #991b1b;
}

.settings-notion-danger-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

@media (max-width: 860px) {
  .settings-notion-shell {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings-notion-header {
    grid-column: 1;
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-notion-profile,
  .settings-notion-danger {
    grid-column: 1;
  }

  .settings-notion-intro {
    grid-column: 1;
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-save-feedback {
    text-align: left;
  }

  .settings-notion-logout-btn {
    width: 100%;
    justify-content: center;
  }

  .settings-notion-form-grid {
    grid-template-columns: 1fr;
  }

  .settings-notion-avatar-row {
    grid-template-columns: 1fr;
  }

  .settings-notion-upload-btn {
    width: 100%;
  }

  .settings-notion-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

.settings-saas-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-saas-shell > * {
  animation: settings-premium-rise 0.44s ease both;
}

.settings-saas-shell > *:nth-child(2) {
  animation-delay: 0.06s;
}

.settings-saas-shell > *:nth-child(3) {
  animation-delay: 0.12s;
}

@keyframes settings-premium-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-saas-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.settings-premium-hero {
  background:
    radial-gradient(circle at 86% -8%, rgba(251, 146, 60, 0.23) 0%, transparent 37%),
    radial-gradient(circle at -8% 90%, rgba(20, 184, 166, 0.2) 0%, transparent 40%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.03), transparent 62%),
    var(--bg-surface);
}

.settings-premium-hero-bg {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(120deg, rgba(148, 163, 184, 0.06) 0 12px, transparent 12px 24px);
  opacity: 0.25;
  pointer-events: none;
}

.settings-saas-account {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.settings-premium-avatar-wrap {
  padding: 2px;
  border-radius: 16px;
  background: linear-gradient(145deg, #06b6d4 0%, #14b8a6 52%, #f59e0b 100%);
  box-shadow: 0 10px 22px rgba(14, 165, 233, 0.18);
}

.settings-saas-avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-shrink: 0;
}

.settings-premium-avatar {
  border: 2px solid rgba(255, 255, 255, 0.75);
}

[data-theme="dark"] .settings-premium-avatar {
  border-color: rgba(15, 23, 42, 0.8);
}

.settings-saas-eyebrow {
  margin: 0 0 2px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 700;
}

.settings-saas-name {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-saas-email {
  margin: 2px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-premium-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.settings-premium-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #0f766e;
  border: 1px solid rgba(20, 184, 166, 0.35);
  background: rgba(20, 184, 166, 0.14);
}

.settings-premium-pill .material-icons {
  font-size: 14px;
}

.settings-premium-pill-muted {
  color: var(--text-secondary);
  border-color: var(--border-color);
  background: var(--bg-primary);
}

.settings-premium-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.settings-premium-score {
  min-width: 180px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  padding: 10px 12px;
}

.settings-premium-score small {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  font-weight: 600;
}

.settings-premium-score strong {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 23px;
  line-height: 1;
  color: var(--text-primary);
}

.settings-premium-score strong span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.settings-premium-score-bar {
  margin-top: 8px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.settings-premium-score-bar span {
  display: block;
  height: 100%;
  width: calc(var(--security-score, 90) * 1%);
  border-radius: inherit;
  background: linear-gradient(90deg, #06b6d4 0%, #10b981 58%, #f59e0b 100%);
}

.settings-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 11px;
  flex-shrink: 0;
}

.settings-logout-btn .material-icons {
  font-size: 18px;
}

.settings-saas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 16px;
}

.settings-card {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.settings-profile-card {
  background:
    linear-gradient(180deg, rgba(14, 165, 233, 0.04) 0%, transparent 35%),
    var(--bg-surface);
}

.settings-card-head {
  margin-bottom: 16px;
}

.settings-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.settings-card-subtitle {
  margin: 4px 0 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.settings-premium-preview {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  margin-bottom: 13px;
}

.settings-premium-preview-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #06b6d4, #10b981);
  color: #ffffff;
  overflow: hidden;
  flex-shrink: 0;
}

.settings-premium-preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-premium-preview-avatar .material-icons {
  font-size: 18px;
}

.settings-premium-preview-copy strong {
  display: block;
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
}

.settings-premium-preview-copy p {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-avatar-input-row {
  display: flex;
  gap: 8px;
}

.settings-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
  padding: 0;
}

.settings-icon-btn .material-icons {
  font-size: 18px;
}

.settings-card-foot {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-save-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 10px;
  font-weight: 700;
}

.settings-save-btn .material-icons {
  font-size: 18px;
}

.settings-status-card {
  background:
    radial-gradient(circle at 95% -10%, rgba(14, 165, 233, 0.17) 0%, transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.03), transparent 35%),
    var(--bg-surface);
}

.settings-status-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-status-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
}

.settings-status-item .material-icons {
  font-size: 18px;
  color: var(--accent-color);
  margin-top: 1px;
}

.settings-status-item strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.settings-status-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.settings-trust-note {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.settings-trust-note .material-icons {
  font-size: 16px;
  color: #f59e0b;
  margin-top: 1px;
}

.settings-trust-note p {
  margin: 0;
}

.settings-reset-card {
  margin-top: 2px;
}

.settings-premium-danger {
  background:
    linear-gradient(180deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.02)),
    var(--bg-surface);
}

.settings-reset-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-reset-title .material-icons {
  color: #ef4444;
}

.settings-reset-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-reset-heading-row h3 {
  color: #ef4444;
  margin: 0;
  font-size: 15px;
}

.settings-reset-title p {
  margin: 4px 0 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-reset-body {
  margin-top: 14px;
}

@media (max-width: 1120px) {
  .settings-saas-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .settings-saas-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-premium-hero-actions {
    width: 100%;
    align-items: stretch;
  }

  .settings-premium-score {
    min-width: 0;
  }

  .settings-logout-btn {
    width: 100%;
    justify-content: center;
  }

  .settings-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .settings-avatar-input-row {
    flex-direction: column;
  }

  .settings-icon-btn {
    width: 100%;
  }

  .settings-save-btn {
    width: 100%;
  }
}

.billing-subtext {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 760px;
}

/* ── Billing Page Content ── */
.billing-page-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Current Plan Banner */
.billing-current-plan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(14, 165, 233, 0.06));
}
.billing-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.billing-banner-left > .material-icons {
  font-size: 28px;
  color: #14b8a6;
}
.billing-banner-left strong {
  font-size: 14px;
  color: var(--text-primary);
}
.billing-banner-left p {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.billing-banner-right {
  flex-shrink: 0;
}
.billing-usage-mini {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.billing-usage-mini strong {
  color: var(--text-primary);
}

/* Billing Period Toggle */
.billing-period-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  width: fit-content;
  margin: 0 auto;
}
.billing-period-btn {
  padding: 8px 20px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.billing-period-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.billing-save-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #0f766e;
  background: rgba(20, 184, 166, 0.16);
}

/* Plans Grid — 4 columns */
.billing-plans-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

/* Plan Card */
.billing-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 18px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-surface);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.billing-plan-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

/* Featured Plan (Pro) */
.billing-plan-featured {
  border-color: #14b8a6;
  box-shadow: 0 8px 28px rgba(20, 184, 166, 0.15);
  transform: scale(1.02);
  z-index: 1;
}
.billing-plan-featured:hover {
  box-shadow: 0 10px 32px rgba(20, 184, 166, 0.2);
}

/* Most Popular Badge */
.billing-plan-popular-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #14b8a6, #0ea5e9);
  white-space: nowrap;
}

/* Plan Header */
.billing-plan-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.billing-plan-title-icon {
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
}
.billing-plan-featured .billing-plan-title-icon {
  color: #14b8a6;
}
.billing-plan-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.billing-plan-tagline {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Plan Price */
.billing-plan-price {
  margin-top: 14px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.billing-plan-price strong {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.billing-plan-price span {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Annual Note */
.billing-plan-annual-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  min-height: 16px;
}

/* Value Line (Pro only) */
.billing-plan-value-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: #0f766e;
}
.billing-plan-value-line .material-icons {
  font-size: 14px;
}

/* Plan CTA */
.billing-plan-cta {
  margin-top: 14px;
  width: 100%;
  justify-content: center;
  font-weight: 600;
}
.billing-plan-no-cc {
  margin: 6px 0 0 0;
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

/* Plan Features List */
.billing-plan-features {
  margin: 14px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.billing-plan-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.35;
}
.billing-plan-features li .material-icons {
  font-size: 15px;
  color: #14b8a6;
  flex-shrink: 0;
}
.billing-plan-features li strong {
  font-weight: 700;
}

/* Locked features (Free plan) */
.billing-feature-locked {
  opacity: 0.5;
}
.billing-feature-locked .material-icons {
  color: var(--text-secondary) !important;
  font-size: 14px !important;
}

/* Highlighted features */
.billing-feature-highlight {
  background: rgba(20, 184, 166, 0.06);
  margin: 0 -8px;
  padding: 4px 8px;
  border-radius: 6px;
}

/* Extra seat note */
.billing-plan-extra-seat {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Value Section ── */
.billing-value-section {
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-surface);
}
.billing-value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.billing-value-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
}
.billing-value-item > .material-icons {
  font-size: 20px;
  color: #14b8a6;
  flex-shrink: 0;
}
.billing-value-item strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
}
.billing-value-item span {
  font-size: 11px;
  color: var(--text-secondary);
}
.billing-value-total {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(14, 165, 233, 0.06));
}
.billing-value-total span {
  font-size: 14px;
  color: var(--text-secondary);
}
.billing-value-total s {
  color: var(--text-secondary);
}
.billing-value-total strong {
  font-size: 18px;
  color: #0f766e;
}

/* ── Comparison Table ── */
.billing-comparison-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.billing-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.billing-comparison-table th,
.billing-comparison-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}
.billing-comparison-table th:first-child,
.billing-comparison-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
}
.billing-comparison-table thead th {
  font-weight: 700;
  font-size: 13px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}
.billing-col-featured {
  background: rgba(20, 184, 166, 0.05);
}
.billing-icon-yes {
  font-size: 16px !important;
  color: #14b8a6;
}
.billing-icon-no {
  font-size: 16px !important;
  color: var(--text-secondary);
  opacity: 0.4;
}

/* ── Trust Bar ── */
.billing-trust-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 14px 0;
  flex-wrap: wrap;
}
.billing-trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.billing-trust-item .material-icons {
  font-size: 16px;
  color: #14b8a6;
}

/* ── Admin Section ── */
.billing-admin-section {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}
.billing-admin-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  list-style: none;
}
.billing-admin-toggle::-webkit-details-marker { display: none; }
.billing-admin-toggle .material-icons { font-size: 18px; }
.billing-admin-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}
.billing-admin-section[open] .billing-admin-chevron {
  transform: rotate(180deg);
}
.billing-admin-content {
  padding: 0 16px 16px;
}

/* Keep existing shared styles */
.billing-shell,
.affiliate-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.billing-card,
.affiliate-card {
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.affiliate-highlight {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at 8% -20%, rgba(14, 165, 233, 0.18), transparent 36%),
    radial-gradient(circle at 96% 110%, rgba(16, 185, 129, 0.18), transparent 40%),
    var(--bg-surface);
}

.billing-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.billing-card-head h3 {
  margin: 0;
  font-size: 17px;
  color: var(--text-primary);
}

.billing-card-head p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.billing-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.billing-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.billing-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.billing-actions-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.affiliate-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.affiliate-kpi {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
}

.affiliate-kpi span {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.affiliate-kpi strong {
  font-size: 20px;
  color: var(--text-primary);
}

.affiliate-invite-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.affiliate-invites-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.affiliate-empty {
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.affiliate-invite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  padding: 10px 12px;
}

.affiliate-invite-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
}

.affiliate-invite-item p {
  margin: 2px 0 0 0;
  color: var(--text-secondary);
  font-size: 11px;
}

.affiliate-invite-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.affiliate-toggle-qualified {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.affiliate-toggle-qualified .material-icons,
.affiliate-remove-invite .material-icons {
  font-size: 16px;
}

.affiliate-note {
  margin-top: 12px;
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--bg-primary);
}

@media (max-width: 1400px) {
  .billing-plans-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .billing-plan-featured {
    grid-column: 1 / -1;
  }
  .billing-value-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .billing-shell,
  .affiliate-shell {
    grid-template-columns: 1fr;
  }
  .billing-plans-grid {
    grid-template-columns: 1fr;
  }
  .billing-plan-featured {
    transform: scale(1);
    grid-column: 1;
  }
  .billing-comparison-table {
    font-size: 12px;
  }
  .billing-comparison-table th,
  .billing-comparison-table td {
    padding: 6px 8px;
  }
}

@media (max-width: 860px) {
  .billing-period-toggle {
    width: 100%;
    justify-content: center;
  }
  .billing-trust-bar {
    gap: 14px;
    flex-direction: column;
    text-align: center;
  }
  .billing-value-grid {
    grid-template-columns: 1fr;
  }
  .affiliate-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-form-grid {
    grid-template-columns: 1fr;
  }

  .billing-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .affiliate-invite-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .billing-current-plan-banner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .billing-banner-right {
    width: 100%;
  }
  .billing-usage-mini {
    flex-direction: column;
  }
  .billing-comparison-wrap {
    font-size: 11px;
  }
  .billing-comparison-table th,
  .billing-comparison-table td {
    padding: 4px 6px;
  }
  .affiliate-kpi-grid {
    grid-template-columns: 1fr;
  }

  .affiliate-invite-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .affiliate-invite-actions {
    width: 100%;
  }

  .affiliate-toggle-qualified,
  .affiliate-remove-invite {
    width: 100%;
    justify-content: center;
  }
}

.profile-stats-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quota-visualizer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

.quota-visualizer-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.quota-circle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.quota-circle {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}

.quota-circle .circle-bg {
  fill: none;
  stroke: var(--bg-primary);
  stroke-width: 2;
}

.quota-circle .circle-progress {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}

.quota-text-center {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.quota-text-center span:first-child {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-color);
}

.quota-text-center small {
  font-size: 12px;
  color: var(--text-secondary);
}

.quota-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quota-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.quota-detail-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.quota-detail-item .dot.sent {
  background: var(--accent-color);
}

.quota-detail-item .dot.remaining {
  background: var(--success);
}

/* Dark Mode Overrides */
[data-theme="dark"] .modal-content {
  background: var(--bg-elevated);
}

[data-theme="dark"] .automation-step-card {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .automation-step-card:hover {
  border-color: var(--accent-color);
}

[data-theme="dark"] .profile-card-main {
  background: var(--bg-surface);
}

[data-theme="dark"] .quota-visualizer-card {
  background: var(--bg-surface);
}


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Styles */
#automation-builder-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

#automation-builder-modal .modal-content {
  background: var(--bg-surface);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

#automation-builder-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

#automation-builder-modal .modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

#automation-builder-modal .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

#automation-builder-modal .modal-close:hover {
  color: var(--error);
}

/* Automation step card styling */
.automation-step-card {
  background: var(--bg-primary);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.automation-step-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Automations list styling */
.automations-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.automations-list .card {
  transition: all 0.2s ease;
}

.automations-list .card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Sidebar Accounts Dropdown */
.sidebar-accounts-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  padding: 8px;
  margin-bottom: 8px;
  z-index: 100;
  display: none;
}

.sidebar-account-item:hover {
  background: var(--bg-elevated);
}



/* =====================================================
   CRITICAL: Modal/Popup Readability Fixes (Dark/Light)
   ===================================================== */

/* === LIGHT MODE: Modal & Popup Base Styles === */
.modal,
.modal-content,
.login-popup {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Light Mode: Modal Input Fields - CRITICAL FIX */
.modal .input-field,
.modal input,
.modal select,
.modal textarea,
.modal-overlay .input-field,
.modal-overlay input,
.modal-overlay select,
.modal-overlay textarea {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

.modal .input-field::placeholder,
.modal input::placeholder,
.modal textarea::placeholder,
.modal-overlay .input-field::placeholder,
.modal-overlay input::placeholder,
.modal-overlay textarea::placeholder {
  color: var(--text-tertiary) !important;
}

.modal .input-field:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus,
.modal-overlay .input-field:focus,
.modal-overlay input:focus,
.modal-overlay select:focus,
.modal-overlay textarea:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px var(--accent-subtle) !important;
  outline: none;
}

/* Light Mode: Modal Labels */
.modal .form-label,
.modal label,
.modal-overlay .form-label,
.modal-overlay label {
  color: var(--text-primary) !important;
}

.modal-header,
.login-popup-header {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

.modal-header,
.login-popup-header {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

.modal-header h2,
.modal-header h3,
.login-popup-header .login-logo {
  color: var(--text-primary);
}

.modal-body,
.login-popup-body {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.login-popup-body h2 {
  color: var(--text-primary);
}

.login-popup-body p {
  color: var(--text-secondary);
}

.modal-footer,
.login-popup-footer {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

.btn-google {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
}

/* Popup Accounts Section - Light Mode */
.popup-accounts-section h3 {
  color: var(--text-secondary);
}

.popup-account-item {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

.popup-account-item:hover {
  background: var(--bg-hover);
}

.popup-account-name {
  color: var(--text-primary);
}

.popup-account-email {
  color: var(--text-secondary);
}

/* === DARK MODE: Modal & Popup Contrast Overrides === */
[data-theme="dark"] .modal,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .login-popup {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Dark Mode: Modal Input Fields - CRITICAL FIX */
[data-theme="dark"] .modal .input-field,
[data-theme="dark"] .modal input,
[data-theme="dark"] .modal select,
[data-theme="dark"] .modal textarea,
[data-theme="dark"] .modal-overlay .input-field,
[data-theme="dark"] .modal-overlay input,
[data-theme="dark"] .modal-overlay select,
[data-theme="dark"] .modal-overlay textarea {
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .modal .input-field::placeholder,
[data-theme="dark"] .modal input::placeholder,
[data-theme="dark"] .modal textarea::placeholder,
[data-theme="dark"] .modal-overlay .input-field::placeholder,
[data-theme="dark"] .modal-overlay input::placeholder,
[data-theme="dark"] .modal-overlay textarea::placeholder {
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .modal .input-field:focus,
[data-theme="dark"] .modal input:focus,
[data-theme="dark"] .modal select:focus,
[data-theme="dark"] .modal textarea:focus,
[data-theme="dark"] .modal-overlay .input-field:focus,
[data-theme="dark"] .modal-overlay input:focus,
[data-theme="dark"] .modal-overlay select:focus,
[data-theme="dark"] .modal-overlay textarea:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px var(--accent-subtle) !important;
}

/* Dark Mode: Modal Labels */
[data-theme="dark"] .modal .form-label,
[data-theme="dark"] .modal label,
[data-theme="dark"] .modal-overlay .form-label,
[data-theme="dark"] .modal-overlay label {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .login-popup-header {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .modal-header h3,
[data-theme="dark"] .login-popup-header .login-logo {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-body,
[data-theme="dark"] .login-popup-body {
  background: var(--bg-surface);
  color: var(--text-primary);
}

[data-theme="dark"] .login-popup-body h2 {
  color: var(--text-primary);
}

[data-theme="dark"] .login-popup-body p {
  color: var(--text-secondary);
}

[data-theme="dark"] .modal-footer,
[data-theme="dark"] .login-popup-footer {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-google {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
}

/* Dark Mode: Popup Accounts Section */
[data-theme="dark"] .popup-accounts-section h3 {
  color: var(--text-secondary);
}

[data-theme="dark"] .popup-account-item {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .popup-account-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

[data-theme="dark"] .popup-account-item.active {
  background: var(--accent-subtle);
  border-color: var(--accent-color);
}

[data-theme="dark"] .popup-account-name {
  color: var(--text-primary);
}

[data-theme="dark"] .popup-account-email {
  color: var(--text-secondary);
}

/* Dark Mode: Modal Input Fields High Contrast */
[data-theme="dark"] .modal-body .input-field,
[data-theme="dark"] .modal-body select,
[data-theme="dark"] .modal-body textarea {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-body .input-field::placeholder,
[data-theme="dark"] .modal-body textarea::placeholder {
  color: var(--text-tertiary);
}

[data-theme="dark"] .modal-body .input-field:focus,
[data-theme="dark"] .modal-body select:focus,
[data-theme="dark"] .modal-body textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Dark Mode: Modal Labels & Text */
[data-theme="dark"] .modal-body .form-label {
  color: var(--text-primary);
}

[data-theme="dark"] .modal-body label {
  color: var(--text-primary);
}

/* Dark Mode: Secondary Buttons in Modals */
[data-theme="dark"] .modal-body .btn-secondary,
[data-theme="dark"] .modal-footer .btn-secondary,
[data-theme="dark"] .login-popup-footer .btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-body .btn-secondary:hover,
[data-theme="dark"] .modal-footer .btn-secondary:hover,
[data-theme="dark"] .login-popup-footer .btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

/* Dark Mode: Close Button */
[data-theme="dark"] .modal-close,
[data-theme="dark"] .login-close {
  color: var(--text-secondary);
}

[data-theme="dark"] .modal-close:hover,
[data-theme="dark"] .login-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Compact modal padding and pink glow overrides (override lower-priority rules) */
/* Slightly increase modal body padding for breathing room */
.modal-body,
.modal-content .modal-body {
  padding: 18px !important;
}

/* Pink glow on modal titles */
.modal-header h2,
.modal-header h3 {
  /* remove glow on popup text - keep clean title */
  text-shadow: none !important;
}

/* Pink glow around primary action button */
.modal-footer .btn-primary {
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.18), 0 0 10px rgba(236, 72, 153, 0.28);
  border: none;
}

.modal-footer .btn-primary:hover {
  box-shadow: 0 10px 30px rgba(236, 72, 153, 0.22), 0 0 18px rgba(236, 72, 153, 0.35);
  transform: translateY(-1px);
}

/* Ensure dark-mode doesn't reintroduce a slab behind footer */
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .login-popup-footer {
  background: transparent !important;
  border-color: transparent !important;
}

/* =====================================================
   Profile Section: Full-width Layout
   ===================================================== */

.profile-content-wrapper {
  width: 100%;
  margin: 0;
}

/* Ensure all profile content inside the wrapper inherits proper width */
.profile-content-wrapper>.section,
.profile-content-wrapper>.profile-layout-grid {
  width: 100%;
}

/* Make the profile layout grid stack vertically when constrained */
.profile-content-wrapper .profile-layout-grid {
  grid-template-columns: 1fr;
  gap: 20px;
}

/* =======================
   Modern Compact Modal Overrides
   High-specificity block to ensure consistent, modern spacing
   and appearance across variants (light/dark).
   ======================= */
.modal,
.modal-content {
  border-radius: 14px !important;
  overflow: hidden !important;
}

.modal {
  margin: 20px auto !important;
}

.modal-content {
  width: 92% !important;
  max-width: 720px !important;
  min-width: 300px !important;
  box-shadow: 0 12px 40px rgba(2, 6, 23, 0.45) !important;
  backdrop-filter: blur(6px) saturate(1.05) !important;
  /* subtle pink outline for the popup */
  border: 1px solid rgba(236, 72, 153, 0.10) !important;
}

.modal-header {
  padding: 18px 20px !important;
}

.modal-header h2,
.modal-header h3 {
  margin: 0 !important;
  font-size: 17px !important;
  font-weight: 700 !important;
}

.modal-body,
.modal-content .modal-body {
  padding: 20px !important;
}

.modal-footer,
.modal-content .modal-footer {
  padding: 14px 18px !important;
  gap: 10px !important;
}

/* Slight modern accent on all buttons in modals */
.modal-footer .btn,
.modal-content .modal-footer .btn {
  border-radius: 8px !important;
  padding: 9px 16px !important;
}

/* Make primary button glow subtly in pink, tuned for modern look */
.modal-footer .btn-primary,
.modal-content .modal-footer .btn-primary {
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.14), 0 0 8px rgba(236, 72, 153, 0.18) !important;
}

/* Keep footer transparent in dark to avoid slab */
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .modal-content .modal-footer {
  background: transparent !important;
}

/* =====================================================
   Mail Automation Empty State (Modern Premium)
   ===================================================== */
.empty-state-automations {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background: var(--bg-surface);
  border-radius: 12px;
  /* Optional: if you want it to look like part of the list container, 
     but usually empty states sit inside the section card or replace the list content. */
}

.empty-state-content {
  max-width: 500px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.4s ease;
}

.empty-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  position: relative;
}

.empty-icon-wrapper .material-icons {
  font-size: 40px;
  background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.empty-icon-wrapper::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  border: 1px dashed rgba(99, 102, 241, 0.3);
  animation: spin 10s linear infinite;
}

.empty-state-content h3 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.empty-state-content p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 32px 0;
  max-width: 420px;
}

.empty-state-features {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  justify-content: center;
}

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.feature-item .material-icons {
  font-size: 20px;
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.1);
  padding: 8px;
  border-radius: 8px;
}

.feature-item span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Dark Mode Adjustments */
[data-theme="dark"] .empty-state-automations {
  background: transparent;
  /* Assuming container has background */
}

[data-theme="dark"] .empty-icon-wrapper {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .empty-icon-wrapper::after {
  border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="dark"] .feature-item .material-icons {
  background: rgba(99, 102, 241, 0.2);
}

/* Campaigns Overview - Modern Card List Design */
.campaigns-list-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  border: none;
  overflow: visible;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.campaign-history-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  /* Icon | Info | Stats | Actions */
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.campaign-history-item:hover {
  background: var(--bg-surface);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}

.history-status-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.history-status-icon .material-icons {
  font-size: 18px;
}

.history-status-icon.pending {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}

.history-status-icon.running {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.history-status-icon.scheduled {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.history-status-icon.completed {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.history-status-icon.stopped {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.history-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.history-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.history-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-weight: 500;
}

.history-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.history-stat-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.history-stat-pill .material-icons {
  font-size: 14px;
  opacity: 0.8;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.history-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-btn .material-icons {
  font-size: 18px;
}

.history-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-color);
  transform: scale(1.05);
}

.history-btn.start:hover {
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
  border-color: transparent;
}

.history-btn.stop:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
  border-color: transparent;
}

/* Scrollbar styling for campaigns list */
.campaigns-list-history::-webkit-scrollbar {
  width: 6px;
}

.campaigns-list-history::-webkit-scrollbar-track {
  background: transparent;
}

.campaigns-list-history::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.campaigns-list-history::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Dark mode overrides */
[data-theme="dark"] .campaign-history-item {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .campaign-history-item:hover {
  background: var(--bg-surface);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .campaigns-list-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .campaigns-list-history::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   MODERN TEMPLATE BUILDER COMPONENTS (INTEGRATED)
   ========================================================================== */

/* Remove full-screen editor layout styles, using standard .section flow */

/* MODERN TOOLBAR & COMPONENTS */
.editor-toolbar-container {
  position: relative;
  z-index: 20;
}

.modern-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 8px;
  border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
  border-right: none;
}

.tool-btn-modern {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
}

.tool-btn-modern:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.tool-btn-modern.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-color);
}

.tool-btn-modern .material-icons {
  font-size: 18px;
}

.tool-select-modern {
  height: 28px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}

/* FIX DARK MODE SELECT VISIBILITY */
[data-theme="dark"] .tool-select-modern option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.tool-select-modern:hover {
  background: var(--bg-elevated);
}

.color-picker-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
}

.color-picker-wrapper:hover {
  background: var(--bg-elevated);
}

.color-picker-wrapper input[type="color"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* EDITOR CANVAS */
.editor-canvas-wrapper {
  position: relative;
}

.modern-editor-canvas {
  width: 100%;
  min-height: 400px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
}

.modern-editor-canvas:focus {
  border-color: var(--accent-color);
}

.modern-editor-canvas:empty::before {
  content: attr(placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
  font-style: italic;
}

.editor-drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(99, 102, 241, 0.05);
  border: 2px dashed var(--accent-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}

.editor-canvas-wrapper.drag-over .editor-drag-overlay {
  opacity: 1;
}

/* FOOTER / STATUS BAR */
.editor-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.editor-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.separator {
  margin: 0 4px;
  opacity: 0.5;
}

.spam-score.low {
  color: var(--success);
}

.spam-score.medium {
  color: var(--warning);
}

.spam-score.high {
  color: var(--error);
}

/* DROPDOWN STYLES */
.dropdown-wrapper {
  position: relative;
}

.toolbar-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: var(--shadow-elevated);
  min-width: 160px;
  display: none;
  z-index: 100;
  padding: 4px 0;
}

.dropdown-wrapper:hover .toolbar-dropdown {
  display: block;
}

.dropdown-header {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}

.dropdown-item {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-primary);
  color: var(--accent-color);
}

/* PREVIEW MODAL SPECIFIC (Simple) */
.preview-modal-content {
  /* Inherits modal-content sizing */
  display: flex;
  flex-direction: column;
}

.preview-body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  /* Neutral light bg for contrast */
}

/* Dark mode preview bg fix */
[data-theme="dark"] .preview-body {
  background: #0f172a;
}

.preview-frame-container {
  flex: 1;
  padding: 24px;
  display: flex;
  justify-content: center;
  overflow-y: auto;
}

/* Frame stays white to simulate real email */
#email-preview-frame {
  width: 100%;
  max-width: 650px;
  background: #fff;
  height: 100%;
  min-height: 400px;
  box-shadow: var(--shadow);
  border: none;
}

/* Dark Mode Overrides for Editor */
[data-theme="dark"] .modern-editor-canvas {
  background: #1e293b;
  /* Dark paper */
}

[data-theme="dark"] .tool-btn-modern:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   TEMPLATE CARDS (Compact - No Preview)
   ========================================================================== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  /* Slightly wider for single line */
  gap: 12px;
}

.template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Reduced height since no preview */
  height: auto;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--accent-light);
}

/* User said they don't like the smaller card design or suggests removing preview.
   "removoe the preview of the tempaltes" -> We hide it.
*/
.template-preview {
  display: none !important;
}

/* Adjust actions to fill card */
.template-actions {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
}

.template-name {
  font-size: 14px;
  /* Slightly larger text */
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.card-btn-group {
  display: flex;
  gap: 6px;
}

/* Tiny Icon Buttons */
.card-icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.card-icon-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent-light);
}

.card-icon-btn.delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
}

/* ==========================================================================
   PREVIEW MODAL (Gmail Style)
   ========================================================================== */
.preview-modal-content {
  /* Inherits modal-content sizing */
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  /* For Premium Look */
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.preview-header-gmail {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.preview-subject-line {
  font-size: 18px;
  font-weight: 500;
  /* Gmail uses leaner font */
  color: var(--text-primary);
  margin-bottom: 16px;
  font-family: 'Google Sans', 'Roboto', sans-serif;
}

.preview-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0b57d0;
  /* Gmail blue */
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.preview-info {
  flex: 1;
}

.preview-sender-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.preview-sender-email {
  font-size: 12px;
  color: var(--text-secondary);
}

.preview-to-me {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.preview-actions-fake {
  display: flex;
  gap: 8px;
  color: var(--text-secondary);
}

.preview-body-container {
  flex: 1;
  background: #fff;
  /* Always white inside for email content */
  padding: 32px;
  overflow-y: auto;
  position: relative;
}

/* Responsive darkmode wrapper for the email FRAME only */
.email-frame-wrapper {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
}

.email-frame-wrapper iframe {
  width: 100%;
  min-height: 400px;
  max-width: 600px;
  /* Standard email width */
  margin: 0 auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-sizing: border-box;
  background: white;
  /* Email content typically has white background */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .email-frame-wrapper iframe {
    max-width: 100%;
    min-height: 300px;
  }
}

/* Dark mode fix: The actual modal structure around the white paper */
[data-theme="dark"] .preview-modal-content {
  border: 1px solid #334155;
}

/* BUT: Email content usually stays white to preserve design, OR user requested dark mode bg change.
   Gmail dark mode inverts email colors often, but for "preview" usually we want to see how it looks.
   User asked: "in dark mode change also the background okay". 
   If they mean the UI around the email, we did that. 
   If they mean the EMAIL ITSELF, that's risky for WYSIWYG, but we can darken the wrapper.
*/
[data-theme="dark"] .preview-body-container {
  background: #1e1e1e;
  /* Outline around the email paper */
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  /* Let clicks pass through if toast is transparent */
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  background: #323232;
  /* Classic dark toast */
  color: white;
  padding: 12px 24px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(20px);
  animation: toastIn 0.3s forwards;
}

.toast.success {
  border-left: 4px solid #4ade80;
  /* Green accent */
}

.toast.error {
  border-left: 4px solid #f87171;
  /* Red accent */
}

@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.pulse-glow {
  position: relative;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.0);
  }

  50% {
    box-shadow: 0 0 18px 6px rgba(99, 102, 241, 0.35);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.0);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.pulse-glow:hover {
  box-shadow: 0 0 24px 8px rgba(99, 102, 241, 0.5);
}

.pulse-glow[disabled] {
  animation: none;
}

#stats-sync-btn {
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

#stats-sync-btn:hover {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

#stats-sync-btn:hover .material-icons {
  color: #fff;
}

#stats-sync-btn:active {
  background: linear-gradient(135deg, #4f46e5 0%, #db2777 100%);
  transform: scale(0.98);
}

#stats-sync-btn:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

/* Compact Quota Section (Text Only below card) */
.sidebar-quota-section.compact-quota {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px 0 0 0 !important;
  margin: 0 !important;
  display: flex !important;
  justify-content: center !important;
  width: 100% !important;
}

#sidebar-sent-count-compact {
  font-size: 11px;
  font-weight: 600;
  color: #ec4899;
  /* Pink color */
  text-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
  /* Pink glow */
  opacity: 1;
  letter-spacing: 0.5px;
  text-align: center;
  margin-top: 4px;
}

[data-theme="dark"] #sidebar-sent-count-compact {
  color: #f472b6;
  /* Lighter pink for dark mode */
  text-shadow: 0 0 12px rgba(244, 114, 182, 0.6);
}

/* Ensure the card has space below it */
.sidebar-profile-card.compact {
  margin-bottom: 2px !important;
}

/* Apple Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  vertical-align: middle;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
  background-color: var(--accent-color);
}

input:focus+.slider {
  box-shadow: 0 0 1px var(--accent-color);
}

input:checked+.slider:before {
  -webkit-transform: translateX(22px);
  -ms-transform: translateX(22px);
  transform: translateX(22px);
}

.switch-label-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.switch-label.active {
  color: var(--text-primary);
  font-weight: 600;
}

/* Sidebar Accounts Dropdown - Recreated Block */
.sidebar-accounts-dropdown {
  /* Hidden by default, toggled via display:block by JS */
  display: none;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-top: 8px;
  box-shadow: var(--shadow-elevated);
  width: 100%;
  min-width: 240px;
  z-index: 1000;
}

.sidebar-accounts-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}

.sidebar-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.sidebar-account-item:hover {
  background: var(--bg-primary);
}

.sidebar-account-item.active {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.1);
}

.sidebar-account-item.active .sidebar-account-name {
  color: var(--accent-color);
  font-weight: 600;
}

.sidebar-account-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.sidebar-account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-account-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sidebar-account-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-account-email {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-account-check {
  font-size: 18px;
  color: var(--accent-color);
}

.sidebar-add-account-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 4px;
  border: 1px dashed var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.sidebar-add-account-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--accent-color);
}

/* Legal & Policies Document Style */
.legal-document {
  background: var(--bg-surface);
  border: none;
  box-shadow: none;
  padding: 32px 48px;
  max-width: 800px;
  margin: 0 auto;
  color: #4b5563;
}

.legal-document h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.legal-document h2 {
  font-size: 22px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.legal-body p,
.legal-body ul {
  line-height: 1.7;
  margin-bottom: 16px;
}

.legal-body ul {
  list-style-position: inside;
  padding-left: 8px;
}

.section-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 48px 0;
}

.sticky-footer {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -24px -16px;
  /* Adjust to counter padding */
}

[data-theme="dark"] .sticky-footer {
  background: rgba(15, 23, 42, 0.85);
}

.sticky-footer label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ===================== SIDEBAR LEGAL LINKS ===================== */
.sidebar-legal-links {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  padding: 0 0 4px 0;
  font-size: 9px;
}

.sidebar-legal-links a {
  font-size: 9px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.sidebar-legal-links a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* ===================== LEGAL CARDS GRID ===================== */
.legal-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legal-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.legal-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent-color);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.legal-card:active {
  transform: translateY(0);
}

.legal-card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.legal-card-icon .material-icons {
  font-size: 22px;
}

.legal-card-content {
  flex: 1;
  min-width: 0;
}

.legal-card-content h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.legal-card-content p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.legal-card-arrow {
  font-size: 20px;
  color: var(--text-tertiary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.legal-card:hover .legal-card-arrow {
  color: var(--accent-color);
  transform: translateX(3px);
}

/* ===================== LEGAL MODAL ===================== */
.legal-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: legalModalFadeIn 0.25s ease;
}

@keyframes legalModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes legalModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.legal-modal-container {
  background: var(--bg-surface);
  border-radius: 20px;
  width: 94%;
  max-width: 760px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  animation: legalModalSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.legal-modal-header {
  padding: 24px 28px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.legal-modal-header-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.legal-modal-header-content .material-icons {
  font-size: 28px;
  opacity: 0.9;
}

.legal-modal-header-content h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.legal-modal-header-content p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.8;
  color: rgba(255, 255, 255, 0.85);
}

.legal-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.legal-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.legal-modal-close .material-icons {
  font-size: 20px;
}

.legal-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  color: var(--text-primary);
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.legal-modal-body::-webkit-scrollbar {
  width: 6px;
}

.legal-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.legal-modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.legal-modal-intro {
  padding: 16px 20px;
  background: var(--bg-primary);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 10px 10px 0;
  margin-bottom: 28px;
}

.legal-modal-intro p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.legal-modal-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 14px;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.legal-modal-body h2:first-of-type {
  margin-top: 0;
}

.legal-modal-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.legal-modal-body p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.legal-modal-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

.legal-modal-body ul li {
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.legal-modal-body ul li strong {
  color: var(--text-primary);
}

.legal-highlight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 10px;
  margin: 16px 0;
}

.legal-highlight .material-icons {
  font-size: 20px;
  color: #6366f1;
  margin-top: 1px;
  flex-shrink: 0;
}

.legal-highlight p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.legal-highlight--success {
  background: rgba(34, 197, 94, 0.06);
  border-color: rgba(34, 197, 94, 0.15);
}

.legal-highlight--success .material-icons {
  color: #22c55e;
}

.legal-highlight--warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.15);
}

.legal-highlight--warning .material-icons {
  color: #f59e0b;
}

.legal-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg-primary);
  border-radius: 10px;
  margin: 12px 0 16px;
}

.legal-contact .material-icons {
  font-size: 20px;
  color: var(--accent-color);
}

.legal-contact a {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-color);
  text-decoration: none;
}

.legal-contact a:hover {
  text-decoration: underline;
}

.legal-laws-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.legal-law-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.legal-law-item strong {
  font-size: 14px;
  color: var(--text-primary);
}

.legal-law-item span {
  font-size: 12px;
  color: var(--text-tertiary);
}

.legal-modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg-surface);
}

/* Dark mode fixes for legal modals */
[data-theme="dark"] .legal-modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .legal-modal-container {
  background: var(--bg-surface);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .legal-highlight {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .legal-highlight--success {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .legal-highlight--warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}

/* Premium Infinite Scroll Animations */
@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.premium-loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(var(--accent-rgb), 0.1);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.2);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* --- Dark theme styling for the chart container --- */
.chart-container {
  background-color: #18191d !important;
  border: 1px solid #2d2d35 !important;
  border-radius: 16px !important;
  padding: 24px !important;
  box-shadow: none !important;
}

/* Style the chart title to be white */
.chart-container h3 {
  color: #ffffff !important;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 24px;
}

/* Ensure the canvas has a transparent background */
.chart-container canvas {
  background-color: transparent !important;
}@keyframes skeleton-loading { 0% { background-color: rgba(0, 0, 0, 0.05); } 100% { background-color: rgba(0, 0, 0, 0.15); } } [data-theme=dark] @keyframes skeleton-loading { 0% { background-color: rgba(255, 255, 255, 0.05); } 100% { background-color: rgba(255, 255, 255, 0.12); } } .skeleton { animation: skeleton-loading 1s linear infinite alternate; border-radius: 4px; color: transparent !important; pointer-events: none; } .skeleton * { visibility: hidden; }

/* ==========================================================================
   CAMPAIGNS TABLE VIEW (Notion-style)
   ========================================================================== */

.campaigns-table {
  width: 100%;
  overflow-x: auto;
}

.campaigns-table-content {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Table Header */
.campaign-table-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

.campaign-table-header th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.campaign-table-header th:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.campaign-table-header th .sort-icon {
  margin-left: 6px;
  opacity: 0.3;
  font-size: 10px;
}

.campaign-table-header th .sort-icon.active {
  opacity: 1;
  color: var(--accent-color);
}

/* Column widths - Compact */
.campaign-col-campaign { width: 120px; }
.campaign-col-status { width: 90px; }
.campaign-col-recipients { width: 70px; text-align: center; }
.campaign-col-sent { width: 70px; text-align: center; }
.campaign-col-opens { width: 85px; text-align: center; }
.campaign-col-clicks { width: 85px; text-align: center; }
.campaign-col-date { width: 75px; }
.campaign-col-actions { width: 120px; text-align: right; }

.campaign-table-header th.campaign-col-recipients,
.campaign-table-header th.campaign-col-sent,
.campaign-table-header th.campaign-col-opens,
.campaign-table-header th.campaign-col-clicks {
  text-align: center;
}

.campaign-table-header th.campaign-col-actions {
  text-align: right;
}

/* Table Body */
.campaign-table-row {
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
  cursor: pointer;
}

.campaign-table-row:hover {
  background: var(--bg-elevated);
}

.campaign-table-row td {
  padding: 10px 12px;
  vertical-align: middle;
}

/* Campaign Column */
.campaign-table-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.campaign-table-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.campaign-table-icon .material-icons {
  font-size: 16px;
  color: var(--text-secondary);
}

.campaign-table-details {
  min-width: 0;
}

.campaign-table-name {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campaign-table-subject {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Badges (contacts-status-badge style) */
.campaign-status-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid;
}

.campaign-badge-running {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.2);
}

.campaign-badge-draft {
  background: rgba(156, 163, 175, 0.1);
  color: #6b7280;
  border-color: rgba(156, 163, 175, 0.2);
}

.campaign-badge-scheduled {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.2);
}

.campaign-badge-completed {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border-color: rgba(139, 92, 246, 0.2);
}

.campaign-badge-stopped {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

.campaign-badge-paused {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.2);
}

.campaign-badge-error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.2);
}

/* Stats columns */
.campaign-col-recipients,
.campaign-col-sent,
.campaign-col-opens,
.campaign-col-clicks {
  text-align: center;
  font-weight: 500;
  color: var(--text-primary);
}

.campaign-rate {
  font-size: 10px;
  color: var(--text-secondary);
  margin-left: 3px;
}

/* Date column */
.campaign-col-date {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Actions */
.campaign-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.campaign-table-row:hover .campaign-table-actions {
  opacity: 1;
}

.campaign-table-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  transition: all 0.2s ease;
}

.campaign-table-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.campaign-table-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.campaign-table-btn.stop:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.campaign-table-btn .material-icons {
  font-size: 14px;
}

/* Responsive */
@media (max-width: 1200px) {
  .campaigns-table {
    overflow-x: auto;
  }
  
  .campaigns-table-content {
    min-width: 900px;
  }
}

@media (max-width: 768px) {
  .campaign-table-actions {
    opacity: 1;
  }
}

/* Dark mode */
[data-theme="dark"] .campaign-table-header th {
  background: var(--bg-surface);
}

[data-theme="dark"] .campaign-table-row:hover {
  background: var(--bg-surface);
}

[data-theme="dark"] .campaign-badge-running {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .campaign-badge-draft {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
  border-color: rgba(156, 163, 175, 0.3);
}

[data-theme="dark"] .campaign-badge-scheduled {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .campaign-badge-completed {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .campaign-badge-stopped {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .campaign-badge-paused {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .campaign-badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Dark mode - Table backgrounds */
[data-theme="dark"] .campaigns-table-content {
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

[data-theme="dark"] .campaign-table-row {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

[data-theme="dark"] .campaign-table-row:hover {
  background: var(--bg-surface);
  border-color: var(--border-glass);
}

/* Dark mode - Campaign Cards (Glass Style) */
[data-theme="dark"] .cmp-card {
  background: rgba(30, 41, 59, 0.4);
  border-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 4px 24px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

[data-theme="dark"] .cmp-card:hover {
  background: rgba(30, 41, 59, 0.6);
  border-color: var(--accent-color);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(99, 102, 241, 0.2),
    0 0 0 1px var(--accent-color) inset;
}

/* Table Header Styling */
.campaign-table-header th {
  position: relative;
}

/* Editable Column Headers */
.campaign-table-header th[data-sort] {
  cursor: pointer;
}

.campaign-table-header th .sort-icon {
  cursor: pointer;
}

/* Save column widths to localStorage */
.campaign-table-header th {
  min-width: 50px;
}

/* Column Editor Styles */
.campaign-col-editor-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-elevated);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.campaign-col-editor-btn:hover {
  background: var(--accent-color);
  color: white;
}

.campaign-col-editor-btn .material-icons {
  font-size: 16px;
}

.campaign-col-editor-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  min-width: 200px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 100;
  animation: slideDown 0.2s ease;
}

.campaign-col-editor-dropdown.hidden {
  display: none;
}

.campaign-col-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.campaign-col-editor-header span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.campaign-col-editor-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-col-editor-close:hover {
  color: var(--text-primary);
}

.campaign-col-editor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campaign-col-editor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.campaign-col-editor-item:hover {
  background: var(--bg-elevated);
}

.campaign-col-editor-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-color);
}

.campaign-col-editor-item label {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  flex: 1;
  user-select: none;
}

.campaign-col-editor-item:hover label {
  color: var(--text-primary);
}

/* Hidden columns */
.campaign-table-row td.hidden-col,
.campaign-table-header th.hidden-col {
  display: none;
}

/* Column editor wrapper */
.campaign-col-editor-wrapper {
  position: relative;
  display: inline-block;
}

/* ============================================================
   HELP BUTTON SYSTEM - Minimal Help Modal
   ============================================================ */

.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 12px;
}

.help-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}

.help-btn:active {
  transform: scale(0.95);
}

.help-btn .material-icons {
  font-size: 18px;
}

/* Help Modal Styles */
.help-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.help-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.help-modal-container {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.help-modal-backdrop.active .help-modal-container {
  transform: scale(1) translateY(0);
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.05), transparent);
}

.help-modal-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.help-modal-header h2 .material-icons {
  color: var(--accent-color);
}

.help-modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.help-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.help-section {
  margin-bottom: 24px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-section-title .material-icons {
  font-size: 18px;
  color: var(--accent-color);
}

.help-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.help-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.help-list li:last-child {
  border-bottom: none;
}

.help-list-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-list-icon .material-icons {
  font-size: 14px;
  color: var(--accent-color);
}

.help-list-content {
  flex: 1;
}

.help-list-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 2px;
}

.help-list-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.help-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-steps li {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.help-steps li:last-child {
  border-bottom: none;
}

.help-steps li::before {
  counter-increment: step;
  content: counter(step);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-color);
  color: white;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-steps-content {
  flex: 1;
  padding-top: 4px;
}

.help-steps-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.help-steps-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.help-tip {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08), transparent);
  border-left: 3px solid var(--primary-color);
  padding: 16px;
  border-radius: 8px;
  margin-top: 20px;
}

.help-tip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 8px;
}

.help-tip-header .material-icons {
  font-size: 16px;
  color: var(--primary-color);
}

.help-tip-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.help-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.help-modal-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.help-modal-btn-primary {
  background: var(--accent-color);
  color: white;
}

.help-modal-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

/* Dark mode adjustments */
[data-theme="dark"] .help-modal-container {
  background: var(--bg-card);
}

[data-theme="dark"] .help-list-icon {
  background: rgba(var(--accent-rgb), 0.15);
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .help-modal-container {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
  }
  
  .help-modal-header {
    padding: 16px 20px;
  }
  
  .help-modal-body {
    padding: 20px;
  }
  
  .help-btn {
    width: 28px;
    height: 28px;
  }
  
  .help-btn .material-icons {
    font-size: 16px;
  }
}

/* ============================================================
   END HELP BUTTON SYSTEM
   ============================================================ */

/* ============================================================
   ACCOUNT SWITCHER MODAL - MODERN CLEAN DESIGN
   ============================================================ */

#account-modal-overlay {
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#account-modal-overlay .modal-content {
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Close Button */
.account-modal-close-btn {
  backdrop-filter: blur(4px);
}

.account-modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.5) !important;
  transform: scale(1.1);
}

.account-modal-close-btn:active {
  transform: scale(0.95);
}

/* Profile Items */
.account-modal-profile-item {
  position: relative;
  overflow: hidden;
}

.account-modal-profile-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-subtle);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.account-modal-profile-item:hover::before {
  opacity: 1;
}

.account-modal-profile-item:hover {
  border-color: var(--accent-color) !important;
  transform: translateX(4px);
}

.account-modal-profile-item:active {
  transform: scale(0.98);
}

.account-modal-profile-item img {
  transition: all 0.15s ease;
}

.account-modal-profile-item:hover img {
  border-color: var(--accent-color) !important;
}

.account-modal-profile-item svg:last-child {
  transition: all 0.15s ease;
}

.account-modal-profile-item:hover svg:last-child {
  color: var(--accent-color);
  transform: translateX(2px);
}

/* Action Buttons */
#account-modal-manage-senders:hover {
  background: var(--bg-hover) !important;
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
}

#account-modal-manage-senders:active {
  transform: scale(0.98);
}

#account-modal-signout:hover {
  background: rgba(239, 68, 68, 0.2) !important;
}

#account-modal-signout:active {
  transform: scale(0.98);
}

/* Light Mode Adjustments */
[data-theme="light"] #account-modal-overlay .modal-content {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .account-modal-close-btn {
  background: rgba(0, 0, 0, 0.2) !important;
  color: white !important;
}

[data-theme="light"] .account-modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.4) !important;
}

/* Focus States for Accessibility */
.account-modal-close-btn:focus-visible,
#account-modal-manage-senders:focus-visible,
#account-modal-signout:focus-visible,
.account-modal-profile-item:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  #account-modal-overlay,
  #account-modal-overlay .modal-content,
  .account-modal-close-btn,
  .account-modal-profile-item,
  .account-modal-profile-item::before,
  .account-modal-profile-item img,
  .account-modal-profile-item svg:last-child {
    animation: none;
    transition: none;
  }
}

/* ============================================================
   END ACCOUNT SWITCHER MODAL
   ============================================================ */

/* ============================================================
   COMPACT MODAL THEME OVERRIDES
   ============================================================ */

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.compact-modal {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 24px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.compact-modal--md {
  max-width: 440px;
}

.compact-modal--lg {
  max-width: 620px;
}

.compact-modal--left {
  text-align: left;
}

.compact-modal--left .compact-modal-icon {
  margin-left: auto;
  margin-right: auto;
}

.compact-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: all 0.2s ease;
}

.compact-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.compact-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.compact-modal-icon .material-icons {
  font-size: 20px;
  line-height: 1;
  color: var(--compact-icon-color, var(--accent-color));
}

.compact-modal-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.compact-modal-body {
  margin-bottom: 16px;
}

.compact-modal--lg .compact-modal-body {
  max-height: 55vh;
  overflow-y: auto;
}

.compact-modal-message {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.compact-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.compact-modal-actions.single .compact-modal-btn {
  width: 100%;
  justify-content: center;
}

.compact-modal-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
}

.compact-modal[data-variant="danger"] .compact-modal-btn.btn-primary {
  background: var(--error);
  border-color: var(--error);
}

.compact-modal[data-variant="warning"] .compact-modal-btn.btn-primary {
  background: #f59e0b;
  border-color: #f59e0b;
}

.compact-modal[data-variant="success"] .compact-modal-btn.btn-primary {
  background: #10b981;
  border-color: #10b981;
}

.compact-modal-input {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .compact-modal-icon .material-icons {
    font-size: 18px;
  }
}

/* Overlay + shell normalization for all modal types */
.modal-backdrop,
.modal-wrapper,
.ai-modal-backdrop,
.activity-log-modal-overlay,
.ab-modal-overlay,
.fb-modal,
.fb-modal-overlay,
.fb-rotation-modal-overlay,
.campaign-wizard-backdrop,
.campaign-details-backdrop,
.manual-config-overlay,
.integration-leads-overlay,
.help-modal-backdrop,
#account-modal-overlay {
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(4px) !important;
}

.modal,
.modal-content,
.premium-modal,
.ai-modal-container,
.activity-log-modal-content,
.ab-modal,
.fb-modal-content,
.fb-rotation-modal-container,
.campaign-details-modal-content,
.manual-config-content,
.integration-leads-content,
.help-modal-container,
#account-modal-overlay .modal-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2) !important;
}

.modal-header,
.modal-content .modal-header,
.ai-modal-header,
.activity-log-modal-header,
.ab-modal-header,
.fb-modal-header,
.fb-rotation-modal-header,
.campaign-details-modal-header,
.manual-config-header,
.integration-leads-header,
.help-modal-header,
#account-modal-overlay .modal-header {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.modal-footer,
.modal-content .modal-footer,
.ai-modal-footer,
.fb-rotation-modal-footer,
.help-modal-footer,
#account-modal-overlay .modal-footer {
  background: var(--bg-surface) !important;
  border-top: 1px solid var(--border-color) !important;
}

.modal-header h2,
.modal-header h3 {
  color: var(--text-primary) !important;
}

.modal-header p {
  color: var(--text-secondary) !important;
}

.modal-header .material-icons {
  color: var(--text-secondary) !important;
}

.modal-close,
.ai-modal-close,
.activity-log-modal-close,
.ab-modal-close,
.fb-modal-close,
.fb-rotation-modal-close,
.campaign-details-modal-close,
.manual-config-close,
.integration-leads-close,
.help-modal-close,
#account-modal-overlay .modal-close {
  color: var(--text-secondary) !important;
  background: transparent !important;
}

.ai-modal-header::before {
  display: none !important;
}

.ai-modal-title {
  color: var(--text-primary) !important;
}

.ai-modal-subtitle {
  color: var(--text-secondary) !important;
}

.ai-modal-icon {
  background: rgba(0, 0, 0, 0.04) !important;
  box-shadow: none !important;
}

.ai-modal-icon .material-icons {
  color: var(--text-primary) !important;
  animation: none !important;
}

.help-modal-header h2,
.help-modal-header h3 {
  color: var(--text-primary) !important;
}

.help-modal-header p {
  color: var(--text-secondary) !important;
}

.help-modal-header .material-icons {
  color: var(--text-secondary) !important;
}

.manual-config-header h3,
.integration-leads-header h3 {
  color: var(--text-primary) !important;
}

.manual-config-header .material-icons,
.integration-leads-header .material-icons {
  color: var(--text-secondary) !important;
}

.integration-leads-header p {
  color: var(--text-secondary) !important;
}

.login-legal-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.login-legal-consent input[type="checkbox"] {
  margin-top: 2px;
  width: 14px;
  height: 14px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.login-legal-consent a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   MOBILE EXPERIENCE (ANALYTICS-FIRST)
   ========================================================================== */
.mobile-bottom-nav,
.mobile-more-backdrop,
.mobile-more-sheet {
  display: none;
}

body.mobile-more-open {
  overflow: hidden;
}

@media (max-width: 1023px) {
  .sidebar {
    display: none !important;
  }

  .app-container {
    height: 100dvh;
  }

  .main-content {
    padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: hidden;
  }

  .view {
    width: 100%;
    max-width: 100%;
  }

  .top-bar,
  .contacts-header,
  .view-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }

  .top-bar h1,
  .contacts-title,
  .view-title {
    font-size: 22px;
    line-height: 1.2;
  }

  .contacts-header-actions,
  .contacts-toolbar,
  .campaigns-toolbar,
  .campaigns-toolbar-left {
    width: 100%;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .contacts-search-wrapper,
  .campaigns-search-wrapper {
    width: 100%;
    max-width: none !important;
  }

  #campaigns-filters,
  #stats-filters,
  .team-date-filter {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 11000;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
    backdrop-filter: blur(16px);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22);
  }

  .mobile-nav-tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: var(--transition-fast);
  }

  .mobile-nav-tab .material-icons {
    font-size: 20px;
  }

  .mobile-nav-tab.active {
    color: var(--accent-color);
    background: var(--accent-subtle);
  }

  .mobile-nav-tab:active {
    transform: scale(0.97);
  }

  .mobile-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10990;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .mobile-more-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-more-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11010;
    background: var(--bg-surface);
    border-radius: 18px 18px 0 0;
    border-top: 1px solid var(--border-color);
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -24px 40px rgba(15, 23, 42, 0.25);
    transform: translateY(105%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.24s ease, opacity 0.24s ease;
  }

  .mobile-more-sheet.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .mobile-more-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
  }

  .mobile-more-close {
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-primary);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-more-item {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 12px;
    min-height: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
  }

  .mobile-more-item .material-icons {
    font-size: 18px;
    color: var(--accent-color);
  }

  .mobile-more-item:active {
    transform: scale(0.98);
  }
}

@media (max-width: 860px) {
  .contacts-table-wrapper,
  .premium-table-container,
  .campaigns-table {
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .contacts-table-modern thead,
  .premium-table thead,
  .campaigns-table-content thead {
    display: none;
  }

  .contacts-table-modern tbody,
  .premium-table tbody,
  .campaigns-table-content tbody {
    display: block;
  }

  .contacts-table-modern tr,
  .premium-table tbody tr,
  .campaigns-table-content tbody tr {
    display: block;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
  }

  .contacts-table-modern td,
  .premium-table td,
  .campaigns-table-content td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    border: none !important;
    padding: 8px 0 !important;
    text-align: right;
    white-space: normal !important;
  }

  .contacts-table-modern td::before,
  .premium-table td::before,
  .campaigns-table-content td::before {
    content: attr(data-label);
    flex: 1;
    text-align: left;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-right: 8px;
  }

  .contacts-table-modern td > *,
  .premium-table td > *,
  .campaigns-table-content td > * {
    margin-left: auto;
  }

  .contacts-table-modern td[colspan],
  .premium-table td[colspan],
  .campaigns-table-content td[colspan],
  .contacts-table-modern .contacts-empty-state,
  .premium-table .empty-state {
    display: block !important;
    text-align: left !important;
    padding: 14px 8px !important;
  }

  .contacts-table-modern td[colspan]::before,
  .premium-table td[colspan]::before,
  .campaigns-table-content td[colspan]::before {
    content: none;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 14px 10px calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-content,
  .compact-modal,
  .preview-modal-content {
    width: min(100%, calc(100vw - 18px)) !important;
    max-width: calc(100vw - 18px) !important;
    min-width: 0 !important;
    max-height: 88vh;
  }

  .campaigns-grid,
  #campaigns-list.campaigns-grid {
    grid-template-columns: 1fr !important;
  }

  .cmp-card {
    padding: 12px !important;
  }

  .team-performance-cards-grid,
  .stats-grid-campaign,
  .followup-stats-grid {
    grid-template-columns: 1fr !important;
  }

  .charts-grid-modern,
  .charts-grid-modern--stack,
  .campaign-overview-row,
  .dashboard-operational-grid {
    grid-template-columns: 1fr !important;
  }
}
