/* =========================================================
   设计令牌 —— Claude 品牌配色（暖米色 + 陶土橙）
   ========================================================= */
:root {
  /* 背景层级 */
  --bg-app:        #F7F4EC;   /* 应用底色：温暖米白 */
  --bg-sidebar:    #F0EADC;   /* 侧边栏：更深一档的暖米色，做出层次 */
  --bg-panel:      #FFFEFB;   /* 聊天区域：接近纯白但仍偏暖 */
  --bg-elevated:   #FFFFFF;   /* 弹窗、卡片 */
  --bg-input:      #FFFFFF;

  /* 描边 */
  --border:        #E4DCC8;
  --border-soft:   #EDE6D6;

  /* 文字 */
  --text-primary:  #2B2620;
  --text-secondary:#6F675A;
  --text-tertiary: #A79C89;
  --text-on-accent:#FFF8F1;

  /* 品牌主色：陶土 / 赤陶橙 */
  --accent:        #C2652F;
  --accent-hover:  #A8541F;
  --accent-soft:   #F1DEC5;
  --accent-soft-text: #8A4A1E;

  /* 功能色 */
  --danger:        #AE4A34;
  --danger-hover:  #93392A;
  --online:        #74936C;

  /* 头像配色轮换 */
  --av-1: #C2652F; --av-1-bg: #F1DEC5;
  --av-2: #6E7F9C; --av-2-bg: #DFE4EE;
  --av-3: #74936C; --av-3-bg: #E1EADD;
  --av-4: #A85A8C; --av-4-bg: #EFDDE9;
  --av-5: #B18B3D; --av-5-bg: #EFE4C8;
  --av-6: #5C8A8A; --av-6-bg: #DCEAE9;

  /* 圆角 / 阴影 / 动效 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(43, 38, 32, .04), 0 1px 1px rgba(43, 38, 32, .03);
  --shadow-2: 0 8px 24px rgba(43, 38, 32, .10), 0 2px 6px rgba(43, 38, 32, .06);
  --shadow-3: 0 20px 60px rgba(43, 38, 32, .20), 0 4px 14px rgba(43, 38, 32, .10);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --font-display: Georgia, "Songti SC", "STSong", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* =========================================================
   基础重置
   ========================================================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select { outline: none; }
::selection { background: var(--accent-soft); color: var(--accent-soft-text); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D9CFB8; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #C9BC9E; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.screen { width: 100vw; height: 100dvh; overflow: hidden; }

/* =========================================================
   登录界面
   ========================================================= */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(560px 420px at 15% 12%, #F4E3CE 0%, transparent 60%),
    radial-gradient(620px 480px at 88% 90%, #EADFC5 0%, transparent 55%),
    var(--bg-app);
}
.auth-box {
  width: min(380px, 100%);
  padding: 40px 36px 32px;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-3);
  text-align: center;
  border: 1px solid var(--border-soft);
}
.brand-mark { margin: 0 auto 18px; width: 40px; }
.auth-box h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -.01em;
}
.login-hint {
  margin: 0 0 28px;
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.6;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }

/* 浮动 label 输入框 */
.field { position: relative; }
.field input {
  width: 100%;
  padding: 18px 14px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-input);
  font-size: 14.5px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field label {
  position: absolute;
  left: 15px;
  top: 14px;
  font-size: 14.5px;
  color: var(--text-tertiary);
  pointer-events: none;
  transform-origin: left top;
  transition: transform .15s var(--ease), color .15s var(--ease), top .15s var(--ease);
}
.field input:focus,
.field input:not(:placeholder-shown) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 7px;
  transform: scale(.76);
  color: var(--accent-hover);
}

.auth-form button,
.modal-box > button,
.modal-actions button,
.send-form button {
  border: 0;
  border-radius: var(--r-md);
  padding: 12px 18px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 600;
  font-size: 14px;
  transition: background .15s var(--ease), transform .06s var(--ease);
}
.auth-form button:hover,
.modal-box > button:hover,
.modal-actions button:hover,
.send-form button:hover { background: var(--accent-hover); }
.auth-form button:active,
.modal-box > button:active,
.modal-actions button:active { transform: scale(.98); }

.err { color: var(--danger); font-size: 12.5px; min-height: 16px; margin: 2px 0 0; }
.hint, .loading { color: var(--text-tertiary); font-size: 12.5px; padding: 6px 2px; }

/* =========================================================
   主界面布局
   ========================================================= */
#main-screen { display: flex; min-width: 0; height: 100dvh; }

