/* Roommate matching portal pages.
   Authored against the Web Awesome design tokens already on :root. */

/* ---- Matches index ---- */

.roommate-matches {
  /* HMS-1601 — the matches list is a card page like waitlist-status and
     review-submission, which Figma centres at 1408px; the old 800px cap left
     a narrow column on wide screens. */
  max-width: 88rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.roommate-matches__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  margin-bottom: 1rem;
}

.roommate-matches__section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  margin: 1.5rem 0 0.75rem;
}

.roommate-matches__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.roommate-match-card {
  background: var(--wa-color-surface-raised);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  padding: 1rem;
}

.roommate-matches__section-sub {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0 0 0.75rem;
}

.roommate-matches__section-title + .roommate-matches__section-sub {
  margin-top: -0.5rem;
}

.roommate-matches__search {
  display: block;
  margin: 0.75rem 0;
}

.roommate-match-card--suggestion {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
}

.roommate-match-card--suggestion + .roommate-match-card--suggestion {
  margin-top: 0.75rem;
}

.roommate-match-card--suggestion .roommate-match-card__avatar {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--wa-color-brand-fill-quiet);
  color: var(--wa-color-brand-on-quiet);
  font-size: 0.8125rem;
  text-transform: uppercase;
}

.roommate-match-card--suggestion .roommate-match-card__suggestion-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.roommate-match-card--suggestion .roommate-match-card__name,
.roommate-match-card--suggestion .roommate-match-card__meta,
.roommate-match-card--suggestion .roommate-match-card__chips {
  margin: 0;
}

.roommate-match-card--suggestion .roommate-match-card__name {
  line-height: 1.25;
}

.roommate-match-card--suggestion .roommate-match-card__meta {
  line-height: 1.35;
}

.roommate-match-card--suggestion .roommate-match-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.roommate-match-card--suggestion .roommate-match-card__actions {
  margin-top: 0;
  flex: none;
  align-items: center;
}

.roommate-match-card--suggestion .roommate-match-card__actions form {
  display: contents;
}

.roommate-match-card--suggestion .roommate-match-card__decline,
.roommate-match-card--suggestion .roommate-match-card__request {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.25rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
}

.roommate-match-card--suggestion .roommate-match-card__request {
  background: var(--wa-color-brand-fill-loud);
  color: var(--wa-color-brand-on-loud);
}

@media (max-width: 640px) {
  .roommate-match-card--suggestion { flex-wrap: wrap; row-gap: 0.5rem; padding: 0.75rem; }
  .roommate-match-card--suggestion .roommate-match-card__actions { width: 100%; justify-content: flex-end; }
}

.roommate-match-card__name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.roommate-match-card__meta {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin-top: 0.25rem;
}

/* HMS-1820 — the durable request state sits inside the suggestion body, so a
   sent card is identifiable without opening the collapsed history. */
.roommate-match-card__request-state {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem 0.5rem;
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
}

.roommate-match-card__request-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-neutral-on-quiet);
  background: var(--wa-color-neutral-fill-quiet);
  border: 1px solid var(--wa-color-neutral-fill-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.125rem 0.5rem;
}

.roommate-match-card__request-state-badge--pending {
  color: var(--wa-color-brand-on-quiet);
  background: var(--wa-color-brand-fill-quiet);
  border-color: var(--wa-color-brand-fill-quiet);
}

.roommate-match-card__request-state-time {
  color: var(--wa-color-text-quiet);
  font-variant-numeric: tabular-nums;
}

.roommate-match-card__preferences {
  color: var(--wa-color-text-normal);
  margin-top: 0.5rem;
}

