/* ATLAS V6 — CRM page augmentation (absorbs former v5-crm.css)
 *
 * V5→V6 migration 2026-06-23. Original v5-crm.css deleted post-migration
 * (verification: grep `.crm5-` = 0). All selectors translated from `.crm5-*`
 * to `.v6-crm-*` vocabulary; dark-mode and `[data-theme="light"]` blocks
 * removed per `.claude/rules/atlas-dashboard.md` hard rule #4 (single locked
 * theme, V6 light).
 *
 * Surface: People > Clients page (data-view="clientcare"). Stage tabs, hot-lead
 * leaderboard, sortable lead table, slide-in detail panel, lead-source perf.
 *
 * DATA INTEGRITY: seeded leads in js/crm.js are DEMO; "Demo data" badge fires
 * when live Lofty/atlas-fetcher data is absent. PII fields render `—` for
 * live binding; nothing fabricated.
 * ─────────────────────────────────────────────────────────────────────── */

/* ── Header actions ─────────────────────────────────────────────────── */
.v6-crm-head-actions { display: flex; align-items: center; gap: 10px; }
.v6-crm-count-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 9px var(--font-ui, Inter); letter-spacing: .12em; text-transform: uppercase;
  color: #647184; background: #f6f3ec; border: 1px solid #d7d0c3; border-radius: 999px;
  padding: 4px 11px; white-space: nowrap;
}
.v6-crm-count-chip b { color: #101722; font-weight: 800; }
.v6-crm-add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 10px var(--font-ui, Inter); letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold, #c18a25); background: rgba(193, 138, 37, 0.12);
  border: 1px solid rgba(193, 138, 37, 0.32); border-radius: 8px;
  padding: 7px 14px; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, transform .12s;
}
.v6-crm-add-btn:hover { background: rgba(193, 138, 37, 0.22); border-color: rgba(193, 138, 37, 0.55); transform: translateY(-1px); }
.v6-crm-add-btn:active { transform: translateY(0); }
.v6-crm-add-btn svg { width: 13px; height: 13px; stroke-width: 2.2; }

