/* =============================================================
   轻聊 · 微信风设计系统 第二部分（wechat-chat.css v1.0）
   聊天页 / 输入区 / 弹窗 / 子页 / 空状态 / 桌面布局
   ============================================================= */

/* ===================== 1. 聊天页顶栏 ===================== */
.chat-head {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: max(6px, var(--safe-t)) 8px 6px;
  background: var(--bar-bg);
  color: var(--ink);
  border-bottom: 0.5px solid var(--line);
  box-sizing: border-box;
}.chat-head__icon-btn,
.back {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 0;
  line-height: 1;
}
.chat-head__icon-btn svg,
.back svg { width: 26px; height: 26px; display: block; }
.chat-head__icon-btn:active,
.back:active { background: var(--press); }
.chat-head__back {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.chat-head__back:active { background: transparent; opacity: 0.5; }
.chat-head-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-align: center;
  padding: 0 92px 0 46px;
  box-sizing: border-box;
  cursor: pointer;
}
.peer-name {
  max-width: 100%;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.peer-status {
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  text-align: center;
}
.peer-status.peer-typing { color: var(--qq); }
.chat-head__actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}
.ttl-head {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background: var(--chip);
  border: 0;
  border-radius: 12px;
  font-size: 12px;
  color: var(--muted);
}
.ttl-head label {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  white-space: nowrap;
}
.ttl-head select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  padding: 0;
  max-width: 66px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* ===================== 2. 消息流 ===================== */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px 18px;
  background: transparent;
}
.row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  animation: ql-fade 0.16s ease;
}
.row.mine { flex-direction: row-reverse; }
.row .avatar {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  font-size: 15px;
  font-weight: 400;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: none;
}
.msg-body {
  display: flex;
  flex-direction: column;
  max-width: min(70%, 440px);
  min-width: 0;
}
.row.mine .msg-body { align-items: flex-end; }
.row.peer .msg-body { align-items: flex-start; }
.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  align-items: stretch;
}
.row.mine .msg-bubble-wrap { align-items: flex-end; }
.row.peer .msg-bubble-wrap { align-items: flex-start; }
.bubble-name {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 4px;
}
.row.mine .bubble-name { display: none; }

.bubble {
  position: relative;
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  box-shadow: none;
}
.row.mine .bubble {
  background: var(--bubble-me);
  color: var(--bubble-me-ink);
  border: 0;
  box-shadow: none;
}
.row.peer .bubble {
  background: var(--bubble-peer);
  border: 0;
  box-shadow: none;
  color: var(--ink);
}
/* 气泡尖角 */
.row:not(.system-row) .bubble::after {
  content: "";
  position: absolute;
  top: 13px;
  width: 0;
  height: 0;
  border: 6px solid transparent;
}
.row.mine .bubble::after {
  right: -6px;
  border-right: 0;
  border-left-color: var(--bubble-me);
}
.row.peer .bubble::after {
  left: -6px;
  border-left: 0;
  border-right-color: var(--bubble-peer);
}
.bubble.media::after { display: none; }
.row.pending .bubble { opacity: 0.55; }
.row.pending-failed .bubble { outline: 1px solid var(--danger); }