.roommate-match-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.roommate-match-card__accept,
.roommate-match-card__request {
  background: var(--wa-color-brand-fill-normal);
  color: var(--wa-color-brand-on-normal);
  border: none;
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.roommate-match-card__decline {
  background: transparent;
  color: var(--wa-color-text-quiet);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.roommate-match-card__decline-reason {
  width: 100%;
  color: var(--wa-color-text-normal);
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem;
}

/* Request cards (incoming and sent): white booking-style layout. */
.roommate-match-card--request {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--wa-color-surface-default, #fff);
}

.roommate-match-card__thumb {
  flex: none;
  width: 5rem;
  height: 5rem;
  border-radius: var(--wa-border-radius-m);
  overflow: hidden;
  background: var(--wa-color-surface-lowered);
}

.roommate-match-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.roommate-match-card__thumb-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
}

.roommate-match-card__booking-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-block-end: 0.625rem;
  border-block-end: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-match-card__booking-copy {
  flex: 1;
  min-width: 0;
}

.roommate-match-card__booking-head + .roommate-match-card__body {
  padding-block-start: 0.625rem;
}

.roommate-match-card__body {
  flex: 1;
  min-width: 0;
}

.roommate-match-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.roommate-match-card__hotel {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--wa-color-text-normal);
}

.roommate-match-card__status {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.125rem 0.5rem;
}

.roommate-match-card__status--confirmed,
.roommate-match-card__status--checked_in {
  color: var(--wa-color-success-on-quiet);
  background: var(--wa-color-success-fill-quiet);
  border-color: var(--wa-color-success-fill-quiet);
}

.roommate-match-card__stay {
  margin: 0.125rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--wa-color-text-quiet);
}

.roommate-match-card__request-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0;
}

.roommate-match-card__avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-normal);
  font-size: 0.75rem;
  font-weight: 600;
}

.roommate-match-card__request-text {
  margin: 0;
  font-size: 1rem;
  color: var(--wa-color-text-normal);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.roommate-match-card__pending {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.125rem 0.5rem;
}

.roommate-match-card__explainer {
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
  margin: 0.5rem 0 0;
}

.roommate-match-card--request .roommate-match-card__actions {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.5rem;
}

.roommate-match-card--request .roommate-match-card__actions form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.roommate-match-card--request .booking-row__request-decline-form {
  flex-wrap: nowrap;
}

.roommate-match-card__view-details {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  background: transparent;
  color: var(--wa-color-text-normal);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.roommate-match-card__accept-match {
  display: inline-block;
  background: var(--wa-color-success-fill-normal);
  color: var(--wa-color-success-on-normal);
  border: none;
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* HMS-752 — Accept Match rendered disabled while the requester holds no
   live booking, with the reason alongside instead of a click-then-error. */
.roommate-match-card__accept-match--disabled {
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-quiet);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  cursor: not-allowed;
}

.roommate-match-card__accept-hint {
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
  align-self: center;
  max-width: 22rem;
}

.roommate-match-card__decline-match {
  display: inline-block;
  background: transparent;
  color: var(--wa-color-danger-on-quiet);
  border: 1px solid var(--wa-color-danger-fill-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.roommate-match-card__ref {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.roommate-matches__empty {
  color: var(--wa-color-text-quiet);
  text-align: center;
  padding: 2rem;
}

/* ---- Confirmation ---- */

.roommate-confirmation {
  /* HMS-1601 — Figma 516:7197 draws the match confirmation as a 640px
     modal; the standalone page takes the same width. */
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ---- Match show (Figma 516:7197) — centered card, hero, shared summary ---- */

.roommate-card {
  /* Fills the confirmation column — a second max-width here just re-created
     the dead space HMS-1601 removed. */
  max-width: 100%;
  margin: 0 auto;
  background: var(--wa-color-surface-raised);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  padding: 1.5rem;
}

/* HMS-1889 — the Change my dates copy is one compact explanatory stack. WA's
   native content flow gives every sibling <p> a 24px bottom margin; a flex
   gap replaces those with one consistent rhythm without touching the match
   summary card. */
.roommate-card--change-dates {
  display: flex;
  flex-direction: column;
  gap: var(--wa-space-s);
}

.roommate-card--change-dates > h1,
.roommate-card--change-dates > p {
  margin: 0;
}

.roommate-card--change-dates .roommate-card__actions {
  padding-top: var(--wa-space-s);
}

/* Green confirm hero: icon disc + title/subtitle row. The --confirmed modifier
   is the only coloured hero; pending keeps the quiet neutral disc. */
.roommate-card__hero {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-card__hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: 50%;
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-quiet);
  font-size: 1.125rem;
}

.roommate-card__hero-icon--confirmed {
  background: var(--wa-color-success-fill-quiet);
  color: var(--wa-color-success-on-quiet);
}

.roommate-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
  margin: 0;
}

.roommate-card__subtitle {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0.25rem 0 0;
}

.roommate-card__summary {
  padding: 1rem 0;
}

.roommate-card__summary-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  margin: 0 0 0.75rem;
}

/* The two-party header row: grey box split into "You (Primary)" | "Roommate". */
.roommate-card__parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--wa-color-surface-lowered);
  border-radius: var(--wa-border-radius-m);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

/* The right column hugs the grey box's right edge so the roommate name lines
   up with the right-aligned values in the detail rows below. */
.roommate-card__party:last-child {
  text-align: right;
}

.roommate-card__party-role {
  display: block;
  font-size: 0.75rem;
  color: var(--wa-color-text-quiet);
}

.roommate-card__party-name {
  display: block;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

/* Details read as a label/value split — the label left, value right-aligned. */
.roommate-card__details {
  margin: 0;
}

.roommate-card__detail {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
}

.roommate-card__detail dt {
  color: var(--wa-color-text-quiet);
}

.roommate-card__detail dd {
  margin: 0;
  color: var(--wa-color-text-normal);
  text-align: right;
}

.roommate-card__section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-card__section-heading {
  margin: 0 0 0.625rem;
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--wa-color-text-normal);
}

.roommate-card__outcome {
  margin: 0 0 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-normal);
  font-weight: 600;
}

.roommate-card__policy-date,
.roommate-card__effect {
  margin: 0.625rem 0 0;
  color: var(--wa-color-text-normal);
  font-size: 0.9375rem;
}

.roommate-card__policy-date {
  color: var(--wa-color-text-quiet);
}

.roommate-card__action-form {
  margin: 0;
}

/* Blue-left-border info note under the summary. */
.roommate-card__note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0.625rem 0.875rem;
  border-left: 3px solid var(--wa-color-brand);
  background: var(--wa-color-brand-fill-quiet);
  font-size: 0.875rem;
  color: var(--wa-color-text-normal);
}

