/* ============================================
   GeroHub — Lead Management Dashboard
   Design System & Styles
   ============================================ */

/* ===== CSS VARIABLES / TOKENS ===== */
:root {
  /* Brand palette */
  --brand-primary: #6C5CE7;
  --brand-primary-light: #A29BFE;
  --brand-primary-dark: #5641D4;
  --brand-accent: #0984E3;
  --brand-gradient: linear-gradient(135deg, #6C5CE7 0%, #0984E3 100%);

  /* Surface & background */
  --bg-app: #F0F2F8;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-panel: #FFFFFF;
  --bg-hover: #F6F7FB;
  --bg-active: #EEF0FF;
  --bg-input: #F4F5FA;

  /* Text */
  --text-primary: #1A1D2E;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Borders */
  --border-light: #E5E7EB;
  --border-medium: #D1D5DB;

  /* Status colors */
  --status-new: #0984E3;
  --status-contacted: #FDCB6E;
  --status-qualified: #00B894;
  --status-proposal: #6C5CE7;
  --status-won: #00CEC9;
  --status-lost: #E17055;

  /* Source colors */
  --src-whatsapp: #25D366;
  --src-facebook: #1877F2;
  --src-instagram: #E4405F;
  --src-gmail: #EA4335;
  --src-telegram: #0088CC;
  --src-sms: #FF9F43;

  /* Score colors */
  --score-hot: #E17055;
  --score-warm: #FDCB6E;
  --score-cold: #74B9FF;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
  --shadow-xl: 0 20px 50px rgba(0,0,0,.12);
  --shadow-glow: 0 0 24px rgba(108,92,231,.2);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(.4,0,.2,1);
  --transition-base: 250ms cubic-bezier(.4,0,.2,1);
  --transition-slow: 400ms cubic-bezier(.4,0,.2,1);

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 72px;
  --panel-width: 400px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== APP LAYOUT (3-column) ===== */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--panel-width);
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns var(--transition-base);
}

.app-layout.panel-closed {
  grid-template-columns: var(--sidebar-width) 1fr 0;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) var(--space-md);
  overflow-y: auto;
  z-index: 20;
  transition: transform var(--transition-base);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm);
  margin-bottom: var(--space-xl);
}

.brand-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.5px;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  color: var(--brand-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--brand-primary);
  background: var(--bg-active);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--brand-gradient);
  border-radius: 0 4px 4px 0;
}

/* Sidebar CTA Card */
.sidebar-cta {
  background: linear-gradient(135deg, #EEF0FF 0%, #F0F7FF 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
  text-align: center;
}

.cta-icon {
  font-size: 1.6rem;
  margin-bottom: var(--space-sm);
}

.sidebar-cta h4 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.sidebar-cta p {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.4;
}

.cta-btn {
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: .78rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(108,92,231,.25);
}

.cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(108,92,231,.35);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-md);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  scroll-behavior: smooth;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-xl);
}

.header-left { flex: 1; }

.header-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text-primary);
}

