/* ═══════════════════════════════════════════
   LeadCRM – Premium Dashboard Stylesheet v2
   ═══════════════════════════════════════════ */

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

/* ── Design Tokens ── */
:root {
  --bg:          #080c14;
  --sidebar:     #0d1222;
  --card:        rgba(16, 22, 38, 0.75);
  --card-hover:  rgba(22, 30, 52, 0.9);
  --border:      rgba(255, 255, 255, 0.07);
  --border-hov:  rgba(255, 255, 255, 0.13);
  --accent:      #4f6ef7;
  --accent2:     #8b5cf6;
  --accent-glow: rgba(79, 110, 247, 0.3);
  --text:        #eef0f5;
  --text-muted:  #94a3b8;
  --text-dim:    #4a5568;
  --success:     #10b981;
  --warning:     #f59e0b;
  --error:       #ef4444;
  --purple:      #8b5cf6;
  --cyan:        #06b6d4;
  --orange:      #f97316;
  --radius:      14px;
  --radius-sm:   10px;
  --font-main:   'DM Sans', sans-serif;
  --font-heading:'Space Grotesk', sans-serif;
  --glass:       blur(14px) saturate(160%);
  --shadow-sm:   0 2px 12px rgba(0, 0, 0, 0.15);
  --shadow-md:   0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-lg:   0 24px 64px rgba(0, 0, 0, 0.4);
  --sidebar-w:   260px;
  --topbar-h:    68px;
  --transition:  all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Mode ── */
:root.light-mode {
  --bg:          #f4f6fb;
  --sidebar:     #ffffff;
  --card:        rgba(255, 255, 255, 0.9);
  --card-hover:  rgba(255, 255, 255, 1);
  --border:      rgba(0, 0, 0, 0.07);
  --border-hov:  rgba(0, 0, 0, 0.14);
  --accent-glow: rgba(79, 110, 247, 0.15);
  --text:        #1e293b;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --glass:       blur(14px) saturate(120%);
}

/* ── Base ── */
body {
  font-family: var(--font-main);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%,  rgba(79,110,247,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139,92,246,0.06) 0%, transparent 50%);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar          { width: 4px; height: 4px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Glass Utility ── */
.glass {
  background: var(--card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--border);
}

/* ════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
  position: relative;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(to bottom, transparent, rgba(79,110,247,0.2) 40%, transparent);
  pointer-events: none;
}

/* Logo */
.logo-section {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800; color: white; font-size: 18px;
  box-shadow: 0 4px 16px var(--accent-glow);
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-heading);
  font-size: 19px; font-weight: 700;
  letter-spacing: -0.5px;
}
.logo-pill {
  margin-left: auto;
  font-size: 9px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white; padding: 2px 7px;
  border-radius: 20px; letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Nav */
.nav-section {
  flex: 1; overflow-y: auto;
  padding: 16px 10px;
}
.nav-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-dim);
  padding: 14px 14px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.nav-link i { flex-shrink: 0; }
.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  translate: 3px 0;
}
.nav-link.active {
  background: linear-gradient(90deg, rgba(79,110,247,0.18), rgba(79,110,247,0.04));
  color: var(--accent);
  font-weight: 600;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent2));
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  line-height: 1.4;
}

