
:root {
  --bg: #F3F5FA;
  --bg-grid: #EAEDF6;
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-strong: rgba(255, 255, 255, 0.88);
  --border: #E4E7F0;
  --border-soft: #ECEEF5;

  --ink-900: #12131C;
  --ink-700: #383B4A;
  --ink-500: #6B7080;
  --ink-400: #9498A6;

  --accent: #4F46E5;
  --accent-soft: #EEF0FE;
  --accent-2: #0FA6A0;
  --accent-2-soft: #E6F8F6;

  --success: #059669;
  --success-soft: #E4F5EE;
  --warning: #D97706;
  --warning-soft: #FCF0DE;
  --danger: #E11D48;
  --danger-soft: #FCE7ED;
  --info: #2563EB;
  --info-soft: #E7EEFD;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  --shadow-sm: 0 1px 2px rgba(18, 19, 28, 0.04), 0 1px 1px rgba(18,19,28,0.03);
  --shadow-md: 0 6px 20px -6px rgba(28, 30, 58, 0.10), 0 2px 6px -2px rgba(28,30,58,0.06);
  --shadow-lg: 0 20px 45px -18px rgba(28, 30, 58, 0.22);
  --shadow-glow: 0 0 0 1px rgba(79,70,229,0.08), 0 16px 40px -12px rgba(79,70,229,0.28);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 76px;
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(79,70,229,0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(15,166,160,0.06), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
  line-height: 1.5;
}

::selection { background: var(--accent); color: #fff; }

button { font-family: inherit; cursor: pointer; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
input { font-family: inherit; }
input:focus-visible, button:focus-visible, .pill:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D6D9E4; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #C3C7D6; }
::-webkit-scrollbar-track { background: transparent; }

/* PAGE LOAD */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -320px 0; }
  100% { background-position: 320px 0; }
}
@keyframes ring-pop {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(15,166,160,0.18); }
  50% { box-shadow: 0 0 0 6px rgba(15,166,160,0.05); }
}
@keyframes dash-flow {
  to { stroke-dashoffset: -24; }
}
@keyframes rotate-spin { to { transform: rotate(360deg); } }


.topbar { animation: fade-up .55s var(--ease-spring) .05s both; }
.kpi-card { animation: fade-up .55s var(--ease-spring) both; }
.kpi-grid .kpi-card:nth-child(1) { animation-delay: .08s; }
.kpi-grid .kpi-card:nth-child(2) { animation-delay: .14s; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: .2s; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: .26s; }
.analytics-grid { animation: fade-up .6s var(--ease-spring) .3s both; }
.table-card { animation: fade-up .6s var(--ease-spring) .34s both; }

.leads-table tbody tr[data-index] {
  animation: fade-in .4s var(--ease) both;
}


.app-shell {
  display: flex;
  min-height: 100vh;
  padding: 14px;
  gap: 14px;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  height: calc(100vh - 28px);
  position: sticky;
  top: 14px;
  transition: width .28s var(--ease), padding .28s var(--ease);
  z-index: 40;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.brand { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.brand-mark {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), #7C74F0);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(79,70,229,0.5);
  transition: transform .3s var(--ease-spring);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.brand-text { display: flex; flex-direction: column; white-space: nowrap; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--ink-500); }

.sidebar-toggle {
  width: 30px; height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-500);
  display: flex; align-items: center; justify-content: center;
  transition: all .18s var(--ease);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.sidebar-toggle:active { transform: scale(.92); }

.nav { flex: 1; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.nav-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-400); padding: 6px 10px 8px; white-space: nowrap;
}
.nav-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 18px; }

