:root {
  --navy: #0a0a0a;
  --gold: #c8973a;
  --gold-lt: #e8b55a;
  --bg: #f7f6f3;
  --card: #ffffff;
  --border: #e5e2da;
  --text: #1c1c1c;
  --text-muted: #6b6b6b;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  margin: 0;
}

.hidden {
  display: none !important;
}

/* ---------- Login screen ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), #1a1a1a);
}

.login-card {
  background: var(--card);
  padding: 40px 36px;
  border-radius: 10px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  font-size: 24px;
  color: var(--navy);
  margin-bottom: 4px;
}

.login-card p.subtitle {
  color: var(--text-muted);
  margin: 0 0 24px;
  font-size: 14px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--navy);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.field textarea {
  resize: vertical;
  min-height: 70px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.88;
}

.btn-primary {
  background: var(--gold);
  color: #fff;
}

.btn-secondary {
  background: #efece4;
  color: var(--navy);
}

.btn-danger {
  background: #b3261e;
  color: #fff;
}

.btn-full {
  width: 100%;
}

.error-text {
  color: #b3261e;
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

/* ---------- App shell ---------- */
#app-screen header.top-bar {
  background: var(--navy);
  color: #fff;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar .brand {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--gold-lt);
}

.top-bar .user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #ddd;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 14px 28px 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--gold);
}

main {
  padding: 24px 28px 60px;
  max-width: 1300px;
  margin: 0 auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select,
.filters input {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
}

#leads-count {
  font-size: 13px;
  color: var(--text-muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

th, td {
  text-align: left;
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f1efe9;
  font-weight: 600;
  color: var(--navy);
}

.lead-row:hover {
  background: #faf8f3;
}

.empty-cell, .error-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 30px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--gold);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #eee;
  color: #444;
  text-transform: capitalize;
}

.status-new { background: #e6f0ff; color: #1d4ed8; }
.status-contacted { background: #fef3c7; color: #92400e; }
.status-left_voicemail { background: #fef3c7; color: #92400e; }
.status-email_sent { background: #ede9fe; color: #5b21b6; }
.status-interested { background: #dcfce7; color: #166534; }
.status-appointment_set { background: #dcfce7; color: #166534; }
.status-client { background: #c8973a; color: #fff; }
.status-not_interested { background: #f3f4f6; color: #6b6b6b; }
.status-dead { background: #fee2e2; color: #991b1b; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal-card {
  background: var(--card);
  border-radius: 10px;
  width: 100%;
  max-width: 640px;
  padding: 28px 30px;
}

.modal-card h2 {
  font-size: 20px;
  margin-bottom: 18px;
  color: var(--navy);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  gap: 10px;
}

.modal-actions .right {
  display: flex;
  gap: 10px;
}

/* ---------- CSV import ---------- */
.import-intro {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 640px;
  margin-bottom: 18px;
}

.csv-mapping-table th, .csv-preview-table th {
  white-space: nowrap;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin: 24px 0 10px;
}

#csv-preview-table {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

#csv-import-result {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}
