/* Shared customer-card component. Loaded by customer-card.js via
   ensureCss. All selectors scoped under .lf-cust-card so they don't
   collide with CRM's existing (unscoped) .cust-* rules in crm.css. */

.lf-cust-card {
  padding: 0;
  position: relative;
}
.lf-cust-card.loading-state { min-height: 96px; }
.lf-cust-card .unmatched {
  color: var(--lf-text-dim);
  font-style: italic;
  font-size: 13px;
}

.lf-cust-card .cust-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.lf-cust-card .cust-identity { flex: 1 1 auto; min-width: 0; }
.lf-cust-card .vip-star {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.85em;
  vertical-align: middle;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}
.lf-cust-card .cust-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--lf-text);
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lf-cust-card .cust-contact {
  color: var(--lf-text-muted);
  font-size: 12.5px;
  margin-top: 4px;
}
.lf-cust-card .cust-shop-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--lf-accent);
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(107, 160, 255, 0.1);
  border: 1px solid rgba(107, 160, 255, 0.18);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.lf-cust-card .cust-shop-link:hover {
  background: rgba(107, 160, 255, 0.2);
  border-color: rgba(107, 160, 255, 0.35);
  text-decoration: none;
}

.lf-cust-card .cust-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}
.lf-cust-card .cust-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--lf-border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}
.lf-cust-card .cust-stat-link:hover {
  border-color: var(--lf-accent);
  background: var(--lf-accent-bg);
  cursor: pointer;
}
.lf-cust-card .cust-stat-link::after {
  content: "↗";
  font-size: 9px;
  color: var(--lf-text-dim);
  margin-left: 4px;
  opacity: 0.7;
}
.lf-cust-card .cust-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--lf-text);
}
.lf-cust-card .cust-stat-label {
  font-size: 10px;
  color: var(--lf-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

.lf-cust-card .cust-tags {
  margin-top: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.lf-cust-card .cust-tag {
  background: rgba(107, 160, 255, 0.12);
  color: var(--lf-accent);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 500;
}

.lf-cust-card .cust-spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--lf-text-dim);
  font-size: 13px;
  padding: 8px 0;
}
.lf-cust-card .cust-spinner::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(107, 160, 255, 0.15);
  border-top-color: var(--lf-accent);
  border-radius: 50%;
  animation: lf-cust-spin 0.8s linear infinite;
}
@keyframes lf-cust-spin { to { transform: rotate(360deg); } }

/* ─── Pending orders ─────────────────────────────────────────── */
.lf-cust-card .pending-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--lf-border);
}
.lf-cust-card .pending-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lf-cust-card .pending-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lf-warn);
}
.lf-cust-card .pending-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--lf-warn);
  font-feature-settings: "tnum";
}
.lf-cust-card .pending-row {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  border: 1px solid transparent;
}
.lf-cust-card .pending-row.type-active {
  background: var(--lf-warn-bg);
  border-color: var(--lf-warn-border);
}
.lf-cust-card .pending-row.type-mixed {
  background: var(--lf-warn-bg);
  border-color: var(--lf-warn-border);
  border-left: 3px solid var(--lf-purple);
}
.lf-cust-card .pending-row.type-preorder {
  background: var(--lf-purple-bg);
  border-color: var(--lf-purple-border);
  opacity: 0.85;
}
.lf-cust-card .pending-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.lf-cust-card .pending-legend .legend-item {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lf-cust-card .legend-active { background: var(--lf-warn-bg); color: var(--lf-warn); }
.lf-cust-card .legend-mixed { background: var(--lf-warn-bg); color: var(--lf-warn); border-left: 2px solid var(--lf-purple); }
.lf-cust-card .legend-preorder { background: var(--lf-purple-bg); color: var(--lf-purple); }
.lf-cust-card .type-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.lf-cust-card .type-pill.pill-preorder { background: var(--lf-purple-bg); color: var(--lf-purple); }
.lf-cust-card .type-pill.pill-mixed { background: var(--lf-purple-bg); color: var(--lf-purple); }
.lf-cust-card .pending-items li.item-preorder { color: var(--lf-text-muted); }
.lf-cust-card .pending-items li .item-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--lf-purple);
  font-weight: 700;
  margin-left: 4px;
}
.lf-cust-card .pending-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.lf-cust-card .pending-link:hover .pending-row { filter: brightness(1.08); }
.lf-cust-card .pending-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.lf-cust-card .pending-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--lf-text);
  font-family: 'JetBrains Mono', monospace;
}
.lf-cust-card .pending-amount {
  font-size: 12px;
  font-weight: 700;
  color: var(--lf-text);
  font-feature-settings: "tnum";
}
.lf-cust-card .pending-age {
  font-size: 10px;
  color: var(--lf-text-muted);
  margin-top: 2px;
}
.lf-cust-card .pending-items {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
  border-top: 1px dashed var(--lf-warn-border);
  padding-top: 6px;
}
.lf-cust-card .pending-items li {
  font-size: 11px;
  color: var(--lf-text);
  line-height: 1.5;
}
.lf-cust-card .pending-items li .qty {
  color: var(--lf-text-muted);
  font-weight: 600;
  margin-right: 2px;
}
.lf-cust-card .pending-more {
  font-size: 11px;
  color: var(--lf-text-dim);
  text-align: center;
  margin-top: 4px;
}

