/* ============================================================
   GreenLight Sales CRM — Main Stylesheet
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --green-dark:   #1a7a4a;
  --green-mid:    #2d9d6b;
  --green-light:  #e8f7ef;
  --green-xlight: #f0faf4;
  --blue:         #3b82f6;
  --blue-light:   #eff6ff;
  --orange:       #f59e0b;
  --orange-light: #fffbeb;
  --red:          #ef4444;
  --red-light:    #fef2f2;
  --purple:       #8b5cf6;
  --purple-light: #f5f3ff;
  --teal:         #06b6d4;
  --teal-light:   #ecfeff;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-300:     #d1d5db;
  --gray-400:     #9ca3af;
  --gray-500:     #6b7280;
  --gray-600:     #4b5563;
  --gray-700:     #374151;
  --gray-800:     #1f2937;
  --gray-900:     #111827;
  --sidebar-w:    260px;
  --sidebar-w-collapsed: 64px;
  --topbar-h:     60px;
  --radius:       8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
  --transition:   0.2s ease;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green-mid); }

h1,h2,h3,h4,h5 { font-weight: 600; line-height: 1.3; }

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

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-details { display: none; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}

.logo-icon { color: var(--green-mid); font-size: 1.3rem; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 1rem;
  transition: color var(--transition);
}
.sidebar-toggle:hover { color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--gray-300);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

.nav-item i { width: 18px; text-align: center; font-size: 0.95rem; flex-shrink: 0; }

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(45,157,107,.15);
  color: var(--green-mid);
  border-left-color: var(--green-mid);
}

.nav-section-label {
  padding: 16px 16px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 12px;
}

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--green-dark);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; }
.user-role { font-size: 0.75rem; color: var(--gray-400); }

.nav-logout { color: var(--gray-400); }
.nav-logout:hover { color: var(--red); background: rgba(239,68,68,.08); }

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

.main-content.sidebar-collapsed { margin-left: var(--sidebar-w-collapsed); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  border-radius: 4px;
  display: none;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-800);
  flex: 1;
}

.topbar-right { color: var(--gray-500); font-size: 0.85rem; }

/* ── Content Area ───────────────────────────────────────────── */
.content-area {
  padding: 24px;
  flex: 1;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

.card-alert { border-left: 4px solid var(--red); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.alert-close {
  position: absolute; right: 12px; top: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: inherit; opacity: 0.6;
}
.alert-close:hover { opacity: 1; }

.alert-success { background: var(--green-xlight); color: var(--green-dark); border: 1px solid #a7f3d0; }
.alert-danger   { background: var(--red-light);   color: #b91c1c;           border: 1px solid #fca5a5; }
.alert-warning  { background: var(--orange-light); color: #92400e;           border: 1px solid #fcd34d; }
.alert-info     { background: var(--blue-light);   color: #1e40af;           border: 1px solid #93c5fd; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary   { background: var(--green-dark);  color: #fff; border-color: var(--green-dark); }
.btn-primary:hover { background: var(--green-mid); color: #fff; }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-danger    { background: var(--red);    color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #dc2626; }

.btn-success   { background: var(--green-mid); color: #fff; border-color: var(--green-mid); }
.btn-success:hover { background: var(--green-dark); }

.btn-ghost     { background: transparent; color: var(--gray-600); border-color: var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-block { width: 100%; justify-content: center; }
.btn-lg    { padding: 10px 22px; font-size: 1rem; }
.btn-sm    { padding: 5px 12px; font-size: 0.8rem; }
.btn-xs    { padding: 3px 8px; font-size: 0.75rem; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--gray-800);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(26,122,74,.12);
}

textarea { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 16px; }
.form-row.two-col > * { flex: 1; }
.form-row.three-col > * { flex: 1; }

.required { color: var(--red); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid .full-width { grid-column: 1 / -1; }

.form-section .card-header h3 { font-size: 0.9rem; }

.form-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 20px 0 8px;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--gray-700);
}
.checkbox-label input[type="checkbox"] { width: auto; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table-sm th, .data-table-sm td { padding: 7px 10px; }

.table-total td { background: var(--gray-50); font-weight: 600; }

.row-won    { background: rgba(26,122,74,.04); }
.row-lost   { background: rgba(239,68,68,.04); opacity: 0.7; }
.row-overdue { background: rgba(239,68,68,.06); }
.row-disabled { opacity: 0.55; }
.row-selected { background: var(--green-xlight); }

.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 4px; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--green-light); color: var(--green-dark); }
.badge-danger  { background: var(--red-light);   color: #b91c1c; }
.badge-warning { background: var(--orange-light); color: #92400e; }
.badge-info    { background: var(--blue-light);   color: #1e40af; }
.badge-gray    { background: var(--gray-100);     color: var(--gray-600); }

/* Stage badges */
.stage-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.stage-new-lead       { background: #e0f2fe; color: #0369a1; }
.stage-contacted      { background: #fef9c3; color: #854d0e; }
.stage-qualified      { background: #fef3c7; color: #92400e; }
.stage-proposal-sent  { background: #ede9fe; color: #5b21b6; }
.stage-negotiation    { background: #fce7f3; color: #9d174d; }
.stage-closed-won     { background: var(--green-light); color: var(--green-dark); }
.stage-closed-lost    { background: var(--red-light); color: #b91c1c; }

/* Touch type badges */
.touch-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.touch-call    { background: #dbeafe; color: #1d4ed8; }
.touch-text    { background: #dcfce7; color: #15803d; }
.touch-email   { background: #fef9c3; color: #854d0e; }
.touch-meeting { background: #ede9fe; color: #5b21b6; }
.touch-other   { background: var(--gray-100); color: var(--gray-600); }
.touch-note    { background: var(--gray-100); color: var(--gray-600); }
.touch-stage_change { background: #fce7f3; color: #9d174d; }

/* Role badges */
.role-badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.role-office    { background: var(--green-light); color: var(--green-dark); }
.role-sales_rep { background: var(--blue-light);  color: #1e40af; }

/* ── KPI Grid ───────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.kpi-green::before  { background: var(--green-dark); }
.kpi-blue::before   { background: var(--blue); }
.kpi-orange::before { background: var(--orange); }
.kpi-red::before    { background: var(--red); }
.kpi-purple::before { background: var(--purple); }
.kpi-teal::before   { background: var(--teal); }

.kpi-icon { font-size: 1.4rem; margin-bottom: 4px; }
.kpi-green .kpi-icon  { color: var(--green-dark); }
.kpi-blue .kpi-icon   { color: var(--blue); }
.kpi-orange .kpi-icon { color: var(--orange); }
.kpi-red .kpi-icon    { color: var(--red); }
.kpi-purple .kpi-icon { color: var(--purple); }
.kpi-teal .kpi-icon   { color: var(--teal); }

.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--gray-800); line-height: 1; }
.kpi-label { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; }

/* ── Section Labels ─────────────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  margin: 24px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}

/* ── Dashboard Layout ───────────────────────────────────────── */
.dashboard-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-chart-card { flex: 1; }

/* Stage mini cards */
.stage-cards-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.stage-mini-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 140px;
  flex: 1;
  box-shadow: var(--shadow-sm);
}

.stage-mini-overdue { border-color: var(--red); background: var(--red-light); }
.stage-mini-name  { font-size: 0.8rem; font-weight: 600; color: var(--gray-600); margin-bottom: 4px; }
.stage-mini-count { font-size: 1.2rem; font-weight: 700; color: var(--gray-800); }
.stage-mini-value { font-size: 0.85rem; color: var(--green-dark); font-weight: 600; }
.stage-mini-prob  { font-size: 0.75rem; color: var(--gray-400); }
.stage-mini-days  { font-size: 0.75rem; color: var(--gray-500); margin-top: 4px; }

/* ── Alerts Summary ─────────────────────────────────────────── */
.alerts-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.alert-summary-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
  color: var(--gray-600);
}

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

.alert-summary-card i { font-size: 1.5rem; }
.alert-summary-count { font-size: 1.8rem; font-weight: 700; }
.alert-summary-label { font-size: 0.75rem; font-weight: 500; }

.alert-summary-danger.has-alerts  { border-color: var(--red);    background: var(--red-light);    color: #b91c1c; }
.alert-summary-warning.has-alerts { border-color: var(--orange); background: var(--orange-light); color: #92400e; }

/* ── Forecast Grid ──────────────────────────────────────────── */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.forecast-card {
  text-align: center;
  padding: 28px 20px;
}

.forecast-icon { font-size: 2rem; color: var(--green-dark); margin-bottom: 10px; }
.forecast-value { font-size: 1.8rem; font-weight: 700; color: var(--gray-800); }
.forecast-label { font-size: 0.9rem; font-weight: 600; color: var(--gray-600); margin-top: 6px; }
.forecast-sub   { font-size: 0.78rem; color: var(--gray-400); margin-top: 4px; }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.progress-bar-wrap > div {
  height: 6px;
  background: var(--green-dark);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-bar-wrap > span { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }

/* ── Kanban Board ───────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.kanban-column {
  min-width: 220px;
  max-width: 260px;
  flex-shrink: 0;
  background: var(--gray-100);
  border-radius: var(--radius);
  overflow: hidden;
}

.kanban-header {
  background: var(--gray-800);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.kanban-stage-name { flex: 1; font-weight: 600; }
.kanban-count { background: rgba(255,255,255,.2); padding: 1px 7px; border-radius: 10px; font-size: 0.75rem; }
.kanban-value { font-size: 0.78rem; color: var(--green-mid); }

.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-empty { padding: 20px; text-align: center; color: var(--gray-400); font-size: 0.85rem; }

.kanban-card {
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card-overdue { border-left: 3px solid var(--red); }

.kanban-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kanban-lead-name { font-weight: 600; font-size: 0.85rem; color: var(--gray-800); }
.kanban-deal-value { font-size: 0.8rem; font-weight: 700; color: var(--green-dark); white-space: nowrap; }
.kanban-company { margin-top: 2px; }
.kanban-meta { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.kanban-next-step { line-height: 1.3; }

/* ── Lead Detail ────────────────────────────────────────────── */
.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

.lead-header-card { padding: 0; }
.lead-header-info {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--gray-100);
}

.lead-avatar-lg {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green-dark);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  flex-shrink: 0;
}

.lead-header-info h2 { font-size: 1.2rem; }
.lead-meta-row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; font-size: 0.85rem; color: var(--gray-500); }
.lead-meta-row span { display: flex; align-items: center; gap: 5px; }

.lead-header-stats {
  display: flex;
  gap: 24px;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.stat-item { text-align: center; }
.stat-value { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); }
.stat-label { font-size: 0.75rem; color: var(--gray-400); margin-top: 2px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.04em; }

.next-step-detail { font-size: 0.95rem; line-height: 1.5; }
.last-update-box {
  background: var(--gray-50);
  border-left: 3px solid var(--green-dark);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-top: 10px;
  color: var(--gray-600);
}

/* Qualification display */
.qual-display { display: flex; flex-direction: column; gap: 8px; }
.qual-item { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.qual-yes { color: var(--green-dark); }
.qual-no  { color: var(--gray-400); }

/* Qualification form */
.qual-score-section { margin-top: 16px; border-top: 1px solid var(--gray-100); padding-top: 14px; }
.qual-score-section h4 { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 10px; }
.qual-checks { display: flex; flex-direction: column; gap: 8px; }

/* Activity Timeline */
.activity-timeline { max-height: 500px; overflow-y: auto; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.timeline-item:last-child { border-bottom: none; }

.timeline-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--gray-500);
}

.timeline-call .timeline-icon    { background: #dbeafe; color: #1d4ed8; }
.timeline-email .timeline-icon   { background: #fef9c3; color: #854d0e; }
.timeline-meeting .timeline-icon { background: #ede9fe; color: #5b21b6; }
.timeline-note .timeline-icon    { background: var(--gray-100); color: var(--gray-500); }

.timeline-content { flex: 1; min-width: 0; }
.timeline-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.timeline-header strong { font-size: 0.85rem; }
.timeline-date { font-size: 0.75rem; color: var(--gray-400); white-space: nowrap; }
.timeline-desc { font-size: 0.82rem; color: var(--gray-600); margin-top: 3px; }
.timeline-outcome { font-size: 0.82rem; color: var(--gray-600); margin-top: 3px; }
.timeline-by { font-size: 0.75rem; color: var(--gray-400); margin-top: 3px; }

/* Quotes */
.quote-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.quote-item:last-child { border-bottom: none; }
.quote-amount { font-size: 1rem; font-weight: 700; color: var(--green-dark); }
.quote-meta { font-size: 0.8rem; color: var(--gray-500); margin: 3px 0; }
.quote-pending { border-left: 3px solid var(--orange); padding-left: 8px; }

/* Stage history */
.stage-history-item { padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.stage-history-item:last-child { border-bottom: none; }

/* ── Alerts Page ────────────────────────────────────────────── */
.alerts-grid { display: flex; flex-direction: column; gap: 20px; }
.alert-card-danger  { border-left: 4px solid var(--red); }
.alert-card-warning { border-left: 4px solid var(--orange); }
.alert-empty { color: var(--green-dark); padding: 12px 0; font-size: 0.9rem; }

/* ── Conversion Funnel ──────────────────────────────────────── */
.conversion-funnel { display: flex; flex-direction: column; gap: 12px; }

.funnel-step {
  display: grid;
  grid-template-columns: 220px 1fr 120px;
  align-items: center;
  gap: 16px;
}

.funnel-stages { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 500; }
.funnel-from, .funnel-to { color: var(--gray-700); }
.funnel-arrow { color: var(--gray-400); font-size: 0.75rem; }

.funnel-bar-wrap {
  background: var(--gray-100);
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.funnel-bar { height: 100%; background: var(--green-dark); border-radius: 4px; transition: width 0.5s ease; }

.funnel-stats { display: flex; align-items: center; gap: 8px; }
.funnel-rate { font-size: 1rem; font-weight: 700; }

/* ── Filters ────────────────────────────────────────────────── */
.filter-card { margin-bottom: 16px; }
.filter-form { padding: 14px 16px; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-row .form-group { margin-bottom: 0; min-width: 150px; }
.filter-actions { display: flex; gap: 8px; }

/* ── Page Actions ───────────────────────────────────────────── */
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ── Import / Mapping ───────────────────────────────────────── */
.mapping-grid { display: flex; flex-direction: column; gap: 10px; }

.mapping-row {
  display: grid;
  grid-template-columns: 1fr 30px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: 6px;
  border: 1px solid var(--gray-200);
}

.mapping-csv-col { display: flex; flex-direction: column; gap: 2px; }
.mapping-col-name { font-weight: 600; font-size: 0.88rem; color: var(--gray-700); }
.mapping-sample { font-size: 0.78rem; }
.mapping-arrow { text-align: center; color: var(--gray-400); }
.mapping-db-col { display: flex; align-items: center; gap: 8px; }
.mapping-select { flex: 1; }
.mapping-auto-badge { font-size: 0.68rem; padding: 1px 6px; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f4c2a 0%, #1a7a4a 50%, #2d9d6b 100%);
  padding: 20px;
}

.auth-container { width: 100%; max-width: 440px; }

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 36px 40px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-dark);
}

.auth-logo .logo-icon { font-size: 1.5rem; }

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-bottom: 24px;
}

.auth-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* ── Utility Classes ────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--gray-400); }
.text-sm      { font-size: 0.82rem; }
.text-xs      { font-size: 0.72rem; }
.text-green   { color: var(--green-dark); }
.text-danger  { color: var(--red); }
.text-warning { color: var(--orange); }
.text-success { color: var(--green-dark); }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: 'SF Mono', 'Fira Code', monospace; }

.lead-name { font-weight: 600; color: var(--gray-800); }
.lead-name:hover { color: var(--green-dark); }
.next-step-text { font-size: 0.85rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .lead-detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: auto; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .topbar-toggle { display: block; }
  .dashboard-row { flex-direction: column; }
  .funnel-step { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 600px) {
  .content-area { padding: 16px; }
  .auth-card { padding: 24px 20px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .form-row.two-col, .form-row.three-col { flex-direction: column; }
  .kanban-board { flex-direction: column; }
  .kanban-column { max-width: 100%; }
}
