/* 
 * EmailFlow Pro - Enterprise SaaS Multi-Theme CSS System
 * Universal High-Contrast Dark & Light Mode Theme
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   1. Theme Variables Definitions
   ========================================================================== */

/* Master Enterprise Light Mode Design System (Default) */
:root,
[data-theme="light"],
[data-theme="dark"],
html,
body {
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-glow: rgba(124, 58, 237, 0.2);
  
  --text-primary: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #334155;
  --label-color: #0f172a;
  
  --input-bg: #ffffff;
  --input-border: 1.5px solid #cbd5e1;
  --input-text: #0f172a;
  --input-placeholder: #64748b;
  
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --accent: #7c3aed;
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  --gradient-accent: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.2);
  
  --glass-bg: #ffffff;
  --glass-border: 1px solid #e2e8f0;
  --backdrop-blur: none;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 50px;
}

/* ==========================================================================
   2. Global Typography & Core Overrides (High-Contrast Light Mode)
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Universal Typography Enforcement (Clean Dark Slate on Light Canvas) */
[data-theme="dark"], [data-theme="light"], body {
  color: #0f172a !important;
}

[data-theme="dark"] h1, [data-theme="dark"] .h1,
[data-theme="dark"] h2, [data-theme="dark"] .h2,
[data-theme="dark"] h3, [data-theme="dark"] .h3,
[data-theme="dark"] h4, [data-theme="dark"] .h4,
[data-theme="dark"] h5, [data-theme="dark"] .h5,
[data-theme="dark"] h6, [data-theme="dark"] .h6,
[data-theme="light"] h1, [data-theme="light"] .h1,
[data-theme="light"] h2, [data-theme="light"] .h2,
[data-theme="light"] h3, [data-theme="light"] .h3,
[data-theme="light"] h4, [data-theme="light"] .h4,
[data-theme="light"] h5, [data-theme="light"] .h5,
[data-theme="light"] h6, [data-theme="light"] .h6 {
  color: #0f172a !important;
  font-weight: 700;
}

[data-theme="dark"] p,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="light"] p,
[data-theme="light"] li,
[data-theme="light"] td,
[data-theme="light"] th {
  color: #334155;
}

.text-secondary,
[data-theme="dark"] .text-secondary,
[data-theme="light"] .text-secondary {
  color: #1e293b !important;
  opacity: 1 !important;
  font-weight: 500;
}

.text-muted,
[data-theme="dark"] .text-muted,
[data-theme="light"] .text-muted,
.extra-small {
  color: #334155 !important;
  opacity: 1 !important;
}

/* Light Mode Typography Enforcement */
[data-theme="light"], [data-theme="dark"], body {
  color: #0f172a !important;
}

[data-theme="light"] h1, [data-theme="light"] .h1,
[data-theme="light"] h2, [data-theme="light"] .h2,
[data-theme="light"] h3, [data-theme="light"] .h3,
[data-theme="light"] h4, [data-theme="light"] .h4,
[data-theme="light"] h5, [data-theme="light"] .h5,
[data-theme="light"] h6, [data-theme="light"] .h6 {
  color: #0f172a !important;
  font-weight: 800;
}

[data-theme="light"] p,
[data-theme="light"] li,
[data-theme="light"] td,
[data-theme="light"] th {
  color: #1e293b;
}

[data-theme="light"] .text-muted,
[data-theme="light"] span.text-muted,
[data-theme="light"] div.text-muted,
[data-theme="light"] p.text-muted,
[data-theme="light"] small.text-muted,
[data-theme="light"] .extra-small {
  color: #334155 !important;
  opacity: 1 !important;
}

[data-theme="light"] .text-secondary,
[data-theme="light"] span.text-secondary,
[data-theme="light"] div.text-secondary,
[data-theme="light"] p.text-secondary,
[data-theme="light"] small.text-secondary {
  color: #1e293b !important;
  opacity: 1 !important;
  font-weight: 500;
}

/* Master Text Visibility Overrides for Light Mode (Fixes white-on-white text) */
[data-theme="light"] .text-white:not(.btn):not(.badge):not(.bg-primary):not(.bg-danger):not(.bg-success):not(.bg-dark):not(.stat-val-dark) {
  color: #0f172a !important;
}

[data-theme="light"] .stat-val.text-white {
  color: #0f172a !important;
}