.nav-item a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  color: var(--ink-700);
  font-weight: 500;
  font-size: 13.8px;
  position: relative;
  transition: background .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
  white-space: nowrap;
}
.nav-icon { display: flex; flex-shrink: 0; transition: transform .2s var(--ease-spring); }
.nav-item a:hover { background: #F3F4FA; color: var(--ink-900); }
.nav-item a:hover .nav-icon { transform: translateX(1px) scale(1.06); }
.nav-item.active a {
  background: linear-gradient(135deg, var(--accent), #6a61ea);
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(79,70,229,0.45);
}
.nav-item { position: relative; display: flex; align-items: center; }
.nav-badge {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  background: var(--danger-soft); color: var(--danger);
  font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); color: #fff; }

.ai-card {
  margin: 4px 4px 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--accent-2-soft), #F6FBFA);
  border: 1px solid #D6EFEC;
  position: relative;
  overflow: hidden;
}
.ai-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: ai-sheen 5s ease-in-out infinite;
}
@keyframes ai-sheen {
  0%, 60% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.ai-card-head {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--accent-2);
  margin-bottom: 8px;
}
.ai-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(15,166,160,0.18);
  animation: soft-pulse 2s infinite;
}
.ai-card p { margin: 0 0 10px; font-size: 12.3px; color: var(--ink-700); line-height: 1.45; position: relative; }
.ai-card-btn {
  width: 100%; border: none; background: var(--ink-900); color: #fff;
  font-size: 12px; font-weight: 600; padding: 8px; border-radius: 8px;
  transition: transform .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
  position: relative;
}
.ai-card-btn:hover { background: var(--accent); transform: translateY(-1px); box-shadow: 0 8px 16px -6px rgba(79,70,229,.5); }
.ai-card-btn:active { transform: translateY(0) scale(.98); }

.sidebar-bottom { border-top: 1px solid var(--border-soft); padding-top: 12px; }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); transition: background .15s; cursor: pointer; }
.user-mini:hover { background: #F3F4FA; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(145deg, #FFB199, #E11D48);
  color: #fff; font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-mini-text { display: flex; flex-direction: column; overflow: hidden; white-space: nowrap; }
.user-mini-name { font-size: 13px; font-weight: 600; }
.user-mini-role { font-size: 11.3px; color: var(--ink-500); }

/* Collapsed state */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); padding: 20px 12px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .ai-card,
.sidebar.collapsed .user-mini-text { display: none; }
.sidebar.collapsed .sidebar-top { justify-content: center; }
.sidebar.collapsed .brand { justify-content: center; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }
.sidebar.collapsed .nav-item a { justify-content: center; }
.sidebar.collapsed .user-mini { justify-content: center; }

.scrim { display: none; }

/*  MAIN / TOPBAR */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  position: sticky;
  top: 14px;
  z-index: 30;
}

.menu-btn {
  display: none;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-700);
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: all .15s var(--ease);
}
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-btn:active { transform: scale(.92); }

.topbar-title { flex-shrink: 0; }
.topbar-title h1 { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.topbar-title p { margin: 1px 0 0; font-size: 12.3px; color: var(--ink-500); }

.search-wrap {
  flex: 1;
  max-width: 420px;
  display: flex; align-items: center; gap: 9px;
  background: #F3F4FA;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 12px;
  color: var(--ink-400);
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
  margin-left: auto;
}
.search-wrap:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-wrap input {
  border: none; outline: none; background: transparent; flex: 1;
  font-size: 13.3px; color: var(--ink-900);
}
.search-wrap input::placeholder { color: var(--ink-400); }
.search-clear {
  border: none; background: #E4E7F0; color: var(--ink-500);
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease);
  animation: scale-in .18s var(--ease-spring) both;
}
.search-clear:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }
.kbd {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-400);
  border: 1px solid var(--border); background: var(--surface);
  padding: 1px 6px; border-radius: 5px; flex-shrink: 0;
}

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-700);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: translateY(0) scale(.94); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
  animation: soft-pulse 2.2s infinite;
}
.divider-v { width: 1px; height: 26px; background: var(--border); }

.profile-chip {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 12px; padding: 5px 10px 5px 5px;
  transition: all .15s var(--ease);
}
.profile-chip:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.profile-chip:active { transform: translateY(0) scale(.98); }
.profile-chip .avatar { width: 30px; height: 30px; font-size: 11px; }
.profile-text { display: flex; flex-direction: column; align-items: flex-start; }
.profile-name { font-size: 12.8px; font-weight: 600; line-height: 1.2; }
.profile-role { font-size: 11px; color: var(--ink-500); }
.profile-chip svg { color: var(--ink-400); margin-left: 2px; transition: transform .2s var(--ease); }
.profile-chip:hover svg { transform: translateY(1px); }

/* CONTENT */
.content { flex: 1; display: flex; flex-direction: column; gap: 18px; padding-bottom: 20px; }


