/* ================================================================
   NCPA Insurance CRM — crm.css
   Joseph & Mary Internal Dashboard
   ================================================================ */

:root {
  --navy:        #1a2640;
  --navy-dark:   #111a2e;
  --navy-mid:    #243352;
  --gold:        #c8922a;
  --gold-light:  #e0b060;
  --gold-pale:   #f8f0e0;
  --copper:      #b07040;
  --cream:       #faf8f4;
  --offwhite:    #f4f2ee;
  --white:       #ffffff;
  --charcoal:    #2c3444;
  --slate:       #4a5568;
  --muted:       #718096;
  --border:      #e2ddd6;
  --hot:         #e53e3e;
  --hot-pale:    #fff5f5;
  --qualified:   #38a169;
  --qual-pale:   #f0fff4;
  --nurture:     #3182ce;
  --nurture-pale:#ebf8ff;
  --manual:      #718096;
  --shadow-sm:   0 2px 8px rgba(26,38,64,0.08);
  --shadow-md:   0 4px 20px rgba(26,38,64,0.12);
  --shadow-lg:   0 8px 40px rgba(26,38,64,0.16);
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --font-display:'Playfair Display', Georgia, serif;
  --font-body:   'DM Sans', system-ui, sans-serif;
  --sidebar-w:   240px;
  --topbar-h:    64px;
  --transition:  0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font-body); background: var(--offwhite); color: var(--charcoal); -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font-body); border: none; }
input, select, textarea { font-family: var(--font-body); }

/* ================================================================
   LOGIN
================================================================ */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(140deg, var(--navy-dark) 0%, var(--navy-mid) 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.75rem 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem; margin-bottom: 1.75rem;
}
.login-shield { font-size: 2rem; color: var(--gold); }
.login-logo strong { display: block; font-family: var(--font-display); font-size: 1.05rem; color: var(--navy); }
.login-logo span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.login-card h1 { font-family: var(--font-display); font-size: 1.6rem; color: var(--navy); margin-bottom: 0.4rem; }
.login-card > p { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }

.login-form { text-align: left; }
.login-field { margin-bottom: 1.1rem; }
.login-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--navy); margin-bottom: 0.35rem; }
.login-field input {
  width: 100%; padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; color: var(--charcoal);
  transition: border-color var(--transition);
}
.login-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,146,42,0.12); }

.login-error { color: var(--hot); font-size: 0.82rem; margin-bottom: 0.75rem; min-height: 1rem; }

.btn-login {
  width: 100%; padding: 0.85rem;
  background: var(--gold); color: var(--white);
  border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700;
  transition: all var(--transition); margin-top: 0.5rem;
}
.btn-login:hover { background: var(--copper); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(200,146,42,0.3); }

.login-footer { margin-top: 2rem; font-size: 0.75rem; color: var(--muted); }

/* ================================================================
   APP LAYOUT
================================================================ */
.crm-app { display: flex; height: 100vh; overflow: hidden; }

/* ================================================================
   SIDEBAR
================================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-dark);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.brand-icon { font-size: 1.5rem; color: var(--gold); }
.brand-text strong { display: block; font-family: var(--font-display); font-size: 0.95rem; color: var(--white); }
.brand-text span { font-size: 0.7rem; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }

.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  color: rgba(255,255,255,0.6);
  background: none; width: 100%; text-align: left;
  transition: all var(--transition);
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.nav-item.active { background: var(--gold); color: var(--white); font-weight: 600; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer { padding: 1rem 0.75rem; border-top: 1px solid rgba(255,255,255,0.07); display: flex; flex-direction: column; gap: 0.5rem; }

.btn-sync {
  width: 100%; padding: 0.6rem 0.85rem;
  background: rgba(200,146,42,0.15); color: var(--gold-light);
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 600;
  transition: all var(--transition); border: 1px solid rgba(200,146,42,0.25);
}
.btn-sync:hover { background: rgba(200,146,42,0.25); }
.btn-sync.syncing { opacity: 0.7; pointer-events: none; }

#syncIcon { display: inline-block; transition: transform 0.6s ease; }
.syncing #syncIcon { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-logout {
  width: 100%; padding: 0.6rem 0.85rem;
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.45);
  border-radius: var(--radius-sm); font-size: 0.82rem;
  transition: all var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); }

/* ================================================================
   MAIN
================================================================ */
.crm-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--offwhite);
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: baseline; gap: 0.75rem; }
.topbar-left h2 { font-family: var(--font-display); font-size: 1.2rem; color: var(--navy); }
.view-subtitle { font-size: 0.8rem; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 1rem; }

