/* ============ 基础 ============ */
:root {
  --green: #07c160;
  --green-strong: #06ad56;
  --green-bubble: #95ec69;
  --bg: #f5f5f5;
  --panel: #ffffff;
  --rail: #2e2e2e;
  --border: #e7e7e7;
  --text: #191919;
  --text-2: #7f7f7f;
  --text-3: #b2b2b2;
  --red: #fa5151;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.logo-icon {
  width: 100%;
  height: 100%;
  display: block;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: #c9c9c9;
  border-radius: 3px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============ 启动页 ============ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.boot-logo {
  width: 72px;
  height: 72px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0ad96d, #06ad56);
  color: #fff;
  box-shadow: 0 16px 40px rgba(7, 193, 96, 0.3);
  animation: bootPulse 1.4s ease-in-out infinite;
}

.boot-logo svg {
  width: 100%;
  height: 100%;
}

@keyframes bootPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.92);
    opacity: 0.75;
  }
}

/* ============ 登录 / 注册 ============ */
.auth-view {
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(1100px 560px at 15% -5%, #d9f7e6 0%, rgba(217, 247, 230, 0) 60%),
    radial-gradient(900px 520px at 95% 105%, #e3f8ee 0%, rgba(227, 248, 238, 0) 55%),
    #f5f7f6;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 34px 32px 24px;
  box-shadow: 0 24px 60px rgba(15, 40, 28, 0.12), 0 2px 8px rgba(15, 40, 28, 0.05);
}

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, #09d66b, #06ad56);
  color: #fff;
  margin: 0 auto;
  box-shadow: 0 10px 24px rgba(7, 193, 96, 0.35);
}

.auth-brand h1 {
  font-size: 22px;
  letter-spacing: 1px;
  margin: 14px 0 6px;
}

.auth-brand p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  background: #f2f3f3;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 0;
  border-radius: 9px;
  font-size: 14px;
  color: var(--text-2);
  transition: all 0.15s ease;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #e3e5e4;
  background: #fafbfb;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.btn {
  border: 0;
  border-radius: 10px;
  height: 44px;
  padding: 0 18px;
  font-size: 15px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--green-strong);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-block {
  width: 100%;
  margin-top: 4px;
}

.btn-ghost {
  background: #fff;
  border: 1px solid #e2e2e2;
  color: #444;
}

.btn-ghost:hover {
  background: #f5f5f5;
}

.btn-sm {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 6px;
}

.form-error {
  background: #fff2f2;
  color: #d93030;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.auth-note {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  margin: 18px 0 0;
}

.avatar-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 0;
  font-size: 30px;
  background: #e8f8ef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-pick-text {
  font-size: 12px;
  color: var(--text-2);
}

/* ============ 头像 ============ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex: none;
  user-select: none;
  line-height: 1;
}

.avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 15px;
}

.avatar-56 {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  font-size: 30px;
}

.avatar-96 {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  font-size: 48px;
}

.avatar-0 { background: #e6f7ee; }
.avatar-1 { background: #e8f0fe; }
.avatar-2 { background: #fff2e0; }
.avatar-3 { background: #fde8ea; }
.avatar-4 { background: #f0ebff; }
.avatar-5 { background: #e5f6f7; }
.avatar-6 { background: #fbf3dc; }
.avatar-7 { background: #edf7e3; }

/* ============ 主布局 ============ */
.app {
  position: relative;
  display: grid;
  grid-template-columns: 64px 300px 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* ============ 左侧导航 ============ */
.rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 0 18px;
}

.rail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 0;
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3a3a3a;
  transition: transform 0.15s ease;
}

.rail-avatar:hover {
  transform: scale(1.05);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 26px;
  width: 100%;
  align-items: center;
}

.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #9a9a9a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.rail-btn .icon {
  width: 22px;
  height: 22px;
}

.rail-btn:hover {
  color: #e6e6e6;
  background: rgba(255, 255, 255, 0.06);
}

.rail-btn.active {
  color: var(--green);
  background: rgba(7, 193, 96, 0.12);
}

.rail-bottom {
  margin-top: auto;
}

.badge {
  position: absolute;
  top: 3px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ============ 会话列表 ============ */
.sidebar {
  background: #f7f7f7;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-head {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 20px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.sidebar-actions {
  display: flex;
  gap: 2px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: #ececec;
}

.search-wrap {
  position: relative;
  margin: 0 14px 10px;
  flex: none;
}

.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #a8a8a8;
}

