:root{
  --bg: #f6f8fc;
  --surface-1: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border-subtle: #e6eaf2;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: rgba(15,23,42,.55);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-contrast: #ffffff;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius: 16px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow-md: 0 1px 2px rgba(15,23,42,.06), 0 10px 26px rgba(15,23,42,.06);
  --shadow-lg: 0 12px 34px rgba(15,23,42,.10);
  --shadow: var(--shadow-md);

  /* Spacing scale (used by styles-polish.css + some JS inline styles) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 24px;
  --focus: 0 0 0 3px rgba(37,99,235,0.25);

  /* Compatibility aliases (used by styles-gmail.css / styles-polish.css) */
  --card: var(--surface-1);
  --surface: var(--surface-1);
  --hover-bg: var(--surface-hover);
  --border: var(--border-subtle);
  --border-light: var(--border-subtle);
  --border-medium: var(--border-strong);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--primary);
  --blue2: var(--primary-hover);

  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: var(--primary);
  --primary-600: var(--primary);
  --primary-700: var(--primary-hover);

  /* Semantic tints (used sparingly; keeps primary accent blue) */
  --success-50: #f0fdf4;
  --success-200: #bbf7d0;
  --success-600: #16a34a;
  --success-700: #15803d;

  --warning-50: #fffbeb;
  --warning-200: #fde68a;
  --warning-300: #fcd34d;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-200: #fecaca;
  --danger-300: #fca5a5;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: var(--radius);
  --radius-full: 9999px;

  --shadow-sm: var(--shadow);
  --shadow-md: var(--shadow);
  --shadow-lg: 0 12px 34px rgba(15,23,42,.10);
  --shadow-xl: 0 22px 60px rgba(15,23,42,.12);
}

body[data-theme="momentum"] {
  --bg: #f8fafc;
  --surface-1: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #eef2f7;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --primary: #111827;
  --primary-hover: #000000;
  --primary-contrast: #ffffff;

  --accent: #2563eb;
  --accent-soft: #dbeafe;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 8px 24px rgba(15,23,42,0.06);
  --shadow-lg: 0 16px 40px rgba(15,23,42,0.08);

  --focus: 0 0 0 3px rgba(37,99,235,0.35);

  /* compatibility aliases */
  --card: var(--surface-1);
  --surface: var(--surface-1);
  --hover-bg: var(--surface-hover);
  --border: var(--border-subtle);
  --border-light: var(--border-subtle);
  --border-medium: var(--border-strong);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--primary);
  --blue2: var(--primary-hover);
  --primary-500: var(--primary);
  --primary-600: var(--primary);
  --primary-700: var(--primary-hover);
}

/* Dark theme now uses a clean light palette — no more dark navy */
[data-theme="dark"]{
  --bg: #f7f9fc;
  --card: #ffffff;
  --surface: #ffffff;
  --text: #0f172a;
  --text-primary: #0f172a;
  --muted: #64748b;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --border: #e2e8f0;
  --border-light: #e8edf2;
  --border-medium: #c8d3de;
  --hover-bg: #f1f5f9;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --shadow: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08);
  --shadow-lg: 0 8px 24px rgba(15,23,42,0.10);
  --shadow-xl: 0 16px 40px rgba(15,23,42,0.12);
}

html[data-theme="dark"]{
  color-scheme: light;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text-primary);
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.muted{ color:var(--muted); }
.hidden{ display:none !important; }

.app-shell{
  min-height:100vh;
  padding:18px;
  display:flex;
  flex-direction:row;
  gap:18px;
}

/* Sidebar */
.sidebar{
  width:240px;
  display:flex;
  flex-direction:column;
  gap:24px;
  flex-shrink:0;
}