/* ---- 侧边栏（参考 Discord 的结构层级）---- */
.sidebar {
  width: 288px;
  flex: 0 0 288px;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.me { position: relative; flex: none; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  background: var(--av-1-bg);
  color: var(--av-1);
  flex: none;
  user-select: none;
}

.avatar.av-1 { background: var(--av-1-bg); color: var(--av-1); }
.avatar.av-2 { background: var(--av-2-bg); color: var(--av-2); }
.avatar.av-3 { background: var(--av-3-bg); color: var(--av-3); }
.avatar.av-4 { background: var(--av-4-bg); color: var(--av-4); }
.avatar.av-5 { background: var(--av-5-bg); color: var(--av-5); }
.avatar.av-6 { background: var(--av-6-bg); color: var(--av-6); }

.online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--online);
  border: 2.5px solid var(--bg-sidebar);
}
.me-text { flex: 1; min-width: 0; }
#my-name {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#settings-btn {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  transition: background .15s var(--ease), color .15s var(--ease), transform .3s var(--ease);
}
#settings-btn:hover { background: var(--border-soft); color: var(--text-primary); transform: rotate(28deg); }

.sidebar-actions { display: grid; gap: 4px; padding: 10px; }
.sidebar-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  position: relative;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar-actions button svg { flex: none; color: var(--text-tertiary); transition: color .15s var(--ease); }
.sidebar-actions button:hover { background: rgba(194, 101, 47, .1); color: var(--accent-hover); }
.sidebar-actions button:hover svg { color: var(--accent-hover); }
.sidebar-actions button span:not(.badge) { flex: 1; }
.badge {
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

.list-label {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.conversation-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.conv-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: left;
  color: var(--text-primary);
  transition: background .12s var(--ease), border-color .12s var(--ease);
}
.conv-item:hover { background: rgba(43, 38, 32, .05); }
.conv-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.conv-item.active span:first-of-type { color: var(--accent-soft-text); font-weight: 700; }
.conv-item .avatar { width: 32px; height: 32px; font-size: 12px; }
.conv-item .conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-item .conv-main > span:first-child {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-tag {
  flex: none;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--border-soft);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
}

/* ---- 聊天区域（参考微信的气泡观感）---- */
.chat-area { min-width: 0; flex: 1; display: flex; flex-direction: column; background: var(--bg-panel); }
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.7;
}
.chat-panel { height: 100dvh; display: flex; flex-direction: column; min-width: 0; }
.chat-header {
  min-height: 56px;
  padding: 14px 22px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 20px 22px;
}
.msg-row { display: flex; align-items: flex-end; gap: 8px; max-width: min(72%, 640px); margin-top: 10px; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row .avatar { width: 26px; height: 26px; font-size: 10.5px; margin-bottom: 2px; }
.msg-col { display: flex; flex-direction: column; min-width: 0; }
.msg-row.mine .msg-col { align-items: flex-end; }

.sender { margin: 0 2px 3px; font-size: 11.5px; color: var(--text-tertiary); font-weight: 600; }

.msg {
  padding: 9px 13px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-1);
}
.msg.mine {
  background: var(--accent);
  color: var(--text-on-accent);
  border-bottom-right-radius: 4px;
}
.msg.theirs {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

/* 翻译区：原文常显，下方用一条细分隔线接上译文——本应用的标志性区块。
   译文还没到达时显示四个依次跳动的小点，到达后换成小一号的译文文字。 */
.msg-sep {
  height: 1px;
  margin: 7px 0;
  background: var(--border-soft);
}
.msg-row.mine .msg-sep { background: rgba(255, 248, 241, .3); }
.translation {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.msg-row.mine .translation { color: rgba(255, 248, 241, .82); }
.translation.pending { display: flex; align-items: center; height: 14px; }
.dots { display: inline-flex; align-items: center; gap: 3px; }
.dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .35;
  animation: dot-bounce 1.1s infinite ease-in-out;
}
.dots span:nth-child(1) { animation-delay: 0s; }
.dots span:nth-child(2) { animation-delay: .12s; }
.dots span:nth-child(3) { animation-delay: .24s; }
.dots span:nth-child(4) { animation-delay: .36s; }
@keyframes dot-bounce {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2.5px); }
}

.send-form { display: flex; gap: 10px; padding: 14px 18px; background: var(--bg-panel); border-top: 1px solid var(--border-soft); }
#msg-input {
  min-width: 0;
  flex: 1;
  padding: 12px 17px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-input);
  font-size: 14.5px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
#msg-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }
.send-form button {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* =========================================================
   弹窗（Discord 风格的悬浮卡片）
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(43, 38, 32, .42);
  backdrop-filter: blur(3px);
  animation: fade-in .15s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  width: min(400px, 100%);
  max-height: 82dvh;
  overflow-y: auto;
  padding: 26px;
  border-radius: var(--r-lg);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-3);
  animation: pop-in .18s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-box h3 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
}
.modal-box label { display: block; margin: 0 0 8px; font-size: 13px; color: var(--text-secondary); }
.modal-box input, .modal-box select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  margin-bottom: 12px;
  font-size: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.modal-box input:focus, .modal-box select:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); }