/* Footer actions: outlined + plain + filled primary, wrapping at mobile widths. */
.roommate-card__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-card__action {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--wa-border-radius-m);
  background: transparent;
  color: var(--wa-color-text-normal);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.roommate-card__action--outlined {
  border: 1px solid var(--wa-color-neutral-border-quiet);
  background: var(--wa-color-surface-raised);
}

.roommate-card__action--primary {
  background: var(--wa-color-brand);
  color: var(--wa-color-brand-on-loud);
}

/* HMS-752 — the pending match's Accept rendered disabled while the
   requester holds no live booking (reason shown in the note above). */
.roommate-card__action[disabled] {
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-quiet);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  cursor: not-allowed;
}

@media (max-width: 40rem) {
  .roommate-card__hero {
    flex-direction: column;
    text-align: center;
  }

  .roommate-card__actions .roommate-card__action,
  .roommate-card__actions wa-button,
  .roommate-card__actions form {
    width: 100%;
  }

  .roommate-card__actions .roommate-card__action {
    text-align: center;
  }
}

@media (max-width: 40rem) {
  /* Stack the hotel thumb above the booking copy so request content gets the
     full card width (matches the stacked booking card on My Bookings). */
  .roommate-match-card__booking-head {
    flex-direction: column;
  }

  /* Keep the avatar beside the name: wrapping the row itself drops the whole
     text block under the avatar. Only the text wraps, inside the row. */
  .roommate-match-card--request .roommate-match-card__request-text {
    flex-wrap: wrap;
    min-width: 0;
  }

  .roommate-match-card--request .roommate-match-card__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .roommate-match-card--request .roommate-match-card__actions .roommate-match-card__view-details,
  .roommate-match-card--request .roommate-match-card__actions form,
  .roommate-match-card--request .roommate-match-card__actions button {
    width: 100%;
  }

  .roommate-match-card--request .booking-row__request-decline-form {
    flex-wrap: wrap;
  }

  .roommate-match-card--request .booking-row__request-reason {
    max-width: none;
    flex: 1 1 100%;
  }

  .roommate-match-card--request .roommate-match-card__ref {
    margin-left: 0;
    text-align: right;
  }
}

/* HMS-744/750/762 — request details, decline-reason input, resolved badges */

.roommate-match-card__sent {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0;
}

