/* 
 * 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
   ========================================================================== */

/* Dark Mode Theme Variables (Default) */
:root,
[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-sidebar: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.9);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --border-color: rgba(255, 255, 255, 0.18);
  --border-glow: rgba(99, 102, 241, 0.5);
  
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --label-color: #f8fafc;
  
  --input-bg: #0f172a;
  --input-border: 1.5px solid rgba(255, 255, 255, 0.28);
  --input-text: #ffffff;
  --input-placeholder: #cbd5e1;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --accent: #06b6d4;
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #2563eb 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 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.4);
  
  --glass-bg: rgba(15, 23, 42, 0.9);
  --glass-border: 1px solid rgba(255, 255, 255, 0.18);
  --backdrop-blur: blur(16px);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 50px;
}

/* Light Mode Theme Variables */
[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-glow: rgba(99, 102, 241, 0.3);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --label-color: #0f172a;
  
  --input-bg: #ffffff;
  --input-border: 1.5px solid #cbd5e1;
  --input-text: #0f172a;
  --input-placeholder: #64748b;
  
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: 1px solid #e2e8f0;
}

/* ==========================================================================
   2. Global Typography & Core Overrides
   ========================================================================== */
* {
  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.3s ease, color 0.3s ease;
}

/* Dark Mode Typography Enforcement */
[data-theme="dark"], body:not([data-theme="light"]) {
  color: #f8fafc !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 {
  color: #ffffff !important;
  font-weight: 800;
}

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

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

