/* Keep client booking rows consistent and vertically balanced. */
#root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card {
  box-sizing: border-box;
  height: auto !important;
  min-height: 82px !important;
  padding: 12px 20px !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

#root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card > .booking-information {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

#root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card > .booking-actions {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  align-items: center;
  justify-self: end;
  justify-content: flex-end;
  flex-wrap: nowrap !important;
  width: auto;
  white-space: nowrap;
}

#root .bookings-page:not(.provider-bookings-page) .contract-request-state {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* A client-hidden confirmation panel must not leave an empty grid row. */
#root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) {
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: auto !important;
  grid-auto-rows: auto !important;
  min-height: 82px !important;
}

#root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) > .booking-information {
  grid-column: 1 !important;
  grid-row: 1 !important;
}

#root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) > .booking-actions {
  grid-column: 2 !important;
  grid-row: 1 !important;
}

@media (max-width: 1250px) {
  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card {
    height: auto !important;
    min-height: 82px !important;
    padding: 14px 16px !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card > .booking-actions {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    justify-content: flex-start;
    flex-wrap: wrap !important;
    width: 100%;
    white-space: normal;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) > .booking-actions {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }
}

@media (max-width: 700px) {
  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card,
  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 14px;
    height: auto !important;
    min-height: 0 !important;
    padding: 16px !important;
    border-radius: 15px;
    box-shadow: 0 8px 22px rgba(20, 54, 86, 0.08);
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card > .client-booking-information,
  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) > .client-booking-information {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    align-items: start;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  #root .bookings-page:not(.provider-bookings-page) .client-booking-information > .status {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    align-self: start;
  }

  #root .bookings-page:not(.provider-bookings-page) .client-booking-summary {
    box-sizing: border-box;
    display: grid;
    grid-column: 1;
    grid-row: 2;
    gap: 7px;
    width: 100%;
    min-width: 0;
  }

  #root .bookings-page:not(.provider-bookings-page) .client-booking-summary > h2 {
    margin: 0 0 2px;
    color: #132b45;
    font-size: 18px;
    font-weight: 750;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  #root .bookings-page:not(.provider-bookings-page) .client-booking-summary > p {
    box-sizing: border-box;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid #e6edf5;
    border-radius: 9px;
    color: #52677d;
    background: #f7fafe;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card > .booking-actions,
  #root .bookings-page:not(.provider-bookings-page) .booking-list > .booking-card:has(.booking-confirmation) > .booking-actions {
    display: grid;
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    justify-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-actions > *,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .request-contract-action,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .contract-request-state,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .review-action,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .review-submitted,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .offline-action {
    box-sizing: border-box;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    white-space: normal;
    text-align: center;
    overflow-wrap: anywhere;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .request-contract-action,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .contract-request-state,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .review-action,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .review-submitted,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > .offline-action {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  #root .bookings-page:not(.provider-bookings-page) .booking-actions > button,
  #root .bookings-page:not(.provider-bookings-page) .booking-actions > a {
    width: 100%;
    justify-content: center;
    align-items: center;
    display: inline-flex;
  }
}
