/* ══════════════════════════════════════════════════════════════════════
   LeadPilot CRM - Main Stylesheet v7.0.0
   Modern Light Theme | Bootstrap 5 | Responsive
   ══════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ────────────────────────────────────────────────── */
:root {
  --crm-primary:   #6366f1;
  --crm-secondary: #8b5cf6;
  --crm-accent:    #06b6d4;
  --crm-sidebar:   #1e1b4b;
  --crm-sidebar-w: 260px;
  --crm-sidebar-collapsed: 68px;
  --crm-topbar-h:  64px;
  --crm-font:      'Inter', system-ui, sans-serif;

  /* Surfaces */
  --surface-bg:    #f8f9fc;
  --surface-card:  #ffffff;
  --surface-hover: #f1f5f9;
  --border-color:  #e2e8f0;

  /* Text */
  --text-main:     #1a1f36;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  /* Sidebar */
  --sidebar-text:       rgba(255,255,255,0.75);
  --sidebar-text-hover: #ffffff;
  --sidebar-active-bg:  rgba(255,255,255,0.12);
  --sidebar-badge:      #ef4444;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.16);

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Transitions */
  --ease:       cubic-bezier(.4,0,.2,1);
  --trans:      .25s var(--ease);
}

/* ─── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--crm-font);
  background: var(--surface-bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Sidebar ────────────────────────────────────────────────────────── */
.crm-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--crm-sidebar-w);
  height: 100vh;
  background: var(--crm-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width var(--trans), transform var(--trans);
  overflow: hidden;
}

.crm-sidebar.collapsed {
  width: var(--crm-sidebar-collapsed);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
  min-height: var(--crm-topbar-h);
}

.sidebar-logo {
  height: 36px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  transition: opacity var(--trans);
  filter: brightness(0) invert(1);
}

.crm-sidebar.collapsed .sidebar-logo { opacity: 0; width: 0; }

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--trans), background var(--trans);
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 14px 20px 6px;
  transition: opacity var(--trans);
  white-space: nowrap;
}

.crm-sidebar.collapsed .nav-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin: 1px 10px;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: color var(--trans), background var(--trans);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav .nav-link i {
  font-size: 18px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.sidebar-nav .nav-link:hover {
  color: var(--sidebar-text-hover);
  background: var(--sidebar-active-bg);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: var(--crm-primary);
  box-shadow: 0 2px 10px rgba(99,102,241,.4);
}

.nav-label {
  transition: opacity var(--trans), width var(--trans);
}

.crm-sidebar.collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.nav-badge {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--sidebar-badge);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.crm-sidebar.collapsed .nav-badge {
  right: 4px;
  top: 6px;
  transform: none;
  font-size: 9px;
  min-width: 14px;
  height: 14px;
}

/* User widget */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--crm-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); text-transform: capitalize; }

