/* ===========================================================================
   Chat UI — implements "Chat UI Design Spec.md"

   Scope: the chat page only (conversation list, message thread, booking detail
   panel). The surrounding sidebar/topbar belong to the host shell.
   =========================================================================== */

/* ---------------------------------------------------------------- layout -- */

/* Wrapper ensures .chat-page fills the available space irrespective of
   whether the host app has set height on every ancestor. */
.chat-page__wrapper {
  position: relative;
  height: 100%;
  /* Floor so the page still renders if the host container has no height of
     its own — at 0px the virtualized list would measure empty and show
     nothing. Hosts that set an explicit height override this naturally. */
  min-height: 520px;
}

.chat-page {
  /* Tokens */
  --chat-bg-page: #f7f7f4;
  --chat-bg-canvas: #fbfaf7;
  --chat-surface: #ffffff;
  --chat-border: #eceae4;

  --chat-input-bg: #f7f7f4;
  --chat-input-border: #e9e7e0;
  --chat-subtle-bg: #f4f3ef;

  --chat-text: #1a2233;
  --chat-text-secondary: #5b6270;
  --chat-text-muted: #8b8f98;
  --chat-text-meta: #a3a7ae;
  --chat-text-faint: #b7bac0;

  --chat-accent: #0f8f8f;
  --chat-accent-tint: #e4f6f6;
  --chat-badge: #16b8b8;
  /* Light blue bubble with dark ink — 12.9:1. A white-text blue can't be
     lightened past ~#4a6fd8 without failing AA at the 12.5px message size. */
  --chat-outgoing: #e4ebfd;
  --chat-outgoing-text: #1a2233;
  --chat-online: #2fbf6f;
  --chat-danger: #c0392b;
  --chat-star: #e0a92a;

  --chat-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    sans-serif;
  --chat-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  background: var(--chat-bg-page);
  color: var(--chat-text);
  font-family: var(--chat-font);
  font-size: 13.5px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.chat-page *,
.chat-page *::before,
.chat-page *::after {
  box-sizing: border-box;
}

.chat-page__list {
  flex: none;
  width: 280px;
  min-width: 0;
  border-right: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.chat-page__thread {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ------------------------------------------------------ conversation list -- */

.chat-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-list__head {
  flex: none;
  padding: 10px;
  border-bottom: 1px solid var(--chat-border);
}

.chat-list__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Search */

.chat-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  height: 30px;
  background: var(--chat-subtle-bg);
  border: 1px solid var(--chat-input-border);
  border-radius: 8px;
}

.chat-search__icon {
  flex: none;
  color: var(--chat-text-meta);
}

.chat-search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  color: var(--chat-text);
}

.chat-search__input::placeholder {
  color: var(--chat-text-muted);
}

.chat-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Tabs */

.chat-tabs {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.chat-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 0 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--chat-text-muted);
}

.chat-tab--active {
  color: var(--chat-accent);
  border-bottom-color: var(--chat-accent);
}

.chat-tab__count {
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--chat-accent-tint);
  color: var(--chat-accent);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.4;
}

/* Section headers */

.chat-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--chat-text-meta);
}

/* Avatar */

.chat-avatar {
  position: relative;
  flex: none;
}

.chat-avatar__img,
.chat-avatar__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.chat-avatar__dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chat-online);
  box-shadow: 0 0 0 2px var(--chat-surface);
}

/* List row */

.conversation-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  cursor: pointer;
  outline: none;
}

.conversation-row:hover {
  background: var(--chat-subtle-bg);
}

.conversation-row--selected,
.conversation-row--selected:hover {
  background: var(--chat-accent-tint);
}

.conversation-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--chat-accent);
}

.conversation-row__body {
  flex: 1;
  min-width: 0;
}

.conversation-row__line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.conversation-row__line + .conversation-row__line {
  margin-top: 2px;
}

.conversation-row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--chat-text);
}

.conversation-row__time {
  flex: none;
  font-size: 9.5px;
  color: var(--chat-text-meta);
}