/* AI Insight widget */
.ai-widget {
  margin: 16px 10px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(79,110,247,0.05));
  border: 1px solid rgba(139,92,246,0.15);
}
.ai-widget-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.ai-widget-header span {
  font-size: 10px; font-weight: 700; color: var(--purple);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.ai-badge {
  background: linear-gradient(135deg, #FF3D68, var(--purple));
  color: white;
  font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.ai-widget p {
  font-size: 11.5px; color: var(--text-dim);
  line-height: 1.5; margin-bottom: 12px;
}
.btn-ai {
  width: 100%; padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(139,92,246,0.3);
  background: transparent;
  color: var(--purple);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-ai:hover { background: rgba(139,92,246,0.12); }

/* User profile at bottom */
.user-profile {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FF6B6B, #FFD93D);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.user-info .name  { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-info .role  { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.btn-logout {
  margin-left: auto;
  background: transparent; border: none;
  color: var(--text-dim); cursor: pointer;
  padding: 7px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-logout:hover { color: var(--error); background: rgba(239,68,68,0.1); }

/* ════════════════════════════════════
   MAIN
   ════════════════════════════════════ */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 28px;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 40;
  background: rgba(8,12,20,0.6);
  backdrop-filter: blur(12px);
}
:root.light-mode .topbar { background: rgba(244,246,251,0.8); }

.topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title  { font-family: var(--font-heading); font-size: 17px; font-weight: 600; }

.search-container { max-width: 360px; width: 100%; position: relative; }
.search-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px 10px 40px;
  color: var(--text);
  font-family: var(--font-main); font-size: 13.5px;
  transition: var(--transition);
  outline: none;
}
.search-input:focus {
  background: rgba(255,255,255,0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79,110,247,0.1);
}
.search-input::placeholder { color: var(--text-dim); }
.search-icon {
  position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}

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

/* Theme toggle */
.mode-toggle {
  width: 50px; height: 26px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 13px;
  position: relative; cursor: pointer;
  display: flex; align-items: center;
  padding: 3px; gap: 0;
  transition: var(--transition);
}
.toggle-icon  { font-size: 11px; z-index: 2; flex: 1; text-align: center; }
.toggle-thumb {
  position: absolute;
  width: 20px; height: 20px;
  background: white; border-radius: 50%;
  transition: 0.3s cubic-bezier(0.4,0,0.2,1);
  left: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
:root.light-mode .toggle-thumb { transform: translateX(24px); background: var(--accent); }

/* Icon buttons in topbar */
.icon-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 11px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
  transition: var(--transition);
  position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--border-hov); color: var(--text); }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px;
  background: var(--error); border-radius: 50%;
  border: 2px solid var(--bg);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white; border: none;
  border-radius: 11px; padding: 9px 18px;
  font-family: var(--font-main);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  transition: var(--transition);
  box-shadow: 0 6px 20px rgba(79,110,247,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(79,110,247,0.4); }

/* ── Content Area ── */
.content-area {
  flex: 1; padding: 28px 32px;
  overflow-y: auto;
}

/* ── Page sections ── */
.page-content { display: none; animation: fadeUp 0.35s ease both; }
.page-content.active { display: block; }
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

/* ════════════════════════════════════
   DASHBOARD – BANNER
   ════════════════════════════════════ */
.dashboard-banner {
  height: 180px;
  background: url('banner.png') center/cover no-repeat;
  border-radius: var(--radius);
  margin-bottom: 28px;
  padding: 0 36px;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
}
.dashboard-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(8,12,20,0.88) 0%, rgba(8,12,20,0.4) 60%, transparent);
}
.dashboard-banner::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(79,110,247,0.08), transparent);
}
.banner-content { position: relative; z-index: 5; }
.banner-title {
  font-family: var(--font-heading);
  font-size: 26px; font-weight: 700;
  margin-bottom: 6px; line-height: 1.2;
}
.banner-subtitle { font-size: 14px; color: var(--text-muted); }
.banner-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(79,110,247,0.15);
  border: 1px solid rgba(79,110,247,0.3);
  color: var(--accent);
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  margin-bottom: 10px;
}
.banner-actions {
  position: relative; z-index: 5;
  margin-left: auto;
  display: flex; gap: 10px;
}
.btn-outline {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: white; border-radius: 10px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-outline:hover { background: rgba(255,255,255,0.14); }

/* ════════════════════════════════════
   KPI CARDS
   ════════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 1280px) { .kpi-row { grid-template-columns: repeat(2,1fr); } }

.kpi-card {
  padding: 22px 24px;
  border-radius: var(--radius);
  position: relative; overflow: hidden;
  transition: var(--transition);
  cursor: default;
}
.kpi-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}
.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hov);
  box-shadow: var(--shadow-md);
}
.kpi-card-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; letter-spacing: 0.2px; }
.kpi-value { font-family: var(--font-heading); font-size: 28px; font-weight: 700; margin-bottom: 6px; line-height: 1; }
.kpi-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.trend-up   { color: var(--success); }
.trend-down { color: var(--error); }

/* ════════════════════════════════════
   CHART CARDS
   ════════════════════════════════════ */
.grid-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 1200px) { .grid-main { grid-template-columns: 1fr; } }

