/* customer-insights.css — Customer Insights tab + drawers */

/* === Tab shell === */
.cust-tab { padding: 24px; max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.cust-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cust-page-title { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); margin: 0; }
.cust-page-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.cust-head-meta { display: flex; align-items: center; gap: 12px; }
.cust-dedup { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 6px 10px; border-radius: 999px; cursor: pointer; transition: background 0.15s; border: 1px solid var(--border); }
.cust-dedup.ok { color: #10B981; }
.cust-dedup.warn { color: #F59E0B; background: rgba(245,158,11,0.06); border-color: rgba(245,158,11,0.25); }
.cust-dedup:hover { background: var(--surface-alt); }
.cust-dedup-icon { font-weight: 600; }
.cust-dedup-text { color: var(--text-2); }
.cust-dedup.warn .cust-dedup-text { color: var(--text); }
.cust-dedup-link { color: var(--accent); text-decoration: none; }
.cust-privacy-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(99,102,241,0.12); color: #6366F1; font-weight: 500; }

/* === Block (section) === */
.cust-block { display: flex; flex-direction: column; gap: 16px; }
.cust-block-head { display: flex; align-items: baseline; justify-content: space-between; }
.cust-block-title { font-size: 18px; font-weight: 600; color: var(--text); margin: 0; letter-spacing: -0.005em; }
.cust-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.cust-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.cust-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.cust-card-meta { font-size: 12px; color: var(--text-3); }
.cust-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cust-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* === Snapshot grid === */
.cust-snapshot-grid,
.cust-snapshot { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cust-metric-card,
.cust-snap-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: default; transition: background 0.15s, border-color 0.15s; display: flex; flex-direction: column; gap: 4px; }
.cust-snap-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.cust-snap-label > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-snap-label .help-ico { margin-left: auto; }
.cust-snap-value { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cust-snap-meta { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.cust-snap-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; }
.cust-snap-delta.up { color: #10B981; }
.cust-snap-delta.down { color: #EF4444; }
.cust-snap-delta.flat { color: var(--text-3); }
.cust-snap-sub { font-size: 11px; color: var(--text-3); }
.cust-snap-card.alert { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.04); }
.cust-metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: default; transition: background 0.15s, border-color 0.15s; }
.cust-metric-card.alert { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.04); }
.cust-metric-lbl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.cust-metric-val { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.1; }
.cust-metric-val .small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.cust-metric-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; margin-top: 4px; }
.cust-metric-delta.pos { color: #10B981; }
.cust-metric-delta.neg { color: #EF4444; }
.cust-metric-delta.flat { color: var(--text-3); }
.cust-metric-sub { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* === Tables === */
.cust-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cust-table th { text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.cust-table th.num { text-align: right; }
.cust-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.cust-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cust-table td.muted { color: var(--text-3); }
.cust-table td.muted.small { font-size: 12px; }
.cust-table td.pos { color: #10B981; }
.cust-table td.neg { color: #EF4444; }
.cust-table tr.clickable { cursor: pointer; transition: background 0.15s; }
.cust-table tr.clickable:hover { background: var(--surface-alt); }
.cust-table tr.total td { font-weight: 600; color: var(--text); border-top: 1px solid var(--border); border-bottom: none; }
.cust-table tr.hot { background: rgba(16,185,129,0.04); }
.cust-table-scroll { overflow-x: auto; }

/* === Avatar === */
.cust-avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: white; font-weight: 600; font-size: 11px; flex-shrink: 0; }
.cust-guest-cell { display: inline-flex; align-items: center; gap: 8px; }

/* === Status badges === */
.cust-status { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 500; }
.cust-status.high-value { color: #EF4444; background: rgba(239,68,68,0.1); }
.cust-status.mid-value { color: #F59E0B; background: rgba(245,158,11,0.1); }
.cust-status.low-value { color: var(--text-3); background: var(--surface-alt); }

.cust-seg-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 500; color: white; }

/* === Buttons === */
.cust-btn-mini { font-size: 11.5px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: all 0.15s; font-weight: 500; }
.cust-btn-mini:hover { background: var(--surface-alt); color: var(--text); border-color: var(--accent); }

/* === Lists === */
.cust-list { display: flex; flex-direction: column; gap: 6px; }
.cust-list-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; transition: background 0.15s; }
.cust-list-item.clickable { cursor: pointer; }
.cust-list-item.clickable:hover { background: var(--surface-alt); }
.cust-list-main { flex: 1; min-width: 0; }
.cust-list-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.cust-list-meta { font-size: 11px; color: var(--text-3); }
.cust-list-footer { padding: 10px; font-size: 11.5px; color: var(--text-3); font-style: italic; }

/* === Empty / muted === */
.cust-empty { padding: 32px 16px; text-align: center; color: var(--text-3); font-size: 12.5px; line-height: 1.55; background: var(--surface-alt); border-radius: 8px; border: 1px dashed var(--border); }
.cust-note { font-size: 11.5px; color: var(--text-3); margin-top: 8px; line-height: 1.5; }
.cust-insight { font-size: 12px; color: var(--text-2); margin-top: 12px; padding: 8px 10px; background: var(--surface-alt); border-radius: 6px; line-height: 1.5; }

/* === RFM matrix === */
.cust-rfm-wrap { display: block; }
.cust-rfm-grid-wrap { width: 100%; }
.cust-rfm-axis-lbl { display: block; color: var(--text-2); font-size: 12px; line-height: 1.35; margin-bottom: 8px; }
.cust-rfm-grid { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 4px; align-items: stretch; }
.cust-rfm-y { min-height: 56px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; color: var(--text-2); font-size: 12.5px; line-height: 1.25; text-align: right; }
.cust-rfm-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.cust-rfm-cell { height: 56px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; position: relative; color: white; font-weight: 600; font-size: 14px; }
.cust-rfm-cell:hover { transform: scale(1.04); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.cust-rfm-cell.empty { background: var(--surface-alt); cursor: default; color: var(--text-3); font-weight: 400; font-size: 11px; }
.cust-rfm-cell.empty:hover { transform: none; box-shadow: none; }
.cust-rfm-xaxis { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 4px; padding-top: 4px; }
.cust-rfm-xgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.cust-rfm-x { font-size: 12px; color: var(--text); text-align: left; }
.cust-rfm-axis-lbl.x { grid-column: 2; margin: 4px 0 0; color: var(--text-2); }
.cust-axis-title { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.cust-rfm-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; padding-top: 12px; }
.cust-rfm-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.cust-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* === Sankey === */
.cust-sankey { width: 100%; height: 280px; }

/* === LTV histogram === */
.cust-histogram { display: block; width: 100%; height: auto; }
.cust-histo-bar { transition: opacity 0.15s; }
.cust-histo-bar:hover { opacity: 0.85; }

/* === LTV/CAC === */
.cust-ltv-cac { display: flex; flex-direction: column; gap: 16px; }
.cust-ltv-cac-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; align-items: end; }
.cust-ltv-cac-block { display: flex; flex-direction: column; gap: 4px; }
.cust-ltv-cac-block .lbl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.cust-ltv-cac-block .val { font-size: 28px; font-weight: 600; color: var(--text); line-height: 1; }
.cust-ltv-cac-block.ratio .val { font-size: 44px; color: #10B981; }
.cust-ltv-cac-block.ratio.warn .val { color: #F59E0B; }
.cust-ltv-cac-status { font-size: 12px; padding: 8px 12px; border-radius: 8px; }
.cust-ltv-cac-status.healthy { background: rgba(16,185,129,0.1); color: #10B981; }
.cust-ltv-cac-status.marginal { background: rgba(245,158,11,0.1); color: #F59E0B; }

/* === Cohort heatmap === */
.cust-cohort-table { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.cust-cohort-table th { padding: 6px 4px; font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.cust-cohort-table td.cohort-lbl { font-size: 11px; color: var(--text-2); padding: 0 8px 0 0; text-align: right; white-space: nowrap; cursor: pointer; }
.cust-cohort-table td.cohort-lbl:hover { color: var(--accent); }
.cust-cohort-cell { width: 56px; height: 32px; border-radius: 4px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; cursor: pointer; transition: transform 0.15s; }
.cust-cohort-cell:hover { transform: scale(1.06); }
.cust-cohort-cell.future { background: var(--surface-alt); color: var(--text-3); cursor: default; }
.cust-cohort-cell.future:hover { transform: none; }
.cust-cohort-cell.baseline { background: var(--surface-alt); color: var(--text-2); cursor: default; }

/* === Acquisition flow / repeat timing === */
.cust-area-chart, .cust-line-chart { display: block; width: 100%; }
.cust-bars { display: flex; flex-direction: column; gap: 8px; }
.cust-bar-row { display: grid; grid-template-columns: 90px 1fr 60px; gap: 10px; align-items: center; font-size: 12px; }
.cust-bar-track { height: 18px; background: var(--surface-alt); border-radius: 4px; position: relative; overflow: hidden; }
.cust-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s; }
.cust-bar-fill.peak { background: #10B981; }

/* === Churn signal === */
.cust-churn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cust-churn-stat { padding: 14px 16px; border-radius: 10px; background: var(--surface-alt); cursor: pointer; transition: all 0.15s; border: 1px solid var(--border); }
.cust-churn-stat:hover { border-color: var(--accent); background: var(--surface); }
.cust-churn-n { font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.cust-churn-lbl { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.45; }

/* === Geography === */
.cust-geo { display: flex; flex-direction: column; gap: 8px; }
.cust-geo-row { display: grid; grid-template-columns: 100px 1fr 36px; gap: 10px; align-items: center; font-size: 12px; }
.cust-geo-name { color: var(--text-2); font-weight: 500; }
.cust-geo-bar { height: 16px; background: var(--surface-alt); border-radius: 4px; position: relative; overflow: hidden; }
.cust-geo-fill { height: 100%; background: linear-gradient(90deg, #6366F1, #818CF8); border-radius: 4px; transition: width 0.3s; }
.cust-geo-pct { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 10.5px; color: var(--text); font-weight: 500; }
.cust-geo-n { font-size: 11px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.cust-geo-sub { padding-top: 8px; border-top: 1px dashed var(--border); margin-top: 4px; font-size: 11.5px; color: var(--text-3); display: flex; gap: 8px; }
.cust-geo-sub-h { color: var(--text-2); }

/* === Composition donut === */
.cust-donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; }
.cust-donut-svg { width: 160px; height: 160px; }
.cust-donut-legend { display: flex; flex-direction: column; gap: 6px; }
.cust-donut-legend-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.cust-donut-lbl { color: var(--text-2); }
.cust-donut-val { color: var(--text); font-weight: 500; }

/* === Patterns grid === */
.cust-patterns-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cust-pattern-stat { padding: 12px 14px; background: var(--surface-alt); border-radius: 8px; }
.cust-pattern-lbl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.cust-pattern-val { font-size: 16px; font-weight: 600; color: var(--text); }

/* === Skeleton === */
@keyframes cust-skel-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.8; } }
.cust-skeleton { display: flex; flex-direction: column; gap: 16px; }
.cust-skel-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cust-skel-card { height: 88px; background: var(--surface-alt); border-radius: 12px; animation: cust-skel-pulse 1.6s infinite; }
.cust-skel-block { background: var(--surface-alt); border-radius: 12px; animation: cust-skel-pulse 1.6s infinite; }

/* === Chart axis === */
.cust-axis-text { font-size: 10px; fill: var(--text-3); }
.cust-grid-line { stroke: var(--border); stroke-dasharray: 2 4; }
.cust-axis-line { stroke: var(--border); }
.cust-mean-line { stroke: #EF4444; stroke-width: 2; stroke-dasharray: 4 3; }
.cust-median-line { stroke: #10B981; stroke-width: 2; stroke-dasharray: 4 3; }
.cust-line-series { fill: none; stroke-width: 2; }
.cust-area-fill { opacity: 0.85; }

/* === Mobile === */
@media (max-width: 768px) {
  .cust-tab { padding: 16px 12px; gap: 20px; }
  .cust-page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .cust-snapshot-grid,
  .cust-snapshot { grid-template-columns: repeat(2, 1fr); }
  .cust-2col { grid-template-columns: 1fr; }
  .cust-3col { grid-template-columns: 1fr; }
  .cust-churn { grid-template-columns: 1fr; }
  .cust-patterns-grid { grid-template-columns: repeat(2, 1fr); }
  .cust-rfm-grid,
  .cust-rfm-xaxis { grid-template-columns: 68px minmax(0, 1fr); }
  .cust-rfm-y { font-size: 11px; padding-right: 6px; }
  .cust-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .cust-cohort-cell { width: 40px; height: 28px; font-size: 10px; }
}
