.support-chat-page {
  min-width: 0;
}

.support-chat-heading,
.support-chat-thread-header,
.support-chat-compose {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.support-chat-heading {
  margin-bottom: 18px;
}

.support-chat-heading h2,
.support-chat-conversations h3,
.support-chat-thread-header h3 {
  margin: 0;
}

.support-chat-heading .muted {
  margin: 6px 0 0;
}

.support-chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.3fr) minmax(0, 1fr);
  gap: 16px;
  min-height: min(78vh, 850px);
}

.support-chat-conversations,
.support-chat-thread {
  min-width: 0;
  padding: 18px;
}

.support-chat-conversations {
  overflow: auto;
  max-height: min(78vh, 850px);
}

.support-chat-conversations h3 {
  margin-bottom: 14px;
}

.support-chat-start {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.support-chat-start label {
  color: #d3dce8;
  font-size: 0.86rem;
}

.support-chat-start select {
  min-width: 0;
  width: 100%;
}

.support-chat-start .button {
  width: 100%;
}

.support-chat-conversation-list {
  display: grid;
  gap: 8px;
}

.support-chat-conversation {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.56);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.support-chat-conversation:hover,
.support-chat-conversation.is-selected {
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(14, 116, 144, 0.2);
}

.support-chat-conversation-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.support-chat-conversation small,
.support-chat-message time {
  color: #aab8ca;
  font-size: 0.78rem;
}

.support-chat-conversation-preview {
  overflow: hidden;
  color: #d3dce8;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-chat-unread {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #0ea5e9;
  color: #031421;
  font-size: 0.75rem;
  font-weight: 800;
}

.support-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.support-chat-thread-header {
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.support-chat-thread-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.support-chat-thread-header .eyebrow {
  margin: 0 0 4px;
}

.support-chat-thread-status {
  max-width: 42%;
  text-align: right;
}

.support-chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: min(62vh, 600px);
  max-height: min(68vh, 720px);
  overflow: auto;
  padding: 4px 2px;
}

.support-chat-message {
  display: grid;
  gap: 5px;
  max-width: min(82%, 720px);
  padding: 10px 13px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 13px;
  background: rgba(30, 41, 59, 0.75);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.support-chat-message.is-admin {
  align-self: flex-end;
  border-color: rgba(14, 165, 233, 0.35);
  background: rgba(14, 116, 144, 0.22);
}

.support-chat-message.is-user {
  align-self: flex-start;
}

.support-chat-message strong {
  color: #e7f6ff;
  font-size: 0.82rem;
}

.support-chat-compose {
  align-items: stretch;
}

.support-chat-compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  max-height: 140px;
  resize: vertical;
}

.support-chat-compose button {
  align-self: flex-end;
  min-width: 100px;
  min-height: 46px;
}

.support-chat-delete {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.support-chat-delete:not(:disabled):hover {
  border-color: rgba(248, 113, 113, 0.8);
  background: rgba(127, 29, 29, 0.3);
}

.support-chat-page button:focus-visible,
.support-chat-page select:focus-visible,
.support-chat-page textarea:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(103, 232, 249, 0.18);
}

.support-chat-page .empty-state {
  margin: 16px 0;
}

@media (max-width: 760px) {
  .support-chat-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .support-chat-conversations {
    max-height: 260px;
  }

  .support-chat-thread {
    min-height: 58vh;
  }

  .support-chat-messages {
    min-height: min(38vh, 340px);
    max-height: min(42vh, 420px);
  }

  .support-chat-thread-status {
    max-width: none;
    text-align: left;
  }

  .support-chat-thread-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .support-chat-delete {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .support-chat-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .support-chat-compose {
    flex-direction: column;
  }

  .support-chat-compose button {
    align-self: stretch;
  }

  .support-chat-message {
    max-width: 95%;
  }
}