.logo{
  font-size:20px;
  font-weight:800;
  color:var(--text);
  display:flex;
  align-items:center;
  gap:8px;
  padding:0 8px;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.nav-btn{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:12px;
  color:var(--muted);
  text-decoration:none;
  font-weight:600;
  font-size:14px;
  transition:all 0.15s ease;
  border:none;
  background:transparent;
  cursor:pointer;
  width:100%;
  text-align:left;
}

.nav-btn:hover{
  background:rgba(255,255,255,0.6);
  color:var(--blue);
}

.nav-btn.active{
  background:var(--card);
  color:var(--blue);
  box-shadow:var(--shadow);
}

.nav-icon{
  font-size:18px;
  width:24px;
  text-align:center;
}

/* Main Content */
.main{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:18px;
  min-width:0; /* Prevent flex overflow */
}

/* Header */
.header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  height:48px;
}

.header-left{
  display:flex;
  gap:12px;
  align-items:center;
  flex:1;
}

.header-right{
  display:flex;
  gap:12px;
  align-items:center;
}

.search-wrap{
  position:relative;
  width:100%;
  max-width:480px;
}

.search-icon{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  pointer-events:none;
}

.search-input{
  width:100%;
  height:44px;
  padding:0 16px 0 42px;
  border-radius:14px;
  border:1px solid transparent;
  background:var(--surface);
  box-shadow:var(--shadow);
  font-size:14px;
  font-weight:500;
  transition:all 0.2s;
  outline:none;
}

.search-input:focus{
  border-color:var(--blue);
  box-shadow:0 0 0 3px rgba(37,99,235,0.1);
}

.btn{
  height:40px;
  padding:0 16px;
  border-radius:12px;
  font-weight:600;
  font-size:13px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  cursor:pointer;
  transition:all 0.15s;
  display:inline-flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
}

.btn:hover{
  background:var(--hover-bg);
  border-color:#cbd5e1;
}

.btn.primary{
  background:var(--blue);
  color:#fff;
  border-color:var(--blue);
  box-shadow:0 2px 4px rgba(37,99,235,0.2);
}

.btn.primary:hover{
  background:var(--blue2);
  border-color:var(--blue2);
}

.icon-btn{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:all 0.15s;
}

.icon-btn:hover{
  background:var(--surface);
  color:var(--text);
  box-shadow:var(--shadow);
}

/* Stats Grid */
.stats-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}

/* Filters */
.filters{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
}

.filter-row{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
}

.filter-group{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:160px;
}

.filter-group.grow{
  flex:1;
  min-width:280px;
}

.filter-group label{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
}

.input,.select,.textarea{
  width:100%;
  height:40px;
  border-radius:14px;
  border:1px solid var(--border);
  padding:0 12px;
  font-weight:500;
  outline:none;
  background:var(--surface);
}

.textarea{
  min-height:86px;
  padding:10px 12px;
  resize:vertical;
}

/* Main split */
.mainSplit{
  display:grid;
  grid-template-columns: var(--list-pane-width, 40%) 1fr;
  gap:0 !important; /* Force no gap */
  column-gap: 0 !important; /* Explicitly remove column gap */
  margin-top: 0;
  padding-top: 0;
  position: relative;
  transition: none !important;
}

/* Force grid to update when CSS variable changes */
.mainSplit[style*="--list-pane-width"] {
  grid-template-columns: var(--list-pane-width) 1fr;
}

/* Pane resizer - positioned at the boundary */
.pane-resizer {
  position: absolute;
  left: var(--list-pane-width, 40%);
  top: 0;
  bottom: 0;
  width: 6px;
  margin-left: -3px; /* Centered exactly on the border */
  cursor: col-resize;
  z-index: 999;
  background: transparent; /* Invisible by default */
  transition: background 150ms ease;
}

.pane-resizer::before {
  display: none; /* Remove the visible line */
}

.pane-resizer:hover {
  background: #3b82f6;
  width: 4px;
  margin-left: -2px;
}

.pane-resizer.resizing {
  background: #2563eb;
  width: 4px;
  margin-left: -2px;
}

/* When in full-width mode (e.g. templates view), hide the resizer */
.app-shell.full-width-view .pane-resizer {
  display: none !important;
}

/* Ensure mainSplit fills height */
.mainSplit {
  flex: 1;
  min-height: 0; /* Allow scrolling inside */
}

