/* Message first on the booking page (/client-order-confirmation): the button
   that starts the lane and the chat panel that opens over the page. On a
   computer the panel is a white column on the right over the dimmed page; on
   a phone it is a sheet from the bottom. It uses the booking page's own
   colors (the --ht-* tokens on .ht-cb) and fonts, and every control sets its
   own text color (the app's web view tints unstyled controls). */

/* The start button, in the HappyTasker box. */
.ht-cb .ht-mf-start {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  padding: 12px 20px;
  border: 1px solid var(--ht-ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ht-ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}
.ht-cb .ht-mf-start:hover { background: var(--ht-bg); color: var(--ht-ink); }
.ht-cb.is-booked .ht-mf-start { display: none; }
/* While the button under Book shows (the "Have a question?" row, .ht-start),
   it is the only one (captain: "under the booking button"); the panel script
   sets data-ht-mf-side on the screens where that row is drawn. */
.ht-cb[data-ht-mf-side="later"] .ht-cb__side .ht-mf-start { display: none; }

/* The panel. */
html.ht-mf-open, html.ht-mf-open body { overflow: hidden; }
.ht-cb .ht-mf {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  /* Above the address suggestion field (z-index 10080) so the page's street
     box cannot draw through the panel. */
  z-index: 20000;
  display: flex;
  justify-content: flex-end;
}
.ht-cb .ht-mf[hidden] { display: none; }
/* The app opens Terms and Privacy as a sheet: it goes over the open panel. */
html.ht-mf-open .ht-legal-sheet { z-index: 20010; }
.ht-mf__shade {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.ht-mf__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 440px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  color: var(--ht-ink);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.16);
  outline: none;
  animation: ht-mf-side 0.2s ease;
}
@keyframes ht-mf-side { from { transform: translateX(24px); opacity: 0; } }
@keyframes ht-mf-up { from { transform: translateY(24px); opacity: 0; } }
.ht-mf__grab { display: none; }

.ht-mf__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ht-line);
}
.ht-mf__photo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--ht-line);
  background: var(--ht-bg);
}
.ht-mf__who { min-width: 0; flex: 1 1 auto; }
.ht-cb .ht-mf__name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ht-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ht-cb .ht-mf__service { margin: 1px 0 0; font-size: 13px; line-height: 1.3; color: var(--ht-ink-3); }
.ht-cb .ht-mf__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ht-bg);
  color: var(--ht-ink);
  cursor: pointer;
}
.ht-cb .ht-mf__close:hover { background: #ededed; color: var(--ht-ink); }

.ht-mf__thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px;
}
.ht-cb .ht-mf__empty {
  margin: 24px 0 0;
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ht-ink-3);
}
.ht-cb .ht-mf__empty[hidden] { display: none; }
.ht-cb .ht-mf__list { margin: 0; padding: 0; list-style: none; }
.ht-mf__msg { display: flex; flex-direction: column; margin: 0 0 14px; }
.ht-mf__msg--me { align-items: flex-end; }
.ht-mf__msg--them { align-items: flex-start; }
.ht-cb .ht-mf__bubble {
  max-width: 84%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ht-cb .ht-mf__msg--me .ht-mf__bubble { background: var(--ht-ink); color: #fff; border-bottom-right-radius: 6px; }
.ht-cb .ht-mf__msg--them .ht-mf__bubble { background: var(--ht-bg); color: var(--ht-ink); border-bottom-left-radius: 6px; }
.ht-cb .ht-mf__time { margin: 5px 2px 0; font-size: 12px; line-height: 1.3; color: var(--ht-ink-3); }
.ht-cb .ht-mf__wait {
  margin: 26px 0 0;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ht-ink-3);
}
.ht-cb .ht-mf__wait[hidden] { display: none; }
.ht-cb .ht-mf__notice {
  width: fit-content;
  max-width: 100%;
  margin: 14px auto 0;
  padding: 10px 16px;
  border: 1px solid var(--ht-line);
  border-radius: 10px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ht-ink-2);
}
.ht-cb .ht-mf__notice[hidden] { display: none; }
.ht-cb .ht-mf__notice .ht-link { display: block; color: var(--ht-blue); }
.ht-cb .ht-mf__load { text-align: center; }

