/* =============================================================
   轻聊 · 微信风设计系统（wechat.css v1.0）
   -------------------------------------------------------------
   这一层不只换色，是重做骨架：
   · 四页签：消息 / 通讯录 / 发现 / 我
   · 导航：居中标题 + 右侧圆形「＋」，搜索栏独立成条
   · 会话行：头像 + 双行文本 + 右侧「时间 / 未读」独立列
   · 通讯录：入口行（发起群聊）+ 分组标题 + 好友行
   · 发现：彩色图标磁贴 + 设置项
   · 我：右置头像资料块 + 分组设置
   加载顺序：style.css（旧布局兜底）→ wechat.css → wechat-chat.css
   ============================================================= */

/* ===================== 1. 设计 token ===================== */
:root {
  /* 品牌 */
  --qq: #07c160;
  --qq-deep: #06ad56;
  --qq-soft: rgba(7, 193, 96, 0.12);

  /* 气泡 */
  --bubble-me: #95ec69;
  --bubble-me-ink: #111111;
  --bubble-peer: #ffffff;

  /* 底色层次：页 < 列表 < 卡片 */
  --page-bg: #ededed;
  --list-bg: #ffffff;
  --chat-bg: #ededed;
  --chat-bg-mesh: none;
  --bar-bg: #ededed;
  --tab-bg: #f7f7f7;
  --composer-bg: #f7f7f7;
  --field-bg: #ffffff;
  --chip: rgba(0, 0, 0, 0.05);

  /* 文本与线 */
  --ink: #191919;
  --ink-2: #576b95;
  --muted: #999999;
  --muted-2: #b2b2b2;
  --line: rgba(0, 0, 0, 0.1);
  --link: #576b95;
  --danger: #fa5151;
  --wechat-head: #ededed;

  /* 交互 */
  --press: rgba(0, 0, 0, 0.05);
  --press-strong: rgba(0, 0, 0, 0.08);

  /* 形状：微信几乎没有大圆角 */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-bubble: 6px;
  --glass-blur: 0px;
  --shadow-sm: 0 0 0 0 rgba(0, 0, 0, 0);
  --shadow-bubble-me: none;
  --shadow-bubble-peer: none;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
/* ===================== 2. 基底 ===================== */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
html.kb-open,
html.kb-open body {
  background: var(--chat-bg);
}
button,
input,
textarea,
select {
  font-family: inherit;
}
button {
  -webkit-tap-highlight-color: transparent;
}
.app {
  height: 100%;
  min-height: 100dvh;
}
.shell {
  height: 100%;
  max-height: 100%;
  max-width: 1080px;
  margin: 0 auto;
  background: var(--list-bg);
  display: flex;
  position: relative;
  overflow: hidden;
  box-shadow: none;
}
.list-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--list-bg);
}
.chat-pane {
  display: none;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  min-height: 0;
  position: relative;
  background: var(--chat-bg);
}
.app.show-chat .list-pane { display: none; }
.app.show-chat .chat-pane { display: flex; }

/* ===================== 3. 登录 ===================== */
.auth {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 20px calc(24px + var(--safe-b));
  background: var(--page-bg);
}
.qq-titlebar,
.qq-winbtns,
.qq-banner {
  display: none !important;
}
.qq-win {
  width: min(360px, 100%);
  background: var(--list-bg);
  border-radius: 12px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
  padding: 0;
  overflow: hidden;
}
.qq-avatar-wrap {
  margin: 0;
  padding-top: 34px;
}
.qq-avatar {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 18px;
  background: var(--list-bg);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}
.qq-avatar img { border-radius: 18px; }
.qq-body { padding: 14px 26px 24px; }