/* Ensure the grid columns don't have gaps */
.mainSplit > * {
  min-width: 0;
  min-height: 0;
}

/* Fix for gap between filters and mainSplit */
.filters + .mainSplit {
  margin-top: 4px; /* Small gap */
}

/* Ensure listPane and detailPane touch each other */
.listPane {
  border-right: 1px solid var(--border);
}

.detailPane {
  border-left: none; /* Let listPane border handle it */
}

/* Remove any default spacing on all child elements */
.mainSplit > * {
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

/* Force all panes inside mainSplit to have square tops */
.mainSplit .listPane,
.mainSplit .detailPane,
.mainSplit #contactListWrap,
.mainSplit #detailPanel {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-radius: 0 !important;
}

.listPane,.detailPane{
  background:var(--card);
  border-top:none;
  border-radius:0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  box-shadow:none;
  overflow:hidden;
  margin-top: 0;
  padding-top: 0;
}

.listPane {
  border-left:1px solid var(--border);
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-radius: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-bottom-left-radius: var(--radius) !important;
  border-bottom-right-radius: 0 !important;
  margin-right: 0 !important;
}

.detailPane {
  border-right:1px solid var(--border);
  border-bottom:1px solid var(--border);
  border-left:none;
  display: flex;
  flex-direction: column;
  position: relative;
  /* IMPORTANT: do not-cap height; pane must reach bottom of viewport */
  max-height: none;
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-radius: 0 !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: var(--radius) !important;
  margin-left: 0 !important;
}

/* Detail pane content scrolls, buttons stick at bottom */
#detailContent {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  min-height: 0;
}

