/* 尬聊 web 端全局样式 —— 颜色一律引用 :root 变量(tokens.dart 同源)。 */
:root {
  /* 与 lib/tokens.dart 逐项对应,改动必须两边同步 */
  --c-primary: #07C160;
  --c-on-primary: #FFFFFF;
  --c-page-bg: #EDEDED;
  --c-text-main: #101010;
  --c-bubble-other: #FFFFFF;
  --c-surface-low: #F5F5F5;
  --c-surface-high: #EAEAEA;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--c-page-bg);
  color: var(--c-text-main);
}

/* ---- 页面骨架 ---- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 360px;
  background: var(--c-bubble-other);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.title { font-size: 22px; text-align: center; color: var(--c-primary); }
.subtitle { font-size: 12px; text-align: center; color: #888; }

/* ---- 表单 ---- */
.field-label { font-size: 13px; color: #666; }

.field {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-surface-high);
  border-radius: 8px;
  font-size: 15px;
  background: var(--c-surface-low);
  outline: none;
}
.field:focus { border-color: var(--c-primary); background: #fff; }

.toggle {
  align-self: flex-start;
  border: 1px solid var(--c-surface-high);
  background: var(--c-surface-low);
  color: #888;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
.toggle-on { color: var(--c-primary); border-color: var(--c-primary); }

.btn-login {
  height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-size: 16px;
  cursor: pointer;
  margin-top: 8px;
}
.btn-login:hover { filter: brightness(1.05); }
.btn-loading { opacity: 0.7; cursor: default; }

/* ---- 结果与状态 ---- */
.error {
  background: #FDE7E7;
  color: #D24545;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  word-break: break-all;
}

.success {
  background: var(--c-surface-low);
  border: 1px solid var(--c-surface-high);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  word-break: break-all;
}
.ok-title { color: var(--c-primary); font-weight: 600; font-size: 15px; }
.im-status { color: #888; }

.footnote { font-size: 12px; color: #999; }

/* ---- 主界面占位(P1 将替换为会话列表) ---- */
.home { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }

.topbar {
  background: var(--c-primary);
  color: var(--c-on-primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-logout {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: var(--c-on-primary);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.15); }

.user-id { font-size: 16px; font-weight: 600; padding: 4px 0; }

.im-status { color: #888; font-size: 13px; }
.im-status.ok { color: var(--c-primary); }

.todo-title { font-weight: 600; margin-bottom: 6px; }
.todo-text { font-size: 13px; color: #666; }

/* ---- P1:会话列表 ---- */
/* 页宽统一 420px 居中(与主框架 .home 一致;群申请/邀请等二级页同宽) */
.conv-page {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
}

.empty {
  padding: 24px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.topbar {
  background: var(--c-primary);
  color: var(--c-on-primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.conn {
  font-size: 12px;
  font-weight: 400;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 2px 10px;
}
.conn.ok { background: rgba(255, 255, 255, 0.35); }

.btn-mini {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: transparent;
  color: var(--c-on-primary);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
}
.btn-mini:hover { background: rgba(255, 255, 255, 0.15); }

.conv-item {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--c-bubble-other);
  border: none;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.conv-item:hover { background: var(--c-surface-low); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--c-primary);
  color: var(--c-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.avatar.group { background: #3A7AF3; }
/* 头像形状区分:单聊圆形、群聊方形(微信式) */
.avatar-img.peer, .avatar.peer { border-radius: 50%; }
.avatar-img.grp, .avatar.grp { border-radius: 8px; }

.conv-mid { flex: 1; min-width: 0; }
/* 会话标题行 + 群聊徽标(区分群聊/单聊) */
.conv-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.conv-title {
  font-size: 15px; font-weight: 600; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-tag {
  flex-shrink: 0; font-size: 10px; font-weight: 500; line-height: 15px;
  color: #3A7AF3; border: 1px solid rgba(58, 122, 243, 0.5);
  border-radius: 3px; padding: 0 4px;
}
.conv-preview {
  font-size: 13px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.conv-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.conv-time { font-size: 11px; color: #bbb; }
.badge {
  background: #FA5151;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---- P1:聊天页 ---- */
.chat-page {
  height: 100vh;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.chat-topbar {
  background: #fff;
  border-bottom: 1px solid #ECECEC;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.chat-topbar .btn-mini { color: #666; border-color: var(--c-surface-high); flex-shrink: 0; white-space: nowrap; }
.chat-topbar .btn-mini:hover { background: var(--c-surface-high); }
.chat-title { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; }
.row .field { flex: 1; min-width: 0; }

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-row { display: flex; flex-direction: column; max-width: 75%; }
.msg-row.mine { align-self: flex-end; align-items: flex-end; }
.msg-row.other { align-self: flex-start; align-items: flex-start; }

.msg-sender { font-size: 11px; color: #999; margin-bottom: 2px; }

.bubble {
  padding: 8px 12px;
  font-size: 15px;
  border-radius: var(--radius);
  word-break: break-word;
  white-space: pre-wrap;
}
.bubble.mine { background: var(--c-primary); color: var(--c-on-primary); }
.bubble.other { background: var(--c-bubble-other); border: 1px solid var(--c-surface-high); }

.msg-time { font-size: 10px; color: #bbb; margin-top: 2px; }

.chat-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--c-surface-low);
  border-top: 1px solid var(--c-surface-high);
}
.chat-input {
  flex: 1;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--c-surface-high);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
}
.chat-input:focus { border-color: var(--c-primary); }
.btn-send {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-size: 14px;
  cursor: pointer;
}
.btn-send:disabled { opacity: 0.6; cursor: default; }

/* ---- P2:引用/撤回/阅后即焚 ---- */
.chat-bottom { display: flex; flex-direction: column; }

.refer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--c-surface-low);
  border-left: 3px solid var(--c-primary);
  padding: 6px 12px;
  font-size: 12px;
  color: #666;
}
.refer-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.refer-close {
  border: none; background: transparent; color: #999;
  font-size: 14px; cursor: pointer; padding: 0 4px;
}

.burn-tip {
  background: #FFF7E6;
  color: #C87D19;
  font-size: 12px;
  padding: 4px 12px;
}

.btn-burn {
  width: 38px; height: 38px;
  border: 1px solid var(--c-surface-high);
  border-radius: 8px; background: #fff;
  font-size: 16px; cursor: pointer;
}

.msg-action { color: #7aa7ff; cursor: pointer; margin-left: 6px; font-size: 10px; }
.msg-action:hover { text-decoration: underline; }

.msg-image {
  max-width: 240px;
  max-height: 240px;
  border-radius: var(--radius);
  display: block;
  cursor: zoom-in;
}

.file-bubble {
  display: inline-block;
  text-decoration: none;
}

/* ---- P2+:主框架 / Tab / 通讯录 / 我的 ---- */
/* 锁死为一屏高(100dvh 兼容移动端地址栏伸缩),滚动只发生在 .home-body,
   tabbar 永远钉在视口底部。此前用 min-height,内容一多就把 tabbar 顶出视口。 */
.home {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 420px;
  margin: 0 auto; /* 主框架整体居中(此前缺失,整个 app 钉在左侧) */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-body { flex: 1; min-height: 0; overflow-y: auto; }

.tabbar {
  display: flex;
  border-top: 1px solid var(--c-surface-high);
  background: var(--c-surface-low);
}
.tab {
  flex: 1;
  height: 52px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #888;
  cursor: pointer;
  font-family: inherit;
}
.tab-active { color: var(--c-primary); font-weight: 600; }

.section {
  background: var(--c-bubble-other);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* 区块内按钮一律整行,杜绝挤在一行重叠 */
.section .btn-login { width: 100%; margin-top: 0; }
.section-title { font-size: 13px; color: #888; padding: 4px 2px 8px; }
.hint { font-size: 13px; color: #bbb; padding: 6px 2px; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row .conv-item { flex: 1; }
.row-actions { display: flex; gap: 8px; }

.btn-mini.dark { color: var(--c-primary); border-color: var(--c-primary); background: #fff; }
.btn-pick {
  width: 40px; height: 40px;
  border: 1px solid var(--c-surface-high);
  border-radius: 8px; background: #fff; cursor: pointer;
}

.my-avatar { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.my-avatar-text {
  width: 48px; height: 48px; border-radius: 8px;
  background: var(--c-primary); color: var(--c-on-primary);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}

.btn-logout-full {
  width: 100%; height: 42px;
  border: none; border-radius: 8px;
  background: #FA5151; color: #fff; font-size: 15px; cursor: pointer;
}

/* ---- 会话操作菜单 / 更多 ---- */
.conv-item-wrap {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--c-bubble-other);
  border: none;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-bottom: 2px;
}
.conv-item-wrap.open { background: var(--c-surface-low); }

.conv-row { display: flex; gap: 12px; align-items: center; width: 100%; }

.btn-more {
  border: none; background: transparent; color: #bbb;
  font-size: 16px; cursor: pointer; padding: 0 4px;
}

.menu {
  margin-top: 8px;
  border-top: 1px solid var(--c-surface-high);
  display: flex;
  flex-direction: column;
}
.menu-item {
  border: none; background: transparent; text-align: left;
  padding: 10px 2px; font-size: 14px; cursor: pointer; color: var(--c-text-main);
  font-family: inherit;
}
.menu-item:hover { background: var(--c-surface-low); }
.menu-item.danger { color: #FA5151; }

/* ---- 表情面板 ---- */
.emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--c-surface-high);
  background: var(--c-surface-low);
}
.emoji-item {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
}
.emoji-item:hover { background: var(--c-surface-high); border-radius: 6px; }

.msg-read { color: var(--c-primary); font-size: 10px; margin-left: 6px; }

.msg-video {
  max-width: 280px;
  border-radius: var(--radius);
  display: block;
}

.qr-img { width: 200px; height: 200px; display: block; margin: 8px auto; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.media-thumb {
  width: 100%; aspect-ratio: 1;
  object-fit: cover; border-radius: 8px; display: block;
  cursor: zoom-in;
}

/* ---- 通话(限制在聊天容器宽度内,不再占满全屏) ---- */
.call-page {
  position: fixed;
  top: 0; bottom: 0; left: 0; right: 0;
  margin: 0 auto;
  max-width: 420px;
  background: #1c1c1e; color: #fff;
  display: flex; flex-direction: column;
  z-index: 50;
}
.call-header { padding: 24px 16px; text-align: center; }
.call-title { font-size: 20px; font-weight: 600; }
.call-peer { font-size: 15px; color: #d0d0d0; margin-top: 4px; }
.call-status { font-size: 13px; color: #9a9a9a; margin-top: 6px; }

.call-body { flex: 1; position: relative; }
.video-wrap { position: relative; width: 100%; height: 100%; }
.video-remote { width: 100%; height: 100%; object-fit: cover; background: #000; }
.video-local {
  position: absolute; right: 12px; bottom: 12px;
  width: 120px; height: 160px; object-fit: cover;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.3);
}

.voice-wrap {
  height: 100%; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}
.voice-icon { font-size: 64px; }

.call-actions {
  display: flex; gap: 16px; justify-content: center;
  padding: 20px 16px 32px;
}
.btn-accept, .btn-reject, .btn-hangup {
  min-width: 96px; height: 44px; border: none; border-radius: 22px;
  font-size: 15px; color: #fff; cursor: pointer; font-family: inherit;
}
.btn-accept { background: #07C160; }
.btn-reject { background: #8A8A8E; }
.btn-hangup { background: #FA5151; }

/* ---- 头像 / 合并消息 ---- */
.avatar-img {
  width: 44px; height: 44px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}

.msg-avatar-img {
  width: 38px; height: 38px; border-radius: 6px;
  object-fit: cover; flex-shrink: 0;
}
.msg-avatar {
  width: 38px; height: 38px; border-radius: 6px;
  background: var(--c-primary); color: var(--c-on-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.msg-row .msg-main { display: flex; flex-direction: column; max-width: 72%; }

.merge-card { cursor: pointer; min-width: 200px; }
.merge-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.merge-preview {
  font-size: 13px; color: #666;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}
.merge-more { font-size: 12px; color: #999; margin-top: 4px; }

.merge-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
}
.merge-overlay {
  width: min(92vw, 560px); height: 80vh;
  background: var(--c-page-bg); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.merge-overlay .msg-list { flex: 1; overflow-y: auto; }

/* ---- V3 集成宿主(此前缺失:导致聊天 Tab 容器塌陷/工具栏无样式) ---- */
.chat-advanced-wrap {
  display: flex;
  flex-direction: column;
  /* .home 已锁死一屏高,这里直接撑满 .home-body 即可 */
  height: 100%;
}

.chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--c-bubble-other);
  border-bottom: 1px solid var(--c-surface-high);
}

.advanced-chat-host {
  flex: 1;
  min-height: 0; /* flex 子项默认 min-height:auto 会撑破容器,必须归零 */
}

/* ---- 全屏聊天视图(打开会话时,无 Tab 栏) ---- */
.chat-view {
  position: relative; /* 顶栏按钮组的定位基准 */
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--c-page-bg);
}
/* 聊天头保持 V3 原生布局(头像+名称靠左,不做居中改写 —— 居中尝试曾导致
   头像消失,已全部退回)。"返回"按钮绝对定位在头部行右侧。 */
.chat-view-topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: auto;
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  z-index: 20;
}
.chat-view-topbar .btn-mini {
  color: #666;
  border-color: var(--c-surface-high);
  background: #fff;
  flex-shrink: 0;
  white-space: nowrap;
}
.chat-view .advanced-chat-host { flex: 1; min-height: 0; }
/* 会话 Tab 里 V3 直接挂在 home-body 下,需要显式高度 */
.home-body > .advanced-chat-host { height: 100%; }

/* 隐藏 V3 自带 composer(根节点 .acc-box-footer,内含 textarea + emoji/paperclip/发送),
   改用自建 Android 式输入区(ChatComposer),避免"功能重复的附件图标"。
   注意:advanced-chat-cn 是 createElement 出来的【标签名】而非 class,
   必须用标签选择器;类选择器 ".advanced-chat-cn" 永远匹配不上。 */
advanced-chat-cn .acc-box-footer { display: none !important; }
/* acc-box-footer 的外层包裹(id=room-footer):白底+上下 padding+顶部分隔线,
   只藏内层会留下一条空白条横在消息区与自建输入区之间,必须一并隐藏 */
advanced-chat-cn .acc-room-footer { display: none !important; }

/* ---- 会话页一体化(消除割裂感) ----
   V3 根节点 .acc-card-window 默认是"浮动卡片"风:圆角+阴影+边框,
   与下方自建输入区拼在一起会出现"上圆角白卡+下灰条"的割裂。
   对齐 Android/微信:顶栏白、消息区与输入区同一灰底连成一体。 */
.chat-view { background: #F5F5F5; }
.chat-view advanced-chat-cn .acc-card-window {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* ================================================================
   自建会话输入区(对齐 Android:语音/键盘 · 输入框 · 发送 · 表情 · ＋)
   ================================================================ */
.chat-composer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #F5F5F5; /* 与 V3 消息区 --chat-content-bg-color 一致,连成一体 */
  border-top: 1px solid #E5E5E5;
}
.chat-composer-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.composer-input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: none;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 15px;
  line-height: 1.3;
  background: #fff;
  max-height: 100px;
  font-family: inherit;
  outline: none;
}
.composer-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #444;
}
.composer-btn.active { color: #07C160; }
.composer-send { color: #07C160; }
.composer-hold {
  flex: 1;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  font-size: 15px;
  color: #333;
  font-family: inherit;
  cursor: pointer;
}
.composer-hold.rec { background: rgba(7,193,96,0.10); border-color: #07C160; color: #07C160; }

.emoji-panel, .attach-panel {
  background: #F5F5F5;
  border-top: 1px solid #E5E5E5;
}
.emoji-panel-head { display: flex; justify-content: flex-end; padding: 4px 10px; }
.emoji-done {
  border: none; background: transparent; color: #07C160;
  font-size: 14px; cursor: pointer;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}
.emoji-cell {
  border: none; background: transparent; font-size: 22px;
  padding: 6px 0; cursor: pointer;
}
.emoji-cell:hover { background: #fff; }

.attach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 6px;
  padding: 16px 12px 20px;
}
.attach-item {
  border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer; font-family: inherit; padding: 6px 0;
}
.attach-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: #EDEDED; display: flex; align-items: center; justify-content: center;
  font-size: 24px; transition: background 0.15s;
}
.attach-item:hover .attach-icon { background: #e0e0e0; }
.attach-label { font-size: 12px; color: #666; }


/* ================================================================
   Android 端对齐重构(白底顶栏 / 分组 cell / 四 Tab / V3 微信绿)
   ================================================================ */

/* ---- 顶栏:白底大标题(Android 风) ---- */
.topbar {
  background: #fff;
  color: var(--c-text-main);
  border-radius: 0;
  border-bottom: 1px solid #ECECEC;
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 700;
}
.topbar .btn-mini { color: #666; border-color: var(--c-surface-high); }
.topbar .conn { background: rgba(7, 193, 96, 0.12); color: var(--c-primary); }

/* ---- 底部四 Tab:图标 + 文字,选中绿色 ---- */
.tabbar {
  height: 56px;
  border-top: 1px solid #ECECEC;
  background: #fff;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 56px;
  font-size: 11px;
  color: #9A9A9A;
  font-family: inherit;
}
.tab .tab-ico { width: 24px; height: 24px; display: block; }
.tab-active { color: var(--c-primary); font-weight: 600; }

/* ---- 分组 cell 列表(Android 式) ---- */
.group-label {
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 14px 4px 6px;
}
.cell-group { background: #fff; border-radius: var(--radius); overflow: hidden; }
.cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.cell + .cell { border-top: 1px solid #F2F2F2; }
.cell-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  color: #fff;
}
.cell-body { flex: 1; min-width: 0; }
.cell-title { font-size: 15px; font-weight: 600; }
/* 无副标题的 cell:标题直接是 .cell 的子节点,让它撑满一行 → 箭头靠最右 */
.cell > .cell-title { flex: 1; min-width: 0; }
.cell-sub {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-trail { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chev { color: #C8C8C8; font-size: 18px; line-height: 1; }
.badge-mini {
  background: #FA5151;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.cell-expand {
  padding: 10px 12px;
  border-top: 1px solid #F2F2F2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #FAFAFA;
}
.apply-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cell.danger { justify-content: center; }
.cell.danger > .cell-title { flex: 0 0 auto; color: #FA5151; font-weight: 600; }

/* ---- 资料页:图标行 / tonal 按钮 / 阅后即焚选项 ---- */
.cell-icon {
  flex: 0 0 26px; width: 26px; margin-right: 10px;
  text-align: center; font-size: 18px; line-height: 1;
}
.tonal-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px; border: none; border-radius: var(--radius);
  background: #E8F8EF; color: #FA5151; font-size: 15px; font-weight: 600; cursor: pointer;
}
.tonal-btn:hover { background: #D9F4E4; }
.tonal-btn .cell-icon { margin-right: 0; }
.burn-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.burn-opt-on {
  background: var(--c-primary) !important; color: #fff !important;
  border-color: var(--c-primary) !important;
}

/* ---- 自建图片查看器(V3 内置灯箱无缩放,点图改弹此查看器) ---- */
.iv-mask {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; overflow: hidden;
}
.iv-stage {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: grab;
}
.iv-stage:active { cursor: grabbing; }
.iv-img {
  max-width: 92vw; max-height: 86vh;
  user-select: none; -webkit-user-drag: none;
  will-change: transform;
}
.iv-bar {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; gap: 12px; z-index: 100001;
}
.iv-btn {
  min-width: 42px; height: 42px; padding: 0 10px;
  border: none; border-radius: 21px;
  background: rgba(255, 255, 255, 0.16); color: #fff;
  font-size: 16px; cursor: pointer;
}
.iv-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* ---- 转发目标选择器浮层 / 轻提示 ---- */
.forward-panel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}
.forward-preview {
  background: var(--c-surface-low);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 80;
  white-space: nowrap;
}

/* ---- 长按动作浮层(零按钮方案 B 的自有 UI) ---- */
advanced-chat-cn { -webkit-user-select: none; user-select: none; }
.v3-lp-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.v3-lp-sheet {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 12px 12px 0 0; overflow: hidden;
}
.v3-lp-action {
  display: block; width: 100%; border: 0; background: #fff;
  padding: 15px 0; font-size: 16px; color: #101010; cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.v3-lp-action:active { background: #f5f5f5; }
.v3-lp-cancel {
  color: #FA5151; font-weight: 600;
  border-top: 8px solid #f0f0f0; border-bottom: 0;
}

/* ---- "+"面板(对齐 Android 输入框右侧 ⊕) ---- */
.plus-btn {
  position: absolute;
  right: 12px;
  bottom: 78px; /* 输入区(约 62px)上方 */
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: var(--c-primary);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 25;
}
.plus-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #ECECEC;
  border-radius: 12px 12px 0 0;
  padding: 18px 12px 22px;
  z-index: 30;
}
.plus-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 6px;
}
.plus-item {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0;
}
.plus-item:hover .plus-icon { background: var(--c-surface-high); }
.plus-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--c-surface-low);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: background 0.15s;
}
.plus-label { font-size: 12px; color: #666; }
.hidden-input { display: none; }

/* ---- 审批页 Tab 条(对齐 Android TabBar:选中绿色下划线) ---- */
.tabstrip {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #ECECEC;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.tabstrip button {
  flex: 1;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2px solid transparent;
}
.tabstrip button.on {
  color: var(--c-primary);
  font-weight: 600;
  border-bottom-color: var(--c-primary);
}
.req-body { display: flex; flex-direction: column; gap: 12px; }

/* ---- 表单元素在 cell 内占满 ---- */
.cell-expand .field { width: 100%; }
.cell-expand .btn-send { width: 100%; }
.tip {
  background: #E8F8EF;
  color: var(--c-primary);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ---- 我的页:绿色资料头 ---- */
.profile-header {
  background: var(--c-primary);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}
.profile-header .ph-name { font-size: 19px; font-weight: 700; }
.profile-header .ph-sub { font-size: 12px; opacity: 0.85; margin-top: 4px; }
.profile-header .my-avatar,
.profile-header .my-avatar-text {
  width: 54px;
  height: 54px;
  background: rgba(255, 255, 255, 0.25);
}

/* ---- V3 主题覆盖:默认紫 → 微信绿 ----
   light DOM,CSS 变量经标签选择器继承进组件内部;!important 压过默认值。 */
advanced-chat-cn {
  --chat-color: #07C160 !important;
  --chat-icon-color-add: #07C160 !important;
  --chat-bg-color-button: #07C160 !important;
  --chat-content-bg-color: #F5F5F5 !important;
  --chat-header-bg-color: #FFFFFF !important;
  --chat-footer-bg-color: #FFFFFF !important;
  --chat-bg-color-input: #FFFFFF !important;
  --chat-dropdown-bg-color: #FFFFFF !important;
  --chat-dropdown-bg-color-hover: #F5F5F5 !important;
  --chat-border-style: 1px solid #EAEAEA !important;
  --chat-color-placeholder: #B0B0B0 !important;
  --chat-message-bg-color-me: #95EC69 !important;
}