.ql-brand { text-align: center; margin: 14px 0 24px; }
.ql-brand-name {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.ql-brand-sub {
  margin: 7px 0 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.qq-field { border-bottom: 1px solid var(--line); }
.qq-field input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 14px 2px;
  font-size: 16px;
  color: var(--ink);
}
.qq-field input::placeholder { color: var(--muted-2); }
.qq-field:focus-within { border-bottom-color: var(--qq); }

.qq-login {
  width: 100%;
  height: 46px;
  margin-top: 24px;
  border: 0;
  border-radius: 6px;
  background: var(--qq);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: none;
}
.qq-login:active { background: var(--qq-deep); }
.qq-login:disabled { opacity: 0.55; }
.qq-links {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
}
.qq-link {
  border: 0;
  background: none;
  color: var(--link);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}
.auth .qq-link { color: var(--link); }
#auth-error {
  min-height: 18px;
  display: none;
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
}
.install-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--link);
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
}
.auth .install-btn { border-color: var(--line); color: var(--link); }
.install-btn:active { background: var(--press); }
.download-app-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--link);
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  cursor: pointer;
}
.download-app-btn:active { background: var(--press); }
.download-app-link {
  display: block;
  background: var(--qq);
  color: #fff;
  border-radius: 6px;
  padding: 12px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}
.app-download-actions .qq-link { display: block; text-align: center; margin-top: 12px; }

/* ===================== 4. 导航 + 搜索 ===================== */
.app-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 46px;
  padding: max(6px, var(--safe-t)) 12px 6px;
  background: var(--bar-bg);
  color: var(--ink);
  border-bottom: 0.5px solid var(--line);
  box-sizing: border-box;
}.app-nav__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-nav__actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-nav__btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease;
}
.app-nav__btn svg { width: 22px; height: 22px; display: block; }
.app-nav__btn:active { background: var(--press); }
.app-nav__btn--text {
  width: auto;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 13px;
  background: var(--qq);
  color: #fff;
}
.app-nav__btn--text:active { background: var(--qq-deep); }

/* 搜索条：与导航同色，输入框纯白 */
.search-bar {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  background: var(--bar-bg);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  background: var(--field-bg);
  border-radius: 6px;
}
.search-field__icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--muted-2);
}
.search-field__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--ink);
}
.search-field__input::placeholder { color: var(--muted-2); }
.search-field__input::-webkit-search-cancel-button { display: none; }

