/* H5 buyer/seller customer-service messages */
.chat-inbox-page,
.chat-thread-page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #f7f7f7;
}
.chat-inbox-page {
  min-height: 100vh;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}
.chat-inbox-top {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--eb-line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.chat-logo { height: 26px; width: auto; }
.chat-inbox-title { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.chat-refresh {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--eb-gray);
}
.chat-refresh:hover { background: #f2f4f8; color: var(--eb-blue); }
.chat-inbox-hint {
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--eb-line);
  font-size: 11.5px;
  color: var(--eb-gray);
}
.chat-list { background: #fff; margin-top: 10px; border-top: 1px solid var(--eb-line); border-bottom: 1px solid var(--eb-line); }
.chat-thread-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--eb-line-soft);
  background: #fff;
}
.chat-thread-row:last-child { border-bottom: 0; }
.chat-thread-row:active { background: #fafbff; }
.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--eb-blue-soft);
  color: var(--eb-blue);
  font-size: 17px;
  font-weight: 700;
  border: 1px solid #e8efff;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-avatar--sm { width: 38px; height: 38px; font-size: 14px; }
.chat-thread-main { flex: 1; min-width: 0; }
.chat-thread-top { display: flex; align-items: center; gap: 8px; }
.chat-thread-top b {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-thread-top time { margin-left: auto; flex: none; font-size: 10px; color: #9aa0ab; }
.chat-thread-role {
  margin-top: 2px; font-size: 10px; color: var(--eb-blue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-thread-last {
  margin-top: 4px; font-size: 12px; color: var(--eb-gray);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-unread {
  flex: none;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--eb-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-inbox-empty,
.chat-inbox-loading {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 26px;
  text-align: center;
  color: var(--eb-gray);
}
.chat-inbox-loading { font-size: 13px; }
.chat-inbox-empty b { margin-top: 10px; font-size: 15px; color: var(--eb-ink); }
.chat-inbox-empty p { max-width: 280px; margin-top: 6px; font-size: 12px; line-height: 1.7; }
.chat-inbox-empty button {
  margin-top: 16px; height: 38px; padding: 0 20px; border-radius: 19px;
  background: var(--eb-blue); color: #fff; font-size: 13px; font-weight: 600;
}
.chat-empty-ico {
  width: 64px; height: 64px; border-radius: 50%;
  background: #fff; border: 1px solid var(--eb-line);
  display: flex; align-items: center; justify-content: center;
  color: var(--eb-blue);
}

/* ---------------- thread ---------------- */
.chat-thread-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-thread-head {
  flex: none;
  height: 60px;
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid var(--eb-line);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
}
.chat-back {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--eb-ink); flex: none;
}
.chat-thread-name { flex: 1; min-width: 0; }
.chat-thread-name b {
  display: block; font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-thread-name span {
  display: block; margin-top: 2px; font-size: 10px; color: var(--eb-gray);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-refresh--thread { margin-left: 0; width: 32px; height: 32px; }
.chat-thread-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px 8px;
  background:
    radial-gradient(circle at 20% 10%, rgba(54, 101, 243, .035), transparent 45%),
    #f7f8fb;
}
.chat-thread-empty {
  padding: 70px 24px; text-align: center; color: var(--eb-gray);
  display: flex; flex-direction: column; align-items: center;
}
.chat-thread-empty b { margin-top: 10px; font-size: 14px; color: var(--eb-ink); }
.chat-thread-empty p { margin-top: 5px; font-size: 11.5px; line-height: 1.7; }
.chat-msg { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-msg-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--eb-blue-soft); color: var(--eb-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  border: 1px solid #e4ebff;
}
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-msg-main { max-width: 78%; min-width: 0; }
.chat-msg.mine .chat-msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.chat-bubble {
  display: inline-block;
  padding: 9px 12px;
  border-radius: 4px 13px 13px 13px;
  background: #fff;
  border: 1px solid #e7e9ef;
  color: var(--eb-ink);
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .02);
}
.chat-msg.mine .chat-bubble {
  background: var(--eb-blue);
  border-color: var(--eb-blue);
  color: #fff;
  border-radius: 13px 4px 13px 13px;
}
.chat-msg-time { margin-top: 3px; font-size: 9px; color: #9aa0ab; }
.chat-msg.mine .chat-msg-time { text-align: right; }
.chat-bubble-img { padding: 4px; background: #fff !important; border-color: #e7e9ef !important; border-radius: 12px !important; }
.chat-bubble-img img { display: block; width: 200px; height: auto; max-width: 100%; max-height: 300px; border-radius: 9px; object-fit: cover; cursor: zoom-in; }
.chat-img-caption { padding: 7px 7px 2px; font-size: 12px; color: var(--eb-ink) !important; }
.chat-order-card {
  width: 255px; max-width: 100%;
  background: #fff; border: 1px solid #e0e4ec; border-radius: 12px;
  padding: 11px; text-align: left; cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
.chat-order-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.chat-order-head span { font-size: 10px; font-weight: 700; color: var(--eb-blue); }
.chat-order-head b { font-size: 9.5px; color: var(--eb-blue); background: var(--eb-blue-soft); border-radius: 9px; padding: 2px 7px; }
.chat-order-prod { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.chat-order-prod img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #f4f5f8; flex: none; }
.chat-order-prod > div { flex: 1; min-width: 0; }
.chat-order-title { font-size: 11px; line-height: 1.4; max-height: 31px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-order-qty { margin-top: 2px; font-size: 9px; color: #9aa0ab; }
.chat-order-prod strong { font-size: 12px; flex: none; }
.chat-order-no { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #eceef4; display: flex; justify-content: space-between; font-size: 9px; color: #9aa0ab; }
.chat-order-no span { color: var(--eb-blue); font-size: 14px; line-height: 9px; }
.chat-product-card {
  width: 255px; max-width: 100%; background: #fff; border: 1px solid #e0e4ec;
  border-radius: 12px; padding: 11px; text-align: left; cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .04);
}
.chat-product-label { font-size: 10px; font-weight: 700; color: var(--eb-blue); }
.chat-product-main { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.chat-product-main img { width: 64px; height: 64px; border-radius: 9px; object-fit: cover; background: #f4f5f8; flex: none; }
.chat-product-info { flex: 1; min-width: 0; }
.chat-product-title { font-size: 11.5px; line-height: 1.4; max-height: 32px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-product-meta { margin-top: 3px; font-size: 9px; color: #9aa0ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-product-price { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--eb-ink); }
.chat-product-chev { color: var(--eb-blue); font-size: 20px; line-height: 1; flex: none; }
.chat-product-hint { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #eceef4; font-size: 9.5px; color: #9aa0ab; }
.chat-product-picker { max-height: 72vh; display: flex; flex-direction: column; padding: 16px 16px calc(12px + env(safe-area-inset-bottom)); }
.chat-product-picker-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; margin-bottom: 12px; }
.chat-product-picker-head button { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: #777; }
.chat-product-search { display: flex; align-items: center; gap: 8px; background: #f5f6f8; border-radius: 20px; padding: 0 12px; height: 40px; }
.chat-product-search span { color: #8b909a; display: flex; }
.chat-product-search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; outline: none; }
.chat-product-search button { font-size: 12px; color: var(--eb-blue); font-weight: 600; }
.chat-product-list { overflow: auto; margin-top: 10px; }
.chat-product-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f1f5; cursor: pointer; }
.chat-product-row img { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #f4f5f8; flex: none; }
.chat-product-row-main { flex: 1; min-width: 0; }
.chat-product-row-main div { font-size: 12.5px; line-height: 1.35; max-height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chat-product-row-main span { display: block; margin-top: 3px; font-size: 10px; color: #9aa0ab; }
.chat-product-row b { font-size: 12.5px; flex: none; }
.chat-product-empty { padding: 26px 0; text-align: center; color: #9aa0ab; font-size: 12px; }

.chat-composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--eb-line);
}
.chat-image-btn {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--eb-blue); background: #f5f7fb;
}
.chat-image-btn:disabled { opacity: .45; }
.chat-file { display: none; }
.chat-composer textarea {
  flex: 1; min-width: 0; max-height: 96px; min-height: 38px;
  padding: 9px 12px; border: 1px solid #dfe3eb; border-radius: 19px;
  background: #f7f7f7; color: var(--eb-ink); font-size: 13px; line-height: 1.5;
  outline: none; resize: none;
}
.chat-composer textarea:focus { border-color: var(--eb-blue); background: #fff; }
.chat-send {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--eb-blue); color: #fff;
}
.chat-send:disabled { background: #cfd6e4; }

@media (min-width: 600px) {
  body { background: #eef0f4; }
  .chat-inbox-page, .chat-thread-page { box-shadow: 0 0 40px rgba(15, 23, 42, .06); }
}