.header-subtitle {
  font-size: .88rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  max-width: 480px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-date {
  font-size: .82rem;
  color: var(--text-tertiary);
  font-weight: 500;
  white-space: nowrap;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  box-shadow: var(--shadow-glow);
}

/* ===== STATS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-leads  { background: #EEF0FF; color: var(--brand-primary); }
.stat-icon-time   { background: #FFF3E0; color: #F0932B; }
.stat-icon-conv   { background: #E8F8F5; color: #00B894; }
.stat-icon-score  { background: #FFF0F0; color: #E17055; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: .75rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.5px;
}

.stat-change {
  font-size: .72rem;
  font-weight: 600;
  margin-top: 2px;
}

.stat-change.positive { color: #00B894; }
.stat-change.negative { color: #E17055; }
.stat-change.neutral  { color: var(--text-tertiary); }

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-md);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.filters-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  min-width: 220px;
  transition: all var(--transition-fast);
}

.search-box:focus-within {
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 3px rgba(108,92,231,.1);
  background: #fff;
}

.search-box svg { flex-shrink: 0; color: var(--text-tertiary); }

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: .85rem;
  color: var(--text-primary);
}

.search-box input::placeholder { color: var(--text-tertiary); }

.filters-right {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.filter-select {
  appearance: none;
  background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 32px 8px 12px;
  font-size: .82rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 140px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 3px rgba(108,92,231,.1);
}

.filter-select:hover {
  border-color: var(--border-medium);
}

/* ===== LEADS TABLE ===== */
.leads-table-wrapper {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.leads-table th {
  background: #FAFBFD;
  padding: 14px 16px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .6px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.leads-table td {
  padding: 14px 16px;
  font-size: .88rem;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
  white-space: nowrap;
}

.leads-table tbody tr {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.leads-table tbody tr:hover {
  background: var(--bg-hover);
}

.leads-table tbody tr.selected {
  background: var(--bg-active);
  box-shadow: inset 3px 0 0 var(--brand-primary);
}

.leads-table tbody tr:last-child td {
  border-bottom: none;
}

/* Name cell */
.lead-name-cell {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.lead-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.lead-avatar .online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00B894;
  border: 2px solid #fff;
}

.lead-name {
  font-weight: 600;
  color: var(--text-primary);
}

.lead-email {
  font-size: .75rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* Source badge */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .3px;
}

.source-badge.whatsapp  { background: #E6F9EE; color: #128C7E; }
.source-badge.facebook  { background: #E7F0FF; color: #1877F2; }
.source-badge.instagram { background: #FFE8EE; color: #E4405F; }
.source-badge.gmail     { background: #FFEAE8; color: #EA4335; }
.source-badge.telegram  { background: #E3F2FD; color: #0088CC; }
.source-badge.sms       { background: #FFF3E0; color: #E67E22; }

/* Source icons */
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.source-dot.whatsapp  { background: var(--src-whatsapp); }
.source-dot.facebook  { background: var(--src-facebook); }
.source-dot.instagram { background: var(--src-instagram); }
.source-dot.gmail     { background: var(--src-gmail); }
.source-dot.telegram  { background: var(--src-telegram); }
.source-dot.sms       { background: var(--src-sms); }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.new       { background: var(--status-new); }
.status-dot.contacted { background: var(--status-contacted); }
.status-dot.qualified { background: var(--status-qualified); }
.status-dot.proposal  { background: var(--status-proposal); }
.status-dot.won       { background: var(--status-won); }
.status-dot.lost      { background: var(--status-lost); }

/* Score */
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 28px;
  border-radius: var(--radius-full);
  font-size: .82rem;
  font-weight: 700;
}

.score-pill.hot  { background: #FFEAE8; color: var(--score-hot); }
.score-pill.warm { background: #FFF9E6; color: #D4A017; }
.score-pill.cold { background: #E8F4FD; color: #2E86C1; }

/* Last message preview */
.last-msg {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: .82rem;
}

/* Date */
.lead-date {
  color: var(--text-secondary);
  font-size: .82rem;
}

/* Action buttons in table */
.lead-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-follow-up {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--brand-primary-light);
  background: transparent;
  color: var(--brand-primary);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-follow-up:hover {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
  box-shadow: 0 4px 12px rgba(108,92,231,.25);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-tertiary);
  gap: var(--space-md);
}

.empty-state p {
  font-size: .88rem;
}

.hidden { display: none !important; }

/* ===== RIGHT PANEL ===== */
.right-panel {
  background: var(--bg-panel);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-base);
  width: var(--panel-width);
  min-width: 0;
}

.app-layout.panel-closed .right-panel {
  width: 0;
  border: none;
  overflow: hidden;
}

.panel-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  color: var(--text-tertiary);
  font-size: .88rem;
  padding: var(--space-xl);
  text-align: center;
}

/* Panel header */
.panel-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, #FAFBFF 0%, #FFFFFF 100%);
}

.panel-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.panel-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.panel-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-lg);
}

.panel-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.panel-interest {
  font-size: .82rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  text-align: center;
  max-width: 280px;
}

.panel-meta {
  display: flex;
  gap: var(--space-sm);
}

.panel-source-badge,
.panel-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 600;
}

/* Panel messages */
.panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.messages-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.message-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: .85rem;
  line-height: 1.5;
  position: relative;
  animation: bubbleIn var(--transition-base) ease-out;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.message-bubble.incoming {
  background: #F3F4F8;
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.message-bubble.outgoing {
  background: var(--brand-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.message-sender {
  font-size: .7rem;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: .7;
}

.message-time {
  font-size: .65rem;
  margin-top: 6px;
  opacity: .6;
  text-align: right;
}

/* Follow-up suggestion box */
.panel-followup {
  margin: 0 var(--space-lg);
  padding: var(--space-md);
  background: linear-gradient(135deg, #FFF9E6 0%, #FFF3E0 100%);
  border: 1px solid #FDCB6E;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.followup-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: .75rem;
  font-weight: 700;
  color: #D4A017;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.followup-text {
  font-size: .84rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: var(--space-md);
}

.followup-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #E5C547;
  background: rgba(255,255,255,.6);
  color: #B8860B;
  border-radius: var(--radius-sm);
  font-size: .75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.followup-copy:hover {
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.followup-copy.copied {
  background: #00B894;
  color: #fff;
  border-color: #00B894;
}

/* Reply box */
.panel-reply {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--border-light);
  background: #FAFBFD;
}

.reply-textarea {
  width: 100%;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: .85rem;
  color: var(--text-primary);
  background: #fff;
  resize: none;
  outline: none;
  transition: all var(--transition-fast);
}

.reply-textarea:focus {
  border-color: var(--brand-primary-light);
  box-shadow: 0 0 0 3px rgba(108,92,231,.1);
}

.reply-textarea::placeholder { color: var(--text-tertiary); }

.reply-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  justify-content: flex-end;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(108,92,231,.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(108,92,231,.35);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary-light);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-active);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1A1D2E;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  opacity: 0;
  transition: all var(--transition-base);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .app-layout {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  .right-panel {
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 30;
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform var(--transition-base);
  }

  .right-panel.open {
    transform: translateX(0);
  }

  .app-layout.panel-closed .right-panel {
    width: var(--panel-width);
  }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 40;
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
    width: var(--sidebar-width);
  }

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

  .menu-toggle { display: flex; }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-left {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-right {
    flex-direction: column;
  }

  .filter-select {
    min-width: 100%;
  }

  .th-last, .td-last {
    display: none;
  }

  .right-panel {
    width: 100vw;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-card     { animation: fadeInUp .4s ease-out backwards; }
.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .1s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .2s; }

.leads-table tbody tr {
  animation: fadeInUp .35s ease-out backwards;
}

.leads-table tbody tr:nth-child(1)  { animation-delay: .08s; }
.leads-table tbody tr:nth-child(2)  { animation-delay: .12s; }
.leads-table tbody tr:nth-child(3)  { animation-delay: .16s; }
.leads-table tbody tr:nth-child(4)  { animation-delay: .2s; }
.leads-table tbody tr:nth-child(5)  { animation-delay: .24s; }
.leads-table tbody tr:nth-child(6)  { animation-delay: .28s; }
.leads-table tbody tr:nth-child(7)  { animation-delay: .32s; }
.leads-table tbody tr:nth-child(8)  { animation-delay: .36s; }
.leads-table tbody tr:nth-child(9)  { animation-delay: .4s; }
.leads-table tbody tr:nth-child(10) { animation-delay: .44s; }

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

.sidebar-overlay.show {
  display: block;
}
