/* ── Design tokens ───────────────────────────────────────── */
:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-focus: #6366F1;

  --sidebar-bg: #0F172A;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-active-bg: rgba(99,102,241,0.18);
  --sidebar-active-text: #A5B4FC;
  --sidebar-text: #94A3B8;
  --sidebar-label: #475569;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-light: #EEF2FF;
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-light: #EEF2FF;

  --text: #0F172A;
  --text-muted: #64748B;
  --text-faint: #94A3B8;

  --success: #10B981;
  --success-light: #ECFDF5;
  --success-text: #065F46;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --danger-light: #FEF2F2;
  --danger-text: #991B1B;
  --warning-light: #FFFBEB;
  --warning-text: #92400E;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.12), 0 8px 10px -6px rgba(0,0,0,0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Typography scale */
  --text-xs: 10px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Motion */
  --duration-fast: 0.12s;
  --duration-base: 0.15s;
  --duration-slow: 0.25s;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Icon sizes */
  --icon-sm: 14px;
  --icon-md: 16px;
  --icon-lg: 20px;

  /* Surface variants */
  --surface-subtle: #F8FAFC;
  --surface-muted: #F1F5F9;
  --divider: #E2E8F0;
}

/* ── Dark Mode ──────────────────────────────────────────── */
:root.dark {
  --bg: #0F172A;
  --surface: #1E293B;
  --surface-subtle: #1E293B;
  --surface-muted: #263348;
  --divider: #334155;
  --border: #334155;
  --border-focus: #818CF8;

  --sidebar-bg: #0B1120;
  --sidebar-hover: rgba(255,255,255,0.05);
  --sidebar-active-bg: rgba(129,140,248,0.15);
  --sidebar-active-text: #C7D2FE;
  --sidebar-text: #94A3B8;
  --sidebar-label: #475569;

  --accent: #818CF8;
  --accent-hover: #6366F1;
  --accent-light: rgba(99,102,241,0.15);

  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-faint: #64748B;

  --success: #34D399;
  --success-light: rgba(16,185,129,0.12);
  --success-text: #6EE7B7;
  --danger: #F87171;
  --danger-hover: #EF4444;
  --danger-light: rgba(239,68,68,0.12);
  --danger-text: #FCA5A5;
  --warning-light: rgba(245,158,11,0.12);
  --warning-text: #FCD34D;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5), 0 8px 10px -6px rgba(0,0,0,0.3);
}

