/* Chat UX shell: separate asset keeps mobile/realtime UX fixes cache-safe. */
#js-rise-chat-wrapper {
  --rise-chat-accent: #6690f4;
  --rise-chat-accent-strong: #567ff0;
  --rise-chat-scroll-track: rgba(102, 144, 244, 0.08);
  --rise-chat-scroll-thumb: rgba(102, 144, 244, 0.46);
  animation: none !important;
  transition: none !important;
}

#js-rise-chat-wrapper .rise-chat-body,
#js-rise-chat-wrapper .post-file-dropzone-scrollbar,
#js-rise-chat-wrapper .tab-content {
  scrollbar-width: thin;
  scrollbar-color: var(--rise-chat-scroll-thumb) var(--rise-chat-scroll-track);
}

#js-rise-chat-wrapper .rise-chat-body::-webkit-scrollbar,
#js-rise-chat-wrapper .post-file-dropzone-scrollbar::-webkit-scrollbar,
#js-rise-chat-wrapper .tab-content::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

#js-rise-chat-wrapper .rise-chat-body::-webkit-scrollbar-track,
#js-rise-chat-wrapper .post-file-dropzone-scrollbar::-webkit-scrollbar-track,
#js-rise-chat-wrapper .tab-content::-webkit-scrollbar-track {
  background: var(--rise-chat-scroll-track);
  border-radius: 999px;
}

#js-rise-chat-wrapper .rise-chat-body::-webkit-scrollbar-thumb,
#js-rise-chat-wrapper .post-file-dropzone-scrollbar::-webkit-scrollbar-thumb,
#js-rise-chat-wrapper .tab-content::-webkit-scrollbar-thumb {
  min-height: 36px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: linear-gradient(180deg, #85a8fa, #6688ee) padding-box;
}

#js-rise-chat-wrapper .rise-chat-body::-webkit-scrollbar-thumb:hover,
#js-rise-chat-wrapper .post-file-dropzone-scrollbar::-webkit-scrollbar-thumb:hover,
#js-rise-chat-wrapper .tab-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6f98f7, #4f75e8) padding-box;
}

#js-rise-chat-wrapper .chat-message-enter {
  animation: riseChatMessageIn 220ms ease-out both;
  will-change: transform, opacity;
}

#js-rise-chat-wrapper .chat-message-enter-me {
  transform-origin: right bottom;
}

#js-rise-chat-wrapper .chat-message-enter-other {
  transform-origin: left bottom;
}

#js-rise-chat-wrapper .chat-msg {
  box-shadow: 0 3px 12px rgba(32, 52, 91, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

#js-rise-chat-wrapper .chat-me .chat-msg {
  box-shadow: 0 5px 16px rgba(86, 111, 223, 0.2);
}

#js-rise-chat-wrapper .message-row {
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

#js-rise-chat-wrapper .message-row:hover {
  transform: none;
}

#js-rise-chat-wrapper .message-row.unread {
  background: rgba(51, 144, 236, .055);
  box-shadow: inset 3px 0 0 rgba(51, 144, 236, .72);
}

#js-rise-chat-wrapper .message-row.unread:hover {
  background: rgba(51, 144, 236, .085);
}

#js-rise-chat-wrapper .chat-dialog-preview-line {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

#js-rise-chat-wrapper .chat-dialog-subject {
  min-width: 0;
  overflow: hidden;
  color: #7b8497;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#js-rise-chat-wrapper .message-row.unread .chat-dialog-subject {
  color: #394257;
  font-weight: 600;
}

#js-rise-chat-wrapper .chat-dialog-unread-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: #3390ec;
  box-shadow: 0 2px 7px rgba(51, 144, 236, .24);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

#js-init-chat-icon.init-chat-icon {
  padding: 0;
  overflow: visible;
}

#js-init-chat-icon .chat-min-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#js-init-chat-icon.init-chat-icon .chat-min-icon {
  width: 100%;
  height: 100%;
}