.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-actions button { flex: 1; }
.modal-box button.secondary {
  background: var(--border-soft);
  color: var(--text-secondary);
}
.modal-box button.secondary:hover { background: var(--border); color: var(--text-primary); }
.modal-box button.danger { background: var(--danger); }
.modal-box button.danger:hover { background: var(--danger-hover); }
.modal-box button.full-width { width: 100%; margin-top: 14px; }

.search-result-item, .req-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.search-result-item .avatar, .req-item .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.search-result-item > span:not(.avatar), .req-item > span:not(.avatar) { flex: 1; font-weight: 500; }
.search-result-item button, .req-item button { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.req-item div { display: flex; gap: 6px; }

.friend-check-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.friend-check-item input { width: auto; margin: 0; accent-color: var(--accent); }

/* =========================================================
   响应式（移动端）
   ========================================================= */
@media (max-width: 720px) {
  .sidebar { width: 118px; flex-basis: 118px; }
  .sidebar-header { padding: 10px 8px; }
  .me-text, #my-name { display: none; }
  .sidebar-actions button span:not(.badge) { display: none; }
  .sidebar-actions button { justify-content: center; padding: 10px 6px; }
  .list-label { padding: 12px 8px 4px; }
  .conv-item .conv-main > span:first-child { font-size: 11.5px; }
  .conv-tag { display: none; }
  .chat-header { padding: 12px 14px; font-size: 14.5px; }
  .messages { padding: 14px 10px; }
  .msg-row { max-width: 88%; }
  .send-form { padding: 10px; }
}

/* ===== 稳定性与新增状态 ===== */
.connection-status {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--online);
}
.connection-status.offline { color: var(--danger); }
.disabled-user {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--danger);
}
.load-older {
  align-self: center;
  margin: 10px auto 0;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
}
.load-older:hover { border-color: var(--accent); color: var(--accent); }
.msg-time {
  display: block;
  margin-top: 4px;
  color: var(--text-tertiary);
  font-size: 10px;
}
.msg-row.mine .msg-time { text-align: right; }
.translation.error { color: var(--danger); }
.translation.error button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  text-decoration: underline;
}

/* =========================================================
   会话操作与群聊管理（v1.3）
   ========================================================= */
.chat-header #chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-actions-btn {
  width: 34px;
  height: 34px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.chat-actions-btn:hover { background: var(--border-soft); color: var(--text-primary); }

.modal-box-wide { width: min(540px, calc(100vw - 28px)); max-height: min(82dvh, 720px); overflow-y: auto; }
.modal-copy { margin: 0 0 14px; color: var(--text-secondary); font-size: 13px; line-height: 1.7; }
.modal-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-title-row h3 { margin-bottom: 3px; }
.modal-subtitle { margin: 0; color: var(--text-tertiary); font-size: 12.5px; line-height: 1.5; }
.count-pill, .role-badge, .disabled-user {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.count-pill { background: var(--border-soft); color: var(--text-secondary); }
.role-badge { background: var(--accent-soft); color: var(--accent-soft-text); }
.disabled-user { background: rgba(174, 74, 52, .1); color: var(--danger); }

.manage-section { margin-top: 18px; }
.manage-section-title { margin-bottom: 8px; color: var(--text-secondary); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.group-member-list {
  overflow-y: auto;
  max-height: 270px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: var(--bg-input);
}
.group-member-item { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
.group-member-item:last-child { border-bottom: 0; }
.group-member-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.group-member-info .avatar { width: 32px; height: 32px; font-size: 12px; }
.member-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.member-remove-btn {
  flex: none;
  border: 1px solid rgba(174, 74, 52, .25);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}
.member-remove-btn:hover { background: rgba(174, 74, 52, .08); }
.group-add-row { display: flex; gap: 8px; }
.group-add-row select { flex: 1; min-width: 0; }
.group-add-row button { flex: none; }

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 13px;
  border: 1px solid rgba(174, 74, 52, .2);
  border-radius: var(--r-md);
  background: rgba(174, 74, 52, .045);
}
.danger-zone strong { display: block; font-size: 13px; }
.danger-zone p { margin: 3px 0 0; color: var(--text-tertiary); font-size: 11.5px; line-height: 1.5; }
.danger-zone button { flex: none; }

@media (max-width: 640px) {
  .chat-actions-btn { width: 32px; height: 32px; }
  .modal-box-wide { width: calc(100vw - 20px); max-height: 88dvh; }
  .danger-zone { align-items: flex-start; flex-direction: column; }
  .danger-zone button { width: 100%; }
  .group-add-row { flex-direction: column; }
  .group-add-row button { width: 100%; }
}

.group-add-row button,
.danger-zone button {
  border: 0;
  border-radius: var(--r-md);
  padding: 10px 15px;
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 700;
  font-size: 13px;
}
.group-add-row button:hover { background: var(--accent-hover); }
.danger-zone button.danger { background: var(--danger); }
.danger-zone button.danger:hover { background: var(--danger-hover); }

/* =========================================================
   Silvery River 品牌、会话搜索、在线状态与多行输入（v1.5）
   ========================================================= */
button, input, select, textarea { font: inherit; color: inherit; }
textarea { outline: none; }

.brand-mark {
  width: 116px;
  height: 116px;
  margin: -12px auto 10px;
}
.brand-mark img,
.app-brand img,
.empty-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.auth-box h1 { font-size: 28px; letter-spacing: -.025em; }

.app-brand {
  height: 54px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 15px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.app-brand img { width: 38px; height: 38px; }

.me-status-line {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.connection-status { display: inline; margin: 0; }

.online-dot,
.status-dot {
  --status-color: var(--text-tertiary);
  background: var(--status-color);
}
.online-dot.status-online,
.status-dot.status-online { --status-color: #6E9A66; }
.online-dot.status-busy,
.status-dot.status-busy { --status-color: #D26A43; }
.online-dot.status-invisible,
.status-dot.status-invisible,
.online-dot.status-offline,
.status-dot.status-offline { --status-color: #AAA394; }

.avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
}
.avatar-wrap .status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg-sidebar);
  border-radius: 50%;
}
.group-member-info .avatar-wrap .status-dot { border-color: var(--bg-input); }

.conversation-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 1px 10px 2px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .65);
  color: var(--text-tertiary);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.conversation-search:focus-within {
  border-color: var(--accent);
  background: var(--bg-input);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.conversation-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
}
.conversation-search input::-webkit-search-cancel-button { display: none; }
#clear-conversation-search {
  width: 20px;
  height: 20px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border-soft);
  color: var(--text-secondary);
  line-height: 1;
}
.conversation-empty {
  padding: 24px 10px;
  color: var(--text-tertiary);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}
.conv-item .conv-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: 400;
}
.conv-item.active .conv-sub { color: rgba(138, 74, 30, .7); }