.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.kpi-card {
  background: var(--surface-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
  transition: transform .28s var(--ease-spring), box-shadow .28s var(--ease-spring), border-color .28s var(--ease);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(79,70,229,0.05), transparent 55%);
  opacity: 0;
  transition: opacity .3s var(--ease);
  pointer-events: none;
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(79,70,229,0.16); }
.kpi-card:hover::before { opacity: 1; }

.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s var(--ease-spring);
}
.kpi-card:hover .kpi-icon { transform: scale(1.08) rotate(-4deg); }
.kpi-icon-indigo { background: var(--accent-soft); color: var(--accent); }
.kpi-icon-rose { background: var(--danger-soft); color: var(--danger); }
.kpi-icon-emerald { background: var(--success-soft); color: var(--success); }
.kpi-icon-amber { background: var(--warning-soft); color: var(--warning); }

.kpi-menu { background: none; border: none; color: var(--ink-400); font-size: 16px; line-height: 1; padding: 4px; border-radius: 6px; transition: all .15s var(--ease); }
.kpi-menu:hover { background: #F3F4FA; color: var(--ink-700); }

.kpi-label { font-size: 12.8px; color: var(--ink-500); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-900); }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 7px 2px 6px; border-radius: 20px; }
.trend-up { color: var(--success); background: var(--success-soft); }
.trend-down { color: var(--danger); background: var(--danger-soft); }
.kpi-sub { font-size: 11.6px; color: var(--ink-400); }

/* Signature: Hot Leads live pulse card */
.kpi-live {
  border-color: rgba(225, 29, 72, 0.18);
  background: linear-gradient(165deg, rgba(255,255,255,0.9), rgba(252, 231, 237, 0.5));
}
.live-pulse { position: relative; width: 10px; height: 10px; }
.live-pulse span {
  position: absolute; inset: 0; border-radius: 50%; background: var(--danger);
}
.live-pulse::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--danger); opacity: 0.5;
  animation: ring-pop 1.8s infinite var(--ease);
}

/* KPI skeleton loading state */
.kpi-card.is-loading .kpi-value,
.kpi-card.is-loading .kpi-sub,
.kpi-card.is-loading .trend { visibility: hidden; position: relative; }
.kpi-card.is-loading .kpi-value::after,
.kpi-card.is-loading .kpi-sub::after {
  content: '';
  visibility: visible;
  position: absolute; left: 0; top: 0;
  width: 70%; height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #EDEFF6 25%, #F7F8FC 50%, #EDEFF6 75%);
  background-size: 320px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ANALYTICS SECTION */
.analytics-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 16px;
}