#js-init-chat-icon .rise-chat-icon-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#js-init-chat-icon .rise-chat-unread-badge {
  position: absolute;
  z-index: 3;
  top: -9px;
  right: -12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #3390ec;
  box-shadow: 0 4px 12px rgba(51, 144, 236, .34);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

#js-init-chat-icon.init-chat-icon .rise-chat-unread-badge {
  top: -5px;
  right: -5px;
}

#js-init-chat-icon .rise-chat-unread-badge.hide {
  display: none !important;
}

#js-init-chat-icon .rise-chat-unread-badge.is-bumping {
  animation: riseChatBadgePop 180ms ease-out both;
}

#js-init-chat-icon.init-chat-icon.has-message {
  color: #506078;
  background: #fff;
  animation: none;
}

#js-init-chat-icon.init-chat-icon.has-message::before {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid rgba(51, 144, 236, .32);
  border-radius: 50%;
  pointer-events: none;
  animation: riseChatNotifyRing 1.5s ease-out 2;
}

#js-rise-chat-wrapper .rise-chat-footer {
  box-shadow: 0 -10px 28px rgba(40, 56, 89, 0.06);
}

#js-rise-chat-wrapper .message-send-button,
#js-rise-chat-wrapper .upload-file-button,
#js-rise-chat-wrapper .record-start-btn,
#js-rise-chat-wrapper .record-end-btn {
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease;
}

#js-rise-chat-wrapper .message-send-button:hover,
#js-rise-chat-wrapper .upload-file-button:hover,
#js-rise-chat-wrapper .record-start-btn:hover,
#js-rise-chat-wrapper .record-end-btn:hover {
  transform: translateY(-1px) scale(1.04);
}

#js-rise-chat-wrapper .message-send-button:active,
#js-rise-chat-wrapper .upload-file-button:active,
#js-rise-chat-wrapper .record-start-btn:active,
#js-rise-chat-wrapper .record-end-btn:active {
  transform: scale(.94);
}

#js-rise-chat-wrapper .is-recording .record-end-btn {
  color: #fff;
  background: #ef5b66;
  box-shadow: 0 0 0 5px rgba(239, 91, 102, .13), 0 6px 18px rgba(239, 91, 102, .25);
  animation: riseChatRecordingPulse 1.4s ease-in-out infinite;
}

#js-rise-chat-wrapper .record-start-btn,
#js-rise-chat-wrapper .record-end-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  border-radius: 50% !important;
}

#js-rise-chat-wrapper .record-end-btn,
#js-rise-chat-wrapper .record-end-btn:hover,
#js-rise-chat-wrapper .record-end-btn:focus {
  color: #fff;
  background: linear-gradient(145deg, #ff6876, #e94558) !important;
  box-shadow: 0 6px 18px rgba(233, 69, 88, .3);
}

#js-rise-chat-wrapper .voice-stop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
}

#js-rise-chat-wrapper .voice-stop-square {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(107, 24, 35, .25);
}

#js-rise-chat-wrapper .recording-text:not(.hide) {
  display: inline-flex;
  align-items: center;
  color: #df4f5c;
  font-size: 12px;
  font-weight: 600;
}

#js-rise-chat-wrapper #chat-reply-form-dropzone.voice-message-sending .post-file-dropzone-scrollbar {
  display: none !important;
}

#js-rise-chat-wrapper .is-uploading-voice {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
}

#js-rise-chat-wrapper .voice-upload-status:not(.hide) {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 13px 0 11px;
  border: 1px solid rgba(51, 144, 236, .14);
  border-radius: 18px;
  color: #267dcc;
  background: rgba(51, 144, 236, .09);
  box-shadow: 0 2px 8px rgba(51, 144, 236, .08);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

#js-rise-chat-wrapper .voice-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  margin-right: 7px;
  gap: 2px;
}

#js-rise-chat-wrapper .voice-upload-icon i {
  display: block;
  width: 2px;
  height: 6px;
  border-radius: 2px;
  background: #3390ec;
  animation: riseVoiceSending 760ms ease-in-out infinite alternate;
}

#js-rise-chat-wrapper .voice-upload-icon i:nth-child(2) {
  height: 13px;
  animation-delay: -380ms;
}

