.messages-workspace {
  min-height: calc(100vh - 118px);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #26334a;
  border-radius: 18px;
  background: #101724;
}

.conversation-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #26334a;
  background: #0f1622;
}

.conversation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 18px 12px;
}

.conversation-toolbar h2,
.thread-header h2 { margin: 0; font-size: 19px; }
.conversation-toolbar small { display: block; margin-top: 4px; color: #8296b3; }
.conversation-toolbar button { padding: 7px 11px; }
.message-node-select { margin: 0 18px 10px; width: calc(100% - 36px); padding: 9px 11px; }
.conversation-search { margin: 0 18px 12px; width: calc(100% - 36px); }
.conversation-list { min-height: 0; overflow-y: auto; border-top: 1px solid #202b3e; }

.conversation-item {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid #1d2839;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font-weight: 400;
}

.conversation-item:hover { background: #172235; }
.conversation-item.active { background: #1c3152; }
.conversation-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #2c6fd8; color: white; font-weight: 800; }
.conversation-copy { min-width: 0; }
.conversation-name,.conversation-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-name { color: #eef5ff; font-weight: 700; }
.conversation-preview { margin-top: 5px; color: #8ca0bd; font-size: 12px; }
.conversation-time { align-self: start; padding-top: 2px; color: #7185a4; font-size: 11px; }

.thread-pane { min-width: 0; display: grid; grid-template-rows:auto minmax(0,1fr) auto; background: #121927; }
.thread-header { position: static; margin: 0; padding: 14px 18px; border-bottom: 1px solid #26334a; background: #121927; }
.thread-header p { margin: 5px 0 0; color: #8296b3; font-size: 12px; }
.thread-identity { min-width: 150px; }
.thread-note { margin-left: auto; width: min(440px,55%); display: grid; grid-template-columns:minmax(0,1fr) auto; gap: 8px; }
.thread-note input { padding: 9px 11px; }
.thread-note button { padding: 9px 12px; white-space: nowrap; }
.thread-messages { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 22px; }
.message-empty { margin: auto; padding: 30px; color: #8296b3; text-align: center; }
.message-row { display: flex; flex-direction: column; align-items: flex-start; }
.message-row.mine { align-items: flex-end; }
.message-bubble { max-width: min(74%, 720px); padding: 10px 13px; border-radius: 16px 16px 16px 5px; background: #253247; color: #f0f5fc; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.message-row.mine .message-bubble { border-radius: 16px 16px 5px 16px; background: #2879f5; color: white; }
.message-meta { margin: 4px 5px 0; color: #7185a4; font-size: 10px; }
.message-tools { display: flex; align-items: center; gap: 8px; margin: 4px 5px 0; }
.message-translate { border: 0; padding: 0; background: transparent; color: #75a9ff; font-size: 11px; font-weight: 600; }
.message-translate:hover { text-decoration: underline; filter: none; }
.message-composer { display: grid; grid-template-columns:minmax(0,1fr) auto; gap: 10px; padding: 14px 18px; border-top: 1px solid #26334a; }
.message-composer textarea { min-height: 46px; max-height: 130px; resize: vertical; border: 1px solid #30405b; border-radius: 14px; background: #0c1320; color: #f5f8ff; padding: 12px 14px; font: inherit; outline: none; }
.message-composer textarea:focus { border-color: #3884ff; box-shadow: 0 0 0 3px #2675ff22; }
.message-composer button { align-self: end; min-height: 46px; }
.message-composer button:disabled,.message-composer textarea:disabled { cursor: not-allowed; opacity: .45; }

@media (max-width: 900px) {
  .messages-workspace { min-height: 720px; grid-template-columns: 300px minmax(0,1fr); }
}

@media (max-width: 680px) {
  .messages-workspace { min-height: 760px; grid-template-columns: 1fr; grid-template-rows: 330px minmax(0,1fr); }
  .conversation-pane { border-right: 0; border-bottom: 1px solid #26334a; }
  .message-bubble { max-width: 88%; }
  .thread-header { align-items: stretch; flex-direction: column; }
  .thread-note { width: 100%; margin: 10px 0 0; }
}
