.message .staff-avatar {
  width: 38px;
  height: 38px;
  margin-right: 10px;
  object-fit: contain;
  border-radius: 50%;
  background: #242b38;
  padding: 5px;
}

.message-body {
  max-width: 76%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.message.user .message-body { align-items: flex-end; }
.message-body p { max-width: 100%; white-space: pre-wrap; }
.message-image-button {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
}
.message-image-button:active { transform: none; filter: none; opacity: 1; }
.message-body .message-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(240px, 65vw);
  max-height: 260px;
  margin: 0;
  padding: 0;
  object-fit: cover;
  border-radius: 12px;
  background: transparent;
}
.image-viewer[hidden] { display: none; }
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(5, 9, 18, .88);
  backdrop-filter: blur(5px);
  -webkit-tap-highlight-color: transparent;
}
.image-viewer img {
  display: block;
  max-width: 100%;
  max-height: 86vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.image-viewer-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(35,42,55,.82);
  color: #fff;
  font-size: 28px;
  line-height: 34px;
}
body.image-viewer-open { overflow: hidden; }

.image-picker {
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: url("chat-plus-button.svg") center/40px 40px no-repeat;
  color: transparent;
  font-size: 0;
  line-height: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.image-picker input { display: none; }

.chat-input { position: relative; }
.selected-image[hidden] { display: none; }
.selected-image {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  max-width: calc(100vw - 24px);
  height: 72px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #485365;
  border-radius: 10px;
  background: #252d39;
  box-shadow: 0 7px 20px rgba(0,0,0,.3);
}
.selected-image img { width: 58px; height: 58px; object-fit: cover; border-radius: 7px; }
.selected-image span { max-width: 190px; overflow: hidden; color: #dce2eb; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.selected-image button { width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%; background: #465162; color: #fff; font-size: 18px; }
.emoji-toggle {
  width: 40px !important;
  height: 40px !important;
  flex: none;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: url("chat-emoji-button.svg") center/40px 40px no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  -webkit-tap-highlight-color: transparent !important;
}
.emoji-panel[hidden] { display:none; }
.emoji-panel { position:absolute; left:12px; bottom:calc(100% + 8px); z-index:3; width:min(330px,calc(100vw - 24px)); padding:10px; display:grid; grid-template-columns:repeat(7,1fr); gap:4px; border:1px solid #485365; border-radius:12px; background:#252d39; box-shadow:0 8px 24px rgba(0,0,0,.34); }
.emoji-panel button { height:36px; padding:0; border:0; border-radius:7px; background:transparent; font-size:22px; cursor:pointer; }
.emoji-panel button:hover { background:#3a4453; }