#js-rise-chat-wrapper .voice-upload-icon i:nth-child(3) {
  height: 10px;
  animation-delay: -190ms;
}

#js-rise-chat-wrapper .voice-upload-icon i:nth-child(4) {
  height: 5px;
  animation-delay: -570ms;
}

#js-rise-chat-wrapper audio.audio {
  width: min(250px, 66vw);
  height: 38px;
  margin: 6px 0;
  border-radius: 999px;
}

.rise-voice-player {
  display: flex;
  align-items: center;
  width: min(270px, calc(100vw - 130px));
  max-width: 100%;
  min-height: 48px;
  padding: 6px 7px;
  border: 1px solid rgba(51, 144, 236, .22);
  border-radius: 15px;
  color: #34445a;
  background: rgba(255, 255, 255, .64);
  box-shadow: 0 5px 16px rgba(28, 63, 105, .08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rise-voice-player audio {
  display: none;
}

.rise-voice-play,
.rise-voice-volume {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  outline: 0;
  cursor: pointer;
}

.rise-voice-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: #3390ec;
  box-shadow: 0 4px 11px rgba(51, 144, 236, .28);
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.rise-voice-play:hover,
.rise-voice-play:focus-visible {
  background: #2584df;
  box-shadow: 0 5px 14px rgba(51, 144, 236, .38);
}

.rise-voice-play > span {
  display: block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.rise-voice-player.is-playing .rise-voice-play > span {
  position: relative;
  width: 10px;
  height: 12px;
  margin-left: 0;
  border: 0;
}

.rise-voice-player.is-playing .rise-voice-play > span::before,
.rise-voice-player.is-playing .rise-voice-play > span::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px;
  background: currentColor;
}

.rise-voice-player.is-playing .rise-voice-play > span::before {
  left: 0;
}

.rise-voice-player.is-playing .rise-voice-play > span::after {
  right: 0;
}

.rise-voice-content {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(54px, 1fr) auto;
  align-items: center;
  min-width: 0;
  margin: 0 8px 0 10px;
  gap: 8px;
}

.rise-voice-seek {
  position: relative;
  height: 20px;
}

.rise-voice-track {
  position: absolute;
  top: 8px;
  right: 0;
  left: 0;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(77, 96, 122, .19);
}

.rise-voice-progress {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #3390ec;
}

.rise-voice-thumb {
  position: absolute;
  z-index: 1;
  top: 4px;
  left: 0;
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #3390ec;
  box-shadow: 0 1px 5px rgba(29, 74, 119, .24);
  transform: translateX(-50%);
  pointer-events: none;
}

.rise-voice-seek input[type="range"] {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  opacity: 0;
}

.rise-voice-time {
  display: inline-flex;
  align-items: center;
  color: currentColor;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.rise-voice-separator,
.rise-voice-duration {
  opacity: .55;
}

.rise-voice-separator {
  margin: 0 3px;
}

.rise-voice-volume {
  width: 28px;
  height: 32px;
  border-radius: 50%;
  color: currentColor;
  background: transparent;
  opacity: .76;
  transition: opacity 150ms ease, background-color 150ms ease;
}

.rise-voice-volume:hover,
.rise-voice-volume:focus-visible {
  background: rgba(51, 144, 236, .1);
  opacity: 1;
}

.rise-voice-volume svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rise-voice-muted-line {
  display: none;
}

.rise-voice-player.is-muted .rise-voice-sound-wave {
  display: none;
}

.rise-voice-player.is-muted .rise-voice-muted-line {
  display: inline;
}

#js-rise-chat-wrapper .chat-me .rise-voice-player {
  color: #fff;
  border-color: rgba(255, 255, 255, .36);
  background: rgba(255, 255, 255, .1);
  box-shadow: none;
}

#js-rise-chat-wrapper .chat-me .rise-voice-play {
  color: #607cf0;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 12px rgba(35, 48, 120, .18);
}

#js-rise-chat-wrapper .chat-me .rise-voice-track {
  background: rgba(255, 255, 255, .3);
}