.search-wrap { position: relative; }
.search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1rem; pointer-events: none; }
#searchInput {
  padding: 0.5rem 0.9rem 0.5rem 2.2rem;
  border: 1.5px solid var(--border); border-radius: 100px;
  font-size: 0.85rem; width: 220px; color: var(--charcoal);
  transition: all var(--transition);
}
#searchInput:focus { outline: none; border-color: var(--gold); width: 260px; box-shadow: 0 0 0 3px rgba(200,146,42,0.1); }

.topbar-user { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 500; color: var(--navy); }
.user-dot { width: 8px; height: 8px; background: var(--qualified); border-radius: 50%; }
.sync-time { font-size: 0.75rem; color: var(--muted); }

/* ── Views ────────────────────────────────────────────────────── */
.view { display: none; padding: 1.75rem; overflow-y: auto; flex: 1; }
.view.active { display: flex; flex-direction: column; gap: 1.5rem; }

/* ================================================================
   DASHBOARD
================================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.stat-number { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-sub { font-size: 0.72rem; color: var(--muted); margin-top: 0.3rem; }

.stat-hot { border-top: 3px solid var(--hot); }
.stat-hot .stat-number { color: var(--hot); }
.stat-qualified { border-top: 3px solid var(--qualified); }
.stat-qualified .stat-number { color: var(--qualified); }
.stat-new { border-top: 3px solid var(--gold); }
.stat-new .stat-number { color: var(--gold); }
.stat-appt { border-top: 3px solid var(--nurture); }
.stat-appt .stat-number { color: var(--nurture); }
.stat-closed { border-top: 3px solid var(--copper); }
.stat-closed .stat-number { color: var(--copper); }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}

.dash-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
}
.panel-header h3 { font-size: 0.875rem; font-weight: 700; color: var(--navy); }

.mini-lead-list { display: flex; flex-direction: column; }

.mini-lead-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  gap: 0.5rem;
}
.mini-lead-item:last-child { border-bottom: none; }
.mini-lead-item:hover { background: var(--cream); }

.mini-lead-name { font-size: 0.875rem; font-weight: 600; color: var(--navy); }
.mini-lead-type { font-size: 0.75rem; color: var(--muted); }
.mini-lead-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }

.type-breakdown { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.type-row { display: flex; align-items: center; gap: 0.75rem; }
.type-name { font-size: 0.82rem; color: var(--charcoal); min-width: 140px; }
.type-bar-wrap { flex: 1; background: var(--offwhite); border-radius: 100px; height: 8px; overflow: hidden; }
.type-bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 100px; transition: width 0.6s ease; }
.type-count { font-size: 0.8rem; font-weight: 700; color: var(--navy); min-width: 24px; text-align: right; }

/* ================================================================
   LEADS TABLE
================================================================ */
.leads-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.filter-group { display: flex; gap: 0.75rem; }
.filter-group select {
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--charcoal); background: var(--white);
  cursor: pointer; transition: border-color var(--transition);
  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='%234a5568' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}
.filter-group select:focus { outline: none; border-color: var(--gold); }
.leads-count { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

.leads-table-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex: 1;
  overflow-y: auto;
}

.leads-table { width: 100%; border-collapse: collapse; }
.leads-table thead { position: sticky; top: 0; z-index: 1; }
.leads-table th {
  padding: 0.75rem 1rem;
  background: var(--navy);
  color: rgba(255,255,255,0.85);
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  text-align: left; white-space: nowrap;
}
.leads-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem; vertical-align: middle;
}
.leads-table tbody tr { transition: background var(--transition); cursor: pointer; }
.leads-table tbody tr:hover { background: var(--cream); }
.leads-table tbody tr:last-child td { border-bottom: none; }

/* Score badge */
.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.2rem 0.6rem; border-radius: 100px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.score-badge.hot { background: var(--hot-pale); color: var(--hot); border: 1px solid rgba(229,62,62,0.2); }
.score-badge.qualified { background: var(--qual-pale); color: var(--qualified); border: 1px solid rgba(56,161,105,0.2); }
.score-badge.nurture { background: var(--nurture-pale); color: var(--nurture); border: 1px solid rgba(49,130,206,0.2); }
.score-badge.manual { background: var(--offwhite); color: var(--muted); border: 1px solid var(--border); }

