.conversations {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: calc(100vh - 265px);
  min-height: 570px;
}
.conversation-list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fbfcf9;
}
.conversation-search {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}
.conversation-search form {
  display: flex;
  gap: 8px;
}
.conversation-search input {
  min-width: 0;
  font-size: 12px;
}
.conversation-tabs {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.conversation-tabs .chip {
  cursor: pointer;
  font-size: 11px;
}
.chat-list {
  overflow: auto;
  flex: 1;
}
.conversation-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 18px 16px;
  display: flex;
  gap: 11px;
  text-align: left;
  color: var(--ink);
}
.conversation-item:hover {
  background: var(--surface-soft);
}
.conversation-item.selected {
  background: #edf3e5;
  box-shadow: inset 3px 0 var(--brand);
}
.conversation-info {
  min-width: 0;
  flex: 1;
}
.conversation-info .row {
  gap: 5px;
  flex-wrap: nowrap;
}
.conversation-info strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-time {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}
.chat-preview {
  display: block;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 4px 0 7px;
}
.chat-type {
  font-size: 10px;
  color: var(--muted);
}
.unread {
  background: var(--brand);
  color: white;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  padding: 1px 5px;
  font-size: 10px;
}
.chat-pagination {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.conversation-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.conversation-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 30px;
}
.conversation-empty .icon {
  height: 42px;
  width: 42px;
  margin-bottom: 16px;
}
.conversation-empty h2 {
  color: var(--ink);
  margin-bottom: 10px;
}
.conversation-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
}
.conversation-heading {
  min-width: 0;
  flex: 1;
}
.conversation-heading h2 {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-options {
  padding: 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.conversation-options label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.message-history {
  flex: 1;
  overflow: auto;
  padding: 20px 24px;
  background: #f7f8f4;
  min-height: 180px;
  overscroll-behavior: contain;
}
.history-start {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding: 0 0 18px;
}
#older-messages {
  text-align: center;
}
#message-bubbles {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.message {
  max-width: 84%;
  padding: 13px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px 12px 12px 3px;
  align-self: flex-start;
  overflow-wrap: anywhere;
}
.message.outgoing {
  align-self: flex-end;
  background: #eaf1df;
  border-color: #dbe5ce;
  border-radius: 12px 12px 3px 12px;
}
.message.automated {
  background: #f0f2ed;
}
.message-author {
  font-size: 10px;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 6px;
}
.message-text {
  white-space: pre-wrap;
  font-size: 13px;
}
.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  font-size: 9px;
  color: var(--muted);
  margin-top: 8px;
  flex-wrap: wrap;
}
.message-meta .badge {
  font-size: 9px;
  padding: 2px 5px;
}
.message-reply {
  font-size: 10px;
  color: var(--brand);
  border: 0;
  background: none;
  padding: 2px;
  cursor: pointer;
}
.message-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.message-buttons a {
  font-size: 11px;
  border: 1px solid var(--line);
  padding: 5px 9px;
  border-radius: 6px;
  background: white;
  text-decoration: none;
}
.reply-composer {
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.reply-composer > label {
  font-size: 12px;
  font-weight: 600;
}
.reply-composer textarea {
  min-height: 72px;
  max-height: 180px;
  font-size: 13px;
}
.reply-composer details {
  font-size: 11px;
  color: var(--muted);
}
.reply-composer summary {
  cursor: pointer;
}
.button-fields {
  align-items: flex-start;
  gap: 12px;
}
.button-fields label {
  flex: 1;
  min-width: 130px;
  font-size: 11px;
}
.button-fields input {
  margin-top: 5px;
}
.reply-reference {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  padding: 7px 10px;
  background: var(--surface-soft);
  border-left: 3px solid var(--brand);
  border-radius: 5px;
}
.reply-reference button {
  margin-left: auto;
}
.mobile-back {
  display: none;
}
.dialog-message-body {
  margin-top: 18px;
}
.broadcast-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}
.broadcast-layout > * {
  min-width: 0;
}
.broadcast-history {
  margin-top: 25px;
}
.audience-categories {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.audience-categories legend {
  font-size: 12px;
  font-weight: 600;
  padding: 0 5px;
}
.audience-categories label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.broadcast-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 18px;
  background: #edf3e5;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 16px 0;
  font-size: 13px;
}
#broadcast-preview > .notice {
  margin: 18px 0;
}
#broadcast-preview > .small {
  margin-top: 8px;
}
.broadcast-layout textarea {
  min-height: 155px;
}
.sidebar {
  overflow-y: auto;
}
.sidebar .wordmark {
  margin-bottom: 25px;
}
.sidebar nav {
  gap: 3px;
}
.channel-card {
  display: none;
}
.sidebar-bottom {
  padding-top: 16px;
}
@media (max-width: 1100px) {
  .conversations {
    grid-template-columns: 265px minmax(0, 1fr);
  }
  .conversation-item {
    padding: 14px 12px;
  }
  .chat-time {
    display: none;
  }
  .broadcast-layout {
    grid-template-columns: 1fr;
  }
  .message {
    max-width: 93%;
  }
}
@media (max-width: 760px) {
  .conversations {
    display: block;
    height: calc(100dvh - 235px);
    min-height: 560px;
  }
  .conversation-list {
    height: 100%;
    border: 0;
  }
  .conversation-detail {
    display: none;
    height: 100%;
  }
  .conversations.chat-open {
    position: fixed;
    inset: 0;
    z-index: 40;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
  .conversations.chat-open .conversation-list {
    display: none;
  }
  .conversations.chat-open .conversation-detail {
    display: flex;
  }
  .mobile-back {
    display: inline-flex;
  }
  .conversation-header,
  .conversation-options {
    padding: 12px;
  }
  .message-history {
    padding: 15px 12px;
  }
  .reply-composer {
    padding: 12px;
  }
  .conversation-header h2 {
    font-size: 14px;
  }
  .message {
    max-width: 92%;
  }
  .sidebar nav {
    flex-direction: row;
  }
  .sidebar {
    overflow: visible;
  }
  .conversation-options .badge {
    font-size: 10px;
  }
  .conversation-options label {
    font-size: 10px;
  }
  .broadcast-layout {
    gap: 16px;
  }
  .chat-time {
    display: inline;
  }
  .button-fields {
    flex-direction: column;
  }
  .button-fields label {
    width: 100%;
  }
}
