/* ===================== DASHBOARD LAYOUT ===================== */
.dashboard-page {
  padding: 2rem 0;
  min-height: calc(100vh - var(--navbar-h));
}

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-title {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin-bottom: 0.25rem;
}

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

/* ===================== STATS CARDS ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
}

.stat-card-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-card-icon.success { background: #E8F8F5; color: var(--success); }
.stat-card-icon.accent { background: #EBF4FB; color: var(--accent); }
.stat-card-icon.warning { background: #FEF9E7; color: #B7791F; }

.stat-card-info { flex: 1; }
.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--text-primary);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.stat-card-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.4rem;
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--danger); }

/* ===================== DASHBOARD SECTIONS ===================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

.dashboard-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}

.dashboard-section-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-section-title {
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-heading);
}

/* ===================== TABLE ===================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg); }

.table-prop-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.table-prop-img {
  width: 52px; height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.table-prop-info .title {
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.table-prop-info .meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.table-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.action-btn {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.action-btn.edit {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.action-btn.edit:hover { background: var(--accent); color: #fff; }

.action-btn.delete {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}
.action-btn.delete:hover { background: var(--danger); color: #fff; }

.action-btn.view {
  border-color: var(--border);
  color: var(--text-secondary);
  background: transparent;
}
.action-btn.view:hover { background: var(--bg); }

/* Status dots */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
}
.status-dot.active::before { background: var(--success); }
.status-dot.sold::before { background: var(--accent); }
.status-dot.rented::before { background: var(--warning); }
.status-dot.pending::before { background: var(--warning); }
.status-dot.closed::before { background: var(--text-muted); }

/* ===================== LEADS INBOX ===================== */
.lead-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: background 0.15s ease;
}
.lead-item:last-child { border-bottom: none; }
.lead-item:hover { background: var(--bg); }
.lead-item.unread { background: var(--primary-light); }

.lead-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.lead-body { flex: 1; min-width: 0; }
.lead-name { font-weight: 700; font-size: 0.875rem; }
.lead-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.lead-message { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.35rem; line-height: 1.5; }
.lead-property { font-size: 0.78rem; color: var(--accent); font-weight: 600; margin-top: 0.25rem; }
.lead-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }

.lead-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}
.lead-time { font-size: 0.72rem; color: var(--text-muted); }

/* ===================== ADD LISTING FORM ===================== */
.listing-wizard {
  max-width: 700px;
}

.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}

.wizard-step {
  flex: 1;
  padding: 0.6rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  position: relative;
}

.wizard-step.completed { background: var(--primary-light); color: var(--primary); }
.wizard-step.active { background: var(--primary); color: #fff; }
.wizard-step-num { display: block; font-size: 0.7rem; font-weight: 700; }

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-muted);
}
.photo-upload-area:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.photo-upload-area.drag-over { border-color: var(--primary); background: var(--primary-light); }

.photo-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.photo-preview-item {
  position: relative;
  width: 80px; height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
}
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-remove {
  position: absolute;
  top: 2px; right: 2px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 50%;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
}

/* ===================== MANAGER DASHBOARD ===================== */
.agent-card-manager {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease;
}
.agent-card-manager:hover { box-shadow: var(--shadow-md); }

.agent-manager-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
}
.agent-manager-avatar img { width: 100%; height: 100%; object-fit: cover; }
.agent-manager-info { flex: 1; min-width: 0; }
.agent-manager-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-manager-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.agent-manager-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}
.agent-manager-stat { text-align: center; }
.agent-manager-stat .val { font-weight: 700; font-size: 1rem; font-family: var(--font-heading); }
.agent-manager-stat .lbl { color: var(--text-muted); font-size: 0.7rem; }

.commission-config {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
}
.commission-config-title { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.75rem; }

.report-filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

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

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stat-card { padding: 1rem; }
  .stat-card-value { font-size: 1.4rem; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.6rem 0.75rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat-card { flex-direction: column; gap: 0.5rem; }
  .stat-card-icon { width: 36px; height: 36px; font-size: 1rem; }
  .stat-card-value { font-size: 1.25rem; }
}