/* ─── Reviews ────────────────────────────────────────────────── */
.lf-cust-card .reviews-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--lf-border);
}
.lf-cust-card .reviews-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lf-cust-card .reviews-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lf-text-muted);
}
.lf-cust-card .reviews-avg {
  font-size: 12px;
  font-weight: 700;
  color: #e6a700;
  font-feature-settings: "tnum";
}
.lf-cust-card .review-row {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  border: 1px solid var(--lf-border);
  background: rgba(255, 255, 255, 0.02);
}
.lf-cust-card .review-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.lf-cust-card .review-link:hover .review-row {
  filter: brightness(1.12);
  border-color: var(--lf-text-muted);
}
.lf-cust-card .review-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.lf-cust-card .review-stars {
  font-size: 12px;
  color: #e6a700;
  letter-spacing: 1px;
  font-feature-settings: "tnum";
}
.lf-cust-card .review-verified {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lf-cust-card .review-date {
  margin-left: auto;
  font-size: 10px;
  color: var(--lf-text-muted);
}
.lf-cust-card .review-product {
  font-size: 10px;
  color: var(--lf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.lf-cust-card .review-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--lf-text);
  margin-bottom: 3px;
}
.lf-cust-card .review-body {
  font-size: 11px;
  line-height: 1.45;
  color: var(--lf-text-muted);
}
.lf-cust-card .reviews-more {
  font-size: 11px;
  color: var(--lf-text-dim);
  text-align: center;
  margin-top: 4px;
}

/* ─── RMA list (cust-rma-*) ──────────────────────────────────── */
.lf-cust-card .cust-rma-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--lf-border);
}
.lf-cust-card .cust-rma-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lf-cust-card .cust-rma-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lf-text-muted);
}
.lf-cust-card .cust-rma-summary {
  font-size: 11px;
  color: var(--lf-text-dim);
  font-feature-settings: "tnum";
}
.lf-cust-card .cust-rma-row {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  border: 1px solid var(--lf-border);
  background: var(--lf-panel-alt);
  transition: border-color 0.12s, background 0.12s;
}
.lf-cust-card .cust-rma-row:hover {
  border-color: var(--lf-accent);
  background: var(--lf-panel-hover);
}
.lf-cust-card .cust-rma-row.closed { opacity: 0.7; }
.lf-cust-card .cust-rma-row.active {
  border-color: var(--lf-accent);
  background: var(--lf-accent-bg);
  cursor: default;
}
.lf-cust-card .cust-rma-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.lf-cust-card .cust-rma-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--lf-text);
  font-family: 'JetBrains Mono', monospace;
}
.lf-cust-card .cust-rma-status {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--lf-panel);
  color: var(--lf-text-muted);
  flex-shrink: 0;
}
.lf-cust-card .cust-rma-status.rma-status-submitted { background: var(--lf-info-bg); color: var(--lf-info); }
.lf-cust-card .cust-rma-status.rma-status-awaiting_unit { background: var(--lf-warn-bg); color: var(--lf-warn); }
.lf-cust-card .cust-rma-status.rma-status-received { background: var(--lf-warn-bg); color: var(--lf-warn); }
.lf-cust-card .cust-rma-status.rma-status-resolved { background: var(--lf-success-bg); color: var(--lf-success); }
.lf-cust-card .cust-rma-status.rma-status-denied { background: var(--lf-error-bg); color: var(--lf-error); }
.lf-cust-card .cust-rma-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--lf-text-dim);
}
.lf-cust-card .cust-rma-reason {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Related conversations ──────────────────────────────────── */
.lf-cust-card .related-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--lf-border);
}
.lf-cust-card .related-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.lf-cust-card .related-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lf-text-dim);
  font-weight: 700;
}
.lf-cust-card .related-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lf-cust-card .related-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.1s;
  min-width: 0;
}
.lf-cust-card .related-row:hover { background: var(--lf-panel-hover); }
.lf-cust-card .related-chan {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--lf-text-muted);
  min-width: 48px;
  text-align: center;
}
.lf-cust-card .related-chan-gmail { background: rgba(234, 67, 53, 0.12); color: #ea4335; }
.lf-cust-card .related-chan-shopify-inbox { background: rgba(150, 191, 72, 0.12); color: #96bf48; }
.lf-cust-card .related-chan-crisp,
.lf-cust-card .related-chan-facebook,
.lf-cust-card .related-chan-instagram,
.lf-cust-card .related-chan-messenger,
.lf-cust-card .related-chan-whatsapp,
.lf-cust-card .related-chan-app {
  background: rgba(107, 160, 255, 0.12);
  color: var(--lf-accent);
}
.lf-cust-card .related-body { flex: 1 1 auto; min-width: 0; }
.lf-cust-card .related-subj {
  font-size: 12px;
  font-weight: 600;
  color: var(--lf-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.lf-cust-card .related-when {
  font-size: 10px;
  color: var(--lf-text-dim);
  margin-top: 1px;
}