/* Light Mode Typography Enforcement */
[data-theme="light"] {
  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"] .text-secondary,
[data-theme="light"] .extra-small {
  color: #475569 !important;
  opacity: 1 !important;
}

/* 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 for Dark Mode (Fixes dark-on-dark text) */
[data-theme="dark"] label,
[data-theme="dark"] .form-label,
[data-theme="dark"] .stat-label {
  color: #f8fafc !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-black {
  color: #f8fafc !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;
}

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

[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;
}

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

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-control-glass::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #cbd5e1 !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;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.app-topbar {
  height: 70px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-content {
  padding: 30px;
  flex: 1;
}

/* ==========================================================================
   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 {
  color: #e2e8f0 !important;
}

[data-theme="light"] .stat-label {
  color: #475569 !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 {
  color: #cbd5e1 !important;
}

[data-theme="light"] .table-glass th {
  color: #475569 !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,
.form-check-input {
  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 {
    flex-direction: column;
  }
  .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: 100%;
    justify-content: center;
  }
  .btn-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }
  .btn-group .btn {
    border-radius: 12px !important;
    width: 100%;
  }
  .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 { grid-template-columns: 1fr; }
}

@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; }
  .d-flex.gap-2 > .btn,
  .d-flex.gap-3 > .btn,
  .d-flex.gap-2 > a.btn,
  .d-flex.gap-3 > a.btn { flex: 1 1 100%; justify-content: center; }

  /* 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 { width: 100%; justify-content: center; }
  .btn-sm { min-height: 40px; }
  form.d-inline { display: block !important; width: 100%; }
  form.d-inline .btn, td .btn, td form .btn { width: 100%; margin: 4px 0 !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;
}

/* Stronger light-theme text visibility */
[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"] label.text-muted,
[data-theme="light"] .text-secondary,
[data-theme="light"] .extra-small {
  color: #111827 !important;
  opacity: 1 !important;
}
[data-theme="light"] .badge.bg-secondary-subtle,
[data-theme="light"] .badge.text-muted,
[data-theme="light"] .bg-secondary-subtle.text-muted {
  background: #e5e7eb !important;
  color: #111827 !important;
  border: 1px solid #9ca3af !important;
}
[data-theme="light"] footer,
[data-theme="light"] footer a,
[data-theme="light"] footer .text-muted {
  color: #111827 !important;
}

/* Better dark-theme gray visibility too */
[data-theme="dark"] .text-muted,
[data-theme="dark"] span.text-muted,
[data-theme="dark"] div.text-muted,
[data-theme="dark"] p.text-muted,
[data-theme="dark"] small.text-muted,
[data-theme="dark"] label.text-muted,
[data-theme="dark"] .text-secondary,
[data-theme="dark"] .extra-small {
  color: #e2e8f0 !important;
  opacity: 1 !important;
}
[data-theme="dark"] .badge.bg-secondary-subtle,
[data-theme="dark"] .badge.text-muted,
[data-theme="dark"] .bg-secondary-subtle.text-muted {
  background: rgba(226,232,240,.92) !important;
  color: #0f172a !important;
  border: 1px solid rgba(255,255,255,.65) !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{height:auto!important;min-height:64px;padding:10px 12px!important;gap:10px;flex-wrap:wrap}.app-topbar>.d-flex{width:100%;justify-content:space-between}.app-topbar .btn-gradient-primary span{display:inline!important}.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; }
}

/* =======================================================================
   FINAL OUTLOOK UI SYSTEM - high contrast, responsive, all modules
   ======================================================================= */
:root,[data-theme="dark"],[data-theme="light"]{
  --ol-blue:#047857;--ol-blue-dark:#065f46;--ol-blue-soft:#e6f4ea;--ol-blue-select:#d1fae5;
  --ol-bg:#f8faf9;--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:#f8faf9!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:#047857!important;--primary-hover:#065f46!important;--border-color:#cbd5e1!important;
  --glass-bg:#fff!important;--glass-border:1px solid #e2e8f0!important;--gradient-primary:linear-gradient(180deg,#047857,#065f46)!important;
  --shadow-card:0 1px 3px rgba(0,0,0,.04)!important;--shadow-glow:0 0 0 1px #a7f3d0!important;
}

/* ==========================================================================
   WEB ULTIMAX EMAIL AUTOMATION - RESPONSIVE HEADER & DARK/LIGHT THEME SYSTEM
   ========================================================================== */

/* 1. Global Font & Theme Tokens */
:root {
  --font-family-base: 'Plus Jakarta Sans', 'Montserrat', system-ui, -apple-system, sans-serif;
  --emerald-primary: #047857;
  --emerald-hover: #065f46;
  --emerald-light: #e6f4ea;
  --emerald-border: #a7f3d0;
}

html, body, * {
  font-family: var(--font-family-base) !important;
}

/* Overriding Bootstrap Blue & Info Utilities to Emerald Green (No Blue) */
.text-primary,
.text-info,
a.text-primary,
a.text-info {
  color: #047857 !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: #10b981 !important;
}

/* Primary & Gradient Buttons to Solid Emerald Green (Matching Reference Pic) */
.btn-primary,
.btn-info,
.btn-gradient-primary,
.btn-emerald {
  background-color: #047857 !important;
  background: #047857 !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.2) !important;
}

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

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

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

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

html[data-theme="dark"] .btn-outline-emerald:hover,
html[data-theme="dark"] .btn-glass-emerald:hover {
  background: #10b981 !important;
  color: #090d16 !important;
}

/* Subtle Badges & Background Highlights */
.bg-primary-subtle,
.bg-info-subtle {
  background-color: #e6f4ea !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
}

html[data-theme="dark"] .bg-primary-subtle,
html[data-theme="dark"] .bg-info-subtle {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

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

html[data-theme="dark"] .border-primary-subtle,
html[data-theme="dark"] .border-info-subtle {
  border-color: rgba(16, 185, 129, 0.3) !important;
}

/* Badge count pills & Status badges */
.badge.bg-primary,
.badge.bg-info,
.badge-status.sending,
.badge-status.active {
  background-color: #047857 !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: #ffffff !important;
  background-color: #1a1a1a !important;
  border-color: #333333 !important;
}

/* Progress Bars - Solid Emerald Green (No Blue Gradients) */
.progress-bar,
.progress-bar.bg-gradient-primary,
.progress-bar.bg-primary {
  background: #047857 !important;
  background-color: #047857 !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: #10b981 !important;
  background-color: #10b981 !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: #047857 !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .nav-link-item {
  color: #334155 !important;
  font-weight: 600 !important;
  border-radius: 9px !important;
  padding: 10px 12px !important;
  transition: all 0.2s ease !important;
  border-left: 3px solid transparent !important;
}

html[data-theme="light"] .nav-link-item i {
  color: #2563eb !important;
  transition: color 0.2s ease, transform 0.2s ease !important;
}

html[data-theme="light"] .nav-link-item:hover {
  background-color: rgba(37, 99, 235, 0.06) !important;
  color: #1d4ed8 !important;
}

html[data-theme="light"] .nav-link-item:hover i {
  color: #1d4ed8 !important;
  transform: scale(1.06);
}

html[data-theme="light"] .nav-link-item:hover span:not(.badge) {
  color: #1d4ed8 !important;
}

html[data-theme="light"] .nav-link-item.active,
html[data-theme="light"] .nav-link-item.active:hover {
  background-color: rgba(37, 99, 235, 0.09) !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  border-left: 3.5px solid #2563eb !important;
  box-shadow: none !important;
}

html[data-theme="light"] .nav-link-item.active i {
  color: #2563eb !important;
}

html[data-theme="light"] .nav-link-item.active span:not(.badge) {
  color: #1d4ed8 !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;
}

/* ── TRUE PURE BLACK DARK MODE SYSTEM ────────────── */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #050505 !important; /* Pure Jet Black Base */
  color: #ffffff !important;
}

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

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

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

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

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

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

html[data-theme="dark"] .nav-link-item:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

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

html[data-theme="dark"] .nav-link-item:hover span:not(.badge) {
  color: #ffffff !important;
}

html[data-theme="dark"] .nav-link-item.active,
html[data-theme="dark"] .nav-link-item.active:hover {
  background-color: rgba(37, 99, 235, 0.22) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  border-left: 3.5px solid #3b82f6 !important;
  box-shadow: none !important;
}

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

html[data-theme="dark"] .nav-link-item.active span:not(.badge) {
  color: #ffffff !important;
}

html[data-theme="dark"] .glass-card,
html[data-theme="dark"] .card {
  background-color: #111111 !important;
  border: 1px solid #222222 !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8) !important;
  color: #ffffff !important;
}

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

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

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

html[data-theme="dark"] .table-glass tr:hover td {
  background-color: #181818 !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: #ffffff !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: #9ca3af !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: #080808 !important;
  color: #ffffff !important;
  border: 1.5px solid #2a2a2a !important;
}

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

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

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

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

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

html[data-theme="dark"] .dropdown-item:hover {
  background-color: #1c1c1c !important;
  color: #10b981 !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 Header Bar */
html[data-theme="light"] .app-topbar,
html[data-theme="light"] .outlook-commandbar {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
}

/* Dark Header Bar */
html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .outlook-commandbar {
  background: #0d131f !important;
  border-bottom: 1px solid #1f293d !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !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: #047857 !important;
}

html[data-theme="dark"] .outlook-app-title,
html[data-theme="dark"] .outlook-app-title i {
  color: #10b981 !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: #e6f4ea !important;
  color: #047857 !important;
}

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

html[data-theme="dark"] .outlook-nav a:hover,
html[data-theme="dark"] .outlook-nav a.active {
  background-color: #161f2e !important;
  color: #10b981 !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: #047857 !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: #111111 !important;
  border: 1px solid #222222 !important;
}

html[data-theme="dark"] .outlook-search i { color: #10b981 !important; }
html[data-theme="dark"] .outlook-search input { color: #ffffff !important; }
html[data-theme="dark"] .outlook-search input::placeholder { color: #9ca3af !important; }

/* Brand Logo Styles (Sidebar & Topbar) */
.sidebar-brand-wrapper {
  padding: 16px 20px !important;
  display: flex !important;
  align-items: center !important;
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)) !important;
  min-height: 74px !important;
  box-sizing: border-box !important;
}
.sidebar-brand-link {
  display: flex !important;
  align-items: center !important;
  text-decoration: none !important;
  width: 100% !important;
}
.sidebar-brand-logo {
  max-height: 42px !important;
  max-width: 100% !important;
  height: auto !important;
  width: auto !important;
  object-fit: contain !important;
  transition: transform 0.2s ease !important;
}
.sidebar-brand-link:hover .sidebar-brand-logo {
  transform: scale(1.02);
}

.topbar-brand-link {
  display: inline-flex !important;
  align-items: center !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
}
.topbar-brand-logo {
  max-height: 38px !important;
  max-width: 190px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  transition: opacity 0.2s ease !important;
}

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

/* Header Action Buttons - Universal Alignment & Shape */
.outlook-action-btn,
.outlook-command-btn,
.outlook-icon-btn {
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 9px !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 0 13px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  border: 1px solid transparent !important;
}

.outlook-action-btn.dropdown-toggle::after,
.outlook-command-btn.dropdown-toggle::after {
  margin-left: 5px !important;
  vertical-align: middle !important;
}

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

/* Primary "+ New" Button in Topbar */
.outlook-action-btn.btn-primary-action,
.outlook-command-btn.btn-primary-emerald,
.btn-primary-emerald {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  border: 1px solid #047857 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(4, 120, 87, 0.28) !important;
}
.outlook-action-btn.btn-primary-action:hover,
.outlook-command-btn.btn-primary-emerald:hover,
.btn-primary-emerald:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(4, 120, 87, 0.38) !important;
}

/* Secondary "Apps" Button in Topbar */
html[data-theme="light"] .outlook-action-btn.btn-secondary-action,
html[data-theme="light"] .outlook-command-btn:not(.btn-primary-emerald),
html[data-theme="light"] .outlook-icon-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}
html[data-theme="light"] .outlook-action-btn.btn-secondary-action:hover,
html[data-theme="light"] .outlook-command-btn:not(.btn-primary-emerald):hover,
html[data-theme="light"] .outlook-icon-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #047857 !important;
}