.analytics-card {
  background: var(--surface-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px 22px 20px;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.analytics-card:hover { box-shadow: var(--shadow-md); }

.analytics-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.analytics-card-head h2 { margin: 0; font-family: var(--font-display); font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.analytics-card-head p { margin: 2px 0 0; font-size: 12.2px; color: var(--ink-500); }
.analytics-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: var(--accent-2);
  background: var(--accent-2-soft); border: 1px solid #C9F0EC;
  padding: 4px 9px; border-radius: 20px; white-space: nowrap;
}

/* Donut chart + legend */
.source-chart-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-wrap { position: relative; width: 168px; height: 168px; flex-shrink: 0; }
.donut-wrap svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut-seg {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.1s var(--ease-spring);
}
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-center .d-total { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink-900); line-height: 1; }
.donut-center .d-label { font-size: 10.5px; color: var(--ink-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }

.source-legend { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 12px; }
.source-legend-item { display: flex; align-items: center; gap: 10px; }
.source-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.source-legend-name { font-size: 12.8px; font-weight: 600; color: var(--ink-700); width: 78px; flex-shrink: 0; }
.source-legend-bar-wrap { flex: 1; height: 7px; border-radius: 8px; background: #EEF0F5; overflow: hidden; }
.source-legend-bar {
  height: 100%; border-radius: 8px; width: 0%;
  transition: width 1s var(--ease-spring);
}
.source-legend-pct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-900); width: 56px; text-align: right; flex-shrink: 0; }

/* AI qualification pipeline card */
.pipeline-flow {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px;
}
.pipeline-step {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 1; min-width: 84px; text-align: center; position: relative;
}
.pipeline-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid #DCE0FC;
  position: relative; z-index: 2;
}
.pipeline-step.is-done .pipeline-icon { background: var(--success-soft); color: var(--success); border-color: #BFE6D3; }
.pipeline-step.is-active .pipeline-icon {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
  animation: soft-pulse-accent 1.8s infinite;
}
@keyframes soft-pulse-accent {
  0%, 100% { box-shadow: 0 0 0 5px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px rgba(79,70,229,0.06); }
}
.pipeline-step-label { font-size: 11.3px; font-weight: 700; color: var(--ink-700); }
.pipeline-step-sub { font-size: 10.3px; color: var(--ink-400); }
.pipeline-connector {
  position: absolute; top: 21px; left: calc(50% + 30px); right: calc(-50% + 30px);
  height: 2px; z-index: 1;
}
.pipeline-step:last-child .pipeline-connector { display: none; }
.pipeline-connector svg { width: 100%; height: 2px; display: block; overflow: visible; }
.pipeline-connector line {
  stroke: #D6DAE8; stroke-width: 2; stroke-dasharray: 4 5;
}
.pipeline-step.is-done .pipeline-connector line { stroke: var(--success); stroke-dasharray: none; }
.pipeline-step.is-active .pipeline-connector line { stroke: var(--accent); animation: dash-flow 1s linear infinite; }

.pipeline-status-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  background: #FAFBFD; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 14px;
}
.pipeline-status-left { display: flex; align-items: center; gap: 9px; }
.pipeline-n8n-mark {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: var(--ink-900); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: -0.02em;
}
.pipeline-status-text { display: flex; flex-direction: column; line-height: 1.3; }
.pipeline-status-title { font-size: 12.3px; font-weight: 700; color: var(--ink-900); }
.pipeline-status-sub { font-size: 11.3px; color: var(--ink-500); }
.pipeline-status-sub .live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); margin-right: 5px; animation: soft-pulse 2s infinite;
}
.pipeline-sync-btn {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-700); font-size: 11.8px; font-weight: 700;
  padding: 7px 12px; border-radius: 9px;
  transition: all .15s var(--ease);
}
.pipeline-sync-btn:hover { border-color: var(--accent); color: var(--accent); }
.pipeline-sync-btn:active svg { animation: rotate-spin .6s linear; }

@media (max-width: 1180px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .source-chart-row { flex-direction: column; align-items: flex-start; }
  .pipeline-step-sub { display: none; }
}

/* TABLE CARD */
.table-card {
  background: var(--surface-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px 16px;
  gap: 16px; flex-wrap: wrap;
}
.table-card-head h2 { margin: 0; font-family: var(--font-display); font-size: 16.5px; font-weight: 700; }
.table-card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-500); }

.table-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.select-wrap {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  background: #F3F4FA; border: 1px solid transparent;
  border-radius: 10px; padding: 7px 30px 7px 12px;
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}
.select-wrap:hover { border-color: var(--border); }
.select-wrap:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.select-wrap label {
  font-size: 11.5px; font-weight: 600; color: var(--ink-400); white-space: nowrap;
}
.select-wrap select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border: none; background: transparent; outline: none;
  font-size: 12.6px; font-weight: 600; color: var(--ink-900);
  padding-right: 4px; cursor: pointer;
}
.select-chevron {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-400); pointer-events: none;
  transition: transform .2s var(--ease);
}
.select-wrap:focus-within .select-chevron { transform: translateY(-50%) rotate(180deg); color: var(--accent); }

.filter-reset {
  display: flex; align-items: center; gap: 6px;
  border: 1px dashed var(--border); background: transparent;
  color: var(--ink-500); font-size: 12.3px; font-weight: 600;
  padding: 7px 12px; border-radius: 10px;
  transition: all .15s var(--ease);
  animation: scale-in .18s var(--ease-spring) both;
}
.filter-reset:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.filter-reset:active { transform: scale(.96); }

/* legacy pill styles (kept for compatibility) */
.filter-pills { display: flex; gap: 6px; background: #F3F4FA; padding: 4px; border-radius: 10px; }
.pill {
  border: none; background: transparent; color: var(--ink-500);
  font-size: 12.3px; font-weight: 600; padding: 6px 12px; border-radius: 7px;
  transition: all .15s var(--ease);
}
.pill:hover { color: var(--ink-900); }
.pill.active { background: var(--surface); color: var(--ink-900); box-shadow: var(--shadow-sm); }

.btn-primary {
  display: flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, var(--accent), #6a61ea);
  color: #fff; border: none; font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 10px;
  box-shadow: 0 8px 18px -6px rgba(79,70,229,0.5);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -6px rgba(79,70,229,0.6); }
.btn-primary:active { transform: translateY(0) scale(.98); }

.table-scroll { overflow-x: auto; }
.leads-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.leads-table thead th {
  text-align: left; font-size: 11.3px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ink-400);
  padding: 10px 14px; border-bottom: 1px solid var(--border-soft);
  background: #FAFBFD; position: sticky; top: 0;
}
.leads-table thead th:first-child { padding-left: 22px; }
.leads-table thead th:last-child { padding-right: 22px; }

