.dashboard-chat {
  width: 100%;
  height: 100%;
  min-height: 0;
  color: #efeff1;
  background:
    radial-gradient(circle at 12% -10%, rgba(145, 70, 255, 0.15), transparent 34%),
    #0e0e10;
  font-family: var(--font-main, "Plus Jakarta Sans", sans-serif);
}

.dashboard-chat-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sm-chat-container > .dashboard-chat,
#twitch-chat-container > .dashboard-chat {
  position: absolute;
  inset: 0;
}

.dashboard-chat-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.dashboard-chat-connection {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  color: #adadb8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(24, 24, 27, 0.78);
  font-size: 0.72rem;
}

.dashboard-chat-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d8d8df;
  box-shadow: 0 0 0 3px rgba(216, 216, 223, 0.08);
}

.dashboard-chat[data-source-state="connected"] .dashboard-chat-status-dot {
  background: #35d07f;
  box-shadow: 0 0 0 3px rgba(53, 208, 127, 0.12), 0 0 10px rgba(53, 208, 127, 0.35);
}

.dashboard-chat[data-source-state="connecting"] .dashboard-chat-status-dot {
  background: #f6c85f;
  animation: dashboard-chat-pulse 1.4s ease-in-out infinite;
}

.dashboard-chat[data-source-state="disconnected"] .dashboard-chat-status-dot,
.dashboard-chat[data-source-state="unavailable"] .dashboard-chat-status-dot {
  background: #f05d75;
  box-shadow: 0 0 0 3px rgba(240, 93, 117, 0.12);
}

.dashboard-chat-status-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-chat-reconnect {
  display: inline-grid;
  width: 25px;
  height: 25px;
  place-items: center;
  padding: 0;
  color: #adadb8;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.dashboard-chat-reconnect:hover,
.dashboard-chat-reconnect:focus-visible {
  color: #fff;
  border-color: rgba(145, 70, 255, 0.45);
  background: rgba(145, 70, 255, 0.14);
  outline: none;
}

.dashboard-chat-messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.55rem 0.55rem 0.85rem;
  scrollbar-color: rgba(173, 173, 184, 0.45) transparent;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.dashboard-chat-empty {
  display: grid;
  min-height: 100%;
  place-content: center;
  gap: 0.4rem;
  padding: 1.5rem;
  color: #7f7f8b;
  text-align: center;
  font-size: 0.78rem;
}

.dashboard-chat-empty-icon {
  font-size: 1.5rem;
  opacity: 0.65;
}

.dashboard-chat-message {
  position: relative;
  padding: 0.35rem 0.38rem;
  border-radius: 6px;
  color: #dedee3;
  font-size: 0.8rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.dashboard-chat-message:hover {
  background: rgba(255, 255, 255, 0.045);
}

.dashboard-chat-message.is-pending {
  opacity: 0.68;
}

.dashboard-chat-message.is-action .dashboard-chat-author,
.dashboard-chat-message.is-action .dashboard-chat-body {
  font-style: italic;
}

.dashboard-chat-time {
  margin-right: 0.35rem;
  color: #70707b;
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
}

.dashboard-chat-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
  margin-right: 0.25rem;
  vertical-align: 0.05em;
}

.dashboard-chat-badge {
  display: inline-grid;
  min-width: 14px;
  height: 14px;
  place-items: center;
  padding: 0 0.18rem;
  color: #fff;
  border-radius: 3px;
  background: #53535f;
  font-size: 0.54rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.dashboard-chat-badge[data-badge="broadcaster"] { background: #e91916; }
.dashboard-chat-badge[data-badge="moderator"] { background: #00ad5f; }
.dashboard-chat-badge[data-badge="vip"] { background: #e005b9; }
.dashboard-chat-badge[data-badge="subscriber"],
.dashboard-chat-badge[data-badge="founder"] { background: #9146ff; }

.dashboard-chat-author {
  color: var(--dashboard-chat-author-color, #a970ff);
  font-weight: 700;
}

.dashboard-chat-reply {
  display: block;
  margin-bottom: 0.12rem;
  color: #9999a5;
  font-size: 0.68rem;
}

.dashboard-chat-first {
  display: inline-block;
  margin-right: 0.3rem;
  padding: 0.05rem 0.28rem;
  color: #f6c85f;
  border: 1px solid rgba(246, 200, 95, 0.35);
  border-radius: 999px;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: 0.08em;
}

.dashboard-chat-emote {
  width: auto;
  height: 1.65em;
  margin: -0.2em 0.06em;
  vertical-align: middle;
  object-fit: contain;
}

.dashboard-chat-new-messages {
  position: absolute;
  left: 50%;
  bottom: 76px;
  z-index: 3;
  transform: translateX(-50%);
  padding: 0.34rem 0.65rem;
  color: #fff;
  border: 1px solid rgba(169, 112, 255, 0.55);
  border-radius: 999px;
  background: rgba(78, 36, 138, 0.96);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.dashboard-chat-permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.58rem 0.65rem;
  color: #f3d9ff;
  border-top: 1px solid rgba(145, 70, 255, 0.28);
  background: rgba(82, 31, 128, 0.3);
  font-size: 0.7rem;
  line-height: 1.35;
}

.dashboard-chat-permission a {
  flex: 0 0 auto;
  padding: 0.3rem 0.5rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: #9146ff;
  text-decoration: none;
  font-weight: 700;
}

.dashboard-chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  padding: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(24, 24, 27, 0.94);
}

.dashboard-chat-input-wrap {
  position: relative;
  min-width: 0;
}

.dashboard-chat-input {
  width: 100%;
  min-height: 38px;
  max-height: 104px;
  resize: none;
  padding: 0.58rem 2.7rem 0.58rem 0.65rem;
  color: #f4f4f5;
  border: 1px solid #35353c;
  border-radius: 8px;
  background: #18181b;
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.35;
  outline: none;
}

.dashboard-chat-input:focus {
  border-color: #9146ff;
  box-shadow: 0 0 0 2px rgba(145, 70, 255, 0.17);
}

.dashboard-chat-input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.dashboard-chat-count {
  position: absolute;
  right: 0.55rem;
  bottom: 0.48rem;
  color: #70707b;
  font-size: 0.58rem;
  pointer-events: none;
}

.dashboard-chat-send {
  align-self: end;
  min-width: 66px;
  min-height: 38px;
  padding: 0.5rem 0.72rem;
  color: #fff;
  border: 1px solid rgba(169, 112, 255, 0.5);
  border-radius: 8px;
  background: linear-gradient(135deg, #9146ff, #6f2ed8);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.dashboard-chat-send:hover:not(:disabled) {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.dashboard-chat-send:focus-visible,
.dashboard-chat-new-messages:focus-visible,
.dashboard-chat-permission a:focus-visible {
  outline: 2px solid #fff !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(145, 70, 255, 0.5);
}

.dashboard-chat-send:disabled {
  cursor: not-allowed;
  filter: grayscale(0.55);
  opacity: 0.5;
}

.dashboard-chat-feedback {
  grid-column: 1 / -1;
  min-height: 0;
  color: #f2a6b3;
  font-size: 0.66rem;
  line-height: 1.3;
}

.dashboard-chat-feedback:empty {
  display: none;
}

.dashboard-chat .is-hidden {
  display: none !important;
}

@keyframes dashboard-chat-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@media (max-width: 520px) {
  .dashboard-chat-message {
    font-size: 0.76rem;
  }

  .dashboard-chat-permission {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-chat-permission a {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-chat-status-dot,
  .dashboard-chat-send {
    animation: none;
    transition: none;
  }
}