html[data-theme="dark"] .outlook-action-btn.btn-secondary-action,
html[data-theme="dark"] .outlook-command-btn:not(.btn-primary-emerald),
html[data-theme="dark"] .outlook-icon-btn {
  background: #131d2e !important;
  border: 1px solid #22344f !important;
  color: #f1f5f9 !important;
}
html[data-theme="dark"] .outlook-action-btn.btn-secondary-action:hover,
html[data-theme="dark"] .outlook-command-btn:not(.btn-primary-emerald):hover,
html[data-theme="dark"] .outlook-icon-btn:hover {
  background: #1a273e !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}

html[data-theme="light"] #theme-toggle-btn {
  color: #047857 !important;
}
html[data-theme="dark"] #theme-toggle-btn {
  color: #f59e0b !important;
}
html[data-theme="light"] #sidebar-toggle-btn {
  color: #047857 !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}
html[data-theme="dark"] #sidebar-toggle-btn {
  color: #ffffff !important;
  background: #131d2e !important;
  border: 1px solid #22344f !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: #142238 !important;
  border-color: #1e3252 !important;
}

@media (max-width: 575.98px) {
  .app-topbar,
  .outlook-commandbar {
    padding: 0 12px !important;
    gap: 8px !important;
    height: 58px !important;
    min-height: 58px !important;
    flex-wrap: nowrap !important;
  }
  .outlook-left {
    gap: 8px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .topbar-brand-logo {
    max-height: 28px !important;
    max-width: 120px !important;
  }
  .outlook-actions {
    gap: 6px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }
  .outlook-action-btn,
  .outlook-command-btn {
    height: 36px !important;
    min-height: 36px !important;
    width: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }
  .outlook-action-btn.dropdown-toggle::after,
  .outlook-command-btn.dropdown-toggle::after {
    display: none !important;
  }
  .outlook-icon-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 8px !important;
  }
}


