/* =============================================
   XYZ AI Lead Generation Agent — style.css
   ============================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #080d1a;
  --bg-surface: #0d1529;
  --bg-card: #111827;
  --bg-card-alt: #131e30;
  --border: rgba(255, 255, 255, 0.07);
  --border-glow: rgba(99, 102, 241, 0.3);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;

  --accent-blue: #6366f1;
  --accent-cyan: #22d3ee;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --sidebar-w: 70px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --transition: 0.22s cubic-bezier(.4, 0, .2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* =============================================
   SIDEBAR (COLLAPSIBLE 70px / 240px)
   ============================================= */
:root {
  --sidebar-w: 70px;
  --sidebar-expanded-w: 240px;
}

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 250ms cubic-bezier(.4, 0, .2, 1);
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

.sidebar:hover,
.sidebar.expanded {
  width: var(--sidebar-expanded-w);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.2);
}

.logo-info {
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.sidebar:hover .logo-info,
.sidebar.expanded .logo-info {
  opacity: 1;
  pointer-events: auto;
}

.logo-name {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.sidebar__nav {
  flex: 1;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__group-title {
  padding: 12px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar__group-title span {
  display: inline-block;
  opacity: 0;
  transition: opacity 200ms ease;
}

.sidebar:hover .sidebar__group-title span,
.sidebar.expanded .sidebar__group-title span {
  opacity: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.nav-item svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: block;
}

.nav-item span {
  display: inline-block;
  opacity: 0;
  transition: opacity 200ms ease;
}

.sidebar:hover .nav-item span,
.sidebar.expanded .nav-item span {
  opacity: 1;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(34, 211, 238, 0.12));
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.1);
}

.nav-item.active svg {
  color: #818cf8;
}

.sidebar__footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.company-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-green);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .5
  }
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  background: rgba(13, 21, 41, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__breadcrumb {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.stats-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.pill-dot.green {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse 2s infinite;
}

/* ── VIEWS ── */
.view {
  display: none;
  padding: 24px;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.view.active {
  display: flex;
}

.view__header h1 {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.view__header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  /* border: none; */
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  border: 1px solid var(--border);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent-blue), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
}

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

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

.btn--outline:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

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

.btn--ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 7px;
}

.btn--lg {
  padding: 14px 24px;
  font-size: 14px;
}

.btn--full {
  width: 100%;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  /* overflow: hidden; */
  transition: border-color var(--transition);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card__header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card--full {
  grid-column: 1 / -1;
}

/* =============================================
   STAT CARDS
   ============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card--blue {
  background: linear-gradient(135deg, #1e1b4b, #1e293b);
}

.stat-card--green {
  background: linear-gradient(135deg, #052e16, #0f2a1a);
}

.stat-card--purple {
  background: linear-gradient(135deg, #2e1065, #1a0c3a);
}

.stat-card--orange {
  background: linear-gradient(135deg, #431407, #27190a);
}

.stat-card--blue:hover {
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.2);
}

.stat-card--green:hover {
  box-shadow: 0 8px 32px rgba(34, 197, 94, 0.15);
}

.stat-card--purple:hover {
  box-shadow: 0 8px 32px rgba(168, 85, 247, 0.15);
}

.stat-card--orange:hover {
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15);
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card--blue .stat-card__icon {
  background: rgba(99, 102, 241, .2);
  color: var(--accent-blue);
}

.stat-card--green .stat-card__icon {
  background: rgba(34, 197, 94, .2);
  color: var(--accent-green);
}

.stat-card--purple .stat-card__icon {
  background: rgba(168, 85, 247, .2);
  color: var(--accent-purple);
}

.stat-card--orange .stat-card__icon {
  background: rgba(245, 158, 11, .2);
  color: var(--accent-amber);
}

.stat-card__body {
  flex: 1;
}

.stat-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.stat-card--blue .stat-value {
  color: #a5b4fc;
}

.stat-card--green .stat-value {
  color: #86efac;
}

.stat-card--purple .stat-value {
  color: #d8b4fe;
}

.stat-card--orange .stat-value {
  color: #fcd34d;
}

.stat-card__glow {
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.12;
}

.stat-card--blue .stat-card__glow {
  background: var(--accent-blue);
}

.stat-card--green .stat-card__glow {
  background: var(--accent-green);
}

.stat-card--purple .stat-card__glow {
  background: var(--accent-purple);
}

.stat-card--orange .stat-card__glow {
  background: var(--accent-amber);
}

/* =============================================
   DASHBOARD GRID
   ============================================= */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── RECENT LIST ── */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card-alt);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: border-color var(--transition);
  cursor: pointer;
  animation: fadeSlideIn 0.4s ease both;
}

