/* Dashboard layout and components */

.dash-body {
  background: var(--bg);
  min-height: 100vh;
}

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

.dash-brand {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
}

.dash-brand span { color: var(--accent); }

.dash-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dash-link {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s;
}

.dash-link:hover,
.dash-link.active {
  color: var(--fg);
  background: rgba(255,255,255,0.04);
}

.dash-link.active {
  color: var(--fg);
}

.dash-demo-btn {
  margin-left: 12px;
  padding: 8px 18px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}

.dash-demo-btn:hover { opacity: 0.88; }

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

.dash-header {
  margin-bottom: 36px;
}

.dash-header h1 {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.dash-subhead {
  color: var(--fg-muted);
  font-size: 16px;
}

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: rgba(255,107,43,0.2); }

.emergency-card { border-color: rgba(239,68,68,0.15); }
.emergency-card:hover { border-color: rgba(239,68,68,0.3); }

.stat-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }

.stat-num {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--fg);
}

.stat-lbl {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.4;
}

/* ---- TWO COL ---- */
.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ---- SECTIONS ---- */
.dash-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

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

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  color: var(--fg);
}

.section-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}
.section-link:hover { opacity: 0.8; }

/* ---- EMPTY STATES ---- */
.empty-state {
  text-align: center;
  padding: 32px 16px;
}
.empty-state-full {
  padding: 80px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; color: var(--fg-muted); }
.empty-state a { color: var(--accent); text-decoration: none; }

/* ---- CALL LIST ---- */
.call-list { display: flex; flex-direction: column; gap: 2px; }

.call-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 0.15s;
}
.call-row:hover { background: var(--bg-elevated); }

.call-meta { display: flex; flex-direction: column; gap: 2px; }
.call-name { font-size: 14px; font-weight: 500; color: var(--fg); }
.call-time { font-size: 12px; color: var(--fg-muted); }

.call-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- APPT LIST ---- */
.appt-list { display: flex; flex-direction: column; gap: 8px; }

.appt-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.appt-date-block { flex-shrink: 0; text-align: center; min-width: 56px; }

.appt-day {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.appt-time { font-size: 12px; color: var(--fg-muted); }

.appt-detail { flex: 1; }
.appt-customer { font-size: 14px; font-weight: 500; color: var(--fg); }
.appt-service { font-size: 13px; color: var(--fg-muted); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.badge-emergency { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
.badge-service { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(255,107,43,0.2); }
.badge-booked { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-demo { background: rgba(139,92,246,0.1); color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }
.badge-new { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-qualified { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-in_progress { background: rgba(234,179,8,0.1); color: #facc15; border: 1px solid rgba(234,179,8,0.2); }
.badge-missed { background: rgba(107,114,128,0.1); color: #9ca3af; border: 1px solid rgba(107,114,128,0.2); }
.badge-contacted { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-closed { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-lost { background: rgba(107,114,128,0.1); color: #9ca3af; border: 1px solid rgba(107,114,128,0.2); }
.badge-scheduled { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
.badge-confirmed { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.badge-completed { background: rgba(107,114,128,0.1); color: #9ca3af; border: 1px solid rgba(107,114,128,0.2); }
.badge-cancelled { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ---- TABLE ---- */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.leads-table thead {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.leads-table th {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.leads-table tr:last-child td { border-bottom: none; }
.leads-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.lead-name { font-weight: 500; color: var(--fg); margin-bottom: 2px; }
.lead-phone { font-size: 12px; color: var(--fg-muted); }
.lead-issue { color: var(--fg-muted); font-size: 13px; }
.lead-date { color: var(--fg-muted); font-size: 13px; white-space: nowrap; }

/* Status select */
.status-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.status-select:hover { border-color: var(--accent); }
.status-select option { background: var(--bg-card); }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-nav { padding: 0 16px; }
  .dash-main { padding: 24px 16px 60px; }
  .dash-nav-links { gap: 0; }
  .dash-link { padding: 8px 10px; font-size: 13px; }
}