/* ========================================================================== 
   Skyhoora-inspired clean blue interface — 2026 responsive refresh
   ========================================================================== */
:root,
[data-theme="light"] {
  --primary: #2f6df6 !important;
  --primary-hover: #2458d8;
  --primary-soft: #edf3ff;
  --primary-softer: #f6f9ff;
  --navy: #09173d;
  --blue-ink: #17306e;
  --mint: #22b979;
  --mint-soft: #eafaf3;
  --bg-main: #f7f9fd;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fbfcff;
  --border-color: #e7ebf3;
  --text-primary: #0b1838;
  --text-secondary: #56647f;
  --text-muted: #7c889f;
  --input-bg: #ffffff;
  --input-text: #0b1838;
  --input-placeholder: #9aa5b8;
  --glass-bg: #ffffff;
  --glass-border: 1px solid #e7ebf3;
  --gradient-primary: linear-gradient(135deg, #3779ff 0%, #2458d8 100%);
  --shadow-card: 0 8px 28px rgba(31, 56, 112, .07);
  --shadow-lift: 0 16px 38px rgba(31, 71, 155, .12);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --primary: #5e8fff !important;
  --primary-hover: #7da5ff;
  --primary-soft: rgba(69, 116, 232, .16);
  --primary-softer: rgba(69, 116, 232, .08);
  --navy: #f5f8ff;
  --blue-ink: #c8d8ff;
  --mint: #55d39c;
  --mint-soft: rgba(55, 180, 126, .12);
  --bg-main: #0c1220;
  --bg-sidebar: #101827;
  --bg-card: #141e30;
  --bg-card-hover: #18243a;
  --border-color: rgba(208, 221, 255, .12);
  --text-primary: #f5f8ff;
  --text-secondary: #b6c2d9;
  --text-muted: #8d9ab2;
  --input-bg: #111b2c;
  --input-text: #f5f8ff;
  --glass-bg: #141e30;
  --glass-border: 1px solid rgba(208, 221, 255, .12);
  --gradient-primary: linear-gradient(135deg, #5e8fff 0%, #3768dc 100%);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, .2);
  --shadow-lift: 0 18px 42px rgba(0, 0, 0, .3);
}

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(circle at 78% -10%, rgba(47,109,246,.08), transparent 28rem),
    var(--bg-main) !important;
  color: var(--text-primary);
  font-family: "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
  letter-spacing: -.01em;
}

::selection { background: rgba(47,109,246,.2); color: var(--text-primary); }

a { transition: color .2s ease, background-color .2s ease, border-color .2s ease, opacity .2s ease; }

/* Refined shell */
.app-sidebar {
  width: 256px;
  background: var(--bg-sidebar) !important;
  border-right: 1px solid var(--border-color) !important;
  box-shadow: 8px 0 30px rgba(30, 61, 127, .035);
}

.sidebar-brand {
  min-height: 74px;
  padding: 16px 18px !important;
  border-bottom: 1px solid var(--border-color) !important;
  gap: 11px;
}

.sidebar-brand > i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  color: #fff !important;
  background: var(--gradient-primary);
  box-shadow: 0 8px 18px rgba(47,109,246,.24);
  font-size: 1.1rem !important;
}

