#messages-page {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(calc(100% - 24px), 1320px);
  min-height: calc(100vh - var(--nav-height, 60px) - var(--footer-height, 64px));
  flex-direction: column;
  margin: 0 auto;
  padding: 22px 0 18px;
}

.messages-page-heading {
  margin: 0 0 8px 5px;
  color: #c2c2c2;
  font: 700 24px Montserrat, "Segoe UI", Arial, sans-serif;
}

.messages-workspace {
  display: flex;
  width: 100%;
  height: min(700px, calc(100vh - 168px));
  min-height: 520px;
  flex: none;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.05);
  box-shadow: none;
  backdrop-filter: none;
}

.messages-contact-panel,
.messages-thread-panel,
.messages-stream-companion {
  height: 100%;
  margin: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.15);
}

.messages-contact-panel {
  display: flex;
  min-width: 0;
  flex: 0 0 300px;
  flex-direction: column;
}

.messages-contact-tools {
  display: block;
  margin: 0;
  padding: 8px 8px 0;
}

.messages-search {
  display: flex;
  width: 100%;
  height: 34px;
  flex-direction: row-reverse;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 9px;
  padding: 4px 7px;
  background: #b0b0b0;
}

.messages-search i {
  color: #575757;
  font-size: 18px;
}

.messages-search input {
  width: 100%;
  height: 26px;
  border: 0;
  outline: 0;
  padding: 0;
  color: #222;
  background: transparent;
  font-size: 14px;
}

.messages-search input::placeholder {
  color: #555;
}

.messages-contact-list {
  height: calc(100% - 42px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 45, 45, 0.7) transparent;
}

.messages-contact-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 58px;
  gap: 0;
  margin-top: 8px;
  border: 0;
  border-radius: 7px;
  padding: 4px;
  color: #787878;
  background: rgba(0, 0, 0, 0.15);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.messages-contact-item:hover,
.messages-contact-item.is-active {
  background: rgba(50, 50, 50, 0.5);
  box-shadow: none;
}

.messages-contact-avatar,
.messages-contact-avatar img {
  width: 50px;
  height: 50px;
  border-radius: 10px;
}

.messages-contact-avatar {
  position: relative;
  flex: 0 0 50px;
  margin-right: 7px;
}

.messages-contact-avatar img {
  display: block;
  object-fit: cover;
}

.messages-presence-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 13px;
  height: 13px;
  border: 4px solid #191919;
  border-radius: 50%;
  background: #666;
  box-sizing: content-box;
}

.messages-presence-dot.is-online {
  background: #45e045;
}

.messages-presence-dot.is-live {
  background: #e31818;
}

.messages-contact-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  margin: 4px;
}

.messages-contact-line {
  display: flex;
}

.messages-contact-copy strong {
  overflow: hidden;
  color: #787878;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-contact-preview {
  overflow: hidden;
  color: #707070;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-contact-time {
  display: none;
}

.messages-unread-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  align-self: center;
  place-items: center;
  margin-right: 4px;
  border-radius: 9px;
  padding: 0 5px;
  color: #fff;
  background: #9b2d2d;
  font-size: 10px;
}

.messages-thread-panel {
  min-width: 0;
  flex: 1 1 auto;
}

.messages-empty-thread {
  display: grid;
  height: 100%;
  place-content: center;
  justify-items: center;
  color: #777;
  text-align: center;
}

.messages-empty-thread[hidden] {
  display: none;
}

.messages-empty-thread i {
  color: #9b2d2d;
}

.messages-active-thread {
  position: relative;
  display: grid;
  height: 100%;
  grid-template-rows: 36px minmax(0, 1fr) 58px;
  padding: 8px;
}

.messages-active-thread[hidden] {
  display: none;
}

.messages-thread-header {
  display: flex;
  min-height: 0;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
}

.messages-thread-person {
  display: none;
}

.messages-thread-menu {
  position: relative;
  margin-left: auto;
}

.messages-thread-menu > button {
  display: grid;
  width: 34px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: #9b2d2d;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.messages-thread-menu-popup {
  position: absolute;
  top: 34px;
  right: 0;
  z-index: 9;
  width: 180px;
  border-radius: 5px;
  padding: 5px;
  background: rgba(20, 20, 20, 0.98);
}

.messages-thread-menu-popup button {
  width: 100%;
  border: 0;
  padding: 9px;
  color: #d66;
  background: transparent;
  cursor: pointer;
}

.messages-thread-history {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 45, 45, 0.7) transparent;
}

.direct-message-row {
  display: block;
  width: fit-content;
  min-width: 140px;
  max-width: 60%;
  align-self: flex-start;
  margin: 5px 0;
}

.direct-message-row.is-own {
  align-self: flex-end;
}