.recent-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

.recent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

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

.recent-company {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.priority-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.priority-badge.high {
  background: rgba(34, 197, 94, .15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, .25);
}

.priority-badge.medium {
  background: rgba(245, 158, 11, .15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, .25);
}

.priority-badge.low {
  background: rgba(100, 116, 139, .15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, .25);
}

.priority-badge.manual {
  background: rgba(168, 85, 247, .15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, .25);
}

/* ── DONUT CHART ── */
.priority-chart {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-center span {
  font-size: 22px;
  font-weight: 800;
}

.donut-center small {
  font-size: 10px;
  color: var(--text-muted);
}

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

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

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

.legend-item span:last-child {
  margin-left: auto;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── INDUSTRY BARS ── */
.industry-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ind-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ind-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 190px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ind-bar-wrap {
  flex: 1;
  background: var(--bg-card-alt);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.ind-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  transition: width 1s ease;
}

.ind-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  width: 24px;
  text-align: right;
}

/* =============================================
   GENERATE LEADS VIEW
   ============================================= */
.gen-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gen-form h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.form-input,
.form-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13.5px;
  padding: 10px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Tag Input */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  min-height: 44px;
  cursor: text;
  transition: border-color var(--transition);
}

.tag-input-wrap:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  animation: fadeIn .2s ease;
}

.tag-remove {
  cursor: pointer;
  opacity: .7;
  font-size: 14px;
  line-height: 1;
}

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

.tag-input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13.5px;
  outline: none;
  min-width: 120px;
  flex: 1;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.q-label {
  font-size: 11px;
  color: var(--text-muted);
}

.qtag {
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font);
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.qtag:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

/* Checkbox Grid */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.checkbox-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.checkbox-item:has(input:checked) {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* Progress */
.progress-card h3 {
  margin-bottom: 20px;
}

.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.prog-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.prog-step.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
}

.prog-step.done {
  color: var(--accent-green);
}

.prog-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.prog-step.active .prog-icon {
  border-color: var(--accent-blue);
  animation: spin .8s linear infinite;
}

.prog-step.done .prog-icon {
  border-color: var(--accent-green);
  background: rgba(34, 197, 94, .15);
}

.prog-step.done .prog-icon::after {
  content: '✓';
  color: var(--accent-green);
  font-size: 11px;
}

.prog-status {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
}

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

.progress-bar-wrap {
  background: var(--bg-surface);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  width: 0%;
  transition: width .5s ease;
}

.progress-msg {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Gen Summary */
.gen-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.summary-chip {
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-chip strong {
  font-size: 22px;
  font-weight: 800;
}

.summary-chip span {
  font-size: 11px;
  color: var(--text-muted);
}

/* =============================================
   LEADS DATABASE
   ============================================= */
.leads-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 220px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-group .form-select {
  width: auto;
  max-width: 220px;
}

.leads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(33.33% - 14px), 1fr));
  gap: 14px;
}

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition);
  cursor: default;
  animation: fadeSlideIn .35s ease both;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lead-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.lead-card__top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lead-avatar {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.lead-company {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
  flex-wrap: wrap;
}

.lead-country {
  font-size: 11px;
  color: var(--text-muted);
}

.lead-industry-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(34, 211, 238, .12);
  color: var(--accent-cyan);
  border: 1px solid rgba(34, 211, 238, .2);
}

.lead-card__contact {
  padding: 12px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.contact-row svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.contact-name {
  font-weight: 600;
  color: var(--text-primary);
}

.contact-title {
  color: var(--text-muted);
}

.contact-email {
  color: #7dd3fc;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-link {
  color: #a5b4fc;
  font-size: 11px;
  text-decoration: none;
  word-break: break-all;
}

.contact-link:hover {
  text-decoration: underline;
}

.lead-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lead-card__footer .btn {
  flex: 1;
  font-size: 12px;
  padding: 7px 10px;
}

/* =============================================
   EMAIL OUTREACH
   ============================================= */
.email-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.email-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  transition: all var(--transition);
  animation: fadeSlideIn .35s ease both;
}