.chart-card {
  padding: 24px;
  border-radius: var(--radius);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.card-title {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 600;
}
.card-title small {
  font-family: var(--font-main);
  font-size: 11px; font-weight: 500;
  color: var(--text-dim);
  margin-left: 8px;
}
.card-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 10px; border-radius: 8px;
  font-size: 12px; cursor: pointer;
  outline: none;
}

/* Source legend */
.legend-list { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.legend-item {
  display: flex; justify-content: space-between; align-items: center;
}
.legend-label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-val   { font-size: 13px; font-weight: 700; }

/* Activity feed */
.activity-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon-wrap {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-text { font-size: 13.5px; color: var(--text); line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ════════════════════════════════════
   LEAD MANAGEMENT
   ════════════════════════════════════ */
.manage-leads-header {
  margin-bottom: 20px;
}
.manage-leads-header h2 {
  font-family: var(--font-heading); font-size: 22px; font-weight: 700;
}
.breadcrumb { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

/* Filter Bar */
.lead-filter-bar {
  display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.search-box-mini {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
}
.search-box-mini input {
  border: none; background: transparent;
  outline: none; font-size: 13px;
  color: var(--text); font-family: var(--font-main);
  width: 160px;
}
.search-box-mini input::placeholder { color: var(--text-dim); }

.filter-divider { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }

.filter-select {
  display: flex; flex-direction: column; gap: 3px;
}
.filter-select label {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.filter-select select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text); padding: 5px 10px;
  border-radius: 7px; font-size: 12px;
  font-family: var(--font-main);
  outline: none; cursor: pointer;
}
.filter-select select:focus { border-color: var(--accent); }

.btn-icon {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* Dropdown */
.dropdown-container { position: relative; }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: var(--border-hov); }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
  display: none;
}
.dropdown-menu.show { display: block; animation: fadeUp 0.18s ease; }
.dropdown-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}
.dropdown-menu a:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Table */
.table-card { border-radius: var(--radius); }
.table-container { overflow-x: auto; }
.manage-leads-table { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
tbody tr:hover td { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize; white-space: nowrap;
}
.badge-new        { background: rgba(79,110,247,0.12);  color: var(--accent); }
.badge-contacted  { background: rgba(6,182,212,0.12);   color: var(--cyan); }
.badge-qualified  { background: rgba(16,185,129,0.12);  color: var(--success); }
.badge-warm       { background: rgba(249,115,22,0.12);  color: var(--orange); }
.badge-lost       { background: rgba(239,68,68,0.12);   color: var(--error); }

/* Stage pill variants */
.stage-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
}

/* Score bar */
.score-cell { display: flex; align-items: center; gap: 10px; }
.score-bar-bg { flex: 1; height: 5px; background: rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 10px; }

/* Pagination */
.pagination-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}
.pagination-controls { display: flex; gap: 4px; align-items: center; }
.page-btn {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted); font-size: 12px;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover   { background: rgba(255,255,255,0.07); color: var(--text); }
.page-btn.active  { background: var(--accent); border-color: var(--accent); color: white; }

/* Side toolbar */
.side-toolbar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}
.tool-btn {
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.tool-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); border-color: var(--border); }
.tool-btn.add   { background: var(--accent); color: white; border-color: var(--accent); }
.tool-btn.add:hover { background: #3b5de8; }

/* ════════════════════════════════════
   LEAD DETAILS
   ════════════════════════════════════ */
.details-header   { margin-bottom: 20px; }
.btn-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 8px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-back:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.details-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
}
.details-left  { display: flex; flex-direction: column; gap: 16px; }
.profile-card  { padding: 24px; border-radius: var(--radius); }
.profile-stats { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.profile-info-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-muted);
}
.score-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  text-align: center;
}
.score-box { padding: 12px 8px; border-right: 1px solid var(--border); }
.score-box:last-child { border-right: none; }
.score-box .val  { font-family: var(--font-heading); font-size: 20px; font-weight: 700; }
.score-box .lbl  { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

.properties-card { padding: 18px; border-radius: var(--radius); }
.properties-table { width: 100%; border-collapse: collapse; }
.properties-table td { padding: 8px 6px; font-size: 12.5px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.properties-table td:first-child { color: var(--text-dim); width: 48%; }

.details-right { display: flex; flex-direction: column; gap: 14px; }
.tabs-header {
  display: flex; align-items: center;
  padding: 6px 12px; border-radius: var(--radius-sm);
  gap: 4px; flex-wrap: wrap;
}
.tab {
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: var(--transition);
}
.tab:hover   { background: rgba(255,255,255,0.05); color: var(--text); }
.tab.active  { background: var(--accent); color: white; }
.btn-accent  {
  margin-left: auto;
  background: var(--accent);
  color: white; border: none;
  border-radius: 10px; padding: 8px 14px;
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.btn-accent:hover { background: #3b5de8; }

.details-main { padding: 20px; border-radius: var(--radius); }
.history-sub-tabs { display: flex; gap: 0; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.sub-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-dim); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: var(--transition);
}
.sub-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sub-tab:hover  { color: var(--text-muted); }

.history-filters {
  display: flex; gap: 20px; align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 20px;
}
.mini-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text); padding: 5px 10px;
  border-radius: 7px; font-size: 12px;
  outline: none; cursor: pointer;
}

/* Activity Timeline */
.activity-timeline { display: flex; flex-direction: column; gap: 0; }
.date-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text-dim); text-transform: uppercase;
  padding: 14px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.date-label:first-child { border-top: none; margin-top: 0; }
