.chat-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  margin-bottom: 24px;
}

.dashboard-messages .surface > button {
  min-height: 44px;
  margin: 0 10px 10px 0;
}

.chat-nav {
  display: grid;
  align-content: start;
  gap: .4rem;
  max-height: 34rem;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.chat-nav h3 {
  margin-block: .5rem .2rem;
  font-size: 14px;
  color: var(--muted);
}

.chat-room {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  overflow-wrap: anywhere;
  text-align: start;
  min-height: 44px;
  width: 100%;
  margin: 0;
  background: #fff;
  border-color: var(--line);
}

.chat-room[aria-pressed="true"] {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.chat-conversation-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.chat-conversation-header > h3 {
  margin: 0;
}

.chat-actions {
  gap: 10px;
}

.chat-actions > button {
  min-height: 44px;
  margin: 0;
}

.chat-toptoolbar{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);align-items:stretch;gap:8px;width:100%;margin:0 0 12px}
.chat-toptoolbar>button{min-height:44px;margin:0;padding:8px 10px;white-space:normal;font-size:14px;line-height:1.3}
.chat-remove{min-height:44px;margin:6px 0 0;font-size:13px}
.chat-message-removed{font-style:italic;color:var(--muted)}

.chat-unread {
  font-size: .8rem;
  font-weight: 700;
}

.chat-detail {
  min-width: 0;
}

.chat-feed {
  height: clamp(16rem, 40vh, 33rem);
  margin-block: .75rem;
  padding: .65rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: .5rem;
}

.chat-feed:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.chat-message {
  margin-block: .35rem;
  padding: .45rem .7rem;
}

.chat-message-own {
  background: var(--paper);
  border-radius: .45rem;
}

.chat-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .45rem;
}

.chat-message-meta time {
  font-size: .78rem;
}

.chat-message p {
  margin: .3rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-composer form {
  grid-template-columns: minmax(0, 1fr);
}

.chat-composer textarea {
  min-height: 4.5rem;
}

.chat-emojis .actions {
  margin-block-start: .45rem;
}

.chat-composer-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-composer-footer button {
  min-height: 44px;
  margin: 0;
}

.chat-emojis {
  position: relative;
}

.chat-emojis .chat-emoji-options {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 3;
  width: min(310px, calc(100vw - 100px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px #0002;
}

@media (max-width: 680px) {
  .chat-toptoolbar{grid-auto-flow:row;grid-template-columns:repeat(2,minmax(0,1fr))}
  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-nav {
    max-height: 13rem;
  }
}