/* Sticky bottom action bar */
.detailTopStrip {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

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

.paneHead{
  padding:14px 14px 10px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid var(--border);
  background:var(--surface);
}

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

.paneSub{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

.list{
  overflow-y:auto;
  height:100%;
}

.row{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  gap:12px;
  cursor:pointer;
  transition:background 0.1s;
}

.row:hover{ background:var(--hover-bg); }
.row.selected{ background:#eff6ff; border-left:3px solid var(--blue); }

.row-check{
  width:16px;
  height:16px;
  border-radius:4px;
  border:1px solid var(--muted);
  cursor:pointer;
}

.avatar{
  width:36px;
  height:36px;
  border-radius:10px;
  background:#e2e8f0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  color:var(--muted);
  font-size:14px;
}

.contactName{
  font-weight:600;
  font-size:14px;
  margin-bottom:2px;
}

.contactMeta{
  font-size:12px;
  color:var(--muted);
}

/* Modals */
.backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,0.4);
  backdrop-filter:blur(2px);
  z-index:9999;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.2s;
}

.backdrop.show{
  opacity:1;
  pointer-events:auto;
}

.modal{
  background:var(--surface);
  border-radius:var(--radius);
  box-shadow:var(--shadow-xl);
  width:100%;
  max-width:500px;
  max-height:90vh;
  display:flex;
  flex-direction:column;
  transform:scale(0.95);
  transition:transform 0.2s;
}

.backdrop.show .modal{ transform:scale(1); }

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

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

.modalBody{
  padding:20px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.modalFoot{
  padding:16px 20px;
  border-top:1px solid var(--border);
  display:flex;
  justify-content:flex-end;
  gap:10px;
  background:#f8fafc;
  border-bottom-left-radius:var(--radius);
  border-bottom-right-radius:var(--radius);
}

/* Empty State */
.empty{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  height:100%;
  text-align:center;
  padding:40px;
  color:var(--muted);
}

.emptyIcon{
  font-size:48px;
  margin-bottom:16px;
  opacity:0.5;
}

/* Utilities */
.badge{
  padding:2px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
}

.badge.blue{ background:#dbeafe; color:#1e40af; }
.badge.green{ background:#dcfce7; color:#166534; }
.badge.orange{ background:#ffedd5; color:#9a3412; }
.badge.red{ background:#fee2e2; color:#991b1b; }
.badge.gray{ background:#f1f5f9; color:#475569; }

/* Toast */
.toast-root{
  position:fixed;
  bottom:24px;
  right:24px;
  display:flex;
  flex-direction:column;
  gap:8px;
  z-index:10000;
}

.toast{
  background:#1e293b;
  color:#fff;
  padding:12px 16px;
  border-radius:10px;
  font-size:14px;
  font-weight:500;
  box-shadow:var(--shadow-lg);
  display:flex;
  align-items:center;
  gap:10px;
  animation:slideUp 0.3s ease-out;
  max-width:320px;
}

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

/* Mobile */
@media (max-width:768px){
  .app-shell{ padding:0; flex-direction:column; }
  .sidebar{ display:none; } /* Hidden for now, need mobile nav */
  .main{ padding:0; }
  .header{ padding:12px; }
  .mainSplit{ grid-template-columns:1fr; }
  .detailPane{ display:none; } /* Show only list on mobile initially */
  .listPane{ border-radius:0 !important; border:none; }
}

/* Full Width View (for templates, documents, etc) */
.app-shell.full-width-view .mainSplit {
  display: block;
}

.app-shell.full-width-view .listPane,
.app-shell.full-width-view .detailPane {
  display: none;
}

/* Contacts V2: either list OR detail fills entire screen below main menu */
.app-shell.contacts-v2-view .mainSplit {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.app-shell.contacts-v2-view .pane-resizer {
  display: none !important;
}

/* List pane: when visible, takes entire area (full width + full height) */
.app-shell.contacts-v2-view #contactListWrap {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  border-right: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
}

/* List-only: list fills entire screen; detail is removed from layout */
.app-shell.contacts-v2-view.contact-list-only #contactListWrap {
  flex: 1 1 0% !important;
  min-height: 0 !important;
}
.app-shell.contacts-v2-view.contact-list-only #detailPanel {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  flex: none !important;
}

/* Contact list inner: fill height so table wrap extends to bottom */
.app-shell.contacts-v2-view #contactList {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Table wrap fills #contactList so list panel runs to bottom of screen */
.app-shell.contacts-v2-view #contactList .pipe-list-table-wrap {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
}
.app-shell.contacts-v2-view #contactList .pipe-list-table-wrap .pipe-list-table {
  flex-shrink: 0 !important;
}

/* Detail pane: hidden by default; only shown when contact-detail-visible */
.app-shell.contacts-v2-view #detailPanel {
  display: none !important;
}

/* When detail is visible: list must not display at all; detail fills full vertical page */
.app-shell.contacts-v2-view.contact-detail-visible #contactListWrap {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  flex: none !important;
}

/* Detail visible: overview/detail takes entire screen from under main menu to bottom */
.app-shell.contacts-v2-view.contact-detail-visible #detailPanel {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  min-height: calc(100vh - 120px) !important; /* full vertical page below header/tabs */
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}
.app-shell.contacts-v2-view.contact-detail-visible #detailPanel #detailContent,
.app-shell.contacts-v2-view.contact-detail-visible #detailPanel > .empty {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

/* ===========================================
   🎯 SEQUENCES UI STYLES
=========================================== */
.sequences-modal {
  background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.sequences-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  backdrop-filter: blur(10px);
}

.sequences-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(to bottom, #f8fafc 0%, #ffffff 100%);
}

.sequences-tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sequences-tab:hover {
  color: var(--primary-600);
  background: var(--primary-50);
  transform: translateY(-1px);
}

.sequences-tab.active {
  color: var(--primary-600);
  background: linear-gradient(135deg, var(--primary-50) 0%, color-mix(in srgb, var(--primary-500) 5%, white) 100%);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary-500) 15%, transparent);
}

.sequences-tab.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-600) 0%, var(--primary-500) 100%);
  border-radius: 2px 2px 0 0;
}

.sequences-body {
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

.sequences-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 100%;
}

.sequence-card-enhanced {
  background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  cursor: default; /* Make it clear this is not clickable */
}

.sequence-card-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  opacity: 0.7;
}