.leads-table tbody td {
  padding: 13px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: 13.2px; color: var(--ink-700); white-space: nowrap;
}
.leads-table tbody td:first-child { padding-left: 22px; }
.leads-table tbody td:last-child { padding-right: 22px; }
.leads-table tbody tr { transition: background .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease); position: relative; cursor: pointer; }
.leads-table tbody tr:hover { background: #F8F9FE; }
.leads-table tbody tr:hover .customer-avatar { transform: scale(1.06); }
.leads-table tbody tr:last-child td { border-bottom: none; }
.leads-table tbody tr.hidden-row { display: none; }

.leads-table tbody tr.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.leads-table tbody tr.selected:hover { background: var(--accent-soft); }
.leads-table tbody tr.selected td:first-child { color: var(--accent); }

.table-empty-row td {
  padding: 0 !important;
  border-bottom: none !important;
}

.lead-id { font-family: var(--font-mono); font-size: 12.3px; color: var(--ink-500); font-weight: 600; }

.customer-cell { display: flex; align-items: center; gap: 10px; }
.customer-avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: #fff;
  transition: transform .2s var(--ease-spring);
}
.customer-info { display: flex; flex-direction: column; line-height: 1.3; }
.customer-name { font-weight: 600; color: var(--ink-900); font-size: 13.2px; }
.customer-phone { font-size: 11.5px; color: var(--ink-400); }

.budget-cell { font-family: var(--font-mono); font-weight: 600; color: var(--ink-900); font-size: 12.8px; }

.source-cell { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-700); }
.source-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.6px; font-weight: 700;
  padding: 4px 10px 4px 8px; border-radius: 20px;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.badge-high { color: var(--danger); background: var(--danger-soft); border-color: rgba(225,29,72,0.14); }
.badge-medium { color: var(--warning); background: var(--warning-soft); border-color: rgba(217,119,6,0.14); }
.badge-low { color: var(--ink-500); background: #EEF0F5; border-color: rgba(107,112,128,0.12); }

.badge-new { color: var(--info); background: var(--info-soft); border-color: rgba(37,99,235,0.14); }
.badge-contacted { color: var(--warning); background: var(--warning-soft); border-color: rgba(217,119,6,0.14); }
.badge-qualified { color: var(--success); background: var(--success-soft); border-color: rgba(5,150,105,0.14); }
.badge-closed { color: #6D28D9; background: #F1E9FE; border-color: rgba(109,40,217,0.14); }

.row-action {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--ink-400);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease);
}
.row-action:hover { background: var(--surface); border-color: var(--border); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.row-action:active { transform: translateY(0) scale(.92); }

.table-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-top: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--ink-500); flex-wrap: wrap; gap: 10px;
}
.table-card-foot strong { color: var(--ink-900); }
.pagination { display: flex; gap: 5px; }
.pagination button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-700); font-size: 12.5px; font-weight: 600;
  transition: all .15s var(--ease);
}
.pagination button:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:active { transform: scale(.92); }