/* Follow-up status pill */
.status-pill {
  display: inline-flex; align-items: center;
  padding: 0.22rem 0.65rem; border-radius: 100px;
  font-size: 0.72rem; font-weight: 700;
}
.status-pill.new { background: #fffbeb; color: #b7791f; border: 1px solid #f6ad55; }
.status-pill.called { background: #ebf8ff; color: #2b6cb0; border: 1px solid #90cdf4; }
.status-pill.appointment { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.status-pill.closed { background: #faf5ff; color: #6b46c1; border: 1px solid #d6bcfa; }

/* Action buttons in table */
.tbl-actions { display: flex; gap: 0.4rem; }
.tbl-btn {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem; font-weight: 600;
  transition: all var(--transition); white-space: nowrap;
  border: 1.5px solid transparent;
}
.tbl-btn-view { background: var(--navy); color: var(--white); }
.tbl-btn-view:hover { background: var(--navy-mid); }
.tbl-btn-call { background: transparent; color: var(--qualified); border-color: var(--qualified); }
.tbl-btn-call:hover { background: var(--qual-pale); }
.tbl-btn-email { background: transparent; color: var(--nurture); border-color: var(--nurture); }
.tbl-btn-email:hover { background: var(--nurture-pale); }

.lead-name-cell { font-weight: 600; color: var(--navy); }
.lead-sub { font-size: 0.75rem; color: var(--muted); margin-top: 0.15rem; }

.empty-state {
  text-align: center; padding: 3rem;
  color: var(--muted); font-size: 0.9rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

/* ================================================================
   MODAL
================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(17,26,46,0.7);
  z-index: 500; display: flex;
  align-items: flex-start; justify-content: center;
  padding: 1.5rem; overflow-y: auto;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 980px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.75rem;
  background: var(--navy);
  color: var(--white);
}
.modal-title-group { display: flex; align-items: center; gap: 0.75rem; }
.modal-header h2 { font-family: var(--font-display); font-size: 1.3rem; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: var(--white);
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.2); }

.modal-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0; max-height: 80vh; overflow-y: auto;
}

.modal-col { padding: 1.5rem 1.75rem; display: flex; flex-direction: column; gap: 1.25rem; }
.modal-col:first-child { border-right: 1px solid var(--border); }

.modal-section h4 {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--gold); margin-bottom: 0.75rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--border);
}

.modal-field {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-size: 0.875rem; color: var(--charcoal); margin-bottom: 0.4rem;
  line-height: 1.5;
}
.modal-field span:first-child { flex-shrink: 0; }
.modal-field a { color: var(--gold); font-weight: 600; }
.modal-field a:hover { color: var(--copper); text-decoration: underline; }

/* Score display */
.score-display { display: flex; align-items: center; gap: 1.25rem; }
.score-circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  flex-shrink: 0;
}
.score-details { display: flex; flex-direction: column; gap: 0.4rem; }
.qual-badge {
  display: inline-block; padding: 0.25rem 0.75rem;
  border-radius: 100px; font-size: 0.78rem; font-weight: 700;
}
.qual-badge.hot { background: var(--hot-pale); color: var(--hot); }
.qual-badge.qualified { background: var(--qual-pale); color: var(--qualified); }
.qual-badge.nurture { background: var(--nurture-pale); color: var(--nurture); }
.qual-badge.manual { background: var(--offwhite); color: var(--muted); }

/* Status buttons */
.status-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.status-btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 600;
  border: 1.5px solid var(--border); color: var(--charcoal); background: var(--white);
  transition: all var(--transition);
}
.status-btn:hover { border-color: var(--gold); background: var(--gold-pale); }
.status-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* Notes */
#modalNotes {
  width: 100%; padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.875rem; line-height: 1.6; color: var(--charcoal);
  resize: vertical; transition: border-color var(--transition);
}
#modalNotes:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,146,42,0.1); }

.btn-save-notes {
  margin-top: 0.6rem; padding: 0.55rem 1.25rem;
  background: var(--gold); color: var(--white);
  border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 700;
  transition: all var(--transition);
}
.btn-save-notes:hover { background: var(--copper); }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.action-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 600;
  border: 1.5px solid transparent;
  transition: all var(--transition); text-align: center;
}
.action-call { background: var(--qual-pale); color: var(--qualified); border-color: rgba(56,161,105,0.3); }
.action-call:hover { background: var(--qualified); color: var(--white); }
.action-email { background: var(--nurture-pale); color: var(--nurture); border-color: rgba(49,130,206,0.3); }
.action-email:hover { background: var(--nurture); color: var(--white); }
.action-appt { background: var(--gold-pale); color: var(--copper); border-color: rgba(200,146,42,0.3); }
.action-appt:hover { background: var(--gold); color: var(--white); }
.action-ghl { background: var(--offwhite); color: var(--navy); border-color: var(--border); }
.action-ghl:hover { background: var(--navy); color: var(--white); }

.lead-notes-text { font-size: 0.875rem; color: var(--slate); line-height: 1.7; font-style: italic; }

/* ================================================================
   TOAST
================================================================ */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--navy); color: var(--white);
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-md); z-index: 9999;
  animation: toastIn 0.25s ease;
}
.toast.success { background: var(--qualified); }
.toast.error { background: var(--hot); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-col:first-child { border-right: none; border-bottom: 1px solid var(--border); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-group { flex-wrap: wrap; }
}

/* ── CSV Import button ───────────────────────────────────────── */
.btn-import {
  display: block;
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.55);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-body);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px dashed rgba(255,255,255,0.15);
}
.btn-import:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.3);
}

