/* Dashboard layout + components */

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

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 12px;
  gap: 2px;
}

.sidebar-link {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: var(--bg-card);
  color: var(--fg);
}

.sidebar-logout {
  margin: 16px 12px 0;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.15s;
  display: block;
}
.sidebar-logout:hover { color: var(--fg-muted); }

/* Main content */
.dash-main {
  margin-left: 220px;
  flex: 1;
  padding: 40px 48px;
  min-width: 0;
}

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

.dash-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 4px;
}

.dash-subtitle {
  font-size: 0.9rem;
  color: var(--fg-muted);
}

.back-link {
  font-size: 0.875rem;
  color: var(--fg-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--fg-muted); }

.btn-accent {
  background: var(--accent);
  color: #0a0a0f;
  text-decoration: none;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  display: inline-block;
}
.btn-accent:hover { background: var(--accent-bright); }

/* Flash message */
.flash-success {
  background: var(--green-dim);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--green);
  margin-bottom: 24px;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
}

.stat-card--amber { border-color: rgba(245,158,11,0.2); }
.stat-card--green { border-color: rgba(34,197,94,0.15); }

.stat-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card--amber .stat-num { color: var(--accent); }
.stat-card--green .stat-num { color: var(--green); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-dim);
  font-weight: 600;
}

/* Filters */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 32px 9px 14px;
  font-size: 0.875rem;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a5a6e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.2s;
}
.filter-select:hover { border-color: rgba(255,255,255,0.12); }

.filter-clear {
  font-size: 0.8rem;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 4px 8px;
}
.filter-clear:hover { color: var(--fg-muted); }

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

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

.leads-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-dim);
  background: var(--bg-elevated);
  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: var(--bg-elevated); }

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

.lead-name { font-weight: 500; }
.lead-company {
  display: block;
  font-size: 0.78rem;
  color: var(--fg-dim);
  margin-top: 2px;
  font-weight: 400;
}

.lead-contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lead-email {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.8rem;
}
.lead-email:hover { color: var(--fg); }
.lead-phone {
  font-size: 0.78rem;
  color: var(--fg-dim);
}

.lead-project, .lead-budget {
  color: var(--fg-muted);
  font-size: 0.82rem;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-date {
  color: var(--fg-dim);
  font-size: 0.8rem;
  white-space: nowrap;
}

.lead-action {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}
.lead-action:hover { color: var(--accent-bright); }

.buyer-name { font-size: 0.82rem; color: var(--fg-muted); }
.unassigned { color: var(--fg-dim); font-size: 0.82rem; }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.status-badge--new { background: rgba(245,158,11,0.12); color: var(--accent); border: 1px solid rgba(245,158,11,0.2); }
.status-badge--contacted { background: rgba(99,102,241,0.1); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.2); }
.status-badge--qualified { background: rgba(34,197,94,0.1); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.status-badge--sold { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.status-badge--rejected { background: rgba(239,68,68,0.08); color: #fca5a5; border: 1px solid rgba(239,68,68,0.15); }

/* Vertical tags */
.vertical-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--bg-elevated);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.vertical-tag--commercial-roofing { border-color: rgba(245,158,11,0.2); color: var(--accent); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 40px;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 16px; }
.empty-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 8px;
}
.empty-sub { color: var(--fg-muted); font-size: 0.9rem; }
.empty-sub a { color: var(--accent); text-decoration: none; }
.empty-sub a:hover { text-decoration: underline; }

/* Detail page */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: start;
}

.section-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-dim);
  margin-bottom: 12px;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-row:first-child { padding-top: 0; }

.detail-row--block {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg-dim);
  font-weight: 600;
  flex-shrink: 0;
}

.detail-value {
  font-size: 0.9rem;
  color: var(--fg);
  text-align: right;
}

.detail-link {
  color: var(--accent);
  text-decoration: none;
}
.detail-link:hover { text-decoration: underline; }

.detail-notes {
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-top: 4px;
}

/* Update form */
.update-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--fg-muted);
  display: block;
  margin-bottom: 6px;
}

.dash-select,
.dash-input,
.dash-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.875rem;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.dash-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a5a6e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.dash-select:focus, .dash-input:focus, .dash-textarea:focus {
  border-color: rgba(245,158,11,0.35);
}
.dash-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

.assigned-at {
  font-size: 0.78rem;
  color: var(--fg-dim);
  margin-top: -8px;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 960px) {
  .sidebar { display: none; }
  .dash-main { margin-left: 0; padding: 24px 20px; }
  .detail-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .leads-table th:nth-child(4),
  .leads-table td:nth-child(4),
  .leads-table th:nth-child(5),
  .leads-table td:nth-child(5),
  .leads-table th:nth-child(7),
  .leads-table td:nth-child(7) {
    display: none;
  }
}