.email-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

.email-card__left {
  flex-shrink: 0;
}

.email-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.email-card__body {
  flex: 1;
  min-width: 0;
}

.email-card__to {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.email-card__company {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.email-card__subject {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.email-card__preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.email-card__actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.email-card__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* =============================================
   CRM EXPORT
   ============================================= */
.crm-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}

.crm-controls h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 18px;
}

.export-stats {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-stat {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.export-stat strong {
  color: var(--text-primary);
  font-weight: 700;
}

.excel-sync-status {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card-hover);
  display: grid;
  gap: 4px;
}

.excel-sync-status strong {
  font-size: 12px;
  color: var(--text-primary);
}

.excel-sync-status span {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}

.crm-preview {
  height: fit-content;
}

.json-preview {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: #94a3b8;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  max-height: 600px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.json-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.json-key {
  color: #7dd3fc;
}

.json-string {
  color: #86efac;
}

.json-number {
  color: #fcd34d;
}

.json-bool {
  color: #f9a8d4;
}

.json-null {
  color: var(--text-muted);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(99, 102, 241, .15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, .25);
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  animation: slideUp .3s cubic-bezier(.34, 1.56, .64, 1);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal__header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, .07);
  color: var(--text-primary);
}

.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.modal__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.email-preview-header {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ep-row {
  display: flex;
  gap: 10px;
  font-size: 13px;
}

.ep-label {
  font-weight: 700;
  color: var(--text-muted);
  width: 60px;
  flex-shrink: 0;
}

.email-preview-body {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
  background: var(--bg-surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 16px;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg {
  opacity: .3;
}

.empty-state h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
}

.empty-state a {
  color: var(--accent-blue);
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* =============================================
   LEAD STATUS COMPONENTS
   ============================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  vertical-align: middle;
}

.lead-card__status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.status-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
}

.status-select:focus {
  border-color: var(--accent-blue);
}

.has-notes-dot {
  font-size: 13px;
  cursor: default;
}

/* Funnel bars */
.funnel-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.funnel-label {
  font-size: 12px;
  font-weight: 600;
  width: 90px;
  flex-shrink: 0;
}

.funnel-bar-wrap {
  flex: 1;
  background: var(--bg-card-alt);
  border-radius: 99px;
  height: 22px;
  overflow: hidden;
}

.funnel-bar {
  height: 100%;
  border-radius: 99px;
  min-width: 3px;
  transition: width 1s ease;
}

.funnel-count {
  font-size: 12px;
  font-weight: 700;
  width: 24px;
  text-align: right;
}

/* =============================================
   INFO BANNER
   ============================================= */
.info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(34, 211, 238, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-banner__icon {
  color: var(--accent-blue);
  flex-shrink: 0;
  opacity: 0.9;
}

.info-banner__body {
  flex: 1;
}

.info-banner strong {
  color: var(--text-primary);
}

.info-banner em {
  color: #a5b4fc;
  font-style: normal;
  font-weight: 600;
}

/* ── NAV COUNT BADGE ── */
.nav-count {
  margin-left: auto;
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  min-width: 22px;
  text-align: center;
}

/* =============================================
   TOAST
   ============================================= */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all .3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(34, 197, 94, .4);
}

.toast.error {
  border-color: rgba(244, 63, 94, .4);
}

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

  to {
    opacity: 1
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

/* =============================================
   LEADS LAYOUT & SIDEBAR
   ============================================= */
.leads-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.leads-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 80px;
}

.leads-sidebar-title {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-left: 12px;
}

.category-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.cat-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.cat-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.cat-count {
  font-size: 11px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 99px;
  color: inherit;
  opacity: 0.8;
}

.leads-main {
  flex: 1;
  min-width: 0;
}

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

.move-dropdown-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  min-width: 160px;
  z-index: 1000;
  padding: 6px;
  animation: fadeSlideIn 0.2s ease;
}

.move-dropdown-wrapper.open .move-dropdown-menu {
  display: block;
}

.move-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}

.move-option:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .crm-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
    box-shadow: 4px 0 30px rgba(0, 0, 0, .5);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

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

  .form-row,
  .sender-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-group {
    flex-wrap: wrap;
  }
}

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

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

  .view {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
  }
}

/* ── TABLES ── */
.table-container {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 1rem;
  padding: 8px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  table-layout: auto;
}