.user-logout {
  color: rgba(255,255,255,0.4);
  font-size: 16px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  transition: color var(--trans);
}
.user-logout:hover { color: #ef4444; }

/* ─── Main Area ─────────────────────────────────────────────────────── */
.crm-main {
  margin-left: var(--crm-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--trans);
}

.crm-main.expanded { margin-left: var(--crm-sidebar-collapsed); }

/* ─── Top Bar ─────────────────────────────────────────────────────── */
.crm-topbar {
  height: var(--crm-topbar-h);
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 50px;
  padding: 8px 18px;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.topbar-search:focus-within {
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.topbar-search i { color: var(--text-muted); font-size: 15px; }

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text-main);
  width: 100%;
  font-family: var(--crm-font);
}

.topbar-search input::placeholder { color: var(--text-light); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-btn {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--surface-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  font-size: 16px;
  transition: all var(--trans);
}

.topbar-btn:hover { background: var(--surface-hover); border-color: var(--crm-primary); color: var(--crm-primary); }

.notif-badge {
  position: absolute;
  top: -3px; right: -3px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--surface-card);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 50px;
  padding: 5px 14px 5px 5px;
  cursor: pointer;
  transition: all var(--trans);
  font-family: var(--crm-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.topbar-user:hover { border-color: var(--crm-primary); box-shadow: var(--shadow-sm); }

.topbar-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

/* ─── Notifications Dropdown ────────────────────────────────────────── */
.notif-dropdown {
  width: 360px;
  padding: 0;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

/* ─── Content Area ─────────────────────────────────────────────────── */
.crm-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
}

/* ─── Page Header ──────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ─── Cards ────────────────────────────────────────────────────────── */
.crm-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--trans);
}

.crm-card:hover { box-shadow: var(--shadow-md); }

/* ─── Stat Cards ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--trans);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--stat-color, var(--crm-primary));
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: var(--stat-bg, rgba(99,102,241,.1));
  color: var(--stat-color, var(--crm-primary));
}

.stat-info { flex: 1 }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text-main); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-change { font-size: 12px; font-weight: 600; margin-top: 4px; }
.stat-change.up { color: #10b981; }
.stat-change.down { color: #ef4444; }

/* ─── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--crm-primary);
  border-color: var(--crm-primary);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--trans);
}
.btn-primary:hover { 
  background: color-mix(in srgb, var(--crm-primary) 85%, black);
  border-color: color-mix(in srgb, var(--crm-primary) 85%, black);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
}

.btn-outline-primary { border-color: var(--crm-primary); color: var(--crm-primary); font-weight: 500; }
.btn-outline-primary:hover { background: var(--crm-primary); color: #fff; }

/* ─── Tables ──────────────────────────────────────────────────────── */
.crm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.crm-table thead th {
  background: var(--surface-bg);
  border-bottom: 1.5px solid var(--border-color);
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.crm-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table tbody tr:hover td { background: var(--surface-hover); }
.crm-table tbody tr { transition: background var(--trans); }

/* Lead row avatar */
.lead-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--crm-primary), var(--crm-secondary));
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ─── Forms ───────────────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--crm-font);
  font-size: 14px;
  color: var(--text-main);
  transition: border-color var(--trans), box-shadow var(--trans);
  padding: 8px 12px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--crm-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

/* ─── Badges ──────────────────────────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 50px;
}

/* Custom colors */
.bg-purple-subtle { background-color: rgba(139,92,246,.12) !important; }
.text-purple { color: #8b5cf6 !important; }

/* ─── Kanban ──────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: calc(100vh - 220px);
  scrollbar-width: thin;
}

.kanban-col {
  min-width: 280px;
  max-width: 280px;
  flex-shrink: 0;
  background: var(--surface-bg);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

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

.kanban-col-title {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
}

.kanban-count {
  background: var(--border-color);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  color: var(--text-muted);
}

.kanban-cards {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  min-height: 100px;
  scrollbar-width: thin;
}

.kanban-card {
  background: var(--surface-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: grab;
  transition: all var(--trans);
  position: relative;
}

.kanban-card:hover {
  border-color: var(--crm-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card.dragging {
  opacity: .4;
  transform: rotate(2deg);
  cursor: grabbing;
}

.kanban-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-main);
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kanban-card-value {
  font-size: 13px;
  font-weight: 700;
  color: #10b981;
  margin-top: 8px;
}

.kanban-drop-zone.drag-over { background: rgba(99,102,241,.06); border-color: var(--crm-primary); }

/* ─── Chat / Messages ────────────────────────────────────────────── */
.chat-layout {
  display: flex;
  height: calc(100vh - var(--crm-topbar-h) - 50px);
  gap: 0;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-sidebar {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.conv-list { flex: 1; overflow-y: auto; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--trans);
  position: relative;
}

.conv-item:hover { background: var(--surface-hover); }
.conv-item.active { background: rgba(99,102,241,.06); border-left: 3px solid var(--crm-primary); }

.conv-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.conv-online {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: #10b981;
  border: 2px solid var(--surface-card);
  border-radius: 50%;
}

.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }

.conv-unread {
  background: var(--crm-primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat Window */
.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface-bg);
}

.chat-header {
  padding: 16px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.msg-bubble.inbound {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.msg-bubble.outbound {
  background: var(--crm-primary);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.msg-time { font-size: 10px; opacity: .7; margin-top: 4px; text-align: right; }

.chat-input-area {
  padding: 16px;
  background: var(--surface-card);
  border-top: 1px solid var(--border-color);
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface-bg);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color var(--trans);
}

.chat-input-wrap:focus-within { border-color: var(--crm-primary); }

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  font-family: var(--crm-font);
  color: var(--text-main);
  max-height: 120px;
  min-height: 24px;
  line-height: 1.5;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  background: var(--crm-primary);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans);
  flex-shrink: 0;
}

.chat-send-btn:hover { background: var(--crm-secondary); transform: scale(1.05); }

/* ─── Auth Pages ──────────────────────────────────────────────────── */
.auth-page {
  background: linear-gradient(135deg, #f8f9fc 0%, #eef2ff 50%, #f0fdf4 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.auth-page::before {
  content: '';
  position: fixed;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99,102,241,.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-xl);
}

.auth-logo {
  height: 48px;
  margin-bottom: 24px;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,.3));
}

