.image-preview[hidden] {
  display: none !important;
}

.message-attachment.file-attachment {
  display: flex;
  align-items: center;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.message-attachment.file-attachment a {
  color: var(--brand, #2563eb);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 9px;
  padding: 8px;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #f8fafc;
}

.image-preview img,
.image-preview video {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 9px;
  object-fit: cover;
  background: #e2e8f0;
}

.image-preview video[hidden] {
  display: none !important;
}

.image-preview span {
  min-width: 0;
  display: grid;
  gap: 2px;
  flex: 1;
}

.image-preview strong,
.image-preview small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-preview strong {
  color: #1e293b;
  font-size: 13px;
}

.image-preview small {
  color: #64748b;
  font-size: 11px;
}

.image-preview button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
  font-size: 22px;
  cursor: pointer;
}

.image-upload-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  margin-right: 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.image-upload-button:hover,
.image-upload-button:focus-visible {
  color: var(--brand);
  background: #eef2ff;
}

.image-upload-button svg {
  width: 22px;
  height: 22px;
}

.media-picker {
  position: relative;
  flex: 0 0 auto;
}

.composer form .media-menu-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  margin: 0 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  line-height: 1;
}

.composer form .media-menu-button:hover,
.composer form .media-menu-button:focus-visible {
  color: var(--brand);
  background: #eef2ff;
}

.composer form .media-menu-button > svg {
  width: 22px;
  height: 22px;
  transition: transform .18s ease;
}

.composer form .media-menu-button[aria-expanded="true"] {
  color: #fff;
  background: var(--brand);
}

.composer form .media-menu-button[aria-expanded="true"] > svg {
  transform: rotate(45deg);
}

.media-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  bottom: calc(100% + 12px);
  width: min(250px, calc(100vw - 52px));
  padding: 7px;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
}

.media-menu[hidden] {
  display: none !important;
}

.composer form .media-menu button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  place-items: initial;
  gap: 11px;
  width: 100%;
  height: auto;
  min-height: 58px;
  flex: none;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font: inherit;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.composer form .media-menu button:hover,
.composer form .media-menu button:focus-visible {
  background: #f1f5f9;
  color: #1e293b;
  outline: none;
}

.composer form .media-menu button > svg {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  color: var(--brand);
}

.composer form .media-menu button > span {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.media-menu strong {
  font-size: 13px;
}

.media-menu small {
  color: #64748b;
  font-size: 10px;
}

/* 对访客统一呈现一个连续的客服身份，不因底层接待方式改变气泡样式。 */
.message-row.admin .message-bubble {
  border-color: #e1e7ef;
  background: #fff;
}

.message-row.admin .message-author {
  color: #64748b;
}

.image-upload-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.message-attachments {
  display: grid;
  gap: 7px;
  margin: 6px 0 3px;
}

.message-attachment {
  display: block;
  color: inherit;
  text-decoration: none;
}

.message-attachment img {
  display: block;
  width: auto;
  max-width: min(240px, 100%);
  max-height: 240px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(15, 23, 42, .08);
}

.message-attachment video {
  display: block;
  width: min(280px, 100%);
  max-height: 260px;
  border-radius: 12px;
  background: #0f172a;
}

.message-attachment small {
  display: block;
  max-width: 240px;
  margin-top: 4px;
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  opacity: .72;
  text-overflow: ellipsis;
  white-space: nowrap;
}