.sequence-card-enhanced:hover {
  /* Subtle hover - just shadow, no transform */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.sequence-card-header-enhanced {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

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

.sequence-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  margin: 20px -24px -24px -24px;
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  border-top: 2px solid #e2e8f0;
  border-radius: 0 0 16px 16px;
}

.sequence-action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sequence-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.sequence-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sequence-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sequence-action-btn-logs {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.sequence-action-btn-logs:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.sequence-action-btn-edit {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.sequence-action-btn-edit:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.sequence-action-btn-duplicate {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.sequence-action-btn-duplicate:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.sequence-action-btn-delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.sequence-action-btn-delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.sequence-icon-badge {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
  flex-shrink: 0;
  transition: all 0.3s;
}

.sequence-icon-badge:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.sequence-card-title-wrapper {
  flex: 1;
  min-width: 0;
}

.sequence-card {
  background: linear-gradient(to bottom, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s ease;
  min-width: 0;
  position: relative;
  overflow: hidden;
  cursor: default; /* Make it clear this is not clickable */
}

.sequence-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  opacity: 0.6;
}

.sequence-card-wide {
  grid-column: span 2;
}

@media (max-width: 1200px) {
  .sequence-card-wide {
    grid-column: span 1;
  }
}

.sequence-card:hover {
  /* Subtle hover - just a slight shadow increase, no transform */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.sequence-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.sequence-status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  position: relative;
  animation: pulse 2s infinite;
}

.sequence-status-indicator.active {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2), 0 0 12px rgba(34, 197, 94, 0.4);
}

.sequence-status-indicator.inactive {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.2);
  animation: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.sequence-card-title {
  flex: 1;
  min-width: 0;
}

.sequence-card-title h3 {
  margin: 0 0 6px 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sequence-trigger-text {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sequence-trigger-text::before {
  content: '⚡';
  font-size: 12px;
  opacity: 0.7;
}

.sequence-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  margin: 20px -24px -24px -24px;
  background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
  border-top: 2px solid #e2e8f0;
  border-radius: 0 0 16px 16px;
}

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

.sequence-action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sequence-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.sequence-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sequence-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sequence-action-btn-logs {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.sequence-action-btn-logs:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.sequence-action-btn-edit {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.sequence-action-btn-edit:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.sequence-action-btn-duplicate {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.sequence-action-btn-duplicate:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.sequence-action-btn-delete {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.sequence-action-btn-delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.sequence-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.sequence-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sequence-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cbd5e1;
  border-radius: 24px;
  transition: 0.3s;
}

.sequence-toggle-slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}

.sequence-toggle-input:checked + .sequence-toggle-slider {
  background: var(--blue);
}

.sequence-toggle-input:checked + .sequence-toggle-slider:before {
  transform: translateX(20px);
}

.sequence-card-body {
  margin-top: 12px;
}

.sequence-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin: 16px 0;
}

.sequence-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

.sequence-stat strong {
  color: #1e293b;
  font-weight: 700;
  font-size: 15px;
}

.sequence-stat.active strong {
  color: #2563eb;
}

.sequence-preview-timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  margin-top: 12px;
}

.sequence-preview-step {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sequence-preview-step-icon {
  font-size: 16px;
}

.sequence-preview-connector {
  color: var(--muted);
  font-size: 14px;
}

.sequence-preview-more {
  color: var(--muted);
  font-style: italic;
}

.sequences-empty {
  text-align: center;
  padding: 60px 20px;
}

.sequences-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.sequences-empty h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  color: var(--text);
}

/* Sequence Builder */
.sequence-builder {
  max-width: 900px;
  margin: 0 auto;
}

.builder-section {
  margin-bottom: 24px;
  padding: 20px;
  background: #f9fafb;
  border-radius: 12px;
}

.builder-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  cursor: help;
  transition: all 0.2s;
}

.help-icon:hover {
  background: var(--blue);
  color: white;
}

.help-tooltip-popup {
  position: fixed;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 10001;
  max-width: 360px;
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  pointer-events: auto;
  animation: fadeIn 0.2s ease-out;
}

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

/* Contact Filters Builder */
.contact-filters-builder {
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  min-height: 40px;
  align-items: center;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
}

.tag-remove {
  background: transparent;
  border: none;
  color: #1e40af;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  margin-left: 4px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.tag-remove:hover {
  background: #dbeafe;
  color: #1e3a8a;
}

.tag-input {
  flex: 1;
  min-width: 150px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  padding: 4px 0;
}

.trigger-builder {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trigger-condition {
  display: flex;
  align-items: center;
  gap: 8px;
}

.steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step-insert-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
  position: relative;
  height: 40px;
}

.step-insert-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, transparent, #e5e7eb, transparent);
  transition: all 0.2s;
}

.step-insert-container:hover .step-insert-line {
  background: linear-gradient(to right, transparent, #2563eb, transparent);
}

.step-insert-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  border: 2px solid #e5e7eb;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 8px;
  font-size: 18px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.step-insert-button:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.step-insert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.step-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s;
}

.step-card:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: grab;
  color: #9ca3af;
  transition: color 0.2s;
  flex-shrink: 0;
}

.step-drag-handle:hover {
  color: #2563eb;
}

.step-drag-handle:active {
  cursor: grabbing;
}

.step-card[draggable="true"] {
  cursor: move;
}

.step-card.dragging {
  opacity: 0.5;
}

.step-drop-indicator {
  height: 4px;
  background: #2563eb;
  border-radius: 2px;
  margin: 8px 0;
  transition: opacity 0.2s;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.step-type-select {
  flex: 1;
}

.step-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-timing {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.timing-options {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.radio input[type="radio"] {
  width: auto;
  margin: 0;
}

.delay-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.conditional-wait {
  margin-top: 12px;
  padding: 12px;
  background: #eff6ff;
  border-radius: 8px;
  border-left: 3px solid var(--blue);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.condition-config {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.builder-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.steps-empty {
  text-align: center;
  padding: 40px 20px;
  background: #f9fafb;
  border-radius: 12px;
}

/* Help Styles */
.sequences-help {
  max-width: 900px;
  margin: 0 auto;
}

.help-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.help-card-header h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.help-card-body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.help-steps {
  margin: 0;
  padding-left: 20px;
}

.help-steps li {
  margin-bottom: 8px;
}

.help-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.help-item:last-child {
  border-bottom: none;
}

.help-example {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}

.help-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.help-action-item {
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  text-align: center;
}

.help-action-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* Sequences Fullscreen & Resize */
.sequences-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 10070 !important;
}

.backdrop.show.sequences-fullscreen-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.step-content-enhanced {
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.step-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.step-type-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.step-type-badge svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex-shrink: 0;
}

.sequence-step-types {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tab-icon {
  font-size: 18px;
  filter: grayscale(0.3);
  transition: all 0.2s;
  display: inline-block;
}

.sequences-tab.active .tab-icon {
  filter: grayscale(0);
  transform: scale(1.1);
}

.sequences-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 0%, transparent 40%, #cbd5e1 40%, #cbd5e1 45%, transparent 45%, transparent 55%, #cbd5e1 55%, #cbd5e1 60%, transparent 60%);
  z-index: 10;
}

.sequences-resize-handle:hover {
  background: linear-gradient(135deg, transparent 0%, transparent 40%, #2563eb 40%, #2563eb 45%, transparent 45%, transparent 55%, #2563eb 55%, #2563eb 60%, transparent 60%);
}

.sequences-modal {
  resize: none !important;
}

.help-example-sequence {
  margin-bottom: 20px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
}

.help-example-sequence strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.help-example-sequence ol {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: var(--muted);
}

.pill.neutral {
  background: #e5e7eb;
  color: #64748b;
}

/* Enrollment log items */
.enrollment-log-item {
  cursor: pointer;
  user-select: none;
}

.enrollment-log-item:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.enrollment-log-item.selected {
  background: #eff6ff !important;
  border-color: #2563eb !important;
}

.enrollment-log-item.selected:hover {
  background: #eff6ff !important;
  border-color: #2563eb !important;
}
