.chat-wrap {
  display: flex;
  flex-direction: column;
  height: clamp(320px, calc(100vh - 220px), 700px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 8px;
}

.chat-msg {
  display: flex;
  justify-content: flex-start;
  padding: 0 2px;
}
.chat-msg.mine { justify-content: flex-end; }

.chat-bubble {
  max-width: 78%;
  background: var(--c-surface);
  border-radius: 14px 14px 14px 3px;
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
  cursor: default;
}
.chat-msg.mine .chat-bubble {
  background: var(--c-primary);
  color: #fff;
  border-radius: 14px 14px 3px 14px;
}

.chat-name {
  font-size: .72rem;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 3px;
}
.chat-msg.mine .chat-name { display: none; }

.chat-text {
  font-size: .9rem;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-time {
  font-size: .68rem;
  opacity: .55;
  text-align: right;
  margin-top: 3px;
}
.chat-msg.mine .chat-time { color: rgba(255,255,255,.75); opacity: 1; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--c-border);
  margin-top: 6px;
}
.chat-input-row input { flex: 1; }

/* Conversations list */
.conv-list { display: flex; flex-direction: column; gap: 6px; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--c-surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.conv-item:hover { box-shadow: var(--shadow-md); }

.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: .9rem; }
.conv-last { font-size: .78rem; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.chat-header h3 { margin: 0; font-size: 1rem; font-weight: 700; flex: 1; }
