.chat-dialog .chat-head,
.chat-dialog .chat-suggestions,
.chat-dialog .chat-form,
.chat-dialog .chat-status,
.chat-dialog .chat-note {
  flex-shrink: 0;
}
.chat-dialog .chat-log {
  scroll-behavior: auto;
}
.chat-dialog .chat-message {
  width: fit-content;
  max-width: 95%;
  padding: 12px 15px;
  margin-bottom: 15px;
  border: 1px solid #dce6f7;
  border-radius: 0 13px 13px 13px;
  background: #fff;
  color: #405d86;
  font-size: 13px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.chat-dialog .chat-message.user {
  max-width: 85%;
  margin-left: auto;
  border: 0;
  border-radius: 13px 0 13px 13px;
  background: #edf3ff;
}
.chat-dialog .chat-message-text {
  margin: 0;
  white-space: pre-wrap;
}
.chat-dialog .chat-waiting {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #60738e;
  font-size: 12px;
}
.chat-dialog .chat-waiting-dots {
  color: #4877de;
  letter-spacing: 2px;
  animation: chat-waiting-pulse 1.5s ease-in-out infinite;
}
.chat-dialog .chat-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 21px 0;
  color: #60738e;
  font-size: 11px;
  line-height: 1.6;
}
.chat-dialog .chat-status.is-error {
  color: #9a502e;
}
.chat-dialog [data-chat-config-notice] {
  font-size: 10px;
  padding-top: 5px;
}
.chat-dialog [data-chat-config-notice][hidden] {
  display: none;
}
.chat-dialog .chat-status-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.chat-dialog .chat-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.chat-dialog .chat-actions button {
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid #dce6f7;
  border-radius: 9px;
  background: #fff;
  color: #315d9c;
  font-size: 11px;
  cursor: pointer;
}
.chat-dialog .chat-actions .chat-stop {
  border-color: #ccd9ee;
  background: #edf3ff;
}
.chat-dialog button[hidden] {
  display: none;
}
.chat-dialog button:disabled {
  cursor: default;
  opacity: .5;
}
.chat-dialog :is(button, a, input):focus-visible {
  outline: 2px solid #4877de;
  outline-offset: 3px;
}
.chat-dialog .chat-manager-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid #dce6f7;
}
.chat-dialog .chat-manager-card strong {
  color: #315a91;
  font-size: 12px;
}
.chat-dialog .chat-configured-contact .chat-manager-card {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.chat-dialog .chat-manager-card a {
  color: #315d9c;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.chat-dialog .chat-manager-card img {
  display: block;
  width: 112px;
  max-height: 160px;
  object-fit: contain;
  background: white;
}
@keyframes chat-waiting-pulse {
  50% { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-dialog .chat-waiting-dots { animation: none; }
}
@media (max-width: 600px), (pointer: coarse) {
  /* iOS 聚焦小字号输入框时会放大页面；触屏和窄屏使用 16px，覆盖手机横屏。 */
  .chat-dialog .chat-form input { font-size: 16px; }
}
@media (max-width: 600px) {
  .chat-dialog {
    height: min(720px, calc(100dvh - 16px));
    max-height: calc(100dvh - 16px);
  }
  .chat-dialog .chat-head { padding: 14px 16px; }
  .chat-dialog .chat-suggestions { flex-wrap: wrap; padding-top: 9px; }
  .chat-dialog .chat-message { font-size: 12px; padding: 10px 12px; }
  .chat-dialog .chat-status { align-items: flex-start; padding: 9px 16px 0; font-size: 10px; }
  .chat-dialog .chat-actions { max-width: 140px; }
  .chat-dialog .chat-actions button { font-size: 10px; }
  .chat-dialog .chat-note { gap: 10px; line-height: 1.6; }
}
@media (max-height: 600px) {
  .chat-dialog .chat-video-channel { display: none; }
  .chat-dialog .chat-head { padding-top: 10px; padding-bottom: 10px; }
  .chat-dialog .chat-log { padding-top: 14px; padding-bottom: 14px; }
}