.direct-message-meta {
  display: flex;
  width: 100%;
  min-height: 25px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  border-radius: 5px 5px 0 0;
  padding: 4px 8px;
  color: #000;
  background: #9b2d2d;
  box-shadow: -1px 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 11px;
}

.direct-message-meta strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direct-message-row.is-own .direct-message-meta {
  color: #9b2d2d;
  background: #1a1a1a;
}

.direct-message-bubble {
  border-radius: 0 0 5px 5px;
  padding: 8px;
  color: #9b2d2d;
  background: #1a1a1a;
  box-shadow: -1px 1px 4px rgba(0, 0, 0, 0.25);
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.direct-message-row.is-own .direct-message-bubble {
  color: #000;
  background: #9b2d2d;
}

.direct-message-bubble .live-chat-emote {
  width: auto;
  height: 54px;
  margin: 2px 3px;
  vertical-align: middle;
}

.direct-message-delete {
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}

.messages-day-divider {
  align-self: center;
  margin: 10px 0 5px;
  color: #666;
  font-size: 10px;
}

.messages-composer {
  display: grid;
  width: 100%;
  height: 42px;
  grid-template-columns: 42px minmax(0, 1fr) 45px;
  align-self: end;
  gap: 0;
  border: 0;
  border-radius: 9px;
  padding: 0 8px;
  background: #1f1f1f;
}

.messages-composer textarea {
  width: 100%;
  height: 42px;
  max-height: 42px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 11px 0 8px;
  color: #b4b4b4;
  background: transparent;
  font: inherit;
  font-size: 14px;
}

.messages-composer button {
  display: grid;
  width: 45px;
  height: 42px;
  place-items: center;
  border: 0;
  color: #9b2d2d;
  background: transparent;
  cursor: pointer;
}

.messages-composer .messages-emote-button {
  width: 42px;
  color: #888;
}

.messages-composer .messages-emote-button:hover,
.messages-composer .messages-emote-button[aria-expanded="true"] {
  color: #9b2d2d;
}

.messages-emote-panel {
  position: absolute;
  right: 8px;
  bottom: 56px;
  left: 8px;
  z-index: 8;
  max-height: 330px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  padding: 10px;
  background: rgba(20, 20, 20, 0.97);
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.34);
}

.messages-emote-group + .messages-emote-group {
  margin-top: 12px;
}

.messages-emote-group h3 {
  margin: 0 0 7px;
  color: #aaa;
  font-size: 13px;
}

.messages-emote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 5px;
}

.messages-emote-grid button {
  display: grid;
  height: 54px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.messages-emote-grid button:hover {
  background: rgba(155, 45, 45, 0.28);
}

.messages-emote-grid img {
  max-width: 100%;
  height: 48px;
  object-fit: contain;
}

.messages-stream-companion {
  display: flex;
  min-width: 0;
  flex: 0 0 340px;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.messages-stream-companion[hidden] {
  display: none;
}

.messages-stream-companion-header {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 0 10px;
  color: #999;
  background: rgba(20, 20, 20, 0.88);
  font-size: 12px;
}

.messages-stream-companion-header button {
  width: 26px;
  height: 26px;
  border: 0;
  color: #aaa;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
}

.messages-stream-companion iframe {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  border: 0;
  background: #111;
}

html.live-message-embed,
body.live-message-embed {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111;
}

body.live-message-embed > header,
body.live-message-embed #sidetoggle,
body.live-message-embed footer {
  display: none !important;
}

body.live-message-embed #contentwrapper,
body.live-message-embed #contentwrapper2 {
  position: static !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.live-message-embed #live-page {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  flex-direction: column;
  margin: 0 !important;
  border-radius: 0 !important;
  overflow: hidden;
  background: #111;
}

body.live-message-embed .live-main-column {
  display: block !important;
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
}

body.live-message-embed .live-player {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 16 / 9;
  border-radius: 0 !important;
}

body.live-message-embed :is(
  .live-audio-settings-toggle,
  .live-info-panel,
  .live-owner-row,
  #live-streamer-controls,
  .live-display-preview-grid,
  #live-user-card
) {
  display: none !important;
}

body.live-message-embed .live-chat-shell {
  position: relative !important;
  inset: auto !important;
  display: flex !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  flex: 1 1 auto;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
}

@media (max-width: 920px) {
  .messages-workspace {
    display: grid;
    height: calc(100vh - 148px);
    grid-template-columns: 1fr;
  }

  .messages-contact-panel,
  .messages-thread-panel {
    width: auto;
    height: 100%;
    margin: 0;
  }

  .messages-thread-panel {
    display: none;
  }

  .messages-workspace.has-active-thread .messages-contact-panel {
    display: none;
  }

  .messages-workspace.has-active-thread .messages-thread-panel {
    display: block;
  }

  .messages-stream-companion {
    display: none;
  }

  .messages-thread-person {
    display: flex;
  }
}