.timeline-item { display: flex; gap: 16px; padding: 10px 0; }
.time-mark { display: flex; flex-direction: column; align-items: center; width: 52px; flex-shrink: 0; }
.icon-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(79,110,247,0.1);
  border: 1px solid rgba(79,110,247,0.2);
  color: var(--accent);
}
.timeline-content {
  flex: 1; padding-top: 4px;
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
}
.timeline-content p { color: var(--text); margin-bottom: 4px; }

/* ════════════════════════════════════
   PIPELINE
   ════════════════════════════════════ */
.pipeline-board { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 12px; }
.pipeline-col { width: 270px; flex-shrink: 0; }
.pipeline-col-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding: 0 4px;
}
.pipeline-stage-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.pipeline-count { font-size: 11px; color: var(--text-dim); font-weight: 600; }
.pipeline-col-body {
  min-height: 380px; padding: 10px;
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 10px;
  border: 1px dashed rgba(255,255,255,0.05);
}
.deal-card {
  padding: 14px 16px; border-radius: 10px;
  cursor: pointer; transition: var(--transition);
}
.deal-card:hover { background: var(--card-hover) !important; transform: translateY(-1px); }
.deal-title  { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.deal-company{ font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.deal-footer { display: flex; justify-content: space-between; align-items: center; }
.deal-value  { color: var(--success); font-weight: 700; font-size: 12px; }
.add-deal-btn {
  text-align: center; padding: 10px;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px; cursor: pointer;
  transition: var(--transition);
}
.add-deal-btn:hover { background: rgba(255,255,255,0.04); color: var(--text-muted); }

/* ════════════════════════════════════
   MODAL
   ════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 500px; max-width: 90vw;
  border-radius: 18px; padding: 32px;
  position: relative;
  animation: fadeUp 0.25s ease;
}
.modal-title { font-family: var(--font-heading); font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.modal-close {
  position: absolute; top: 20px; right: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 6px;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }

/* ════════════════════════════════════
   SEARCH RESULTS OVERLAY
   ════════════════════════════════════ */
.search-results-overlay {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--sidebar);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 100; max-height: 360px;
  overflow-y: auto; display: none;
  padding: 10px;
}
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  cursor: pointer; transition: var(--transition);
}
.search-result-item:hover { background: rgba(255,255,255,0.05); }

/* ════════════════════════════════════
   AI BADGE
   ════════════════════════════════════ */
.ai-card {
  border: 1px solid transparent;
  background: linear-gradient(145deg, rgba(139,92,246,0.08), rgba(79,110,247,0.08));
  transition: var(--transition);
}
.ai-card:hover { border-color: var(--purple); }