.ht-cb .ht-mf__compose {
  display: block;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 12px 20px 10px;
  border-top: 1px solid var(--ht-line);
  background: #fff;
}
.ht-cb .ht-mf__compose[hidden] { display: none; }
.ht-mf__row { display: flex; align-items: flex-end; gap: 10px; }
.ht-cb .ht-mf__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  max-height: 132px;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #b0b0b0;
  border-radius: 10px;
  background: #fff;
  color: var(--ht-ink);
  font-family: inherit;
  /* 16px keeps an iPhone from zooming the page when the box is tapped. */
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  box-shadow: none;
}
.ht-cb .ht-mf__input:focus { outline: none; border-color: var(--ht-ink); box-shadow: 0 0 0 1px var(--ht-ink); }
.ht-cb .ht-mf__send { flex: 0 0 auto; padding: 14px 20px; }
.ht-cb .ht-mf__compose .ht-card__error { margin-top: 8px; }
.ht-cb .ht-mf__keep { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--ht-ink-3); }

.ht-mf__foot {
  flex: 0 0 auto;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ht-line);
  background: #fff;
}

/* Phone: a sheet from the bottom, with the page still showing above it. */
@media (max-width: 899px) {
  .ht-cb .ht-mf { align-items: flex-end; justify-content: center; }
  .ht-mf__panel {
    width: 100%;
    height: calc(100% - 64px);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.16);
    animation-name: ht-mf-up;
  }
  .ht-mf__grab {
    display: block;
    flex: 0 0 auto;
    width: 40px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 3px;
    background: #d9d9d9;
  }
  .ht-mf__head { padding: 10px 16px 14px; }
  .ht-mf__thread { padding: 18px 16px; }
  .ht-cb .ht-mf__compose { padding: 10px 16px 8px; }
  .ht-mf__foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  /* With the keyboard open there is little room: the sheet takes it all. The
     page under it is not drawn, so none of it shows through a keyboard whose
     top bar is see-through. */
  .ht-mf.is-short .ht-mf__panel { height: 100%; border-radius: 0; }
  html.ht-mf-short .ht-cb > :not(.ht-mf) { visibility: hidden; }
  .ht-mf.is-short .ht-mf__grab,
  .ht-mf.is-short .ht-mf__keep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ht-mf__panel { animation: none; }
}

/* Someone not signed in typed first: the message waits in the chat, and the
   booking page's own phone, code and name boxes sit here, where the text box
   was (js/custom/message-first-panel.js). */
.ht-cb .ht-mf__signin {
  flex: 0 0 auto;
  max-height: 70%;
  overflow-y: auto;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--ht-line);
  background: #fff;
}
.ht-cb .ht-mf__signin[hidden] { display: none; }
.ht-cb .ht-mf__signin .ht-info__helper { margin: 8px 0 0; }
.ht-cb .ht-mf__signin .ht-btn { width: 100%; margin-top: 12px; }
/* The two name boxes side by side, as on the one-screen booking form. */
.ht-cb .ht-mf__signin [data-ht-login-step="name"]:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 12px;
}
.ht-cb .ht-mf__signin [data-ht-login-step="name"] .ht-float { margin-top: 0; }
.ht-cb .ht-mf__signin [data-ht-login-step="name"] > :not(.ht-float) { grid-column: 1 / -1; }
.ht-cb .ht-mf__signin [data-ht-login-step="name"] .ht-mf__why { margin: 8px 0 0; }
/* The emptied Your info card under the panel is not drawn. */
.ht-cb.ht-mf-borrowed [data-step-kind="your_info"] { visibility: hidden; }
.ht-cb .ht-mf__msg.is-pending .ht-mf__bubble { opacity: 0.6; }
@media (max-width: 899px) {
  .ht-cb .ht-mf__signin { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
}