.empty-logo {
  width: 118px;
  height: 118px;
  opacity: .76;
  filter: saturate(.86);
}
.chat-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-header #chat-title { flex: none; }
.chat-subtitle {
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
}

.send-form {
  position: relative;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
}
#msg-input {
  min-height: 42px;
  max-height: 132px;
  resize: none;
  overflow-y: auto;
  padding: 10px 15px;
  border-radius: 19px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.send-form #send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
}
.send-form #send-btn:hover { background: var(--accent-hover); }
.emoji-wrap { position: relative; flex: none; }
.send-form .composer-icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-input);
  color: var(--text-secondary);
}
.send-form .composer-icon-btn:hover,
.send-form .composer-icon-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.emoji-panel {
  position: absolute;
  z-index: 30;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(338px, calc(100vw - 28px));
  height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-3);
}
.emoji-search-row { padding: 11px 11px 7px; }
.emoji-search-row input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-input);
  font-size: 12.5px;
}
.emoji-search-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.emoji-categories {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 0 9px 7px;
  border-bottom: 1px solid var(--border-soft);
}
.send-form .emoji-category-btn {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
}
.send-form .emoji-category-btn:hover,
.send-form .emoji-category-btn.active { background: var(--accent-soft); color: var(--accent-hover); }
.emoji-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-content: start;
  gap: 2px;
  overflow-y: auto;
  padding: 9px;
}
.send-form .emoji-item {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: inherit;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 22px;
}
.send-form .emoji-item:hover { background: var(--accent-soft); transform: scale(1.08); }
.emoji-empty { margin: auto; color: var(--text-tertiary); font-size: 12px; }

.status-help {
  margin: -5px 0 14px;
  color: var(--text-tertiary);
  font-size: 11.5px;
  line-height: 1.5;
}
.member-status {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 10.5px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .app-brand { justify-content: center; height: 50px; padding: 6px; }
  .app-brand img { width: 36px; height: 36px; }
  .app-brand span { display: none; }
  .conversation-search { margin: 2px 7px; padding: 8px; }
  .conversation-search svg, #clear-conversation-search { display: none; }
  .conversation-search input { font-size: 11px; text-align: center; }
  .conv-item .conv-sub { display: none; }
  .send-form { gap: 6px; padding: 9px; }
  .send-form .composer-icon-btn, .send-form #send-btn { width: 40px; height: 40px; }
  #msg-input { min-height: 40px; padding: 9px 13px; }
  .emoji-panel { left: -2px; width: min(320px, calc(100vw - 20px)); height: 330px; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
}
.msg .text { white-space: pre-wrap; }
