/* Heartland Asset Group — Dashboard styles */
/* Navy + gold palette matching main site */

:root {
  --navy: #1a2744;
  --navy-dark: #0f1a2e;
  --navy-mid: #243459;
  --gold: #c8a24a;
  --gold-light: #e8c97a;
  --gold-dim: rgba(200, 162, 74, 0.15);
  --text: #2a2a2a;
  --text-muted: #6b7280;
  --bg: #f0f2f7;
  --card-bg: #ffffff;
  --border: #e2e6ee;
  --danger: #d9534f;
  --success: #3d8c40;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(26,39,68,0.08);
  --shadow-lg: 0 8px 32px rgba(26,39,68,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Auth Gate ─────────────────────────────────────────── */

.auth-gate {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.auth-box {
  background: white;
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  width: 360px;
}

.auth-logo {
  width: 56px; height: 56px;
  background: var(--navy);
  color: var(--gold);
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  margin: 0 auto 1.5rem;
}

.auth-box h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.auth-box p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; }

.auth-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 1rem;
  background: var(--bg);
}

.auth-input:focus { outline: none; border-color: var(--gold); }

.auth-btn {
  width: 100%;
  background: var(--navy);
  color: var(--gold);
  border: none;
  padding: 0.875rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-btn:hover { background: var(--navy-mid); }

.auth-error { color: var(--danger); font-size: 0.8rem; margin-top: 0.5rem; }

/* ── Top Bar ───────────────────────────────────────────── */

.topbar {
  background: var(--navy);
  color: white;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

.topbar-logo {
  width: 36px; height: 36px;
  background: var(--gold);
  color: var(--navy-dark);
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}

.topbar-name { font-size: 0.95rem; font-weight: 600; line-height: 1.2; }
.topbar-sub { font-size: 0.7rem; opacity: 0.55; }

.topbar-stats { display: flex; gap: 0.75rem; flex: 1; flex-wrap: wrap; }

.stat-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  min-width: 120px;
}

.stat-card.stat-fees { border-color: rgba(200,162,74,0.4); }

.stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; margin-bottom: 0.2rem; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--gold); }

.topbar-actions { margin-left: auto; }

.btn-add-lead {
  background: var(--gold);
  color: var(--navy-dark);
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.btn-add-lead:hover { background: var(--gold-light); }

/* ── Filters ────────────────────────────────────────────── */

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

.filter-group { display: flex; align-items: center; gap: 0.5rem; }
.filter-group label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.filter-group select {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
}
.filter-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--gold); }

.btn-clear {
  background: none;
  border: 1px solid var(--border);
  padding: 0.4rem 0.875rem;
  border-radius: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-clear:hover { background: var(--bg); }

/* ── Kanban Board ───────────────────────────────────────── */

.kanban-board {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  overflow-x: auto;
  min-height: calc(100vh - 180px);
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 240px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
}

.col-header {
  padding: 0.6rem 0.875rem;
  border-radius: 8px 8px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: white;
}

.col-new { background: #4a7ab5; }
.col-contacted { background: #7b68c4; }
.col-hot_lead { background: var(--gold); color: var(--navy-dark); }
.col-under_contract { background: #e67e22; }
.col-assigned { background: #27ae60; }
.col-closed { background: var(--navy); }
.col-dead { background: #7f8c8d; }

.col-count {
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.col-cards {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.5rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 0.15s;
}

.col-cards.drag-over { background: rgba(200,162,74,0.12); border-color: var(--gold); }

/* ── Deal Cards ─────────────────────────────────────────── */

.deal-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
  box-shadow: var(--shadow);
}

.deal-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.deal-card:active { cursor: grabbing; }
.deal-card.dragging { opacity: 0.5; }

.deal-card.hot::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 3px 3px 0 0;
  margin: -0.75rem -0.75rem 0.5rem;
}

.deal-address {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.deal-seller {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.deal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.deal-badge {
  background: var(--bg);
  color: var(--navy);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.deal-badge.hot-badge { background: var(--gold-dim); color: #8a6a1a; border-color: rgba(200,162,74,0.3); }

.deal-footer { display: flex; justify-content: space-between; align-items: center; }
.deal-fee { font-size: 0.8rem; font-weight: 700; color: var(--navy); }
.deal-days { font-size: 0.65rem; color: var(--text-muted); }
.deal-days.urgent { color: var(--danger); }

/* ── Modal ──────────────────────────────────────────────── */

.modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  width: 680px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: var(--navy);
}

.modal-close {
  background: none; border: none; font-size: 1.5rem;
  color: var(--text-muted); cursor: pointer; line-height: 1;
}

.modal-close:hover { color: var(--navy); }

/* ── Lead Detail ───────────────────────────────────────── */

.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.lead-detail-field { display: flex; flex-direction: column; gap: 0.2rem; }
.lead-detail-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.lead-detail-value { font-size: 0.875rem; color: var(--text); font-weight: 500; }
.lead-detail-value.highlight { color: var(--navy); font-size: 1rem; }

.lead-detail-full { grid-column: 1 / -1; }
.lead-detail-full textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 80px;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
}

.notes-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }

.note-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.875rem;
}

.note-header { display: flex; justify-content: space-between; margin-bottom: 0.3rem; }
.note-date { font-size: 0.7rem; color: var(--text-muted); }
.note-author { font-size: 0.7rem; font-weight: 600; color: var(--navy); }
.note-text { font-size: 0.85rem; color: var(--text); line-height: 1.4; }

.status-timeline { margin-bottom: 1.5rem; }

.timeline-entry {
  display: flex; gap: 0.75rem; padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 0.3rem;
  flex-shrink: 0;
}

.timeline-date { color: var(--text-muted); min-width: 100px; }
.timeline-status { font-weight: 600; color: var(--navy); }
.timeline-by { color: var(--text-muted); }

/* ── Forms ─────────────────────────────────────────────── */

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.625rem 0.875rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--gold);
}

.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }
.btn-cancel { background: none; border: 1px solid var(--border); padding: 0.625rem 1.5rem; border-radius: 6px; font-size: 0.875rem; cursor: pointer; color: var(--text-muted); }
.btn-save { background: var(--navy); color: var(--gold); border: none; padding: 0.625rem 1.5rem; border-radius: 6px; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.btn-save:hover { background: var(--navy-mid); }

.add-note-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.add-note-row textarea { flex: 1; border: 1px solid var(--border); border-radius: 6px; padding: 0.625rem; font-size: 0.85rem; font-family: 'Inter', sans-serif; }
.add-note-row button { background: var(--gold); color: var(--navy-dark); border: none; padding: 0.625rem 1rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; }

/* ── Status Selector ───────────────────────────────────── */

.status-select-wrap { margin-bottom: 1rem; }
.status-select-wrap label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 0.3rem; }
.status-select-wrap select { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; font-size: 0.875rem; }

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .topbar { padding: 0.75rem; gap: 0.75rem; }
  .topbar-stats { gap: 0.5rem; }
  .stat-card { min-width: 90px; padding: 0.4rem 0.6rem; }
  .stat-value { font-size: 1rem; }
  .kanban-board { padding: 0.75rem; gap: 0.5rem; }
  .kanban-col { flex: 0 0 200px; min-width: 200px; }
  .lead-detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal-content { padding: 1.25rem; }
}

@media (max-width: 480px) {
  .topbar-stats { display: none; }
  .kanban-col { flex: 0 0 170px; min-width: 170px; }
}