/* Dark mode component overrides */
:root.dark .stage-new        { background: rgba(148,163,184,0.15); color: #CBD5E1; }
:root.dark .stage-contacted  { background: rgba(99,102,241,0.15); color: #A5B4FC; }
:root.dark .stage-responded  { background: rgba(251,191,36,0.15); color: #FCD34D; }
:root.dark .stage-won        { background: rgba(16,185,129,0.15); color: #6EE7B7; }

:root.dark .s-new        { background: rgba(148,163,184,0.15); color: #CBD5E1; }
:root.dark .s-contacted  { background: rgba(99,102,241,0.15); color: #A5B4FC; }
:root.dark .s-opened     { background: rgba(251,191,36,0.15); color: #FCD34D; }
:root.dark .s-responded  { background: rgba(139,92,246,0.15); color: #C4B5FD; }
:root.dark .s-won        { background: rgba(16,185,129,0.15); color: #6EE7B7; }
:root.dark .s-lost       { background: rgba(239,68,68,0.12); color: #FCA5A5; }

:root.dark .icon-blue    { background: rgba(37,99,235,0.15); color: #60A5FA; }
:root.dark .icon-indigo  { background: rgba(67,56,202,0.15); color: #A5B4FC; }
:root.dark .icon-violet  { background: rgba(124,58,237,0.15); color: #C4B5FD; }
:root.dark .icon-emerald { background: rgba(5,150,105,0.15); color: #6EE7B7; }

:root.dark .col-count { background: rgba(255,255,255,0.08); color: var(--text-muted); }

:root.dark .pipeline-card { background: var(--surface); border-color: var(--border); }
:root.dark .card-no-flow { background: rgba(99,102,241,0.15); }
:root.dark .card-no-flow:hover { background: rgba(99,102,241,0.25); }
:root.dark .contact-card { background: var(--surface); border-color: var(--border); }
:root.dark .stat-card { background: var(--surface); border-color: var(--border); }

:root.dark .data-table th { background: var(--surface-muted); }
:root.dark .data-table tr:hover td { background: rgba(255,255,255,0.03); }

:root.dark .form-card { background: var(--surface); border-color: var(--border); }
:root.dark .table-card { background: var(--surface); border-color: var(--border); }
:root.dark .modal-box { background: var(--surface); border-color: var(--border); }
:root.dark .cmd-k-box { background: var(--surface); border-color: var(--border); }

:root.dark input,
:root.dark textarea,
:root.dark select {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
:root.dark input::placeholder,
:root.dark textarea::placeholder { color: var(--text-faint); }

:root.dark .btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
:root.dark .btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }

:root.dark .btn-primary {
  box-shadow: 0 1px 3px rgba(129,140,248,0.3), 0 0 0 1px rgba(129,140,248,0.2);
}

:root.dark .login-card { background: var(--surface); border-color: var(--border); }
:root.dark .login-screen { background: var(--bg); }

:root.dark .notif-panel { background: var(--surface); border-color: var(--border); }

:root.dark .you-badge { background: rgba(129,140,248,0.15); color: #A5B4FC; }

:root.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }
:root.dark ::-webkit-scrollbar-track { background: transparent; }

:root.dark .settings-section-header .settings-section-icon {
  border-color: var(--border);
}

:root.dark .skeleton { background: var(--surface-muted); }
:root.dark .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
}

:root.dark .onboarding-bar { background: var(--surface); border-color: var(--border); }
:root.dark .onboarding-step { border-color: var(--border); }

:root.dark .perm-custom-badge { background: rgba(251,191,36,0.15); color: #FCD34D; }

:root.dark .bottom-tab-bar {
  background: rgba(15,23,42,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  border-top-color: rgba(255,255,255,0.08);
}
:root.dark .bottom-tab { color: var(--text-faint); }
:root.dark .bottom-tab.active { color: var(--accent); }

:root.dark .cp-page { background: var(--bg); }
:root.dark .cp-sidebar { background: var(--surface); border-color: var(--border); }
:root.dark .cp-section { border-color: var(--border); }
:root.dark .cp-tab-btn { color: var(--text-muted); }
:root.dark .cp-tab-btn.active { color: var(--accent); border-color: var(--accent); }

:root.dark .report-placeholder-overlay { background: rgba(15,23,42,0.85); }
:root.dark .report-kpi-card { background: var(--surface); border-color: var(--border); }
:root.dark .report-chart-card canvas { filter: brightness(0.9); }

:root.dark .task-item { background: var(--surface); border-color: var(--border); }
:root.dark .tasks-count-overdue  { background: rgba(239,68,68,0.15); }
:root.dark .tasks-count-today    { background: rgba(245,158,11,0.15); }
:root.dark .tasks-count-upcoming { background: rgba(99,102,241,0.15); }
:root.dark .tasks-count-done     { background: rgba(16,185,129,0.15); }
:root.dark .task-input-row input { background: var(--bg); border-color: var(--border); color: var(--text); }
:root.dark .task-input-row input::placeholder { color: var(--text-faint); }

:root.dark .flow-card { background: var(--surface); border-color: var(--border); }
:root.dark .template-card { background: var(--surface); border-color: var(--border); }

:root.dark .users-tab-btn { color: var(--text-muted); }
:root.dark .users-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
:root.dark .users-tab-btn:hover { color: var(--text); }

:root.dark .perms-matrix-card { background: var(--surface); border-color: var(--border); }
:root.dark .perms-matrix-table th { background: var(--surface-muted); }
:root.dark .perm-audit-card { background: var(--surface); border-color: var(--border); }
:root.dark .perm-audit-icon { background: rgba(124,58,237,0.15); }

:root.dark .toast { background: var(--surface); border-color: var(--border); color: var(--text); }

/* ── Appearance / Theme Toggle (Settings) ─────────────────── */
.appearance-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0;
}
.appearance-theme-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.theme-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-default);
}
.theme-opt:hover { color: var(--text); }
.theme-opt.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow: hidden; }
body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── Layout ──────────────────────────────────────────────── */
.app { display: flex; height: 100vh; overflow: hidden; }
.workspace { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: relative;
  width: 232px;
  min-width: 232px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo-img {
  width: 100%;
  max-width: 216px;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}

.sidebar-nav { flex: 1; padding: var(--space-3) var(--space-2); overflow-y: auto; }
.nav-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sidebar-label);
  padding: 6px 10px 4px;
  margin-top: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: var(--space-2) 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default);
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #E2E8F0; }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: var(--icon-md); height: var(--icon-md); flex-shrink: 0; opacity: 0.8; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 14px 16px;
}
/* Logged-in user row */
.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  margin-bottom: 10px;
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px; font-weight: 600; color: #E2E8F0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: var(--text-xs); color: var(--sidebar-label);
  text-transform: uppercase; letter-spacing: 0.04em; margin-top: 1px;
}

.sidebar-stat-row { display: flex; align-items: center; gap: 0; }
.sidebar-stat { flex: 1; text-align: center; }
.sidebar-stat-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.08); }
.sidebar-stat-n { display: block; font-size: 17px; font-weight: 700; color: #E2E8F0; }
.sidebar-stat-l { display: block; font-size: 9px; color: var(--sidebar-label); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px; }

/* ── Views ───────────────────────────────────────────────── */
.view { display: none; flex: 1; overflow-y: auto; padding: 28px 32px 40px; }
.view.active { display: block; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: var(--text-xl); font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.page-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-header-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-default), box-shadow var(--duration-base) var(--ease-default), transform var(--duration-fast);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(99,102,241,0.3), 0 0 0 1px rgba(99,102,241,0.2);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(99,102,241,0.4); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-violet { background: var(--accent); color: white; }
.btn-violet:hover { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(99,102,241,0.4); }
.btn-sm { padding: 5px 11px; font-size: var(--text-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Stats row ───────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-base) var(--ease-default);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-blue   { background: #EFF6FF; color: #2563EB; }
.icon-indigo { background: #EEF2FF; color: #4338CA; }
.icon-violet { background: #F5F3FF; color: #7C3AED; }
.icon-emerald{ background: #ECFDF5; color: #059669; }
.stat-card-num { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; line-height: 1; }
.stat-card-label { font-size: var(--text-sm); color: var(--text-muted); margin-top: 3px; }

/* ── Pipeline board ──────────────────────────────────────── */
/* ── Pipeline view toggle ───────────────────────────────────── */
.contacts-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.contacts-toolbar .pipeline-view-toggle {
  margin-bottom: 0;
  flex-shrink: 0;
}
.filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.filter-chip.active .chip-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 2px;
}
.filter-chip-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}
:root.dark .filter-chip { background: var(--surface); }
:root.dark .filter-chip:hover { background: rgba(99,102,241,0.15); }
:root.dark .filter-chip.active { background: var(--accent); }

.pipeline-view-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  width: fit-content;
}
.toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-default);
}
.toggle-btn:hover { color: var(--text); background: var(--surface); }
.toggle-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── Stage pills (pipeline table) ──────────────────────────── */
.stage-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.stage-new        { background: #DBEAFE; color: #1E40AF; }
.stage-contacted  { background: #E0E7FF; color: #3730A3; }
.stage-responded  { background: #FEF3C7; color: #92400E; }
.stage-won        { background: #D1FAE5; color: #065F46; }

.pipeline-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 24px;
  min-height: 400px;
  align-items: flex-start;
}
.pipeline-board::-webkit-scrollbar { height: 6px; }
.pipeline-board::-webkit-scrollbar-track { background: transparent; }
.pipeline-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }

.pipeline-col {
  min-width: 230px;
  width: 230px;
  flex-shrink: 0;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pipeline-col-header {
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.col-new .col-dot       { background: #94A3B8; }
.col-contacted .col-dot { background: #3B82F6; }
.col-opened .col-dot    { background: #F59E0B; }
.col-responded .col-dot { background: #8B5CF6; }
.col-won .col-dot       { background: #10B981; }
.col-lost .col-dot      { background: #EF4444; }

.col-label { font-size: var(--text-sm); font-weight: 700; color: var(--text); flex: 1; }
.col-count {
  background: var(--divider);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.pipeline-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.col-empty {
  text-align: center;
  padding: 28px 10px;
  color: var(--text-faint);
  font-size: var(--text-sm);
}

/* Pipeline cards */
.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  cursor: pointer;
  transition: box-shadow 0.14s, border-color 0.14s, transform 0.1s;
  position: relative;
}
.pipeline-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #CBD5E1;
  transform: translateY(-1px);
}
.pipeline-card[draggable="true"] { cursor: grab; }
.pipeline-card[draggable="true"]:active { cursor: grabbing; }
.pipeline-card.dragging {
  opacity: 0.35;
  transform: scale(0.95);
  box-shadow: none;
}
.pipeline-col.drag-over {
  background: rgba(99, 102, 241, 0.06);
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
}
.pipeline-col.drag-over .pipeline-cards {
  min-height: 80px;
}
.card-top { display: flex; align-items: center; gap: 9px; }
.card-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0;
}
.card-info { flex: 1; min-width: 0; }
.card-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-practice { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info { flex: 1; min-width: 0; }
.card-engagement {
  display: flex; gap: 4px; align-items: center; flex-shrink: 0; margin-left: auto;
}
.eng-opened { color: var(--success); display: flex; align-items: center; }
.eng-clicked { color: var(--accent); display: flex; align-items: center; }
.card-flow-row {
  padding: 0 12px; margin-bottom: 2px; font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.card-meta-left { min-width: 0; flex: 1; }
.card-email { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.card-activity { font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.card-no-flow {
  display: flex; align-items: center; gap: 5px;
  margin-top: 8px; padding: 5px 10px;
  font-size: 11px; color: var(--accent); cursor: pointer;
  background: var(--accent-light); border-radius: var(--radius-sm);
  transition: background var(--duration-fast);
}
.card-no-flow:hover { background: #E0E7FF; }
.pipeline-card.no-flow { border-left: 3px solid var(--border); }
.card-send-btn {
  color: var(--accent) !important; font-size: 11px; font-weight: 600;
  gap: 4px; width: auto !important; padding: 0 8px !important;
}

/* ── Pipeline card quick actions ────────────────────────── */
.card-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--divider);
  opacity: 0;
  height: 0;
  overflow: visible;
  transition: opacity var(--duration-fast), height var(--duration-fast), margin var(--duration-fast), padding var(--duration-fast);
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.pipeline-card:hover .card-actions {
  opacity: 1;
  height: 28px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--divider);
}
.card-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast), color var(--duration-fast);
  padding: 0;
}
.card-action-btn:hover {
  background: var(--surface-muted);
  color: var(--accent);
}
.card-action-dropdown-wrap {
  position: relative;
}
.card-action-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  padding: 4px;
}
.card-popup-item {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: none;
  background: none;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--duration-fast);
  white-space: nowrap;
}
.card-popup-item:hover {
  background: var(--surface-muted);
}
.card-popup-item.active {
  color: var(--accent);
  font-weight: 600;
}
.card-popup-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.step-dots { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #E2E8F0;
  border: 1.5px solid #CBD5E1;
  transition: background 0.15s;
}
.step-dot.filled { background: var(--accent); border-color: var(--accent); }
.step-dot.filled-all { background: var(--success); border-color: var(--success); }

/* ── Table ───────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  overflow-y: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover td { background: #FAFBFE; }

.td-name { display: flex; align-items: center; gap: 10px; }
.td-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
}
.td-name-text { font-weight: 600; color: var(--text); }
.td-name-sub { font-size: 11px; color: var(--text-muted); }
.td-email { font-size: 12px; color: var(--text-muted); }
.td-phone { font-size: 12px; color: var(--text-muted); }

/* ── Contact cards grid ─────────────────────────────────── */
.contacts-cards-grid { padding: 0; }
.contacts-cards-grid #contacts-cards-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-card:hover { border-color: #C4B5FD; box-shadow: var(--shadow-sm); }
.contact-card-header { display: flex; align-items: flex-start; gap: 12px; }
.contact-card-avatar { width: 40px; height: 40px; font-size: 13px; flex-shrink: 0; }
.contact-card-name { flex: 1; min-width: 0; }
.contact-card-fullname { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-card-practice { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-card-meta { display: flex; flex-direction: column; gap: 6px; }
.contact-card-row { display: flex; align-items: center; gap: 6px; }
.contact-card-email { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); margin-top: auto; }

.table-step-dots { display: flex; gap: 4px; }

.table-actions { display: flex; gap: 6px; }

/* ── Search ──────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-input {
  padding: 8px 12px 8px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  min-width: 220px;
  outline: none;
  color: var(--text);
  transition: border 0.14s, box-shadow 0.14s;
}
.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.search-input::placeholder { color: var(--text-faint); }

/* ── Tooltip ─────────────────────────────────────────────── */
.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: default;
  margin-left: 4px;
  vertical-align: middle;
}
.tip svg { color: var(--text-faint); flex-shrink: 0; }
.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #F8FAFC;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  width: max-content;
  max-width: 260px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1E293B;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 100;
}
.tip:hover::after, .tip:hover::before { opacity: 1; }

/* ── Forms ───────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 760px;
}
.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group-full { grid-column: 1 / -1; }
.form-col-sm { grid-column: span 1; max-width: 140px; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.req { color: var(--danger); }
.optional { font-weight: 400; color: var(--text-faint); }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border 0.14s, box-shadow 0.14s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: #CBD5E1; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.flow-select-hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.4; }
.import-flow-select { margin-top: 16px; padding: 14px 16px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ── Settings ────────────────────────────────────────────── */
.settings-layout { max-width: 760px; }
.settings-section-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}
.settings-section-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-section-title { font-size: var(--text-base); font-weight: 700; color: var(--text); }
.settings-section-sub { font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }

/* ── Import ──────────────────────────────────────────────── */
.import-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.import-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.import-step-num {
  width: 22px; height: 22px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.import-step code {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent);
}
.import-example-block {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 4px;
}
.import-example-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.import-example {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre;
}
/* ── Alert / message ─────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.alert.success { background: var(--success-light); color: var(--success-text); border: 1px solid #A7F3D0; }
.alert.error   { background: var(--danger-light);  color: var(--danger-text);  border: 1px solid #FECACA; }
.alert.info    { background: var(--accent-light);  color: #3730A3;             border: 1px solid #C7D2FE; }
.hidden { display: none !important; }

/* ── Status pills ────────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.s-new          { background: var(--surface-muted); color: #475569; border: 1px solid #CBD5E1; }
.s-contacted    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.s-responded    { background: #F5F3FF; color: #6D28D9; border: 1px solid #DDD6FE; }
.s-won          { background: var(--success-light); color: #065F46; border: 1px solid #A7F3D0; }
.s-lost         { background: var(--danger-light);  color: #991B1B; border: 1px solid #FECACA; }
.s-opened       { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ── Step badges ─────────────────────────────────────────── */
.step-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.step-badge-none { background: var(--surface-muted); color: #64748B; }
.step-badge-mid  { background: #EEF2FF; color: #4338CA; }
.step-badge-done { background: var(--success-light); color: #065F46; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  transition: opacity 0.15s, visibility 0.15s;
}
.modal-overlay.hidden {
  display: flex !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0,0,0,0.05);
}
.modal-sm { max-width: 400px; padding: 32px; text-align: center; }
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface-muted);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
  z-index: 1;
}
.modal-close-btn:hover { background: #E2E8F0; color: var(--text); }

/* Modal internals (rendered by JS) */
.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 48px 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  letter-spacing: -0.03em;
}
.modal-header-info { flex: 1; min-width: 0; }
.modal-name { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.modal-practice { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.modal-body { padding: 20px 24px; }

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.info-item { display: flex; align-items: flex-start; gap: 10px; }
.info-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}
.info-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.info-value { font-size: 13px; color: var(--text); margin-top: 2px; word-break: break-word; }
.info-full { grid-column: 1 / -1; }

/* Email sequence timeline */
.seq-section { margin-bottom: 20px; }
.seq-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.seq-timeline { display: flex; flex-direction: column; gap: 0; }
.seq-item {
  display: flex;
  gap: 14px;
  position: relative;
}
.seq-item:not(:last-child) .seq-line-wrap::after {
  content: '';
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% + 4px);
  background: var(--border);
}
.seq-item.seq-sent:not(:last-child) .seq-line-wrap::after { background: #A7F3D0; }
.seq-line-wrap { position: relative; display: flex; flex-direction: column; align-items: center; width: 24px; flex-shrink: 0; padding-top: 2px; }
.seq-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  flex-shrink: 0;
  z-index: 1;
  transition: all 0.15s;
}
.seq-sent .seq-circle { background: var(--success); border-color: var(--success); color: white; }
.seq-next .seq-circle { background: var(--accent); border-color: var(--accent); color: white; }

.seq-content {
  flex: 1;
  padding-bottom: 16px;
}
.seq-title { font-size: 13px; font-weight: 600; color: var(--text); }
.seq-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.seq-next .seq-title { color: var(--accent); }
.seq-actions { display: flex; gap: 6px; margin-top: 6px; }

/* Inline email preview */
.seq-preview {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease, opacity 0.2s ease;
  opacity: 0;
  margin-top: 0;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
}
.seq-preview.open {
  max-height: 400px;
  overflow-y: auto;
  opacity: 1;
  margin-top: 10px;
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.seq-preview-subject {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius) var(--radius) 0 0;
}
.seq-preview-subject strong { color: var(--text); }
.seq-preview-body {
  padding: 16px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.seq-preview-body img { max-width: 100%; height: auto; }

/* Email log expand */
.email-log-toggle {
  color: var(--primary);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.email-log-toggle:hover { text-decoration: underline; }
.email-log-body {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.5;
}
.email-log-subject {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.email-log-content { word-wrap: break-word; }

/* Status quick-change pills */
.status-section { margin-bottom: 4px; }
.status-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.status-pills-row { display: flex; flex-wrap: wrap; gap: 6px; }
.status-pill-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.status-pill-btn:hover { border-color: #CBD5E1; background: var(--bg); }
.status-pill-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.status-pill-btn.active-won { border-color: var(--success); background: var(--success-light); color: #065F46; }
.status-pill-btn.active-lost { border-color: var(--danger); background: var(--danger-light); color: #991B1B; }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #FAFBFE;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal-footer-spacer { flex: 1; }

/* Confirm modal */
.confirm-icon { font-size: 32px; margin-bottom: 12px; }
.confirm-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.confirm-msg { font-size: 13.5px; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: center; gap: 10px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.success { background: #064E3B; }
.toast.error   { background: #7F1D1D; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Template library ────────────────────────────────────── */
/* ── Template card grid ───────────────────────────────────── */
.template-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.template-card-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.14s, border-color 0.14s, transform 0.12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.template-card-v2:hover { box-shadow: var(--shadow-md); border-color: #CBD5E1; transform: translateY(-1px); }

.tc-v2-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.tc-v2-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tc-badge-default {
  background: var(--surface-muted); color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 600;
}

.tc-badge-ai {
  display: inline-flex; align-items: center; gap: 3px;
  background: #EEF2FF; color: var(--accent);
  border: 1px solid #C7D2FE;
  padding: 2px 7px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 600;
}

.tc-v2-subject {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-v2-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.tc-v2-type {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.tc-v2-date {
  font-size: 11px;
  color: var(--text-faint);
}

.tc-v2-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Template editor ─────────────────────────────────────── */
#view-template-editor.active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.template-editor-layout {
  display: flex;
  gap: 20px;
  flex: 1;
  overflow: hidden;
  padding-bottom: 24px;
}
.editor-left {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
.editor-right {
  width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Body mode toggle (Plain Text | HTML) */
.body-mode-toggle {
  display: inline-flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.body-mode-btn {
  padding: 4px 12px;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
  letter-spacing: 0.01em;
}
.body-mode-btn + .body-mode-btn { border-left: 1.5px solid var(--border); }
.body-mode-btn:hover { background: var(--bg); color: var(--text); }
.body-mode-btn.active { background: var(--accent-light); color: var(--accent); }

/* Plain-text mode textarea — use proportional font */
.template-editor-textarea.plaintext-mode {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13.5px;
  line-height: 1.7;
  background: #FAFBFD;
}

/* Step selector (in editor) */
.step-selector { display: flex; gap: 6px; }
.step-sel-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.step-sel-btn:hover { border-color: #CBD5E1; background: var(--bg); }
.step-sel-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

/* HTML textarea */
.template-editor-textarea {
  width: 100%;
  height: 340px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.65;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  color: var(--text);
  background: #FAFBFC;
  outline: none;
  transition: border 0.14s, box-shadow 0.14s, background 0.14s;
  tab-size: 2;
}
.template-editor-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
  background: white;
}

/* Variables panel */
.vars-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 4px;
}
.vars-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  background: #F8FAFC;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background 0.12s;
}
.vars-toggle:hover { background: var(--surface-muted); }
.vars-body { padding: 14px; border-top: 1px solid var(--border); display: none; }
.vars-body.open { display: block; }
.vars-hint { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.vars-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.var-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.var-chip:hover { border-color: var(--accent); background: var(--accent-light); }
.var-chip code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}
.var-chip span { font-size: 10px; color: var(--text-faint); }

/* Preview panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  background: var(--surface);
}
.preview-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.preview-badge {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #C7D2FE;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.preview-subject-bar {
  padding: 9px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: white;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-subject-bar strong { color: var(--text); }
.preview-frame {
  flex: 1;
  border: none;
  width: 100%;
  background: white;
}

/* ── Login screen ────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.login-screen.hidden { display: none !important; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 44px 40px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-xl);
  text-align: center;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.login-logo-img {
  width: 100%;
  max-width: 270px;
  height: auto;
  display: block;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.logout-btn { color: var(--sidebar-text) !important; }
.logout-btn:hover { color: #E2E8F0 !important; }

/* ── Bulk Send Modal ─────────────────────────────────────── */
.bulk-modal { max-width: 520px; padding: 0; display: flex; flex-direction: column; max-height: 82vh; }
.bulk-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.bulk-modal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.bulk-modal-search svg { flex-shrink: 0; }
.bulk-modal-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13.5px;
  color: var(--text);
  background: transparent;
  font-family: inherit;
}
.bulk-modal-search input::placeholder { color: var(--text-muted); }
.bulk-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.bulk-select-all-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.bulk-count { color: var(--text-muted); font-size: 12px; }
.bulk-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
  min-height: 80px;
}
.bulk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid transparent;
}
.bulk-row:hover { background: var(--bg); }
.bulk-row input[type="checkbox"] { flex-shrink: 0; cursor: pointer; width: 15px; height: 15px; }
.bulk-row-info { flex: 1; min-width: 0; }
.bulk-row-name { display: block; font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-row-practice { display: block; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bulk-step-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}
.bulk-step-badge.step-1 { background: var(--surface-muted); color: #64748B; }
.bulk-step-badge.step-2 { background: #EFF6FF; color: #3B82F6; }
.bulk-step-badge.step-3 { background: #F0FDF4; color: #16A34A; }
.bulk-empty { padding: 28px 20px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.bulk-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Email Tracking Toggle ───────────────────────────────── */
.tracking-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.tracking-toggle:hover { border-color: var(--text-muted); }
.tracking-toggle.active { background: #EEF2FF; border-color: #A5B4FC; color: var(--accent); }
.tracking-toggle .tracking-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.15s ease;
}
.tracking-toggle.active .tracking-dot { background: var(--accent); }
.tracking-toggle-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.tracking-toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  background: #CBD5E1;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.tracking-toggle-switch.on { background: var(--accent); }
.tracking-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tracking-toggle-switch.on::after { transform: translateX(16px); }

/* ── User modal ──────────────────────────────────────────── */
.user-row:hover td { background: var(--bg); }
.user-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--border);
}
.user-modal-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-modal-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.you-badge {
  font-size: 10px;
  font-weight: 600;
  background: #EEF2FF;
  color: #6366F1;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.user-modal-body { padding: 4px 0; }
.user-modal-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.user-modal-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.user-role-row { display: flex; gap: 8px; align-items: center; }
.user-profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* User modal avatar with upload */
.user-modal-avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}
.user-modal-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.user-modal-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  color: #fff;
}
.user-modal-avatar-wrap:hover .user-modal-avatar-overlay { opacity: 1; }
.user-role-select {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.user-role-select:focus { border-color: var(--accent); }
.user-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Flows ───────────────────────────────────────────────── */
.flows-list { display: flex; flex-direction: column; gap: 10px; max-width: 680px; }
.flow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color var(--duration-base) var(--ease-default), box-shadow var(--duration-base) var(--ease-default);
}
.flow-card:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.08); }
.flow-card-name { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.flow-card-meta { font-size: 12.5px; color: var(--text-muted); }
.flow-card-right { display: flex; align-items: center; gap: 10px; color: var(--text-muted); }
.flow-step-count, .flow-contact-count {
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}
.flow-empty { color: var(--text-muted); font-size: 14px; padding: 40px 0; text-align: center; }

/* Flow editor */
.fe-step-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.fe-step-row:last-child { border-bottom: none; }
.fe-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fe-step-select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.fe-step-select:focus { border-color: var(--accent); }
.fe-step-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.fe-step-remove:hover { color: #DC2626; background: #FEF2F2; }
.fe-steps-empty { color: var(--text-muted); font-size: 13.5px; padding: 16px 0; text-align: center; }

/* ── Password eye toggle ─────────────────────────────────── */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap input[type="password"],
.pw-wrap input[type="text"] {
  flex: 1;
  padding-right: 38px !important;
}
.pw-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  border-radius: 4px;
  line-height: 0;
  transition: color 0.15s;
}
.pw-eye-btn:hover { color: var(--text); }
.pw-eye-btn svg { width: 16px; height: 16px; }

/* Flow step delay input row */
.fe-step-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.fe-step-delay {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: 12px;
}
.fe-step-delay svg {
  flex-shrink: 0;
  color: var(--text-faint);
}
.fe-step-delay-label {
  white-space: nowrap;
}
.fe-step-delay-input {
  width: 56px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}
.fe-step-delay-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Send delay notice in contact modal */
.send-delay-notice {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
}

/* Step delay badge in contact modal flow steps list */
.step-delay-badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-alt);
  color: var(--text-faint);
  border-radius: 4px;
  font-size: 11px;
  padding: 1px 5px;
  margin-left: 4px;
  font-weight: 500;
}

/* ── CSV Import ──────────────────────────────────────────── */

/* ── Logo Upload ──────────────────────────────────────────── */
.logo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  background: var(--bg-subtle, #fafafa);
  transition: border-color 0.15s;
  position: relative;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-empty-text {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 10px;
}
#logo-preview-wrap {
  position: relative;
  display: inline-block;
}
.logo-preview-img {
  max-height: 80px;
  max-width: 260px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}
.logo-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger, #ef4444);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 0;
  line-height: 1;
}
.logo-remove-btn:hover { background: #dc2626; }
.logo-upload-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

/* ── Sortable Table Headers ─────────────────────────────────── */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--primary); }
.sort-arrow { font-size: 11px; color: var(--primary); }

/* ── CSV Import Modal ──────────────────────────────────────── */
.import-modal {
  max-width: 640px;
  width: 90vw;
  padding: 28px;
  max-height: 85vh;
  overflow-y: auto;
}
.import-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.import-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.import-drop-zone:hover, .import-drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
}
.import-file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 12px;
}
.import-file-name {
  font-weight: 600;
  font-size: 14px;
}
.import-file-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.import-preview-raw {
  margin-top: 12px;
}
.import-table-wrap {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.import-preview-table th {
  background: var(--bg);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.import-preview-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-preview-table tr:last-child td { border-bottom: none; }
.import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.import-loading {
  text-align: center;
  padding: 48px 20px;
}
.import-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-sm {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes ai-dot { 0%,80%,100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }
.import-result-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.import-result-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.import-result-row:last-child { border-bottom: none; }
.import-result-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}
.import-result-detail {
  font-size: 12px;
  color: var(--text-muted);
}
.btn-xs {
  font-size: 12px;
  padding: 4px 10px;
}
.import-success-icon {
  flex-shrink: 0;
}

/* ── Modal tabs ──────────────────────────────────────────────── */
.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 16px -24px 0;
  padding: 0 24px;
}
.modal-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.modal-tab-btn:hover { color: var(--text); }
.modal-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-badge {
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
}
.modal-tab-btn.active .tab-badge {
  background: var(--primary-light);
  color: var(--primary);
}
.modal-tab-panel {
  padding-top: 14px;
}

/* ── Activity feed ───────────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-icon-green  { background: #ecfdf5; color: #059669; }
.activity-icon-red    { background: #fef2f2; color: #dc2626; }
.activity-icon-blue   { background: #eff6ff; color: #2563eb; }
.activity-icon-purple { background: #f5f3ff; color: #7c3aed; }
.activity-icon-yellow { background: #fffbeb; color: #d97706; }
.activity-icon-orange { background: #fff7ed; color: #ea580c; }
.activity-icon-gray   { background: #f8fafc; color: #64748b; }
.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-detail {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}
.activity-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.activity-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 24px 0;
}

/* ── Nav badge ─────────────────────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #EF4444;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  margin-left: auto;
  line-height: 1;
}
.nav-badge.hidden { display: none; }

/* ── Notes panel ───────────────────────────────────────────── */
.notes-panel, .tasks-panel {
  padding: 4px 0 8px;
}
.note-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.note-item:last-of-type { border-bottom: none; }
.note-body {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 4px;
}
.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
}
.note-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0;
  transition: opacity .15s;
}
.note-item:hover .note-delete-btn { opacity: 1; }
.note-delete-btn:hover { color: #EF4444; }

/* ── Tasks panel ───────────────────────────────────────────── */
.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: box-shadow var(--duration-fast), border-color var(--duration-fast);
}
.task-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: #CBD5E1;
}
.task-item-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
}
.task-item-overdue {
  border-left: 3px solid #EF4444;
}
.task-item.task-completed {
  opacity: 0.6;
}
.task-reminder-icons {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  color: var(--text-faint);
  margin-left: 2px;
}
.task-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.task-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.task-title {
  font-size: 13px;
  color: var(--text);
}
.task-completed .task-title {
  text-decoration: line-through;
  color: var(--text-faint);
}
.task-due {
  font-size: 11px;
  color: var(--text-faint);
}
.task-overdue { color: #EF4444 !important; font-weight: 600; }
.task-due-today { color: #F59E0B !important; font-weight: 600; }
.task-contact-name {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.task-flow-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #7C3AED;
  background: #F3EAFF;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.task-reminder-icon {
  color: var(--text-faint);
  flex-shrink: 0;
}
.task-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0;
  transition: opacity .15s;
  flex-shrink: 0;
}
.task-item:hover .task-delete-btn { opacity: 1; }
.task-delete-btn:hover { color: #EF4444; }

/* ── Inline add forms ──────────────────────────────────────── */
.inline-add-form {
  background: var(--bg-subtle, #F9FAFB);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin: 8px 0;
}
.inline-textarea, .inline-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  font-family: inherit;
  margin-bottom: 8px;
}
.inline-textarea:focus, .inline-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent);
}
.inline-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
  flex: 1;
  margin-bottom: 8px;
}
.inline-add-row {
  display: flex;
  gap: 8px;
}
.inline-add-actions {
  display: flex;
  gap: 8px;
}
.inline-add-trigger {
  margin-top: 6px;
}

/* ── Tasks stats bar ───────────────────────────────────────── */
.tasks-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.tasks-stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.tasks-stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}
.tasks-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}
.tasks-stat-overdue .tasks-stat-num { color: #EF4444; }
.tasks-stat-today   .tasks-stat-num { color: #F59E0B; }
.tasks-stat-upcoming .tasks-stat-num { color: var(--primary); }
.tasks-stat-done     .tasks-stat-num { color: #10B981; }

/* ── Tasks quick-add ──────────────────────────────────────── */
.tasks-quick-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}
.tasks-quick-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
  padding: 6px 4px;
  font-family: inherit;
  min-width: 0;
}
.tasks-quick-input::placeholder { color: var(--text-faint); }
.tasks-quick-date {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  font-family: inherit;
}
@media (max-width: 600px) {
  .tasks-stats { flex-wrap: wrap; gap: 8px; }
  .tasks-stat { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .tasks-quick-add { flex-wrap: wrap; }
  .tasks-quick-input { flex: 1 1 100%; }
  .tasks-quick-date { flex: 1; }
}

/* ── Tasks view groups ─────────────────────────────────────── */
.tasks-group {
  margin-bottom: 20px;
}
.tasks-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tasks-group-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tasks-group-collapsible {
  cursor: pointer;
  user-select: none;
}
.tasks-group-collapsible:hover .tasks-group-title { color: var(--accent); }
.tasks-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  transition: color var(--duration-fast);
}
.tasks-group-icon { display: flex; align-items: center; }
.tasks-group-icon-overdue { color: #EF4444; }
.tasks-group-icon-today   { color: #F59E0B; }
.tasks-group-icon-upcoming { color: var(--accent); }
.tasks-group-icon-completed { color: var(--success); }
.tasks-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.tasks-count-overdue  { background: #FEF2F2; color: #DC2626; }
.tasks-count-today    { background: #FFFBEB; color: #D97706; }
.tasks-count-upcoming { background: var(--accent-light); color: var(--accent); }
.tasks-count-done     { background: var(--success-light); color: var(--success-text); }
.tasks-group-chevron {
  transition: transform var(--duration-base);
  color: var(--text-faint);
}
.tasks-group-chevron.collapsed { transform: rotate(-90deg); }
.tasks-group-body { display: flex; flex-direction: column; gap: 6px; }
.tasks-group-body.hidden { display: none; }

/* ── Task item actions ────────────────────────────────────── */
.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.task-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  opacity: 0;
}
.task-item:hover .task-send-btn { opacity: 1; }
.task-send-btn:hover { background: #DBEAFE; border-color: #93C5FD; }
@media (max-width: 600px) {
  .task-send-btn { opacity: 1; }
  .task-delete-btn { opacity: 1 !important; }
  .task-item { padding: 12px 0; }
  .task-checkbox { width: 20px; height: 20px; }
}

/* ── Custom Fields — contact modal ────────────────────────────────────────── */
.fields-panel {
  padding: 4px 0 8px;
}
.cf-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.cf-row:last-child { border-bottom: none; }
.cf-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cf-value-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cf-input {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.cf-input:hover { border-color: var(--border); background: var(--bg); }
.cf-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent);
}
.cf-saved {
  font-size: 11px;
  font-weight: 500;
  color: #10B981;
  min-width: 36px;
  opacity: 0;
  transition: opacity .2s;
}
.cf-saved.cf-saved-show { opacity: 1; }
.cf-saved.cf-saved-error { color: #EF4444; opacity: 1; }

/* ── Custom Fields — settings ──────────────────────────────────────────────── */
.cf-defs-empty {
  font-size: 13px;
  color: var(--text-faint);
  padding: 8px 0 12px;
}
.cf-def-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.cf-def-row:last-child { border-bottom: none; }
.cf-def-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.cf-def-name { font-size: 13px; font-weight: 500; color: var(--text); }
.cf-def-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  background: var(--bg-subtle, #F3F4F6);
  border-radius: 4px;
  padding: 2px 6px;
}
.cf-def-options {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.cf-def-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cf-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1;
}
.icon-purple {
  background: #EDE9FE;
  color: #7C3AED;
}

/* ── Reports ──────────────────────────────────────────────── */
.report-kpi-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.report-kpi-card {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.report-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}
.report-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.report-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.report-range-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.report-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .report-charts-grid { grid-template-columns: 1fr; }
}
.report-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}
.report-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}
.report-chart-wrap {
  position: relative;
  height: 220px;
}
.report-chart-wrap-sm {
  height: 200px;
}

/* ── Auto-send toggle ─────────────────────────────────────── */
.auto-send-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  margin-top: 12px;
  background: var(--accent-light);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius);
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #CBD5E1;
  border-radius: 22px;
  transition: .2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.auto-send-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.auto-send-label { font-size: 13px; font-weight: 600; color: var(--text); }
.auto-send-hint { font-size: 12px; color: var(--text-muted); }

/* ── Send window (inline in auto-send row) ────────────────── */
.send-window-times-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.send-window-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.send-window-dash {
  color: var(--text-muted);
}
.send-window-select {
  padding: 7px 28px 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  min-width: 120px;
}
.send-window-select:hover {
  border-color: var(--accent);
}
.send-window-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.auto-send-badge, .flow-auto-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-left: 8px;
  vertical-align: middle;
}
.flow-paused-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #F59E0B;
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  margin-left: 8px;
  vertical-align: middle;
}
/* ── Flow picker (contact modal) ───────────────────────────── */
.seq-start-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 16px 16px;
}
.seq-start-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.seq-start-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.seq-start-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.seq-start-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.seq-flow-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.seq-flow-option:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.seq-flow-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
}
.seq-flow-option svg { color: var(--accent); flex-shrink: 0; }
.seq-flow-option-info { display: flex; flex-direction: column; gap: 2px; }
.seq-flow-option-name { font-size: 13px; font-weight: 600; color: var(--text); }
.seq-flow-option-meta { font-size: 12px; color: var(--text-muted); }

.auto-send-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid #C7D2FE;
  border-radius: var(--radius-sm);
}
.flow-start-panel {
  padding: 20px 0;
}
.flow-start-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.flow-paused-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--warning-text);
  background: var(--warning-light);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
}
.pipeline-card.flow-paused {
  border-left: 3px solid #F59E0B;
}

/* ── Global FAB (Quick Add) ────────────────────────────────── */
.fab-container {
  position: fixed; bottom: 28px; right: 28px; z-index: 1000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.fab-btn {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  transition: transform var(--duration-base) var(--ease-default), background var(--duration-base), box-shadow var(--duration-base);
}
.fab-btn:hover {
  background: var(--accent-hover); transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}
.fab-icon-plus {
  transition: transform var(--duration-slow) var(--ease-spring);
}
.fab-container.open .fab-icon-plus {
  transform: rotate(45deg);
}
.fab-menu {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
  opacity: 0; transform: translateY(8px) scale(0.95);
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-default), transform var(--duration-base) var(--ease-default);
}
.fab-container.open .fab-menu {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
}
.fab-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border: none; border-radius: var(--radius-full);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  box-shadow: var(--shadow-md); white-space: nowrap;
  transition: background var(--duration-fast), transform var(--duration-fast);
}
.fab-item:hover {
  background: var(--accent-light); transform: translateX(-4px);
}
.fab-item svg { color: var(--accent); flex-shrink: 0; }
.fab-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.15); opacity: 0; pointer-events: none;
  transition: opacity var(--duration-base);
}
.fab-overlay.active {
  opacity: 1; pointer-events: auto;
}
:root.dark .fab-item { background: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
:root.dark .fab-item:hover { background: rgba(99,102,241,0.2); }
:root.dark .fab-overlay.active { background: rgba(0,0,0,0.4); }

/* ── Activity Feed ─────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-fast);
}
.activity-item:last-child { border-bottom: none; }
.activity-item[onclick]:hover { background: var(--bg); }
.activity-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-icon-sent  { background: var(--accent-light); color: var(--accent); }
.activity-icon-open  { background: var(--success-light); color: var(--success); }
.activity-icon-click { background: #EDE9FE; color: #7C3AED; }
.activity-icon-task  { background: #ECFDF5; color: #059669; }
.activity-body { flex: 1; min-width: 0; }
.activity-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.activity-text strong { font-weight: 600; }
.activity-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

:root.dark .activity-icon-sent  { background: rgba(99,102,241,0.15); }
:root.dark .activity-icon-open  { background: rgba(16,185,129,0.15); }
:root.dark .activity-icon-click { background: rgba(124,58,237,0.15); }
:root.dark .activity-icon-task  { background: rgba(5,150,105,0.15); }
:root.dark .activity-item[onclick]:hover { background: rgba(255,255,255,0.03); }

/* ── Email tracking UI ────────────────────────────────────── */
.seq-opened { color: var(--success); font-weight: 500; }
.seq-clicks { color: var(--text-muted); }
.report-kpi-card.clickable {
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.report-kpi-card.clickable:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}
.opens-drilldown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.opens-drilldown-row:hover { background: var(--bg); }
.opens-drilldown-row:last-child { border-bottom: none; }
.opens-drilldown-info { flex: 1; min-width: 0; }
.opens-drilldown-name { font-size: 13px; font-weight: 600; color: var(--text); }
.opens-drilldown-meta { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opens-drilldown-detail { text-align: right; flex-shrink: 0; }
.opens-drilldown-subject { font-size: 12px; color: var(--text); }
.opens-drilldown-date { font-size: 11px; color: var(--success); font-weight: 500; }

/* ── Permissions UI (user modal) ──────────────────────────── */
.perm-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.perm-check-row:last-child { border-bottom: none; }
.perm-check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.perm-custom-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #FEF3C7;
  color: #92400E;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  margin-left: auto;
}
.user-perms-loading {
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ── Role Templates ───────────────────────────────────────── */
.perm-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.perm-templates-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  width: 100%;
  margin-bottom: 2px;
}
.perm-tpl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.perm-tpl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ── Users Tab Nav ────────────────────────────────────────── */
.users-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.users-tab-btn {
  padding: 9px 18px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.users-tab-btn:hover { color: var(--text); }
.users-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Flows / Templates tabs ─────────────────────────────── */
.flows-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.flows-tab-btn {
  padding: 9px 18px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-base), border-color var(--duration-base);
}
.flows-tab-btn:hover { color: var(--text); }
.flows-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Collapsible Settings sections ──────────────────────── */
.settings-collapsible .settings-section-header {
  cursor: pointer;
  user-select: none;
}
.settings-chevron {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-default);
}
.settings-collapsible.collapsed .settings-chevron {
  transform: rotate(-90deg);
}
.settings-section-body {
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-default), opacity var(--duration-base);
  max-height: 2000px;
  opacity: 1;
}
.settings-collapsible.collapsed .settings-section-body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
}