[data-theme="light"] label,
[data-theme="light"] .form-label,
[data-theme="light"] .stat-label {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* Master Text Visibility Overrides */
[data-theme="dark"] label,
[data-theme="dark"] .form-label,
[data-theme="dark"] .stat-label,
[data-theme="light"] label,
[data-theme="light"] .form-label,
[data-theme="light"] .stat-label {
  color: #0f172a !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-black,
[data-theme="light"] .text-dark,
[data-theme="light"] .text-black {
  color: #0f172a !important;
}

/* ==========================================================================
   3. Form Labels, Controls, Inputs & Placeholders
   ========================================================================== */

/* Universal High Contrast Form Labels */
label, 
.form-label, 
label.form-label, 
.stat-label, 
.menu-category {
  font-weight: 700 !important;
  font-size: 0.86rem !important;
  letter-spacing: 0.5px !important;
  margin-bottom: 7px !important;
  display: block !important;
  opacity: 1 !important;
  text-transform: uppercase !important;
  color: #0f172a !important;
}

[data-theme="dark"] label,
[data-theme="dark"] .form-label,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .menu-category,
[data-theme="light"] label,
[data-theme="light"] .form-label,
[data-theme="light"] .stat-label,
[data-theme="light"] .menu-category {
  color: #0f172a !important;
}

/* Form Controls (Inputs, Selects, Textareas) */
.form-control,
.form-select,
.form-control-glass {
  border-radius: var(--radius-md) !important;
  padding: 12px 16px !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  background-color: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control-glass,
[data-theme="dark"] select option,
[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
[data-theme="light"] .form-control-glass,
[data-theme="light"] select option {
  background-color: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-control-glass::placeholder,
[data-theme="dark"] textarea::placeholder,
[data-theme="light"] .form-control::placeholder,
[data-theme="light"] .form-control-glass::placeholder,
[data-theme="light"] textarea::placeholder {
  color: #64748b !important;
  opacity: 0.85 !important;
}

[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
[data-theme="light"] .form-control-glass,
[data-theme="light"] select option {
  background-color: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .form-control::placeholder,
[data-theme="light"] .form-control-glass::placeholder,
[data-theme="light"] textarea::placeholder {
  color: #64748b !important;
  opacity: 0.85 !important;
}

/* Focus States */
.form-control:focus,
.form-select:focus,
.form-control-glass:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35) !important;
  outline: none !important;
}

/* Input Group Text Icon Box */
.input-group-text {
  border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
}

[data-theme="dark"] .input-group-text {
  background-color: #1e293b !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  color: #818cf8 !important;
}

[data-theme="light"] .input-group-text {
  background-color: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #4338ca !important;
}

/* ==========================================================================
   4. Buttons - Universal Light Text & High Visibility
   ========================================================================== */

/* Primary & Accent Gradient Buttons MUST ALWAYS HAVE PURE WHITE BOLD FONT */
.btn-gradient-primary,
.btn-primary,
.btn-gradient-accent,
.btn-success,
.btn-danger,
.btn-warning {
  color: #ffffff !important;
  font-weight: 700 !important;
  border: none !important;
  border-radius: var(--radius-md);
  padding: 10px 22px;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
}

.btn-gradient-primary {
  background: var(--gradient-primary) !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-gradient-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6);
  color: #ffffff !important;
}

.btn-gradient-accent {
  background: var(--gradient-accent) !important;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

.btn-gradient-accent:hover {
  transform: translateY(-2px);
  color: #ffffff !important;
}

/* Secondary Glass Buttons */
.btn-glass {
  border-radius: var(--radius-md);
  padding: 9px 20px;
  font-weight: 600;
  transition: all 0.2s ease;
}

[data-theme="dark"] .btn-glass {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

[data-theme="dark"] .btn-glass:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

[data-theme="light"] .btn-glass {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .btn-glass:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* ==========================================================================
   5. Glass Cards, Layout, Sidebar & Navigation
   ========================================================================== */

.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.glass-nav {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: var(--glass-border);
}

/* App Sidebar */
.app-sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: var(--glass-border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  height: 70px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: var(--glass-border);
}

.sidebar-logo {
  height: 38px;
  width: auto;
  border-radius: 8px;
}

.sidebar-menu {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
}

.nav-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.nav-link-item:hover, .nav-link-item.active {
  background: var(--gradient-primary);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.nav-link-item i {
  font-size: 1.1rem;
}

.app-main {
  margin-left: 260px;
  width: calc(100% - 260px);
  max-width: calc(100% - 260px);
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  box-sizing: border-box;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-topbar {
  height: 64px;
  min-height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1050;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.app-content {
  padding: 24px 28px;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* ==========================================================================
   6. Dashboard KPI Stat Cards & Analytics
   ========================================================================== */

.stat-card {
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, var(--border-glow) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
}

.stat-val {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 10px 0 4px;
  letter-spacing: -0.5px;
}

[data-theme="dark"] .stat-val {
  color: #ffffff !important;
}

[data-theme="light"] .stat-val {
  color: #0f172a !important;
}

.stat-label {
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase !important;
}

[data-theme="dark"] .stat-label,
[data-theme="light"] .stat-label,
.stat-label {
  color: #1e293b !important;
}

/* ==========================================================================
   7. Tables, Badges, Modals, Code Blocks & Alerts
   ========================================================================== */

/* Glass Tables */
.table-glass {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table-glass th {
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .table-glass th,
[data-theme="light"] .table-glass th,
.table-glass th {
  color: #0f172a !important;
}

.table-glass td {
  padding: 16px;
  background: var(--bg-card);
  border-top: var(--glass-border);
  border-bottom: var(--glass-border);
  font-size: 0.9rem;
}

.table-glass tr td:first-child {
  border-left: var(--glass-border);
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.table-glass tr td:last-child {
  border-right: var(--glass-border);
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* Status Badges */
.badge-status {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-status.sending {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.sending::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Modals & Popups Ultra-Responsive Polish */
.modal-backdrop {
  z-index: 10550 !important;
}

.modal {
  z-index: 10600 !important;
  padding-right: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
}

body.modal-open .app-topbar,
body.modal-open .outlook-commandbar,
body.modal-open .app-sidebar,
body.modal-open-active .app-topbar,
body.modal-open-active .app-sidebar {
  z-index: 1000 !important;
}

.modal-dialog {
  max-width: 820px;
  width: 94%;
  margin: 1.5rem auto !important;
  max-height: calc(100vh - 3rem) !important;
  display: flex !important;
  flex-direction: column !important;
}

.modal-dialog-centered {
  min-height: calc(100vh - 3rem) !important;
  align-items: center !important;
}

@media (max-width: 767.98px) {
  .modal-dialog {
    width: 96% !important;
    margin: 0.5rem auto !important;
    max-height: calc(100vh - 1rem) !important;
  }
  .modal-dialog-centered {
    min-height: calc(100vh - 1rem) !important;
  }
}

.modal-content {
  background: var(--bg-card) !important;
  border: var(--glass-border) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7) !important;
  border-radius: 20px !important;
  max-height: calc(100vh - 3rem) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  width: 100% !important;
}

@media (max-width: 767.98px) {
  .modal-content {
    max-height: calc(100vh - 1rem) !important;
    border-radius: 14px !important;
  }
}

/* Ensure forms inside modal content flex properly and do not overflow viewport */
.modal-content form {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  width: 100% !important;
}

[data-theme="dark"] .modal-content {
  background-color: #0f172a !important;
  color: #ffffff !important;
}

[data-theme="light"] .modal-content {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

.modal-header {
  border-color: var(--border-color) !important;
  padding: 1.25rem 1.5rem !important;
  flex-shrink: 0 !important;
}

.modal-title {
  font-weight: 800 !important;
  font-size: 1.25rem !important;
}

.modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 1.25rem 1.5rem !important;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 4px;
}

@media (max-width: 767.98px) {
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem !important;
  }
  
  /* Make multi-column form grids stack into 1 clean column on mobile popups */
  .modal-body .row > [class*="col-"] {
    width: 100% !important;
    margin-bottom: 0.5rem;
  }
}

.modal-footer {
  border-color: var(--border-color) !important;
  padding: 1rem 1.5rem !important;
  flex-shrink: 0 !important;
  background: var(--bg-card) !important;
}

/* Code Highlights */
code {
  color: #f472b6 !important;
  background: rgba(244, 114, 182, 0.18) !important;
  border: 1px solid rgba(244, 114, 182, 0.35) !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
}

/* Responsive Drawer for Mobile */
@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1035;
    display: none;
  }
  .sidebar-overlay.show {
    display: block;
  }
}

/* ==========================================================================
   Professional Responsive Polish - Email Automation Suite
   ========================================================================== */
:root {
  --ef-container: 1180px;
  --ef-focus: 0 0 0 4px rgba(99,102,241,.25);
}

.app-main, .app-content, main {
  min-width: 0;
}

.glass-card {
  border-radius: 18px !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  box-shadow: 0 18px 50px rgba(0,0,0,.22) !important;
}

[data-theme="light"] .glass-card {
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 12px 30px rgba(15,23,42,.08) !important;
}

.btn,
.form-control,
.form-select {
  min-height: 44px;
}

.btn-sm { min-height: 36px; }

.btn-gradient-primary {
  background: linear-gradient(135deg, #6366f1 0%, #2563eb 100%) !important;
  border: 0 !important;
  box-shadow: 0 12px 22px rgba(37,99,235,.18);
}

.btn-gradient-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(37,99,235,.24);
}

.table-responsive {
  border-radius: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-glass {
  min-width: 860px;
}

.table-glass th {
  white-space: nowrap;
  font-size: .76rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.badge-status,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  min-height: 26px;
  border-radius: 999px;
  padding: 7px 10px;
}

.modal-dialog {
  margin: 16px auto;
}

.modal-content {
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.modal-body {
  overflow-y: auto;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none !important;
  box-shadow: var(--ef-focus) !important;
}

.workflow-step-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.workflow-step-line:last-child { border-bottom: 0; }

.metric-card {
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(99,102,241,.18), transparent 65%);
}

@media (max-width: 1199.98px) {
  .d-flex.align-items-center.justify-content-between.mb-4 {
    align-items: flex-start !important;
    gap: 16px;
  }
}

@media (max-width: 991.98px) {
  body { font-size: 15px; }
  .app-content, main { padding: 18px !important; }
  .glass-card { padding: 18px !important; }
  .row.g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
}

@media (max-width: 767.98px) {
  h3.fw-bold { font-size: 1.35rem; line-height: 1.25; }
  .d-flex.align-items-center.justify-content-between.mb-4,
  .page-header-box {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .d-flex.align-items-center.justify-content-between.mb-4 > a,
  .d-flex.align-items-center.justify-content-between.mb-4 > button,
  .d-flex.align-items-center.justify-content-between.mb-4 .btn {
    width: auto;
    max-width: 100%;
  }
  .btn-group {
    display: inline-flex !important;
    flex-wrap: wrap;
    width: auto;
    max-width: 100%;
    gap: 4px;
  }
  .btn-group .btn {
    border-radius: 8px !important;
    width: auto;
    flex: 0 1 auto;
  }
  .modal-dialog { width: calc(100% - 16px) !important; margin: 0.5rem auto !important; }
  .modal-content { max-height: calc(100vh - 20px) !important; border-radius: 14px !important; display: flex !important; flex-direction: column !important; }
  .modal-header, .modal-footer, .modal-body { padding: 14px !important; }
  .modal-body { flex: 1 1 auto !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch !important; }
  .modal-footer { flex-direction: column-reverse !important; gap: 8px !important; }
  .modal-footer .btn { width: 100% !important; margin: 0 !important; }
  #smtpTestPanel .d-flex { flex-direction: column !important; align-items: stretch !important; gap: 8px !important; }
  #btnTestSmtpModal { width: 100% !important; justify-content: center !important; }
  footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .app-content, main { padding: 14px !important; }
  .glass-card { padding: 14px !important; border-radius: 14px !important; }
  .form-control, .form-select, .form-control-glass { padding: 11px 12px !important; }
  .btn-group { display: inline-flex !important; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* ==========================================================================
   Mobile Responsiveness Hardening - All App Sections
   ========================================================================== */
html, body { max-width: 100%; }
img, svg, canvas, iframe { max-width: 100%; }

@media (max-width: 767.98px) {
  .container, .container-fluid { max-width: 100% !important; padding-left: 14px !important; padding-right: 14px !important; }
  .row { --bs-gutter-x: .85rem; --bs-gutter-y: .85rem; }
  [class*="col-xl"], [class*="col-lg"], [class*="col-md"], [class*="col-sm"] { min-width: 0; }

  /* Header/action bars */
  .d-flex.justify-content-between,
  .d-flex.align-items-center.justify-content-between,
  .d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap;
    gap: 12px;
  }
  .d-flex.gap-2,
  .d-flex.gap-3 { flex-wrap: wrap; gap: 8px !important; }
  .d-flex.gap-2 > .btn,
  .d-flex.gap-3 > .btn,
  .d-flex.gap-2 > a.btn,
  .d-flex.gap-3 > a.btn { flex: 0 1 auto; max-width: 100%; width: auto; }

  /* Cards and metrics */
  .glass-card { width: 100%; overflow: hidden; }
  .stat-card, .metric-card { min-height: auto; }
  .display-4 { font-size: 2.2rem; }
  .fs-4 { font-size: 1.25rem !important; }

  /* Forms */
  .input-group { width: 100% !important; max-width: 100% !important; flex-wrap: nowrap; }
  .form-control, .form-select, .form-control-glass, textarea { width: 100% !important; max-width: 100% !important; }
  textarea[rows="18"] { min-height: 260px; }
  .form-check { padding-top: 4px; padding-bottom: 4px; }

  /* Tables */
  .table-responsive { width: 100%; margin-bottom: 0; border: 1px solid rgba(255,255,255,.08); }
  .table-glass { min-width: 720px; }
  .table-glass td, .table-glass th { padding: 12px 10px !important; vertical-align: top; }

  /* Progress bars and badges */
  td[style*="min-width"] { min-width: 130px !important; }
  .badge, .badge-status { white-space: normal; text-align: left; }

  /* Modals and previews */
  .modal-dialog-centered { min-height: calc(100% - 1rem); }
  iframe { min-height: 320px; }
  #live-preview-iframe, #previewIframe { height: 360px !important; }

  /* Automation cards */
  .workflow-step-line, .automation-step, .p-3.bg-dark .d-flex { align-items: flex-start !important; }
  .p-3.bg-dark .d-flex i { margin-top: 2px; }
}

@media (max-width: 575.98px) {
  body { font-size: 14px; }
  h1, .h1 { font-size: 1.7rem !important; }
  h2, .h2 { font-size: 1.45rem !important; }
  h3, .h3 { font-size: 1.25rem !important; }
  h4, .h4, h5, .h5 { font-size: 1.05rem !important; }

  .btn { max-width: 100%; width: auto; }
  .btn.w-100, .btn-block { width: 100% !important; }
  .btn-sm { min-height: 32px; font-size: 0.8rem; padding: 6px 12px; }
  form.d-inline { display: inline-block !important; width: auto; }
  form.d-inline .btn, td .btn, td form .btn { width: auto !important; margin: 2px !important; display: inline-flex !important; }

  .card-body, .modal-body { padding: 16px !important; }
  .modal-content { border-radius: 22px !important; }
  .modal-header, .modal-footer { padding-left: 16px !important; padding-right: 16px !important; }

  .table-glass { min-width: 640px; font-size: .86rem; }
  .progress { min-width: 90px; }

  .alert { align-items: flex-start !important; line-height: 1.45; }
  code { white-space: normal; word-break: break-word; }
}

@media (max-width: 390px) {
  .container, .container-fluid, .app-content, main { padding-left: 10px !important; padding-right: 10px !important; }
  .glass-card { padding: 12px !important; }
  .table-glass { min-width: 600px; }
  .badge, .badge-status { font-size: .72rem; padding: 6px 8px; }
}

/* ==========================================================================
   Visibility + Logo Responsiveness Fixes
   ========================================================================== */
/* Make table header gray text prominent, especially on light backgrounds */
.table-glass thead,
.table-glass thead tr,
.table-glass th {
  background: #ffffff !important;
}
.table-glass th {
  color: #0f172a !important;
  font-weight: 900 !important;
  letter-spacing: .055em !important;
  border-bottom: 2px solid #cbd5e1 !important;
}
[data-theme="dark"] .table-glass th,
[data-theme="light"] .table-glass th {
  color: #0f172a !important;
  background: #ffffff !important;
}

/* Master Universal High-Contrast Dark Text Tokens (Strictly Never Faint/White) */
.text-secondary,
[data-theme="light"] .text-secondary,
[data-theme="dark"] .text-secondary,
span.text-secondary,
div.text-secondary,
p.text-secondary,
small.text-secondary,
.card .text-secondary,
.page-header-box .text-secondary {
  color: #1e293b !important;
  opacity: 1 !important;
  font-weight: 500;
}

.text-muted,
[data-theme="light"] .text-muted,
[data-theme="dark"] .text-muted,
span.text-muted,
div.text-muted,
p.text-muted,
small.text-muted,
label.text-muted,
.extra-small,
.card .text-muted,
.page-header-box .text-muted {
  color: #334155 !important;
  opacity: 1 !important;
}

/* High-Contrast Badges & Status Pills (Fixes invisible "Cold Email" pills) */
.badge.bg-light,
.badge.bg-light.text-secondary,
.badge.text-secondary,
.badge.border,
span.badge.border,
[data-theme="light"] .badge.bg-light,
[data-theme="dark"] .badge.bg-light,
[data-theme="light"] .badge.bg-secondary-subtle,
[data-theme="dark"] .badge.bg-secondary-subtle,
[data-theme="light"] .badge.text-muted,
[data-theme="dark"] .badge.text-muted,
.badge-unopened {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  letter-spacing: 0.02em !important;
}

/* Prominent Action Links Inside Cards */
a.text-secondary,
.card a.text-secondary,
a.text-secondary.small,
a.fw-medium.text-secondary {
  color: #7c3aed !important;
  font-weight: 700 !important;
  text-decoration: none !important;
}
a.text-secondary:hover,
.card a.text-secondary:hover,
a.text-secondary.small:hover,
a.fw-medium.text-secondary:hover {
  color: #5b21b6 !important;
  text-decoration: underline !important;
}

/* Footer text */
footer,
footer a,
footer .text-muted,
footer .text-secondary {
  color: #334155 !important;
  font-weight: 500 !important;
}

/* Responsive sidebar logo/brand */
.sidebar-brand {
  min-height: 76px;
  height: auto !important;
  padding: 12px 16px !important;
  gap: 10px !important;
  overflow: hidden;
}
.sidebar-brand > i {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem !important;
}
.sidebar-brand > div {
  min-width: 0;
  flex: 1;
}
.sidebar-brand h5 {
  color: #ffffff !important;
  font-size: clamp(1rem, 1.4vw, 1.35rem) !important;
  line-height: 1.15 !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  margin-bottom: 4px !important;
}
.sidebar-brand .badge {
  max-width: 100%;
  white-space: nowrap;
  font-weight: 900 !important;
}
[data-theme="light"] .sidebar-brand h5 {
  color: #0f172a !important;
}

@media (max-width: 991.98px) {
  .sidebar-brand { min-height: 68px; }
  .sidebar-brand h5 { font-size: 1.05rem !important; }
  .sidebar-brand > i { width: 34px; height: 34px; font-size: 1.75rem !important; }
}
@media (max-width: 390px) {
  .sidebar-brand { padding: 10px 12px !important; }
  .sidebar-brand h5 { font-size: .98rem !important; }
  .sidebar-brand .badge { font-size: .62rem !important; padding: 5px 8px !important; }
}

/* Campaign/contact picker and mobile header final fixes */
.contact-picker{max-height:260px;overflow:auto;border:1px solid rgba(255,255,255,.16);border-radius:16px;background:rgba(2,6,23,.28);padding:10px;display:grid;gap:8px}.contact-pick-item{display:flex;align-items:flex-start;gap:10px;padding:10px;border-radius:12px;border:1px solid rgba(255,255,255,.1);background:rgba(255,255,255,.04);cursor:pointer}.contact-pick-item input{margin-top:4px}.contact-pick-item span{display:flex;flex-direction:column;min-width:0}.contact-pick-item b{color:#fff;overflow-wrap:anywhere}.contact-pick-item small{color:#cbd5e1;overflow-wrap:anywhere}[data-theme="light"] .contact-picker{background:#f8fafc;border-color:#cbd5e1}[data-theme="light"] .contact-pick-item{background:#fff;border-color:#e5e7eb}[data-theme="light"] .contact-pick-item b{color:#111827}[data-theme="light"] .contact-pick-item small{color:#374151}
@media(max-width:767.98px){.app-topbar .badge-status,.app-topbar .text-muted{font-size:.72rem!important}.contact-picker{max-height:220px}.contact-pick-item{padding:9px}.campaign-actions,td .btn,td form{width:100%;display:block!important}.table-glass td:last-child{min-width:150px}}
@media(max-width:420px){.app-topbar .btn{min-height:40px;padding:8px 10px!important}.app-topbar .btn-gradient-primary{width:auto!important}.contact-picker{max-height:190px}}


/* Gmail-like reply inbox and compose UI */
.gmail-compose{background:#fff!important;color:#111827!important;border-radius:16px;overflow:hidden}.compose-line{width:100%;border:0;border-bottom:1px solid #e5e7eb;padding:13px 14px;outline:0;color:#111827;background:#fff}.compose-body{width:100%;border:0;outline:0;padding:14px;color:#111827;background:#fff;resize:vertical}.reply-thread{display:grid;gap:12px}.reply-bubble{padding:14px;border-radius:16px;border:1px solid rgba(255,255,255,.12)}.reply-bubble.inbound{background:rgba(255,255,255,.07)}.reply-bubble.outbound{background:rgba(37,99,235,.18);margin-left:38px}.reply-bubble p{margin:8px 0 0}@media(max-width:575.98px){.reply-bubble.outbound{margin-left:0}.gmail-compose{border-radius:12px}.compose-line,.compose-body{font-size:14px}}

/* Campaign delete action responsiveness */
@media (max-width: 575.98px) {
  td form.d-inline .btn.text-danger { margin-top: 4px !important; }
}

/* =======================================================================
   ENTERPRISE LIGHT UI SYSTEM - High contrast, responsive, all modules
   ======================================================================= */
:root,[data-theme="dark"],[data-theme="light"]{
  --ol-blue:#7C3AED;--ol-blue-dark:#6D28D9;--ol-blue-soft:#F5F3FF;--ol-blue-select:#DDD6FE;
  --ol-bg:#F8FAFC;--ol-surface:#ffffff;--ol-surface-2:#f1f5f9;--ol-border:#cbd5e1;
  --ol-border-soft:#e2e8f0;--ol-text:#0f172a;--ol-text-2:#334155;--ol-muted:#64748b;
  --bg-main:#F8FAFC!important;--bg-sidebar:#fff!important;--bg-card:#fff!important;--bg-card-hover:#f8fafc!important;
  --text-primary:#0f172a!important;--text-secondary:#334155!important;--text-muted:#64748b!important;
  --primary:#7C3AED!important;--primary-hover:#6D28D9!important;--border-color:#cbd5e1!important;
  --glass-bg:#fff!important;--glass-border:1px solid #e2e8f0!important;--gradient-primary:#7C3AED!important;
  --shadow-card:0 1px 3px rgba(0,0,0,.04)!important;--shadow-glow:0 0 0 1px #DDD6FE!important;
}

/* ==========================================================================
   EMAILFLOW PRO SAAS - RESPONSIVE HEADER & LIGHT THEME SYSTEM
   ========================================================================== */

/* 1. Global Font & Theme Tokens */
:root {
  --font-family-base: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --purple-primary: #7C3AED;
  --purple-hover: #6D28D9;
  --purple-light: #F5F3FF;
  --purple-border: #DDD6FE;
}

/* Overriding Bootstrap Blue & Info Utilities to Brand Purple */
.text-primary,
.text-info,
a.text-primary,
a.text-info {
  color: #7C3AED !important;
}

html[data-theme="dark"] .text-primary,
html[data-theme="dark"] .text-info,
html[data-theme="dark"] a.text-primary,
html[data-theme="dark"] a.text-info {
  color: #7C3AED !important;
}

/* Primary Buttons to Solid Purple */
.btn-primary,
.btn-info,
.btn-gradient-primary,
.btn-emerald,
.btn-purple {
  background-color: #7C3AED !important;
  background: #7C3AED !important;
  border-color: #7C3AED !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px rgba(124, 58, 237, 0.2) !important;
}

.btn-primary:hover,
.btn-info:hover,
.btn-gradient-primary:hover,
.btn-emerald:hover,
.btn-purple:hover,
.btn-primary:focus,
.btn-info:focus,
.btn-gradient-primary:focus {
  background-color: #6D28D9 !important;
  background: #6D28D9 !important;
  border-color: #6D28D9 !important;
  color: #ffffff !important;
}

/* Secondary & Outline Purple Buttons */
.btn-outline-emerald,
.btn-glass-emerald {
  background: #ffffff !important;
  border: 1.5px solid #7C3AED !important;
  color: #7C3AED !important;
  font-weight: 700 !important;
}

.btn-outline-emerald:hover,
.btn-glass-emerald:hover {
  background: #7C3AED !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .btn-outline-emerald,
html[data-theme="dark"] .btn-glass-emerald {
  background: #ffffff !important;
  border: 1.5px solid #7C3AED !important;
  color: #7C3AED !important;
}

html[data-theme="dark"] .btn-outline-emerald:hover,
html[data-theme="dark"] .btn-glass-emerald:hover {
  background: #6D28D9 !important;
  color: #ffffff !important;
}

/* Subtle Badges & Background Highlights */
.bg-primary-subtle,
.bg-info-subtle {
  background-color: #F5F3FF !important;
  color: #7C3AED !important;
  border: 1px solid #DDD6FE !important;
}

html[data-theme="dark"] .bg-primary-subtle,
html[data-theme="dark"] .bg-info-subtle {
  background-color: #F5F3FF !important;
  color: #7C3AED !important;
  border: 1px solid #DDD6FE !important;
}

.border-primary-subtle,
.border-info-subtle {
  border-color: #DDD6FE !important;
}

html[data-theme="dark"] .border-primary-subtle,
html[data-theme="dark"] .border-info-subtle {
  border-color: #DDD6FE !important;
}

/* Badge count pills & Status badges */
.badge.bg-primary,
.badge.bg-info,
.badge-status.sending,
.badge-status.active {
  background-color: #7C3AED !important;
  color: #ffffff !important;
}

/* Universal High Contrast Badge Text (e.g. Auto-Rotation) */
.badge.bg-dark,
.badge.bg-dark i,
.badge-dark,
.badge-dark i,
.badge-emerald,
.badge-emerald i {
  color: #ffffff !important;
}

html[data-theme="dark"] .badge.bg-dark,
html[data-theme="dark"] .badge.bg-dark i,
html[data-theme="dark"] .badge-dark,
html[data-theme="dark"] .badge-dark i {
  color: #0F172A !important;
  background-color: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
}

/* Progress Bars - Solid Purple (Brand Primary) */
.progress-bar,
.progress-bar.bg-gradient-primary,
.progress-bar.bg-primary {
  background: #7C3AED !important;
  background-color: #7C3AED !important;
}

html[data-theme="dark"] .progress-bar,
html[data-theme="dark"] .progress-bar.bg-gradient-primary,
html[data-theme="dark"] .progress-bar.bg-primary {
  background: #7C3AED !important;
  background-color: #7C3AED !important;
}

/* ── LIGHT MODE THEME SYSTEM ────────────── */
html[data-theme="light"],
html[data-theme="light"] body {
  background-color: #f8faf9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .app-main,
html[data-theme="light"] .app-content {
  background-color: #f8faf9 !important;
}

html[data-theme="light"] .app-sidebar {
  background-color: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .sidebar-brand {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .sidebar-brand h5,
html[data-theme="light"] .sidebar-title-text {
  color: #0F172A !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .nav-link-item {
  color: #475569 !important;
  font-weight: 500 !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  transition: all 0.15s ease !important;
}

html[data-theme="light"] .nav-link-item i,
html[data-theme="light"] .nav-link-item [data-lucide] {
  color: #64748B !important;
  transition: color 0.15s ease !important;
}

html[data-theme="light"] .nav-link-item:hover {
  background-color: #F8FAFC !important;
  color: #0F172A !important;
}

html[data-theme="light"] .nav-link-item:hover i,
html[data-theme="light"] .nav-link-item:hover [data-lucide],
html[data-theme="light"] .nav-link-item:hover span {
  color: #7C3AED !important;
}

html[data-theme="light"] .nav-link-item.active {
  background-color: #F5F3FF !important;
  color: #7C3AED !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  border: 1px solid #DDD6FE !important;
}

html[data-theme="light"] .nav-link-item.active i,
html[data-theme="light"] .nav-link-item.active [data-lucide],
html[data-theme="light"] .nav-link-item.active span,
html[data-theme="light"] .nav-link-item.active:hover i,
html[data-theme="light"] .nav-link-item.active:hover span {
  color: #7C3AED !important;
}

html[data-theme="light"] .glass-card,
html[data-theme="light"] .card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04) !important;
  color: #0f172a !important;
}

html[data-theme="light"] .table-responsive {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
}

html[data-theme="light"] .table-glass th,
html[data-theme="light"] .table-glass thead tr {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .table-glass td {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .table-glass tr:hover td {
  background-color: #f8fafc !important;
}

html[data-theme="light"] h1, html[data-theme="light"] h2, html[data-theme="light"] h3,
html[data-theme="light"] h4, html[data-theme="light"] h5, html[data-theme="light"] h6,
html[data-theme="light"] .fw-bold {
  color: #0f172a !important;
}

html[data-theme="light"] .text-muted,
html[data-theme="light"] p.text-muted,
html[data-theme="light"] span.text-muted,
html[data-theme="light"] div.text-muted {
  color: #64748b !important;
  opacity: 1 !important;
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select,
html[data-theme="light"] .form-control-glass,
html[data-theme="light"] textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .form-control::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #64748b !important;
}

/* ── UNIVERSAL MASTER LIGHT MODE SYSTEM ────────────── */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html[data-theme="dark"] .app-main,
html[data-theme="dark"] .app-content {
  background-color: #f8fafc !important;
}

html[data-theme="dark"] .app-sidebar {
  background-color: #ffffff !important;
  border-right: 1px solid #e2e8f0 !important;
}

html[data-theme="dark"] .sidebar-brand {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="dark"] .sidebar-brand h5,
html[data-theme="dark"] .sidebar-title-text {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="dark"] .nav-link-item {
  color: #334155 !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
}

html[data-theme="dark"] .nav-link-item i {
  color: #64748B !important;
}

html[data-theme="dark"] .nav-link-item:hover {
  background-color: #F8FAFC !important;
  color: #7C3AED !important;
}

html[data-theme="dark"] .nav-link-item:hover i,
html[data-theme="dark"] .nav-link-item:hover span,
html[data-theme="dark"] .nav-link-item:hover * {
  color: #7C3AED !important;
}

html[data-theme="dark"] .nav-link-item.active {
  background-color: #F5F3FF !important;
  color: #7C3AED !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .nav-link-item.active i,
html[data-theme="dark"] .nav-link-item.active span,
html[data-theme="dark"] .nav-link-item.active:hover i,
html[data-theme="dark"] .nav-link-item.active:hover span,
html[data-theme="dark"] .nav-link-item.active:hover * {
  color: #7C3AED !important;
}

html[data-theme="dark"] .glass-card,
html[data-theme="dark"] .card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
  color: #0f172a !important;
}

html[data-theme="dark"] .table-responsive {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
}

html[data-theme="dark"] .table-glass th,
html[data-theme="dark"] .table-glass thead tr {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
  font-weight: 700 !important;
}

html[data-theme="dark"] .table-glass td {
  background-color: #ffffff !important;
  color: #334155 !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

html[data-theme="dark"] .table-glass tr:hover td {
  background-color: #f8fafc !important;
}

html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6,
html[data-theme="dark"] .fw-bold {
  color: #0f172a !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] p.text-muted,
html[data-theme="dark"] span.text-muted,
html[data-theme="dark"] div.text-muted {
  color: #64748b !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-control-glass,
html[data-theme="dark"] textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #64748b !important;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .form-label {
  color: #0f172a !important;
}

html[data-theme="dark"] .modal-content {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
}

html[data-theme="dark"] .dropdown-menu {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08) !important;
}

html[data-theme="dark"] .dropdown-item {
  color: #334155 !important;
}

html[data-theme="dark"] .dropdown-item:hover {
  background-color: #f5f3ff !important;
  color: #7c3aed !important;
}

/* ── 3. HEADER BAR (RESPONSIVE FLEXBOX & VISIBLE CONTROLS) ────────────── */
.app-topbar,
.outlook-commandbar {
  height: 64px !important;
  min-height: 64px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  padding: 0 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1060 !important;
  gap: 12px !important;
}

/* Light & Unified Header Bar */
html[data-theme="light"] .app-topbar,
html[data-theme="light"] .outlook-commandbar,
html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .outlook-commandbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
}

/* Header Left Group */
.outlook-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-shrink: 1 !important;
  min-width: 0 !important;
}

.outlook-app-title {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 220px !important;
}

html[data-theme="light"] .outlook-app-title,
html[data-theme="light"] .outlook-app-title i {
  color: #7C3AED !important;
}

html[data-theme="dark"] .outlook-app-title,
html[data-theme="dark"] .outlook-app-title i {
  color: #7C3AED !important;
}

/* Header Navigation Links */
.outlook-nav {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

@media (max-width: 1359.98px) {
  .outlook-nav {
    display: none !important;
  }
}

.outlook-nav a {
  text-decoration: none !important;
  padding: 7px 12px !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
  white-space: nowrap !important;
}

html[data-theme="light"] .outlook-nav a {
  color: #334155 !important;
}

html[data-theme="light"] .outlook-nav a:hover,
html[data-theme="light"] .outlook-nav a.active {
  background-color: #F5F3FF !important;
  color: #7C3AED !important;
}

html[data-theme="dark"] .outlook-nav a {
  color: #334155 !important;
}

html[data-theme="dark"] .outlook-nav a:hover,
html[data-theme="dark"] .outlook-nav a.active {
  background-color: #F5F3FF !important;
  color: #7C3AED !important;
}

/* Header Search Container */
.outlook-center {
  flex: 1 !important;
  max-width: 420px !important;
  min-width: 120px !important;
  margin: 0 12px !important;
}

@media (max-width: 767.98px) {
  .outlook-center {
    display: none !important;
  }
}

.outlook-search {
  height: 40px !important;
  border-radius: 50px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 0 16px !important;
  width: 100% !important;
  transition: all 0.2s ease !important;
}

.outlook-search input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  width: 100% !important;
  font-size: 0.88rem !important;
}

.outlook-search input:focus,
.outlook-search input:active {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

html[data-theme="light"] .outlook-search {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .outlook-search i { color: #7C3AED !important; }
html[data-theme="light"] .outlook-search input { color: #0f172a !important; }
html[data-theme="light"] .outlook-search input::placeholder { color: #64748b !important; }

html[data-theme="dark"] .outlook-search {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="dark"] .outlook-search i { color: #7C3AED !important; }
html[data-theme="dark"] .outlook-search input { color: #0f172a !important; }
html[data-theme="dark"] .outlook-search input::placeholder { color: #64748b !important; }

/* Header Right Actions */
.outlook-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
}

/* Header Action Buttons - Universal Visibility */
.outlook-command-btn,
.outlook-icon-btn {
  height: 40px !important;
  min-height: 40px !important;
  border-radius: 10px !important;
  font-weight: 700 !important;
  font-size: 0.88rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 0 14px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
}

.outlook-icon-btn {
  width: 40px !important;
  padding: 0 !important;
}

/* Light Mode Action Buttons */
html[data-theme="light"] .outlook-command-btn,
html[data-theme="light"] .outlook-icon-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .outlook-command-btn:hover,
html[data-theme="light"] .outlook-icon-btn:hover {
  background: #F5F3FF !important;
  color: #7C3AED !important;
}

html[data-theme="light"] #theme-toggle-btn {
  color: #7C3AED !important;
}

html[data-theme="light"] #sidebar-toggle-btn {
  color: #7C3AED !important;
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
}

/* Dark Mode Action Buttons */
html[data-theme="dark"] .outlook-command-btn,
html[data-theme="dark"] .outlook-icon-btn {
  background: #ffffff !important;
  border: 1px solid #E2E8F0 !important;
  color: #0F172A !important;
}

html[data-theme="dark"] .outlook-command-btn:hover,
html[data-theme="dark"] .outlook-icon-btn:hover {
  background: #F5F3FF !important;
  color: #7C3AED !important;
}

html[data-theme="dark"] #theme-toggle-btn {
  color: #7C3AED !important;
}

html[data-theme="dark"] #sidebar-toggle-btn {
  color: #0F172A !important;
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
}

/* Primary "+ New" Button in Topbar */
.outlook-command-btn.btn-primary-emerald,
.btn-primary-emerald {
  background-color: #7C3AED !important;
  background: #7C3AED !important;
  border: 1px solid #7C3AED !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

.outlook-command-btn.btn-primary-emerald:hover,
.btn-primary-emerald:hover {
  background-color: #6D28D9 !important;
  background: #6D28D9 !important;
  border-color: #6D28D9 !important;
  color: #ffffff !important;
}

/* Contact Picker & Miscellaneous Responsive Helpers */
.contact-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 10px;
}

html[data-theme="dark"] .contact-picker-toolbar {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

@media (max-width: 575.98px) {
  .app-topbar,
  .outlook-commandbar {
    padding: 0 10px !important;
    gap: 6px !important;
    height: 52px !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
  }
  .outlook-left {
    gap: 6px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .outlook-app-title {
    max-width: 110px !important;
    font-size: 0.82rem !important;
  }
  .outlook-app-title span {
    display: inline-block !important;
    max-width: 80px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .outlook-actions {
    gap: 4px !important;
    flex-shrink: 0 !important;
  }
  .outlook-command-btn {
    padding: 0 8px !important;
    font-size: 0.76rem !important;
    height: 34px !important;
    min-height: 34px !important;
    gap: 4px !important;
  }
  .outlook-icon-btn {
    width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
  }
}

/* ==========================================================================
   ==========================================================================
   MILLION DOLLAR SAAS PRODUCT DESIGN SYSTEM & ULTRA-RESPONSIVE ENGINE
   Tier-1 Enterprise Aesthetics: Linear / Resend / Stripe / Supabase Inspired
   ==========================================================================
   ========================================================================== */

/* 1. Universal Tactile, Eye-Catchy Button Hierarchy */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  cursor: pointer;
}

/* Shimmer reflection effect on hover */
.btn-gradient-primary::after,
.btn-primary::after,
.btn-gradient-accent::after,
.btn-gradient-warning::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg);
  transition: none;
  pointer-events: none;
}

.btn-gradient-primary:hover::after,
.btn-primary:hover::after,
.btn-gradient-accent:hover::after,
.btn-gradient-warning:hover::after {
  left: 140%;
  transition: all 0.75s ease-in-out;
}

/* Primary Purple SaaS Button */
.btn-gradient-primary,
.btn-primary,
.btn-primary-emerald,
.btn-purple {
  background: #7C3AED !important;
  background-color: #7C3AED !important;
  color: #ffffff !important;
  border: 1px solid #7C3AED !important;
  box-shadow: 0 1px 2px rgba(124, 58, 237, 0.25) !important;
}

.btn-gradient-primary:hover,
.btn-primary:hover,
.btn-primary-emerald:hover,
.btn-purple:hover {
  transform: translateY(-1px);
  background: #6D28D9 !important;
  background-color: #6D28D9 !important;
  border-color: #6D28D9 !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3) !important;
  color: #ffffff !important;
}

.btn-gradient-primary:active,
.btn-primary:active,
.btn-primary-emerald:active,
.btn-purple:active {
  transform: translateY(0);
  background: #5B21B6 !important;
  background-color: #5B21B6 !important;
  box-shadow: 0 1px 2px rgba(124, 58, 237, 0.2) !important;
}

/* Secondary Frosted Acrylic Glass Button */
.btn-glass {
  background: rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #ffffff !important;
  transform: translateY(-1.5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25), 0 0 15px rgba(16, 185, 129, 0.15) !important;
}

.btn-glass:active {
  transform: translateY(1px) scale(0.98);
}

[data-theme="light"] .btn-glass {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

[data-theme="light"] .btn-glass:hover {
  background: #F8FAFC !important;
  border-color: #7C3AED !important;
  color: #7C3AED !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.15) !important;
}

/* Accent Cyan / Info Button */
.btn-gradient-accent,
.btn-gradient-info,
.btn-info {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 8px 24px -4px rgba(6, 182, 212, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.btn-gradient-accent:hover,
.btn-gradient-info:hover,
.btn-info:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 14px 32px -4px rgba(6, 182, 212, 0.6), 0 0 20px rgba(6, 182, 212, 0.3) !important;
  color: #ffffff !important;
}

/* Amber / Warning AI Button */
.btn-gradient-warning,
.btn-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 8px 24px -4px rgba(245, 158, 11, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.btn-gradient-warning:hover,
.btn-warning:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 14px 32px -4px rgba(245, 158, 11, 0.6), 0 0 20px rgba(245, 158, 11, 0.3) !important;
  color: #ffffff !important;
}

/* Crimson Danger Button */
.btn-gradient-danger,
.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 8px 24px -4px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

.btn-gradient-danger:hover,
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -4px rgba(239, 68, 68, 0.55) !important;
  color: #ffffff !important;
}

/* 2. Million Dollar Glass Cards & Stat Blocks */
.glass-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.88) 0%, rgba(13, 18, 30, 0.82) 100%) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(255, 255, 255, 0.09) !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.glass-card:hover {
  border-color: rgba(16, 185, 129, 0.32) !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 25px rgba(16, 185, 129, 0.12) !important;
  transform: translateY(-2px);
}

[data-theme="light"] .glass-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}

[data-theme="light"] .glass-card:hover {
  border-color: #7C3AED !important;
  box-shadow: 0 16px 36px -8px rgba(124, 58, 237, 0.15) !important;
}

/* 3. Stat Cards with 3D Glowing Capsules & Anti-Collision Layout */
.stat-card {
  padding: 18px 20px !important;
  position: relative;
  overflow: hidden;
  border-radius: 16px !important;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.stat-card > .d-flex {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 12px !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.stat-card > .d-flex > div:first-child {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.stat-icon {
  width: 46px !important;
  height: 46px !important;
  flex: 0 0 46px !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  border-radius: 14px !important;
  display: grid !important;
  place-items: center !important;
  font-size: 1.35rem !important;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.stat-val {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 4px 0 6px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-val.fs-5,
.stat-val.stat-val-sm,
.stat-val-sm {
  font-size: 1.1rem !important;
  white-space: normal !important;
  line-height: 1.25 !important;
  letter-spacing: -0.01em !important;
}

.stat-label {
  font-size: 0.74rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  opacity: 0.9;
  display: block;
}

/* 4. Pulse Badges & Micro-Animations */
.badge-status {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.badge-status.sending {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

.badge-status.sending::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: live-pulse 1.8s infinite;
}

@keyframes live-pulse {
  0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* 5. Tables & Horizontal Scrolling Polish */
.table-responsive {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.4);
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(4, 120, 87, 0.4);
  border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(4, 120, 87, 0.7);
}

[data-theme="light"] .table-responsive {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.table-glass {
  margin-bottom: 0 !important;
  width: 100%;
}

.table-glass thead th {
  background: #f8fafc !important;
  padding: 14px 18px !important;
  font-size: 0.74rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: #0f172a !important;
  border-bottom: 1px solid #cbd5e1 !important;
  white-space: nowrap;
}

[data-theme="light"] .table-glass thead th,
[data-theme="dark"] .table-glass thead th {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

.table-glass tbody td {
  padding: 16px 18px !important;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  transition: background 0.15s ease;
}

[data-theme="light"] .table-glass tbody td {
  border-bottom: 1px solid #f1f5f9 !important;
}

.table-glass tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="light"] .table-glass tbody tr:hover td {
  background: #f8fafc !important;
}

/* 6. Form Controls & Focus Halos */
.form-control,
.form-select,
.form-control-glass {
  border-radius: 12px !important;
  padding: 12px 16px !important;
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

.form-control:focus,
.form-select:focus,
.form-control-glass:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25) !important;
}

/* Form check input base */
.form-check-input {
  cursor: pointer;
  box-shadow: none !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.6);
}

/* ==========================================================================
   7. Deep Multi-Device Responsive Architecture
   ========================================================================== */

/* Small Phones (< 576px) */
@media (max-width: 575.98px) {
  .app-content {
    padding: 14px 10px !important;
  }
  
  /* Make Stat Cards 2x2 grid on small screens */
  .row.g-4 > [class*="col-xl-3"] {
    width: 50% !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
    margin-bottom: 10px !important;
  }
  
  .stat-card {
    padding: 14px 12px !important;
    border-radius: 14px !important;
  }
  
  .stat-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.15rem !important;
    border-radius: 10px !important;
  }
  
  .stat-val {
    font-size: 1.35rem !important;
    margin: 4px 0 !important;
  }
  
  .stat-label {
    font-size: 0.68rem !important;
  }
  
  /* Buttons expand for comfortable touch */
  .btn-gradient-primary.w-100,
  .btn.w-100 {
    font-size: 0.9rem !important;
    padding: 12px 16px !important;
  }

  /* Table responsive wrap */
  .table-glass {
    min-width: 720px !important;
  }
  
  /* Modal Edge-to-Edge Sheet on mobile */
  .modal-dialog {
    width: 100% !important;
    margin: 0 !important;
    min-height: 100vh !important;
  }
  .modal-content {
    border-radius: 0 !important;
    min-height: 100vh !important;
    border: none !important;
  }
}

/* Tablets & Small Laptops (< 991.98px) */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8) !important;
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .app-content {
    padding: 20px 16px !important;
  }
  
  /* Ensure header elements wrap neatly */
  .page-header,
  .page-title-bar,
  .d-flex.align-items-center.justify-content-between.mb-4:not(.no-stack) {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }
  .page-header > .d-flex,
  .page-title-bar > .d-flex,
  .d-flex.align-items-center.justify-content-between.mb-4:not(.no-stack) > .d-flex {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
}

/* Large Screens (> 1600px) */
@media (min-width: 1600px) {
  .app-content {
    padding: 36px 48px !important;
    max-width: 1800px;
    margin: 0 auto;
  }
}

/* ==========================================================================
   8. Million Dollar SaaS Product Design System — Tactile Buttons & Elements
   ========================================================================== */

/* Shimmer reflection animation for primary CTAs */
@keyframes shimmerReflection {
  0% { transform: translateX(-100%) rotate(25deg); }
  100% { transform: translateX(250%) rotate(25deg); }
}

.btn-gradient-primary {
  background: #7C3AED !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  letter-spacing: 0.2px;
  border: 1px solid #7C3AED !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.25) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  border-radius: 10px !important;
}

.btn-gradient-primary:hover {
  background: #6D28D9 !important;
  border-color: #6D28D9 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35) !important;
}

.btn-gradient-primary:active {
  transform: translateY(0px) !important;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.2) !important;
}

.btn-gradient-accent {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #818cf8 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35) !important;
  transition: all 0.2s ease !important;
  border-radius: 10px !important;
}

.btn-gradient-accent:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.45) !important;
  color: #ffffff !important;
}

.btn-gradient-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35) !important;
  transition: all 0.2s ease !important;
  border-radius: 10px !important;
}

.btn-gradient-warning:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 22px rgba(245, 158, 11, 0.45) !important;
}

.btn-gradient-danger {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f87171 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35) !important;
  transition: all 0.2s ease !important;
  border-radius: 10px !important;
}

.btn-gradient-danger:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 22px rgba(239, 68, 68, 0.45) !important;
  color: #ffffff !important;
}

.btn-glass {
  background: #ffffff !important;
  border: 1px solid #E2E8F0 !important;
  color: #0F172A !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  transition: all 0.2s ease !important;
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
}

.btn-glass.active,
.btn-glass:active {
  background: #7C3AED !important;
  border-color: #7C3AED !important;
  color: #ffffff !important;
}

[data-theme="light"] .btn-glass {
  background: #ffffff !important;
  border: 1px solid #E2E8F0 !important;
  color: #0F172A !important;
}

[data-theme="light"] .btn-glass:hover {
  background: #F8FAFC !important;
  border-color: #CBD5E1 !important;
  color: #7C3AED !important;
}

[data-theme="light"] .btn-glass.active {
  background: #7C3AED !important;
  border-color: #7C3AED !important;
  color: #ffffff !important;
}

/* Open Email Tracking Badges & Indicators */
.badge-opened {
  background: rgba(6, 182, 212, 0.14) !important;
  color: #06b6d4 !important;
  border: 1px solid rgba(6, 182, 212, 0.3) !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 0.72rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.15) !important;
}

.badge-opened-fire {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.18)) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 0.72rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.badge-unopened {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 0.72rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

/* Visual Workflow Styling */
.workflow-node {
  position: relative;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  transition: all 0.2s ease;
}

.workflow-node:hover {
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.workflow-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  color: #10b981;
  font-size: 1.2rem;
}

/* Template Cards with Hover Depth */
.template-card {
  border-radius: 14px !important;
  overflow: hidden !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
}

.template-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-theme="light"] .template-card {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .template-card:hover {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08) !important;
  border-color: #7C3AED !important;
}

/* ==========================================================================
   9. Universal Responsive Polish & Multi-Device Perfection Engine
   ========================================================================== */

/* Universal Header & Action Wrap Containment */
.page-header-box,
.page-header,
.page-title-bar,
.app-content > .d-flex.align-items-center.justify-content-between.mb-4,
.app-content > div:first-child.d-flex.justify-content-between {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px 20px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  margin-bottom: 24px !important;
}

.page-header-title,
.app-content > .d-flex.align-items-center.justify-content-between.mb-4 > div:first-child {
  min-width: 240px;
  flex: 1 1 auto;
  max-width: 100%;
}

.page-header-actions,
.header-actions,
.app-content > .d-flex.align-items-center.justify-content-between.mb-4 > .d-flex:last-child {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px 12px !important;
  flex: 0 1 auto;
  max-width: 100% !important;
}

/* Light / Dark Adaptive Credential Badges */
.credential-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

html[data-theme="light"] .credential-badge {
  background: #F5F3FF !important;
  color: #7C3AED !important;
  border: 1px solid #DDD6FE !important;
}

html[data-theme="dark"] .credential-badge {
  background: rgba(15, 23, 42, 0.85) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Sleek SaaS Category Filter Pills */
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  border: 1px solid transparent;
}

html[data-theme="light"] .category-pill {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .category-pill:hover {
  background: #F5F3FF;
  color: #7C3AED;
  border-color: #DDD6FE;
  transform: translateY(-1px);
}

html[data-theme="light"] .category-pill.active {
  background: #7C3AED !important;
  color: #ffffff !important;
  border-color: #7C3AED !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.28) !important;
}

html[data-theme="dark"] .category-pill {
  background: #ffffff;
  color: #0F172A;
  border-color: #E2E8F0;
}

html[data-theme="dark"] .category-pill:hover {
  background: #F5F3FF;
  color: #7C3AED;
  border-color: #DDD6FE;
  transform: translateY(-1px);
}

html[data-theme="dark"] .category-pill.active {
  background: #7C3AED !important;
  color: #ffffff !important;
  border-color: #7C3AED !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3) !important;
}

.category-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

html[data-theme="light"] .category-pill-count {
  background: #e2e8f0;
  color: #1e293b;
}

html[data-theme="light"] .category-pill.active .category-pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

html[data-theme="dark"] .category-pill-count {
  background: #F1F5F9;
  color: #0F172A;
}

html[data-theme="dark"] .category-pill.active .category-pill-count {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* Category Pill Action Sub-Buttons */
.category-btn-group {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  margin-bottom: 6px;
  border-radius: 50px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .category-btn-group {
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

html[data-theme="dark"] .category-btn-group {
  border: 1px solid #E2E8F0;
  background: #ffffff;
}

.category-btn-main {
  border: none !important;
  background: transparent !important;
  padding: 6px 12px !important;
  font-size: 0.83rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

html[data-theme="light"] .category-btn-main {
  color: #334155 !important;
}

html[data-theme="light"] .category-btn-main:hover {
  color: #7C3AED !important;
}

html[data-theme="dark"] .category-btn-main {
  color: #334155 !important;
}

html[data-theme="dark"] .category-btn-main:hover {
  color: #7C3AED !important;
}

.category-btn-group.active {
  background: #7C3AED !important;
  border-color: #7C3AED !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3) !important;
}

.category-btn-group.active .category-btn-main,
.category-btn-group.active .category-btn-main * {
  color: #ffffff !important;
}

.category-btn-action {
  border: none !important;
  background: transparent !important;
  padding: 6px 8px !important;
  font-size: 0.78rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.category-btn-action:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Tablet & Mobile Media Queries */
@media (max-width: 991.98px) {
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .app-content {
    padding: 20px 16px !important;
  }
  .outlook-nav {
    display: none !important;
  }
  .page-header-box,
  .app-content > .d-flex.align-items-center.justify-content-between.mb-4 {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .page-header-actions,
  .app-content > .d-flex.align-items-center.justify-content-between.mb-4 > .d-flex:last-child {
    width: 100% !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 575.98px) {
  .app-content {
    padding: 14px 12px !important;
  }
  .app-topbar {
    padding: 0 12px !important;
  }
  .stat-card {
    padding: 14px 14px !important;
  }
  .stat-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.15rem !important;
  }
  .stat-val {
    font-size: 1.35rem !important;
  }
}