.sidebar-brand h5,
.sidebar-title-text { color: var(--navy) !important; font-size: .93rem; letter-spacing: -.025em; }
.sidebar-brand .badge { background: var(--mint-soft) !important; color: var(--mint) !important; border: 0 !important; }
.sidebar-menu { padding: 14px 12px 24px; }
.menu-category {
  color: var(--text-muted) !important;
  font-size: .65rem !important;
  line-height: 1;
  letter-spacing: .12em !important;
  padding: 14px 10px 7px;
  margin: 0 !important;
}

.nav-link-item {
  min-height: 44px;
  margin: 3px 0;
  padding: 10px 12px !important;
  border-radius: 10px;
  color: var(--text-secondary) !important;
  font-size: .84rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  transition: color .2s ease, background .2s ease, transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease !important;
}

.nav-link-item i { color: #7785a1 !important; font-size: 1rem; transition: transform .25s ease, color .2s ease; }
.nav-link-item:hover {
  color: var(--primary) !important;
  background: var(--primary-softer) !important;
  transform: translateX(2px);
}
.nav-link-item:hover i { color: var(--primary) !important; transform: scale(1.06); }
.nav-link-item.active,
.nav-link-item.active:hover {
  color: var(--primary) !important;
  background: var(--primary-soft) !important;
  box-shadow: inset 0 0 0 1px rgba(47,109,246,.08);
}
.nav-link-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
}
.nav-link-item.active i,
.nav-link-item.active span,
.nav-link-item.active * { color: var(--primary) !important; }

.sidebar-footer-user { background: var(--bg-sidebar); border-color: var(--border-color) !important; }
.sidebar-user-name { color: var(--navy) !important; }
.sidebar-avatar-circle { background: var(--primary-soft) !important; border-color: rgba(47,109,246,.15) !important; }
.sidebar-avatar-circle i,
.text-emerald { color: var(--primary) !important; }

.app-main { margin-left: 256px; background: transparent; }
.app-topbar,
.outlook-commandbar {
  height: 74px !important;
  min-height: 74px;
  padding: 0 28px !important;
  background: color-mix(in srgb, var(--bg-sidebar) 94%, transparent) !important;
  border-bottom: 1px solid var(--border-color) !important;
  box-shadow: none !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.outlook-app-title { color: var(--navy) !important; font-weight: 750; }
.outlook-app-title i { color: var(--primary) !important; }
.outlook-nav { gap: 4px; }
.outlook-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 0 !important;
  padding: 0 12px !important;
  color: var(--text-secondary) !important;
  font-weight: 650;
}
.outlook-nav a:hover { color: var(--primary) !important; background: var(--primary-softer); }
.outlook-nav a.active { color: var(--primary) !important; background: var(--primary-soft); }

.outlook-search {
  height: 42px;
  max-width: 360px;
  background: var(--bg-main) !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}
.outlook-search:focus-within { background: var(--bg-card) !important; border-color: rgba(47,109,246,.45) !important; box-shadow: 0 0 0 4px rgba(47,109,246,.09) !important; }
.outlook-search i { color: var(--text-muted); }
.outlook-search input { color: var(--text-primary) !important; }