/* ── Permissions Matrix ───────────────────────────────────── */
.perms-matrix-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}
.perms-matrix-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.perms-matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.perms-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 600px;
}
.perms-matrix-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.perms-matrix-table th.perm-col-header {
  text-align: center;
  max-width: 90px;
  word-break: break-word;
  white-space: normal;
  line-height: 1.3;
}
.perms-matrix-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.perms-matrix-table tr:last-child td { border-bottom: none; }
.perms-matrix-table tr:hover td { background: var(--bg); }
.perms-matrix-table td.perm-cell {
  text-align: center;
}
.perm-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}
.perm-check-icon.yes {
  background: #ECFDF5;
  color: #059669;
}
.perm-check-icon.no {
  background: var(--bg);
  color: var(--border);
}
.matrix-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.matrix-user-cell:hover .matrix-user-name { color: var(--accent); text-decoration: underline; }
.matrix-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.matrix-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.matrix-user-role {
  font-size: 11px;
  color: var(--text-faint);
}
.matrix-override-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F59E0B;
  vertical-align: super;
  margin-left: 2px;
}

/* ── Permission Audit Feed ────────────────────────────────── */
.perm-audit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.perm-audit-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.perm-audit-card h3 a {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.perm-audit-card h3 a:hover { text-decoration: underline; }
.perm-audit-item {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.perm-audit-item:last-child { border-bottom: none; }
.perm-audit-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #F5F3FF;
  color: #7C3AED;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.perm-audit-body { flex: 1; min-width: 0; }
.perm-audit-who {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}
.perm-audit-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.perm-audit-changes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.perm-change-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.perm-change-chip.granted {
  background: #ECFDF5;
  color: #065F46;
}
.perm-change-chip.revoked {
  background: #FEF2F2;
  color: #991B1B;
}
.perm-audit-time {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}
.perm-audit-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ══════════════════════════════════════════════════════════════
   Mobile Responsive
   ══════════════════════════════════════════════════════════════ */

/* ── Hamburger button ──────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ── Bottom tab bar (hidden on desktop) ───────────────────── */
.bottom-tab-bar { display: none; }
.ptr-indicator { display: none; }
.swipe-underlay { display: none; }

/* ── Sidebar backdrop ──────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-backdrop.open {
  opacity: 1;
}

/* ── Tablet breakpoint (768px) ─────────────────────────────── */
@media (max-width: 768px) {
  /* Root layout */
  html, body { overflow: auto; height: auto; }
  .app { height: auto; min-height: 100vh; overflow: visible; flex-direction: column; }
  .workspace { overflow: visible; }

  /* Hamburger visible */
  .mobile-menu-btn { display: flex; }

  /* Sidebar off-screen */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 999;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; pointer-events: none; }
  .sidebar-backdrop.open { pointer-events: auto; }

  /* Views */
  .view { padding: 60px 16px 32px; }

  /* Page header */
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-right { justify-content: stretch; }
  .page-header-right .btn { flex: 1; justify-content: center; }

  /* Stats row */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Pipeline board */
  .pipeline-col { min-width: 200px; width: 200px; }

  /* Tables */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: 16px; }
  .form-col-sm { max-width: none; }

  /* Modals — full-screen */
  .modal-overlay { padding: 0; }
  .modal { max-width: 100%; max-height: 100vh; border-radius: 0; }
  .modal-header { padding: 16px 44px 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-info-grid { grid-template-columns: 1fr; }

  /* Report KPIs */
  .report-kpi-row { gap: 10px; }
  .report-kpi-card { min-width: calc(50% - 10px); flex: none; padding: 14px 16px; }
  .report-kpi-value { font-size: 22px; }

  /* Report charts */
  .report-charts-grid { grid-template-columns: 1fr; }
  .report-chart-card { padding: 16px; }

  /* Touch-friendly sizing (44px minimum per iOS HIG) */
  .btn { min-height: 44px; }
  .nav-item { padding: 12px 10px; }
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 12px;
    font-size: 16px; /* prevents iOS auto-zoom */
  }
  .task-checkbox {
    width: 22px; height: 22px;
    min-width: 44px; min-height: 44px;
    padding: 11px;
    box-sizing: content-box;
    margin: -11px;
    position: relative;
  }
  .task-delete-btn, .task-send-btn {
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
  }
  .card-avatar { width: 40px; height: 40px; font-size: 13px; }

  /* Settings */
  .settings-layout { max-width: 100%; }

  /* Flow picker */
  .seq-flow-option { padding: 12px; }

  /* Opens drilldown */
  .opens-drilldown-row { padding: 12px 16px; }

  /* ── Bottom Tab Bar ─────────────────────────────────────── */
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 997;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,0.92);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 6px rgba(0,0,0,0.04);
    justify-content: space-around;
    align-items: stretch;
  }
  .bottom-tab {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    border: none; background: none;
    color: var(--text-muted);
    font-size: 10px; font-weight: 500;
    padding: 6px 0;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
  }
  .bottom-tab.active { color: var(--accent); }
  .bottom-tab-icon { width: 22px; height: 22px; }
  .bottom-tab-label { font-size: 10px; letter-spacing: 0.01em; }
  .bottom-tab-badge {
    position: absolute;
    top: 4px; right: calc(50% - 18px);
    background: #EF4444; color: #fff;
    font-size: 9px; font-weight: 700;
    min-width: 16px; height: 16px;
    line-height: 16px; text-align: center;
    border-radius: 99px; padding: 0 4px;
  }
  .bottom-tab-badge.hidden { display: none; }

  /* Hide hamburger when bottom bar is present */
  .mobile-menu-btn { display: none !important; }

  /* Add bottom padding to views for tab bar */
  .view { padding-bottom: calc(40px + 56px + env(safe-area-inset-bottom, 0px)) !important; }

  /* ── Pipeline Mobile Stacked List ───────────────────────── */
  .pipeline-board {
    flex-direction: column;
    overflow-x: visible;
    gap: 0;
    min-height: auto;
    padding-bottom: 0;
  }
  .pipeline-col {
    width: 100% !important;
    min-width: 100% !important;
    border-radius: 0;
    background: transparent;
  }
  .pipeline-col + .pipeline-col {
    border-top: 1px solid var(--border);
  }
  .pipeline-col-header {
    padding: 14px 4px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
  }
  .pipeline-col-header::after {
    content: '';
    width: 8px; height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-left: auto;
  }
  .pipeline-col.collapsed .pipeline-col-header::after {
    transform: rotate(-45deg);
  }
  .pipeline-col.collapsed .pipeline-cards { display: none; }
  .pipeline-cards { padding: 0 0 8px; }
  .pipeline-card {
    padding: 14px 4px;
    border: none;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    border-radius: 0;
    box-shadow: none;
  }
  .pipeline-card:last-child { border-bottom: none; }
  .pipeline-card:hover, .pipeline-card:active { box-shadow: none; transform: none; background: var(--bg); }
  .card-bottom { display: none; }
  .card-actions { display: none !important; }
  .card-no-flow { display: none; }
  .pipeline-card.no-flow { border-left: none; }
  .fab-container { bottom: 72px; right: 16px; }
  .fab-btn { width: 48px; height: 48px; }

  /* ── Pull-to-Refresh ────────────────────────────────────── */
  .ptr-indicator {
    display: flex;
    align-items: center; justify-content: center;
    height: 0;
    overflow: hidden;
    transition: height 0.2s ease;
    background: var(--bg);
  }
  .ptr-indicator.pulling { transition: none; }
  .ptr-indicator.refreshing { height: 48px; }
  .ptr-spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.15s;
  }
  .ptr-indicator.pulling .ptr-spinner,
  .ptr-indicator.refreshing .ptr-spinner { opacity: 1; }
  .ptr-indicator.refreshing .ptr-spinner { animation: ptr-spin 0.6s linear infinite; }
  @keyframes ptr-spin { to { transform: rotate(360deg); } }

  /* ── Swipe Actions ──────────────────────────────────────── */
  .swipeable { position: relative; overflow: hidden; }
  .swipe-underlay {
    display: flex;
    position: absolute; top: 0; bottom: 0;
    align-items: center; gap: 6px;
    padding: 0 20px;
    font-size: 13px; font-weight: 600; color: #fff;
    pointer-events: none;
    opacity: 0; transition: opacity 0.15s;
  }
  .swipe-underlay.visible { opacity: 1; }
  .swipe-underlay-right { left: 0; background: #10B981; }
  .swipe-underlay-left  { right: 0; background: var(--accent); }
  .swipe-content {
    position: relative; z-index: 1;
    background: var(--surface);
    transition: transform 0.2s ease;
  }
  .swipe-content.swiping { transition: none; }
}