.bubble-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  flex-wrap: wrap;
}
.row.mine .bubble-meta { justify-content: flex-end; }
.bubble-meta:empty { display: none; }
.msg-ttl-status {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.2;
  color: #e08a2e;
  font-variant-numeric: tabular-nums;
}
.row.mine .msg-ttl-status { text-align: right; }
.msg-ttl-status .ttl-tag { color: inherit; }
.msg-ttl-status .ttl-tag.waiting { color: var(--muted); }
.msg-read-status {
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: transparent !important;
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
}
.row.mine .msg-read-status { text-align: right; }
.msg-read-status--unread { color: var(--muted); }
.ttl-tag { color: #e08a2e; font-variant-numeric: tabular-nums; }
.ttl-tag.waiting { color: var(--muted); }

.row.system-row {
  justify-content: center;
  margin-bottom: 12px;
}
.system-tip {
  max-width: 80%;
  padding: 2px 10px;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.msg-time-sep {
  display: block;
  margin: 10px 0 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.4;
  user-select: none;
}

/* 引用块 */
.quote-bubble-simple {
  display: block;
  max-width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.quote-bubble-simple--in { background: rgba(0, 0, 0, 0.06); color: #6b6b6b; }
.quote-bubble-simple--out { background: rgba(0, 0, 0, 0.08); color: #2f5b23; }.quote-sender { font-weight: 500; margin-right: 6px; color: var(--qq-deep); }
.row.mine .quote-sender { color: #2f6b23; }.row.quote-flash .bubble { outline: 2px solid var(--qq); outline-offset: 1px; }

/* 图片 / 视频 / 文件 */
.bubble.media {
  padding: 0;
  background: transparent !important;
  box-shadow: none;
  overflow: hidden;
  border-radius: 6px;
}
.bubble img.chat-img,
.bubble video.chat-vid {
  display: block;
  max-width: 100%;
  border-radius: 6px;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  max-width: 250px;
  padding: 10px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
  text-decoration: none;
}
.row.peer .file-card { background: var(--list-bg); }.file-ico {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 4px;
  background: var(--list-bg);
  color: var(--qq);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.file-name {
  font-size: 14px;
  font-weight: 400;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.file-size { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 长按菜单 */
.msg-menu {
  position: fixed;
  z-index: 70;
  display: flex;
  min-width: 168px;
  background: var(--list-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.16);
}
.msg-menu[hidden] { display: none !important; }
.msg-menu button {
  flex: 1;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}
.msg-menu button:active { background: var(--press); }
.msg-menu button[hidden] { display: none !important; }
.msg-menu button + button { border-left: 1px solid var(--line); }

/* ===================== 3. 输入区 ===================== */
.composer {
  flex-shrink: 0;
  position: relative;
  z-index: 4;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  background: var(--composer-bg);
  border-top: 0.5px solid var(--line);
  box-shadow: none;
}html.kb-open .composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--composer-bottom, 0px);
  z-index: 100;
  padding-bottom: 8px;
  background: var(--composer-bg);
  border-top: 0.5px solid var(--line);
}
html.kb-open #messages { padding-bottom: calc(70px + var(--composer-bottom, 0px)); }
.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 52px;
  padding: 8px 10px;
  box-sizing: border-box;
}
.input-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  outline: none;
  resize: none;
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  box-shadow: none;
}
.input-row textarea::placeholder { color: var(--muted-2); }
.input-row textarea:focus { border-color: transparent; box-shadow: none; }
html.kb-open .input-row textarea {
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
}
.tool {
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.tool-ico { display: block; color: currentColor; }
.tool:active { background: var(--press); }
.tool.active { background: transparent; color: var(--qq); box-shadow: none; }
.send-btn {
  flex-shrink: 0;
  height: 34px;
  min-width: 56px;
  margin-bottom: 1px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: var(--qq);
  color: #fff;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  cursor: pointer;
}
.send-btn:active { background: var(--qq-deep); opacity: 1; }
.send-btn[hidden] { display: none !important; }
.send-err {
  display: none;
  margin: 0;
  padding: 0 12px 8px;
  text-align: right;
  font-size: 12px;
}

/* 回复条 */
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 10px 0;
  padding: 8px 10px;
  background: var(--field-bg);
  border: 0;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: none;
}
.reply-bar[hidden] { display: none !important; }
.reply-bar__label { flex-shrink: 0; color: var(--qq); font-weight: 500; }
.reply-bar__content {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar__cancel {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: var(--chip);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

/* 表情 / 加号面板 */
.plus-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 0;
  padding: 20px 14px 16px;
  background: var(--composer-bg);
  border-top: 1px solid var(--line);
}
.plus-panel[hidden] { display: none !important; }
.plus-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.plus-item .ico {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 12px;
  background: var(--list-bg);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-style: normal;
  box-shadow: none;
  transition: transform 0.12s ease;
}
.plus-item:active .ico { transform: scale(0.94); }

.calc-pad {
  padding: 8px 8px 6px;
  background: var(--composer-bg);
  border-top: 1px solid var(--line);
}
.calc-pad[hidden] { display: none !important; }
.calc-lcd { display: none; }
.calc-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px 4px;
  margin-bottom: 6px;
  max-height: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.calc-grid button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.calc-grid button:active { background: var(--press); }
.calc-grid button.emoji-item { display: grid; place-items: center; padding: 4px; }
.calc-grid button.emoji-item img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
}
.calc-grid .emoji-loading {
  grid-column: 1 / -1;
  padding: 18px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.calc-keys { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; }
.calc-keys button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.key-ac,
.key-del { background: var(--chip); color: var(--ink); }
.key-eq { background: var(--qq); color: #fff; }
.bubble-dy-emoji {
  width: 28px;
  height: 28px;
  margin: 0 1px;
  vertical-align: -6px;
  object-fit: contain;
}

/* ===================== 4. 弹窗 ===================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.5);
}
.modal[hidden] { display: none !important; }
.modal-card {
  display: flex;
  flex-direction: column;
  width: min(400px, 100%);
  max-height: min(85vh, calc(100dvh - 32px));
  background: var(--list-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.modal-head strong { font-size: 17px; font-weight: 600; }
.modal-x {
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-body { flex: 1; padding: 14px 16px; overflow-y: auto; }
.modal-body input[type="text"],
.modal-body input[type="password"],
.modal-body input[type="number"],
.modal-body input[type="tel"],
.modal-body input:not([type]),
.modal-body textarea,
.modal-body select {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  outline: none;
  background: var(--field-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  box-sizing: border-box;
}
.modal-body input::placeholder,
.modal-body textarea::placeholder { color: var(--muted-2); }
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus { border-color: var(--qq); }
.modal-tip { margin: 0 0 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.modal-tip-flush { padding: 0; }
.modal-foot { padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px)); }
.modal-foot .qq-login { margin-top: 0; letter-spacing: 2px; }
.modal-okmsg { margin: 8px 0 0; color: var(--qq); font-size: 13px; }
.members-gid-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.members-gid-row code { font-size: 12px; word-break: break-all; }

.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}
.pick-list li:last-child { border-bottom: 0; }
.pick-list .avatar {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  font-size: 14px;
  box-shadow: none;
}
.pick-list li input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid #c8c8c8;
  border-radius: 50%;
  background: transparent;
  position: relative;
}
.pick-list li input[type="checkbox"]:checked {
  background: var(--qq);
  border-color: var(--qq);
}
.pick-list li input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.members-manage-list li { border-bottom-color: var(--line); }
.members-manage-list .mem-kick {
  padding: 4px 9px;
  border: 0;
  border-radius: 4px;
  background: rgba(250, 81, 81, 0.1);
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
}
.members-manage-list .mem-tag { color: var(--muted); font-size: 12px; }
.members-foot { display: flex; gap: 8px; }
.members-foot .diag-btn { flex: 1; }

/* 使用说明 */
.help-card { width: min(480px, 100%); max-height: 88vh; }
.help-body { font-size: 14px; line-height: 1.6; color: var(--ink); }
.help-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--qq-soft);
  color: var(--qq-deep);
  font-size: 12px;
  font-weight: 500;
}
.help-body h3 { margin: 10px 0 8px; font-size: 16px; color: var(--ink); }
.help-body p { margin: 0 0 12px; color: var(--muted); }
.help-steps { margin: 0 0 16px; padding-left: 18px; color: var(--muted); }
.help-steps li { margin: 0 0 10px; }
.help-steps b { display: block; margin-bottom: 2px; color: var(--ink); font-weight: 500; }
.help-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--chip);
  color: var(--ink);
  font-family: inherit;
}
.help-list { margin: 0; padding-left: 18px; color: var(--muted); }
.help-list li { margin: 0 0 8px; }
.help-note { color: var(--muted); font-size: 13px; }

/* ===================== 5. 子页（伪装设置） ===================== */
.sub-page {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
  color: var(--ink);
}
.sub-page[hidden] { display: none !important; }
.sub-page__header {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 46px;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px;
  background: var(--bar-bg);
  border-bottom: 0.5px solid var(--line);
}
.sub-page__back {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.sub-page__title { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); }
.sub-page__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--page-bg);
}
.sub-page .contact-section {
  background: var(--list-bg);
  border-radius: 0;
  overflow: hidden;
}
.profile-tip {
  margin: 8px 0;
  padding: 10px 16px;
  background: var(--list-bg);
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  border-radius: 0;
}
.profile-tip[hidden] { display: none !important; }

/* 一键回伪装浮窗 */
.cover-shell-fab {
  position: fixed;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--list-bg);
  color: var(--danger);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.cover-shell-fab[hidden] { display: none !important; }
.cover-shell-fab:active { transform: scale(0.95); }
.cover-shell-fab__tip {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(136px + env(safe-area-inset-bottom, 0px));
  z-index: 201;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.cover-shell-fab__tip[hidden] { display: none !important; }
html.disguise-active .cover-shell-fab,
html.disguise-active .cover-shell-fab__tip,
html.decoy-active .cover-shell-fab,
html.decoy-active .cover-shell-fab__tip { display: none !important; }

/* ===================== 6. 空状态 ===================== */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 28px;
  text-align: center;
}
.chat-empty[hidden],
#chat-empty[hidden] { display: none !important; }
.chat-empty__mark {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: var(--list-bg);
  color: #c8c8c8;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 400;
}.chat-empty__title { margin: 6px 0 0; font-size: 15px; color: var(--ink); }
.chat-empty__hint { margin: 0; font-size: 13px; color: var(--muted); }
.empty {
  margin: 0;
  padding: 48px 24px;
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.empty[hidden] { display: none !important; }
#panel-chats > .empty,
#panel-contacts > .empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}
.empty-logo { font-size: 20px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-bottom: 8px; }

/* ===================== 7. 诊断面板 ===================== */
.diag-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
}
.diag-panel[hidden] { display: none !important; }
.diag-card {
  width: min(420px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--list-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
}
.diag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.diag-x { border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.diag-body { flex: 1; padding: 14px 16px; overflow-y: auto; }
.diag-tip { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.diag-list { font-size: 13px; color: var(--ink); }
.diag-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.diag-row:last-child { border-bottom: 0; }
.diag-name { font-weight: 500; }
.diag-detail { margin-top: 2px; font-size: 12px; color: var(--muted); word-break: break-all; }
.diag-tag { flex-shrink: 0; height: 20px; padding: 0 7px; border-radius: 3px; font-size: 11px; line-height: 20px; }
.diag-tag.ok { background: var(--qq-soft); color: var(--qq-deep); }
.diag-tag.warn { background: rgba(242, 162, 58, 0.16); color: #c47c14; }
.diag-tag.bad { background: rgba(250, 81, 81, 0.12); color: var(--danger); }
.diag-foot { display: flex; gap: 8px; padding: 12px 16px max(16px, env(safe-area-inset-bottom, 0px)); }
.diag-btn {
  flex: 1;
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--qq);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.diag-btn.sec { background: var(--chip); color: var(--ink); }

/* ===================== 8. 桌面：双栏卡片 ===================== */
@media (min-width: 860px) and (hover: hover) and (pointer: fine) {
  body {
    padding: 20px;
    background: #e3e4e6;
  }  .app:not([hidden]) { display: block; height: 100%; }
  .shell {
    max-width: 1080px;
    height: calc(100dvh - 40px);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }  .list-pane {
    width: 320px;
    flex: 0 0 320px;
    border-right: 1px solid var(--line);
    display: flex !important;
  }
  .chat-pane { display: flex !important; }
  .app.show-chat .list-pane { display: flex !important; }
  .back,
  .chat-head__back { display: none; }
  .chat-head-info {
    align-items: flex-start;
    padding: 0 110px 0 18px;
    text-align: left;
  }
  .peer-name,
  .peer-status { text-align: left; }
  .chat-head__actions { right: 12px; }
  .messages { padding: 16px 20px 18px; }
  .item:hover { background: var(--press); }
  .cell:hover { background: var(--press); }
  .modal { background: rgba(0, 0, 0, 0.35); }
}

/* PWA / 原生壳：宽屏也保持单栏铺满 */
@media (min-width: 860px) and (hover: hover) and (pointer: fine) {
  html.standalone body,
  html.native-shell body { padding: 0 !important; background: var(--page-bg) !important; }
  html.standalone .shell,
  html.native-shell .shell {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  html.standalone .list-pane,
  html.native-shell .list-pane {
    width: 100% !important;
    flex: 1 1 0 !important;
    border-right: 0 !important;
  }
  html.standalone .chat-pane,
  html.native-shell .chat-pane { display: none !important; }
  html.standalone .app.show-chat .list-pane,
  html.native-shell .app.show-chat .list-pane { display: none !important; }
  html.standalone .app.show-chat .chat-pane,
  html.native-shell .app.show-chat .chat-pane { display: flex !important; }
  html.standalone .back,
  html.native-shell .back { display: inline-flex !important; }
}

/* 「我」「发现」整页：桌面收成同一张卡片，内容 600px 居中 */
@media (min-width: 860px) and (hover: hover) and (pointer: fine) {
  html.nav-me:not(.standalone):not(.native-shell) body { background: #e3e4e6 !important; }  html.nav-me:not(.standalone):not(.native-shell) .shell {
    width: 100% !important;
    max-width: 1080px !important;
    margin: 0 auto !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    overflow: hidden !important;
  }  html.nav-me .list-pane.nav-me {
    width: 100% !important;
    flex: 1 1 0 !important;
    border-right: 0 !important;
  }
  html.nav-me #panel-me,
  html.nav-me #panel-discover {
    padding-left: max(0px, calc(50% - 300px));
    padding-right: max(0px, calc(50% - 300px));
  }
  /* 桌面子页贴合同一张卡片 */
  html:not(.standalone):not(.native-shell) .sub-page {
    inset: 20px auto auto 50%;
    transform: translateX(-50%);
    width: min(1080px, calc(100vw - 40px));
    height: calc(100dvh - 40px);
    max-height: calc(100dvh - 40px);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }
  html:not(.standalone):not(.native-shell) .sub-page__header {
    padding-left: max(8px, calc(50% - 300px));
    padding-right: max(8px, calc(50% - 300px));
  }
  html:not(.standalone):not(.native-shell) .sub-page__body > * {
    margin-left: max(0px, calc(50% - 300px));
    margin-right: max(0px, calc(50% - 300px));
  }
}

/* ===================== 9. 动效 / 无障碍 ===================== */
@keyframes ql-fade {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
:focus-visible { outline: 2px solid var(--qq); outline-offset: 2px; border-radius: 4px; }
button:focus-visible,
.cell:focus-visible,
.tab:focus-visible,
.tool:focus-visible { outline-offset: -2px; }
html.kb-open .composer :focus-visible { outline: none; }

* { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 128, 0.32) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.3); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 128, 0.5); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .row, .modal-card, .qq-win { animation: none; }
  * { transition: none !important; }
}