/* ════════════════════════════════════
   ADMIN SECTION
   ════════════════════════════════════ */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: flex-start;
}
.admin-card {
    padding: 24px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
}
.admin-card h3 {
    font-size: 16px;
    font-weight: 700;
}
.admin-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.admin-icon-wrap {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255,255,255,0.02);
}
.upload-dropzone:hover {
    border-color: var(--accent);
    background: rgba(79,110,247,0.05);
}

.team-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.team-card {
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
}
.role-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.icon-btn-small {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn-small:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}

@media (max-width: 1024px) {
    .admin-grid { grid-template-columns: 1fr; }
    .admin-card { grid-column: span 1 !important; }
}

/* ════════════════════════════════════
   TOAST SYSTEM
   ════════════════════════════════════ */
.toast-card {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 1000;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast-card.show {
    transform: translateY(0);
    opacity: 1;
}
.toast-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}
.toast-title { font-weight: 700; font-size: 14px; color: var(--text); }
.toast-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ════════════════════════════════════
   UTILITIES
   ════════════════════════════════════ */
.btn-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border-color: var(--accent);
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.dropdown-container { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--sidebar);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    padding: 6px;
    backdrop-filter: blur(12px);
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    transition: 0.2s;
}
.dropdown-menu a:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}
.menu-divider { height: 1px; background: var(--border); margin: 6px; }

/* ════════════════════════════════════
   CALL BUTTON  (CallButton component)
   ════════════════════════════════════ */
.call-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.call-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

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

.call-btn:disabled,
.call-btn.logging {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.call-btn.logging::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(16,185,129,0.3);
    border-top-color: var(--success);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 2px;
}

/* Call count badge */
.call-count {
    background: var(--success);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

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

/* ════════════════════════════════════
   REPORTS PAGE
   ════════════════════════════════════ */
.reports-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 4px;
}

.report-stat-card {
    padding: 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.report-stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79,110,247,0.15);
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.report-card {
    padding: 20px;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.report-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.report-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.owner-table-wrap {
    max-height: 240px;
    overflow-y: auto;
}

.owner-row {
    cursor: pointer;
    transition: background 0.15s;
}
.owner-row:hover td {
    background: rgba(79,110,247,0.06);
}

@media (max-width: 1200px) {
    .reports-stats-row { grid-template-columns: repeat(2, 1fr); }
    .reports-grid { grid-template-columns: 1fr; }
    .reports-grid .report-card { grid-column: span 1 !important; }
}

/* ════════════════════════════════════
   LEADS TABLE SKELETON
   (LeadsTableSkeleton component)
   ════════════════════════════════════ */
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 6px;
}
@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ════════════════════════════════════
   PWA INSTALL BANNER
   (InstallPromptBanner component)
   ════════════════════════════════════ */
.pwa-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 80px);
    max-width: 520px;
    z-index: 999;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: slideUp 0.4s cubic-bezier(0.175,0.885,0.32,1.275) both;
}
.pwa-banner-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}
.pwa-icon-wrap {
    width: 40px;
    height: 40px;
    background: rgba(79,110,247,0.12);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
@keyframes slideUp {
    from { opacity:0; transform: translateX(-50%) translateY(20px); }
    to   { opacity:1; transform: translateX(-50%) translateY(0); }
}

/* ════════════════════════════════════
   BADGE COMPONENT
   (shadcn Badge → .crm-badge variants)
   ════════════════════════════════════ */
.crm-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: opacity 0.15s;
}

