/* ============================================================
   Sales Navigator CRM — Main Stylesheet
   Bootstrap 5.3 + Custom Design System
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  /* Ez Rankings brand palette */
  --blue:            #11559b;
  --blue-dark:       #0d4280;
  --blue-light:      rgba(17,85,155,0.1);
  --blue-grad:       linear-gradient(135deg, #11559b 0%, #1a6cc4 100%);
  --gold:            #f5c400;
  --gold-dark:       #d4a900;
  --gold-light:      rgba(245,196,0,0.12);

  --sidebar-bg:      #0a0a0a;
  --sidebar-hover:   #1f1d1a;
  --sidebar-active:  #f5c400;
  --sidebar-border:  #2a2926;
  --sidebar-text:    #c7c4be;
  --sidebar-muted:   #6c685f;
  --sidebar-width:   248px;
  --font-mono:       "Geist Mono", "SF Mono", "Menlo", "Consolas", monospace;

  --primary:         #11559b;
  --primary-hover:   #0d4280;
  --primary-light:   rgba(17,85,155,0.1);
  --primary-grad:    var(--blue-grad);
  --success:         #22c55e;
  --success-light:   rgba(34,197,94,0.1);
  --warning:         #f59e0b;
  --warning-light:   rgba(245,158,11,0.1);
  --danger:          #ef4444;
  --danger-light:    rgba(239,68,68,0.1);
  --info:            #06b6d4;
  --info-light:      rgba(6,182,212,0.1);

  --bg:              #f4f6fb;
  --card-bg:         #ffffff;
  --border:          #e2e8f2;
  --border-light:    #f0f4f8;
  --text:            #0a0f1a;
  --text-muted:      #5a6a80;
  --text-light:      #94a3b8;

  --radius:          10px;
  --radius-lg:       14px;
  --radius-xl:       20px;
  --shadow:          0 1px 4px rgba(10,25,41,0.07), 0 1px 2px rgba(10,25,41,0.04);
  --shadow-md:       0 4px 16px rgba(10,25,41,0.09), 0 2px 6px rgba(10,25,41,0.04);
  --shadow-lg:       0 12px 32px rgba(10,25,41,0.13), 0 4px 12px rgba(10,25,41,0.06);

  --font:            'Inter', system-ui, -apple-system, sans-serif;
  --transition:      all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Wrapper Layout ─────────────────────────────────────── */
.wrapper { display: flex; min-height: 100vh; }
.content-area { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-x: hidden; margin-left: var(--sidebar-width); }
.main-content { flex: 1; padding: 28px; max-width: 1600px; width: 100%; margin: 0 auto; overflow-x: hidden; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #e7e5e0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
  z-index: 200;
  padding: 18px 14px 14px;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 14px;
  flex-shrink: 0;
}
.brand-icon {
  width: 30px; height: 30px;
  background: var(--gold);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #0a0a0a; flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 900;
  overflow: hidden;
}
.brand-icon img { width: 22px; height: 22px; object-fit: contain; }
.brand-name {
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}
.brand-tagline {
  color: #8c887f;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 1px;
  opacity: 1;
}

.sidebar-nav { flex: 1; padding: 0; overflow-y: auto; }
.nav-list { list-style: none; padding: 0; margin: 0; }

.nav-sep {
  padding: 6px 8px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.nav-item { margin: 1px 0; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    border-radius: 7px;
    color: #e8e8e8;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400 !important;
    transition: background .12s, color .12s;
    position: relative;
    font-family: 'Inter';
}
.nav-link:hover {
  background: var(--sidebar-hover);
  color: #f0eee8;
}
.nav-link.active {
  background: var(--sidebar-active);
  color: #0a0a0a;
  font-weight: 600;
}
.nav-link.active:hover { background: var(--sidebar-active); color: #0a0a0a; }
.nav-icon {
  width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  color: inherit;
  background: none;
  border-radius: 0;
}
.nav-link:hover .nav-icon { background: none; }
.nav-link.active .nav-icon { color: #0a0a0a; background: none; }
.nav-label { flex: 1; }
.nav-badge {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: 99px;
  background: #ef4444; color: #fff;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 700;
}
.nav-link.active .nav-badge { background: rgba(239,68,68,0.75); }

/* Sidebar foot / user section */
.sidebar-foot {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 8px;
  margin-top: 8px;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  background: #1a1816;
  margin-top: 4px;
}
.sidebar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #2a2926;
  color: #f0eee8;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f0eee8 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px;
  color: #8c887f;
  text-transform: capitalize;
  margin-top: 1px;
}
.btn-logout {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px;
  color: #6c685f;
  background: transparent;
  border: none;
  text-decoration: none;
  transition: var(--transition);
  flex-shrink: 0;
  font-size: 0.82rem;
}
.btn-logout:hover { background: rgba(239,68,68,0.15); color: #f87171; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

/* ── Top Header ─────────────────────────────────────────── */
.top-header {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: none;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); }

.breadcrumb-nav .breadcrumb { margin: 0; }
.breadcrumb-item { font-size: 0.82rem; }
.breadcrumb-item a { color: var(--text-muted); text-decoration: none; }
.breadcrumb-item.active { color: var(--text); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-light); }

.header-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  transition: var(--transition);
}
.header-icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}
.header-user { display: flex; align-items: center; gap: 8px; }
.header-user-name { font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.header-user-role { font-size: 0.68rem; color: var(--text-muted); text-transform: capitalize; }

/* ── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1;
  letter-spacing: -0.04em;
}
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin: 4px 0 0; }
.page-header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-date-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  box-shadow: var(--shadow);
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfd 0%, #f5f7fb 100%);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin: 0; letter-spacing: -0.1px; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: transparent; }

/* ── KPI Row ────────────────────────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 2px 8px rgba(10,25,41,0.06), 0 1px 3px rgba(10,25,41,0.03);
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
  cursor: default;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 18px 18px 0 0;
}
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: -40px; right: -40px;
  width: 130px; height: 130px;
  border-radius: 50%;
  pointer-events: none;
}
.kpi-card:hover {
  box-shadow: 0 8px 28px rgba(10,25,41,0.11), 0 3px 10px rgba(10,25,41,0.05);
  transform: translateY(-4px);
  border-color: transparent;
}
.kpi-primary::before  { background: var(--blue-grad); }
.kpi-primary::after   { background: radial-gradient(circle, rgba(99,102,241,0.13) 0%, transparent 70%); }
.kpi-success::before  { background: linear-gradient(90deg,#22c55e,#4ade80); }
.kpi-success::after   { background: radial-gradient(circle, rgba(34,197,94,0.13) 0%, transparent 70%); }
.kpi-warning::before  { background: linear-gradient(90deg,var(--gold),#ffd740); }
.kpi-warning::after   { background: radial-gradient(circle, rgba(245,158,11,0.13) 0%, transparent 70%); }
.kpi-danger::before   { background: linear-gradient(90deg,#ef4444,#f87171); }
.kpi-danger::after    { background: radial-gradient(circle, rgba(239,68,68,0.13) 0%, transparent 70%); }
.kpi-info::before     { background: linear-gradient(90deg,#06b6d4,#22d3ee); }
.kpi-info::after      { background: radial-gradient(circle, rgba(6,182,212,0.13) 0%, transparent 70%); }
.kpi-icon-wrap {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.35rem;
}
.kpi-content { flex: 1; min-width: 0; }
.kpi-value {
    font-size: 35px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -1.5px;
}
.kpi-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.kpi-sub .up   { color: #22c55e; font-weight: 600; }
.kpi-sub .down { color: #ef4444; font-weight: 600; }
.kpi-sub .warn { color: var(--warning); font-weight: 600; }

/* ── Filters Row ────────────────────────────────────────── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.filter-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 280px;
}
.filter-search-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.85rem;
  pointer-events: none;
}
.filter-search-wrap .form-control { padding-left: 36px; }
.filter-select { min-width: 140px; max-width: 180px; }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  overflow-x: auto;
}
.crm-table { width: 100%; border-collapse: collapse; min-width: 700px; font-size: 13px; }
.crm-table thead th {
  background: var(--bg);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.crm-table thead th.sortable { cursor: pointer; }
.crm-table thead th.sortable:hover { color: var(--text); }
.crm-table thead th.num { text-align: right; }
.crm-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
  color: var(--text);
}
.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table tbody tr:hover td { background: #fafaf9; }
.td-num { width: 38px; color: var(--text-muted); font-size: 12px; }
.td-value { text-align: right; white-space: nowrap; font-size: 13px; font-weight: 550; }
.lead-cell-name {
  background: none; border: none; padding: 0;
  font-weight: 600; color: var(--text); font-size: 13.5px; text-align: left;
  cursor: pointer; text-decoration: none; display: block;
}
.lead-cell-name:hover { color: var(--primary); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.lead-cell-sub {
  display: flex; align-items: center; gap: 6px;
  margin-top: 2px; font-size: 11.5px; color: var(--text-muted);
}
.stage-dot-wrap { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(0,0,0,0); }
.stage-dot-label { font-size: 12.5px; color: var(--text); font-weight: 500; }
.src-pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 5px; background: var(--bg);
  border: 1px solid var(--border); font-size: 11.5px; color: var(--text); font-weight: 500;
}
.fu-date-line { font-size: 12.5px; font-weight: 500; color: var(--text); }
.fu-tag-sm {
  display: inline-block; align-self: flex-start;
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg); color: var(--text-muted); font-weight: 500; border: 1px solid var(--border);
}
.fu-tag-sm.overdue { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.fu-tag-sm.today   { background: var(--gold); color: #0a0a0a; font-weight: 700; border-color: var(--gold); }
.fu-tag-sm.soon    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.empty-row { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-row i { font-size: 2.5rem; display: block; margin-bottom: 12px; opacity: 0.3; }

.crm-table th.sticky-action-col,
.crm-table td.sticky-action-col {
  position: sticky; right: 0; z-index: 2;
  background: var(--card-bg);
  box-shadow: -3px 0 8px rgba(0,0,0,0.06);
}
.crm-table thead th.sticky-action-col { background: var(--bg); z-index: 3; }
.crm-table tbody tr:hover td.sticky-action-col { background: #fafaf9; }

/* ── Stage Badges ───────────────────────────────────────── */
.badge-stage {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.badge-no-response   { background: rgba(100,116,139,0.1); color: #475569; }
.badge-contacted     { background: rgba(6,182,212,0.12);  color: #0891b2; }
.badge-qualified     { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-proposal-sent { background: rgba(168,85,247,0.12); color: #9333ea; }
.badge-negotiation   { background: rgba(249,115,22,0.12); color: #ea580c; }
.badge-converted     { background: rgba(34,197,94,0.12);  color: #16a34a; }
.badge-close-lost    { background: rgba(239,68,68,0.12);  color: #dc2626; }
.badge-competitor    { background: rgba(236,72,153,0.12); color: #db2777; }
.badge-budget-issue  { background: rgba(245,158,11,0.15); color: #b45309; }
.badge-invalid       { background: rgba(100,116,139,0.15);color: #64748b; }
.badge-secondary     { background: rgba(100,116,139,0.1); color: #64748b; }

/* ── Avatars ────────────────────────────────────────────── */
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}
.user-avatar.xs { width: 28px; height: 28px; font-size: 0.65rem; }
.user-avatar.sm { width: 32px; height: 32px; font-size: 0.72rem; }
.user-avatar.lg { width: 48px; height: 48px; font-size: 1rem; }

/* ── Action Buttons ─────────────────────────────────────── */
.actions-cell { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.action-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.8rem;
  text-decoration: none;
  padding: 0;
}
.action-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.action-btn.del:hover { background: var(--danger-light); color: var(--danger); }
.action-btn.edit:hover { background: var(--warning-light); color: var(--warning); }

/* ── Reference Pagination ───────────────────────────────── */
.pager-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.pager-foot-text { font-size: 12.5px; color: var(--text-muted); }
.pager-btns { display: flex; align-items: center; gap: 4px; }
.pg-btn {
  width: 30px; height: 30px;
  border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--text-muted);
  font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: var(--transition);
}
.pg-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.pg-btn.active { background: var(--text); color: var(--gold); border-color: var(--text); }

/* ── Reference KPI cards (k-card style) ─────────────────── */
.k-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.k-card {
  position: relative;
  padding: 18px 18px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-height: 110px;
  transition: border-color .12s;
}
.k-card:hover { border-color: var(--border-light); box-shadow: var(--shadow-md); }
.k-top { display: flex; align-items: center; justify-content: space-between; }
.k-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.k-delta {
  font-size: 10.5px; padding: 2px 7px; border-radius: 99px;
  background: #ecfdf5; color: #047857; font-weight: 600;
}
.k-delta-danger { background: #fef2f2; color: #b91c1c; }
.k-value {
  font-size: 34px; font-weight: 600; letter-spacing: -0.025em;
  line-height: 1.05; margin-top: 10px; color: var(--text);
}
.k-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.k-sparkline { position: absolute; right: 14px; bottom: 14px; opacity: 0.5; }
.k-amber {
  background: var(--gold); border-color: var(--gold-dark);
}
.k-amber .k-label { color: rgba(10,10,10,.65); }
.k-amber .k-value { color: #0a0a0a; }
.k-amber .k-sub { color: rgba(10,10,10,.7); }
.k-amber .k-delta { background: rgba(10,10,10,.1); color: #0a0a0a; }
.k-dark {
  background: var(--sidebar-bg); border-color: var(--sidebar-bg); color: #f0eee8;
}
.k-dark .k-label { color: #a8a49b; }
.k-dark .k-value { color: var(--gold); }
.k-dark .k-sub { color: #a8a49b; }
.k-dark .k-delta { background: rgba(245,196,0,.18); color: var(--gold); }
.k-dark::after {
  content: ''; position: absolute; right: -40px; bottom: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(245,196,0,.18), transparent);
  pointer-events: none;
}
.k-urgent .k-delta { background: #fef2f2; color: #b91c1c; }

/* ── Reference Follow-up KPI strip ──────────────────────── */
.fu-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.fu-kpi-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.fu-kpi-card::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.fu-kpi-overdue::after  { background: #ef4444; }
.fu-kpi-today::after    { background: var(--gold); }
.fu-kpi-upcoming::after { background: #3b82f6; }
.fu-kpi-done::after     { background: #10b981; }
.fu-kpi-mark {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center; flex-shrink: 0;
}
.fu-kpi-overdue  .fu-kpi-mark { background: #fef2f2; color: #b91c1c; }
.fu-kpi-today    .fu-kpi-mark { background: #fff5c6; color: #6b5b00; }
.fu-kpi-upcoming .fu-kpi-mark { background: #eff6ff; color: #1d4ed8; }
.fu-kpi-done     .fu-kpi-mark { background: #ecfdf5; color: #047857; }
.fu-kpi-body { flex: 1; min-width: 0; }
.fu-kpi-val {
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.025em; line-height: 1.05; color: var(--text);
}
.fu-kpi-lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); margin-top: 2px;
}
.fu-kpi-trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; padding: 3px 7px; border-radius: 99px;
  background: var(--bg); color: var(--text-muted); white-space: nowrap;
  border: 1px solid var(--border);
}
.fu-kpi-overdue .fu-kpi-trend { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.fu-kpi-done    .fu-kpi-trend { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* ── Reference Follow-up cards ───────────────────────────── */
.fu-ref-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  padding: 16px;
}
.fu-ref-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .12s, box-shadow .12s;
}
.fu-ref-card::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0;
}
.fu-ref-card.fu-today::before    { background: var(--gold); }
.fu-ref-card.fu-overdue::before  { background: #ef4444; }
.fu-ref-card.fu-upcoming::before { background: #3b82f6; }
.fu-ref-card:hover { border-color: var(--border); box-shadow: var(--shadow-md); }
.fu-ref-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.fu-ref-head-l { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.fu-ref-type-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-muted); flex-shrink: 0;
  font-size: 13px;
}
.fu-ref-card.fu-today    .fu-ref-type-icon { background: #fff5c6; color: #6b5b00; border-color: #f0d97a; }
.fu-ref-card.fu-overdue  .fu-ref-type-icon { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.fu-ref-card.fu-upcoming .fu-ref-type-icon { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.fu-ref-name {
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text); margin-bottom: 4px; text-decoration: none;
  display: block;
}
.fu-ref-name:hover { color: var(--primary); text-decoration: underline; }
.fu-ref-meta { display: flex; gap: 5px; flex-wrap: wrap; }
.fu-ref-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 11px; color: var(--text); font-weight: 500;
}
.fu-ref-time {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.fu-ref-time-main { font-size: 12.5px; color: var(--text); font-weight: 600; }
.fu-ref-note {
  font-size: 12.5px; color: var(--text);
  line-height: 1.45; padding: 8px 10px;
  background: var(--bg); border-radius: 7px;
  border-left: 2px solid var(--border);
}
.fu-ref-card.fu-today    .fu-ref-note { background: #fffbe6; border-left-color: var(--gold); }
.fu-ref-card.fu-overdue  .fu-ref-note { background: #fef7f7; border-left-color: #fca5a5; }
.fu-ref-card.fu-upcoming .fu-ref-note { background: #f5f9ff; border-left-color: #93c5fd; }
.fu-ref-foot {
  display: flex; align-items: center; gap: 6px;
  padding-top: 8px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.fu-ref-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--card-bg);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: var(--transition); text-decoration: none;
}
.fu-ref-action:hover { background: var(--bg); color: var(--text); }
.fu-ref-action-done:hover  { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.fu-ref-action-skip:hover  { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.fu-ref-action-gcal { color: #4285F4; border-color: rgba(66,133,244,.3); }
.fu-ref-action-gcal:hover  { background: rgba(66,133,244,.08); border-color: #4285F4; color: #4285F4; }

/* ── Page eyebrow ────────────────────────────────────────── */
.page-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin-bottom: 6px;
}

/* ── Follow-up Summary Cards ────────────────────────────── */
.fu-summary-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(10,25,41,0.06);
  transition: all 0.25s ease;
  height: 100%;
}
.fu-summary-card:hover { box-shadow: 0 8px 24px rgba(10,25,41,0.1); transform: translateY(-3px); border-color: transparent; }
.fu-overdue  { border-top: 4px solid var(--danger); }
.fu-today    { border-top: 4px solid var(--warning); }
.fu-upcoming { border-top: 4px solid var(--info); }
.fu-sum-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.fu-overdue  .fu-sum-header { color: var(--danger); background: transparent; }
.fu-today    .fu-sum-header { color: #b45309; background: transparent; }
.fu-upcoming .fu-sum-header { color: #0e7490; background: transparent; }
.fu-count {
  font-size: 1.9rem; font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.fu-mini-list { list-style: none; margin: 0; padding: 8px 16px; }
.fu-mini-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.82rem;
  gap: 8px;
}
.fu-mini-list li:last-child { border-bottom: none; }
.fu-mini-list a { color: var(--text); font-weight: 500; text-decoration: none; }
.fu-mini-list a:hover { color: var(--primary); }
.fu-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.fu-empty { padding: 16px; font-size: 0.82rem; color: var(--text-light); text-align: center; }
.fu-view-all {
  display: block;
  padding: 10px 16px;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  border-top: 1px solid var(--border-light);
  font-weight: 500;
}
.fu-view-all:hover { background: var(--primary-light); }

/* Follow-up cell in table */
.fu-cell { font-size: 0.8rem; color: var(--text-muted); }
.fu-overdue  { color: var(--danger)  !important; }
.fu-today    { color: var(--warning) !important; }
.fu-upcoming { color: var(--info); }
.fu-done     { color: var(--success); }
.fu-missed   { color: var(--text-light); text-decoration: line-through; }

/* ── Follow-up Page Tabs ────────────────────────────────── */
.fu-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.fu-tab {
  padding: 14px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.fu-tab:hover { color: var(--text); }
.fu-tab.active { color: var(--text); border-bottom-color: var(--text); }
.fu-tab-badge {
  background: var(--text-light); color: white;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
}
.fu-tab.tab-danger .fu-tab-badge { background: var(--danger); }
.fu-tab.tab-danger.active { color: var(--danger); border-bottom-color: var(--danger); }

/* Follow-up Cards on followups.php */
.fu-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: var(--transition);
  border-left: 4px solid var(--border);
}
.fu-card:hover { box-shadow: var(--shadow-md); }
.fu-card.fu-overdue  { border-left-color: var(--danger);  background: rgba(239,68,68,0.02); }
.fu-card.fu-today    { border-left-color: var(--warning); background: rgba(245,158,11,0.02); }
.fu-card.fu-upcoming { border-left-color: var(--info); }
.fu-card-left { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 2px; }
.fu-mode-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 1rem;
}
.fu-card-body { flex: 1; min-width: 0; }
.fu-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fu-lead-name { font-weight: 600; color: var(--text); text-decoration: none; font-size: 0.9rem; }
.fu-lead-name:hover { color: var(--primary); }
.fu-card-time { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.fu-card-time.fu-overdue { color: var(--danger); font-weight: 600; }
.fu-card-meta { margin-top: 5px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.fu-card-note { margin-top: 6px; font-size: 0.8rem; color: var(--text-muted); }
.fu-card-actions { display: flex; flex-direction: column; gap: 4px; justify-content: flex-start; }

/* 3-column grid for card view */
.fu-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 16px;
}

/* Follow-up Timeline on lead-view.php */
.fu-timeline { list-style: none; padding: 0; margin: 0; }
.fu-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.fu-item:last-child { border-bottom: none; }
.fu-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.fu-dot.pending { background: var(--warning); }
.fu-dot.done    { background: var(--success); }
.fu-dot.missed  { background: var(--text-light); }
.fu-item-body { flex: 1; }
.fu-item-header {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 500; flex-wrap: wrap;
}
.fu-item-time { font-size: 0.78rem; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.fu-item-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.fu-item-meta { display: flex; align-items: center; margin-top: 6px; gap: 6px; }
.badge-sm { font-size: 0.65rem !important; padding: 2px 7px !important; }
.fu-item.fu-overdue { background: rgba(239,68,68,0.03); }
.fu-item.fu-today { background: rgba(245,158,11,0.03); }

/* ── Notes ──────────────────────────────────────────────── */
.note-item {
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.note-meta { display: flex; align-items: center; margin-bottom: 6px; }
.note-text { font-size: 0.875rem; color: var(--text); line-height: 1.6; }

/* ── Activity Feed ──────────────────────────────────────── */
.activity-list {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    max-height: 420px;
    overflow-y: auto;
}
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 18px;
  position: relative;
  transition: background 0.15s;
}
.activity-item:hover { background: var(--border-light); }
.activity-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 30px; top: 38px;
  width: 2px; height: calc(100% - 20px);
  background: var(--border);
  border-radius: 2px;
}
.act-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary-light);
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 0 1px var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 0.65rem;
  flex-shrink: 0;
  margin-top: 3px;
  position: relative;
  z-index: 1;
}
.act-body { flex: 1; min-width: 0; }
.act-text { font-size: 0.8rem; line-height: 1.55; color: var(--text); }
.act-text a { color: var(--primary); text-decoration: none; font-weight: 600; }
.act-text a:hover { text-decoration: underline; }
.act-time { font-size: 0.7rem; color: var(--text-light); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.act-time::before { content: ''; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--border); }

/* ── Lead Info (lead-view.php) ──────────────────────────── */
.info-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.info-value { font-size: 0.875rem; color: var(--text); }
.service-tag {
  display: inline-flex;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Service Chips ──────────────────────────────────────── */
.service-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.service-chip {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.service-chip:hover { border-color: var(--text); color: var(--text); background: var(--bg); }
.service-chip.selected { background: var(--text); color: var(--gold); border-color: var(--text); }

/* ── Form Sections ──────────────────────────────────────── */
.form-section { margin-bottom: 24px; }
.form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
}
.form-section-title i { color: var(--primary); }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.form-control, .form-select {
  border-color: var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text);
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(245,196,0,0.18);
}
.input-group-text { background: #f8fafc; border-color: var(--border); color: var(--text-muted); font-size: 0.875rem; }

/* ── Modals ─────────────────────────────────────────────── */
.modal-content { border: none; border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.modal-title { font-size: 1rem; font-weight: 700; }

/* ── Dropzone ───────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone-icon { font-size: 3rem; color: var(--text-light); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: 16px; opacity: 0.25; }

/* ── Toast ──────────────────────────────────────────────── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }
.crm-toast {
  min-width: 280px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: white;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  animation: slideIn 0.3s ease;
  font-size: 0.875rem;
}
.crm-toast.success { border-left: 4px solid var(--success); }
.crm-toast.error   { border-left: 4px solid var(--danger); }
.crm-toast.warning { border-left: 4px solid var(--warning); }
.crm-toast.info    { border-left: 4px solid var(--info); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Mobile Bottom Nav ──────────────────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 1000;
  align-items: center;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
.mob-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.mob-nav-item i { font-size: 1.15rem; }
.mob-nav-item.active, .mob-nav-item:hover { color: var(--text); }
.mob-nav-item.mob-nav-add { flex: 0 0 60px; }
.mob-add-btn {
  width: 46px; height: 46px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #0a0a0a;
  font-size: 1.2rem;
  margin-top: -18px;
  box-shadow: var(--shadow-md);
}

/* ── Mobile Lead Cards ──────────────────────────────────── */
.mobile-cards { display: none; }
.desktop-table { display: block; }
.lead-card-mobile {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.lead-card-mobile .lead-name { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.lead-meta span { display: flex; align-items: center; gap: 4px; }

/* ── Login Page ─────────────────────────────────────────── */
body.login-body {
  background: #0a1929;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.login-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}
.login-glow.g1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(17,85,155,0.5), transparent 70%);
  top: -150px; right: -100px;
}
.login-glow.g2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245,196,0,0.2), transparent 70%);
  bottom: -100px; left: -100px;
}
.login-wrapper { position: relative; z-index: 1; width: 100%; max-width: 420px; }
.login-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 6px; }
.login-logo {
  width: 42px; height: 42px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.login-title { font-size: 1.3rem; font-weight: 700; color: #fff; margin: 0; }
.login-subtitle { text-align: center; color: rgba(255,255,255,0.5); font-size: 0.875rem; margin-bottom: 30px; }
.login-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 18px;
}
.login-field { margin-bottom: 18px; }
.login-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.login-input-wrap { position: relative; }
.login-input-wrap i {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.35);
  font-size: 0.85rem;
  pointer-events: none;
}
.login-input-wrap input {
  width: 100%;
  padding: 12px 44px 12px 40px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}
.login-input-wrap input::placeholder { color: rgba(255,255,255,0.25); }
.login-input-wrap input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245,196,0,0.18); }
.toggle-pwd {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    z-index: 999;
    width: 30px;
    height: 30px;
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: #0a1929;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font);
  margin-top: 8px;
}
.login-btn:hover { background: var(--gold-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(245,196,0,0.4); }
.login-hint {
  margin-top: 24px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.4);
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.8;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ── Utilities ──────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-primary-light { background: var(--primary-light) !important; }

/* ── Button Overrides ───────────────────────────────────── */
.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.1px;
  box-shadow: none;
  color: #0a0a0a;
}
.btn-primary:hover, .btn-primary:focus {
  background: #f0bc00;
  border-color: #f0bc00;
  box-shadow: none;
  color: #0a0a0a;
}
.btn-primary:active {
  background: #e6b300;
  border-color: #e6b300;
  color: #0a0a0a;
}
.btn-outline-primary {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}
.btn-outline-primary:active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}
.btn { border-radius: 9px; font-size: 0.875rem; font-weight: 500; }
.btn-sm { border-radius: 7px; font-size: 0.8rem; }

/* ── Filters Panel ──────────────────────────────────────── */
.filters-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(10,25,41,0.07);
  margin-bottom: 24px;
}
.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: background 0.2s ease;
  user-select: none;
}
.filters-panel.open .filters-header { border-bottom-color: var(--border); }
.filters-header:hover { background: var(--border-light); }
.filters-header-left { display: flex; align-items: center; gap: 10px; }
.filter-icon-box {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--text);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-size: 0.82rem;
  flex-shrink: 0;
  box-shadow: none;
}
.filters-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.filter-count-badge {
  background: var(--text);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  box-shadow: none;
}
.filters-header-right { display: flex; align-items: center; gap: 12px; }
.filter-clear-link {
  font-size: 0.8rem;
  color: var(--danger);
  text-decoration: none;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1.5px solid rgba(239,68,68,0.25);
  display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.18s;
}
.filter-clear-link:hover { background: rgba(239,68,68,0.07); border-color: var(--danger); color: #dc2626; }
.filter-toggle-chevron {
  width: 28px; height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), background 0.2s, border-color 0.2s, color 0.2s;
  background: var(--bg);
}
.filters-panel.open .filter-toggle-chevron {
  transform: rotate(180deg);
  background: var(--blue-light);
  border-color: rgba(17,85,155,0.3);
  color: var(--blue);
}
.filters-body { display: none; padding: 20px; }
.filters-panel.open .filters-body { display: block; animation: filterSlideIn 0.22s ease; }
@keyframes filterSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.fg-wide { grid-column: span 2; }
.fg-date { grid-column: span 2; }
.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
  display: block;
}
.filter-grid .form-control,
.filter-grid .form-select {
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 0.85rem;
  height: 38px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: var(--bg);
}
.filter-grid .form-control:focus,
.filter-grid .form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(17,85,155,0.12);
  background-color: var(--card-bg);
}
.filter-grid .filter-search-wrap .form-control { background-color: var(--card-bg); }
.filter-grid .filter-search-wrap .form-control:focus { background-color: var(--card-bg); }
.filter-search-wrap { position: relative; }
.filter-search-wrap i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.8rem;
  pointer-events: none;
}
.filter-search-wrap .form-control { padding-left: 34px; }
.date-range-wrap { display: flex; align-items: center; gap: 8px; }
.date-range-wrap .form-control { flex: 1; }
.date-range-sep { color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; }
.filter-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.btn-filter-apply {
  background: var(--blue-grad);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(17,85,155,0.3);
  transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s;
}
.btn-filter-apply:hover { opacity: 0.9; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(17,85,155,0.35); }
.btn-filter-reset {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.18s;
}
.btn-filter-reset:hover { border-color: var(--text-muted); color: var(--text); background: var(--bg); }
.btn-filter-export {
  background: transparent;
  color: #16a34a;
  border: 1.5px solid rgba(22,163,74,0.3);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.18s;
  margin-left: auto;
}
.btn-filter-export:hover { background: rgba(22,163,74,0.07); border-color: #16a34a; color: #15803d; }

/* ── Page Header Enhancements ───────────────────────────── */
.page-title-wrap { display: flex; align-items: center; gap: 14px; }
.page-title-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--blue-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(17,85,155,0.28);
}
.leads-count-chip {
  display: inline-flex;
  align-items: center;
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 1px 8px;
  border-radius: 6px;
  margin-right: 3px;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    height: 100%;
    top: 0;
    transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
    z-index: 1050;
    box-shadow: none;
  }
  .sidebar.show {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
  }
  .sidebar-overlay.show { display: block; }
  .sidebar-toggle { display: flex !important; }

  .content-area { width: 100%; max-width: 100vw; overflow-x: hidden; margin-left: 0; }
  .main-content { padding: 16px; padding-bottom: 80px; max-width: 100%; overflow-x: hidden; }

  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
  .kpi-card { padding: 16px 14px; }
  .kpi-card::before { height: 4px; }
  .kpi-value { font-size: 1.5rem; letter-spacing: -0.8px; }
  .kpi-icon-wrap { width: 46px; height: 46px; }

  .desktop-table { display: none !important; }
  .mobile-cards  { display: block !important; }
  .mobile-bottom-nav { display: flex !important; }

  .page-header { flex-direction: column; align-items: flex-start; margin-bottom: 20px; }
  .page-header-right { width: 100%; justify-content: flex-end; }
  .dash-date-badge { display: none; }
  .page-title { font-size: 1.35rem; }

  .filter-row { flex-direction: column; }
  .filter-row > * { max-width: 100% !important; width: 100%; min-width: 0; }
  .filter-search-wrap { max-width: 100% !important; }

  .filter-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fg-wide { grid-column: span 2; }
  .fg-date { grid-column: span 2; }
  .filters-body { padding: 14px; }
  .filter-footer { gap: 8px; }
  .btn-filter-export { margin-left: 0; }

  .modal-dialog { margin: 0; max-width: 100%; }
  .modal-content { border-radius: 0; min-height: 100svh; }

  .form-grid { grid-template-columns: 1fr; }
  .fu-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .fu-ref-grid { grid-template-columns: 1fr 1fr; }
  .k-grid { grid-template-columns: 1fr 1fr 1fr; }
  .fu-kpi-strip { grid-template-columns: 1fr 1fr; }

  /* Prevent chart canvas overflow */
  canvas { max-width: 100% !important; }
  .row { --bs-gutter-x: 0.75rem; }
}

@media (max-width: 575.98px) {
  .filter-grid { grid-template-columns: 1fr; }
  .fg-wide, .fg-date { grid-column: span 1; }
  .date-range-wrap { flex-direction: column; gap: 6px; }
  .date-range-sep { display: none; }
  .filters-header { padding: 12px 14px; }
  .filter-toggle-chevron { display: none; }

  .main-content { padding: 12px; padding-bottom: 80px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-icon-wrap { width: 40px; height: 40px; font-size: 1rem; }
  .kpi-value { font-size: 1.25rem; }
  .kpi-label { font-size: 0.67rem; }
  .top-header { padding: 0 14px; }
  .fu-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fu-tab { padding: 12px 14px; font-size: 0.8rem; }
  .fu-cards-grid { grid-template-columns: 1fr; }
  .fu-ref-grid { grid-template-columns: 1fr; }
  .k-grid { grid-template-columns: 1fr 1fr; }
  .fu-kpi-strip { grid-template-columns: 1fr 1fr; }
  canvas { max-width: 100% !important; height: auto !important; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
}

/* ─────────────────────────────────────────────────────────────
   NEW FEATURES: Lead Score, Attachments, Invoice, Dashboard
   ───────────────────────────────────────────────────────────── */

/* ── Lead Score Badge ────────────────────────────────────── */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.score-badge.score-high {
  background: rgba(34,197,94,0.12);
  color: #15803d;
  border: 1px solid rgba(34,197,94,0.3);
}
.score-badge.score-medium {
  background: rgba(245,158,11,0.12);
  color: #92400e;
  border: 1px solid rgba(245,158,11,0.3);
}
.score-badge.score-low {
  background: rgba(17,85,155,0.10);
  color: #11559b;
  border: 1px solid rgba(17,85,155,0.25);
}

/* ── Attachment Items ─────────────────────────────────────── */
.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}
.attachment-item:last-child { border-bottom: none; }
.attachment-item:hover { background: var(--border-light); }

.att-icon {
  width: 36px; height: 36px;
  background: var(--bg);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.att-info { flex: 1; min-width: 0; }
.att-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-meta { font-size: 0.73rem; color: var(--text-muted); margin-top: 1px; }
.att-actions { display: flex; align-items: center; flex-shrink: 0; }

/* ── Dashboard Filter Bar ─────────────────────────────────── */
.dash-filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: var(--shadow);
}

/* ── Invoice Status Badges ────────────────────────────────── */
.inv-status-draft     { background: #f1f5f9; color: #475569; }
.inv-status-sent      { background: #e0f2fe; color: #0369a1; }
.inv-status-paid      { background: #dcfce7; color: #15803d; }
.inv-status-overdue   { background: #fee2e2; color: #dc2626; }
.inv-status-cancelled { background: #f3f4f6; color: #374151; }

/* ── KPI Danger variant is handled by ::before/::after above ── */

/* ── Dashboard Custom Date Range Row ──────────────────────── */
.dash-custom-range {
  display: flex;
  gap: 6px;
  align-items: center;
}
.dash-date-input {
  width: 145px;
  min-width: 0;
}

/* ── Responsive for filter bar ────────────────────────────── */
@media (max-width: 575.98px) {
  .dash-filter-bar { overflow-x: hidden; }
  .dash-custom-range { flex-wrap: wrap; }
  .dash-date-input { width: calc(50% - 6px); flex: 1 1 auto; }
  .dash-custom-range > span { display: none; }
  .dash-custom-range .btn { flex: 0 0 auto; }
}

/* ══════════════════════════════════════════════════════════
   LEADS PAGE — Reference Design
   ══════════════════════════════════════════════════════════ */

/* ── Leads KPI Strip ──────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.kpis .kpi {
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative; overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
}
.kpis .kpi:hover { border-color: var(--text-light); box-shadow: var(--shadow-md); }
.kpis .kpi-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.kpis .kpi-row   { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kpis .kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; color: var(--text); }
.kpis .kpi-delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10.5px; padding: 2px 7px; border-radius: 99px;
  background: var(--success-light); color: #047857; font-weight: 600; white-space: nowrap;
}
.kpis .kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }
.kpis .kpi.kpi-accent { background: var(--text); border-color: var(--text); }
.kpis .kpi.kpi-accent .kpi-label { color: #a8a49b; }
.kpis .kpi.kpi-accent .kpi-value { color: var(--gold); }
.kpis .kpi.kpi-accent .kpi-sub   { color: #a8a49b; }
.kpis .kpi.kpi-accent .kpi-delta { background: rgba(245,196,0,.18); color: var(--gold); }
.kpis .kpi.kpi-accent::after {
  content: ''; position: absolute; right: -30px; bottom: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(245,196,0,.18), transparent);
}
.kpis .kpi.kpi-gold { background: var(--gold); border-color: var(--gold); }
.kpis .kpi.kpi-gold .kpi-label { color: rgba(10,10,10,.65); }
.kpis .kpi.kpi-gold .kpi-value { color: #0a0a0a; }
.kpis .kpi.kpi-gold .kpi-sub   { color: rgba(10,10,10,.6); }
.kpis .kpi.kpi-gold .kpi-delta { background: rgba(0,0,0,.12); color: #0a0a0a; }
.kpis .kpi.kpi-gold::after {
  content: ''; position: absolute; right: -30px; bottom: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.25), transparent);
}
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 768px)  { .kpis { grid-template-columns: repeat(2,1fr); } }

/* ── View Tabs ────────────────────────────────────────────── */
.view-tabs {
  display: flex; align-items: center; gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.vt {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 12px; background: transparent; border: none;
  text-decoration: none; font-size: 13px; color: var(--text-muted);
  font-weight: 500; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; cursor: pointer;
  transition: color .15s;
}
.vt:hover { color: var(--text); }
.vt.is-on { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.vt-count {
  font-size: 11px; padding: 1px 6px; border-radius: 99px;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border);
}
.vt.is-on .vt-count { background: var(--text); color: var(--gold); border-color: var(--text); }
.vt-spacer { flex: 1; }

/* ── Filter Bar (chip style) ──────────────────────────────── */
.filter-bar-ref {
  display: flex; flex-direction: column; gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}
.fb-inner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px;
}
.search-inp {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; min-width: 220px; max-width: 320px; flex: 1;
  color: var(--text-muted); transition: border-color .15s;
}
.search-inp:focus-within { border-color: var(--text); background: var(--card-bg); }
.search-inp svg { flex-shrink: 0; color: var(--text-muted); }
.search-inp input {
  border: none; background: transparent; font-size: 13px; flex: 1;
  padding: 2px 0; color: var(--text); outline: none;
}
.search-inp input::placeholder { color: var(--text-muted); }
.chips-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Chip-styled select overlay */
.chip-sel {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text-muted);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: var(--transition);
}
.chip-sel:hover { background: var(--bg); color: var(--text); border-color: var(--text-light); }
.chip-sel.is-on { background: var(--text); border-color: var(--text); color: #fff; }
.chip-sel.is-on .cs-label { color: var(--gold); opacity: 1; }
.chip-sel.is-on .cs-sep   { color: rgba(255,255,255,.3); }
.cs-label { opacity: .65; }
.cs-sep   { color: var(--text-light); font-size: 11px; }
.cs-val   { font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.chip-sel select {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%; font-size: 13px;
}
/* Plain chip button */
.chip-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; background: transparent;
  border: 1px dashed var(--border); border-radius: 7px;
  color: var(--text-muted); font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: var(--transition);
}
.chip-btn:hover { background: var(--bg); color: var(--text); border-color: var(--text-light); border-style: solid; }
.chip-btn.has-val { border-style: solid; background: var(--bg); color: var(--text); }
.filter-right { display: flex; gap: 6px; align-items: center; margin-left: auto; }
/* Advanced filters panel */
.adv-filters {
  display: none; border-top: 1px solid var(--border);
  padding: 14px; background: var(--bg);
}
.adv-filters.open { display: block; }
.adv-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.adv-filter-item label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  display: block; margin-bottom: 5px;
}
.adv-filter-footer { display: flex; gap: 8px; align-items: center; }

/* ── Leads Table (reference style) ───────────────────────── */
table.leads {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 880px;
}
table.leads thead th {
  text-align: left; font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); padding: 11px 14px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none;
}
table.leads thead th.num { text-align: right; }
table.leads tbody td {
  padding: 13px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.leads tbody tr:last-child td { border-bottom: none; }
table.leads tbody tr:hover td { background: #fafaf9; }
table.leads .th-sel, table.leads .td-sel { width: 36px; padding-right: 0; padding-left: 14px; }
table.leads .th-act, table.leads .td-act {
  width: 100px; text-align: right;
  position: sticky; right: 0; z-index: 2;
  background: var(--card-bg);
}
table.leads thead .th-act { background: var(--bg); z-index: 3; }
table.leads tbody tr:hover .td-act { background: #fafaf9; }
table.leads .td-num { width: 42px; color: var(--text-muted); font-size: 12px; }
table.leads .td-val { text-align: right; white-space: nowrap; font-weight: 600; }

/* Checkbox */
.l-cb { display: inline-flex; cursor: pointer; }
.l-cb input { position: absolute; opacity: 0; pointer-events: none; }
.l-cb-box {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--border); background: var(--card-bg);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; transition: all .12s;
}
.l-cb:hover .l-cb-box { border-color: var(--text); }
.l-cb input:checked + .l-cb-box { background: var(--text); border-color: var(--text); color: var(--gold); }

/* Lead name */
.l-name {
  background: none; border: none; padding: 0; display: block;
  font-weight: 600; color: var(--text); font-size: 13.5px;
  text-align: left; cursor: pointer; text-decoration: none;
}
.l-name:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--gold); color: var(--text); }
.l-sub { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
.l-sub .l-link { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }

/* Stage */
.l-stage { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.l-stage .stage-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.l-stage-label { font-size: 12.5px; color: var(--text); font-weight: 500; }

/* Source pill */
.src-tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 11.5px; color: var(--text); font-weight: 500;
}
.src-tag.src-whatsapp { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.src-tag.src-presales { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.src-tag.src-smm      { background: #f3e8ff; color: #7c3aed; border-color: #e9d5ff; }
.src-tag.src-web      { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.src-tag.src-referral { background: #ccfbf1; color: #0f766e; border-color: #99f6e4; }
.src-tag.src-call     { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.src-tag.src-calendly { background: #ffe4e6; color: #be123c; border-color: #fecdd3; }
.src-tag.src-chat     { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.src-tag.src-ppc      { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.src-tag.src-existing { background: #f5f5f4; color: #57534e; border-color: #d6d3d1; }

/* Assignee */
.l-assignee { display: inline-flex; align-items: center; gap: 7px; }
.l-assignee span { font-size: 13px; color: var(--text); }
.av-dk {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); color: #f0eee8;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0; flex-shrink: 0;
}

/* Follow-up cell */
table.leads .fu-cell { display: flex; flex-direction: column; gap: 2px; font-size: inherit; color: inherit; }
.l-fu-date { font-size: 12.5px; font-weight: 500; color: var(--text); }
.l-fu-tag {
  display: inline-block; align-self: flex-start;
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg); color: var(--text-muted); font-weight: 500;
  border: 1px solid var(--border);
}
.l-fu-tag.overdue { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.l-fu-tag.today   { background: var(--gold); color: #0a0a0a; font-weight: 700; border-color: var(--gold); }
.l-fu-tag.soon    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* Icon buttons for table actions */
.tbl-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-muted); cursor: pointer; text-decoration: none;
  transition: var(--transition);
}
.tbl-icon-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.tbl-icon-btn.del:hover { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ── Reference Pagination ─────────────────────────────────── */
.page-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-top: 1px solid var(--border);
}
.foot-text { font-size: 12.5px; color: var(--text-muted); }
.pager { display: flex; align-items: center; gap: 4px; }
.pg {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-muted); font-size: 12.5px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; transition: var(--transition); cursor: pointer;
}
.pg:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.pg.is-on { background: var(--text); color: var(--gold); border-color: var(--text); }
.pg-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; text-decoration: none;
  transition: var(--transition);
}
.pg-icon:hover { background: var(--bg); color: var(--text); }
.pg-icon:disabled, .pg-icon[disabled] { opacity: .3; cursor: not-allowed; pointer-events: none; }

/* ── .dim / .mono helpers for leads table ─────────────────── */
.l-dim { color: var(--text-muted); }
.l-mono { font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* ── btn-ghost for leads page actions ─────────────────────── */
.btn-ghost-sm {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border); background: var(--card-bg);
  color: var(--text-muted); text-decoration: none; cursor: pointer;
  transition: var(--transition);
}
.btn-ghost-sm:hover { background: var(--bg); color: var(--text); }

/* ── Source / Assignee helpers ──────────────────────────── */
.source-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.assignee { display: inline-flex; align-items: center; gap: 7px; }
.assignee span { font-size: 13px; }

/* ── Lead Detail Page ───────────────────────────────────── */

/* Header */
.ld-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.ld-head-l { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.ld-back {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 12.5px; font-weight: 550;
  color: var(--text);
  margin-top: 6px;
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s;
}
.ld-back:hover { background: var(--bg); color: var(--text); }
.ld-title-block { min-width: 0; }
.ld-name {
  margin: 0 0 8px;
  font-size: 32px; line-height: 1.05;
  letter-spacing: -0.025em; font-weight: 600;
  color: var(--text);
}
.ld-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ld-id { font-size: 12px; color: var(--text-light); font-family: var(--font-mono); }
.ld-page-actions { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; flex-wrap: wrap; }

/* 2-column layout */
.ld-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}
.ld-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ld-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1180px) {
  .ld-grid { grid-template-columns: 1fr; }
  .ld-side { order: -1; }
}

/* Cards */
.ld-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ld-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
}
.ld-card-title-row { display: flex; align-items: center; gap: 10px; }
.ld-card-ico {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--bg);
  display: grid; place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ld-card-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ld-card-body { padding: 18px; }

/* Lead info field grid */
.ld-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 22px;
  padding: 20px;
}
@media (max-width: 900px) { .ld-info-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .ld-info-grid { grid-template-columns: 1fr; } }
.ld-field { min-width: 0; }
.ld-field-k {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-light);
  margin-bottom: 5px;
}
.ld-field-ico { color: var(--text-light); font-size: 11px; }
.ld-field-v { font-size: 13.5px; color: var(--text); word-break: break-word; }
.ld-field-v a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); }

/* Pipeline */
.ld-pipeline {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 4px;
}
@media (max-width: 1100px) { .ld-pipeline { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 700px)  { .ld-pipeline { grid-template-columns: repeat(4, 1fr); } }
.ld-pipeline li {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 3px 8px;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  min-width: 0;
  list-style: none;
}
.ld-pipeline .pip-mark {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border-light);
  color: var(--text-light);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  flex-shrink: 0;
}
.ld-pipeline .pip-lbl {
  font-size: 10px; color: var(--text-muted);
  text-align: center; line-height: 1.2;
  letter-spacing: -0.01em; word-break: break-all;
}
.ld-pipeline .pip-done { background: var(--text); border-color: var(--text); }
.ld-pipeline .pip-done .pip-mark { background: var(--gold); color: var(--text); }
.ld-pipeline .pip-done .pip-lbl { color: #f0eee8; }
.ld-pipeline .pip-active {
  background: rgba(245,196,0,.15);
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245,196,0,.2);
}
.ld-pipeline .pip-active .pip-mark { background: var(--text); color: var(--gold); }
.ld-pipeline .pip-active .pip-lbl { color: var(--text); font-weight: 600; }
.ld-pipeline-note {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 10px 12px;
  border-radius: 8px;
  background: #fef7f7; border: 1px solid #fecaca;
  color: #7f1d1d; font-size: 12.5px;
}
.ld-pipeline-note i { color: #b91c1c; flex-shrink: 0; }

/* Deal */
.ld-deal {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px; align-items: start;
}
@media (max-width: 700px) { .ld-deal { grid-template-columns: 1fr; } }
.ld-deal-main { padding: 4px 0; }
.ld-deal-label {
  font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-light); margin-bottom: 8px;
}
.ld-deal-value {
  font-size: 40px; font-weight: 600;
  letter-spacing: -0.025em; line-height: 1;
  color: #047857;
}
.ld-deal-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.ld-deal-side { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ld-deal-stat {
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.ld-deal-stat:first-child { grid-column: 1 / -1; background: var(--text); color: #f0eee8; border-color: var(--text); }
.ld-deal-stat:first-child .ld-deal-k { color: #a8a49b; }
.ld-deal-stat:first-child .ld-deal-v { color: var(--gold); }
.ld-deal-k {
  font-family: var(--font-mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-light); margin-bottom: 3px;
}
.ld-deal-v { font-size: 14px; font-weight: 600; }

/* Notes composer */
.ld-note-composer {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg);
  margin-bottom: 14px;
}
.ld-note-composer textarea {
  width: 100%; border: none; background: transparent;
  resize: vertical; font-size: 13.5px;
  color: var(--text); padding: 6px 8px;
  font-family: inherit;
}
.ld-note-composer textarea:focus { outline: none; }
.ld-note-composer textarea::placeholder { color: var(--text-light); }
.ld-note-actions {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 6px 4px 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
/* Note items */
.ld-note-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--card-bg);
  margin-top: 10px;
}
.ld-note-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px; font-size: 12px;
}
.ld-note-text { font-size: 13px; color: var(--text); line-height: 1.5; }

/* Empty state */
.ld-empty {
  text-align: center; padding: 28px 12px 12px;
  color: var(--text-muted);
}
.ld-empty-mark {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  margin: 0 auto 10px; font-size: 18px;
}
.ld-empty-title { font-size: 14px; font-weight: 600; color: var(--text); }
.ld-empty-sub { font-size: 12.5px; max-width: 380px; margin: 4px auto 0; line-height: 1.5; }

/* Drop zone */
.ld-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .12s;
}
.ld-dropzone:hover { border-color: var(--primary); }
.ld-dz-mark {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--card-bg); border: 1px solid var(--border);
  margin: 0 auto 10px;
  display: grid; place-items: center;
  color: var(--text-muted); font-size: 20px;
}
.ld-dz-title { font-size: 13.5px; color: var(--text); font-weight: 550; }
.ld-dz-sub { font-size: 12px; margin-top: 4px; }

/* Attachment items */
.ld-att-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.ld-att-item:last-child { border-bottom: none; }
.ld-att-ico {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  display: grid; place-items: center;
  flex-shrink: 0; font-size: 16px;
}
.ld-att-info { flex: 1; min-width: 0; }
.ld-att-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ld-att-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.ld-att-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }

/* Side panel */
.ld-side-card { font-size: 13px; }
.ld-side-card .ld-card-body { padding: 14px; }

/* Follow-up items in side panel */
.ld-fu {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  background: var(--card-bg);
  position: relative;
  overflow: hidden;
}
.ld-fu + .ld-fu { margin-top: 10px; }
.ld-fu.fu-overdue { border-color: #fecaca; background: #fff8f8; }
.ld-fu.fu-overdue::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: #ef4444;
}
.ld-fu.fu-today { border-color: var(--gold); }
.ld-fu.fu-today::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--gold);
}
.ld-fu-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ld-fu-type {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13px; color: var(--text);
}
.ld-fu-type-ico {
  width: 22px; height: 22px; border-radius: 6px;
  background: #fef2f2; color: #b91c1c;
  display: grid; place-items: center; flex-shrink: 0;
}
.ld-fu-when {
    font-size: 11.5px;
    color: #000000;
    font-family: 'Inter';
    font-weight: 400;
    background: #f5c40036;
    border-radius: 100px;
    padding: 2px 10px;
    border: 1px dashed #f5c400;
}
.ld-fu-mid { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.ld-fu-foot {
  display: flex; gap: 4px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border-light);
  align-items: center; flex-wrap: wrap;
}

/* Follow-up tags */
.fu-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 7px; border-radius: 4px;
  background: var(--bg); color: var(--text-muted);
}
.fu-tag.fu-pending { background: var(--gold-light); color: var(--text); font-weight: 700; border: 1px solid var(--gold); }
.fu-tag.fu-overdue { background: #fef2f2; color: #b91c1c; }
.fu-tag.fu-today   { background: var(--gold); color: var(--text); font-weight: 700; }
.fu-tag.fu-missed  { background: var(--danger-light); color: var(--danger); }
.fu-tag.fu-done    { background: var(--success-light); color: #047857; }
.fu-tag.fu-upcoming { background: #eff6ff; color: #1d4ed8; }

/* Side link */
.ld-side-link {
  display: flex; align-items: center; gap: 4px;
  margin-top: 12px;
  font-size: 12.5px; color: var(--text-muted);
  font-weight: 500; text-decoration: none;
}
.ld-side-link:hover { color: var(--text); }

/* Icon button for lead detail actions */
.ld-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.ld-icon-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.ld-icon-btn.ok:hover { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.ld-icon-btn.danger:hover { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* Google Calendar state */
.ld-gc-state {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  background: #ecfdf5;
  border-radius: 8px;
  border: 1px solid #a7f3d0;
}
.ld-gc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16,185,129,.18);
  margin-top: 4px; flex-shrink: 0;
}
.ld-gc-title { font-size: 12.5px; font-weight: 600; color: #064e3b; }
.ld-gc-sub { font-size: 11.5px; color: #065f46; margin-top: 2px; }

/* Activity timeline */
.ld-timeline {
  list-style: none; padding: 0; margin: 0;
  position: relative;
}
.ld-timeline::before {
  content: ''; position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 1px; background: var(--border);
}
.ld-timeline li {
  display: flex; gap: 12px;
  padding: 6px 0 12px; position: relative;
}
.ld-timeline li:last-child { padding-bottom: 0; }
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--gold); flex-shrink: 0;
  margin-top: 4px; z-index: 1;
  box-shadow: 0 0 0 3px var(--card-bg);
  border: 1.5px solid var(--card-bg);
}
.tl-dot-amber { background: var(--gold); }
.tl-dot-blue  { background: #3b82f6; }
.tl-dot-green { background: #10b981; }
.tl-dot-red   { background: #ef4444; }
.tl-content { flex: 1; min-width: 0; }
.tl-title { font-size: 12.5px; color: var(--text-muted); }
.tl-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.tl-time { font-size: 11px; color: var(--text-light); margin-top: 3px; font-family: var(--font-mono); }

/* inp / inp-area */
.inp {
  border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px; background: var(--card-bg);
  color: var(--text); width: 100%;
  transition: border-color .12s, box-shadow .12s;
  font-family: inherit;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); outline: none; }
.inp::placeholder { color: var(--text-light); }
.inp-area { resize: vertical; }