.conversation-row__preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--chat-text-muted);
}

.conversation-row__badge {
  flex: none;
  min-width: 16px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--chat-badge);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

/* ------------------------------------------------------------- thread -- */

.chat-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--chat-bg-canvas);
}

.chat-thread__header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 56px;
  padding: 0 14px;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.chat-thread__identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-thread__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 600;
}

.chat-thread__subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--chat-text-meta);
}

.chat-thread__booking-id {
  flex: none;
  font-family: var(--chat-mono);
  font-size: 10.5px;
  color: var(--chat-text-meta);
}

/* Message list */

.chat-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.chat-messages__inner {
  /* min-height: 100%; */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.chat-messages__sentinel {
  flex-shrink: 0;
  margin: 4px 0;
}

.chat-messages__hint {
  margin: 24px 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--chat-text-meta);
}

.chat-date-divider {
  margin: 14px 0 10px;
  text-align: center;
  font-size: 10.5px;
  color: var(--chat-text-meta);
}

/* Bubbles */

.chat-container {
  display: block;
}

.message-row {
  display: flex;
  margin-bottom: 8px;
}

.message-row.outgoing {
  justify-content: flex-end;
}

.message-row.incoming {
  justify-content: flex-start;
}

.bubble-container {
  position: relative;
  max-width: 62%;
  min-width: 0;
}

.chat-bubble {
  padding: 7px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  word-break: break-word;
  transition: filter 0.12s ease;
}

.message-row.outgoing .chat-bubble {
  border-radius: 14px 14px 4px 14px;
  background: var(--chat-outgoing);
  color: var(--chat-outgoing-text);
}

.message-row.incoming .chat-bubble {
  border-radius: 14px 14px 14px 4px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  color: var(--chat-text);
}

.chat-bubble:hover {
  filter: brightness(0.98);
}

.chat-bubble.deleted-message {
  background: var(--chat-subtle-bg);
  border: 1px solid var(--chat-border);
  color: var(--chat-text-muted);
  font-style: italic;
}

.message-text {
  white-space: pre-wrap;
}

/* Timestamps sit under every bubble, always visible. */

.timestamp_outgoing,
.timestamp_incomeing {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  font-size: 9.5px;
  color: var(--chat-text-faint);
}

.timestamp_outgoing {
  justify-content: flex-end;
}

.timestamp_incomeing {
  justify-content: flex-start;
}

.message-status {
  display: inline-flex;
  align-items: center;
  color: var(--chat-text-faint);
}

.message-status.read {
  color: var(--chat-accent);
}

.message-status.failed {
  color: var(--chat-danger);
}

.message-status.edited,
.message-status.deleted {
  font-size: 9px;
  font-style: italic;
}

/* Hover actions on own messages */

.message-options {
  position: absolute;
  top: -10px;
  right: 4px;
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--chat-border);
  border-radius: 7px;
  background: var(--chat-surface);
  box-shadow: 0 3px 10px rgba(26, 34, 51, 0.1);
}

.message-option-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: none;
  cursor: pointer;
  color: var(--chat-text-secondary);
}

.message-option-btn:hover {
  background: var(--chat-subtle-bg);
}

.more-options-container {
  position: relative;
}

.delete-option {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  border: 1px solid var(--chat-border);
  border-radius: 7px;
  background: var(--chat-surface);
  box-shadow: 0 6px 18px rgba(26, 34, 51, 0.1);
}

.delete-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  white-space: nowrap;
  color: var(--chat-danger);
}

.delete-btn:hover {
  background: #fdecea;
}

/* Inline edit */

.edit-message-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-message-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--chat-input-border);
  border-radius: 7px;
  outline: none;
  background: var(--chat-surface);
  font: inherit;
  font-size: 12.5px;
  color: var(--chat-text);
}

.edit-actions {
  display: flex;
  gap: 6px;
}

.save-edit,
.cancel-edit {
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
}

.save-edit {
  border: 0;
  background: var(--chat-accent);
  color: #ffffff;
}