.outlook-command-btn,
.outlook-icon-btn,
.btn {
  min-height: 42px;
  border-radius: 9px !important;
  font-weight: 650;
  box-shadow: none !important;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease !important;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.outlook-command-btn.btn-primary-emerald,
.btn-primary,
.btn-gradient-primary,
.btn-success {
  color: #fff !important;
  background: var(--gradient-primary) !important;
  border-color: transparent !important;
  box-shadow: 0 8px 18px rgba(47,109,246,.18) !important;
}
.outlook-command-btn.btn-primary-emerald:hover,
.btn-primary:hover,
.btn-gradient-primary:hover,
.btn-success:hover { box-shadow: 0 10px 24px rgba(47,109,246,.25) !important; }
.btn-outline-success { color: var(--primary) !important; border-color: rgba(47,109,246,.3) !important; }
.btn-outline-success:hover { color: #fff !important; background: var(--primary) !important; border-color: var(--primary) !important; }

.app-content { padding: 30px 32px 44px !important; max-width: 1600px; width: 100%; margin-inline: auto; }
.app-content > .d-flex:first-child { gap: 20px; }
.app-content h1,
.app-content h2,
.app-content h3,
.app-content h4,
.app-content h5,
.app-content h6 { color: var(--navy) !important; letter-spacing: -.025em; }

/* Cards and metric surfaces */
.glass-card,
.card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-card) !important;
  backdrop-filter: none !important;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .25s ease !important;
}
.glass-card:hover,
.card:hover { transform: translateY(-2px); border-color: rgba(47,109,246,.18) !important; box-shadow: var(--shadow-lift) !important; }
.stat-card { min-height: 146px; padding: 22px !important; }
.stat-card::after { display: none !important; }
.stat-label { color: var(--text-muted) !important; font-size: .68rem !important; letter-spacing: .09em !important; }
.stat-val { color: var(--navy) !important; font-size: clamp(1.45rem, 2vw, 2rem) !important; letter-spacing: -.04em; margin: 7px 0 4px; }
.stat-icon {
  width: 48px !important;
  height: 48px !important;
  border-radius: 12px !important;
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  box-shadow: none !important;
}
.stat-icon i { color: currentColor !important; }
.bg-primary.bg-gradient.stat-icon,
.bg-info.bg-gradient.stat-icon { background: var(--primary-soft) !important; color: var(--primary) !important; }
.bg-success.bg-gradient.stat-icon { background: var(--mint-soft) !important; color: var(--mint) !important; }
.bg-warning.bg-gradient.stat-icon { background: #fff6e5 !important; color: #d88918 !important; }

.badge-status,
.badge { border-radius: 7px !important; font-weight: 650; letter-spacing: 0; }
.badge-status.sending,
.bg-success-subtle { background: var(--mint-soft) !important; color: var(--mint) !important; }

/* Forms, dropdowns, tabs, and tables */
.form-control,
.form-select,
.form-control-glass {
  min-height: 44px;
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
}
.form-control:focus,
.form-select:focus,
.form-control-glass:focus { 
  border-color: rgba(47,109,246,.75) !important; 
  box-shadow: 0 0 0 4px rgba(47,109,246,.15) !important; 
}

/* Universal Dark Mode Input Text & Contrast Enforcement */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control-glass,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-control-glass,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
.bg-dark .form-control,
.bg-dark .form-control-glass {
  background-color: #0d1527 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  caret-color: #38bdf8 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-control-glass:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .form-control-glass:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus {
  background-color: #121e36 !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3) !important;
}

/* Crisp High-Visibility Text Selection */
::selection,
.form-control::selection,
.form-select::selection,
.form-control-glass::selection,
input::selection,
textarea::selection,
[data-theme="dark"] input::selection,
[data-theme="dark"] textarea::selection,
html[data-theme="dark"] input::selection,
html[data-theme="dark"] textarea::selection {
  background: #2563eb !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Dark Mode Placeholder Clarity */
[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-control-glass::placeholder,
[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8 !important;
  opacity: 0.85 !important;
}

/* Autofill Visibility Fix */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0px 1000px #0d1527 inset !important;
  caret-color: #ffffff !important;
}
.dropdown-menu,
.outlook-menu {
  padding: 8px;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-lift) !important;
  animation: menuIn .18s cubic-bezier(.2,.8,.2,1);
}
.dropdown-item { min-height: 40px; display: flex; align-items: center; gap: 10px; border-radius: 8px; color: var(--text-secondary) !important; }
.dropdown-item:hover,
.dropdown-item:focus { color: var(--primary) !important; background: var(--primary-soft) !important; }
.nav-tabs { gap: 6px; border-bottom-color: var(--border-color); }
.nav-tabs .nav-link { min-height: 44px; border: 0 !important; border-radius: 9px 9px 0 0 !important; color: var(--text-secondary); font-weight: 650; }
.nav-tabs .nav-link:hover { color: var(--primary); background: var(--primary-softer); }
.nav-tabs .nav-link.active { color: var(--primary) !important; background: var(--primary-soft) !important; }
.tab-pane.active { animation: contentIn .32s cubic-bezier(.2,.8,.2,1); }

.table-responsive { border: 1px solid var(--border-color); border-radius: 11px; }
.table-glass { margin: 0 !important; color: var(--text-primary) !important; }
.table-glass th {
  background: var(--primary-softer) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 13px 16px !important;
  font-size: .68rem !important;
  letter-spacing: .07em;
}
.table-glass td { background: var(--bg-card) !important; color: var(--text-secondary) !important; border-color: var(--border-color) !important; padding: 15px 16px !important; }
.table-glass tbody tr { transition: background-color .2s ease, transform .2s ease; }
.table-glass tbody tr:hover td { background: var(--primary-softer) !important; }

.modal-content { background: var(--bg-card) !important; border: 1px solid var(--border-color) !important; border-radius: 15px !important; box-shadow: 0 28px 80px rgba(10,23,61,.22) !important; }
.modal.fade .modal-dialog { transform: translateY(14px) scale(.985); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.modal.show .modal-dialog { transform: none; }

/* Page and interaction motion */
body.page-enter .app-content { animation: contentIn .42s cubic-bezier(.2,.8,.2,1) both; }
body.is-leaving .app-content { opacity: 0; transform: translateY(7px); transition: opacity .16s ease, transform .16s ease; }
body.is-leaving .app-topbar { opacity: .85; transition: opacity .16s ease; }

@keyframes contentIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-5px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive behavior */
@media (max-width: 1199.98px) {
  .app-content { padding: 26px 24px 40px !important; }
  .outlook-commandbar { padding-inline: 20px !important; }
}

@media (max-width: 991.98px) {
  .app-sidebar { width: min(86vw, 286px); transform: translateX(-102%); box-shadow: 24px 0 70px rgba(10,23,61,.2); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0 !important; }
  .sidebar-overlay.show { background: rgba(9,23,61,.38); backdrop-filter: blur(3px); }
  .app-content { padding: 24px 20px 36px !important; }
}

/* ========================================================================== 
   Segmented Filter Tabs & Modern Section Buttons (Image 2)
   ========================================================================== */
.campaign-filter-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
  margin-bottom: 20px !important;
}

.campaign-filter-segmented {
  display: inline-flex !important;
  align-items: center !important;
  padding: 5px !important;
  border-radius: 12px !important;
  gap: 4px !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  box-sizing: border-box !important;
}
.campaign-filter-segmented::-webkit-scrollbar {
  display: none !important;
}

/* Light Mode Filter Segment */
html[data-theme="light"] .campaign-filter-segmented {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* Dark Mode Filter Segment */
html[data-theme="dark"] .campaign-filter-segmented {
  background: #0d1525 !important;
  border: 1px solid #1e2c45 !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35) !important;
}

/* Filter Tab Pill */
.filter-tab-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  padding: 7px 16px !important;
  border-radius: 8px !important;
  border: 1px solid transparent !important;
  outline: none !important;
  background: transparent !important;
  font-size: 0.86rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  user-select: none !important;
  line-height: 1.3 !important;
}

/* Light Mode Inactive Pill */
html[data-theme="light"] .filter-tab-pill {
  color: #475569 !important;
}
html[data-theme="light"] .filter-tab-pill:hover {
  color: #047857 !important;
  background: rgba(255, 255, 255, 0.7) !important;
}

/* Light Mode Active Pill */
html[data-theme="light"] .filter-tab-pill.active {
  background: #ffffff !important;
  color: #047857 !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  font-weight: 700 !important;
}

/* Dark Mode Inactive Pill */
html[data-theme="dark"] .filter-tab-pill {
  color: #94a3b8 !important;
}
html[data-theme="dark"] .filter-tab-pill:hover {
  color: #f1f5f9 !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

/* Dark Mode Active Pill */
html[data-theme="dark"] .filter-tab-pill.active {
  background: #182438 !important;
  color: #34d399 !important;
  border-color: #273b5c !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
  font-weight: 700 !important;
}

/* Count Badge in Pill */
.filter-tab-count {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 2px 7px !important;
  border-radius: 999px !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  margin-left: 2px !important;
}
html[data-theme="light"] .filter-tab-count {
  background: rgba(4, 120, 87, 0.12) !important;
  color: #047857 !important;
}
html[data-theme="dark"] .filter-tab-count {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
}

/* Status Indicator Dots */
.status-indicator-dot {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}
.dot-sending {
  background: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
  animation: pulse-dot 2s infinite !important;
}
.dot-queued {
  background: #f59e0b !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25) !important;
}
.dot-completed {
  background: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25) !important;
}
.dot-paused {
  background: #94a3b8 !important;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Search Box in Filter Bar */
.campaign-search-wrap {
  position: relative !important;
  min-width: 240px !important;
  flex: 1 1 auto !important;
  max-width: 320px !important;
}
.campaign-search-wrap .search-icon {
  position: absolute !important;
  left: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: 0.9rem !important;
  pointer-events: none !important;
}
html[data-theme="light"] .campaign-search-wrap .search-icon { color: #64748b !important; }
html[data-theme="dark"] .campaign-search-wrap .search-icon { color: #94a3b8 !important; }
.campaign-search-input {
  padding-left: 38px !important;
  height: 42px !important;
  border-radius: 10px !important;
  font-size: 0.88rem !important;
}

/* Unified Mobile Responsiveness */
@media (max-width: 767.98px) {
  .app-topbar,
  .outlook-commandbar {
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 14px !important;
    flex-wrap: nowrap !important;
  }
  .outlook-center,
  .outlook-search,
  .outlook-nav {
    display: none !important;
  }
  .outlook-left {
    flex: 0 0 auto !important;
    min-width: 0 !important;
    gap: 8px !important;
  }
  .topbar-brand-logo {
    max-height: 32px !important;
    max-width: 140px !important;
  }
  .outlook-actions {
    margin-left: auto !important;
    flex: 0 0 auto !important;
    gap: 6px !important;
  }
  .outlook-action-btn,
  .outlook-command-btn {
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    font-size: 0.82rem !important;
    border-radius: 8px !important;
  }
  .outlook-icon-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 8px !important;
  }
  .app-content { padding: 20px 14px 32px !important; }
  .campaign-filter-wrapper {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .campaign-filter-segmented {
    width: 100% !important;
  }
  .campaign-search-wrap {
    max-width: 100% !important;
    width: 100% !important;
  }
  .row.g-4 { --bs-gutter-y: 1rem; }
  .glass-card:hover,
  .card:hover { transform: none; }
  footer { padding-inline: 16px !important; }
}

@media (max-width: 575.98px) {
  .app-topbar,
  .outlook-commandbar {
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 10px !important;
  }
  .topbar-brand-logo {
    max-height: 28px !important;
    max-width: 115px !important;
  }
  .outlook-action-btn,
  .outlook-command-btn {
    width: 36px !important;
    min-width: 36px !important;
    padding: 0 !important;
    justify-content: center !important;
  }
  .outlook-action-btn.dropdown-toggle::after,
  .outlook-command-btn.dropdown-toggle::after {
    display: none !important;
  }
  .filter-tab-pill {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
  }
}

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

/* Specificity bridge for active nav items */
html[data-theme="light"] .nav-link-item.active,
html[data-theme="light"] .nav-link-item.active:hover {
  background: rgba(37, 99, 235, 0.09) !important;
  color: #1d4ed8 !important;
  border-left: 3.5px solid #2563eb !important;
}
html[data-theme="light"] .nav-link-item.active i {
  color: #2563eb !important;
}
html[data-theme="light"] .nav-link-item.active span:not(.badge) {
  color: #1d4ed8 !important;
}

html[data-theme="dark"] .nav-link-item.active,
html[data-theme="dark"] .nav-link-item.active:hover {
  background: rgba(37, 99, 235, 0.22) !important;
  color: #ffffff !important;
  border-left: 3.5px solid #3b82f6 !important;
}
html[data-theme="dark"] .nav-link-item.active i {
  color: #60a5fa !important;
}
html[data-theme="dark"] .nav-link-item.active span:not(.badge) {
  color: #ffffff !important;
}

html[data-theme] .btn-primary-emerald { background: var(--gradient-primary) !important; border-color: transparent !important; }

/* Super high-contrast, crystal clear badge for 12 CHECKS */
html[data-theme="light"] .bg-emerald-badge,
html[data-theme="light"] .nav-link-item .bg-emerald-badge,
html[data-theme="light"] .nav-link-item.active .bg-emerald-badge {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
  font-weight: 700 !important;
  font-size: 0.65rem !important;
  padding: 3px 7px !important;
  border-radius: 6px !important;
}

html[data-theme="dark"] .bg-emerald-badge,
html[data-theme="dark"] .nav-link-item .bg-emerald-badge,
html[data-theme="dark"] .nav-link-item.active .bg-emerald-badge {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  font-weight: 700 !important;
  font-size: 0.65rem !important;
  padding: 3px 7px !important;
  border-radius: 6px !important;
}

html[data-theme] .sidebar-brand > i {
  color: #fff !important;
  background: var(--gradient-primary) !important;
  border-color: transparent !important;
}