.roommate-match-card__share {
  font-size: 0.875rem;
  color: var(--wa-color-text-normal);
  margin: 0;
}

.roommate-match-card__note {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0;
}

/* Resolved badges — the request-history palette QA pinned in HMS-1818. */
.roommate-match-card__pending--accepted {
  color: #18743b;
  background: #e1f5e5;
  border-color: #e1f5e5;
}

.roommate-match-card__pending--expired {
  color: #946200;
  background: #fff3d6;
  border-color: #fff3d6;
}

.roommate-match-card__pending--declined {
  color: #b30532;
  background: #fff0ef;
  border-color: #fff0ef;
}

.roommate-match-card__pending--cancelled {
  color: #606775;
  background: #eceef1;
  border-color: #eceef1;
}

.roommate-match-card--closed {
  opacity: 0.85;
}

/* HMS-1633 — the request a notification's "View request" deep-linked to. */
.roommate-match-card--highlight {
  outline: 2px solid var(--wa-color-brand);
  outline-offset: -2px;
}

/* Anchor scrolls must clear the sticky mobile brand bar (~3.25rem) — the
   same offset guest-review cards take (HMS-1621). */
.roommate-match-card--closed[id] {
  scroll-margin-top: 4.5rem;
}

/* HMS-744 — request history: one collapsible group per booking. */
.roommate-history-group {
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-raised);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.roommate-history-group__summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  list-style: none;
}

.roommate-history-group__summary::-webkit-details-marker {
  display: none;
}

/* HMS-1638 — the summary is a mini card head, not one run-on line: the main
   column stacks the hotel heading over the secondary owner/stay lines and
   takes the leftover width so the count badge pins right. The expand
   chevron needs no markup: Web Awesome's native.css appends a summary::after
   chevron that rotates open — the old ::before arrow plus that ::after were
   the duplicate indicators QA flagged, so only the ::before rules went. */
.roommate-history-group__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.roommate-history-group__hotel {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  overflow-wrap: break-word;
}

.roommate-history-group__owner {
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.roommate-history-group__meta {
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
  overflow-wrap: break-word;
}

/* Web Awesome pads open details and pulls the summary out by the same amount
   for its own panel chrome; our group card owns its rhythm instead, so the
   open state keeps the closed state's padding and the summary stays inside
   the border. */
.roommate-history-group[open] {
  padding: 0;
}

.roommate-history-group[open] > .roommate-history-group__summary {
  margin-inline: 0;
}

.roommate-history-group__count {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.125rem 0.5rem;
}

.roommate-history-group .roommate-match-card {
  border: none;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: 0;
}

/* Lifecycle timeline inside a history card: timestamp left, event text right. */
.roommate-timeline {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.roommate-timeline__event {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8125rem;
}

.roommate-timeline__at {
  flex: none;
  min-width: 9.5rem;
  color: var(--wa-color-text-quiet);
  font-variant-numeric: tabular-nums;
}

.roommate-timeline__text {
  color: var(--wa-color-text-normal);
}

/* Dialog decline form: reason input + submit, wrapping at mobile widths. */
.roommate-card__decline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.roommate-card__decline-reason {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--wa-color-text-normal);
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
}

/* Preference chips inside the dialog's request-details rows. */
.roommate-card__detail dd.roommate-card__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.375rem;
}

/* HMS-1758 — in-app confirmation for the roommate actions (same conventions
   as funnel-leave-dialog). HMS-1785 — head row with title + close (X),
   question split from the quieter booking/payment detail. */