#js-rise-chat-wrapper .chat-me .rise-voice-progress {
  background: #fff;
}

#js-rise-chat-wrapper .chat-me .rise-voice-thumb {
  border-color: #607cf0;
  background: #fff;
  box-shadow: 0 1px 5px rgba(35, 48, 120, .2);
}

#js-rise-chat-wrapper .chat-me .rise-voice-volume:hover,
#js-rise-chat-wrapper .chat-me .rise-voice-volume:focus-visible {
  background: rgba(255, 255, 255, .14);
}

#js-rise-chat-wrapper .chat-file-download-link {
  display: inline-flex;
  align-items: center;
  margin-top: 3px;
  padding: 3px 7px 3px 3px;
  border-radius: 999px;
  color: #2785dc;
  font-size: 11.5px;
  line-height: 1.2;
  text-decoration: none;
  opacity: .88;
}

#js-rise-chat-wrapper .chat-file-download-link:hover {
  background: rgba(51, 144, 236, .09);
  opacity: 1;
}

#js-rise-chat-wrapper .chat-me .chat-file-download-link,
#js-rise-chat-wrapper .chat-me .chat-file-download-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

#js-rise-chat-wrapper #chat-message-reply-form.is-sending .message-send-button {
  opacity: .62;
  pointer-events: none;
  animation: riseChatSendPulse .9s ease-in-out infinite alternate;
}

@keyframes riseChatMessageIn {
  from { opacity: 0; transform: translate3d(0, 6px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes riseChatRecordingPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(239, 91, 102, .12), 0 6px 18px rgba(239, 91, 102, .2); }
  50% { box-shadow: 0 0 0 9px rgba(239, 91, 102, 0), 0 8px 22px rgba(239, 91, 102, .3); }
}

@keyframes riseVoiceSending {
  from { transform: scaleY(.55); opacity: .55; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes riseChatSendPulse {
  from { transform: scale(.96); }
  to { transform: scale(1.03); }
}

@keyframes riseChatBadgePop {
  from { opacity: 0; transform: scale(.82); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes riseChatNotifyRing {
  0% { opacity: .8; transform: scale(.88); }
  100% { opacity: 0; transform: scale(1.28); }
}

@media (max-width: 767px) {
  #js-rise-chat-wrapper {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: fixed !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: var(--rise-chat-viewport-height, 100dvh) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    inset: auto 0 auto 0 !important;
    top: var(--rise-chat-viewport-top, 0px) !important;
    bottom: auto !important;
    margin: 0 !important;
    padding-top: env(safe-area-inset-top);
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden;
    z-index: 1060 !important;
    overscroll-behavior: contain;
  }

  #js-rise-chat-wrapper .chat-topbar,
  #js-rise-chat-wrapper .rise-chat-header {
    flex: 0 0 62px;
    width: 100%;
    min-width: 0;
  }

  #js-rise-chat-wrapper .chat-title,
  #js-rise-chat-wrapper .chat-topbar-title {
    max-width: calc(100% - 120px);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #js-rise-chat-wrapper .rise-chat-body,
  #js-rise-chat-wrapper .rise-chat-body.full-height,
  #js-rise-chat-wrapper .rise-chat-body.long {
    flex: 1 1 auto;
    width: 100%;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-padding-bottom: 18px;
  }

  #js-rise-chat-wrapper .rise-chat-footer {
    position: relative !important;
    bottom: auto !important;
    flex: 0 0 auto;
    min-width: 0;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 0;
  }

  #js-rise-chat-wrapper .rise-chat-footer textarea {
    min-height: 50px;
    max-height: 110px;
    font-size: 16px;
    line-height: 1.4;
  }

  #js-rise-chat-wrapper .chat-msg {
    max-width: 84%;
  }

  #js-rise-chat-wrapper .chat-button-section {
    padding: 6px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #js-rise-chat-wrapper,
  #js-rise-chat-wrapper *,
  #js-rise-chat-wrapper *::before,
  #js-rise-chat-wrapper *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