.cancel-edit {
  border: 1px solid var(--chat-input-border);
  background: var(--chat-surface);
  color: var(--chat-text-secondary);
}

/* --------------------------------------------------------- booking card -- */

.system-message {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.booking-card {
  width: 78%;
  padding: 13px;
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  background: var(--chat-surface);
}

.booking-card__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.booking-card__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.booking-card__status-label {
  font-size: 12px;
  font-weight: 700;
}

.booking-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.booking-card__cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.booking-card__label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--chat-text-meta);
}

.booking-card__value {
  font-size: 11.5px;
  color: var(--chat-text);
}

.booking-card__time {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--chat-accent);
}

.booking-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.booking-card__actions > * {
  flex: 1;
}

/* Buttons */

.chat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.chat-btn--sm {
  padding: 7px 12px;
  border-radius: 7px;
}

.chat-btn--primary {
  background: var(--chat-accent);
  color: #ffffff;
}

.chat-btn--primary:hover {
  filter: brightness(1.06);
}

.chat-btn--danger {
  background: var(--chat-surface);
  border-color: var(--chat-input-border);
  color: var(--chat-danger);
}

.chat-btn--danger:hover {
  background: #fdecea;
}

/* ---------------------------------------------------- typing indicator -- */

.typing-indicator {
  padding: 6px 2px 0;
}

.typing-indicator__pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: var(--chat-surface);
}

.typing-indicator__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-text-meta);
  opacity: 0.5;
  animation: typingDot 1.2s infinite ease-in-out;
}

.typing-indicator__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator__dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingDot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-indicator__dot {
    animation: none;
  }
}

/* ------------------------------------------------------------ composer -- */

.message-input-container {
  flex: none;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.chatMessageInputform {
  padding: 12px 14px;
}

.chatMessageInputdiv {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.attachment-container {
  position: relative;
  flex: none;
}

.attachment-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--chat-subtle-bg);
  cursor: pointer;
  color: var(--chat-text-secondary);
}

.attachment-button:hover {
  background: var(--chat-input-border);
}

.attachment-icon {
  display: inline-flex;
}

.attachment-options {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  padding: 4px;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  background: var(--chat-surface);
  box-shadow: 0 6px 18px rgba(26, 34, 51, 0.1);
}

.attachment-options button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  color: var(--chat-text-secondary);
}

.attachment-options button:hover {
  background: var(--chat-subtle-bg);
}

.attachment-options .icon {
  display: inline-flex;
  color: var(--chat-text-muted);
}

.chatMessageInput {
  flex: 1;
  min-width: 0;
  max-height: 96px;
  padding: 8px 13px;
  border: 1px solid var(--chat-input-border);
  border-radius: 20px;
  outline: none;
  background: var(--chat-input-bg);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--chat-text);
}

.chatMessageInput::placeholder {
  color: var(--chat-text-muted);
}

.chatMessageInput:focus {
  border-color: var(--chat-accent);
}

.chatMessageInputSubmit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--chat-accent);
  cursor: pointer;
}

.chatMessageInputSubmit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Attachment previews above the composer */

.attachments-preview-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 0;
}

.attachments-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
}

.scroll-button {
  flex: none;
  width: 22px;
  height: 22px;
  border: 1px solid var(--chat-input-border);
  border-radius: 50%;
  background: var(--chat-surface);
  cursor: pointer;
  font-size: 11px;
  color: var(--chat-text-secondary);
}

.scroll-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.add-more-files {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  width: 72px;
  height: 72px;
  border: 1px dashed var(--chat-input-border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--chat-text-muted);
}

.plus-icon {
  font-size: 16px;
  line-height: 1;
}

.add-more-text {
  font-size: 9.5px;
}

.file-preview {
  position: relative;
  flex: none;
  width: 72px;
}

.file-preview-content {
  width: 72px;
  height: 72px;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--chat-subtle-bg);
}

.file-preview-image,
.file-preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-preview-document {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 20px;
}