.roommate-confirm-dialog {
  border: 0;
  border-radius: var(--wa-border-radius-l);
  padding: 1.5rem;
  width: min(26rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  background: var(--wa-color-surface-raised);
  color: var(--wa-color-text-normal);
  box-shadow: 0 1.5rem 3rem rgb(15 23 42 / 0.25);
}
.roommate-confirm-dialog::backdrop { background: rgb(15 23 42 / 0.6); }
.roommate-confirm-dialog__head,
.roommate-confirm-dialog__question,
.roommate-confirm-dialog__body,
.roommate-confirm-dialog__detail,
.roommate-confirm-dialog__actions {
  align-self: stretch;
}
.roommate-confirm-dialog__head,
.roommate-confirm-dialog__question,
.roommate-confirm-dialog__detail,
.roommate-confirm-dialog__actions {
  flex: none;
}
.roommate-confirm-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.roommate-confirm-dialog__title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.roommate-confirm-dialog__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--wa-color-brand-fill-quiet);
  color: var(--wa-color-brand-on-quiet);
  font-size: 1rem;
}
.roommate-confirm-dialog__icon[hidden] { display: none; }
.roommate-confirm-dialog__title {
  margin: 0;
  color: var(--wa-color-text-normal);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
}
.roommate-confirm-dialog__close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: -0.5rem -0.5rem 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--wa-border-radius-m);
  background: transparent;
  color: var(--wa-color-text-quiet);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.roommate-confirm-dialog__close:hover {
  color: var(--wa-color-text-normal);
  background: var(--wa-color-surface-lowered);
}
.roommate-confirm-dialog__question {
  margin: 1rem 0 0;
  font-size: 1rem;
  line-height: 1.5;
}
.roommate-confirm-dialog__body {
  flex: 0 1 auto;
  min-height: 0;
  margin-top: 1rem;
  overflow-y: auto;
}
.roommate-confirm-dialog__detail {
  margin: 0.5rem 0 0;
  color: var(--wa-color-text-quiet);
  font-size: 0.875rem;
  white-space: pre-line;
}
.roommate-confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
}
.roommate-confirm-dialog--plain .roommate-confirm-dialog__actions {
  margin-top: 2.25rem;
  padding-top: 0;
  border-top: 0;
}
.roommate-confirm-dialog__cancel,
.roommate-confirm-dialog__ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.5rem;
  padding: 0 1.25rem;
  border-radius: var(--wa-border-radius-m);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1;
  cursor: pointer;
}
.roommate-confirm-dialog__cancel {
  border: 1px solid var(--wa-color-neutral-border-quiet);
  background: var(--wa-color-surface-raised);
  color: var(--wa-color-text-normal);
}
.roommate-confirm-dialog__ok {
  border: none;
  background: var(--wa-color-brand-fill-loud);
  color: var(--wa-color-brand-on-loud);
}
.roommate-confirm-dialog__ok--danger {
  background: var(--wa-color-danger-fill-loud);
  color: var(--wa-color-danger-on-loud);
}

/* HMS-1780 — Sent Requests card: request details beside the cost breakdown,
   reference bottom-left, actions bottom-right. */
.roommate-match-card__columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.625rem 2rem;
  align-items: stretch;
  margin-top: 0.625rem;
}

.roommate-match-card__section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.375rem;
  color: var(--wa-color-text-normal);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.roommate-match-card__section-heading i {
  color: var(--wa-color-text-quiet);
  font-size: 0.875rem;
}

.roommate-match-card__request-info > * {
  margin-top: 0;
  margin-bottom: 0;
}

.roommate-match-card__request-info > * + * {
  margin-top: 0.125rem;
}

.roommate-match-card__request-info > .roommate-match-card__section-heading {
  margin-bottom: 0.375rem;
}

.roommate-match-card__request-info .roommate-match-card__sent,
.roommate-match-card__request-info .roommate-match-card__share,
.roommate-match-card__request-info .roommate-match-card__explainer {
  line-height: 1.35;
}

.roommate-match-card__request-info > .roommate-match-card__if-accepts {
  margin-top: 0.375rem;
}

.roommate-match-card__request-info .roommate-match-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.roommate-match-card__cost {
  padding-inline-start: 1rem;
  border-inline-start: 1px solid var(--wa-color-neutral-border-quiet, #e5e7eb);
}

.roommate-match-card__cost-rows {
  margin: 0;
}

.roommate-match-card__cost-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.9375rem;
  line-height: 1.25;
}

.roommate-match-card__cost-row + .roommate-match-card__cost-row {
  margin-top: 0.125rem;
}

.roommate-match-card__cost-row dt {
  color: var(--wa-color-text-normal);
}