.search-wrap input {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  background: #ebebeb;
  padding: 0 10px 0 32px;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.search-wrap input:focus {
  background: #fff;
  border-color: var(--green);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}

.empty-tip {
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
  padding: 40px 16px;
  line-height: 1.9;
}

.conv-item,
.contact-item,
.entry-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.conv-item:hover,
.contact-item:hover,
.entry-item:hover {
  background: #ececec;
}

.conv-item.active {
  background: #e2e2e2;
}

.conv-avatar {
  position: relative;
  flex: none;
}

.presence {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #bdbdbd;
  border: 2px solid #f7f7f7;
}

.presence.online {
  background: var(--green);
}

.conv-item.active .presence {
  border-color: #e2e2e2;
}

.unread {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #f7f7f7;
}

.conv-info {
  flex: 1;
  min-width: 0;
}

.conv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.conv-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-time {
  font-size: 11px;
  color: var(--text-3);
  flex: none;
}

.conv-preview {
  font-size: 12px;
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
}

.entry-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.entry-icon .icon {
  width: 20px;
  height: 20px;
}

.entry-name {
  font-size: 14px;
}

.count-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-label {
  font-size: 11px;
  color: #a8a8a8;
  padding: 12px 12px 6px;
}

.contact-item {
  gap: 10px;
}

.contact-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-uid {
  font-size: 11px;
  color: #a8a8a8;
}

/* 侧边“我” */
.side-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.side-profile:hover {
  background: #ececec;
}

.side-profile-info {
  flex: 1;
  min-width: 0;
}

.side-profile-name {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-profile-id {
  font-size: 11.5px;
  color: #999;
  margin-top: 3px;
}

.chev {
  width: 15px;
  height: 15px;
  color: #c0c0c0;
}

.side-menu {
  margin-top: 12px;
  border-top: 1px solid #ececec;
  padding-top: 12px;
}

.side-menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  color: #e64340;
}

.side-menu-item:hover {
  background: #ececec;
}

/* ============ 主区域 ============ */
.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-inner {
  text-align: center;
  color: var(--text-3);
}

.welcome-logo {
  width: 72px;
  height: 72px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0ad96d, #06ad56);
  color: #fff;
  margin: 0 auto 18px;
  box-shadow: 0 14px 30px rgba(7, 193, 96, 0.25);
}

.welcome-logo svg {
  width: 100%;
  height: 100%;
}

.welcome h2 {
  color: #7a7a7a;
  font-size: 18px;
  margin: 0 0 8px;
}

.welcome p {
  margin: 0;
  font-size: 13px;
}

/* ============ 聊天窗 ============ */
.chat-pane {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.chat-head {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}

.chat-head-info {
  min-width: 0;
}

.chat-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}

.presence-dot.off {
  background: #c0c0c0;
}

.chat-sub {
  font-size: 11px;
  color: #9b9b9b;
  margin-top: 2px;
  height: 14px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 10px;
  display: flex;
  flex-direction: column;
}

.chat-loading,
.chat-empty {
  margin: auto;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  line-height: 1.8;
}

.time-sep {
  align-self: center;
  font-size: 11px;
  color: #a0a0a0;
  background: rgba(0, 0, 0, 0.045);
  padding: 3px 8px;
  border-radius: 4px;
  margin: 10px 0;
  flex: none;
}

.load-more {
  align-self: center;
  border: 0;
  background: rgba(0, 0, 0, 0.045);
  color: #7a7a7a;
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 12px;
  margin: 4px 0 12px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  max-width: 100%;
}

.msg-row.me {
  flex-direction: row-reverse;
}

.msg-row .bubble {
  position: relative;
  max-width: min(68%, 560px);
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03);
}

.msg-row.me .bubble {
  background: var(--green-bubble);
}

.msg-row.them .bubble::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 13px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid #fff;
}

.msg-row.me .bubble::before {
  content: "";
  position: absolute;
  right: -5px;
  top: 13px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--green-bubble);
}

.composer {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 8px 20px 12px;
}

.composer-tools {
  display: flex;
  gap: 4px;
  position: relative;
}

#msg-input {
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  padding: 6px 0;
  max-height: 140px;
  display: block;
}

.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.send-hint {
  font-size: 10.5px;
  color: #b7b7b7;
}

.btn-send {
  height: 32px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 13px;
  background: var(--green);
  color: #fff;
}

.btn-send:disabled {
  background: #dcdcdc;
  color: #fff;
  cursor: default;
}

.emoji-pop {
  position: absolute;
  bottom: 42px;
  left: 0;
  width: 272px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 20;
}

.emoji-pop button {
  border: 0;
  background: transparent;
  font-size: 20px;
  padding: 6px 0;
  border-radius: 6px;
  line-height: 1;
}

.emoji-pop button:hover {
  background: #f2f2f2;
}

/* ============ 页面（资料 / 好友 / 申请 / 搜索） ============ */
.page-pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: var(--bg);
}

.page {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 28px 60px;
}

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
}

.profile-top,
.friend-hero {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 6px 4px 28px;
}

.profile-info {
  min-width: 0;
}