.badge-blue    { background: #3b82f620; color: #60a5fa; border-color: #3b82f640; }
.badge-purple  { background: #a855f720; color: #c084fc; border-color: #a855f740; }
.badge-green   { background: #22c55e20; color: #4ade80; border-color: #22c55e40; }
.badge-indigo  { background: #6366f120; color: #818cf8; border-color: #6366f140; }
.badge-violet  { background: #8b5cf620; color: #a78bfa; border-color: #8b5cf640; }
.badge-emerald { background: #10b98120; color: #34d399; border-color: #10b98140; }
.badge-gray    { background: #6b728020; color: #9ca3af; border-color: #6b728040; }
.badge-red     { background: #ef444420; color: #f87171; border-color: #ef444440; }
.badge-orange  { background: #f9731620; color: #fb923c; border-color: #f9731640; }
.badge-ai      { background: linear-gradient(135deg,#4f6ef710,#8b5cf710); color: #818cf8; border-color: #6366f140; font-size: 8px; }

/* ════════════════════════════════════
   AVATAR COMPONENT
   (shadcn Avatar + AvatarFallback)
   ════════════════════════════════════ */
.lead-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.leads-row:hover .lead-avatar {
    transform: scale(1.08);
}

.owner-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: linear-gradient(135deg, #4f6ef7, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* ════════════════════════════════════
   LEAD TABLE ROW HOVER
   ════════════════════════════════════ */
.leads-row {
    transition: background 0.15s;
}
.leads-row:hover {
    background: rgba(79, 110, 247, 0.04);
}
.lead-name-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
}
.lead-name-link:hover { color: #7c9cff; text-decoration: underline; }
.phone-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s;
}
.phone-link:hover { color: var(--text); }

/* ════════════════════════════════════
   DROPDOWN MENU COMPONENT
   (shadcn DropdownMenu)
   ════════════════════════════════════ */
.dropdown-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 500;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    list-style: none;
    margin: 0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.dropdown-menu.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

.dropdown-menu li button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    border-radius: 8px;
    text-align: left;
    transition: background 0.1s;
}
.dropdown-menu li button:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}
.dropdown-menu li button i { color: var(--text-dim); flex-shrink: 0; }

.dropdown-item-danger { color: #f87171 !important; }
.dropdown-item-danger:hover { background: rgba(239,68,68,0.1) !important; }
.dropdown-item-danger i { color: #f87171 !important; }

.dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
    padding: 0 !important;
}

/* ════════════════════════════════════
   HOVERCARD COMPONENT
   (shadcn HoverCard → CSS hover popup)
   ════════════════════════════════════ */
.hovercard-wrap {
    position: relative;
    display: inline-flex;
}
.hovercard-content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 160px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateX(-50%) translateY(4px);
    z-index: 200;
    white-space: nowrap;
}
.hovercard-wrap:hover .hovercard-content {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════
   PAGINATION COMPONENT
   (shadcn Pagination → .pagination-controls <ul>)
   ════════════════════════════════════ */
.pagination-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text-dim);
    font-size: 12px;
}

/* ════════════════════════════════════
   BUTTON DANGER (AlertDialog action)
   ════════════════════════════════════ */
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: #ef444420;
    color: #f87171;
    border: 1px solid #ef444440;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-danger:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    box-shadow: 0 4px 16px rgba(239,68,68,0.3);
}

/* ════════════════════════════════════
   SIDEBAR (Sidebar + SidebarRail)
   Collapsible with data-state
   ════════════════════════════════════ */
.sidebar {
    transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
}
.sidebar[data-state="collapsed"] {
    width: 68px;
}
.sidebar[data-state="collapsed"] .nav-text,
.sidebar[data-state="collapsed"] .nav-label,
.sidebar[data-state="collapsed"] .nav-badge,
.sidebar[data-state="collapsed"] .logo-text,
.sidebar[data-state="collapsed"] .logo-pill,
.sidebar[data-state="collapsed"] .ai-widget,
.sidebar[data-state="collapsed"] .user-info {
    display: none;
}
.sidebar[data-state="collapsed"] .logo-section {
    justify-content: center;
    padding: 22px 12px;
}
.sidebar[data-state="collapsed"] .nav-link {
    justify-content: center;
    padding: 12px;
}
.sidebar[data-state="collapsed"] .user-profile {
    justify-content: center;
    padding: 12px;
}

/* SidebarRail (hover drag handle on right edge) */
.sidebar-rail {
    position: absolute;
    right: -2px; top: 0;
    width: 4px; height: 100%;
    cursor: col-resize;
    z-index: 100;
    background: transparent;
    transition: background 0.2s;
}
.sidebar-rail:hover {
    background: var(--accent);
    opacity: 0.4;
}

/* SidebarTrigger button */
.sidebar-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-trigger:hover {
    background: rgba(79,110,247,0.1);
    color: var(--accent);
    border-color: rgba(79,110,247,0.3);
}

/* Tooltip (Tooltip component) on collapsed sidebar */
.sidebar[data-state="collapsed"] .nav-link {
    position: relative;
}
.sidebar[data-state="collapsed"] .nav-link[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: #1e293b;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 999;
    pointer-events: none;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Sync main content width with sidebar collapse */
body[data-sidebar="collapsed"] .main {
    margin-left: 0;
}

/* ════════════════════════════════════
   PROGRESS COMPONENT  (Progress)
   ════════════════════════════════════ */
.crm-progress {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background: rgba(255,255,255,0.06);
}
.crm-progress-indicator {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ════════════════════════════════════
   SWITCH COMPONENT  (Switch)
   ════════════════════════════════════ */
.crm-switch {
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 22px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.12);
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
    outline: none;
}
.crm-switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}
.crm-switch.checked {
    background: var(--accent);
}
.crm-switch.checked::after {
    transform: translateX(18px);
}
.crm-switch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: none; }

/* ════════════════════════════════════
   TOGGLE GROUP  (ToggleGroup)
   Table / Kanban view toggle
   ════════════════════════════════════ */
.toggle-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}
.toggle-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--transition);
}
.toggle-item:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.toggle-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(79,110,247,0.3);
}

/* ════════════════════════════════════
   TABS COMPONENT  (Tabs + TabsList + TabsTrigger + TabsContent)
   ════════════════════════════════════ */
.crm-tabs {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.tabs-list {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}
.tabs-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.tabs-trigger:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.tabs-trigger.active {
    background: rgba(79,110,247,0.15);
    color: var(--accent);
    font-weight: 600;
}
.tabs-trigger.active i { color: var(--accent); }
.tabs-content {
    animation: tabFadeIn 0.2s ease;
}
@keyframes tabFadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

/* ════════════════════════════════════
   SEPARATOR  (Separator)
   ════════════════════════════════════ */
.crm-separator {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 0;
}
.crm-separator-vertical {
    width: 1px;
    height: 100%;
    background: var(--border);
    flex-shrink: 0;
}

/* ════════════════════════════════════
   SLIDER  (Slider → input[type=range])
   ════════════════════════════════════ */
.crm-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.08);
    outline: none;
    cursor: pointer;
}
.crm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(79,110,247,0.5);
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}
.crm-slider:hover::-webkit-slider-thumb {
    box-shadow: 0 2px 16px rgba(79,110,247,0.7);
}
.crm-slider::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid white;
    cursor: pointer;
}
.crm-slider::-moz-range-track {
    height: 6px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.08);
}

