/* ============================================================================
   customers.css — module-scoped tweaks for the Customers / CRM view.
   Every class is prefixed .customers-* and uses ONLY palette tokens.
   ========================================================================== */

/* ── NPS gauge card ──────────────────────────────────────────────────────── */
.customers-nps .customers-gauge-wrap{display:grid;place-items:center}
.customers-nps-legend{margin-top:10px;gap:6px;flex-wrap:wrap}
.customers-nps-chip{
  display:inline-flex;align-items:center;gap:6px;
  font-family:var(--font-mono);font-size:9px;letter-spacing:.6px;
  text-transform:uppercase;color:var(--text-muted)}
.customers-nps-chip i{width:7px;height:7px;border-radius:50%;flex:none}
.customers-nps-chip .dot-ok{background:var(--success);box-shadow:0 0 6px var(--success)}
.customers-nps-chip .dot-mid{background:var(--warn);box-shadow:0 0 6px var(--warn)}
.customers-nps-chip .dot-bad{background:var(--danger);box-shadow:0 0 6px var(--danger)}

/* ── KPI 2×2 ─────────────────────────────────────────────────────────────── */
.customers-kpi-grid{gap:11px}
.customers-kpi{
  background:var(--bg2);border:1px solid var(--border);
  border-radius:var(--radius-sm);padding:11px 12px;gap:5px}
.customers-kpi .kpi-value{line-height:1}

/* ── segments donut ──────────────────────────────────────────────────────── */
.customers-seg-body{display:flex;align-items:center;gap:14px}
.customers-donut{flex:none}
.customers-seg-legend{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
.customers-seg-row{
  display:flex;align-items:center;gap:9px;
  padding:6px 0;border-bottom:1px solid var(--border)}
.customers-seg-row:last-child{border-bottom:none}
.customers-seg-key{width:9px;height:9px;border-radius:3px;flex:none}
.customers-seg-name{flex:1;font-size:12px;color:var(--text-muted)}
.customers-seg-val{font-family:var(--font-mono);font-size:13px;font-weight:600;color:var(--text)}

/* ── customer directory table ────────────────────────────────────────────── */
.customers-table-card{display:flex;flex-direction:column}
.customers-table-head{padding:16px 16px 13px;margin-bottom:0}
.customers-table-scroll{overflow:auto;max-height:430px}
.customers-table thead th{
  position:sticky;top:0;z-index:1;
  background:var(--panel-hi);backdrop-filter:blur(6px)}

.customers-row{cursor:pointer}
.customers-row.is-selected{
  background:linear-gradient(90deg,var(--accent-soft),transparent)!important;
  box-shadow:inset 3px 0 0 var(--accent1)}

.customers-acct{display:flex;align-items:center;gap:10px;min-width:0}
.customers-acct .avatar{width:30px;height:30px;font-size:11px}
.customers-acct-body{min-width:0}
.customers-acct-name{font-size:13px;font-weight:600;color:var(--text);white-space:nowrap}
.customers-acct-sub{
  font-size:10px;color:var(--text-faint);margin-top:1px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:160px}

.customers-health{display:flex;align-items:center;gap:9px;min-width:108px}
.customers-health-bar{flex:1;height:6px}
.customers-health-num{
  font-family:var(--font-mono);font-size:11px;font-weight:600;
  color:var(--text-muted);width:18px;text-align:right}
.customers-health-num.warn{color:var(--warn)}
.customers-health-num.bad{color:var(--danger)}

.customers-seen{font-family:var(--font-mono);font-size:11px;color:var(--text-muted);white-space:nowrap}
.customers-seen.is-stale{color:var(--warn)}

.customers-owner .avatar{width:26px;height:26px;font-size:10px}

/* ── account detail mini-card ────────────────────────────────────────────── */
.customers-detail{display:flex;flex-direction:column}
.customers-detail-body{display:flex;flex-direction:column;gap:13px}
.customers-detail-top{display:flex;align-items:center;gap:12px}
.customers-detail-id{min-width:0}
.customers-detail-name{
  font-family:var(--font-display);font-size:17px;font-weight:600;
  letter-spacing:-.2px;color:var(--text)}
.customers-detail-meta{font-size:11px;color:var(--text-faint);margin-top:1px}
.customers-detail-tags{display:flex;gap:6px;margin-top:7px;flex-wrap:wrap}

.customers-detail-spark{
  background:var(--bg2);border:1px solid var(--border);
  border-radius:var(--radius-sm);padding:10px 12px}
.customers-detail-sparklabel{
  font-family:var(--font-mono);font-size:9px;letter-spacing:1.5px;
  text-transform:uppercase;color:var(--text-faint)}
.customers-detail-spark .spark{margin-top:6px}

.customers-detail-stats{display:flex;flex-direction:column}
.customers-detail-stats .stat-row{padding:7px 0}

.customers-detail-owner{
  display:flex;align-items:center;gap:10px;
  background:var(--bg2);border:1px solid var(--border);
  border-radius:var(--radius-sm);padding:9px 11px}
.customers-detail-owner .avatar{width:30px;height:30px;font-size:11px}
.customers-detail-owner-body{flex:1;min-width:0}
.customers-detail-owner-name{font-size:12px;font-weight:600;color:var(--text)}
.customers-detail-owner-role{font-size:10px;color:var(--text-faint)}

.customers-detail-actions{align-items:stretch}
.customers-detail-actions .btn-block{flex:1}
.customers-detail-actions [data-d-act="email"]{width:38px;flex:none;padding:0}

/* ── at-risk + portfolio row ─────────────────────────────────────────────── */
.customers-risk-stack{display:flex;flex-direction:column;gap:9px}
.customers-crm{display:flex;flex-direction:column}
.customers-crm-stats{display:flex;flex-direction:column}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width:1180px){
  .customers-table-scroll{max-height:360px}
}
@media (max-width:820px){
  .customers-seg-body{flex-direction:column}
  .customers-donut{margin:0 auto}
  .customers-acct-sub{max-width:120px}
}