.profile-name {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-line {
  font-size: 12.5px;
  color: #8a8a8a;
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-btn {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 7px;
  color: #666;
}

.mini-btn:hover {
  background: #f5f5f5;
}

.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 22px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  cursor: pointer;
}

.card-row:last-child {
  border-bottom: 0;
}

.card-row:hover {
  background: #fafafa;
}

.row-label {
  color: #333;
}

.row-value {
  color: #999;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-danger-outline {
  width: 100%;
  height: 44px;
  background: #fff;
  color: #e64340;
  border: 1px solid #ededed;
  border-radius: 10px;
  font-size: 14.5px;
}

.btn-danger-outline:hover {
  background: #fff5f5;
}

.version {
  text-align: center;
  color: #c0c0c0;
  font-size: 11px;
  margin-top: 26px;
}

.friend-actions {
  display: flex;
  gap: 12px;
}

.friend-actions .btn {
  flex: 1;
}

.btn-danger {
  background: #fff;
  border: 1px solid #f3c9c9;
  color: #e64340;
}

.btn-danger:hover {
  background: #fff5f5;
}

/* 好友申请 */
.req-group-title {
  font-size: 12px;
  color: #9a9a9a;
  margin: 10px 4px 10px;
}

.req-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.req-info {
  flex: 1;
  min-width: 0;
}

.req-name {
  font-size: 14px;
  font-weight: 500;
}

.req-msg {
  font-size: 12px;
  color: #9a9a9a;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.req-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.tag-muted {
  font-size: 12px;
  color: #a8a8a8;
  flex: none;
}

/* 添加朋友 */
.add-search {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.input-wrap {
  flex: 1;
  position: relative;
}

.input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #a8a8a8;
}

.add-search input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e3e3e3;
  padding: 0 14px 0 36px;
  font-size: 14px;
  outline: none;
  background: #fff;
  transition: all 0.15s ease;
}

.add-search input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

.add-search .btn {
  height: 42px;
  flex: none;
}

.search-hint {
  font-size: 12px;
  color: #a8a8a8;
  margin: 0 4px 18px;
  line-height: 1.7;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
}

.user-id {
  font-size: 12px;
  color: #9a9a9a;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-action {
  flex: none;
}

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.modal h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.modal-text {
  margin: 0 0 4px;
  color: #666;
  font-size: 13.5px;
  line-height: 1.7;
}

.modal-user {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #f7f7f7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.modal-user-name {
  font-size: 14px;
  font-weight: 500;
}

.modal-user-id {
  font-size: 12px;
  color: #9a9a9a;
  margin-top: 2px;
}

.modal-label {
  display: block;
  font-size: 12px;
  color: #8a8a8a;
  margin-bottom: 6px;
}

.modal textarea,
.modal-input {
  width: 100%;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  resize: none;
  outline: none;
  min-height: 84px;
}

.modal-input {
  height: 44px;
  min-height: 0;
}

.modal textarea:focus,
.modal-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-actions .btn {
  height: 38px;
  padding: 0 18px;
  font-size: 13.5px;
}

.btn-danger-solid {
  background: #e64340;
  color: #fff;
  font-weight: 600;
}

.btn-danger-solid:hover {
  background: #d93a37;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.avatar-option {
  border: 1px solid transparent;
  background: #f7f7f7;
  border-radius: 8px;
  font-size: 22px;
  padding: 8px 0;
  line-height: 1;
}

.avatar-option:hover {
  background: #edf7f1;
}

.avatar-option.selected {
  border-color: var(--green);
  background: #e8f8ef;
}

/* ============ Toast ============ */
.toast-root {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.2s ease;
  max-width: 80vw;
  word-break: break-word;
}

.toast.error {
  background: rgba(214, 50, 50, 0.95);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ 移动端 ============ */
.mobile-tabs {
  display: none;
}

.back-btn {
  display: none;
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

  .sidebar {
    position: absolute;
    inset: 0 0 calc(56px + env(safe-area-inset-bottom)) 0;
    z-index: 10;
    border-right: 0;
  }

  .sidebar-head {
    height: calc(56px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  .main {
    position: fixed;
    inset: 0 0 calc(56px + env(safe-area-inset-bottom)) 0;
    z-index: 30;
    transform: translateX(102%);
    transition: transform 0.22s ease;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  }

  .app.show-main .main {
    transform: translateX(0);
  }

  .welcome {
    display: none;
  }

  .mobile-tabs {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #f7f7f7;
    border-top: 1px solid #e3e3e3;
    z-index: 40;
  }

  .mobile-tab {
    flex: 1;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    color: #7a7a7a;
    position: relative;
    padding: 0;
  }

  .mobile-tab .icon {
    width: 21px;
    height: 21px;
  }

  .mobile-tab.active {
    color: var(--green);
  }

  .mobile-tab .badge {
    top: 5px;
    right: calc(50% - 24px);
  }

  .back-btn {
    display: flex;
  }

  .chat-head {
    height: calc(56px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-left: 8px;
    padding-right: 12px;
    gap: 4px;
  }

  .messages {
    padding: 12px 12px 6px;
  }

  .msg-row .bubble {
    max-width: 76%;
  }

  .composer {
    padding: 6px 12px 10px;
  }

  .send-hint {
    display: none;
  }

  .page {
    padding: 22px 18px 40px;
  }

  .profile-top,
  .friend-hero {
    padding-top: 2px;
  }

  .profile-name {
    font-size: 20px;
  }

  .avatar-96 {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    font-size: 38px;
  }

  .add-search .btn {
    padding: 0 16px;
  }

  .emoji-pop {
    width: 258px;
  }
}