.roommate-match-card__cost-row dd {
  margin: 0;
  color: var(--wa-color-text-normal);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.roommate-match-card__cost-row--total {
  margin-top: 0.25rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet, #e5e7eb);
  font-weight: 700;
}

.roommate-match-card__cost-row--total dt,
.roommate-match-card__cost-row--total dd {
  font-weight: 700;
}

/* HMS-1780 — with no shared stay there is no cost column; the request
   details take the full width instead of leaving the right half empty. */
.roommate-match-card__columns > :only-child {
  grid-column: 1 / -1;
}

.roommate-match-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-block-start: 0.625rem;
  padding-block-start: 0.625rem;
  border-block-start: 1px solid var(--wa-color-neutral-border-quiet, #e5e7eb);
}

.roommate-match-card__footer .roommate-match-card__actions {
  justify-content: flex-end;
  margin: 0 0 0 auto;
}

.roommate-match-card__footer .roommate-match-card__ref {
  margin: 0;
  text-align: left;
}

@media (max-width: 40rem) {
  .roommate-match-card--request {
    padding: 1rem;
  }

  .roommate-match-card__columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .roommate-match-card__cost {
    padding-inline-start: 0;
    padding-block-start: 0.625rem;
    border-inline-start: 0;
    border-block-start: 1px solid var(--wa-color-neutral-border-quiet, #e5e7eb);
  }

  .roommate-match-card__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .roommate-match-card__footer .roommate-match-card__actions {
    width: 100%;
    margin: 0;
  }
}

/* HMS-1793 — the Request dialog's merge preview: stays comparison, what
   accepting does, and the before/after price. The payload is authored inside
   a hidden wrapper on the suggestion card and cloned into the dialog body. */
.roommate-confirm-dialog:has(.roommate-confirm-dialog__body:not([hidden])) {
  width: min(34rem, calc(100% - 2rem));
  overflow: hidden;
}

.roommate-confirm-dialog__body {
  margin-top: 0.875rem;
  font-size: 0.875rem;
  line-height: 1.45;
}

.roommate-request-preview__hotel {
  font-weight: 600;
}

.roommate-request-preview__stays {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.375rem 0.75rem;
  margin-top: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-lowered);
}

.roommate-request-preview__col {
  font-weight: 600;
  color: var(--wa-color-text-quiet);
}

.roommate-request-preview__if {
  margin: 0.875rem 0 0.375rem;
  font-size: 0.9375rem;
}

.roommate-request-preview__steps {
  margin: 0;
  padding-inline-start: 1.25rem;
}

.roommate-request-preview__steps li + li {
  margin-top: 0.25rem;
}

.roommate-request-preview__price {
  margin: 0.75rem 0 0;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
}

.roommate-request-preview__price-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.roommate-request-preview__price-row + .roommate-request-preview__price-row {
  margin-top: 0.25rem;
}

.roommate-request-preview__price-row--total {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
  font-weight: 600;
}

.roommate-request-preview__was {
  color: var(--wa-color-text-quiet);
  text-decoration: line-through;
  font-weight: 400;
}

.roommate-request-preview__note {
  margin: 0.75rem 0 0;
  color: var(--wa-color-text-quiet);
  font-size: 0.8125rem;
}

/* HMS-1793 — Sent Requests card: the "If X accepts" explainer under the
   request details and the Now / After match / Refund price table beside it. */
.roommate-match-card__if-accepts {
  margin-top: 0.375rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  background: var(--wa-color-surface-lowered);
}

.roommate-match-card__if-accepts-title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
}

.roommate-match-card__if-accepts-list {
  margin: 0;
  padding-inline-start: 1rem;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.roommate-match-card__if-accepts-list li + li {
  margin-top: 0.125rem;
}

.roommate-match-card__price {
  margin-top: 0.5rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-match-card__price-title {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
}

.roommate-match-card__price-rows {
  margin: 0;
}

.roommate-match-card__price-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.roommate-match-card__price-row + .roommate-match-card__price-row {
  margin-top: 0.125rem;
}

.roommate-match-card__price-row dt {
  color: var(--wa-color-text-quiet);
}

.roommate-match-card__price-row dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* HMS-1823 re-test — the price-breakdown total row reads bold, and add-on
   names sit quieter inside their row label. */
.roommate-card__detail--total dt,
.roommate-card__detail--total dd {
  font-weight: 700;
}

.roommate-card__detail-note {
  font-weight: 400;
  font-size: 0.8125rem;
}

.roommate-card__fee-callout {
  margin-top: 0.625rem;
}