/* ── Appointments ────────────────────────────────────────────── */
.appointments-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.appt-loading {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.5rem 0;
}

.appt-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.5rem 0;
  gap: 1rem;
}

.appt-book-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  transition: color var(--transition);
}
.appt-book-link:hover { color: var(--copper); text-decoration: underline; }

.appt-card {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: var(--offwhite);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  transition: all var(--transition);
}
.appt-card:hover { border-color: var(--gold); }

.appt-date-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius-sm);
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.appt-month {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-light);
  line-height: 1;
}
.appt-day {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--white);
}

.appt-card-right {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}
.appt-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
}
.appt-time {
  font-size: 0.78rem;
  color: var(--slate);
}
.appt-notes {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.1rem;
}

.appt-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.18rem 0.5rem;
  border-radius: 100px;
  margin-top: 0.2rem;
  width: fit-content;
}
.appt-confirmed { background: var(--qual-pale);    color: var(--qualified); }
.appt-showed    { background: #f0fff4;              color: #276749; }
.appt-noshow    { background: var(--hot-pale);      color: var(--hot); }
.appt-cancelled { background: var(--offwhite);      color: var(--muted); }

/* ── Appointments View ───────────────────────────────────────── */
.appt-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.appt-view-note {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-refresh-appts {
  padding: 0.5rem 1rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-refresh-appts:hover {
  border-color: var(--gold);
  background: var(--gold-pale);
}

.appt-view-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.appt-view-loading,
.appt-view-empty {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.appt-day-group { display: flex; flex-direction: column; gap: 0.75rem; }

.appt-day-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--gold-pale);
}

.appt-day-cards { display: flex; flex-direction: column; gap: 0.6rem; }

.appt-view-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all var(--transition);
}
.appt-view-card:hover { box-shadow: var(--shadow-sm); border-color: var(--gold); }
.appt-has-lead { cursor: pointer; }

.appt-view-info { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.appt-view-name { font-size: 0.95rem; font-weight: 700; color: var(--navy); }
.appt-view-time { font-size: 0.82rem; color: var(--slate); }
.appt-view-contact { font-size: 0.8rem; color: var(--muted); }
.appt-view-contact a { color: var(--gold); }
.appt-view-contact a:hover { text-decoration: underline; }
.appt-view-notes { font-size: 0.78rem; color: var(--muted); font-style: italic; margin-top: 0.15rem; }

.appt-view-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.appt-view-lead-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-pale);
  border: 1px solid rgba(200,146,42,0.3);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.appt-view-lead-btn:hover {
  background: var(--gold);
  color: var(--white);
}

/* ── Lead Management Buttons ─────────────────────────────────── */
.lead-mgmt-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lead-mgmt-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  border: 1.5px solid transparent;
  transition: all var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-mark-won {
  background: var(--qual-pale);
  color: var(--qualified);
  border-color: rgba(56,161,105,0.3);
}
.btn-mark-won:hover {
  background: var(--qualified);
  color: var(--white);
  border-color: var(--qualified);
}

.btn-close-lead {
  background: var(--nurture-pale);
  color: var(--nurture);
  border-color: rgba(49,130,206,0.3);
}
.btn-close-lead:hover {
  background: var(--nurture);
  color: var(--white);
  border-color: var(--nurture);
}

.btn-delete-lead {
  background: var(--hot-pale);
  color: var(--hot);
  border-color: rgba(229,62,62,0.25);
}
.btn-delete-lead:hover {
  background: var(--hot);
  color: var(--white);
  border-color: var(--hot);
}

/* Confirm dialog overlay */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,26,46,0.85);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: toastIn 0.2s ease;
}

.confirm-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.confirm-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.confirm-card p {
  font-size: 0.875rem;
  color: var(--slate);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-btn-cancel {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--offwhite);
  color: var(--slate);
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.confirm-btn-cancel:hover { background: var(--border); }

.confirm-btn-confirm {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  transition: all var(--transition);
  color: var(--white);
}
.confirm-btn-confirm.won    { background: var(--qualified); }
.confirm-btn-confirm.close  { background: var(--nurture); }
.confirm-btn-confirm.delete { background: var(--hot); }
.confirm-btn-confirm:hover  { opacity: 0.88; transform: translateY(-1px); }