/* ── Stage tabs ─────────────────────────────────────────────────────── */
.v6-crm-stage-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.v6-crm-tab {
  display: inline-flex; align-items: center; gap: 7px;
  font: 700 10px var(--font-ui, Inter); letter-spacing: .08em; text-transform: uppercase;
  color: #647184; background: #fffdf8; border: 1px solid #d7d0c3; border-radius: 999px;
  padding: 6px 13px; cursor: pointer; white-space: nowrap;
  transition: color .14s, background .14s, border-color .14s;
}
.v6-crm-tab:hover { color: #101722; background: #f6f3ec; }
.v6-crm-tab .v6-crm-tab-n {
  font: 800 9px var(--font-ui, Inter);
  color: #647184; background: #f6f3ec; border-radius: 999px;
  padding: 1px 7px; min-width: 18px; text-align: center;
}
.v6-crm-tab.is-active {
  color: var(--gold, #c18a25); background: rgba(193, 138, 37, 0.12); border-color: rgba(193, 138, 37, 0.42);
}
.v6-crm-tab.is-active .v6-crm-tab-n { color: var(--gold, #c18a25); background: rgba(193, 138, 37, 0.18); }
.v6-crm-tab.is-active[data-stage="Hot"]            { color: #9c1844; background: rgba(156,24,68,.10); border-color: rgba(156,24,68,.40); }
.v6-crm-tab.is-active[data-stage="Hot"] .v6-crm-tab-n { color: #9c1844; background: rgba(156,24,68,.18); }
.v6-crm-tab.is-active[data-stage="Working"]        { color: #c79444; background: rgba(199,148,68,.12); border-color: rgba(199,148,68,.40); }
.v6-crm-tab.is-active[data-stage="Working"] .v6-crm-tab-n { color: #c79444; background: rgba(199,148,68,.20); }
.v6-crm-tab.is-active[data-stage="Under Contract"] { color: #17623a; background: rgba(23,98,58,.10); border-color: rgba(23,98,58,.36); }
.v6-crm-tab.is-active[data-stage="Under Contract"] .v6-crm-tab-n { color: #17623a; background: rgba(23,98,58,.18); }

/* ── Score leaderboard (hot-lead strip) ─────────────────────────────── */
.v6-crm-board { margin-bottom: 16px; }
.v6-crm-board-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 9px; }
.v6-crm-board-title {
  font: 700 10px var(--font-ui, Inter); letter-spacing: .14em; text-transform: uppercase;
  color: #101722;
}
.v6-crm-board-sub {
  font: 400 9px var(--font-ui, Inter); color: #8a95a3;
}
.v6-crm-board-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.v6-crm-hot {
  position: relative;
  background: rgba(255, 253, 248, 0.96); border: 1px solid #d7d0c3; border-radius: 12px;
  padding: 12px 13px 11px; display: flex; flex-direction: column; gap: 7px;
  cursor: pointer; overflow: hidden;
  transition: border-color .14s, transform .12s, box-shadow .14s;
  box-shadow: 0 4px 12px rgba(29, 24, 14, 0.06);
}
.v6-crm-hot::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--gold, #c18a25);
}
.v6-crm-hot[data-band="fire"]::before  { background: linear-gradient(180deg, #c97a40, #9c1844); }
.v6-crm-hot[data-band="amber"]::before { background: #c79444; }
.v6-crm-hot[data-band="blue"]::before  { background: #17468e; }
.v6-crm-hot:hover {
  border-color: var(--gold, #c18a25); transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(29, 24, 14, 0.14);
}
.v6-crm-hot-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.v6-crm-hot-name {
  font: 700 12.5px var(--font-ui, Inter);
  color: #101722; line-height: 1.2; min-width: 0;
}
.v6-crm-hot-interest {
  font: 400 9px var(--font-ui, Inter);
  color: #8a95a3; line-height: 1.4; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.v6-crm-hot-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: auto; padding-top: 4px;
}
.v6-crm-hot-act {
  font: 400 8.5px var(--font-ui, Inter); color: #647184;
}

/* ── Score badge ────────────────────────────────────────────────────── */
.v6-crm-score {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  font: 800 11px var(--font-ui, Inter); letter-spacing: .02em;
  border-radius: 999px; padding: 2px 9px; min-width: 38px; line-height: 1.5; white-space: nowrap;
}
.v6-crm-score[data-band="fire"]  { color: #fff; background: linear-gradient(135deg, #c97a40, #9c1844); border: 1px solid rgba(156,24,68,.55); }
.v6-crm-score[data-band="amber"] { color: #c79444; background: rgba(199,148,68,.14); border: 1px solid rgba(199,148,68,.42); }
.v6-crm-score[data-band="blue"]  { color: #17468e; background: rgba(23,70,142,.14); border: 1px solid rgba(23,70,142,.40); }
.v6-crm-score[data-band="gray"]  { color: #8a95a3; background: #f6f3ec; border: 1px solid #d7d0c3; }
.v6-crm-score .v6-crm-flame { font-size: 10px; line-height: 1; }

/* ── Stage chip ─────────────────────────────────────────────────────── */
.v6-crm-chip {
  display: inline-flex; align-items: center;
  font: 700 8.5px var(--font-ui, Inter); letter-spacing: .1em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.v6-crm-chip[data-stage="New"]            { color: var(--gold, #c18a25); background: rgba(193,138,37,.12); border: 1px solid rgba(193,138,37,.32); }
.v6-crm-chip[data-stage="Working"]        { color: #c79444; background: rgba(199,148,68,.12); border: 1px solid rgba(199,148,68,.34); }
.v6-crm-chip[data-stage="Nurturing"]      { color: #17468e; background: rgba(23,70,142,.12); border: 1px solid rgba(23,70,142,.34); }
.v6-crm-chip[data-stage="Hot"]            { color: #9c1844; background: rgba(156,24,68,.12); border: 1px solid rgba(156,24,68,.36); }
.v6-crm-chip[data-stage="Under Contract"] { color: #17623a; background: rgba(23,98,58,.10); border: 1px solid rgba(23,98,58,.30); }
.v6-crm-chip[data-stage="Dead"]           { color: #8a95a3; background: #f6f3ec; border: 1px solid #d7d0c3; }

/* ── Source icon (letter circle) ────────────────────────────────────── */
.v6-crm-src { display: inline-flex; align-items: center; gap: 7px; font: 400 11px var(--font-ui, Inter); color: #647184; white-space: nowrap; }
.v6-crm-src-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font: 800 9px var(--font-ui, Inter);
  color: #101722; background: #f6f3ec; border: 1px solid #d7d0c3; flex-shrink: 0;
}
.v6-crm-src-ic[data-src="Zillow"]      { color: #17468e; background: rgba(23,70,142,.14); border-color: rgba(23,70,142,.34); }
.v6-crm-src-ic[data-src="Realtor.com"] { color: #9c1844; background: rgba(156,24,68,.14); border-color: rgba(156,24,68,.34); }
.v6-crm-src-ic[data-src="Google"]      { color: #c79444; background: rgba(199,148,68,.16); border-color: rgba(199,148,68,.34); }
.v6-crm-src-ic[data-src="Referral"]    { color: #17623a; background: rgba(23,98,58,.14);  border-color: rgba(23,98,58,.32); }
.v6-crm-src-ic[data-src="Social"]      { color: #6e5298; background: rgba(110,82,152,.14); border-color: rgba(110,82,152,.32); }
.v6-crm-src-ic[data-src="Direct"]      { color: var(--gold, #c18a25); background: rgba(193,138,37,.14); border-color: rgba(193,138,37,.32); }

/* ── Lead table ─────────────────────────────────────────────────────── */
.v6-crm-table-wrap {
  border: 1px solid #d7d0c3; border-radius: 12px; overflow: hidden; overflow-x: auto;
  background: rgba(255, 253, 248, 0.96); margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(29, 24, 14, 0.06);
}
.v6-crm-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.v6-crm-table thead th {
  font: 700 9px var(--font-ui, Inter); letter-spacing: .12em; text-transform: uppercase;
  color: #8a95a3; padding: 10px 12px; text-align: left;
  background: rgba(193, 138, 37, 0.05); border-bottom: 1px solid #d7d0c3;
  white-space: nowrap; user-select: none;
}
.v6-crm-table thead th.is-sortable { cursor: pointer; transition: color .12s; }
.v6-crm-table thead th.is-sortable:hover { color: #101722; }
.v6-crm-sort-ind { display: inline-block; margin-left: 4px; opacity: .35; font-size: 8px; }
.v6-crm-table thead th.is-sorted .v6-crm-sort-ind { opacity: 1; color: var(--gold, #c18a25); }
.v6-crm-table tbody td {
  padding: 11px 12px; border-bottom: 1px solid #ebe7de;
  font-size: 12px; color: #101722; vertical-align: middle;
}
.v6-crm-table tbody tr:last-child td { border-bottom: 0; }
.v6-crm-table tbody tr { cursor: pointer; transition: background .12s; }
.v6-crm-table tbody tr:hover td { background: rgba(193, 138, 37, 0.05); }
.v6-crm-table tbody tr.is-open td { background: rgba(193, 138, 37, 0.08); }
.v6-crm-row-name { font: 600 12px var(--font-ui, Inter); white-space: nowrap; }
.v6-crm-row-interest { font-size: 11px; color: #647184; max-width: 200px; }
.v6-crm-row-act-cell { white-space: nowrap; }
.v6-crm-row-ts { font: 400 10.5px var(--font-ui, Inter); color: #8a95a3; white-space: nowrap; }
.v6-crm-row-agent {
  display: inline-flex; align-items: center; gap: 6px;
  font: 400 11px var(--font-ui, Inter); color: #647184; white-space: nowrap;
}
.v6-crm-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font: 800 8.5px var(--font-ui, Inter);
  color: var(--gold, #c18a25); background: rgba(193,138,37,.12);
  border: 1px solid rgba(193,138,37,.28); flex-shrink: 0;
}
.v6-crm-avatar.is-none { color: #8a95a3; background: #f6f3ec; border-color: #d7d0c3; }

/* Inline quick-action buttons */
.v6-crm-qa {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  color: #8a95a3; background: #f6f3ec; border: 1px solid #d7d0c3;
  cursor: pointer; margin-right: 4px;
  transition: color .12s, background .12s, border-color .12s;
}
.v6-crm-qa:last-child { margin-right: 0; }
.v6-crm-qa:hover { color: var(--gold, #c18a25); background: rgba(193,138,37,.10); border-color: rgba(193,138,37,.34); }
.v6-crm-qa svg { width: 13px; height: 13px; stroke-width: 1.9; }

.v6-crm-empty {
  padding: 26px 16px; text-align: center;
  font: 400 11px var(--font-ui, Inter); color: #8a95a3;
}

/* ── Lead-source performance table ──────────────────────────────────── */
.v6-crm-perf {
  background: rgba(255, 253, 248, 0.96); border: 1px solid #d7d0c3; border-radius: 12px;
  overflow: hidden; box-shadow: 0 4px 12px rgba(29, 24, 14, 0.06);
}
.v6-crm-perf-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid #d7d0c3;
}
.v6-crm-perf-title {
  font: 700 10px var(--font-ui, Inter); letter-spacing: .14em; text-transform: uppercase;
  color: #101722; flex: 1;
}
.v6-crm-perf-table { width: 100%; border-collapse: collapse; }
.v6-crm-perf-table thead th {
  font: 700 8.5px var(--font-ui, Inter); letter-spacing: .1em; text-transform: uppercase;
  color: #8a95a3; padding: 8px 14px; text-align: left;
  background: rgba(193, 138, 37, 0.05); border-bottom: 1px solid #ebe7de;
}
.v6-crm-perf-table thead th.num,
.v6-crm-perf-table tbody td.num { text-align: right; }
.v6-crm-perf-table tbody td { padding: 9px 14px; font-size: 11.5px; color: #101722; border-bottom: 1px solid #ebe7de; }
.v6-crm-perf-table tbody tr:nth-child(even) td { background: rgba(193, 138, 37, 0.025); }
.v6-crm-perf-table tbody tr:last-child td { border-bottom: 0; }
.v6-crm-perf-conv { font: 700 12px var(--font-ui, Inter); }
.v6-crm-perf-conv.is-high { color: #17623a; }
.v6-crm-perf-conv.is-mid  { color: #c79444; }
.v6-crm-perf-src { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }

/* ── Lead detail slide-in panel ─────────────────────────────────────── */
.v6-crm-scrim {
  position: fixed; inset: 0; background: rgba(15,10,4,.5);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease; z-index: 1200;
}
.v6-crm-scrim.is-open { opacity: 1; pointer-events: auto; }
.v6-crm-detail {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 92vw;
  background: rgba(255, 253, 248, 0.99); border-left: 1px solid #d7d0c3;
  box-shadow: -16px 0 40px rgba(29, 24, 14, 0.34);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  z-index: 1201; display: flex; flex-direction: column; overflow: hidden;
}
.v6-crm-detail.is-open { transform: translateX(0); }
.v6-crm-detail-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 18px 14px; border-bottom: 1px solid #d7d0c3;
}
.v6-crm-detail-titles { flex: 1; min-width: 0; }
.v6-crm-detail-name {
  font: 800 17px var(--font-display, "Aptos Display", Inter);
  color: #101722; line-height: 1.15; margin-bottom: 7px;
}
.v6-crm-detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v6-crm-detail-x {
  width: 30px; height: 30px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; color: #8a95a3;
  background: #f6f3ec; border: 1px solid #d7d0c3;
  cursor: pointer; flex-shrink: 0;
  transition: color .12s, background .12s;
}
.v6-crm-detail-x:hover { color: #101722; background: #ebe7de; }
.v6-crm-detail-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.v6-crm-sec {
  font: 700 9px var(--font-ui, Inter); letter-spacing: .14em; text-transform: uppercase;
  color: #8a95a3; margin: 18px 0 9px;
}
.v6-crm-sec:first-child { margin-top: 0; }

/* Contact grid */
.v6-crm-kv {
  display: grid; grid-template-columns: 88px 1fr; gap: 7px 12px; font-size: 12px;
}
.v6-crm-kv dt { font: 400 10px var(--font-ui, Inter); color: #8a95a3; }
.v6-crm-kv dd { margin: 0; color: #101722; word-break: break-word; }
.v6-crm-kv dd a { color: var(--gold, #c18a25); text-decoration: none; }
.v6-crm-kv dd a:hover { text-decoration: underline; }

/* Timeline */
.v6-crm-timeline { display: flex; flex-direction: column; }
.v6-crm-tl-row { display: flex; gap: 10px; padding: 0 0 12px; position: relative; }
.v6-crm-tl-row:not(:last-child)::before {
  content: ""; position: absolute; left: 5px; top: 14px; bottom: 0;
  width: 1px; background: #d7d0c3;
}
.v6-crm-tl-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--gold, #c18a25); border: 2px solid rgba(255, 253, 248, 0.99);
  flex-shrink: 0; margin-top: 2px; position: relative; z-index: 1;
}
.v6-crm-tl-main { flex: 1; min-width: 0; }
.v6-crm-tl-text { font-size: 12px; color: #101722; line-height: 1.35; }
.v6-crm-tl-meta { font: 400 9px var(--font-ui, Inter); color: #8a95a3; margin-top: 2px; }

/* AI suggestion card */
.v6-crm-ai {
  background: linear-gradient(135deg, rgba(193,138,37,.10), rgba(193,138,37,.02));
  border: 1px solid rgba(193,138,37,.30); border-radius: 8px; padding: 12px 13px;
}
.v6-crm-ai-head {
  display: flex; align-items: center; gap: 6px;
  font: 700 8.5px var(--font-ui, Inter); letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold, #c18a25); margin-bottom: 6px;
}
.v6-crm-ai-text { font-size: 12px; color: #101722; line-height: 1.45; }

/* Detail panel quick actions */
.v6-crm-detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v6-crm-detail-actions .v6-crm-da-full { grid-column: 1 / -1; }
.v6-crm-da {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: 700 10px var(--font-ui, Inter); letter-spacing: .06em; text-transform: uppercase;
  color: #647184; background: #f6f3ec; border: 1px solid #d7d0c3; border-radius: 8px;
  padding: 9px 10px; cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.v6-crm-da:hover { color: var(--gold, #c18a25); background: rgba(193,138,37,.10); border-color: rgba(193,138,37,.32); }
.v6-crm-da.is-primary { color: var(--gold, #c18a25); background: rgba(193,138,37,.12); border-color: rgba(193,138,37,.34); }
.v6-crm-da svg { width: 13px; height: 13px; stroke-width: 1.9; }

/* Source freshness footer */
.v6-crm-foot {
  display: flex; align-items: center; gap: 9px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid #ebe7de;
}
.v6-crm-foot-badge {
  font: 700 8.5px var(--font-ui, Inter); letter-spacing: .1em; text-transform: uppercase;
  color: #8a95a3; background: #f6f3ec; border: 1px solid #d7d0c3;
  border-radius: 4px; padding: 3px 8px;
}
.v6-crm-foot-badge.is-demo { color: #c79444; border-color: rgba(199,148,68,.34); background: rgba(199,148,68,.08); }
.v6-crm-foot-badge.is-live { color: #17623a; border-color: rgba(23,98,58,.30); background: rgba(23,98,58,.07); }
.v6-crm-foot-fresh { font: 400 8.5px var(--font-ui, Inter); color: #8a95a3; margin-left: auto; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .v6-crm-board-strip {
    display: flex; overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .v6-crm-hot { min-width: 200px; scroll-snap-align: start; flex: 0 0 auto; }
}