.table th,
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.table th {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
}

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

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-state {
  text-align: center;
  padding: 3rem !important;
  color: var(--text-muted);
}

/* ── WYSIWYG EDITOR STYLES ── */
.wysiwyg-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wysiwyg-toolbar {
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border);
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.wysiwyg-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.wysiwyg-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.wysiwyg-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  width: 100%;
  outline: none;
  cursor: pointer;
}

.wysiwyg-select option {
  background: #0f172a;
  color: #fff;
}

.wysiwyg-select--variable {
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  font-weight: 500;
  margin-left: auto;
}

.wysiwyg-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}

.wysiwyg-editor {
  min-height: 280px;
  max-height: 500px;
  overflow-y: auto;
  padding: 16px;
  color: #f8fafc;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  background: rgba(15, 23, 42, 0.4);
}

.wysiwyg-editor p {
  margin: 0 0 1em 0;
}

.wysiwyg-editor:empty:before {
  content: "Hi {{first_name}},\n\nI'm reaching out regarding...\n\nKind regards,";
  color: var(--text-muted);
  opacity: 0.6;
  white-space: pre-wrap;
  pointer-events: none;
}

/* ── GMAIL STYLE COMPOSER ── */
.gmail-composer-overlay {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 620px;
  max-width: 95vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--border);
  border-bottom: none;
}

.gmail-composer-box {
  display: flex;
  flex-direction: column;
}

.gmail-composer-header {
  background: #1e293b;
  padding: 10px 16px;
  color: #f8fafc;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.gmail-composer-body {
  display: flex;
  flex-direction: column;
}

.gmail-field {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.2);
}

.gmail-field label {
  width: 65px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.gmail-field input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  outline: none;
  padding: 6px 0;
}

