/* ========== DASHBOARD LAYOUT ========== */
.dash-body {
  min-height: 100vh;
  background: var(--bg-dark);
}

/* Topbar */
.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.dash-logo:hover { color: var(--accent); }

.dash-topbar-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Main content */
.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ========== STAT CARDS ========== */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: rgba(245, 158, 11, 0.3);
}

.stat-card-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.stat-card-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}

.stat-card-value.accent { color: var(--accent); }

/* ========== LEADS SECTION ========== */
.dash-leads-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dash-leads-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

.dash-leads-header h2 {
  font-size: 1.2rem;
  color: var(--fg);
}

/* Filter buttons */
.dash-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--fg);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0a0a;
}

/* ========== TABLE ========== */
.table-wrap {
  overflow-x: auto;
}

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

.leads-table thead th {
  text-align: left;
  padding: 14px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.leads-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

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

.leads-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.leads-table td {
  padding: 16px 20px;
  font-size: 0.9rem;
  color: var(--fg);
  vertical-align: middle;
}

.td-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.has-notes {
  font-size: 0.75rem;
  opacity: 0.7;
  cursor: default;
}

.td-phone {
  color: var(--accent);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.td-phone:hover { text-decoration: underline; }

.td-date {
  color: var(--fg-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Source tag */
.source-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
}

/* Status badges */
.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.status-new       { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.status-contacted { background: rgba(245,158,11,0.12);   color: var(--accent); border: 1px solid rgba(245,158,11,0.25); }
.status-won       { background: rgba(34, 197, 94, 0.12); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.status-lost      { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }

/* Table empty/loading/error states */
.table-loading td,
.table-empty td,
.table-error td {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.table-error td { color: #f87171; }

/* ========== ACTION COLUMN ========== */
.td-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-select {
  appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.status-select:hover,
.status-select:focus {
  border-color: var(--accent);
  outline: none;
  color: var(--fg);
}

.status-select:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-notes {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-muted);
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-notes:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== MODAL ========== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  padding: 28px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.1rem;
  color: var(--fg);
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--fg); }

.modal-notes {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 14px 16px;
  resize: vertical;
  min-height: 120px;
  margin-bottom: 20px;
  transition: border-color 0.15s;
}

.modal-notes:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #0a0a0a;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 24px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .dash-main { padding: 24px 16px 60px; }
  .dash-topbar { padding: 0 16px; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .dash-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 20px 16px; }
  .stat-card-value { font-size: 2rem; }
  .dash-leads-header { flex-direction: column; align-items: flex-start; }
  .td-actions { flex-direction: column; align-items: flex-start; }
}
