:root {
  --bg: #e9edf2;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --ink: #13171c;
  --ink-2: #5d6673;
  --ink-3: #949dab;
  --line: #e6eaf0;
  --accent: #2f6feb;
  --accent-soft: #eaf1fe;
  --accent-ink: #ffffff;
  --danger: #c14343;
  --ok: #12805c;
  --mine-bg: #2f6feb;
  --mine-ink: #ffffff;
  --theirs-bg: #f2f4f7;
  --theirs-ink: #13171c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12;
    --panel: #15181e;
    --panel-2: #1b1f26;
    --ink: #eef1f5;
    --ink-2: #a2abb8;
    --ink-3: #6f7a89;
    --line: #262b34;
    --accent: #4d86f7;
    --accent-soft: #1b2637;
    --mine-bg: #2f6feb;
    --theirs-bg: #21262f;
    --theirs-ink: #eef1f5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

#app, #auth { width: 100%; }

.app, .auth {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  max-width: 520px;
  background: var(--panel);
  position: relative;
  overflow: hidden;
}

@media (min-width: 560px) and (min-height: 620px) {
  .app, .auth {
    height: min(780px, 94dvh);
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
  }
}

.grow { flex: 1; min-width: 0; }

.app.chatting .topbar { display: none; }

/* ---------------------------------------------------------------- 登录页 */

.auth { justify-content: center; padding: 28px 22px 20px; overflow-y: auto; }
.auth-card { width: 100%; max-width: 360px; margin: 0 auto; }

.brand { text-align: center; margin-bottom: 26px; }
.brand-mark {
  width: 54px; height: 54px; margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
}
.brand h1 { font-size: 21px; font-weight: 600; letter-spacing: -.2px; margin: 0 0 4px; }
.brand p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.field { display: block; margin-bottom: 12px; }
.field > span {
  display: block; font-size: 12.5px; color: var(--ink-2);
  margin-bottom: 6px; font-weight: 500;
}
.field > span em { font-style: normal; color: var(--ink-3); font-weight: 400; }

.field input {
  width: 100%;
  padding: 12px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus { border-color: var(--accent); background: var(--panel); }
.field input::placeholder { color: var(--ink-3); }

.server-box {
  margin: 4px 0 16px;
  border: 1px dashed var(--line);
  border-radius: 11px;
  padding: 0 12px;
  background: var(--panel-2);
}
.server-box summary {
  cursor: pointer; font-size: 12.5px; color: var(--ink-2);
  padding: 10px 0; list-style: none; font-weight: 500;
}
.server-box summary::-webkit-details-marker { display: none; }
.server-box summary::after { content: " ›"; color: var(--ink-3); }
.server-box[open] summary::after { content: " ⌄"; }
.server-box .field { margin-bottom: 10px; }
.server-box input { background: var(--panel); }

.hint { font-size: 12px; color: var(--ink-3); margin: 0 0 10px; line-height: 1.5; }
.server-box .hint { margin-bottom: 10px; }

.btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  border-radius: 11px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter .15s, opacity .15s;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:active { filter: brightness(.94); }
.btn.primary[disabled] { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }

.switch { text-align: center; font-size: 13px; color: var(--ink-2); margin: 14px 0 0; }
.switch a { color: var(--accent); text-decoration: none; font-weight: 500; }

.foot { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 22px 0 0; }

/* ------------------------------------------------------------------ 主界面 */

.topbar, .chatbar {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 auto;
  padding-top: max(12px, env(safe-area-inset-top));
}

.topbar .title, .chatbar .title {
  font-size: 15.5px; font-weight: 600; letter-spacing: -.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .sub, .chatbar .sub {
  font-size: 12px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sub.online { color: var(--ok); }

/* 聊天页顶部：名字居中，两边留等宽按钮位 */
.chatbar .chat-title { text-align: center; }
.chatbar #btn-back, .chatbar #btn-group-info { width: 34px; flex: 0 0 34px; }

.avatar {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 15px; font-weight: 600;
  background: #888;
  user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }

.icon-btn {
  width: 36px; height: 36px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: none; border-radius: 10px;
  background: transparent; color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:active { background: var(--panel-2); }
.icon-btn.back { margin-left: -6px; }

/* ---------------------------------------------------------------- 会话列表 */

.list-view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.conv-list { padding: 6px 0; }

.conv {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.conv:active { background: var(--panel-2); }

.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-name {
  font-size: 15px; font-weight: 500; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-time { font-size: 11.5px; color: var(--ink-3); flex: 0 0 auto; }
.conv-count { font-size: 11.5px; color: var(--ink-3); font-weight: 400; margin-left: 5px; }
.avatar.grp { border-radius: 12px; }
.conv-preview {
  font-size: 13px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.conv.unread .conv-preview { color: var(--ink); font-weight: 500; }

.badge {
  min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 10px;
  background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600;
  display: grid; place-items: center;
  flex: 0 0 auto;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}

.empty {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 30px 34px; text-align: center; gap: 4px;
}
.empty-mark {
  width: 62px; height: 62px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 10px;
}
.empty h3 { font-size: 15.5px; font-weight: 600; margin: 0; }
.empty p { font-size: 13px; color: var(--ink-2); margin: 2px 0 16px; max-width: 260px; }
.empty .btn { width: auto; padding: 9px 18px; font-size: 14px; }

/* ------------------------------------------------------------------ 聊天页 */

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.messages {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 14px 8px;
  display: flex; flex-direction: column; gap: 3px;
  background:
    radial-gradient(circle at 20% 0%, rgba(47,111,235,.045), transparent 45%),
    var(--panel);
}

.day {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  margin: 12px 0 8px;
}
/* 消息少的时候贴着输入框显示，多了以后这个占位自动收成 0 */
.messages .pad { flex: 1 1 auto; min-height: 0; }
.day span {
  background: var(--panel-2); padding: 3px 10px; border-radius: 20px;
}

.row { display: flex; margin-top: 3px; align-items: flex-end; gap: 8px; }
/* 自己的消息：倒序排列，头像自然落到右边 */
.row.mine { flex-direction: row-reverse; justify-content: flex-start; }
.row.group-start { margin-top: 10px; }

/* 消息旁边的小头像（像微信那样） */
.avatar.sm { width: 34px; height: 34px; font-size: 13px; margin-bottom: 1px; }
.row .bubble { max-width: calc(78% - 42px); }

.bubble {
  max-width: 78%;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.45;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(4px); opacity: .4; } to { transform: none; opacity: 1; } }

.row.theirs .bubble {
  background: var(--theirs-bg); color: var(--theirs-ink);
  border-bottom-left-radius: 6px;
}
.row.mine .bubble {
  background: var(--mine-bg); color: var(--mine-ink);
  border-bottom-right-radius: 6px;
}
.row.mine.pending .bubble { opacity: .62; }

.meta {
  display: flex; align-items: center; gap: 5px;
  justify-content: flex-end;
  font-size: 11px; color: var(--ink-3);
  margin: 3px 2px 0;
}
.meta .tick { color: var(--accent); font-weight: 600; }
.meta .tick.read { color: var(--ok); }

.typing { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); display: block;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.composer {
  display: flex; align-items: flex-end; gap: 4px;
  padding: 9px 8px;
  padding-bottom: max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex: 0 0 auto;
}
.composer .icon-btn { width: 33px; height: 38px; color: var(--ink-2); }
.composer .icon-btn.on { color: var(--accent); }
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  outline: none;
}
.composer textarea:focus { border-color: var(--accent); background: var(--panel); }

.send {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 50%;
  border: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.send[disabled] { opacity: .4; }
.send:active:not([disabled]) { transform: scale(.94); }

/* --------------------------------------------------------------- 首页 / 标签栏 */

.home-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.home-scroll { flex: 1; overflow-y: auto; padding: 14px 14px 20px; }
.site-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.site-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 14px 8px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
  position: relative;
}
.site-card:active { background: var(--panel-2); }
.site-card .site-mark {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  color: #fff; font-size: 18px; font-weight: 600;
}
.site-card .site-name { font-size: 12.5px; color: var(--ink); }
.site-card.add .site-mark {
  background: transparent; border: 1.5px dashed var(--line); color: var(--ink-3);
  font-size: 24px; font-weight: 400;
}
.site-card .site-del {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(20,24,30,.55); color: #fff;
  font-size: 13px; line-height: 1; display: none; place-items: center;
}
body.editing-sites .site-card.removable .site-del { display: grid; }
.home-tip {
  font-size: 12px; color: var(--ink-3); text-align: center;
  line-height: 1.6; margin: 20px 6px 0;
}

.tabbar {
  flex: 0 0 auto;
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  border: none; background: transparent;
  color: var(--ink-3);
  font-family: inherit; font-size: 11px;
  padding: 7px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer;
  position: relative;
}
.tab.on { color: var(--accent); }
.tab-badge {
  position: absolute; top: 3px; left: 50%; margin-left: 6px;
  min-width: 16px; height: 16px; padding: 0 5px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-style: normal; font-weight: 600;
  display: grid; place-items: center;
}
.app.chatting .tabbar { display: none; }
.app.home-mode #main-topbar,
.app.home-mode #list-view,
.app.me-mode #main-topbar,
.app.me-mode #list-view { display: none; }

/* 头像图片 */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* 我的 */
.me-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.me-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 24px; }
.me-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 16px 18px;
  display: flex; flex-direction: column; align-items: center;
}
.me-avatar {
  width: 86px; height: 86px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 600;
  overflow: hidden;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-avatar-btn {
  margin-top: 10px; border: none; background: transparent;
  color: var(--accent); font-size: 12.5px; font-family: inherit; cursor: pointer;
  padding: 4px 8px;
}
.me-name { margin-top: 4px; font-size: 17px; font-weight: 600; color: var(--ink); }
.me-id {
  margin-top: 3px; font-size: 13px; color: var(--ink-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.me-rows {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.me-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border: none; background: transparent;
  border-bottom: 1px solid var(--line);
  font-family: inherit; font-size: 14.5px; color: var(--ink);
  cursor: pointer; text-align: left;
}
.me-row:last-child { border-bottom: none; }
.me-row:active { background: var(--panel-2); }
.me-row em {
  margin-left: auto; font-style: normal;
  color: var(--ink-3); font-size: 13.5px;
  max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-row svg { color: var(--ink-3); flex: 0 0 auto; }

/* 链接卡片消息 */
.link-card {
  display: flex; gap: 10px; align-items: flex-start;
  min-width: 170px; max-width: 240px;
  cursor: pointer;
}
.link-card .link-ico {
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff; font-size: 14px; font-weight: 600;
  background: #7d8695;
}
.link-card .link-txt { min-width: 0; }
.link-card .link-title {
  font-size: 13.5px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.link-card .link-site { font-size: 11.5px; opacity: .7; margin-top: 3px; }
.row.mine .link-card .link-ico { background: rgba(255,255,255,.22); }

/* 图片 / 表情消息 */
.row.mine .bubble.media, .row.theirs .bubble.media { background: transparent; padding: 0; border-radius: 0; }
.bubble.media img {
  display: block;
  max-width: 200px;
  max-height: 250px;
  border-radius: 14px;
  object-fit: cover;
  cursor: zoom-in;
  background: var(--panel-2);
}
.row.mine .bubble.media img { box-shadow: 0 1px 2px rgba(16,24,40,.10); }
.bubble.sticker { background: transparent !important; padding: 0 !important; }
.bubble.sticker img { display: block; width: 104px; height: 104px; object-fit: contain; }

.bubble.pending-media {
  width: 180px; height: 130px;
  display: grid; place-items: center;
  background: var(--panel-2) !important;
  color: var(--ink-3); font-size: 12.5px;
}
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
  margin: 0 auto 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 表情面板 */
.panel {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--panel);
  max-height: 250px;
  display: flex; flex-direction: column;
}
.panel-tabs {
  display: flex; gap: 4px;
  padding: 8px 12px 4px;
  flex: 0 0 auto;
}
.panel-tab {
  border: none; background: transparent;
  color: var(--ink-3); font-size: 13px; font-family: inherit;
  padding: 5px 11px; border-radius: 8px; cursor: pointer;
}
.panel-tab.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.panel-body {
  flex: 1; overflow-y: auto;
  padding: 6px 12px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 4px;
}
.panel-body.stickers { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }

.emoji-item {
  border: none; background: transparent;
  font-size: 24px; line-height: 1;
  padding: 6px 0; border-radius: 8px;
  cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.emoji-item:active { background: var(--panel-2); }
.emoji-item.more { font-size: 18px; color: var(--ink-3); }

.sticker-cell { position: relative; }
.sticker-cell img {
  width: 100%; aspect-ratio: 1;
  object-fit: contain;
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  display: block;
}
.sticker-cell .del {
  position: absolute; top: -5px; right: -5px;
  width: 19px; height: 19px; border-radius: 50%;
  border: none; background: var(--danger); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer;
  display: none; place-items: center;
}
.panel-body.managing .sticker-cell .del { display: grid; }
.sticker-head {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ink-3);
  padding: 2px 2px 6px;
}
.sticker-head button {
  border: none; background: transparent; color: var(--accent);
  font-size: 12.5px; font-family: inherit; cursor: pointer; padding: 2px 4px;
}

/* 按住说话 */
.hold-bar {
  display: none;
  flex: 1;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.composer.voice-mode textarea { display: none; }
.composer.voice-mode .hold-bar { display: flex; }
.composer.voice-mode #send { display: none; }
.hold-bar.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.recording {
  position: absolute; left: 50%; bottom: 84px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(20, 24, 30, .9);
  color: #fff;
  font-size: 12.5px;
  padding: 9px 15px;
  border-radius: 20px;
  z-index: 40;
  white-space: nowrap;
}
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff5a5a;
  animation: recpulse 1s infinite;
}
@keyframes recpulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rec-hint { color: rgba(255,255,255,.6); }

/* 语音气泡 */
.voice {
  display: flex; align-items: center; gap: 8px;
  min-width: 78px;
  cursor: pointer;
}
.voice .tri {
  width: 0; height: 0;
  border-left: 9px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  flex: 0 0 auto;
  opacity: .85;
}
.voice .bars { display: flex; align-items: center; gap: 2px; height: 16px; }
.voice .bars i {
  display: block; width: 2.5px; border-radius: 2px;
  background: currentColor; opacity: .55;
}
.voice .dur { font-size: 12.5px; opacity: .8; margin-left: 2px; }
.voice.playing .bars i { animation: vbounce .9s infinite ease-in-out; opacity: .95; }
.voice.playing .bars i:nth-child(2) { animation-delay: .1s; }
.voice.playing .bars i:nth-child(3) { animation-delay: .2s; }
.voice.playing .bars i:nth-child(4) { animation-delay: .3s; }
.voice.playing .bars i:nth-child(5) { animation-delay: .4s; }
@keyframes vbounce { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1.35); } }

/* 群里显示发送者 */
.sender { font-size: 11.5px; color: var(--ink-3); margin: 0 0 3px 5px; }

/* 加号菜单 */
.menu-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 4px;
  border: none; background: transparent;
  text-align: left; font-family: inherit; color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.menu-row:last-of-type { border-bottom: none; }
.menu-icon {
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.menu-row strong { display: block; font-size: 14.5px; font-weight: 500; }
.menu-row em { font-style: normal; font-size: 12px; color: var(--ink-3); }

/* 选人 / 成员列表 */
.pick-list, .member-list {
  max-height: 210px; overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
}
.pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.pick-row:active { background: var(--panel-2); }
.pick-row .avatar { width: 30px; height: 30px; font-size: 12px; }
.pick-row .tick-box {
  width: 19px; height: 19px; border-radius: 50%;
  border: 1.5px solid var(--line);
  margin-left: auto;
  display: grid; place-items: center;
  color: transparent;
  font-size: 12px;
}
.pick-row.on .tick-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; font-size: 14px;
}
.member-row .avatar { width: 28px; height: 28px; font-size: 12px; }
.member-row .owner-tag { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }

/* 更新进度 */
.progress {
  height: 7px; border-radius: 5px;
  background: var(--panel-2);
  overflow: hidden;
  margin: 12px 0 2px;
}
.progress-bar {
  height: 100%; width: 0%;
  background: var(--accent);
  border-radius: 5px;
  transition: width .2s;
}

/* 看图 */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(8, 10, 14, .93);
  display: flex; align-items: center; justify-content: center;
  z-index: 80; padding: 18px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .close {
  position: absolute; top: 16px; right: 16px;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.14); color: #fff;
  font-size: 20px; cursor: pointer;
}

/* 新消息顶部横幅：跟微信一样从屏幕上方滑下来 */
.banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 10px; right: 10px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: #20242c;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
  z-index: 200;
  cursor: pointer;
  animation: banner-in .22s ease-out;
}
.banner[hidden] { display: none; }
@keyframes banner-in {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.banner .avatar { width: 40px; height: 40px; font-size: 15px; }
.banner-body { flex: 1 1 auto; min-width: 0; }
.banner-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.banner-text {
  font-size: 12.5px; opacity: .88; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-badge {
  flex: 0 0 auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #f0483e; color: #fff;
  font-size: 11px; line-height: 18px; text-align: center;
}
.banner-badge[hidden] { display: none; }
.banner-time { flex: 0 0 auto; font-size: 11px; opacity: .6; align-self: flex-start; }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 66px);
  transform: translateX(-50%);
  background: rgba(20, 24, 30, .92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 11px;
  z-index: 99;
  max-width: 82vw;
  text-align: center;
}

.sheet {
  border: none;
  border-radius: 18px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  width: min(360px, 88vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.sheet::backdrop { background: rgba(12, 16, 22, .38); }
.sheet-inner { padding: 20px 20px 16px; }
.sheet h3 { margin: 0 0 3px; font-size: 16px; font-weight: 600; }
.sheet-actions { display: flex; gap: 9px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------- 在线表情 / 联系人管理 */
.panel-body.panel-online { display: block; padding: 10px 12px 14px; max-height: 250px; overflow-y: auto; }
.panel-online[hidden] { display: none; }
.online-head { display: flex; gap: 6px; align-items: center; margin-bottom: 9px; }
.online-head input {
  flex: 1 1 auto; min-width: 0; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--ink); font-size: 12.5px;
}
.online-head button, .online-tools button {
  flex: 0 0 auto; height: 32px; padding: 0 11px; border: none;
  border-radius: 9px; background: var(--accent); color: #fff;
  font-size: 12.5px; cursor: pointer;
}
.online-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.online-chips button {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2);
  border-radius: 20px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.online-chips button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.online-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; }
.online-cell {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); aspect-ratio: 1; display: grid; place-items: center;
  padding: 5px; cursor: pointer;
}
.online-cell img { width: 100%; height: 100%; object-fit: contain; }
.online-cell .add {
  position: absolute; right: 2px; bottom: 2px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff;
  font-size: 15px; line-height: 20px; padding: 0; cursor: pointer;
}
.online-cell.done .add { background: var(--ok); }
.online-tip { font-size: 11.5px; color: var(--ink-3); margin: 9px 0 0; line-height: 1.5; }
.online-tools { display: flex; gap: 8px; margin-top: 9px; }
.online-tools button { background: var(--panel-2); color: var(--accent); border: 1px solid var(--accent); }
.contact-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}
.contact-row .avatar { width: 36px; height: 36px; font-size: 14px; }
.contact-row .who { flex: 1 1 auto; min-width: 0; }
.contact-row .who strong { display: block; font-size: 14px; font-weight: 500; }
.contact-row .who em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.contact-row button {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent;
  color: var(--danger); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer;
}
