/* ============================================================
   Property CRM – Main Stylesheet
   ============================================================ */

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

:root {
  --bg: #f7f4f0;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #e5e2dd;
  --border-light: #f0ece7;
  --text: #1a1a1a;
  --text-muted: #7a7570;
  --text-light: #a09890;
  --accent: #1a1a1a;
  --accent-hover: #333;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;

  /* Pipeline stage colours */
  --stage-new: #7c3aed;
  --stage-contacted: #2563eb;
  --stage-viewing: #d97706;
  --stage-reserved: #059669;
  --stage-exchanged: #0891b2;
  --stage-closed: #6b7280;

  /* Unit status colours */
  --status-available: #16a34a;
  --status-reserved: #d97706;
  --status-completed: #1a1a1a;
  --status-not_released: #9ca3af;
}

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

/* ──────────────────────────────────────────────
   Layout
   ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow-y: auto;
}

#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#topbar {
  position: sticky;
  top: 0;
  background: rgba(247,244,240,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
}

#content {
  padding: 32px 28px 48px;
  max-width: 1200px;
  width: 100%;
}

/* ──────────────────────────────────────────────
   Sidebar
   ────────────────────────────────────────────── */
.sidebar-logo {
  padding: 20px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-logo-mark {
  width: 32px; height: 32px;
  background: var(--text);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
}
.sidebar-workspace {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-section {
  padding: 18px 10px 8px;
}
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-size: 14px;
  font-weight: 450;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--bg); color: var(--text); font-weight: 550; }
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.nav-item-count {
  margin-left: auto;
  font-size: 11px;
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 6px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-dev-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13.5px;
  color: var(--text-muted);
}
.sidebar-dev-item:hover { background: var(--bg); color: var(--text); }
.sidebar-dev-item.active { background: var(--bg); color: var(--text); font-weight: 500; }
.sidebar-dev-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 10px;
  border-top: 1px solid var(--border-light);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sidebar-user:hover { background: var(--bg); }
.sidebar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 500; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }

/* ──────────────────────────────────────────────
   Topbar
   ────────────────────────────────────────────── */
#search-box {
  flex: 1;
  max-width: 400px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
#search-box:focus { border-color: #bbb; }
#search-box::placeholder { color: var(--text-light); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ──────────────────────────────────────────────
   Typography
   ────────────────────────────────────────────── */
