/* ===== DESIGN TOKENS ===== */
:root {
  --navy:    #1a2340;
  --gold:    #c9a84c;
  --blue:    #2b52d4;
  --green:   #0aaf6e;
  --red:     #ef4444;
  --purple:  #7c4ddb;
  --orange:  #f59e0b;
  --bg:      #f0f2f7;
  --surface: #ffffff;
  --border:  #e8edf5;
  --muted:   #8a9bbf;
  --text:    #1a2340;
  --text-sm: #64748b;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; font-size: 14px; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 64px; min-height: 100vh; background: var(--navy);
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 0; position: fixed; left: 0; top: 0; z-index: 100;
  transition: width 0.25s ease, transform 0.25s ease; overflow: hidden;
}
@media (min-width: 769px) { .sidebar:hover { width: 220px; } }

/* Hamburger — hidden on desktop */
.hamburger-btn {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: 8px; color: var(--navy); font-size: 20px;
  line-height: 1; transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--bg); }

/* Sidebar overlay (mobile backdrop) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 99; opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

.logo { display: flex; align-items: center; gap: 10px; padding: 0 16px 20px; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.08); overflow: hidden; }
.logo-icon { font-size: 22px; flex-shrink: 0; }
.logo-text { color: #fff; font-size: 15px; font-weight: 800; white-space: nowrap; opacity: 0; transition: opacity 0.2s; }
.sidebar:hover .logo-text { opacity: 1; }

/* PROFILE */
.profile-card { display: flex; align-items: center; gap: 10px; padding: 14px 16px; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.08); overflow: hidden; }
.profile-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); flex-shrink: 0; }
.profile-info { opacity: 0; transition: opacity 0.2s; white-space: nowrap; overflow: hidden; }
.sidebar:hover .profile-info { opacity: 1; }
.profile-name { color: #fff; font-size: 13px; font-weight: 700; }
.profile-title { color: var(--muted); font-size: 10px; }
.profile-phone { color: var(--gold); font-size: 10px; font-weight: 600; }
.profile-email { color: var(--muted); font-size: 10px; }

/* NAV */
nav { display: flex; flex-direction: column; padding: 8px 0; width: 100%; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 11px 20px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all 0.2s; cursor: pointer; white-space: nowrap; width: 100%;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: rgba(201,168,76,0.12); color: var(--gold); border-left-color: var(--gold); }
.nav-icon { font-size: 18px; flex-shrink: 0; }
.nav-text { opacity: 0; transition: opacity 0.2s; }
.sidebar:hover .nav-text { opacity: 1; }

/* APPS SECTION */
.apps-section { padding: 8px 0; width: 100%; border-top: 1px solid rgba(255,255,255,0.08); margin-top: auto; }
.apps-title { color: rgba(255,255,255,0.3); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 8px 20px 4px; white-space: nowrap; opacity: 0; }
.sidebar:hover .apps-title { opacity: 1; }
.app-link {
  display: flex; align-items: center; gap: 14px; padding: 8px 20px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500;
  transition: all 0.2s; white-space: nowrap; width: 100%;
}
.app-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.app-link-blue { color: #7da8f5 !important; }
.app-link-green { color: #5dd4a0 !important; }
.app-icon { font-size: 16px; flex-shrink: 0; }
.app-text { opacity: 0; transition: opacity 0.2s; white-space: nowrap; }
.sidebar:hover .app-text { opacity: 1; }
.app-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 12px; }

/* ===== MAIN ===== */
.main { margin-left: 64px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ===== TOPBAR ===== */
.topbar {
  background: #fff; padding: 10px 24px; display: flex;
  align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.topbar-title { font-size: 18px; font-weight: 800; color: var(--navy); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* COMPACT QUICK APPS BAR */
.quick-apps-bar { display: flex; gap: 4px; align-items: center; }
.qa-btn {
  width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; text-decoration: none;
  background: var(--bg); transition: all 0.15s; cursor: pointer;
  border: 1px solid transparent;
}
.qa-btn:hover { background: var(--navy); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.15); }

/* ===== SECTIONS ===== */
.section { display: none; padding: 20px 24px; flex-direction: column; gap: 16px; }
.section.active { display: flex; }

/* ===== ACTION CARDS ===== */
.action-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.action-card {
  background: #fff; border-radius: 14px; padding: 18px 16px; cursor: pointer;
  border: 1.5px solid var(--border); transition: all 0.2s; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.action-card:hover { border-color: var(--blue); box-shadow: 0 6px 20px rgba(43,82,212,0.12); transform: translateY(-2px); }
.action-card:first-child { border-color: var(--gold); background: linear-gradient(135deg, #fffbf0, #fff); }
.action-card:first-child:hover { border-color: var(--gold); box-shadow: 0 6px 20px rgba(201,168,76,0.2); }
.action-icon { font-size: 28px; margin-bottom: 8px; }
.action-label { font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.action-sub { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.stat-card {
  border-radius: 14px; padding: 18px 16px; background: #fff;
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.stat-card.blue   { border-top: 3px solid var(--blue); }
.stat-card.green  { border-top: 3px solid var(--green); }
.stat-card.orange { border-top: 3px solid var(--gold); }
.stat-card.purple { border-top: 3px solid #7c4ddb; }
.stat-card.teal   { border-top: 3px solid #0891b2; }
.stat-card.fire   { border-top: 3px solid #f97316; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 32px; font-weight: 900; color: var(--navy); line-height: 1; }
.stat-sub { font-size: 11px; color: #aab4cc; }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); border: 1px solid var(--border); }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--navy); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filters { display: flex; gap: 8px; align-items: center; }
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== TABLE ===== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #f8f9fc; padding: 9px 12px; text-align: left; font-weight: 700; color: var(--muted); border-bottom: 2px solid #f0f0f0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.table td { padding: 10px 12px; border-bottom: 1px solid #f5f5f5; color: #333; vertical-align: middle; }
.table tr:hover td { background: #fafbff; }
.empty { text-align: center; color: #ccc; font-style: italic; padding: 32px !important; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-nuevo       { background: #e8f4fd; color: #1a7fc4; }
.badge-contactado  { background: #fff3e0; color: #e65100; }
.badge-cita        { background: #e8f5e9; color: #2e7d32; }
.badge-negociacion { background: #f3e5f5; color: #7b1fa2; }
.badge-cerrado     { background: #e0f2f1; color: #00695c; }
.badge-perdido     { background: #fce4ec; color: #c62828; }
.interest-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 700; background: #ede7f6; color: #4527a0; }

/* ===== BUTTONS ===== */
.btn-primary { background: var(--navy); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary:hover { background: var(--blue); }
.btn-secondary { background: var(--bg); color: #333; border: none; border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-danger { background: #fce4ec; color: #c62828; border: none; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.btn-sm { background: var(--bg); color: #444; border: none; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.btn-sm:hover { background: #e8edf5; }

/* ===== INPUTS ===== */
input, select, textarea { width: 100%; border: 1.5px solid #e0e0e0; border-radius: 8px; padding: 9px 12px; font-size: 13px; color: #333; background: #fafafa; transition: border 0.2s; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); background: #fff; }
textarea { resize: vertical; min-height: 72px; }
.input-sm { width: auto; padding: 7px 10px; font-size: 12px; }

/* ===== FORM ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.3px; }
.full-width { grid-column: 1 / -1; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 18px; width: 90%; max-width: 540px; max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: 0 24px 64px rgba(0,0,0,0.2); }
.modal-wide { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h2 { font-size: 17px; font-weight: 800; }
.modal-close { background: var(--bg); border: none; border-radius: 50%; width: 30px; height: 30px; font-size: 18px; cursor: pointer; color: #888; display: flex; align-items: center; justify-content: center; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; padding-top: 14px; border-top: 1px solid #f0f0f0; }

/* ===== PIPELINE ===== */
.pipeline-board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0; align-items: flex-start; min-height: 60vh; }
.pipeline-col { min-width: 190px; max-width: 200px; flex-shrink: 0; background: #f8f9fc; border-radius: 12px; padding: 12px; border: 1px solid var(--border); }
.pipeline-col-title { font-size: 12px; font-weight: 800; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; text-transform: uppercase; letter-spacing: 0.5px; }
.pipeline-count { background: #e8edf5; color: #666; border-radius: 10px; padding: 2px 7px; font-size: 10px; }
.pipeline-card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); cursor: pointer; transition: all 0.15s; border: 1px solid #f0f0f0; }
.pipeline-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); border-color: #e0e8ff; }
.pipeline-card-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.pipeline-card-meta { font-size: 11px; color: #aaa; }
.pipeline-card-budget { font-size: 12px; color: var(--blue); font-weight: 700; margin-top: 6px; }

/* ===== FUNNEL ===== */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 10px; }
.funnel-label { font-size: 11px; color: #666; width: 90px; text-align: right; font-weight: 600; }
.funnel-bar-wrap { flex: 1; background: var(--bg); border-radius: 6px; height: 20px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 6px; display: flex; align-items: center; padding-left: 8px; font-size: 10px; color: #fff; font-weight: 700; transition: width 0.6s ease; }
.funnel-count { font-size: 12px; font-weight: 700; color: #333; width: 22px; }

/* ===== FOLLOW-UP ===== */
.followup-list { display: flex; flex-direction: column; gap: 8px; }
.followup-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: #fffbeb; border-radius: 10px; border-left: 3px solid #f59e0b; cursor: pointer; transition: all 0.2s; }
.followup-item:hover { background: #fef3c7; }
.followup-item.overdue { background: #fef2f2; border-left-color: var(--red); }
.followup-name { font-weight: 700; font-size: 13px; }
.followup-date { font-size: 11px; color: #888; margin-top: 2px; }

/* ===== TEMPLATES ===== */
.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.template-card { background: #f8f9fc; border-radius: 10px; padding: 14px; border: 1px solid var(--border); }
.template-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--blue); }
.template-body { font-size: 12px; color: #666; line-height: 1.5; white-space: pre-wrap; }
.template-copy { margin-top: 10px; background: #eef2ff; color: var(--blue); border: none; border-radius: 6px; padding: 6px 12px; font-size: 11px; cursor: pointer; font-weight: 700; }

/* ===== LEAD DETAIL ===== */
.lead-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.lead-detail-item label { font-size: 10px; color: #aaa; display: block; margin-bottom: 2px; text-transform: uppercase; font-weight: 700; }
.lead-detail-item span { font-size: 14px; font-weight: 600; }
.notes-box { background: #f8f9fc; border-radius: 8px; padding: 12px; font-size: 13px; color: #555; line-height: 1.5; }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item { font-size: 12px; color: #555; padding: 7px 10px; background: #f8f9fc; border-radius: 8px; display: flex; justify-content: space-between; }
.history-date { font-size: 10px; color: #bbb; }

/* ===== CALENDAR ===== */
.calendar-grid { display: flex; flex-direction: column; gap: 8px; }
.calendar-day { padding: 12px 14px; background: #f8f9fc; border-radius: 10px; border: 1px solid var(--border); }
.calendar-day-title { font-weight: 700; font-size: 12px; margin-bottom: 8px; color: var(--navy); }
.calendar-lead { font-size: 12px; color: #555; padding: 5px 0; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; cursor: pointer; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; opacity: 0; transform: translateY(8px); transition: all 0.3s; z-index: 9999; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }

.text-muted { color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ===== PRE-CALIFICACIÓN WIZARD ===== */
.qualify-wrapper {
  width: 100%; display: flex; flex-direction: column; gap: 20px;
}

/* LIVE RATES BANNER */
.rate-banner {
  background: var(--navy); border-radius: 14px; padding: 14px 20px;
  box-shadow: 0 4px 16px rgba(26,35,64,0.2);
}
.rate-loading { color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 600; }
.rate-banner-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.rate-source { display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255,255,255,0.5); white-space: nowrap; }
.rate-tag { padding: 3px 8px; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.5px; }
.rate-tag.live { background: rgba(10,175,110,0.2); color: #5dd4a0; }
.rate-tag.fallback { background: rgba(245,158,11,0.2); color: #fbbf24; }
.rate-items { display: flex; align-items: center; gap: 0; flex: 1; flex-wrap: wrap; }
.rate-item { display: flex; flex-direction: column; align-items: center; padding: 0 20px; }
.rate-item.highlight .rate-val { color: #5dd4a0; }
.rate-lbl { font-size: 10px; color: rgba(255,255,255,0.45); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; white-space: nowrap; }
.rate-val { font-size: 20px; font-weight: 900; color: #fff; line-height: 1; }
.rate-val.green { color: #5dd4a0; }
.rate-sep { width: 1px; height: 36px; background: rgba(255,255,255,0.1); }

/* Progress bar at top */
.qual-progress {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 14px; padding: 18px 48px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05); border: 1px solid var(--border);
}
.qual-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; }
.qstep-dot {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 15px; font-weight: 900;
  background: #e8edf5; color: #aab4cc; transition: all 0.3s;
}
.qual-step.active .qstep-dot { background: var(--navy); color: #fff; box-shadow: 0 4px 12px rgba(26,35,64,0.3); }
.qual-step.done   .qstep-dot { background: #0aaf6e; color: #fff; }
.qstep-label { font-size: 11px; font-weight: 700; color: #aab4cc; text-transform: uppercase; letter-spacing: 0.8px; white-space: nowrap; }
.qual-step.active .qstep-label { color: var(--navy); }
.qual-step.done   .qstep-label { color: #0aaf6e; }
.qstep-line { flex: 1; height: 2px; background: #e8edf5; min-width: 60px; margin: 0 16px 18px; transition: background 0.3s; }
.qstep-line.done { background: #0aaf6e; }

/* Panels */
.qual-panel { background: #fff; border-radius: 16px; padding: 36px 40px; box-shadow: 0 2px 6px rgba(0,0,0,0.05); border: 1px solid var(--border); }
.qual-panel.hidden { display: none; }
.qual-title { font-size: 24px; font-weight: 900; color: var(--navy); margin-bottom: 6px; }
.qual-sub { font-size: 14px; color: var(--muted); margin-bottom: 32px; }

/* Step 1 — Type cards */
.type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.type-card {
  border: 2px solid #e8edf5; border-radius: 18px; padding: 36px 24px;
  text-align: center; cursor: pointer; transition: all 0.22s; background: #fafbff;
  position: relative; overflow: hidden;
}
.type-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 60%, rgba(43,82,212,0.04)); }
.type-card:hover { border-color: var(--blue); background: #f0f4ff; transform: translateY(-4px); box-shadow: 0 12px 32px rgba(43,82,212,0.15); }
.type-card:nth-child(2):hover { border-color: var(--gold); background: #fffbf0; box-shadow: 0 12px 32px rgba(201,168,76,0.18); }
.type-card:nth-child(3):hover { border-color: #0aaf6e; background: #f0fff8; box-shadow: 0 12px 32px rgba(10,175,110,0.15); }
.type-icon { font-size: 52px; margin-bottom: 14px; display: block; }
.type-name { font-size: 18px; font-weight: 900; color: var(--navy); margin-bottom: 8px; }
.type-desc { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Step 2 — Qual form */
.qual-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 28px; }
.qual-field { display: flex; flex-direction: column; gap: 6px; }
.qual-field label { font-size: 12px; font-weight: 700; color: #444; text-transform: uppercase; letter-spacing: 0.4px; }
.qual-field .hint { font-size: 11px; color: #b0bbcc; margin-top: 2px; }
.qual-nav { display: flex; justify-content: space-between; align-items: center; padding-top: 22px; border-top: 1px solid #f0f0f0; }

/* Step 3 — Result */
.qual-result-header {
  display: flex; align-items: center; gap: 20px; padding: 28px 24px;
  border-radius: 16px; margin-bottom: 24px;
}
.qual-result-header.qualified { background: linear-gradient(135deg, #f0fff8, #e6f9f0); border: 2px solid #0aaf6e; }
.qual-result-header.not-qualified { background: linear-gradient(135deg, #fff5f5, #fee8e8); border: 2px solid #ef4444; }
.qual-result-icon { font-size: 56px; flex-shrink: 0; }
.qual-result-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 4px; }
.qual-result-label.qualified { color: #0aaf6e; }
.qual-result-label.not-qualified { color: #ef4444; }
.qual-result-value { font-size: 32px; font-weight: 900; color: var(--navy); line-height: 1.1; }
.qual-result-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.qual-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.qual-metric {
  background: #f8f9fc; border-radius: 14px; padding: 18px 16px;
  border: 1px solid var(--border); text-align: center;
}
.qual-metric-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.qual-metric-value { font-size: 20px; font-weight: 900; color: var(--navy); }
.qual-metric-value.good { color: #0aaf6e; }
.qual-metric-value.warn { color: #f59e0b; }
.qual-metric-value.bad  { color: #ef4444; }

.qual-zones { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.qual-zone-chip {
  background: #eef2ff; color: var(--blue); border-radius: 20px;
  padding: 7px 16px; font-size: 13px; font-weight: 700; border: 1px solid #d5e0ff;
}

.qual-tips { background: #fffbeb; border-radius: 14px; padding: 18px 20px; border-left: 4px solid #f59e0b; }
.qual-tips-title { font-size: 13px; font-weight: 800; color: #92400e; margin-bottom: 10px; }
.qual-tips ul { padding-left: 18px; }
.qual-tips li { font-size: 13px; color: #78350f; margin-bottom: 6px; line-height: 1.4; }

/* ===== QUAL RESULT COMPONENTS ===== */

/* Hero banner */
.qr-hero {
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 18px; padding: 28px 32px; margin-bottom: 20px; gap: 24px;
}
.qr-hero.ok   { background: linear-gradient(135deg, #e8f4ff 0%, #f0fff8 100%); border: 2px solid #0aaf6e; }
.qr-hero.warn { background: linear-gradient(135deg, #fff9ed 0%, #fff5f5 100%); border: 2px solid #f59e0b; }
.qr-hero-left { flex: 1; }
.qr-badge {
  display: inline-block; padding: 4px 14px; border-radius: 20px;
  font-size: 11px; font-weight: 800; letter-spacing: 1px; margin-bottom: 10px;
}
.qr-badge.ok   { background: #dcfce7; color: #15803d; }
.qr-badge.warn { background: #fef3c7; color: #92400e; }
.qr-big-number { font-size: 42px; font-weight: 900; color: var(--navy); line-height: 1; margin-bottom: 6px; }
.qr-big-label  { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.qr-hero-meta  { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: #555; }
.qr-hero-meta strong { color: var(--navy); }

/* Score ring */
.qr-hero-score { flex-shrink: 0; }
.qr-score-ring {
  width: 110px; height: 110px; border-radius: 50%;
  background: conic-gradient(var(--score-color) 0%, #e8edf5 0%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px white, 0 0 0 6px var(--score-color);
}
.qr-score-inner { text-align: center; }
.qr-score-num   { font-size: 22px; font-weight: 900; color: var(--navy); line-height: 1; }
.qr-score-lbl   { font-size: 9px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
.qr-score-rating { font-size: 10px; font-weight: 700; color: var(--score-color); margin-top: 2px; }

/* Metric row */
.qr-metrics-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px;
}
.qr-metric {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 12px; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04); transition: transform 0.15s;
}
.qr-metric:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.qr-m-icon  { font-size: 22px; margin-bottom: 6px; }
.qr-m-val   { font-size: 16px; font-weight: 900; color: var(--navy); margin-bottom: 4px; }
.qr-m-lbl   { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }

/* Charts */
.qr-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.qr-chart-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.qr-chart-title { font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 14px; }
.qr-chart-wrap  { height: 200px; position: relative; }
.qr-chart-wrap canvas { max-height: 200px; }
.qr-chart-total { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Bottom info row */
.qr-bottom-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; margin-top: 16px; }
.qr-zone-card, .qr-tips-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.qr-zone-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f5f5f5; font-size: 13px; font-weight: 600; color: var(--navy);
}
.qr-zone-row:last-child { border-bottom: none; }
.qr-zone-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex-shrink: 0; }
.qr-step-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid #f5f5f5; font-size: 13px; color: #444; line-height: 1.4;
}
.qr-step-row:last-of-type { border-bottom: none; }
.qr-step-num { color: var(--blue); font-weight: 900; font-size: 16px; line-height: 1.2; flex-shrink: 0; }
.qr-cta {
  margin-top: 14px; background: var(--navy); color: #fff; border-radius: 10px;
  padding: 11px 16px; font-size: 13px; font-weight: 700; text-align: center;
}
.qr-trend-big { font-size: 40px; font-weight: 900; color: #0aaf6e; margin: 8px 0; }

/* Loan badges row */
.qr-loan-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.qr-loan-badge {
  background: #f0f4ff; border: 1px solid #d5e0ff; border-radius: 8px;
  padding: 5px 12px; font-size: 11px; font-weight: 700; color: var(--blue);
}

/* Programs */
.qr-programs { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.qr-programs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.qr-program-card { display: flex; align-items: flex-start; gap: 12px; background: #f8f9fc; border-radius: 10px; padding: 12px 14px; border: 1px solid var(--border); }
.qr-prog-icon { font-size: 22px; flex-shrink: 0; }
.qr-prog-name { font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 3px; }
.qr-prog-benefit { font-size: 11px; color: var(--muted); line-height: 1.4; }

/* ===== COMMISSION TRACKER ===== */
.comm-goal-card { padding: 20px 24px 16px; }
.comm-goal-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.comm-progress-wrap { margin-top: 8px; }
.comm-progress-bar { width: 100%; height: 14px; background: #e8edf5; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.comm-progress-fill { height: 100%; background: linear-gradient(90deg, #0aaf6e, #c9a84c); border-radius: 99px; width: 0%; transition: width 0.8s cubic-bezier(.4,0,.2,1); }
.comm-progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; }
.comm-calc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 16px; align-items: end; }
.comm-calc-result { display: flex; flex-direction: column; gap: 6px; background: #f8f9fc; border-radius: 10px; padding: 12px 16px; border: 1px solid var(--border); min-width: 180px; }
.calc-res-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #555; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.calc-res-item:last-child { border-bottom: none; padding-bottom: 0; }

/* ===== CMA TOOL ===== */
.cma-price-range { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 16px; }
.cma-price-item { text-align: center; padding: 18px 12px; border-radius: 12px; border: 2px solid #e8edf5; }
.cma-price-item.low { background: #fef2f2; border-color: #fecaca; }
.cma-price-item.mid { background: #f0fdf4; border-color: #bbf7d0; transform: scale(1.04); box-shadow: 0 4px 16px rgba(10,175,110,0.12); }
.cma-price-item.high { background: #eff6ff; border-color: #bfdbfe; }
.cma-p-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.cma-p-val { font-size: 24px; font-weight: 900; color: var(--navy); }
.cma-price-item.low .cma-p-val { color: #ef4444; }
.cma-price-item.mid .cma-p-val { color: #0aaf6e; font-size: 28px; }
.cma-price-item.high .cma-p-val { color: var(--blue); }
.cma-header-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== HERRAMIENTAS ===== */
.qr-tool-wrap { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; margin-top: 14px; }
.qr-tool-wrap canvas, .qr-tool-wrap #qr-canvas-wrap { border: 2px solid #e8edf5; border-radius: 10px; padding: 10px; background: #fff; }
.qr-tool-info { flex: 1; min-width: 220px; }
.signature-preview { background: #f8f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin-top: 14px; overflow-x: auto; }
.market-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.market-item { background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px; padding: 16px 12px; text-align: center; transition: transform 0.2s, box-shadow 0.2s; }
.market-item:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.market-icon { font-size: 24px; margin-bottom: 8px; }
.market-val { font-size: 20px; font-weight: 900; color: var(--navy); }
.market-lbl { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ===== EBBA ALERT BANNER ===== */
.ebba-alert-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(135deg, #fff1f2, #fef2f2);
  border: 2px solid #fca5a5; border-left: 5px solid #ef4444;
  border-radius: 12px; padding: 14px 18px; margin-bottom: 20px;
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border { 0%,100%{border-left-color:#ef4444} 50%{border-left-color:#f87171} }
.ebba-alert-icon { font-size: 26px; flex-shrink: 0; }
.ebba-alert-body { flex: 1; min-width: 200px; }
.ebba-alert-body strong { font-size: 14px; color: #991b1b; display: block; margin-bottom: 4px; }
.ebba-alert-names { font-size: 12px; color: #7f1d1d; }
.ebba-inline-alert {
  background: #fff1f2; border: 1.5px solid #fca5a5; border-radius: 8px;
  padding: 8px 12px; font-size: 12px; color: #991b1b; margin: 8px 0; font-weight: 600;
}

/* ===== CONTRACTS SECTION ===== */
.contract-alert-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff7ed; border: 2px solid #fed7aa; border-left: 5px solid #f97316;
  border-radius: 12px; padding: 16px 20px; margin-bottom: 14px;
}
.contract-alert-left { flex: 1; min-width: 200px; }
.contract-alert-name { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.contract-alert-sub { font-size: 12px; color: #9a3412; }

.contract-gen-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 20px; }
.contract-types-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 10px; }
.contract-type-info { display: flex; gap: 10px; align-items: flex-start; background: #f8f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.contract-type-info > span { font-size: 22px; flex-shrink: 0; }
.contract-type-info strong { font-size: 13px; font-weight: 800; color: var(--navy); display: block; margin-bottom: 2px; }
.contract-type-info p { font-size: 11px; color: var(--muted); margin: 0; line-height: 1.4; }
.contract-type-info.req { border-color: #fde68a; background: #fffbeb; }
.ctag { display: inline-block; background: #fef3c7; color: #92400e; font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: 99px; margin-bottom: 3px; letter-spacing: .3px; }

/* Send for signing button */
.btn-sign-send { padding: 10px 18px; background: #25D366; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .2s; }
.btn-sign-send:hover { background: #1da851; }

/* Inline sign link box */
.sign-link-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.sign-url-row { margin-bottom: 12px; }
.sign-url-input { flex: 1; min-width: 200px; padding: 10px 12px; border: 2px solid #6ee7b7; border-radius: 8px; font-size: 12px; background: #fff; color: var(--navy); font-family: monospace; }
.btn-wa-big { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px 20px; background: #25D366; color: #fff; border: none; border-radius: 12px; font-size: 15px; font-weight: 800; cursor: pointer; text-decoration: none; transition: background .2s; }
.btn-wa-big:hover { background: #1da851; }

/* Showing count badge in lead rows */
.showing-badge { background: #e0e7ff; color: var(--blue); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; margin-left: 6px; }
.showing-badge.alert { background: #fee2e2; color: #991b1b; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .qr-metrics-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .action-row { grid-template-columns: repeat(2, 1fr); }
  .qr-charts-row { grid-template-columns: 1fr; }
  .qr-bottom-row  { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .type-cards { grid-template-columns: 1fr; }
  .qual-form { grid-template-columns: 1fr; }
  .action-row { grid-template-columns: repeat(2, 1fr); }
  .qr-metrics-row { grid-template-columns: repeat(2, 1fr); }
  .qr-hero { flex-direction: column; }
  .qr-big-number { font-size: 30px; }
  .comm-calc-grid { grid-template-columns: 1fr 1fr; }
  .cma-price-range { grid-template-columns: 1fr; }
  .cma-price-item.mid { transform: none; }
  .market-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-tool-wrap { flex-direction: column; }
}

/* ===== NAV BADGE ===== */
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; background: var(--red);
  color: #fff; border-radius: 99px; font-size: 10px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 4px; flex-shrink: 0;
}

/* ===== LEAD SCORE ===== */
.score-icon { font-size: 14px; margin-right: 4px; cursor: default; vertical-align: middle; }
.row-overdue { background: #fff8f0 !important; }
.overdue-date { color: var(--red); font-weight: 700; font-size: 12px; }

/* ===== WA BUTTONS ===== */
.btn-wa { background: #e7fdf0; color: #166534; border: 1px solid #bbf7d0; border-radius: 6px; padding: 5px 9px; font-size: 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.btn-wa:hover { background: #25D366; color: #fff; border-color: #25D366; }
.pipe-wa-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: #e7fdf0; color: #166534; border: 1px solid #bbf7d0; border-radius: 6px; font-size: 11px; cursor: pointer; text-decoration: none; font-weight: 600; }
.pipe-wa-btn:hover { background: #25D366; color: #fff; border-color: #25D366; }

/* ===== PIPELINE DRAG & DROP ===== */
.pipeline-col-title { padding-bottom: 8px; margin-bottom: 10px; }
.pipeline-col.drag-over { background: #e8f0fe !important; border: 2px dashed var(--blue) !important; }
.pipeline-card.dragging { opacity: 0.45; transform: rotate(2deg); box-shadow: 0 12px 28px rgba(0,0,0,0.2); pointer-events: none; }
.pipe-score { font-size: 15px; flex-shrink: 0; }
.pipe-empty { color: #bbb; font-size: 12px; text-align: center; padding: 20px 8px; border: 2px dashed #e0e0e0; border-radius: 8px; }

@media (max-width: 768px) {
  /* Sidebar: hidden off-screen until toggled */
  .sidebar { transform: translateX(-100%); width: 240px !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay { display: block; }

  /* Main: full width */
  .main { margin-left: 0 !important; }

  /* Topbar */
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  .hamburger-btn { display: flex; }
  .quick-apps-bar { display: none; }

  /* Sections */
  .section { padding: 12px 10px; gap: 12px; }
  .card { padding: 14px 12px; }

  /* Grids: force single column on small screens */
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .action-row  { grid-template-columns: repeat(2, 1fr); }
  .dash-row    { grid-template-columns: 1fr; }
  .form-grid   { grid-template-columns: 1fr; }
  .pipeline-board { flex-direction: column; }
  .pipeline-col   { min-width: unset; width: 100%; }
  .contract-gen-row { flex-direction: column; gap: 10px; }

  /* Contract editor: stack sidebar above preview */
  .ce-body { flex-direction: column; }
  .ce-sidebar { width: 100% !important; min-width: unset; max-height: 45vh; border-right: none; border-bottom: 1px solid var(--border); }
  .ce-actions { gap: 4px; }
  .btn-ce { padding: 7px 10px; font-size: 11px; }

  /* Tables: scroll horizontally */
  .table-wrap, .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Modal */
  .modal { width: 96vw; max-height: 92vh; margin: 4vh auto 0; }
  .modal-body { padding: 14px; }

  /* Topbar backup buttons: show only icons */
  .backup-label { display: none; }
}

/* ===== CONTRACT EDITOR MODAL ===== */
.modal-editor { position: fixed; inset: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; margin: 0; padding: 0; z-index: 1001; display: none; flex-direction: column; background: #fff; }
.modal-editor.open { display: flex; }
.ce-header { background: var(--navy); color: #fff; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; }
.ce-title { font-size: 16px; font-weight: 800; }
.ce-client { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ce-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-ce { padding: 8px 14px; border: none; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-ce-save  { background: #334155; color: #94a3b8; }
.btn-ce-print { background: #1e3a5f; color: #93c5fd; }
.btn-ce-sign  { background: #0aaf6e; color: #fff; }
.ce-body { display: flex; flex: 1; overflow: hidden; }
.ce-sidebar { width: 340px; min-width: 300px; background: #f8f9fc; border-right: 1px solid var(--border); overflow-y: auto; padding: 16px; flex-shrink: 0; }
.ce-sec-title { font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); margin: 14px 0 8px; }
.ce-row { margin-bottom: 10px; }
.ce-lbl { display: block; font-size: 11px; font-weight: 700; color: #64748b; margin-bottom: 4px; }
.ce-inp { width: 100%; padding: 8px 10px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px; background: #fff; color: var(--navy); transition: border-color .15s; box-sizing: border-box; }
.ce-inp:focus { outline: none; border-color: var(--gold); }
.ce-inp:disabled { background: var(--bg); color: #94a3b8; cursor: not-allowed; }
textarea.ce-inp { resize: vertical; min-height: 80px; font-family: inherit; }
.ce-preview { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ce-preview-label { background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 16px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .5px; flex-shrink: 0; }
.ce-iframe { flex: 1; border: none; width: 100%; }
.field.filled { background: #fef9c3; border-bottom: 2px solid #c9a84c; border-radius: 2px; padding: 0 3px; }

/* ===== MONTHLY CALENDAR ===== */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-month-title { font-size: 15px; font-weight: 800; color: var(--navy); text-transform: capitalize; }
.cal-nav-btn { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; font-size: 15px; cursor: pointer; color: var(--navy); font-weight: 700; transition: all 0.15s; }
.cal-nav-btn:hover { background: var(--navy); color: #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-hdr { text-align: center; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 0; }
.cal-cell { min-height: 72px; background: #f8f9fc; border-radius: 8px; border: 1px solid var(--border); padding: 4px 6px; transition: background 0.15s; }
.cal-cell.cal-empty { background: transparent; border-color: transparent; }
.cal-cell.cal-today { background: #eef2ff; border-color: var(--blue); }
.cal-cell.cal-overdue-day { background: #fff1f1; border-color: #fca5a5; }
.cal-day-num { font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 3px; }
.cal-today .cal-day-num, .cal-today-num { color: var(--blue); }
.cal-lead-tag { display: block; font-size: 10px; font-weight: 700; background: #dbeafe; color: #1e40af; border-radius: 4px; padding: 1px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: background 0.15s; }
.cal-lead-tag:hover { background: var(--blue); color: #fff; }
.cal-tag-late { background: #fee2e2 !important; color: #991b1b !important; }
.cal-tag-late:hover { background: var(--red) !important; color: #fff !important; }
.cal-summary { margin-top: 12px; font-size: 12px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }
.cal-summary span { font-weight: 700; color: var(--navy); }

/* ===== DORMANT LEADS ===== */
.dormant-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: #faf8ff; border-radius: 10px; border-left: 3px solid #7c4ddb; margin-bottom: 8px; gap: 12px; transition: background 0.15s; }
.dormant-item:hover { background: #f3eeff; }
.dormant-info { flex: 1; min-width: 0; }
.dormant-name { font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 2px; }
.dormant-meta { font-size: 11px; color: var(--muted); }
.dormant-days { font-size: 11px; font-weight: 800; color: #7c4ddb; background: #ede9fe; border-radius: 99px; padding: 2px 9px; white-space: nowrap; flex-shrink: 0; }

/* ===== PROPERTY CARDS ===== */
.prop-cards-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.prop-card { background: #f8f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; transition: box-shadow 0.15s; }
.prop-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.prop-card-main { flex: 1; min-width: 0; }
.prop-addr { font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 3px; }
.prop-meta { font-size: 11px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.prop-meta span { background: #e8edf5; border-radius: 99px; padding: 1px 7px; font-weight: 700; }
.prop-notes { font-size: 12px; color: #555; line-height: 1.4; margin-top: 4px; }
.prop-card-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.prop-link-btn { font-size: 11px; font-weight: 700; color: var(--blue); text-decoration: none; background: #eef2ff; border-radius: 6px; padding: 4px 9px; transition: background 0.15s; }
.prop-link-btn:hover { background: var(--blue); color: #fff; }
.prop-remove-btn { background: #fce4ec; color: #c62828; border: none; border-radius: 6px; padding: 4px 9px; font-size: 11px; cursor: pointer; font-weight: 700; transition: background 0.15s; }
.prop-remove-btn:hover { background: #ef4444; color: #fff; }

/* ===== SOCIAL MEDIA HUB ===== */

/* Header card */
.sm-header-card { padding: 20px 22px 0; margin-bottom: 0 !important; }
.sm-hero { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.sm-hero-title { font-size: 20px; font-weight: 900; color: var(--navy); }
.sm-hero-sub   { font-size: 13px; color: var(--muted); margin-top: 3px; }
.sm-hero-actions { display: flex; gap: 8px; }

/* Tabs */
.sm-tabs { display: flex; gap: 4px; border-top: 1px solid var(--border); padding-top: 12px; flex-wrap: wrap; }
.sm-tab-btn {
  padding: 8px 18px; border: 1.5px solid var(--border); border-radius: 8px 8px 0 0;
  background: #f8f9fc; color: var(--muted); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.15s; border-bottom: none; margin-bottom: -1px;
}
.sm-tab-btn:hover { background: #eef2ff; color: var(--navy); }
.sm-tab-btn.active { background: #fff; color: var(--navy); border-color: var(--border); border-bottom-color: #fff; }

/* Action buttons */
.sm-capcut-big { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; background: #1a1a1a; color: #fff; border-radius: 8px; font-size: 13px; font-weight: 700; text-decoration: none; transition: background 0.15s; }
.sm-capcut-big:hover { background: #333; }
.sm-buffer-big { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; background: #2c4bff; color: #fff; border-radius: 8px; font-size: 13px; font-weight: 700; text-decoration: none; transition: background 0.15s; }
.sm-buffer-big:hover { background: #1a38e8; }

/* ---- CALENDAR ---- */
.sm-cal-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.sm-cal-title  { font-size: 16px; font-weight: 800; color: var(--navy); }
.sm-cal-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.sm-leg { padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.sm-cal-grid   { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.sm-cal-hdr    { text-align: center; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 5px 0; }
.sm-cal-cell   { min-height: 68px; background: #f8f9fc; border-radius: 8px; border: 1px solid var(--border); padding: 4px 5px; transition: background 0.1s; }
.sm-cal-empty  { background: transparent !important; border-color: transparent !important; }
.sm-today-cell { background: #eef2ff; border-color: var(--blue); }
.sm-has-post   { cursor: default; }
.sm-cal-daynum { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.sm-today-num  { color: var(--blue); font-size: 12px; }
.sm-cal-tag    { font-size: 10px; font-weight: 700; border-radius: 4px; padding: 2px 5px; cursor: pointer; transition: opacity 0.15s; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-cal-tag:hover { opacity: 0.75; }
.sm-cal-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; gap: 8px; }

/* ---- POSTS ---- */
.sm-posts-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.sm-posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.sm-post-card  { background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sm-post-head  { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.sm-post-type-badge { font-size: 12px; font-weight: 800; color: var(--navy); background: #e8edf5; border-radius: 99px; padding: 3px 10px; }
.sm-post-day   { font-size: 11px; color: var(--muted); font-weight: 600; }
.sm-post-body  { font-size: 12px; line-height: 1.55; color: #444; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; font-family: inherit; margin: 0; flex: 1; }
.sm-post-foot  { display: flex; gap: 6px; flex-wrap: wrap; }
.sm-copy-btn   { padding: 6px 12px; background: var(--navy); color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s; }
.sm-copy-btn:hover { background: var(--blue); }
.sm-buf-btn    { padding: 6px 12px; background: #2c4bff; color: #fff; border-radius: 6px; font-size: 12px; font-weight: 700; text-decoration: none; transition: background 0.15s; }
.sm-buf-btn:hover { background: #1a38e8; }
.sm-ig-btn     { padding: 6px 12px; background: linear-gradient(135deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color: #fff; border-radius: 6px; font-size: 12px; font-weight: 700; text-decoration: none; }

/* ---- VIDEO SCRIPTS ---- */
.sm-videos-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; background: #1a1a1a; border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.sm-videos-banner strong { color: #fff; font-size: 14px; display: block; margin-bottom: 3px; }
.sm-videos-banner span   { color: #aaa; font-size: 12px; }
.sm-scripts-list  { display: flex; flex-direction: column; gap: 14px; }
.sm-script-card   { background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.sm-script-head   { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sm-script-title  { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 3px; }
.sm-script-meta   { font-size: 12px; color: var(--muted); font-weight: 600; }
.sm-capcut-btn    { padding: 6px 14px; background: #1a1a1a; color: #fff; border-radius: 6px; font-size: 12px; font-weight: 700; text-decoration: none; }
.sm-capcut-btn:hover { background: #333; }
.sm-scenes        { display: flex; flex-direction: column; gap: 8px; }
.sm-scene         { display: flex; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.sm-scene-num     { font-size: 10px; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; margin-top: 2px; min-width: 52px; }
.sm-scene-txt     { font-size: 12px; color: #444; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* ---- CONFIG ---- */
.sm-config-wrap { display: flex; flex-direction: column; gap: 0; }
.sm-cfg-inp { width: 100%; padding: 9px 12px; border: 1.5px solid #e0e0e0; border-radius: 8px; font-size: 13px; background: #fafafa; transition: border 0.2s; font-family: inherit; }
.sm-cfg-inp:focus { outline: none; border-color: var(--blue); background: #fff; }
.sm-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; margin-top: 14px; }
.sm-tool-card  { display: flex; flex-direction: column; align-items: center; gap: 6px; background: #f8f9fc; border: 1.5px solid var(--border); border-radius: 12px; padding: 18px 12px; text-align: center; text-decoration: none; color: var(--navy); transition: all 0.15s; }
.sm-tool-card:hover { border-color: var(--blue); background: #eef2ff; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(43,82,212,0.1); }
.sm-tool-card strong { font-size: 13px; font-weight: 800; }
.sm-tool-card span   { font-size: 11px; color: var(--muted); line-height: 1.3; }

/* ---- WORKFLOW ---- */
.sm-workflow { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.sm-wf-step  { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; background: #f8f9fc; border-radius: 10px; border: 1px solid var(--border); }
.sm-wf-num   { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; flex-shrink: 0; }
.sm-wf-body  { display: flex; flex-direction: column; gap: 3px; }
.sm-wf-body strong { font-size: 13px; color: var(--navy); font-weight: 800; }
.sm-wf-body span   { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ---- SEND / SCHEDULE BUTTONS ---- */
.sm-send-btn        { padding: 6px 12px; background: #7c4ddb; color: #fff; border: none; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s; }
.sm-send-btn:hover  { background: #6d3fc9; }
.sm-schedule-all-btn { padding: 9px 18px; background: #7c4ddb; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.15s; white-space: nowrap; }
.sm-schedule-all-btn:hover { background: #6d3fc9; }

/* ---- MAKE.COM SETUP STEPS ---- */
.sm-setup-steps   { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.sm-setup-step    { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: #f8f9fc; border-radius: 10px; border: 1px solid var(--border); }
.sm-setup-num     { width: 26px; height: 26px; border-radius: 50%; background: #7c4ddb; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; flex-shrink: 0; margin-top: 1px; }
.sm-setup-body    { display: flex; flex-direction: column; gap: 2px; }
.sm-setup-body strong { font-size: 13px; color: var(--navy); font-weight: 800; }
.sm-setup-body span   { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ===== HEYGEN MODULE ===== */
.hg-setup-banner { display:flex; align-items:center; gap:16px; background:linear-gradient(135deg,#1a2340,#2b3d6b); border-radius:14px; padding:20px 24px; color:#fff; margin-bottom:16px; }
.hg-setup-icon   { font-size:40px; flex-shrink:0; }
.hg-setup-text strong { display:block; font-size:15px; font-weight:800; margin-bottom:4px; }
.hg-setup-text span   { font-size:13px; color:rgba(255,255,255,0.7); }
.hg-config-card  { margin-bottom:16px; }
.hg-steps        { display:flex; flex-direction:column; gap:10px; margin-top:12px; }
.hg-step         { display:flex; align-items:flex-start; gap:12px; }
.hg-step-num     { width:26px; height:26px; border-radius:50%; background:var(--blue); color:#fff; font-size:12px; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top:1px; }
.hg-step-body    { display:flex; flex-direction:column; gap:2px; }
.hg-step-body strong { font-size:13px; color:var(--navy); font-weight:800; }
.hg-step-body span   { font-size:12px; color:var(--muted); line-height:1.4; }
.hg-step-body code   { background:#e8edf5; border-radius:4px; padding:1px 5px; font-size:11px; color:#1e40af; }
.hg-video-types  { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:4px; }
.hg-type-card    { border:2px solid var(--border); border-radius:12px; padding:12px 16px; cursor:pointer; text-align:center; transition:all 0.2s; background:#f8f9fc; min-width:110px; }
.hg-type-card:hover   { border-color:var(--blue); background:#eef2ff; }
.hg-type-card.selected{ border-color:var(--blue); background:#eef2ff; }
.hg-type-icon    { font-size:24px; margin-bottom:4px; }
.hg-type-name    { font-size:11px; font-weight:700; color:var(--navy); }
.hg-generate-btn { background:linear-gradient(135deg,var(--blue),#1a3aaa); font-size:14px; padding:11px 22px; }
.hg-generate-btn:hover { opacity:0.9; }
.hg-locked       { opacity:0.6; pointer-events:none; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sm-posts-grid { grid-template-columns: 1fr; }
  .sm-cal-tag    { font-size: 9px; }
  .sm-cal-cell   { min-height: 52px; }
  .sm-videos-banner { flex-direction: column; }
  .sm-script-head { flex-direction: column; }
  .sm-schedule-all-btn { font-size: 12px; padding: 8px 12px; }
}

/* ===================================================
   CLIENT GENERATION ENGINE (CGE)
   =================================================== */

/* Header card */
.cge-header-card { padding: 20px; }
.cge-hero { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
.cge-title { font-size: 20px; font-weight: 900; color: var(--navy); }
.cge-sub   { font-size: 13px; color: var(--muted); margin-top: 4px; }
.cge-hero-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.cge-hero-stat  { text-align: center; }
.cge-hero-stat span { display: block; font-size: 26px; font-weight: 900; color: var(--navy); line-height: 1; }
.cge-hero-stat small { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Tabs */
.cge-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 14px; }
.cge-tab-btn {
  padding: 8px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; background: var(--bg); color: var(--muted); transition: all 0.2s;
}
.cge-tab-btn:hover  { background: #e8edf5; color: var(--navy); }
.cge-tab-btn.active { background: var(--navy); color: #fff; }

/* Section header inside tabs */
.cge-section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

/* Mini stats row */
.cge-stats-mini { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cge-mini-stat  {
  background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 18px; text-align: center; min-width: 100px;
}
.cge-mini-stat span  { display: block; font-size: 24px; font-weight: 900; color: var(--navy); line-height: 1; }
.cge-mini-stat small { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-top: 3px; display: block; }
.cge-alert-stat { background: #fff7ed; border-color: #f59e0b; }
.cge-alert-stat span { color: #d97706; }

/* Badges */
.cge-badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.cge-badge.fb  { background: #dbeafe; color: #1e40af; }
.cge-badge.ig  { background: #fce7f3; color: #9d174d; }
.cge-badge.gg  { background: #fef9c3; color: #92400e; }
.cge-badge.zl  { background: #f0fdf4; color: #166534; }
.cge-badge.em  { background: #f5f3ff; color: #5b21b6; }
.cge-badge.wa  { background: #f0fdf4; color: #15803d; }
.cge-badge.ref { background: #fef3c7; color: #b45309; }
.cge-badge.ot  { background: #f1f5f9; color: #475569; }

/* Status dots */
.cge-status { font-size: 12px; font-weight: 700; white-space: nowrap; }
.cge-status.green  { color: #0aaf6e; }
.cge-status.orange { color: #f59e0b; }
.cge-status.muted  { color: var(--muted); }
.cge-status.blue   { color: var(--blue); }
.cge-status.purple { color: var(--purple); }
.cge-status.teal   { color: #0891b2; }
.cge-status.red    { color: var(--red); }

/* Table wrap */
.table-wrap { overflow-x: auto; }

/* CGE modal overlay (inline, uses display:flex not .open class) */
.cge-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}

/* ---- AD COPY BANK ---- */
.cge-copybank-wrap { display: flex; flex-direction: column; gap: 20px; }
.cge-copy-category {}
.cge-copy-cat-header { font-size: 13px; font-weight: 800; padding: 8px 14px; border-radius: 8px; margin-bottom: 12px; display: inline-block; }
.cge-copy-ads-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cge-copy-card { background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.cge-copy-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.cge-copy-platform { font-size: 11px; font-weight: 700; color: var(--muted); background: #e8edf5; border-radius: 99px; padding: 3px 10px; }
.cge-copy-headline { font-size: 13px; font-weight: 800; color: var(--navy); line-height: 1.3; }
.cge-copy-body  { font-size: 12px; line-height: 1.55; color: #444; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow-y: auto; font-family: inherit; margin: 0; }
.cge-copy-cta   { font-size: 11px; color: #555; background: #eef2ff; border-radius: 6px; padding: 4px 10px; }
.cge-copy-notes { font-size: 11px; color: #92400e; background: #fef9c3; border-radius: 6px; padding: 4px 10px; }

/* ---- EMAIL SEQUENCES ---- */
.cge-email-wrap { display: flex; flex-direction: column; gap: 12px; }
.cge-seq-card   { background: #f8f9fc; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cge-seq-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; cursor: pointer; transition: background 0.15s; }
.cge-seq-header:hover { background: #eef2ff; }
.cge-seq-title  { font-size: 14px; font-weight: 800; color: var(--navy); }
.cge-seq-meta   { font-size: 11px; color: var(--muted); margin-top: 3px; }
.cge-seq-arrow  { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.cge-seq-body   { border-top: 1px solid var(--border); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.cge-email-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.cge-email-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cge-email-num     { font-size: 11px; font-weight: 800; color: var(--blue); text-transform: uppercase; letter-spacing: 0.5px; }
.cge-email-subject { font-size: 12px; font-weight: 700; color: var(--navy); margin-top: 2px; }
.cge-email-body { font-size: 12px; line-height: 1.6; color: #444; background: #f8f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; font-family: inherit; margin: 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .cge-hero { flex-direction: column; }
  .cge-hero-stats { justify-content: space-between; width: 100%; }
  .cge-copy-ads-grid { grid-template-columns: 1fr; }
  .cge-tabs { gap: 4px; }
  .cge-tab-btn { font-size: 12px; padding: 7px 11px; }
}