/*EMPTY STATES*/
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 56px 24px 62px;
  animation: fade-up .4s var(--ease-spring) both;
}
.empty-state-icon {
  width: 76px; height: 76px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--accent-soft), #F6F7FE);
  border: 1px solid #E1E4FA;
  color: var(--accent);
  margin-bottom: 18px;
  position: relative;
}
.empty-state-icon::after {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 26px;
  border: 1px dashed #D4D8F5;
  animation: ring-pop 2.6s ease-out infinite;
}
.empty-state.is-search .empty-state-icon { background: linear-gradient(150deg, var(--warning-soft), #FFFBF3); border-color: #F2DFB3; color: var(--warning); }
.empty-state.is-search .empty-state-icon::after { border-color: #F2DFB3; }

.empty-state h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--ink-900); }
.empty-state p { margin: 0 0 20px; font-size: 13px; color: var(--ink-500); max-width: 320px; line-height: 1.55; }
.empty-state-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.empty-state-btn-secondary {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-700);
  font-size: 12.6px; font-weight: 600; padding: 9px 15px; border-radius: 10px;
  transition: all .15s var(--ease);
}
.empty-state-btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* TABLE LOADING SKELETON */
.skeleton-row td { padding: 14px; border-bottom: 1px solid var(--border-soft); }
.skeleton-bar {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, #EDEFF6 25%, #F7F8FC 50%, #EDEFF6 75%);
  background-size: 320px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(90deg, #EDEFF6 25%, #F7F8FC 50%, #EDEFF6 75%);
  background-size: 320px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-cell-flex { display: flex; align-items: center; gap: 10px; }
.skeleton-cell-flex .skeleton-bar { width: 110px; }

/*  LEAD DETAILS DRAWER */
body.drawer-locked { overflow: hidden; }

.leads-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 16, 28, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .32s var(--ease);
  z-index: 70;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }

.lead-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 540px;
  max-width: 94vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 70px -24px rgba(18, 19, 28, 0.35);
  transform: translateX(100%);
  transition: transform .42s var(--ease-spring);
  z-index: 71;
  display: flex;
  flex-direction: column;
}
.lead-drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  background: linear-gradient(180deg, #FAFBFF, #FFFFFF);
}
.drawer-header-info { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.drawer-header-text { min-width: 0; }
.drawer-header-text h2 {
  margin: 0 0 2px; font-family: var(--font-display); font-size: 17px; font-weight: 700;
  letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer-header-text .lead-id { display: block; margin-bottom: 8px; }
.drawer-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.drawer-close {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-500);
  display: flex; align-items: center; justify-content: center;
  transition: all .16s var(--ease);
}
.drawer-close:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; transform: rotate(90deg); }
.drawer-close:active { transform: rotate(90deg) scale(.9); }

.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 24px 22px 40px;
  display: flex; flex-direction: column; gap: 28px;
}

.drawer-section {
  opacity: 0;
  animation: fade-up .45s var(--ease-spring) forwards;
}
.lead-drawer.open .drawer-section:nth-child(1) { animation-delay: .06s; }
.lead-drawer.open .drawer-section:nth-child(2) { animation-delay: .1s; }
.lead-drawer.open .drawer-section:nth-child(3) { animation-delay: .14s; }
.lead-drawer.open .drawer-section:nth-child(4) { animation-delay: .18s; }
.lead-drawer.open .drawer-section:nth-child(5) { animation-delay: .22s; }
.lead-drawer.open .drawer-section:nth-child(6) { animation-delay: .26s; }

.drawer-section h3 {
  margin: 0 0 14px;
  font-family: var(--font-display); font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-500);
  display: flex; align-items: center; gap: 8px;
}
.drawer-section h3::before { content: ''; width: 3px; height: 14px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }

.empty-note { margin: 0; font-size: 12.8px; color: var(--ink-400); font-style: italic; }


.ai-summary-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.12);
}

.ai-summary-box p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: #444;
}

/* Section 1: info grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-item {
  background: #FAFBFD; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.info-item:hover { border-color: #DCE0FC; background: #FAFAFF; }
.info-label { font-size: 10.6px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.info-value { font-size: 13.3px; font-weight: 600; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Section 2: inquiry quote */
.quote-box {
  margin: 0;
  background: var(--accent-soft);
  border: 1px solid #DCE0FC;
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.2px; line-height: 1.65; color: var(--ink-700); font-style: italic;
}

/* Section 3: transcript */
.transcript-box {
  background: #F8F9FC; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 15px 16px;
}
.transcript-line { display: flex; gap: 10px; margin-bottom: 12px; align-items: flex-start; }
.transcript-line:last-child { margin-bottom: 0; }
.speaker-tag {
  flex-shrink: 0; font-size: 10.3px; font-weight: 700; padding: 3px 8px;
  border-radius: 6px; margin-top: 1px; white-space: nowrap;
}
.speaker-tag.agent { background: var(--accent-soft); color: var(--accent); }
.speaker-tag.customer { background: var(--accent-2-soft); color: var(--accent-2); }
.transcript-text { font-size: 12.9px; color: var(--ink-700); line-height: 1.55; }

