/* ============================================================================
   customerIntel.css — Customer Intelligence panel (2026-06-10)
   Segment pills, tri-score card badges, rollup header, quick actions, the deep
   score panel with "why". Glass-consistent with ELEVATE; mobile-safe. Semantic
   green/amber/red are intentional (segment tone). Rollback: remove this link.
   ============================================================================ */

/* ── segment pill (cards + drawer) ── */
.cv-seg-pill {
  display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; line-height: 1.2; white-space: nowrap;
}
.cv-seg-pill--lg { font-size: 10px; padding: 4px 11px; }

/* ── tri-score badge on each card ── */
.cv-intel-badge {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 10px 0 2px; padding-top: 9px;
  border-top: 1px solid var(--border);
}
.cv-tri { display: inline-flex; gap: 8px; align-items: center; flex: 1; min-width: 0; }
.cv-tri-item { display: inline-flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.cv-tri-k { font-size: 8.5px; font-weight: 800; color: var(--text-muted); letter-spacing: .04em; }
.cv-tri-bar { flex: 1; height: 5px; min-width: 18px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; border: 1px solid var(--border); }
.cv-tri-bar > i { display: block; height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.16,.84,.3,1); }

/* ── rollup header ── */
.cv-intel-rollup {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin: 0 0 16px; padding: 12px 16px; border-radius: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
}
html:not([data-theme="light"]) .cv-intel-rollup {
  background: linear-gradient(158deg, rgba(20,23,30,.5), rgba(16,18,23,.36));
  border-color: rgba(165,178,198,.14);
  backdrop-filter: blur(20px) saturate(1.15); -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.cv-roll-cells { display: flex; gap: 8px; flex-wrap: wrap; }
.cv-roll-cell {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 76px; padding: 9px 14px; border-radius: 13px; cursor: pointer;
  background: rgba(127,140,165,.06); border: 1px solid var(--border);
  border-bottom: 2px solid var(--rc, var(--accent));
  transition: background .2s, transform .18s, box-shadow .2s;
}
.cv-roll-cell:hover { background: rgba(127,140,165,.12); transform: translateY(-1px); }
.cv-roll-cell.is-on { background: rgba(127,140,165,.16); box-shadow: 0 0 0 1px var(--rc); }
.cv-roll-n { font-size: 20px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.cv-roll-l { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.cv-roll-side { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: 12px; color: var(--text-secondary); }
.cv-roll-side b { color: var(--text-primary); }
.cv-roll-acts { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.cv-roll-act b { color: var(--accent); font-weight: 800; }

/* ── toolbar filters ── */
.cv-filter-sel, .cv-filter-search {
  font-size: 12px; padding: 6px 10px; border-radius: 9px;
  background: var(--bg-input); color: var(--text-primary);
  border: 1px solid var(--border); outline: none; max-width: 170px;
}
.cv-filter-search { width: 150px; }
.cv-filter-sel:focus, .cv-filter-search:focus { border-color: var(--border-hover); }

/* ── deep drawer: 3-score panel with "why" ── */
.cv-intel-panel {
  margin: 0 0 14px; padding: 14px; border-radius: 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
}
html:not([data-theme="light"]) .cv-intel-panel {
  background: linear-gradient(158deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border-color: rgba(165,178,198,.14);
}
.cv-intel-panel-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cv-intel-panel-cap { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.cv-score-row { margin-bottom: 11px; }
.cv-score-row:last-child { margin-bottom: 0; }
.cv-score-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.cv-score-name { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.cv-score-val { font-size: 16px; font-weight: 800; line-height: 1; }
.cv-score-track { height: 7px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; border: 1px solid var(--border); }
.cv-score-track > i { display: block; height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.16,.84,.3,1); }
.cv-score-why { font-size: 10.5px; line-height: 1.45; color: var(--text-muted); margin-top: 4px; }
.cv-na { color: var(--warning, #d97706); font-weight: 600; }

/* ── quick actions ── */
.cv-qa-wrap { margin: 0 0 16px; }
.cv-qa-row { display: flex; gap: 7px; flex-wrap: wrap; }
.cv-qa {
  font-size: 11px; font-weight: 600; padding: 7px 12px; border-radius: 10px;
  cursor: pointer; white-space: nowrap; color: var(--text-secondary);
  background: var(--bg-elevated); border: 1px solid var(--border);
  transition: background .18s, border-color .18s, color .18s, transform .12s;
}
.cv-qa:hover { color: var(--text-primary); border-color: var(--border-hover); transform: translateY(-1px); }
.cv-qa:active { transform: scale(.97); }
.cv-qa:disabled { opacity: .6; cursor: wait; }
.cv-qa--suggested { border-color: var(--accent); color: var(--text-primary); box-shadow: 0 0 0 1px var(--accent-subtle); }
.cv-qa--done { opacity: .65; cursor: default; }
.cv-qa.is-on { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); font-weight: 800; }
.cv-qa-note { display: flex; gap: 8px; margin-top: 9px; align-items: flex-start; }
.cv-qa-note textarea {
  flex: 1; min-width: 0; font-size: 12px; padding: 8px 10px; border-radius: 9px; resize: vertical;
  background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); outline: none;
}
.cv-qa-note textarea:focus { border-color: var(--border-hover); }
.cv-qa-note-save {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  background: var(--accent); color: var(--bg-primary, #0a0c11); border: 0;
}
.cv-qa-note-save:hover { filter: brightness(1.08); }
.cv-qa-msg { font-size: 11px; color: var(--text-muted); margin-top: 7px; min-height: 14px; }

/* ── mobile ── */
@media (max-width: 640px) {
  .cv-intel-rollup { padding: 10px 12px; gap: 10px; }
  .cv-roll-cells { gap: 6px; width: 100%; }
  .cv-roll-cell { min-width: 0; flex: 1; padding: 8px 6px; }
  .cv-roll-n { font-size: 17px; }
  .cv-roll-side { align-items: flex-start; width: 100%; }
  .cv-filter-group { width: 100%; padding-left: 0 !important; border-left: 0 !important; flex-wrap: wrap; }
  .cv-filter-sel, .cv-filter-search { flex: 1; max-width: none; min-width: 110px; }
  .cv-qa-row { gap: 6px; }
  .cv-qa { flex: 1 1 auto; text-align: center; padding: 8px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .cv-tri-bar > i, .cv-score-track > i, .cv-roll-cell, .cv-qa { transition: none; }
}