/* ════════════════════════════════════
   SCROLL AREA  (ScrollArea → CSS)
   ════════════════════════════════════ */
.crm-scroll-area {
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.crm-scroll-area::-webkit-scrollbar { width: 6px; height: 6px; }
.crm-scroll-area::-webkit-scrollbar-track { background: transparent; }
.crm-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 9999px;
}
.crm-scroll-area::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ════════════════════════════════════
   SKELETON  (Skeleton → animate-pulse)
   ════════════════════════════════════ */
.crm-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.09) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ════════════════════════════════════
   POPOVER  (Popover)
   ════════════════════════════════════ */
.crm-popover {
    position: fixed;
    z-index: 600;
    background: var(--bg-card, #12192e);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    min-width: 280px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.crm-popover.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* ════════════════════════════════════
   KANBAN BOARD  (ToggleGroup → Kanban view)
   ════════════════════════════════════ */
.kanban-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.kanban-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 230px;
    flex-shrink: 0;
}
.kanban-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.kanban-col-title { font-size: 12px; font-weight: 700; }
.kanban-col-body { display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ════════════════════════════════════
   FORM ELEMENTS  (Select → .form-input)
   ════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-input {
    width: 100%;
    padding: 9px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
    border-color: rgba(79,110,247,0.5);
    box-shadow: 0 0 0 3px rgba(79,110,247,0.1);
}
.form-input option { background: #12192e; }
