/*
 * CRM Guest 360 — the unified guest timeline, in the Ivory theme.
 *
 * What crm-guest-360-history.js paints: the linked-record line under a
 * profile heading, the widened stay metrics, the badges a search result wears
 * once a Filoxenia record is linked to it, and the two read-only stay cards —
 * the Filoxenia one with its "Filoxenia-reported" block and the archived
 * Protel one (WP-3) with its "Protel-archived" block.
 *
 * Both read-only cards deliberately look like a reservation card and read
 * differently. They reuse .crm-reservation-card so the three sit in one list
 * without a seam, and everything this sheet adds says which of the three it
 * is: the tag names the source, the reported block is set apart on the ivory
 * ground, and nothing on either card has a hover or a focus ring, because
 * neither has a record to open.
 *
 * Every colour is consumed from the shared ground and semantic tokens in
 * crm-guest-360-ivory.css, declared on .crm-guest-360-view. Nothing is
 * re-declared here and there are no raw hex values.
 *
 * This sheet exists rather than more rules in crm-guest-360.css because that
 * file sits at its architecture-audit line ceiling; the split follows the
 * precedent crm-guest-360-case-settings.css set.
 */

/* --- the linked record --------------------------------------------------- */

/* One line under the profile heading: which record on the other side of the
   crosswalk this profile is linked to, and whether that link still wants a
   human confirmation. */
.crm-guest-360-view .crm-history-linked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0 0;
}

.crm-guest-360-view .crm-history-linked-label,
.crm-guest-360-view .crm-history-linked-key {
  color: var(--crm-ivory-ink-soft);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
}

.crm-guest-360-view .crm-history-linked-key {
  border: 1px solid var(--crm-ivory-hair);
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--crm-ivory-card);
}

.crm-guest-360-view .crm-history-linked-open {
  border: 1px solid var(--crm-ivory-hair-strong);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--crm-ivory-ink);
  background: var(--crm-ivory-card);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
  cursor: pointer;
}

.crm-guest-360-view .crm-history-linked-open:hover {
  background: color-mix(in srgb, var(--brand-gold) 10%, var(--crm-ivory-card));
}

/* The one chip that carries a state rather than a fact: the two records
   spell the surname differently and nobody has decided yet (D9). The word
   carries the meaning; the tint only repeats it. */
.crm-guest-360-view .crm-history-chip {
  border: 1px solid var(--crm-ivory-hair-strong);
  border-radius: 999px;
  padding: 1px 8px;
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.crm-guest-360-view .crm-history-chip.is-verify {
  background: var(--crm-sem-warn-soft);
  color: var(--crm-sem-warn);
}

/* --- the search-result badges -------------------------------------------- */

/* On a Protel card: the Filoxenia record that was folded into it. On a
   Filoxenia card that kept its place: which link it has, including the one
   whose Protel profile no longer exists. */
.crm-guest-360-view .crm-result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.crm-guest-360-view .crm-result-badge {
  border: 1px solid var(--crm-ivory-hair-strong);
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--crm-sem-info-soft);
  color: var(--crm-sem-info);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.crm-guest-360-view .crm-result-badge.is-verify {
  background: var(--crm-sem-warn-soft);
  color: var(--crm-sem-warn);
  text-transform: uppercase;
}

.crm-guest-360-view .crm-result-badge.is-absent {
  background: var(--crm-sem-neutral-soft);
  color: var(--crm-sem-neutral);
}

/* --- the stay metrics ---------------------------------------------------- */

/* The same three-column strip the profile has always had, with room under
   the first number for the Filoxenia · Protel split. */
.crm-guest-360-view .crm-history-metrics small {
  display: block;
  margin-top: 0.2rem;
  color: var(--crm-ivory-ink-soft);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
}

/* --- the read-only stay cards -------------------------------------------- */

/* A Filoxenia stay and an archived Protel stay are unopenable for the same
   reason — there is no record behind the row — so they wear the same ground
   and the same flat cursor. */
.crm-guest-360-view .crm-reservation-card.is-historical,
.crm-guest-360-view .crm-reservation-card.is-archived {
  align-items: start;
  background: var(--crm-ivory-card);
  cursor: default;
}

.crm-guest-360-view .crm-history-tag {
  color: var(--crm-ivory-ink-soft);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

/* The block spans the whole card because it is about the stay, not about one
   of its columns. */
.crm-guest-360-view .crm-history-reported {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.45rem;
  margin-top: 0.35rem;
  border-top: 1px solid var(--crm-ivory-hair-soft);
  padding-top: 0.5rem;
}

.crm-guest-360-view .crm-history-reported-title {
  color: var(--crm-ivory-ink-faint);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.crm-guest-360-view .crm-history-reported-facts,
.crm-guest-360-view .crm-history-reported-revenue {
  display: grid;
  gap: 0.4rem 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.crm-guest-360-view .crm-history-reported-facts > span,
.crm-guest-360-view .crm-history-reported-revenue > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.crm-guest-360-view .crm-history-reported small {
  color: var(--crm-ivory-ink-soft);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

.crm-guest-360-view .crm-history-reported strong {
  color: var(--crm-ivory-ink);
  font-size: 0.85rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* The net figure beside its gross, in the annotation weight: both were
   recorded, and neither is derivable from the other. */
.crm-guest-360-view .crm-history-reported-revenue > span > span {
  color: var(--crm-ivory-ink-soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.85rem;
  font-style: italic;
}

/* The archived block carries gross figures only — the archive mirror kept no
   net amounts — so it is two lines shorter than the Filoxenia one. A slightly
   firmer rule above it keeps it reading as a section of the card rather than
   a stray line under the columns. */
.crm-guest-360-view .crm-history-reported.is-archived {
  border-top-color: var(--crm-ivory-hair);
}

/* --- the search card's archive line -------------------------------------- */

/* Under the reservation count on a guest card. It is a different grain —
   units, because the archive has no reservation account key — so it is set
   apart from the number above rather than added into it. */
.crm-guest-360-view .crm-result-archived {
  color: var(--crm-ivory-ink-soft);
  font-family: "Tenor Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

@media (max-width: 900px) {
  .crm-guest-360-view .crm-history-reported {
    margin-top: 0.5rem;
  }
}