.page-eyebrow {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}
.page-title {
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.5px;
  line-height: 1.15;
  font-family: Georgia, 'Times New Roman', serif;
  margin-bottom: 4px;
}
.page-sub {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

h2 { font-size: 20px; font-weight: 500; letter-spacing: -0.3px; }
h3 { font-size: 15px; font-weight: 600; }

/* ──────────────────────────────────────────────
   Buttons
   ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.12s, opacity 0.12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--border-light); color: var(--text); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 7px; }

/* ──────────────────────────────────────────────
   Cards
   ────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-sm { padding: 14px; }

/* ──────────────────────────────────────────────
   Stats row
   ────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -1px;
  font-family: Georgia, serif;
  line-height: 1;
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ──────────────────────────────────────────────
   Development cards
   ────────────────────────────────────────────── */
.dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.dev-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.dev-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-1px); }
.dev-card-img {
  width: 100%; height: 170px;
  object-fit: cover;
  background: var(--bg);
}
.dev-card-img-placeholder {
  width: 100%; height: 170px;
  background: linear-gradient(135deg, #e8e4df 0%, #d4cec9 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}
.dev-card-body { padding: 16px; }
.dev-card-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.badge-live { background: #dcfce7; color: #15803d; }
.badge-coming { background: #fef3c7; color: #92400e; }
.badge-sold { background: #f1f5f9; color: #64748b; }
.dev-card-name { font-size: 16px; font-weight: 600; margin-bottom: 3px; letter-spacing: -0.2px; }
.dev-card-location { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.dev-card-stats {
  display: flex; gap: 16px;
  font-size: 12.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}
.dev-card-stat strong { color: var(--text); font-weight: 600; }

/* ──────────────────────────────────────────────
   Inventory bar
   ────────────────────────────────────────────── */
.inventory-bar-wrap { margin: 20px 0; }
.inventory-bar {
  height: 8px;
  border-radius: 4px;
  background: #e5e7eb;
  overflow: hidden;
  display: flex;
  margin-bottom: 10px;
}
.inventory-bar-segment { height: 100%; transition: width 0.3s; }
.inv-available { background: var(--status-available); }
.inv-reserved { background: var(--status-reserved); }
.inv-completed { background: var(--status-completed); }
.inventory-legend {
  display: flex; gap: 20px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.inv-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ──────────────────────────────────────────────
   Table
   ────────────────────────────────────────────── */
.table-wrap {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: #faf9f7; }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: #faf9f7; }
.td-muted { color: var(--text-muted); font-size: 12.5px; }
.td-name { font-weight: 500; }
.td-email { font-size: 12px; color: var(--text-muted); }

/* ──────────────────────────────────────────────
   Badges / Pills
   ────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stage-new { background: #f3e8ff; color: var(--stage-new); }
.stage-contacted { background: #dbeafe; color: var(--stage-contacted); }
.stage-viewing { background: #fef3c7; color: var(--stage-viewing); }
.stage-reserved { background: #d1fae5; color: var(--stage-reserved); }
.stage-exchanged { background: #cffafe; color: var(--stage-exchanged); }
.stage-closed { background: #f3f4f6; color: var(--stage-closed); }

.status-available { background: #dcfce7; color: #15803d; }
.status-reserved { background: #fef3c7; color: #92400e; }
.status-exchanged { background: #e0f2fe; color: #0369a1; }
.status-completed { background: #f1f5f9; color: #1e293b; }
.status-not_released { background: #f3f4f6; color: #6b7280; }

/* Multi-select status toggle buttons */
.status-toggle-group { display:flex; flex-wrap:wrap; gap:6px; }
.status-toggle { padding:4px 12px; border-radius:20px; border:1.5px solid #e5e7eb; background:#fff;
  font-size:12px; font-weight:500; cursor:pointer; transition:all .15s; color:#6b7280; }
.status-toggle:hover { border-color:#9ca3af; }
.status-toggle.active-available { background:#dcfce7; color:#15803d; border-color:#86efac; }
.status-toggle.active-reserved { background:#fef3c7; color:#92400e; border-color:#fcd34d; }
.status-toggle.active-exchanged { background:#e0f2fe; color:#0369a1; border-color:#7dd3fc; }
.status-toggle.active-completed { background:#f1f5f9; color:#1e293b; border-color:#cbd5e1; }
.status-toggle.active-not_released { background:#f3f4f6; color:#6b7280; border-color:#d1d5db; }

.source-pill { background: #f1f5f9; color: #475569; font-size: 11.5px; padding: 2px 7px; border-radius: 4px; font-weight: 500; }

/* ──────────────────────────────────────────────
   Pipeline Kanban
   ────────────────────────────────────────────── */
.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}
.kanban-col {
  flex: 0 0 240px;
  min-width: 240px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-title { font-size: 13px; font-weight: 600; }
.kanban-col-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--border-light);
  border-radius: 10px;
  padding: 1px 7px;
}
.kanban-cards { display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.1s, transform 0.1s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.07); transform: translateY(-1px); }
.kanban-card-name { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.kanban-card-dev { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; }
.kanban-empty {
  background: #faf9f7;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
}

/* ──────────────────────────────────────────────
   Lead detail
   ────────────────────────────────────────────── */
.lead-detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.detail-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  gap: 16px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--text-muted); flex-shrink: 0; }
.detail-row-value { text-align: right; font-weight: 450; word-break: break-word; }

.property-hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  height: 200px;
  margin-bottom: 16px;
}
.property-hero img { width: 100%; height: 100%; object-fit: cover; }
.property-hero-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  padding: 16px;
  color: white;
}
.property-hero-dev { font-size: 11px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.06em; }
.property-hero-plot { font-size: 22px; font-weight: 600; font-family: Georgia, serif; }

/* Pipeline stage selector */
.pipeline-stages {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pipeline-stage-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 13.5px;
  color: var(--text-muted);
}
.pipeline-stage-btn:hover { background: var(--bg); }
.pipeline-stage-btn.active { background: var(--bg); color: var(--text); font-weight: 550; }
.pipeline-stage-btn .stage-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  flex-shrink: 0;
}
.pipeline-stage-btn.active .stage-indicator {
  background: currentColor;
}

/* ──────────────────────────────────────────────
   Activity timeline
   ────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  margin-top: 2px;
}
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 13.5px; font-weight: 500; }
.activity-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.activity-time { font-size: 11.5px; color: var(--text-light); margin-top: 3px; }

/* ──────────────────────────────────────────────
   Forms / Modals
   ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 20px;
  overflow-y: auto;
}
.modal {
  background: white;
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  position: relative;
}
.modal-lg { max-width: 700px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; border-radius: 4px;
  font-size: 20px; line-height: 1;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.form-label-muted { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: white;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #999; }
.form-textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ──────────────────────────────────────────────
   Toast notifications
   ────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #1a1a1a;
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: all;
  animation: toast-in 0.2s ease;
}
.toast-success { background: #166534; }
.toast-error { background: #991b1b; }
@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ──────────────────────────────────────────────
   Empty states
   ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.empty-state-sub { font-size: 13.5px; }

/* ──────────────────────────────────────────────
   Dashboard welcome banner
   ────────────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: white;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.welcome-date { font-size: 12px; opacity: 0.6; margin-bottom: 6px; }
.welcome-title { font-family: Georgia, serif; font-size: 28px; font-weight: 400; margin-bottom: 6px; }
.welcome-sub { font-size: 13px; opacity: 0.7; }
.welcome-actions { display: flex; gap: 10px; flex-shrink: 0; }
.btn-white { background: white; color: #1a1a1a; border: none; }
.btn-white:hover { background: #f0f0f0; }
.btn-outline-white { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }
.btn-outline-white:hover { background: rgba(255,255,255,0.1); }

/* ──────────────────────────────────────────────
   Email inbox
   ────────────────────────────────────────────── */
.email-list { display: flex; flex-direction: column; }
.email-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
.email-item:hover { background: #faf9f7; }
.email-item.processed { opacity: 0.5; }
.email-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0;
  color: var(--text-muted);
}
.email-meta { flex: 1; min-width: 0; }
.email-from { font-size: 13.5px; font-weight: 600; }
.email-subject { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
.email-preview { font-size: 12.5px; color: var(--text-light); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.email-time { font-size: 11.5px; color: var(--text-muted); }

/* ──────────────────────────────────────────────
   Settings
   ────────────────────────────────────────────── */
.settings-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.settings-section-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

/* ──────────────────────────────────────────────
   Search results
   ────────────────────────────────────────────── */
.search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 200;
  max-height: 360px;
  overflow-y: auto;
  margin-top: 4px;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border-light);
}
.search-result-item:hover { background: var(--bg); }
.search-result-item:last-child { border-bottom: none; }
.search-result-icon { color: var(--text-muted); flex-shrink: 0; }
.search-result-title { font-size: 13.5px; font-weight: 500; }
.search-result-sub { font-size: 12px; color: var(--text-muted); }

/* ──────────────────────────────────────────────
   Loading spinner
   ────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center { display: flex; justify-content: center; align-items: center; min-height: 200px; }

/* ──────────────────────────────────────────────
   Tabs
   ────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab-count {
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  margin-left: 5px;
}

/* ──────────────────────────────────────────────
   Misc utilities
   ────────────────────────────────────────────── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.font-semibold { font-weight: 600; }
.mt-auto { margin-top: auto; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
  border: none;
  background: none;
  padding: 0;
}
.back-link:hover { color: var(--text); }

/* ──────────────────────────────────────────────
   Chart bar (mini bar chart)
   ────────────────────────────────────────────── */
.mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 48px; }
.mini-bar { flex: 1; background: var(--border-light); border-radius: 3px 3px 0 0; min-width: 8px; transition: height 0.3s; }
.mini-bar-active { background: var(--text); }

/* ──────────────────────────────────────────────
   Scrollbar styling
   ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* ──────────────────────────────────────────────
   Responsive
   ────────────────────────────────────────────── */
@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .lead-detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