.gmail-composer-footer {
  padding: 12px 16px;
  background: #1e293b;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── CAMPAIGN REVIEW ITEM ── */
.campaign-review-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.campaign-review-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.lead-checkbox-wrapper {
  display: inline-flex;
  align-items: center;
  margin-right: 12px;
}

.lead-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #6366f1;
  border-radius: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lead-checkbox:hover {
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.no-email-indicator {
  font-size: 10px;
  font-weight: 600;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* ── QUILL.JS DARK THEME OVERRIDES ── */
.quill-dark-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.ql-toolbar.ql-snow {
  background: #1e293b !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 12px !important;
}

.gmail-native-editor,
.ql-container.ql-snow,
.email-preview-body,
.wysiwyg-editor {
  border: none !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  font-size: 14px !important;
  padding: 20px 24px !important;
  min-height: 240px;
  max-height: 380px;
  overflow-y: auto !important;
  outline: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.gmail-native-editor:empty:before {
  content: attr(placeholder);
  color: #94a3b8;
  font-style: normal;
  pointer-events: none;
  display: block;
}

.gmail-native-editor::-webkit-scrollbar,
.ql-editor::-webkit-scrollbar,
.ql-container::-webkit-scrollbar,
.email-preview-body::-webkit-scrollbar,
.wysiwyg-editor::-webkit-scrollbar {
  width: 8px;
}

.gmail-native-editor::-webkit-scrollbar-track,
.ql-editor::-webkit-scrollbar-track,
.ql-container::-webkit-scrollbar-track,
.email-preview-body::-webkit-scrollbar-track,
.wysiwyg-editor::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.gmail-native-editor::-webkit-scrollbar-thumb,
.ql-editor::-webkit-scrollbar-thumb,
.ql-container::-webkit-scrollbar-thumb,
.email-preview-body::-webkit-scrollbar-thumb,
.wysiwyg-editor::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.gmail-native-editor::-webkit-scrollbar-thumb:hover,
.ql-editor::-webkit-scrollbar-thumb:hover,
.ql-container::-webkit-scrollbar-thumb:hover,
.email-preview-body::-webkit-scrollbar-thumb:hover,
.wysiwyg-editor::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.ql-editor.ql-blank::before {
  color: #94a3b8 !important;
  opacity: 0.8;
  font-style: normal !important;
}

.email-preview-container {
  background: #ffffff !important;
  color: #0f172a !important;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ql-snow .ql-stroke {
  stroke: #cbd5e1 !important;
}

.ql-snow .ql-fill {
  fill: #cbd5e1 !important;
}

.ql-snow .ql-picker {
  color: #cbd5e1 !important;
}

.ql-snow .ql-picker-options {
  background-color: #0f172a !important;
  border-color: var(--border) !important;
  color: #f8fafc !important;
}

.ql-snow.ql-toolbar button:hover,
.ql-snow .ql-toolbar button:hover,
.ql-snow.ql-toolbar button:focus,
.ql-snow .ql-toolbar button:focus,
.ql-snow.ql-toolbar button.ql-active,
.ql-snow .ql-toolbar button.ql-active {
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 4px;
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: #6366f1 !important;
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: #6366f1 !important;
}

/* ── STRICT PASTED EMAIL SIGNATURE & NESTED TABLE ISOLATION ── */
.ql-editor table,
.email-preview-body table,
.wysiwyg-editor table,
.email-preview-container table {
  display: table !important;
  margin: 0;
  padding: 0;
  max-width: 100%;
  background: transparent;
  table-layout: auto !important;
}

.ql-editor table table,
.email-preview-body table table,
.wysiwyg-editor table table,
.email-preview-container table table {
  display: table !important;
  margin: 0;
  padding: 0;
}

.ql-editor table tbody,
.email-preview-body table tbody,
.wysiwyg-editor table tbody,
.email-preview-container table tbody {
  display: table-row-group !important;
}

.ql-editor table tr,
.email-preview-body table tr,
.wysiwyg-editor table tr,
.email-preview-container table tr {
  display: table-row !important;
}

.ql-editor table td,
.ql-editor table th,
.email-preview-body table td,
.email-preview-body table th,
.wysiwyg-editor table td,
.wysiwyg-editor table th,
.email-preview-container table td,
.email-preview-container table th {
  display: table-cell !important;
  white-space: normal;
  box-sizing: content-box;
}

.ql-editor img,
.email-preview-body img,
.wysiwyg-editor img,
.email-preview-container img {
  max-width: 100%;
  display: inline-block;
  vertical-align: middle;
  border: none;
  outline: none;
}

.gmail-native-editor p,
.email-preview-body p,
.wysiwyg-editor p,
.email-preview-container p {
  margin: 0 0 0.6em 0 !important;
  line-height: 1.5 !important;
  color: #0f172a !important;
}

.gmail-native-editor div,
.email-preview-body div,
.wysiwyg-editor div,
.email-preview-container div {
  color: #0f172a !important;
}

.gmail-native-editor a,
.email-preview-body a,
.wysiwyg-editor a,
.email-preview-container a {
  text-decoration: underline;
  color: #2563eb !important;
}

.gmail-native-editor ul,
.gmail-native-editor ol,
.email-preview-body ul,
.email-preview-body ol,
.wysiwyg-editor ul,
.wysiwyg-editor ol,
.email-preview-container ul,
.email-preview-container ol {
  margin: 0.5em 0 0.8em 0 !important;
  padding-left: 28px !important;
  list-style-position: outside !important;
}

.gmail-native-editor li,
.email-preview-body li,
.wysiwyg-editor li,
.email-preview-container li {
  margin-bottom: 4px !important;
  line-height: 1.5 !important;
}

/* ── PROTECTED ATOMIC SIGNATURE BLOCK ── */
.email-signature-block {
  display: block !important;
  width: 500px !important;
  max-width: 500px !important;
  margin-top: 16px !important;
  margin-bottom: 8px !important;
  text-align: left !important;
  border-radius: 4px;
  position: relative;
}

.email-signature-block table {
  width: 500px !important;
  max-width: 500px !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.email-signature-block table table {
  width: auto !important;
}

.email-signature-block table td {
  box-sizing: content-box !important;
}

.email-signature-block img {
  max-width: 100% !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.ql-editor .email-signature-block:hover {
  outline: 1px dashed #6366f1;
}

/* ── CAMPAIGN BADGES & PROGRESS STYLES ── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.green {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge.orange {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.red {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.blue {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge.gray {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.selection-counter-badge {
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
  transition: all 0.2s ease;
}

/* =============================================
   CAMPAIGN MODAL LEAD SELECTOR THEMING
   ============================================= */
.modal-lead-selector-container {
  background: var(--bg-surface, #0d1529);
  border: 1px solid var(--border-glow, rgba(99, 102, 241, 0.25));
  border-radius: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.modal-lead-selector-container::-webkit-scrollbar {
  width: 6px;
}

.modal-lead-selector-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.modal-lead-selector-container::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
}

/* =============================================
   SLIDE-OUT LEAD PROFILE DRAWER (OPTION A)
   ============================================= */
.lead-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.lead-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lead-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 90vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.lead-drawer.active {
  transform: translateX(0);
}

.lead-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 16px;
}


.modal-lead-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  cursor: pointer;
}

.modal-lead-card:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateX(2px);
}

.modal-lead-card.is-checked {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

.modal-lead-card.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal-lead-card .lead-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
}

.modal-lead-card .lead-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-lead-card .lead-title {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-lead-card .lead-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-lead-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.modal-lead-badge.country {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.modal-lead-badge.no-email {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ── COUNTRY FILTER DROPDOWN UI FIX ── */
.country-filter-dropdown {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(15, 23, 42, 0.85) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a5b4fc' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 12px 12px !important;
  color: #f8fafc !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 5px 30px 5px 12px !important;
  height: 32px !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.country-filter-dropdown:hover {
  background-color: rgba(30, 41, 59, 0.95) !important;
  border-color: rgba(99, 102, 241, 0.6) !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.18);
}

.country-filter-dropdown:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25) !important;
}

.country-filter-dropdown option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  padding: 8px 12px !important;
}

/* Custom Dark Theme Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

::-webkit-scrollbar-corner {
  background: #0f172a;
}

.modal-lead-selector-container {
  scrollbar-width: thin;
  scrollbar-color: #334155 #0f172a;
}

/* ==========================================================================
   Track Delivery Enterprise CRM Design System
   ========================================================================== */
.delivery-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  margin-top: 16px;
}

.delivery-table-wrapper {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0f172a;
}

.delivery-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

.delivery-table th {
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 5;
}

.delivery-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.delivery-table tbody tr {
  min-height: 58px;
  transition: background 0.15s ease;
}

.delivery-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

/* Specific Column Minimum Widths */
.col-date     { width: 140px; min-width: 130px; }
.col-sender   { width: 200px; min-width: 180px; max-width: 220px; }
.col-recip    { width: 220px; min-width: 200px; max-width: 240px; }
.col-subject  { width: 220px; min-width: 200px; max-width: 250px; }
.col-status   { width: 135px; min-width: 125px; }
.col-msgid    { width: 220px; min-width: 190px; max-width: 240px; }
.col-response { width: 200px; min-width: 180px; max-width: 230px; }
.col-action   { width: 70px;  min-width: 60px;  text-align: center; }

/* Date Formatting (2-line) */
.date-cell-main { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.date-cell-sub  { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }

/* Subject + Campaign Stack */
.subject-cell-main { font-size: 13px; font-weight: 600; color: #f8fafc; overflow: hidden; text-overflow: ellipsis; }
.subject-cell-empty { font-size: 12px; font-style: italic; color: #64748b; }
.subject-cell-sub  { font-size: 11px; color: #64748b; margin-top: 2px; display: flex; align-items: center; gap: 4px; }

/* Semantic Status Badges */
.delivery-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.status-badge-delivered  { background: rgba(34, 197, 94, 0.15);  color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.status-badge-accepted   { background: rgba(6, 182, 212, 0.15);  color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.status-badge-sent       { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.status-badge-deferred   { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-badge-bounced    { background: rgba(239, 68, 68, 0.15);  color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-badge-failed     { background: rgba(225, 29, 72, 0.15);  color: #f43f5e; border: 1px solid rgba(225, 29, 72, 0.3); }
.status-badge-pending    { background: rgba(148, 163, 184, 0.15);color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.status-badge-processing { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.status-badge-cancelled  { background: rgba(71, 85, 105, 0.15);  color: #64748b; border: 1px solid rgba(71, 85, 105, 0.3); }

/* Monospace Message ID Box */
.msgid-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 220px;
}

.msgid-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn-icon {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s, color 0.15s;
}

.msgid-wrapper:hover .copy-btn-icon {
  opacity: 1;
  color: #38bdf8;
}

/* Action Icon Button */
.action-more-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.action-more-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #ffffff;
}

/* Response Code Badges */
.response-code-success { color: #4ade80; font-family: var(--mono); font-size: 11px; font-weight: 600; }
.response-code-deferred{ color: #fbbf24; font-family: var(--mono); font-size: 11px; font-weight: 600; }
.response-code-error   { color: #f87171; font-family: var(--mono); font-size: 11px; font-weight: 600; }