.remove-file {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border: 1px solid var(--chat-border);
  border-radius: 50%;
  background: var(--chat-surface);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  color: var(--chat-text-secondary);
}

.file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10.5px;
  color: var(--chat-text-secondary);
}

.file-size {
  font-size: 9.5px;
  color: var(--chat-text-meta);
}

.upload-progress {
  height: 3px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--chat-border);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--chat-accent);
  transition: width 0.2s ease;
}

.upload-error {
  font-size: 9.5px;
  color: var(--chat-danger);
}

/* -------------------------------------------------------------- media -- */

.media-grid {
  display: grid;
  gap: 4px;
  margin-bottom: 5px;
}

.media-grid.single-media {
  grid-template-columns: 1fr;
}

.media-grid.multi-media {
  grid-template-columns: 1fr 1fr;
}

.media-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  /* Diagonal-stripe placeholder shows through until the media paints. */
  background: repeating-linear-gradient(
    45deg,
    #eceae4 0 10px,
    #f4f3ef 10px 20px
  );
}

.media-content {
  display: block;
  width: 180px;
  max-width: 100%;
  height: 120px;
  object-fit: cover;
  cursor: pointer;
}

.media-grid.multi-media .media-content {
  width: 100%;
  height: 88px;
}

.document-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px;
  background: var(--chat-surface);
}

.file-icon {
  font-size: 18px;
}

.download-btn {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  background: rgba(26, 34, 51, 0.55);
  cursor: pointer;
  font-size: 10px;
  color: #ffffff;
}

.download-progress-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 42px;
}

.download-progress {
  height: 2px;
  background: var(--chat-accent);
}

.cancel-download {
  font-size: 9px;
}

.circular-progress-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 120px;
}

.media-preview-background {
  position: absolute;
  inset: 0;
}

.blurred-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(6px);
}

.circular-progress {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
}

.circular-progress-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circular-progress-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 3;
}

.circular-progress-bar {
  fill: none;
  stroke: var(--chat-accent);
  stroke-width: 3;
  stroke-linecap: round;
}

.circular-progress-text {
  position: absolute;
  font-size: 9.5px;
  font-weight: 600;
  color: #ffffff;
}

/* ------------------------------------------------------- booking panel -- */

.booking-panel {
  flex: none;
  display: flex;
  flex-direction: column;
  width: 210px;
  min-height: 0;
  border-left: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.booking-panel__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px;
}

.booking-panel__header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.booking-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.booking-status-pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.booking-panel__stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 16px;
}

.booking-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.booking-field__label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--chat-text-meta);
}

.booking-field__value {
  font-size: 11.5px;
  color: var(--chat-text);
  word-break: break-word;
}

.booking-field__value--mono {
  font-family: var(--chat-mono);
}

.booking-field__value--accent {
  font-size: 13px;
  font-weight: 700;
  color: var(--chat-accent);
}

.booking-accordion {
  margin-top: 14px;
  border-top: 1px solid var(--chat-border);
}

.booking-accordion__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--chat-text);
}

.booking-accordion__chevron {
  color: var(--chat-text-muted);
}

.booking-accordion__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px;
  border-radius: 8px;
  background: var(--chat-input-bg);
}

.booking-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.booking-kv__label {
  color: var(--chat-text-muted);
}

.booking-kv__value {
  text-align: right;
  color: var(--chat-text);
}

.booking-panel__footer {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.booking-panel__footer .chat-btn {
  width: 100%;
}

/* -------------------------------------------------------------- empty -- */

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 32px 20px;
  text-align: center;
}

.chat-empty--thread {
  flex: 1;
  height: 100%;
  background: var(--chat-bg-canvas);
}

.chat-empty__icon {
  margin-bottom: 8px;
  color: var(--chat-text-faint);
}

.chat-empty__title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--chat-text-secondary);
}

.chat-empty__text {
  margin: 0;
  max-width: 240px;
  font-size: 11px;
  color: var(--chat-text-muted);
}

/* ------------------------------------------------------------- loader -- */

.loader-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.dot-spinner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.dot-spinner__dot {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
}

.dot-spinner__dot::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--chat-accent);
  opacity: 0.5;
  animation: dotSpinnerFade 1s infinite linear;
}

.dot-spinner__dot:nth-child(1) { transform: rotate(0deg); }
.dot-spinner__dot:nth-child(2) { transform: rotate(45deg); }
.dot-spinner__dot:nth-child(3) { transform: rotate(90deg); }
.dot-spinner__dot:nth-child(4) { transform: rotate(135deg); }
.dot-spinner__dot:nth-child(5) { transform: rotate(180deg); }
.dot-spinner__dot:nth-child(6) { transform: rotate(225deg); }
.dot-spinner__dot:nth-child(7) { transform: rotate(270deg); }
.dot-spinner__dot:nth-child(8) { transform: rotate(315deg); }

.dot-spinner__dot:nth-child(1)::before { animation-delay: 0s; }
.dot-spinner__dot:nth-child(2)::before { animation-delay: 0.125s; }
.dot-spinner__dot:nth-child(3)::before { animation-delay: 0.25s; }
.dot-spinner__dot:nth-child(4)::before { animation-delay: 0.375s; }
.dot-spinner__dot:nth-child(5)::before { animation-delay: 0.5s; }
.dot-spinner__dot:nth-child(6)::before { animation-delay: 0.625s; }
.dot-spinner__dot:nth-child(7)::before { animation-delay: 0.75s; }
.dot-spinner__dot:nth-child(8)::before { animation-delay: 0.875s; }

@keyframes dotSpinnerFade {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* -------------------------------------------------------- responsive -- */

/* Below ~1200px the booking panel folds away before the thread is squeezed. */
@media (max-width: 1200px) {
  .booking-panel {
    display: none;
  }
}

@media (max-width: 820px) {
  .chat-page__list {
    width: 190px;
  }
}

/* ===========================================================================
   Additions for the current component structure
   =========================================================================== */

/* The list is head + body; the body holds the tabs and the scroll area. */
.chat-list__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.chat-list__body .chat-tabs {
  flex: none;
  gap: 0;
  margin: 0;
  border-bottom: 1px solid var(--chat-border);
}

.chat-list__body .chat-tab {
  flex: 1;
  justify-content: center;
  padding: 9px 6px;
  margin-bottom: -1px;
}

/* Virtualized conversation list. The virtualizer measures this element, so it
   must have a definite height — flex:1 inside a bounded column, or an explicit
   cap when nested in a collapsible service group. */
.chat-vlist {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.chat-vlist--bounded {
  height: auto;
  max-height: 264px;
}

.chat-vlist__sizer {
  position: relative;
  width: 100%;
}

.chat-vlist__item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

/* Service grouping */

.chat-group {
  border-bottom: 1px solid var(--chat-border);
}

.chat-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.chat-group__header:hover {
  background: var(--chat-subtle-bg);
}

.chat-group__chevron {
  font-size: 10px;
  color: var(--chat-text-muted);
}

.chat-group__body {
  padding-bottom: 4px;
}

/* Service conversations show an icon rather than a person's avatar. */
.conversation-row__service-icon,
.chat-thread__service-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--chat-accent-tint);
  color: var(--chat-accent);
}

/* Back button: mobile-only, since the list is always visible on desktop. */
.chat-thread__back {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  color: var(--chat-text-secondary);
}

.chat-thread__back:hover {
  background: var(--chat-subtle-bg);
}

/* Below this width the list and thread swap instead of sitting side by side. */
@media (max-width: 720px) {
  .chat-page__list {
    width: 100%;
    border-right: 0;
  }

  .chat-page__list.mobile-hidden,
  .chat-page__thread.mobile-hidden {
    display: none;
  }

  .chat-page__thread.mobile-visible {
    display: flex;
  }

  .chat-thread__back {
    display: inline-flex;
  }
}