/* ── Small phone breakpoint (480px) ────────────────────────── */
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .stat-card { padding: 12px 14px; }
  .stat-card-num { font-size: 18px; }

  .page-header-right { flex-direction: column; }
  .page-header-right .btn { width: 100%; }

  .pipeline-col { min-width: 180px; width: 180px; }

  .report-kpi-card { min-width: 100%; padding: 14px 16px; }

  .modal-header { gap: 10px; }
  .modal-avatar { width: 36px; height: 36px; font-size: 13px; }
  .modal-name { font-size: 15px; }
}

/* ── Audit Log ──────────────────────────────────────────── */
.audit-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.audit-badge-green { background: #D1FAE5; color: #065F46; }
.audit-badge-blue  { background: #DBEAFE; color: #1E40AF; }
.audit-badge-red   { background: #FEE2E2; color: #991B1B; }
.audit-badge-yellow { background: #FEF3C7; color: #92400E; }
.audit-badge-purple { background: #EDE9FE; color: #5B21B6; }
.audit-badge-gray  { background: #F3F4F6; color: #374151; }

.audit-pagination { margin-top: 16px; }
.audit-pag-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.audit-pag-info {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Flow Builder Tree ─────────────────────────────────────── */
/* ── Linear flow builder ─────────────────────────────────── */
.flow-linear-list { display: flex; flex-direction: column; }
.flow-linear-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: default;
  transition: box-shadow 0.14s, border-color 0.14s;
  position: relative;
}
.flow-linear-step:hover { box-shadow: var(--shadow-sm); border-color: #CBD5E1; }
.flow-linear-step.dragging { opacity: 0.35; box-shadow: none; }
.flow-linear-step.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-light); }
.flow-step-drag-handle {
  color: var(--text-faint);
  cursor: grab;
  padding: 2px 0;
  flex-shrink: 0;
  margin-top: 10px;
}
.flow-step-drag-handle:active { cursor: grabbing; }
.flow-step-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.flow-step-icon-email { background: #EEF2FF; color: #6366F1; }
.flow-step-icon-delay { background: #E0F2FE; color: #0284C7; }
.flow-step-body { flex: 1; min-width: 0; }
.flow-step-number {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.flow-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.flow-step-delay-row { margin-top: 8px; }
.flow-step-verb {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.flow-step-muted { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.flow-step-select {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.flow-step-select:focus { border-color: var(--accent); outline: none; }
.flow-step-delay-input {
  width: 58px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
  background: var(--bg);
  color: var(--text);
}
.flow-step-delay-input:focus { border-color: var(--accent); outline: none; }

/* ── Inline template creation in flow steps ─────────────── */
.flow-inline-tpl {
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-inline-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}
.flow-inline-input:focus, .flow-inline-textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.flow-inline-textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 60px;
}
.flow-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.flow-step-remove-btn {
  background: none;
  border: none;
  padding: 5px;
  color: var(--text-faint);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-top: 2px;
  transition: color 0.14s, background 0.14s;
}
.flow-step-remove-btn:hover { color: var(--danger); background: var(--danger-light); }
.flow-step-connector {
  width: 2px;
  height: 18px;
  background: var(--border);
  margin: 0 auto;
}
.flow-linear-add-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

/* ── Add condition link ───────────────────────────────────── */
.flow-add-condition-row {
  text-align: center;
  padding: 2px 0;
}

/* ── Condition block ──────────────────────────────────────── */
/* ── Condition block ─────────────────────────────── */
.flow-condition-block {
  margin: 6px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F8FAFC;
  overflow: visible;
}
.flow-condition-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.flow-condition-if {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.flow-condition-radios {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.flow-condition-radio {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.flow-condition-radio input[type="radio"] {
  display: none;
}
.flow-condition-radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.14s;
  flex-shrink: 0;
}
.flow-condition-radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.14s;
}
.flow-condition-radio input[type="radio"]:checked + .flow-condition-radio-dot {
  border-color: var(--accent);
}
.flow-condition-radio input[type="radio"]:checked + .flow-condition-radio-dot::after {
  transform: scale(1);
}
.flow-condition-radio:hover .flow-condition-radio-dot {
  border-color: var(--accent);
}
.flow-condition-radio-text {
  user-select: none;
}
.flow-condition-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
}
.flow-condition-remove:hover { background: #FEE2E2; color: #DC2626; }

/* ── Side-by-side branches ──────────────────────── */
.flow-condition-branches-row {
  display: flex;
  gap: 0;
  padding: 0;
}
.flow-branch {
  flex: 1;
  padding: 14px;
  border-left: none;
  min-width: 0;
}
.flow-branch-yes { background: #F0FDF4; border-radius: 0 0 0 12px; }
.flow-branch-no  { background: #FEF2F2; border-radius: 0 0 12px 0; }
.flow-branch-yes + .flow-branch-no { border-left: 1px solid var(--border); }
.flow-branch-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.flow-branch-yes .flow-branch-label { color: #16A34A; }
.flow-branch-yes .flow-branch-label::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22C55E;
}
.flow-branch-no .flow-branch-label { color: #DC2626; }
.flow-branch-no .flow-branch-label::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #EF4444;
}
.flow-branch-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flow-branch-content .flow-step-connector { display: none; }

/* ── Compact branch pills ───────────────────────── */
.flow-branch-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  transition: border-color 0.14s;
}
.flow-branch-pill:hover { border-color: #CBD5E1; }
.flow-branch-pill-icon {
  flex-shrink: 0;
  display: flex;
  color: var(--text-muted);
}
.flow-branch-pill-select {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  outline: none;
}
.flow-branch-pill-verb {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.flow-branch-pill-input {
  width: 40px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 12px;
  text-align: center;
  color: var(--text);
}
.flow-branch-pill-input:focus { border-color: var(--accent); outline: none; }
.flow-branch-pill-unit {
  font-size: 12px;
  color: var(--text-muted);
}
.flow-branch-pill-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  opacity: 0;
  transition: opacity 0.14s;
}
.flow-branch-pill:hover .flow-branch-pill-remove { opacity: 1; }
.flow-branch-pill-remove:hover { color: #DC2626; background: #FEE2E2; }

/* ── Branch add buttons ─────────────────────────── */
.flow-branch-add-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 0 2px;
}
.flow-branch-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s;
}
.flow-branch-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  border-style: solid;
  background: var(--accent-light);
}

.flow-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  width: 100%;
}

/* Connector line between nodes */
.flow-connector {
  width: 2px;
  height: 24px;
  background: var(--border);
  margin: 0 auto;
}

/* Base node card */
.flow-node {
  position: relative;
  width: 340px;
  max-width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: border-color var(--duration-base) var(--ease-default), box-shadow var(--duration-base) var(--ease-default);
}
.flow-branch .flow-node {
  width: 100%;
  min-width: 160px;
}
.flow-node:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
}

.flow-node-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
}

.flow-node-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.flow-node-body {
  padding: 12px 14px;
}

.flow-node-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.flow-node:hover .flow-node-actions { opacity: 1; }

.flow-node-action-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  border: none;
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--duration-base) var(--ease-default), color var(--duration-base) var(--ease-default);
}
.flow-node-action-btn:hover { background: #FEE2E2; color: #DC2626; }

/* Email node */
.flow-node-email .flow-node-icon { background: #EEF2FF; color: #6366F1; }
.flow-node-email { border-left: 3px solid #6366F1; }

/* Condition node */
.flow-node-condition .flow-node-icon { background: #FEF3C7; color: #D97706; }
.flow-node-condition { border-left: 3px solid #D97706; }

/* Delay node */
.flow-node-delay .flow-node-icon { background: #E0F2FE; color: #0284C7; }
.flow-node-delay { border-left: 3px solid #0284C7; }

/* Branches container */
.flow-branches {
  display: flex;
  gap: 16px;
  justify-content: center;
  position: relative;
  width: 100%;
  overflow-x: auto;
  padding: 0 8px;
}

/* Branch column */
.flow-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 160px;
  flex: 1;
  max-width: 280px;
  position: relative;
}

.flow-branch-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 0;
}
/* Branch color variants */
.flow-branch-color-green { background: #DCFCE7; color: #166534; }
.flow-branch-color-red { background: #FEE2E2; color: #991B1B; }
.flow-branch-color-blue { background: #DBEAFE; color: #1E40AF; }
.flow-branch-color-purple { background: #EDE9FE; color: #5B21B6; }
.flow-branch-color-orange { background: #FEF3C7; color: #92400E; }

/* Horizontal connector line for branches */
.flow-branch-connectors {
  display: flex;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 24px;
}
.flow-branch-connectors::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border);
}
.flow-branch-connectors::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 0;
  background: var(--border);
}

/* Outcome toggle panel */
.flow-outcome-panel {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 8px;
  min-width: 140px;
}

.flow-outcome-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  transition: opacity 0.15s;
}
.flow-outcome-toggle.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.flow-outcome-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #6366F1;
  cursor: pointer;
  margin: 0;
}
.flow-outcome-toggle.disabled input[type="checkbox"] {
  cursor: not-allowed;
}
.flow-outcome-label {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 11px;
}
.flow-outcome-toggle.disabled .flow-outcome-label {
  color: var(--text-muted);
  text-decoration: line-through;
}
.flow-outcome-claimed {
  font-size: 9px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}

/* Add branch button */
.flow-add-branch-btn {
  font-size: 12px;
  font-weight: 500;
  color: #D97706;
  background: #FEF3C7;
  border: 1px dashed #D97706;
  border-radius: var(--radius-full);
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.flow-add-branch-btn:hover {
  background: #FDE68A;
}

/* Remove branch button */
.flow-branch-remove-btn {
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  transition: all 0.15s;
}
.flow-branch-remove-btn:hover {
  color: #DC2626;
  background: #FEE2E2;
}

/* Validation warning */
.flow-validation-warning {
  font-size: 11px;
  color: #DC2626;
  margin-top: 4px;
  font-weight: 500;
}

/* Vertical connectors on each branch */
.flow-branch > .flow-connector {
  height: 20px;
}

/* Add-step button (inline in the tree) */
.flow-add-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  background: var(--bg);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  transition: all 0.15s;
}
.flow-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #EEF2FF;
}

/* Add-step dropdown */
.flow-add-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-xl);
  padding: 6px;
  z-index: 100;
  min-width: 200px;
}
.flow-add-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.12s;
}
.flow-add-menu-item:hover { background: var(--bg-secondary); }
.flow-add-menu-item .flow-node-icon { width: 24px; height: 24px; border-radius: 6px; }

/* End node */
.flow-end-node {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
}

/* Sender rows */
.sender-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.sender-row:last-child { border-bottom: none; }
.sender-row-info { flex: 1; min-width: 0; }
.sender-row-name { font-size: 14px; font-weight: 600; color: var(--text); }
.sender-row-email { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sender-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* Settings subsection labels / dividers */
.settings-subsection-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.settings-subsection-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
.settings-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.settings-subsection-header .settings-subsection-label {
  margin-bottom: 0;
}

/* ── Modal tab export button ──────────────────────────────── */
.modal-tab-export {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.modal-tab-export:hover {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Sidebar search row (search + bell) ───────────────────── */
.sidebar-search-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 8px 2px;
}
.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--sidebar-text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.sidebar-search-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #CBD5E1;
  border-color: rgba(255,255,255,0.18);
}
.sidebar-search-btn span { flex: 1; }
.sidebar-search-btn kbd {
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  color: var(--sidebar-label);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ── Global Search Overlay (Cmd+K) ───────────────────────── */
.cmd-k-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 11vh;
  animation: cmdkFadeIn 0.1s ease;
}
.cmd-k-overlay.hidden { display: none; }
@keyframes cmdkFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.cmd-k-modal {
  width: 580px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -12px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: cmdkSlideDown 0.12s ease;
}
@keyframes cmdkSlideDown {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cmd-k-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-k-search-icon { color: var(--text-muted); flex-shrink: 0; }
.cmd-k-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  background: transparent;
}
.cmd-k-input::placeholder { color: var(--text-faint); }
.cmd-k-esc-hint {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 7px;
  font-family: inherit;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  user-select: none;
}
.cmd-k-esc-hint:hover {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.cmd-k-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
}
.cmd-k-results:empty { display: none; }

.cmd-k-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 10px 10px 4px;
}

.cmd-k-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.08s;
  border: 1px solid transparent;
}
.cmd-k-result:hover { background: var(--bg); }
.cmd-k-result.selected {
  background: var(--accent-light);
  border-color: rgba(99,102,241,0.15);
}

.cmd-k-result-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cmd-k-result-icon.type-contact  { background: #EEF2FF; color: #6366F1; }
.cmd-k-result-icon.type-flow     { background: #F0FDF4; color: #16A34A; }
.cmd-k-result-icon.type-template { background: #FFF7ED; color: #EA580C; }
.cmd-k-result-icon.type-task     { background: #FEF2F2; color: #DC2626; }
.cmd-k-result-icon.type-view     { background: var(--surface-muted); color: #64748B; }

.cmd-k-result-body { flex: 1; min-width: 0; }
.cmd-k-result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-k-result-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.cmd-k-result-arrow {
  color: var(--text-faint);
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s;
}
.cmd-k-result:hover .cmd-k-result-arrow,
.cmd-k-result.selected .cmd-k-result-arrow { opacity: 1; }

.cmd-k-empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.cmd-k-empty strong { color: var(--text); }

.cmd-k-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.cmd-k-footer span {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
}
.cmd-k-footer kbd {
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  color: var(--text-muted);
}

/* ── Breadcrumb bar ───────────────────────────────────────── */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-height: 36px;
}
.breadcrumb-bar.hidden { display: none; }
.breadcrumb-item { display: flex; align-items: center; gap: 4px; }
.breadcrumb-link {
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.1s;
}
.breadcrumb-link:hover { background: var(--accent-light); }
.breadcrumb-sep {
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  user-select: none;
}
.breadcrumb-current { font-weight: 500; color: var(--text); }

/* ── Sidebar recent items ─────────────────────────────────── */
.sidebar-recents {
  padding: 8px 8px 0 0;
  margin-left: -8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-recents.hidden { display: none; }
.sidebar-recents-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sidebar-label);
  padding: 4px 10px 5px;
}
.sidebar-recents-list { display: flex; flex-direction: column; gap: 1px; }
.sidebar-recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  color: var(--sidebar-text);
  font-size: 12px;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
}
.sidebar-recent-item:hover { background: var(--sidebar-hover); color: #CBD5E1; }
.sidebar-recent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.recent-dot-contact  { background: #6366F1; }
.recent-dot-flow     { background: #16A34A; }
.recent-dot-template { background: #EA580C; }
.recent-dot-task     { background: #DC2626; }
.recent-dot-view     { background: #64748B; }
.sidebar-recent-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-recent-type {
  font-size: 10px;
  color: var(--sidebar-label);
  flex-shrink: 0;
  text-transform: capitalize;
}

/* ── Onboarding checklist bar ─────────────────────────────── */
.onboarding-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}
.onboarding-bar.hidden { display: none; }

.ob-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px 10px;
  cursor: pointer;
  user-select: none;
}
.ob-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.ob-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ob-progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.ob-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}
.ob-progress-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.ob-toggle-icon {
  color: var(--text-faint);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.ob-toggle-icon.open { transform: rotate(180deg); }
.ob-dismiss {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-faint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
  padding: 0;
}
.ob-dismiss:hover { background: var(--bg); color: var(--text-muted); }

.ob-steps {
  padding: 2px 28px 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 900px) {
  .ob-steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .ob-steps { grid-template-columns: 1fr; }
  .ob-header { padding: 10px 16px 8px; }
}

.ob-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color var(--duration-base) var(--ease-default), box-shadow var(--duration-base) var(--ease-default);
}
.ob-step.done { opacity: 0.55; }
.ob-step:not(.done) { cursor: pointer; }
.ob-step:not(.done):hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.ob-step-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s;
}
.ob-step.done .ob-step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.ob-step:not(.done):hover .ob-step-circle {
  border-color: var(--accent);
  color: var(--accent);
}
.ob-step-body { flex: 1; min-width: 0; }
.ob-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.ob-step.done .ob-step-label { text-decoration: line-through; color: var(--text-muted); }
.ob-step-desc {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
  line-height: 1.4;
}

/* Done state */
.ob-all-done {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 500;
  color: var(--success-text);
}

/* ── Unified empty state ──────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 32px 60px;
  gap: 0;
}
.empty-state-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  margin-bottom: 20px;
}
.empty-state-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.empty-state-body {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.65;
  margin-bottom: 24px;
}
.empty-state-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Center empty state when it's the only child in the pipeline board */
.pipeline-board > .empty-state {
  flex: 1;
  width: 100%;
  min-height: 100%;
}

/* Pipeline board empty (whole board, not per-column) */
.pipeline-board-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px;
  text-align: center;
  gap: 0;
  flex: 1;
}

/* Tasks global empty */
.tasks-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 32px;
  gap: 0;
}

/* ── Reports placeholder (chart frames with overlay) ─────── */
.report-placeholder-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(248,250,252,0.88);
  backdrop-filter: blur(2px);
  border-radius: var(--radius-lg);
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}
.report-placeholder-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}
.report-placeholder-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.report-placeholder-sub {
  font-size: 12px;
  color: var(--text-faint);
}
.report-chart-card { position: relative; }

/* KPI empty state row */
.report-kpi-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  grid-column: 1 / -1;
}
.report-kpi-empty-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.report-kpi-empty-cta {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

/* ── Skeleton loaders ─────────────────────────────────────── */
@keyframes skel-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skel {
  background: linear-gradient(
    90deg,
    #EEF2F7 0%,
    #EEF2F7 25%,
    #F5F8FC 50%,
    #EEF2F7 75%,
    #EEF2F7 100%
  );
  background-size: 1200px 100%;
  animation: skel-shimmer 1.6s ease-in-out infinite;
  border-radius: 5px;
  flex-shrink: 0;
}

/* Pipeline board skeleton cards */
.skel-pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skel-pipeline-card .skel-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Flow card list skeleton */
.skel-flow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Task list skeleton */
.skel-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.skel-task-item:last-child { border-bottom: none; }

/* Template card grid skeleton */
.skel-tmpl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Button spinner ───────────────────────────────────────── */
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.btn-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.55s linear infinite;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.btn-loading {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: 0.8;
}
.report-kpi-empty-cta:hover { text-decoration: underline; }

/* ── Notification Bell ── */
.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-base) var(--ease-default), color var(--duration-base) var(--ease-default);
  flex-shrink: 0;
}
.notif-bell-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.notif-bell-btn svg { width: 18px; height: 18px; }
.notif-bell-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: #EF4444;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 1.5px solid #1e1e2e;
}
.notif-bell-badge.hidden { display: none; }

/* ── Notification Panel ── */
.notif-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #1a1a2e;
  z-index: 50;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  overflow: hidden;
}
.notif-panel.hidden { display: none; }

.notif-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.notif-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.notif-back-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.notif-back-btn svg { width: 16px; height: 16px; }
.notif-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex: 1;
  letter-spacing: 0.01em;
}
.notif-mark-read-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  padding: 4px 6px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}
.notif-mark-read-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* Digest bar */
.notif-digest-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.notif-digest-label {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 100%;
  margin-bottom: 2px;
}
.notif-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
}
.notif-chip-sent    { color: #60A5FA; border-color: rgba(96,165,250,0.25); background: rgba(96,165,250,0.08); }
.notif-chip-opened  { color: #34D399; border-color: rgba(52,211,153,0.25); background: rgba(52,211,153,0.08); }
.notif-chip-replied { color: #A78BFA; border-color: rgba(167,139,250,0.25); background: rgba(167,139,250,0.08); }
.notif-chip-won     { color: #FBBF24; border-color: rgba(251,191,36,0.25);  background: rgba(251,191,36,0.08);  }

/* Notification list */
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: default;
  transition: background 0.12s;
  position: relative;
}
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item-unread { background: rgba(124,58,237,0.07); }
.notif-item-unread:hover { background: rgba(124,58,237,0.12); }

.notif-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.notif-icon svg { width: 14px; height: 14px; }
.notif-icon-reply   { background: rgba(167,139,250,0.15); color: #A78BFA; }
.notif-icon-won     { background: rgba(251,191,36,0.15);  color: #FBBF24; }
.notif-icon-opened  { background: rgba(52,211,153,0.15);  color: #34D399; }
.notif-icon-sent    { background: rgba(96,165,250,0.15);  color: #60A5FA; }
.notif-icon-task    { background: rgba(129,140,248,0.15); color: #818CF8; }
.notif-icon-default { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4); }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-text {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
  margin-bottom: 3px;
}
.notif-item-text strong { color: #fff; font-weight: 600; }
.notif-item-time {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
}
.notif-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7C3AED;
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.25);
  padding: 10px 14px 4px;
}

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: rgba(255,255,255,0.25);
  font-size: 12px;
  text-align: center;
}
.notif-empty svg { width: 28px; height: 28px; opacity: 0.3; }

/* Preferences section */
.notif-prefs-section {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 12px 14px;
  flex-shrink: 0;
}
.notif-prefs-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.3);
  margin-bottom: 10px;
}
.notif-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.notif-pref-row:last-child { border-bottom: none; }
.notif-pref-label {
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
}
/* Toggle switch */
.notif-toggle {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}
.notif-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.notif-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s;
}
.notif-toggle input:checked + .notif-toggle-track { background: #7C3AED; }
.notif-toggle-track::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: transform 0.2s;
}
.notif-toggle input:checked + .notif-toggle-track::after { transform: translateX(14px); }

/* ── Flatpickr calendar overrides ── */
.flatpickr-calendar {
  font-family: 'Inter', sans-serif;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
}
.flatpickr-months {
  background: #7C3AED;
  padding: 6px 0;
}
.flatpickr-months .flatpickr-month,
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  color: #fff;
  fill: #fff;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: rgba(255,255,255,0.7); }
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .flatpickr-monthDropdown-months {
  color: #fff;
  font-weight: 600;
}
.flatpickr-current-month .flatpickr-monthDropdown-months option { color: #333; }
.flatpickr-weekdays { background: #f9f7ff; }
span.flatpickr-weekday { color: #7C3AED; font-weight: 600; font-size: 11px; }
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: #7C3AED;
  border-color: #7C3AED;
  color: #fff;
}
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: #6D28D9;
  border-color: #6D28D9;
}
.flatpickr-day.inRange {
  background: rgba(124,58,237,0.10);
  border-color: transparent;
  box-shadow: -5px 0 0 rgba(124,58,237,0.10), 5px 0 0 rgba(124,58,237,0.10);
  color: #4C1D95;
}
.flatpickr-day:hover { background: rgba(124,58,237,0.08); border-color: transparent; }
.flatpickr-day.today { border-color: #7C3AED; }
.flatpickr-day.today:hover { background: rgba(124,58,237,0.08); }

/* ── Contact Full-Page View ── */
#view-contact { padding: 0; }
.cp-page {
  display: flex;
  height: calc(100vh - 0px);
  overflow: hidden;
}

/* ── Left sidebar ── */
.cp-sidebar {
  width: 300px;
  min-width: 300px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.cp-sidebar::-webkit-scrollbar { width: 4px; }
.cp-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 2px; }

.cp-back-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cp-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.cp-back-btn:hover { background: var(--surface-muted); color: var(--text); }
.cp-back-btn svg { width: 16px; height: 16px; }

.cp-profile {
  padding: 24px 22px 18px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.cp-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.03em;
}
.cp-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}
.cp-practice {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.cp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.12s;
}
.cp-status-pill:hover { opacity: 0.85; }

.cp-section {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.cp-section:last-child { border-bottom: none; }
.cp-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cp-info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.cp-info-row:last-child { margin-bottom: 0; }
.cp-info-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.cp-info-text {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
  line-height: 1.4;
}
.cp-info-text a { color: var(--primary); text-decoration: none; }
.cp-info-text a:hover { text-decoration: underline; }
.cp-info-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

/* Quick actions */
.cp-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cp-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.cp-action-btn:hover { background: #F8FAFC; border-color: #CBD5E1; }
.cp-action-btn svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.cp-action-btn.cp-action-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.cp-action-btn.cp-action-primary:hover { background: var(--primary-hover); }
.cp-action-btn.cp-action-primary svg { color: rgba(255,255,255,0.8); }
.cp-action-btn.cp-action-danger { color: #DC2626; }
.cp-action-btn.cp-action-danger:hover { background: #FEF2F2; border-color: #FCA5A5; }
.cp-action-btn.cp-action-danger svg { color: #DC2626; }

/* Flow status card */
.cp-flow-card {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.cp-flow-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.cp-flow-progress {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cp-flow-bar {
  height: 4px;
  background: #E2E8F0;
  border-radius: 2px;
  overflow: hidden;
}
.cp-flow-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s;
}

/* Related contacts */
.cp-related-list { display: flex; flex-direction: column; gap: 4px; }
.cp-related-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.cp-related-item:hover { background: var(--surface-muted); }
.cp-related-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.cp-related-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.cp-related-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Right content area ── */
.cp-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #FAFBFE;
  overflow: hidden;
}
.cp-content-header {
  display: flex;
  align-items: center;
  padding: 14px 28px 0;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.cp-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 0;
  margin-right: 20px;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.cp-tab-btn:hover { color: var(--text); }
.cp-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.cp-tab-badge {
  display: inline-block;
  font-size: 10px;
  background: #F3F4F6;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 4px;
}
.cp-tab-btn.active .cp-tab-badge { background: var(--primary-light); color: var(--primary); }

.cp-tab-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.cp-content-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
.cp-content-body::-webkit-scrollbar { width: 5px; }
.cp-content-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }

.cp-tab-panel { display: none; }
.cp-tab-panel.active { display: block; }

/* Wider content panels */
.cp-content-body .activity-feed { max-width: 640px; }
.cp-content-body .notes-panel { max-width: 640px; }
.cp-content-body .tasks-panel { max-width: 640px; }
.cp-content-body .fields-panel { max-width: 500px; }
.cp-content-body .seq-section { max-width: 640px; }

/* Empty state for related */
.cp-empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