/* Section 4: images */
.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.image-tile {
  aspect-ratio: 1 / 1; border-radius: 12px;
  background: linear-gradient(150deg, #EEF0FE, #E4E7F9);
  border: 1px solid var(--border-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--accent); transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.image-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.image-tile span { font-size: 10px; color: var(--ink-500); font-weight: 600; text-align: center; padding: 0 6px; line-height: 1.3; }

/* Customer Uploaded Media */

#drawerImages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.uploaded-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.uploaded-image:hover {
  transform: scale(1.03);
}

#drawerImages p,
#drawerVideo p {
  font-size: 13px;
  opacity: 0.65;
  margin: 10px 0;
}


/* Uploaded Video */

#drawerVideo {
  margin-top: 12px;
  width: 100%;
}

.uploaded-video {
  width: 100%;
  max-height: 420px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #000;
  display: block;
  object-fit: contain;
}


/* Section 5: AI analysis */
.confidence-card {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, var(--accent-soft), #FFFFFF);
  border: 1px solid #DCE0FC; border-radius: 12px; padding: 14px 16px;
  margin-bottom: 12px;
}
.confidence-text { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.confidence-bar-wrap { height: 8px; border-radius: 8px; background: #E4E7F9; overflow: hidden; }
.confidence-bar { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1s var(--ease-spring); }
.confidence-num { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--accent); flex-shrink: 0; }

.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.analysis-card {
  background: #FAFBFD; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 5px;
  transition: border-color .15s var(--ease);
}
.analysis-card:hover { border-color: #DCE0FC; }
.analysis-card .a-label { font-size: 10.5px; color: var(--ink-400); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.analysis-card .a-value { font-size: 13.6px; font-weight: 700; color: var(--ink-900); }

.priority-row {
  display: flex; align-items: center; justify-content: space-between;
  background: #FAFBFD; border: 1px solid var(--border-soft); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px;
}
.priority-row .a-label { font-size: 12px; font-weight: 600; color: var(--ink-700); text-transform: none; letter-spacing: 0; }

.missing-box {
  background: var(--warning-soft); border: 1px solid #F5DDB0; border-radius: 12px;
  padding: 12px 14px;
}
.missing-box .m-title {
  font-size: 11.3px; font-weight: 700; color: var(--warning);
  display: flex; align-items: center; gap: 6px; margin-bottom: 9px;
}
.missing-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.missing-chip {
  font-size: 11.3px; font-weight: 600; color: #92400E; background: #fff;
  border: 1px solid #F5DDB0; padding: 4px 10px; border-radius: 20px;
}

/* Section 6: recommendations */
.rec-grid { display: flex; flex-direction: column; gap: 14px; }
.rec-card {
  border: 1px solid var(--border-soft); border-radius: 16px; overflow: hidden;
  background: #fff; transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.rec-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #DCE0FC; }
.rec-image {
  height: 130px;
  background: linear-gradient(140deg, #E4E7F9, #D6DBF7);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); position: relative;
}
.rec-match {
  position: absolute; top: 10px; right: 10px;
  background: #fff; color: var(--success); font-size: 11px; font-weight: 800;
  padding: 4px 9px 4px 7px; border-radius: 20px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 4px;
}
.rec-match svg { color: var(--warning); }
.rec-body { padding: 14px 16px 16px; }
.rec-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 5px; }
.rec-title { font-size: 13.8px; font-weight: 700; color: var(--ink-900); line-height: 1.3; }
.rec-price { font-family: var(--font-mono); font-weight: 700; color: var(--accent); font-size: 13.3px; white-space: nowrap; flex-shrink: 0; }
.rec-location { display: flex; align-items: center; gap: 5px; font-size: 11.8px; color: var(--ink-500); margin-bottom: 11px; }
.rec-specs { display: flex; gap: 14px; margin-bottom: 11px; padding-bottom: 11px; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.rec-spec { display: flex; align-items: center; gap: 5px; font-size: 11.8px; color: var(--ink-700); font-weight: 600; }
.rec-spec svg { color: var(--ink-400); }
.rec-reason { display: flex; gap: 7px; font-size: 12px; color: var(--ink-500); line-height: 1.55; }
.rec-reason svg { flex-shrink: 0; margin-top: 2px; color: var(--accent-2); }

/*  DRAWER ACTION BAR */
.drawer-actions {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #FFFFFF, #FAFBFF);
}

.drawer-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-700);
  font-size: 12.3px; font-weight: 700;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
  white-space: nowrap;
}
.drawer-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.drawer-btn:active { transform: translateY(0) scale(.97); }
.drawer-btn svg { flex-shrink: 0; }

.drawer-btn-call { border-color: #DCE0FC; color: var(--accent); }
.drawer-btn-call:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.drawer-btn-whatsapp { border-color: #C9F0EC; color: var(--accent-2); }
.drawer-btn-whatsapp:hover { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }

.drawer-btn-schedule { border-color: #C9DBFB; color: var(--info); }
.drawer-btn-schedule:hover { background: var(--info); color: #fff; border-color: var(--info); }

.drawer-btn-qualify { border-color: #BFE6D3; color: var(--success); }
.drawer-btn-qualify:hover { background: var(--success); color: #fff; border-color: var(--success); }

.drawer-btn-close-lead { border-color: #F6C6D3; color: var(--danger); }
.drawer-btn-close-lead:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.drawer-btn:disabled {
  opacity: 0.5; pointer-events: none; transform: none; box-shadow: none;
}

@media (max-width: 640px) {
  .drawer-actions { grid-template-columns: repeat(2, 1fr); padding: 14px 16px; }
}

/*  TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 13px 14px;
  pointer-events: auto;
  transform: translateX(120%);
  opacity: 0;
  transition: transform .38s var(--ease-spring), opacity .3s var(--ease);
  border-left: 3px solid var(--accent);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; }

.toast-icon {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.toast-text { flex: 1; min-width: 0; padding-top: 1px; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--ink-900); line-height: 1.3; }
.toast-sub { font-size: 11.8px; color: var(--ink-500); margin-top: 2px; line-height: 1.4; }
.toast-dismiss {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; border: none;
  background: transparent; color: var(--ink-400);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s var(--ease);
}
.toast-dismiss:hover { background: #EEF0F5; color: var(--ink-700); }

.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }

.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { background: var(--info-soft); color: var(--info); }

.toast-whatsapp { border-left-color: var(--accent-2); }
.toast-whatsapp .toast-icon { background: var(--accent-2-soft); color: var(--accent-2); }

.toast-danger { border-left-color: var(--danger); }
.toast-danger .toast-icon { background: var(--danger-soft); color: var(--danger); }

.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { background: var(--warning-soft); color: var(--warning); }

@media (max-width: 480px) {
  .toast-container { left: 12px; right: 12px; bottom: 14px; max-width: none; }
}


/* RESPONSIVE */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-title p { display: none; }
}

@media (max-width: 980px) {
  .app-shell { padding: 10px; gap: 10px; }
  .sidebar {
    position: fixed;
    left: 10px; top: 10px;
    height: calc(100vh - 20px);
    transform: translateX(-110%);
  will-change: transform;
  transition: transform .28s var(--ease);
  z-index: 1000;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); padding: 20px 16px; }
  .sidebar.collapsed .brand-text, .sidebar.collapsed .nav-text,
  .sidebar.collapsed .nav-label, .sidebar.collapsed .ai-card,
  .sidebar.collapsed .user-mini-text { display: flex; }
  .sidebar-toggle { display: none; }
  .menu-btn { display: flex; }
  

@media (max-width:980px){

  .scrim{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(18,19,28,.35);
    backdrop-filter:blur(2px);

    opacity:0;
    visibility:hidden;
    transition:.25s;

    z-index:999;
  }

  .scrim.show{
    opacity:1;
    visibility:visible;
  }

}
  .search-wrap { display: none; }
  .topbar-title h1 { font-size: 17px; }
}

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .table-card-head { flex-direction: column; align-items: flex-start; }
  .table-actions { width: 100%; justify-content: space-between; }
  .profile-text { display: none; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-actions { gap: 8px; }
}

@media (max-width: 480px) {
  .filter-pills { flex-wrap: wrap; }
  .table-card-foot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .lead-drawer { width: 100vw; max-width: 100vw; }
  .info-grid { grid-template-columns: 1fr; }
  .analysis-grid { grid-template-columns: 1fr; }
  .image-grid { grid-template-columns: repeat(2, 1fr); }
  .drawer-body { padding: 20px 16px 32px; }
  .drawer-header { padding: 18px 16px 16px; }
}
