/* contact-file.css — the customer file, above the contact form.
 *
 * It shares the page with Chatwoot's own form, so it takes the campaign
 * wizard's palette rather than inventing a third one: the same lines, the same
 * card surface, the same lime for the one thing being pointed at.
 */
.crm-cf {
  --cf-ink: #1d1b1c;
  --cf-muted: #55606c;
  --cf-faint: #606a76;
  --cf-line: #e8ebe4;
  --cf-card: #ffffff;
  --cf-soft: #fafbf8;
  --cf-brand: #d4fb08;
  --cf-good: #12a150;
  --cf-good-bg: rgba(18, 161, 80, .12);
  --cf-bad: #b91c1c;
  --cf-bad-bg: rgba(185, 28, 28, .1);
  --cf-warn: var(--crm-alert-ink, #c8243b);
  --cf-warn-bg: var(--crm-alert-bg, #fff1f2);

  /* The column this sits in is `items-start`, which sizes its children to
     their content rather than stretching them. Without a width of its own the
     file collapsed to about 245px of a 650px column, and the six figures - a
     grid of `repeat(auto-fit, minmax(140px, 1fr))` - fell into a single column
     and became a tall stack of wide empty boxes.

     `align-self` is what actually overrides the parent's alignment; the width
     covers the case where this lands somewhere that is not a flex column. */
  align-self: stretch;
  width: 100%;

  margin: 4px 0 26px;
  color: var(--cf-ink);
  font-size: 14px;
}

:root.dark .crm-cf,
.dark .crm-cf,
[data-theme="dark"] .crm-cf {
  --cf-ink: #e8eaed;
  --cf-muted: #98a1ad;
  --cf-faint: #78828e;
  --cf-line: #2c3138;
  --cf-card: #1b1e23;
  --cf-soft: #22262c;
  --cf-good: #4ade80;
  --cf-good-bg: rgba(18, 161, 80, .2);
  --cf-bad: #fca5a5;
  --cf-bad-bg: rgba(185, 28, 28, .2);
  --cf-warn: var(--crm-alert-ink, #c8243b);
  --cf-warn-bg: var(--crm-alert-bg, #fff1f2);
}

.crm-cf * { box-sizing: border-box; }
.crm-cf button { font: inherit; color: inherit; }

/* ---- the six figures ----------------------------------------------------- */

.crm-cf__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.crm-cf__stat {
  border: 1px solid var(--cf-line);
  border-radius: 8px;
  padding: 11px 13px 12px;
  background: var(--cf-card);
  min-width: 0;
}

.crm-cf__k { font-size: 11px; color: var(--cf-muted); }

.crm-cf__v {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.crm-cf__s { font-size: 11.5px; color: var(--cf-faint); margin-top: 2px; }

.crm-cf__stat.is-company { border-color: var(--cf-brand); }

.crm-cf__company {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2px;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.crm-cf__company:hover { text-decoration: underline; }

/* ---- tabs ---------------------------------------------------------------- */

.crm-cf__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--cf-line);
  margin-bottom: 4px;
}

.crm-cf__tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 8px 12px 9px;
  font-size: 13px;
  color: var(--cf-muted);
  cursor: pointer;
  margin-bottom: -1px;
}

.crm-cf__tab:hover { color: var(--cf-ink); }
.crm-cf__tab.is-on { color: var(--cf-ink); font-weight: 600; border-bottom-color: var(--cf-brand); }

.crm-cf__n {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--cf-soft);
  border: 1px solid var(--cf-line);
  border-radius: 999px;
  padding: 0 7px;
}

/* ---- rows ---------------------------------------------------------------- */

.crm-cf__body { display: flex; flex-direction: column; }

.crm-cf__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--cf-line);
  text-decoration: none;
  color: inherit;
}

.crm-cf__row:last-child { border-bottom: 0; }
a.crm-cf__row:hover { background: var(--cf-soft); }

.crm-cf__left { min-width: 0; flex: 1; }
.crm-cf__right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.crm-cf__t {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-cf__m { font-size: 12px; color: var(--cf-faint); margin-top: 2px; }
.crm-cf__amount { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

.crm-cf__note {
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.crm-cf__empty {
  font-size: 13px;
  color: var(--cf-faint);
  line-height: 1.6;
  padding: 16px 2px;
  max-width: 64ch;
}

/* ---- state pills --------------------------------------------------------- */

.crm-cf__pill {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--cf-soft);
  color: var(--cf-muted);
  border: 1px solid var(--cf-line);
}

.crm-cf__pill.is-open,
.crm-cf__pill.is-pending { background: var(--cf-warn-bg); color: var(--cf-warn); border-color: transparent; }

.crm-cf__pill.is-resolved,
.crm-cf__pill.is-won,
.crm-cf__pill.is-read,
.crm-cf__pill.is-delivered,
.crm-cf__pill.is-completed { background: var(--cf-good-bg); color: var(--cf-good); border-color: transparent; }

.crm-cf__pill.is-failed,
.crm-cf__pill.is-lost,
.crm-cf__pill.is-cancelled { background: var(--cf-bad-bg); color: var(--cf-bad); border-color: transparent; }

/* What happened - the customer's timeline (item 54) */
.crm-cf__event { align-items: flex-start; gap: 12px; }
.crm-cf__eicon { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; background: var(--cf-soft, #f4f5f7); color: var(--cf-muted); margin-top: 1px; }
.crm-cf__event.is-waiting .crm-cf__eicon, .crm-cf__event.is-lost .crm-cf__eicon, .crm-cf__event.is-alert .crm-cf__eicon { color: #dc2626; }
.crm-cf__event.is-won .crm-cf__eicon, .crm-cf__event.is-sale_completed .crm-cf__eicon, .crm-cf__event.is-task_done .crm-cf__eicon { color: #15803d; }
.crm-cf__event.is-ai .crm-cf__eicon, .crm-cf__event.is-ai_action .crm-cf__eicon, .crm-cf__event.is-ai_suggested .crm-cf__eicon { color: var(--crm-ink); }
.crm-cf__etext { white-space: normal; unicode-bidi: plaintext; }