.auth-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }

/* ─── Flow Builder ─────────────────────────────────────────────────── */
.flow-canvas {
  background: #f8f9fc;
  background-image: radial-gradient(circle, #d1d5db 1px, transparent 1px);
  background-size: 24px 24px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  height: calc(100vh - 260px);
  min-height: 500px;
}

.flow-node {
  position: absolute;
  background: var(--surface-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 180px;
  cursor: move;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--trans), box-shadow var(--trans);
}

.flow-node:hover, .flow-node.selected {
  border-color: var(--crm-primary);
  box-shadow: var(--shadow-md);
}

.flow-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 13px;
}

.flow-node-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ─── Pagination ──────────────────────────────────────────────────── */
.crm-pagination {
  display: flex;
  align-items: center;
  justify-content: between;
  gap: 4px;
}

.crm-pagination .page-link {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  border-color: var(--border-color);
  color: var(--text-main);
  font-size: 13px;
  padding: 6px 12px;
  transition: all var(--trans);
}

.crm-pagination .page-item.active .page-link {
  background: var(--crm-primary);
  border-color: var(--crm-primary);
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}

/* ─── Score Bar ─────────────────────────────────────────────────── */
.score-bar {
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--crm-primary), var(--crm-secondary));
  transition: width var(--trans);
}

/* ─── Dropdown ────────────────────────────────────────────────────── */
.dropdown-menu {
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  font-size: 14px;
}

.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: background var(--trans);
}

.dropdown-item:hover { background: rgba(99,102,241,.08); color: var(--crm-primary); }
.dropdown-item:active { background: var(--crm-primary); color: white; }

/* ─── Sidebar Overlay (mobile) ────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

/* ─── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 16px; display: block; }
.empty-state h5 { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
.empty-state p { font-size: 13px; }

/* ─── Timeline ────────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 32px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item { position: relative; margin-bottom: 20px; }

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--crm-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.timeline-content {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.timeline-time { font-size: 11px; color: var(--text-light); }

/* ─── Scroll ──────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .crm-sidebar {
    transform: translateX(-100%);
    width: var(--crm-sidebar-w) !important;
    z-index: 1050;
  }

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

  .crm-main { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex !important; align-items: center; }
  .sidebar-overlay.active { display: block; }
  .nav-label, .nav-section-label { opacity: 1 !important; width: auto !important; }
}

@media (max-width: 768px) {
  .crm-content { padding: 16px; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-actions { width: 100%; }
  .topbar-search { display: none; }
  .chat-sidebar { width: 100%; }
  .chat-layout { flex-direction: column; }
  .kanban-board { padding-bottom: 80px; }
}

@media (max-width: 480px) {
  .crm-topbar { padding: 0 12px; gap: 8px; }
  .auth-card { padding: 24px 20px; }
}

/* ─── Utilities ────────────────────────────────────────────────────── */
.text-primary { color: var(--crm-primary) !important; }
.bg-primary-light { background: rgba(99,102,241,.1); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.gap-2 { gap: .5rem; }
.cursor-pointer { cursor: pointer; }
.transition { transition: all var(--trans); }
.shadow-hover:hover { box-shadow: var(--shadow-md) !important; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.animate-fade { animation: fadeIn .3s var(--ease) both; }
.animate-slide { animation: slideIn .3s var(--ease) both; }
.skeleton { background: linear-gradient(90deg, var(--border-color) 25%, var(--surface-hover) 50%, var(--border-color) 75%); background-size: 200% 100%; animation: skeleton 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