/* ===================== 5. 会话 / 好友 行 ===================== */
.panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: var(--list-bg);
}
#panel-chats,
#panel-contacts { background: var(--list-bg); padding: 0; }
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.list-sec {
  padding: 16px 16px 6px;
  background: var(--list-bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.list-hint {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 11px 16px;
  background: var(--list-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.item::after {
  content: "";
  position: absolute;
  left: 76px;
  right: 0;
  bottom: 0;
  height: 0.5px;
  background: var(--line);
  pointer-events: none;
}
.item:last-child::after { display: none; }
.item:active,
.item.active { background: var(--press); }
.item .avatar {
  width: 48px;
  height: 48px;
  border-radius: 5px;
  font-size: 18px;
  font-weight: 400;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: none;
}
.item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.item-top {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  min-width: 0;
}
.item-name {
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.item-time { display: none; }
.item-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.item-preview {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 右侧独立列：时间在上、未读在下 */
.item-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  align-self: flex-start;
  padding-top: 3px;
  min-width: 44px;
}
.item-side .item-time {
  display: block;
  font-size: 12px;
  line-height: 1;
  color: var(--muted-2);
  white-space: nowrap;
}
.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 400;
}
.badge[hidden] { display: none !important; }
.group-tag {
  display: inline-block;
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--qq);
  color: #fff;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.5;
  vertical-align: 1px;
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--qq);
  flex-shrink: 0;
  margin-left: 2px;
}
.tag-online {
  font-size: 11px;
  color: var(--qq);
  flex-shrink: 0;
}
.friend-actions { display: flex; gap: 6px; flex-shrink: 0; }
.friend-actions button {
  border: 0;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.friend-accept { background: var(--qq); color: #fff; }
.friend-reject,
.friend-cancel { background: var(--chip); color: var(--ink); }

/* ===================== 6. 页签 ===================== */
.tabbar {
  flex-shrink: 0;
  display: flex;
  margin: 0;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom, 0px));
  background: var(--tab-bg);
  border-top: 0.5px solid var(--line);
  box-shadow: none;
  z-index: 5;
  position: relative;
}.tab {
  position: relative;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 3px 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  line-height: 1.2;
  color: #7f7f7f;
  cursor: pointer;
}.tab.active { color: var(--qq); font-weight: 500; }
.tab-ico,
.tab-ico svg { width: 25px; height: 25px; display: block; }
.tab .tab-label { letter-spacing: 0.02em; }
.tab-badge {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.tab-badge[hidden] { display: none !important; }

/* ===================== 7. 通用行部件（通讯录 / 发现 / 我 / 子页） ===================== */
.cell-group { background: var(--list-bg); }
.cell-group + .cell-group { margin-top: 8px; }
.cell-cap {
  padding: 18px 16px 7px;
  font-size: 13px;
  color: var(--muted);
  background: var(--page-bg);
}
.cell {
  position: relative;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  background: var(--list-bg);
  color: var(--ink);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.cell::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 0;
  bottom: 0;
  height: 0.5px;
  background: var(--line);
  pointer-events: none;
}
.cell:last-child::after { display: none; }
.cell:active { background: var(--press); }
.cell--icon { padding-left: 16px; }
.cell--icon::after { left: 62px; }
.cell__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--qq);
}
.cell__icon svg { width: 19px; height: 19px; display: block; }
.cell__icon--gray { background: #7f8c9b; }
.cell__icon--blue { background: #4a90e2; }
.cell__icon--orange { background: #f2a23a; }
.cell__icon--purple { background: #8e7bd6; }
.cell__icon--red { background: #e05a5a; }
.cell__title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell__value {
  flex-shrink: 0;
  font-size: 15px;
  color: var(--muted);
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell__arrow {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-top: 1.5px solid #c8c8c8;
  border-right: 1.5px solid #c8c8c8;
  transform: rotate(45deg);
}.cell--danger { justify-content: center; color: var(--danger); }
.panel-me .cell--danger { margin-top: 8px; }
.cell--danger::after { display: none; }
.cell--danger .cell__title { flex: 0 0 auto; color: var(--danger); }
.cell-hint {
  margin: 0;
  padding: 8px 16px 14px;
  background: var(--list-bg);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* 开关 */
.switch {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  margin: 0;
  border: 0;
  border-radius: 14px;
  background: #e5e5e5;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}
.switch:checked { background: var(--qq); }
.switch:checked::after { transform: translateX(20px); }

/* 「我」「发现」宽页：隐藏搜索栏与右上角「＋」 */
.list-pane.nav-me .search-bar { display: none !important; }
.list-pane.nav-me .app-nav__actions { display: none !important; }

/* ===================== 8. 通讯录 ===================== */
.contact-entries {
  background: var(--list-bg);
}
.contact-entries .cell:first-child::before {
  content: "";
}
#contact-list .item .item-preview { color: var(--muted); }

/* ===================== 9. 发现 ===================== */
.panel-discover,
#panel-discover { background: var(--page-bg); padding: 0; }
#panel-discover .cell-group { margin: 8px 0 0; }
#panel-discover .cell-group:first-child { margin-top: 8px; }

/* ===================== 10. 我 ===================== */
.panel-me {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--page-bg);
  padding: max(8px, env(safe-area-inset-top, 0px)) 0 20px;
}
.me-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 24px 16px;
  background: var(--list-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
}
.me-card-info {
  flex: 1;
  min-width: 0;
  padding-left: 2px;
}
.me-page-avatar {
  order: 2;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 8px !important;
  font-size: 24px;
  font-weight: 400;
}
.me-card__arrow {
  order: 3;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-top: 1.5px solid #c8c8c8;
  border-right: 1.5px solid #c8c8c8;
  transform: rotate(45deg);
}.me-page-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-page-user {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.me-page-uid-row {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.me-page-uid-row code {
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}
.me-page-uid-row .linkish { margin-left: auto; }
.me-menu-group {
  margin: 8px 0 0;
}
.me-version {
  margin: 22px 4px 6px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-2);
}
.linkish {
  border: 0;
  background: none;
  color: var(--link);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
}
.me-select {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  outline: none;
  cursor: pointer;
  text-align: right;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  max-width: 140px;
}
.me-select option { color: #111; background: #fff; }