/* Dashboard layout */
.dash-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

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

.sidebar-nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: var(--fg-dim);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.nav-item:hover { background: var(--bg-card); color: var(--fg); }
.nav-item.active { color: var(--accent); background: var(--accent-glow); }

.nav-icon { font-size: 16px; }

.sidebar-logout { padding: 16px 24px; }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg-dim);
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.2s, color 0.2s;
}
.logout-btn:hover { border-color: var(--fg-dim); color: var(--fg); }

/* Main area */
.dash-main {
  flex: 1;
  margin-left: 220px;
  padding: 40px 48px;
  max-width: 1100px;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.dash-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-subtitle {
  font-size: 14px;
  color: var(--fg-dim);
  margin-top: 2px;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px; height: 8px;
  background: #00d4ff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-label { font-size: 13px; color: var(--fg-dim); }

/* KPI row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.kpi-num {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
}
.kpi-num.accent { color: var(--accent); }
.kpi-num.warm { color: var(--accent-warm); }
.kpi-num.green { color: #00e676; }

.kpi-label {
  font-size: 12px;
  color: var(--fg-dim);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tab panels */
.tab-panel { display: block; }
.tab-panel.hidden { display: none; }

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

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--fg-dim);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--fg);
  margin-bottom: 8px;
}
.empty-state p { font-size: 15px; margin-bottom: 32px; }

/* Webhook box */
.webhook-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: left;
  max-width: 540px;
  margin: 0 auto;
}

.webhook-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-dim);
  display: block;
  margin-bottom: 10px;
}

.webhook-url-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.webhook-url {
  font-size: 12px;
  color: var(--accent);
  word-break: break-all;
  flex: 1;
  font-family: monospace;
}

.webhook-hint {
  font-size: 12px;
  color: var(--fg-dim);
  margin-top: 12px;
  font-family: monospace;
}

.webhook-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.webhook-bar-label {
  font-size: 11px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.webhook-bar-url {
  font-size: 12px;
  color: var(--accent);
  font-family: monospace;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Copy buttons */
.copy-btn, .copy-btn-sm {
  background: var(--accent-glow);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.copy-btn-sm { font-size: 11px; padding: 4px 10px; }
.copy-btn:hover, .copy-btn-sm:hover { background: rgba(0, 212, 255, 0.25); }

/* Leads list */
.leads-list { display: flex; flex-direction: column; gap: 16px; }

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

.lead-card:hover { border-color: rgba(255, 255, 255, 0.12); }
.lead-card.new { border-left: 3px solid var(--accent-warm); }
.lead-card.responded { border-left: 3px solid var(--accent); }
.lead-card.booked { border-left: 3px solid #00e676; }

.lead-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-meta { display: flex; flex-direction: column; gap: 2px; }
.lead-name { font-weight: 600; font-size: 16px; }
.lead-contact { font-size: 13px; color: var(--fg-dim); }

.lead-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.lead-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 100px;
}
.lead-badge.new { background: rgba(255, 107, 53, 0.15); color: var(--accent-warm); }
.lead-badge.responded { background: var(--accent-glow); color: var(--accent); }
.lead-badge.booked { background: rgba(0, 230, 118, 0.15); color: #00e676; }
.lead-badge.closed { background: rgba(136, 136, 160, 0.15); color: var(--fg-dim); }
.lead-badge.lost { background: rgba(136, 136, 160, 0.1); color: var(--fg-dim); }

.lead-time { font-size: 12px; color: var(--fg-dim); }
.lead-message { font-size: 15px; color: var(--fg-dim); font-style: italic; margin-bottom: 16px; line-height: 1.5; }

.lead-ai-response {
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.ai-response-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 8px;
}

.ai-response-text { font-size: 14px; color: var(--fg); line-height: 1.6; }

.lead-ai-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-dim);
  margin-bottom: 16px;
}

.pulse-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

.lead-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  border: none;
}
.action-btn:hover { opacity: 0.85; }

.book-btn { background: var(--accent); color: #000; }
.complete-btn { background: rgba(0, 230, 118, 0.15); color: #00e676; border: 1px solid rgba(0, 230, 118, 0.3); }
.cancel-btn { background: rgba(136, 136, 160, 0.1); color: var(--fg-dim); border: 1px solid var(--border); }

.status-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 13px;
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
}

/* Appointments */
.appointments-list { display: flex; flex-direction: column; gap: 12px; }

.appt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.appt-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  text-align: center;
}

.appt-date { font-size: 12px; color: var(--fg-dim); }
.appt-hour { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--accent); }

.appt-info { flex: 1; }
.appt-name { font-weight: 600; font-size: 16px; }
.appt-service { font-size: 13px; color: var(--fg-dim); margin-top: 2px; }
.appt-contact { font-size: 13px; color: var(--fg-dim); }

.appt-actions { display: flex; gap: 8px; }

/* Settings */
.settings-form { max-width: 600px; }
.settings-section { margin-bottom: 40px; }
.settings-section h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-hint { font-size: 14px; color: var(--fg-dim); margin-bottom: 16px; line-height: 1.6; }
.settings-hint code { background: var(--bg-surface); padding: 2px 6px; border-radius: 4px; font-size: 13px; color: var(--accent); }

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn-primary-sm {
  padding: 11px 24px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary-sm:hover { opacity: 0.9; }

.btn-new {
  padding: 9px 18px;
  background: var(--accent-glow);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-new:hover { background: rgba(0, 212, 255, 0.25); }

.btn-ghost {
  padding: 11px 24px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg-dim);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.btn-ghost:hover { border-color: var(--fg-dim); }

.success-banner {
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  color: #00e676;
  margin-bottom: 24px;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-dim);
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.modal-close:hover { border-color: var(--fg-dim); }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-brand, .nav-item span:last-child, .sidebar-logout { display: none; }
  .nav-icon { font-size: 20px; }
  .nav-item { justify-content: center; padding: 16px; }
  .dash-main { margin-left: 64px; padding: 24px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .sidebar { display: none; }
  .dash-main { margin-left: 0; padding: 16px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .appt-card { flex-direction: column; align-items: flex-start; }
  .modal { padding: 24px; }
}
