/* Dashboard — HaulWave Call Routing */

.dashboard-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* Stats Bar */
.dash-stats {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 32px;
  margin-bottom: 16px;
  gap: 0;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 40px;
  flex: 1;
}
.dash-stat-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px;
  color: var(--text);
  letter-spacing: 1px;
  line-height: 1;
}
.dash-stat-num.accent { color: var(--accent); }
.dash-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.dash-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* Live Bar */
.live-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.live-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.live-time {
  margin-left: auto;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--text);
}

/* Main Grid */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

/* Sections */
.dash-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 0.5px;
  color: var(--text);
}
.section-header h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: var(--text);
}

/* Call Cards */
.calls-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 340px);
  overflow-y: auto;
}
.calls-list::-webkit-scrollbar { width: 4px; }
.calls-list::-webkit-scrollbar-track { background: transparent; }
.calls-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.call-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s;
}
.call-card.call-pending {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.04);
}
.call-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.call-meta { display: flex; align-items: center; gap: 10px; }
.call-time {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.call-service-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
}
.status-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid;
}
.call-body { margin-bottom: 10px; }
.call-caller {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.call-location {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.call-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.call-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  color: var(--success);
  letter-spacing: 0.5px;
}
.call-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.call-contractor {
  font-size: 12px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  padding: 8px 16px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-accent {
  background: var(--accent);
  color: #1e293b;
}
.btn-accent:hover { background: var(--accent-dim); }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.btn-outline:hover { background: rgba(245, 158, 11, 0.08); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-full { width: 100%; }

/* Aside */
.dash-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.quick-info { display: flex; flex-direction: column; gap: 12px; }
.qi-row { display: flex; justify-content: space-between; align-items: center; }
.qi-label { font-size: 13px; color: var(--text-muted); }
.qi-val { font-family: 'Bebas Neue', sans-serif; font-size: 20px; color: var(--text); letter-spacing: 0.5px; }
.qi-val.accent { color: var(--accent); }

/* Contractor List */
.contractors-list { display: flex; flex-direction: column; gap: 10px; }
.contractor-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
}
.contractor-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1e293b;
  font-size: 16px;
  flex-shrink: 0;
}
.contractor-info { flex: 1; min-width: 0; }
.contractor-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contractor-stats { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.contractor-toggle { flex-shrink: 0; }
.toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.toggle input { display: none; }
.toggle-label { font-size: 11px; color: var(--text-muted); }
.toggle input:checked + .toggle-label { color: var(--success); }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 0.5px; color: var(--text); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-call-info { font-size: 14px; color: var(--text-muted); padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-control {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-control::placeholder { color: var(--text-muted); opacity: 0.6; }

.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.checkbox-label input { accent-color: var(--accent); }

/* Empty state */
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 14px; }

/* Source Attribution */
.source-section { margin-bottom: 16px; }
.source-grid {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 4px;
}
.source-card {
  flex: 1;
  text-align: center;
  padding: 20px 16px;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.source-ads { border-color: rgba(59, 130, 246, 0.3); }
.source-organic { border-color: rgba(16, 185, 129, 0.3); }
.source-big {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px;
  letter-spacing: 1px;
  line-height: 1;
}
.source-ads .source-big { color: #3b82f6; }
.source-organic .source-big { color: var(--success); }
.source-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
}
.source-divider {
  width: 1px;
  height: 60px;
  background: var(--border);
  margin: 0 8px;
}

/* Volume Chart */
.volume-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 120px;
  padding: 8px 0;
}
.vol-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 4px;
}
.vol-bar {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(to top, var(--accent), rgba(249, 115, 22, 0.4));
  border-radius: 6px 6px 4px 4px;
  min-height: 4px;
  margin-top: auto;
}
.vol-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.vol-bar-count {
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
}

/* Analytics Tables */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.analytics-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.analytics-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table tr:hover td { background: rgba(255,255,255,0.02); }

.service-tag {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 6px;
}

.rate-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid;
}
.rate-good { color: var(--success); border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.1); }
.rate-ok { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.1); }
.rate-low { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.1); }

/* Mobile */
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .source-grid { flex-wrap: wrap; }
  .source-divider { display: none; }
  .source-card { min-width: calc(50% - 4px); }
}
@media (max-width: 600px) {
  .dash-stats { padding: 16px; gap: 0; }
  .dash-stat { padding: 0 16px; }
  .dash-stat-num { font-size: 28px; }
  .dash-aside { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .calls-list { max-height: 60vh; }
}

/* Tab Navigation */
.dash-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
}
.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dash-tab:hover { background: var(--surface-2); color: var(--text); }
.dash-tab.active { background: var(--accent-dim); color: var(--green-light); }
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--amber);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 20px;
  height: 18px;
  line-height: 1;
}

/* Bookings Table */
.booking-row { cursor: pointer; }
.booking-row:hover td { background: rgba(107,170,107,0.05); }

/* Booking Detail Panel */
.bp-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 0.5px;
  color: var(--text);
}
.bp-phone {
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-bright);
  text-decoration: none;
  margin-top: 4px;
}
.bp-phone:hover { text-decoration: underline; }
.bp-section {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bp-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.bp-row span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.bp-row strong { font-size: 14px; color: var(--text); text-align: right; }
.bp-notes-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.bp-notes { font-size: 13px; color: var(--text-muted); background: var(--surface-2); border-radius: 8px; padding: 12px; line-height: 1.5; white-space: pre-wrap; }
.bp-actions { display: flex; flex-direction: column; gap: 8px; }
.bp-actions .btn { margin-bottom: 0; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }