/* Customer salon conversations, scoped to the My Hair Chats workspace. */
.customer-chats {
  --chat-ink: #292536;
  --chat-muted: #777383;
  --chat-line: #e8e6ed;
  --chat-purple: #67549a;
  --chat-soft: #f4f0fb;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
  min-height: 0;
  color: var(--chat-ink);
}
body.me-workspace-mode .me-workspace:has(> .customer-chats) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.me-workspace > .customer-chats { flex: 1; }
.customer-chats .me-page-header { margin: 0; }
.customer-chats-layout {
  display: grid;
  grid-template-columns: minmax(240px, 30%) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--chat-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 16px rgba(38, 29, 60, .025);
}
.customer-chat-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--chat-line);
  background: #fff;
}
.customer-chat-list > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 18px 14px;
}
.customer-chat-list > header :is(h2, h3, strong) {
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.4;
}
.customer-chat-list > header :is(span, small) {
  color: var(--chat-muted);
  font-size: .75rem;
}
.customer-chat-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 14px;
  border: 1px solid var(--chat-line);
  border-radius: 9px;
  padding: 0 11px;
  color: #908a9b;
  background: #faf9fc;
}
.customer-chat-search .icon { width: 16px; height: 16px; flex: 0 0 16px; }
.customer-chat-search input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  padding: 8px 0;
  background: transparent;
  color: var(--chat-ink);
  box-shadow: none;
  font: inherit;
  font-size: .77rem;
}
.customer-chat-search:focus-within { border-color: #a99ac5; box-shadow: 0 0 0 3px #67549a12; }
.customer-chat-search input:focus-visible { outline-offset: 4px; }
.customer-chat-salon-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 8px 10px;
  scrollbar-width: thin;
  scrollbar-color: #ddd7e6 transparent;
  overscroll-behavior: contain;
}
.customer-chats .customer-chat-salon-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  /* Preserve roomy rows against the customer shell's mobile 44px reset. */
  min-height: 74px !important;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 10px;
  text-align: left;
  color: var(--chat-ink);
  background: #fff;
  font: inherit;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease;
}
.customer-chat-salon-row:hover { background: #f8f6fb; }
.customer-chat-salon-row[aria-current="true"] { border-color: #e9e1f5; background: var(--chat-soft); }
.customer-chat-avatar {
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 1px solid #e8e1f0;
  border-radius: 12px;
  color: var(--chat-purple);
  background: #f1ecf9;
  font-size: .9rem;
  font-weight: 700;
}
.customer-chat-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.customer-chat-row-copy { display: grid; flex: 1; min-width: 0; gap: 5px; }
.customer-chat-row-heading { display: flex; min-width: 0; align-items: center; gap: 8px; }
.customer-chat-row-heading strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--chat-ink);
  font-size: .8rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-chat-row-heading time { flex: 0 0 auto; color: var(--chat-muted); font-size: .66rem; font-weight: 400; }
.customer-chat-preview {
  display: block;
  overflow: hidden;
  margin: 0;
  color: var(--chat-muted);
  font-size: .74rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-chat-unread,
.customer-chat-unread-badge {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 19px;
  height: 19px;
  border-radius: 6px;
  padding: 0 5px;
  color: #fff;
  background: var(--chat-purple);
  font-size: .64rem;
  font-weight: 700;
}
.customer-chat-room {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}
.customer-chat-room-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 77px;
  border-bottom: 1px solid var(--chat-line);
  padding: 15px 22px;
  background: #fff;
}
.customer-chat-back { display: none; }
.customer-chat-back-icon { display: inline-flex; transform: rotate(180deg); }
.customer-chat-salon-link {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--chat-ink);
  background: transparent;
  text-align: left;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.customer-chat-salon-link > :not(.customer-chat-avatar) { min-width: 0; }
.customer-chat-salon-link :is(h2, h3, strong) { display: block; overflow: hidden; margin: 0; font-size: .9rem; font-weight: 650; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.customer-chat-salon-link :is(small, p) { display: block; margin: 3px 0 0; color: var(--chat-muted); font-size: .72rem; line-height: 1.4; }
.customer-chat-salon-link:hover :is(h2, h3, strong) { color: var(--chat-purple); }
.customer-chat-room-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 8px; }
.customer-chat-room-actions button { min-height: 36px; font-size: .73rem; }
.customer-chat-stream.appointment-message-thread {
  gap: 12px;
  padding: 22px 24px;
  background: #fcfbfe;
  overscroll-behavior: contain;
  scroll-padding-block: 20px;
}
.customer-chat-stream.appointment-message-thread > * { flex-shrink: 0; }
.customer-chat-stream.appointment-message-thread article { max-width: min(82%, 460px); padding: 10px 13px 8px; box-shadow: none; }
.customer-chat-stream.appointment-message-thread article p { font-size: .82rem; line-height: 1.55; }
.customer-chat-stream.appointment-message-thread article.salon { border-color: #e9e5ef; background: #fff; }
.customer-chat-stream.appointment-message-thread article.customer:not(.is-failed) { border-color: var(--chat-purple); background: var(--chat-purple); }
.customer-chat-stream.appointment-message-thread article footer { gap: 7px; margin-top: 5px; }
.customer-chat-stream.appointment-message-thread article footer :is(time, span) { font-size: .63rem; }
.customer-chat-date { align-self: center; margin: 9px 0 5px; color: #8b8495; font-size: .66rem; font-weight: 550; line-height: 1.5; text-align: center; }
.customer-chat-appointment {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 14px;
  align-self: center;
  align-items: center;
  gap: 12px;
  width: min(100%, 480px);
  min-width: 0;
  border: 1px solid #e6e0ee;
  border-radius: 11px;
  padding: 14px;
  color: var(--chat-ink);
  background: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease;
}
.customer-chat-appointment:hover { border-color: #c9bcdf; background: #fdfbff; }
.customer-chat-appointment > span:first-child { display: grid; place-items: center; color: #8a77aa; }
.customer-chat-appointment > span:first-child .icon { width: 20px; height: 20px; }
.customer-chat-appointment > .icon { width: 14px; height: 14px; color: #8a77aa; }
.customer-chat-appointment-copy { display: grid; flex: 1; min-width: 0; gap: 4px; }
.customer-chat-appointment-copy small { color: #897d99; font-size: .63rem; font-weight: 600; line-height: 1.4; }
.customer-chat-appointment-copy strong { color: var(--chat-ink); font-size: .79rem; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.customer-chat-appointment-copy > span { color: var(--chat-muted); font-size: .7rem; line-height: 1.45; }
.customer-chat-appointment .status-badge { flex: 0 0 auto; max-width: 110px; border-radius: 6px; font-size: .61rem; text-align: center; white-space: normal; }
.customer-chat-composer.appointment-message-composer { position: relative; z-index: 1; gap: 10px; border-color: var(--chat-line); padding: 15px 20px; }
.customer-chat-composer.appointment-message-composer textarea { min-height: 46px; max-height: 112px; border-color: #e4dfeb; border-radius: 10px; padding: 11px 13px; background: #fcfbfe; font-size: .82rem; }
.customer-chat-composer.appointment-message-composer > small { grid-column: 1 / -1; color: var(--chat-muted); font-size: .65rem; line-height: 1.35; }
.customer-chat-composer.appointment-message-composer button { min-width: 70px; min-height: 44px; border-radius: 9px; font-size: .79rem; }
.customer-chat-empty,
.customer-chat-loading { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px 24px; color: var(--chat-muted); text-align: center; font-size: .82rem; line-height: 1.65; }
.customer-chat-room > .customer-chat-empty,
.customer-chat-room > .customer-chat-loading { grid-row: 1 / -1; }
.customer-chat-empty .icon,
.customer-chat-loading .icon { width: 26px; height: 26px; color: #a89abf; }
.customer-chat-empty :is(h2, h3, strong) { margin: 0; color: #51475f; font-size: .95rem; font-weight: 600; }
.customer-chat-empty p { max-width: 300px; margin: 0; }
.customer-chat-error { margin: 12px; border: 1px solid #efdad8; border-radius: 9px; padding: 12px 14px; color: #934c47; background: #fff9f8; font-size: .76rem; line-height: 1.55; }
.customer-chat-error button { margin-left: 8px; }
.customer-chat-note { margin: 0; border-top: 1px solid var(--chat-line); padding: 13px 20px; color: var(--chat-muted); background: #fcfbfe; font-size: .73rem; line-height: 1.5; text-align: center; }
.customer-chats :is(button, a, input, textarea, [tabindex="0"]):focus-visible { outline: 3px solid #a18cc5; outline-offset: 2px; }
@media (max-width: 1180px) and (min-width: 761px) {
  .customer-chats-layout { grid-template-columns: minmax(225px, 34%) minmax(0, 1fr); }
  .customer-chat-room-header { padding-inline: 16px; }
  .customer-chat-stream.appointment-message-thread { padding: 18px 16px; }
  .customer-chat-composer.appointment-message-composer { padding-inline: 14px; }
}
@media (max-width: 768px) {
  body.me-workspace-mode .me-workspace:has(> .customer-chats) { overflow: visible; }
  .me-workspace > .customer-chats { flex: 0 0 auto; }
  .customer-chats { height: clamp(440px, calc(100dvh - 340px), 760px); }
}
@media (max-width: 760px) {
  .customer-chats { gap: 16px; }
  .customer-chats-layout { grid-template-columns: minmax(0, 1fr); border-radius: 13px; }
  .customer-chat-list { border-right: 0; }
  .customer-chat-list > header { padding: 17px 16px 12px; }
  .customer-chat-list > header :is(h2, h3, strong) { font-size: .92rem; }
  .customer-chat-search input { font-size: 16px; }
  .customer-chat-salon-row { min-height: 74px; }
  .customer-chat-row-heading strong { font-size: .83rem; }
  .customer-chat-room { display: none; }
  .customer-chats.is-room-open .customer-chat-list { display: none; }
  .customer-chats.is-room-open .customer-chat-room { display: grid; }
  .customer-chat-back { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 36px; min-height: 40px; border: 0; border-radius: 8px; padding: 7px; color: var(--chat-purple); background: transparent; }
  .customer-chat-back .icon { width: 18px; height: 18px; }
  .customer-chat-room-header { min-height: 72px; gap: 7px; padding: 12px; }
  .customer-chat-room-header .customer-chat-avatar { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
  .customer-chat-salon-link { gap: 9px; }
  .customer-chat-salon-link :is(h2, h3, strong) { font-size: .83rem; }
  .customer-chat-salon-link :is(small, p) { font-size: .66rem; }
  .customer-chat-room-actions { gap: 4px; }
  .customer-chat-room-actions button { min-width: 36px; min-height: 38px; padding: 7px; font-size: .68rem; }
  .customer-chat-stream.appointment-message-thread { padding: 16px 12px; }
  .customer-chat-stream.appointment-message-thread article { max-width: 88%; }
  .customer-chat-appointment { grid-template-columns: 20px minmax(0, 1fr) 14px; gap: 8px 10px; padding: 12px; }
  .customer-chat-appointment-copy { grid-column: 2; }
  .customer-chat-appointment .status-badge { grid-row: 2; grid-column: 2; justify-self: start; margin: 0; }
  .customer-chat-appointment > .icon { grid-row: 1 / 3; grid-column: 3; }
  .customer-chat-composer.appointment-message-composer { gap: 8px; padding: 11px; }
  .customer-chat-composer.appointment-message-composer textarea { padding: 10px; font-size: 16px; }
  .customer-chat-composer.appointment-message-composer button { min-width: 56px; padding-inline: 10px; }
  .customer-chat-note { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .customer-chat-salon-row,
  .customer-chat-appointment { transition: none; }
}
