/* ============================================================
   仿微信 PC 端博客主题 · 样式表
   配色参照微信 Windows 客户端 3.x 浅色主题
   ============================================================ */

:root {
  --wx-green:        #07c160;
  --wx-green-hover:  #06ad56;
  --wx-rail-bg:      #2e2e2e;
  --wx-rail-icon:    #7f7f7f;
  --wx-list-bg:      #e7e7e7;
  --wx-list-hover:   #dcdcdc;
  --wx-list-active:  #c8c8c8;
  --wx-main-bg:      #f5f5f5;
  --wx-border:       #d9d9d9;
  --wx-border-soft:  #e7e7e7;
  --wx-text:         #191919;
  --wx-text-sub:     #9a9a9a;
  --wx-text-time:    #b2b2b2;
  --wx-link:         #576b95;
  --wx-bubble-me:    #95ec69;
  --wx-bubble-you:   #ffffff;
  --wx-red:          #fa5151;
  --wx-window-w:     1200px;
  --wx-window-h:     760px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--wx-text);
  background: #d6d6d6;
  /* 桌面背景，衬托出窗口 */
  background-image: linear-gradient(135deg, #cfd9df 0%, #e2ebf0 100%);
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ===================== 窗口外壳 ===================== */

.wx-window {
  width: var(--wx-window-w);
  height: var(--wx-window-h);
  max-width: 100vw;
  max-height: 100vh;
  background: var(--wx-main-bg);
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (max-width: 1240px), (max-height: 800px) {
  .wx-window {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}

/* ---------- 标题栏 ---------- */

.wx-titlebar {
  height: 40px;
  flex: 0 0 40px;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  user-select: none;
  position: relative;
  z-index: 20;
}

.wx-titlebar .tb-title {
  font-size: 13px;
  color: #333;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.wx-titlebar .tb-title .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--wx-green);
}

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

.tb-btn {
  width: 34px; height: 28px;
  border: 0; background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.tb-btn:hover { background: #e6e6e6; color: #333; }
.tb-btn.close:hover { background: #e81123; color: #fff; }

/* ===================== 主体三栏 ===================== */

.wx-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---------- 最左侧功能栏 ---------- */

.wx-rail {
  width: 60px;
  flex: 0 0 60px;
  background: var(--wx-rail-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 0 18px;
  user-select: none;
}

.rail-avatar {
  width: 36px; height: 36px;
  border-radius: 4px;
  background: #4a4a4a;
  cursor: pointer;
  margin-bottom: 26px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .15s;
}
.rail-avatar:hover { transform: scale(1.06); }
.rail-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-avatar .ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 500;
}

.rail-icons {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.rail-item {
  width: 46px; height: 46px;
  border: 0; background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--wx-rail-icon);
  position: relative;
  transition: color .15s, background .15s;
  padding: 0;
}
.rail-item:hover { color: #b5b5b5; background: rgba(255,255,255,.05); }
.rail-item.active { color: #fff; background: rgba(255,255,255,.07); }
.rail-item.active::before {
  content: '';
  position: absolute;
  left: -7px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--wx-green);
  border-radius: 2px;
}
.rail-item .rail-label {
  font-size: 10px;
  letter-spacing: .2px;
  transform: scale(.92);
}
.rail-item svg { width: 21px; height: 21px; }

.rail-badge {
  position: absolute;
  top: 4px; right: 5px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--wx-red);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  font-style: normal;
}

.rail-foot { display: flex; flex-direction: column; gap: 6px; }

/* ---------- 中间列表栏 ---------- */

.wx-list-pane {
  width: 268px;
  flex: 0 0 268px;
  min-width: 0;
  background: var(--wx-list-bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #d8d8d8;
}

/* 朋友圈和真微信一致：没有会话列表栏，直接整个页面 */
.wx-window.view-moments .wx-list-pane { display: none; }

.list-search {
  padding: 13px 12px 11px;
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.search-box {
  flex: 1;
  height: 26px;
  background: #d6d6d6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 5px;
  transition: background .15s;
}
.search-box:focus-within { background: #fff; box-shadow: inset 0 0 0 1px #cfcfcf; }
.search-box svg { width: 13px; height: 13px; color: #8b8b8b; flex: 0 0 auto; }
.search-box input {
  flex: 1; border: 0; background: transparent;
  font-size: 12.5px; color: #333; outline: none; min-width: 0;
}
.search-box input::placeholder { color: #9b9b9b; }

.list-add {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  background: #d6d6d6;
  border: 0; border-radius: 4px;
  color: #6b6b6b;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.list-add:hover { background: #c9c9c9; }
.list-add svg { width: 13px; height: 13px; }

.list-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 会话条目 */
.conv {
  height: 64px;
  padding: 12px 12px 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  transition: background .1s;
}
.conv:hover { background: var(--wx-list-hover); }
.conv.active { background: var(--wx-list-active); }
.conv + .conv::before {
  content: '';
  position: absolute;
  left: 14px; right: 0; top: 0;
  height: 1px; background: #dcdcdc;
}
.conv.active::before, .conv.active + .conv::before { opacity: 0; }

.conv-avatar {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: #c8c8c8;
}
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv-avatar .ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; font-weight: 500;
}

.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-name {
  flex: 1; min-width: 0;
  font-size: 14px;
  color: #191919;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-time { font-size: 11px; color: var(--wx-text-time); flex: 0 0 auto; }
.conv-preview {
  margin-top: 4px;
  font-size: 12px;
  color: var(--wx-text-sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; gap: 6px; align-items: center;
}
.conv-preview .pin {
  flex: 0 0 auto;
  color: #b08b3a;
  font-size: 10px;
  border: 1px solid #d9c08a;
  border-radius: 2px;
  padding: 0 3px;
  line-height: 14px;
}
.conv-unread {
  position: absolute;
  right: 14px; bottom: 12px;
  font-size: 11px; color: #fff; background: var(--wx-red);
  min-width: 16px; height: 16px; line-height: 16px;
  text-align: center; border-radius: 8px; padding: 0 4px;
}

/* 分组标题（通讯录用） */
.group-label {
  padding: 16px 14px 6px;
  font-size: 11px;
  color: #8a8a8a;
  letter-spacing: .4px;
}

/* 通讯录：管理行 / 分组行 / 拼音字母索引（仿微信 PC） */
.contact-manage {
  margin: 10px 12px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid #e7e7e7;
  border-radius: 6px;
  font-size: 14px;
  color: #191919;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background .15s;
}
.contact-manage:hover { background: #f7f7f7; }
.contact-manage .cm-icon {
  width: 22px; height: 22px;
  color: #576b95;
  display: flex; align-items: center; justify-content: center;
}
.contact-manage .cm-icon svg { width: 20px; height: 20px; }

.group-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 8px;
  color: #7f7f7f;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.group-row:hover { color: #4d4d4d; }
.grp-arrow {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #9a9a9a;
  transition: transform .15s;
}
.grp-arrow svg { width: 12px; height: 12px; }
.grp-arrow.down { transform: rotate(90deg); }
.grp-name { flex: 1; }
.grp-count { color: #b2b2b2; font-size: 12.5px; }

.group-letter {
  padding: 10px 16px 6px;
  font-size: 12.5px;
  color: #9a9a9a;
}
.letter-section .conv-name { font-size: 14px; }

/* 列表空状态 */
.list-empty {
  padding: 50px 20px;
  text-align: center;
  color: #a0a0a0;
  font-size: 13px;
  line-height: 1.9;
}
.list-empty svg { width: 40px; height: 40px; opacity: .35; margin-bottom: 10px; }

/* 加载骨架 */
.skeleton {
  padding: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.skeleton .sk-av { width: 40px; height: 40px; border-radius: 4px; background: #dcdcdc; flex: 0 0 40px; }
.skeleton .sk-lines { flex: 1; }
.skeleton .sk-l {
  height: 11px; background: #dedede; border-radius: 3px; margin-bottom: 8px;
}
.skeleton .sk-l:last-child { width: 60%; margin-bottom: 0; }
@keyframes sk-pulse { 0%,100% { opacity: 1 } 50% { opacity: .5 } }
.skeleton { animation: sk-pulse 1.2s ease-in-out infinite; }

/* ---------- 右侧内容区 ---------- */

.wx-main {
  flex: 1;
  min-width: 0;
  background: var(--wx-main-bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.main-header {
  height: 60px;
  flex: 0 0 60px;
  border-bottom: 1px solid var(--wx-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--wx-main-bg);
}
.main-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #191919;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.main-header .sub {
  font-size: 12px;
  color: var(--wx-text-sub);
  margin-left: 10px;
  font-weight: 400;
}
.main-header .hd-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.hd-btn {
  height: 28px; padding: 0 12px;
  border: 1px solid #d5d5d5;
  background: #fff;
  border-radius: 4px;
  font-size: 12.5px; color: #444;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: all .15s;
}
.hd-btn:hover { border-color: #bbb; color: #191919; }
.hd-btn svg { width: 14px; height: 14px; }
.hd-btn.primary {
  background: var(--wx-green); border-color: var(--wx-green); color: #fff;
}
.hd-btn.primary:hover { background: var(--wx-green-hover); border-color: var(--wx-green-hover); }

/* 空内容占位 */
.main-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #c4c4c4;
  gap: 12px;
}
.main-empty svg { width: 76px; height: 76px; }
.main-empty p { margin: 0; font-size: 13.5px; }

/* ===================== 文章（消息）视图 ===================== */

.article-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 26px 26px;
  scroll-behavior: smooth;
}

/* 时间分隔 */
.chat-time-sep {
  text-align: center;
  margin: 6px 0 16px;
}
.chat-time-sep span {
  display: inline-block;
  font-size: 12px;
  color: #b2b2b2;
  background: rgba(0,0,0,.04);
  padding: 3px 10px;
  border-radius: 3px;
}

.msg-row {
  display: flex;
  gap: 11px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.msg-row.me { flex-direction: row-reverse; }

.msg-avatar {
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: 4px;
  overflow: hidden;
  background: #cfcfcf;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-avatar .ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}

.msg-col { max-width: 68%; min-width: 0; }

.msg-bubble {
  position: relative;
  background: var(--wx-bubble-you);
  border-radius: 5px;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.72;
  color: #191919;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.msg-bubble::before {
  content: '';
  position: absolute;
  top: 12px;
  border: 6px solid transparent;
}
.msg-row .msg-bubble::before {
  left: -11px;
  border-right-color: var(--wx-bubble-you);
}
.msg-row.me .msg-bubble {
  background: var(--wx-bubble-me);
}
.msg-row.me .msg-bubble::before {
  left: auto; right: -11px;
  border-right-color: transparent;
  border-left-color: var(--wx-bubble-me);
}

.msg-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: #b8b8b8;
  display: flex;
  gap: 10px;
  padding: 0 2px;
}
.msg-row.me .msg-meta { justify-content: flex-end; }

/* Markdown 正文排版 */
.md h1, .md h2, .md h3, .md h4 {
  margin: 1.25em 0 .6em;
  font-weight: 600;
  line-height: 1.4;
  color: #111;
}
.md h1 { font-size: 22px; border-bottom: 1px solid #ececec; padding-bottom: 8px; margin-top: 0; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 14.5px; }
.md p { margin: .7em 0; }
.md ul, .md ol { margin: .7em 0; padding-left: 1.6em; }
.md li { margin: .3em 0; }
.md strong { font-weight: 600; color: #000; }
.md em { font-style: italic; }
.md a { color: var(--wx-link); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md code {
  background: rgba(0,0,0,.06);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 12.5px;
}
.md pre {
  background: #282c34;
  color: #abb2bf;
  padding: 13px 15px;
  border-radius: 5px;
  overflow-x: auto;
  margin: .9em 0;
  font-size: 12.5px;
  line-height: 1.6;
}
.md pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.md blockquote {
  margin: .9em 0;
  padding: 6px 0 6px 14px;
  border-left: 3px solid #d0d0d0;
  color: #6b6b6b;
  background: rgba(0,0,0,.02);
}
.md img { max-width: 100%; border-radius: 4px; margin: .6em 0; cursor: zoom-in; display: block; }
.md hr { border: 0; border-top: 1px solid #e6e6e6; margin: 1.4em 0; }
.md table { border-collapse: collapse; margin: .9em 0; font-size: 13px; }
.md th, .md td { border: 1px solid #e0e0e0; padding: 6px 10px; }
.md th { background: #f4f4f4; font-weight: 600; }

/* 文章底部导航 */
.article-foot {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid #e6e6e6;
}
.foot-nav {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 5px;
  cursor: pointer;
  transition: border-color .15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.foot-nav:hover { border-color: #c5c5c5; }
.foot-nav .k { font-size: 11.5px; color: var(--wx-text-sub); display: block; margin-bottom: 3px; }
.foot-nav .v { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.foot-nav.next { text-align: right; }

/* ===================== 文章评论区 ===================== */
.comment-section {
  margin-top: 22px;
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
}
.cm-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
  color: #191919;
  padding-bottom: 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid #f2f2f2;
}
.cm-title svg { width: 17px; height: 17px; color: var(--wx-green); }
.cm-count {
  background: #eaf7ea;
  color: var(--wx-green);
  border-radius: 10px;
  padding: 1px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}
.cm-empty {
  text-align: center;
  color: var(--wx-text-sub);
  font-size: 12.5px;
  padding: 28px 0 22px;
}
.cm-empty svg {
  width: 34px; height: 34px;
  color: #d8d8d8;
  display: block;
  margin: 0 auto 8px;
}
.cm-item {
  padding: 13px 8px;
  border-bottom: 1px solid #f5f5f5;
  border-radius: 6px;
  transition: background .15s;
}
.cm-item:hover { background: #fafafa; }
.cm-item:last-child { border-bottom: 0; }
.cm-body { min-width: 0; }

/* 楼中楼嵌套缩进 */
.cm-children { margin-top: 10px; margin-left: 14px; padding-left: 12px; border-left: 2px solid #eef0ef; }
.cm-children .cm-item {
  padding: 10px 6px;
  border-bottom: 0;
}
.cm-children .cm-item:hover { background: #f7f9f7; }
.cm-children .cm-item + .cm-item { border-top: 1px dashed #f0f0f0; }
.cm-children .cm-text { font-size: 13.5px; }
.cm-children .cm-name { font-size: 13px; }
.cm-children .cm-floor { display: none; }
.cm-children .cm-reply-btn { font-size: 11.5px; }
.cm-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.cm-name { font-size: 13.5px; font-weight: 600; color: #576b95; }
.cm-reply-tag {
  font-size: 11.5px;
  color: #9a9a9a;
  font-weight: 400;
}
.cm-reply-btn {
  display: none;
  border: 0;
  background: transparent;
  color: #576b95;
  font-size: 12px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 3px;
}
.cm-item:hover .cm-reply-btn { display: inline-block; }
.cm-reply-btn:hover { background: #eef3fa; }
.cm-reply-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f0f7f0;
  border-left: 3px solid var(--wx-green);
  border-radius: 4px;
  padding: 5px 10px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #555;
}
.cm-reply-hint b { color: #576b95; font-weight: 600; }
.cm-reply-hint button {
  border: 0;
  background: transparent;
  color: #9a9a9a;
  cursor: pointer;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
  padding: 0;
}
.cm-reply-hint button:hover { background: #e0e0e0; color: #555; }
.cm-reply-hint button svg { width: 12px; height: 12px; }
.cm-floor {
  font-size: 11px;
  color: #c5c5c5;
  background: #f5f5f5;
  border-radius: 3px;
  padding: 0 6px;
  line-height: 16px;
}
.cm-time { font-size: 11.5px; color: #c0c0c0; margin-left: auto; }
.cm-text {
  font-size: 14px;
  color: #2b2b2b;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ===================== 底部留言输入区 ===================== */
.article-composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--wx-border-soft);
  background: #f7f7f7;
  padding: 12px 18px 14px;
}
.cm-composer-card {
  background: #fff;
  border: 1px solid var(--wx-border-soft);
  border-radius: 8px;
  padding: 10px 12px 8px;
  transition: border-color .15s, box-shadow .15s;
}
.cm-composer-card:focus-within {
  border-color: var(--wx-green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, .08);
}
.cm-form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.cm-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  background: #f7f7f7;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background .15s, border-color .15s;
}
.cm-field:focus-within { background: #fff; border-color: var(--wx-green); }
.cm-field svg { width: 14px; height: 14px; color: #b0b0b0; flex: 0 0 auto; }
.cm-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: #333;
  height: 100%;
}
.cm-field input::placeholder { color: #b5b5b5; }

.composer-input {
  width: 100%;
  height: 60px;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  color: #191919;
  padding: 4px 2px;
}
.composer-input::placeholder { color: #bbb; }

.composer-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  border-top: 1px dashed #f0f0f0;
  padding-top: 8px;
}
.composer-tip { font-size: 11.5px; color: #b5b5b5; margin-right: auto; }
.cm-counter { font-size: 11.5px; color: #c5c5c5; font-variant-numeric: tabular-nums; }

.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  background: #e9e9e9;
  color: #9a9a9a;
  font-size: 12.5px;
  cursor: not-allowed;
  transition: all .15s;
}
.btn-send svg { width: 14px; height: 14px; }
.btn-send.ready {
  background: var(--wx-green);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(7, 193, 96, .3);
}
.btn-send.ready:hover { background: var(--wx-green-hover); }
.btn-send.ready:active { transform: scale(.96); }

/* ===================== 朋友圈视图 ===================== */

.moments-scroll {
  flex: 1;
  overflow-y: auto;
  background: #f5f5f5;
  position: relative;
}

.moments-cover {
  height: 260px;
  background: linear-gradient(135deg, #4b5563 0%, #6b7280 55%, #9ca3af 100%);
  background-size: cover;
  background-position: center;
  position: relative;
}
.moments-cover.default {
  background-image:
    radial-gradient(circle at 22% 28%, rgba(255,255,255,.22), transparent 45%),
    linear-gradient(135deg, #3f4a5a 0%, #5a6675 50%, #7d8a99 100%);
}
.cover-nickname {
  position: absolute;
  right: 22px;
  bottom: 42px;
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  text-shadow: 0 1px 6px rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cover-nickname .cover-avatar {
  width: 58px; height: 58px;
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,.75);
  overflow: hidden;
  background: #8a8a8a;
}
.cover-nickname .cover-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cover-nickname .cover-avatar .ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px;
}

.moments-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 24px 40px;
}

.moment-item {
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.moment-avatar {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 5px;
  overflow: hidden;
  background: #c9c9c9;
}
.moment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.moment-avatar .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px; }

.moment-main { flex: 1; min-width: 0; }
.moment-nick {
  color: var(--wx-link);
  font-size: 14.5px;
  font-weight: 500;
  margin-bottom: 5px;
}
.moment-text {
  font-size: 14px;
  line-height: 1.72;
  color: #191919;
  white-space: pre-wrap;
  word-break: break-word;
}
.moment-images {
  margin-top: 9px;
  display: grid;
  gap: 5px;
  max-width: 366px;
}
.moment-images.n1 { grid-template-columns: 168px; }
.moment-images.n2 { grid-template-columns: repeat(2, 82px); }
.moment-images.n3, .moment-images.n4, .moment-images.n6, .moment-images.n9 { grid-template-columns: repeat(3, 82px); }
.moment-images.n5, .moment-images.n7, .moment-images.n8 { grid-template-columns: repeat(3, 82px); }
.moment-images.n1 .mi { height: 168px; }
.moment-images .mi { height: 82px; }
.moment-images .mi {
  border-radius: 3px;
  overflow: hidden;
  background: #eee;
  cursor: zoom-in;
  position: relative;
}
.moment-images .mi img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .15s; }
.moment-images .mi:hover img { filter: brightness(.92); }

.moment-loc {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--wx-link);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 4px;
  margin-left: -4px;
  border-radius: 4px;
  transition: background .15s;
}
.moment-loc:hover { background: #eef3fa; text-decoration: underline; }
.moment-loc svg { width: 12px; height: 12px; }

/* ===================== 定位地图弹窗（仿微信） ===================== */
.loc-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.loc-panel {
  width: min(760px, 100%);
  height: min(560px, 100%);
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.loc-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  flex: 0 0 auto;
}
.loc-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: #191919;
  display: flex;
  align-items: center;
  gap: 6px;
  word-break: break-all;
}
.loc-name svg { width: 15px; height: 15px; color: var(--wx-link); flex: 0 0 auto; }
.loc-close {
  border: 0;
  background: transparent;
  color: #999;
  cursor: pointer;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  flex: 0 0 auto;
}
.loc-close:hover { background: #f0f0f0; color: #333; }
.loc-close svg { width: 16px; height: 16px; }
.loc-map { flex: 1; min-height: 0; background: #e8ecef; position: relative; overflow: hidden; }
.loc-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* 自绘高德瓦片地图 */
.loc-map.amap-box { cursor: grab; touch-action: none; }
.loc-map.amap-box.dragging { cursor: grabbing; }
.amap-tiles { position: absolute; inset: 0; z-index: 1; }
.amap-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  pointer-events: none;
  user-select: none;
}
.amap-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -100%);
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
}
.amap-pin span {
  display: block;
  width: 24px;
  height: 24px;
  background: #e05b5b;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: relative;
}
.amap-pin span::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  background: #fff;
  border-radius: 50%;
}
.amap-zoom {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.amap-zoom button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .22);
}
.amap-zoom button:hover { background: #f2f2f2; }
.amap-info { min-width: 0; }
.amap-info b {
  display: block;
  color: #191919;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.amap-info i {
  font-style: normal;
  color: #9a9a9a;
  font-size: 11.5px;
}
.loc-ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid #eee;
  font-size: 12px;
  color: #9a9a9a;
  flex: 0 0 auto;
}
.loc-ft a { color: var(--wx-link); text-decoration: none; }
.loc-ft a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .loc-mask { padding: 0; }
  .loc-panel { height: 100%; border-radius: 0; }
}

.moment-foot {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.moment-time { font-size: 12px; color: #b0b0b0; flex: 1; }

/* 长文折叠 */
.moment-expand {
  border: 0;
  background: transparent;
  color: var(--wx-link);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}
.moment-expand:hover { text-decoration: underline; }

/* 两圆点按钮 + 弹出菜单（同微信） */
.moment-menu-wrap {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.moment-menu-btn {
  width: 34px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: #f2f2f2;
  color: #6b6b6b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.moment-menu-btn:hover { background: #e6e6e6; color: #3d3d3d; }
.moment-menu-btn svg { width: 16px; height: 16px; }
.moment-pop {
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  background: #4c4c4c;
  border-radius: 6px;
  display: none;
  align-items: stretch;
  padding: 0 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
  white-space: nowrap;
}
.moment-pop.show { display: flex; }
.moment-pop::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  margin-top: -4px;
  border-left: 5px solid #4c4c4c;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.moment-pop button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 16px;
  border-radius: 5px;
}
.moment-pop button:hover { background: rgba(255, 255, 255, .09); }
.moment-pop button svg { width: 14px; height: 14px; }
.moment-pop .pop-sep { width: 1px; background: rgba(255, 255, 255, .18); margin: 5px 0; }

/* 点赞 + 评论区（浅灰块，同微信） */
.moment-social {
  margin-top: 10px;
  background: #f7f7f7;
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 13px;
}
.like-line {
  line-height: 1.7;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.like-line svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  margin-top: 4px;
  color: var(--wx-link);
}
.like-line span { color: var(--wx-link); }
.social-divider { height: 1px; background: #e3e3e3; margin: 7px 0; }
.cmt-line {
  line-height: 1.7;
  padding: 2px 0;
  word-break: break-word;
}
.cmt-line .name { color: var(--wx-link); font-weight: 500; }
.cmt-line .reply-tag { color: #9a9a9a; font-size: 12px; margin: 0 2px; }
.cmt-line .txt { color: #333; }
.cmt-reply-btn {
  display: none;
  border: 0;
  background: transparent;
  color: #9a9a9a;
  font-size: 11.5px;
  cursor: pointer;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 3px;
}
.cmt-line:hover .cmt-reply-btn { display: inline-block; }
.cmt-reply-btn:hover { color: var(--wx-link); background: #e9eef6; }

/* 评论输入框：默认隐藏，点"评论"展开 */
.cmt-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.cmt-form input {
  flex: 1;
  min-width: 0;
  height: 28px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 12.5px;
  outline: none;
}
.cmt-form input:focus { border-color: var(--wx-green); }
.cmt-form button {
  height: 28px;
  padding: 0 12px;
  border: 0; border-radius: 4px;
  background: var(--wx-green);
  color: #fff; font-size: 12.5px;
  cursor: pointer;
  flex: 0 0 auto;
}
.cmt-form button:hover { background: var(--wx-green-hover); }

/* ===================== 通讯录（友链）视图 ===================== */

.contact-detail {
  flex: 1;
  overflow-y: auto;
  padding: 34px 40px;
  display: flex;
  justify-content: center;
}

.contact-card {
  width: 100%;
  max-width: 520px;
}
.contact-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid #e6e6e6;
}
.contact-head .ch-avatar {
  width: 62px; height: 62px;
  border-radius: 6px;
  overflow: hidden;
  background: #c9c9c9;
  flex: 0 0 62px;
}
.contact-head .ch-avatar img { width: 100%; height: 100%; object-fit: cover; }
.contact-head .ch-avatar .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; }
.contact-head h3 { margin: 0 0 6px; font-size: 19px; font-weight: 500; }
.contact-head .ch-desc { font-size: 13px; color: #7a7a7a; line-height: 1.6; }

.contact-rows { padding-top: 8px; }
.crow {
  display: flex;
  padding: 14px 2px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13.5px;
}
.crow .k { width: 88px; flex: 0 0 88px; color: #9a9a9a; }
.crow .v { flex: 1; color: #333; word-break: break-all; }
.crow .v a { color: var(--wx-link); text-decoration: none; }
.crow .v a:hover { text-decoration: underline; }

.contact-actions {
  display: flex;
  gap: 10px;
  padding-top: 24px;
}
.btn-primary {
  flex: 1;
  height: 36px;
  border: 0; border-radius: 5px;
  background: var(--wx-green);
  color: #fff; font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s;
}
.btn-primary:hover { background: var(--wx-green-hover); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-ghost {
  height: 36px;
  padding: 0 16px;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  background: #fff;
  color: #444; font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
}
.btn-ghost:hover { border-color: #bbb; color: #191919; }

/* 申请友链表单 */
.apply-panel {
  flex: 1;
  overflow-y: auto;
  padding: 28px 40px;
  display: flex;
  justify-content: center;
}
.apply-form { width: 100%; max-width: 520px; }
.apply-form h3 { margin: 0 0 6px; font-size: 17px; font-weight: 500; }
.apply-form .sub { font-size: 12.5px; color: #9a9a9a; margin-bottom: 22px; line-height: 1.7; }
.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 12.5px; color: #6b6b6b; margin-bottom: 6px; }
.form-row label .req { color: var(--wx-red); }
.form-row input, .form-row textarea {
  width: 100%;
  border: 1px solid #dcdcdc;
  border-radius: 5px;
  padding: 9px 11px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
  background: #fff;
  color: #191919;
}
.form-row textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
.form-row input:focus, .form-row textarea:focus { border-color: #a8d8bd; }
.form-row .hint { font-size: 11.5px; color: #a8a8a8; margin-top: 5px; }
.form-actions { display: flex; gap: 10px; padding-top: 6px; }

/* ===================== 设置视图 ===================== */

.settings-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 26px 34px;
  display: flex;
  justify-content: center;
}
.settings-wrap { width: 100%; max-width: 620px; }

.set-group {
  background: #fff;
  border-radius: 6px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.set-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .12s;
  border: 0; background: transparent; width: 100%; text-align: left;
  font-size: 14px; color: #191919;
}
.set-item:hover { background: #f7f7f7; }
.set-item + .set-item { border-top: 1px solid #f0f0f0; }
.set-item .si-icon {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.set-item .si-icon svg { width: 17px; height: 17px; }
.set-item .si-icon.green { background: #07c160; }
.set-item .si-icon.blue  { background: #1677ff; }
.set-item .si-icon.orange{ background: #ff8f1f; }
.set-item .si-icon.gray  { background: #8a8a8a; }
.set-item .si-text { flex: 1; min-width: 0; }
.set-item .si-text .t { font-size: 14px; }
.set-item .si-text .d { font-size: 12px; color: #9a9a9a; margin-top: 2px; }
.set-item .si-arrow { color: #c8c8c8; flex: 0 0 auto; }
.set-item .si-arrow svg { width: 14px; height: 14px; }

.settings-note {
  font-size: 12px;
  color: #a0a0a0;
  text-align: center;
  padding: 6px 0 20px;
  line-height: 1.8;
}

/* ===================== 博主信息弹窗 ===================== */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  animation: fade-in .16s ease;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }

.profile-card {
  width: 380px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 54px rgba(0,0,0,.28);
  animation: pop-in .2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop-in { from { opacity: 0; transform: scale(.93) translateY(10px) } to { opacity: 1; transform: none } }

.pc-head {
  padding: 30px 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}
.pc-avatar {
  width: 76px; height: 76px;
  border-radius: 8px;
  overflow: hidden;
  background: #ccc;
  margin-bottom: 14px;
}
.pc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pc-avatar .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 32px; }
.pc-nick { font-size: 19px; font-weight: 500; margin-bottom: 5px; }
.pc-wxid { font-size: 12.5px; color: #9a9a9a; }
.pc-region { font-size: 12.5px; color: #9a9a9a; margin-top: 5px; }

.pc-body { padding: 6px 26px 20px; }
.pc-row {
  display: flex;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 13.5px;
}
.pc-row:last-child { border-bottom: 0; }
.pc-row .k { width: 74px; flex: 0 0 74px; color: #9a9a9a; }
.pc-row .v { flex: 1; color: #333; word-break: break-all; }
.pc-row .v a { color: var(--wx-link); text-decoration: none; }
.pc-row .v a:hover { text-decoration: underline; }
.pc-sig {
  padding: 14px 0 4px;
  font-size: 13px;
  color: #666;
  line-height: 1.75;
  white-space: pre-wrap;
}
.pc-bio {
  padding: 12px 0;
  font-size: 13px;
  color: #444;
  line-height: 1.8;
  white-space: pre-wrap;
  border-top: 1px solid #f5f5f5;
  margin-top: 6px;
}
.pc-foot { padding: 0 26px 22px; display: flex; gap: 10px; }
.pc-foot .btn-primary { height: 34px; font-size: 13.5px; }
.pc-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 26px; height: 26px;
  border: 0; background: transparent;
  color: #b8b8b8; cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.pc-close:hover { background: #f0f0f0; color: #666; }
.pc-close svg { width: 13px; height: 13px; }

/* ===================== 图片查看器 ===================== */

.viewer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in .15s ease;
}
.viewer-mask img {
  max-width: 88vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.viewer-close {
  position: absolute;
  top: 22px; right: 26px;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.viewer-close:hover { background: rgba(255,255,255,.22); }
.viewer-close svg { width: 16px; height: 16px; }

/* ===================== Toast ===================== */

.toast-layer {
  position: fixed;
  top: 68px; left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(0,0,0,.82);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 5px;
  animation: toast-in .2s ease;
  max-width: 460px;
  text-align: center;
  line-height: 1.6;
}
.toast.ok { background: rgba(7,193,96,.92); }
.toast.err { background: rgba(250,81,81,.92); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ===================== 滚动条 ===================== */

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.16); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.3); }
::-webkit-scrollbar-thumb:active { background: rgba(0,0,0,.4); }

/* ===================== 后台页面（admin.html） ===================== */

.admin-page {
  width: 100%;
  height: 100%;
  display: flex;
  background: var(--wx-main-bg);
}

.admin-side {
  width: 208px;
  flex: 0 0 208px;
  background: var(--wx-rail-bg);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  color: #fff;
}
.admin-side .brand {
  padding: 0 20px 20px;
  font-size: 15px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}
.admin-side .brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wx-green); }
.admin-nav { flex: 1; padding: 0 10px; }
.admin-nav button {
  width: 100%;
  height: 40px;
  border: 0; background: transparent;
  color: #a5a5a5;
  border-radius: 5px;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  font-size: 13.5px;
  margin-bottom: 3px;
  transition: all .14s;
}
.admin-nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-nav button.active { background: rgba(255,255,255,.12); color: #fff; }
.admin-nav button svg { width: 16px; height: 16px; }
.admin-nav .badge {
  margin-left: auto;
  background: var(--wx-red);
  color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 8px; padding: 0 4px; text-align: center;
}
.admin-side .side-foot { padding: 12px 18px; font-size: 12px; color: #7f7f7f; border-top: 1px solid rgba(255,255,255,.08); }
.admin-side .side-foot .logout { color: #c9c9c9; cursor: pointer; margin-top: 8px; display: inline-block; }
.admin-side .side-foot .logout:hover { color: #fff; }

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-top {
  height: 58px;
  flex: 0 0 58px;
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  display: flex; align-items: center;
  padding: 0 24px;
  justify-content: space-between;
}
.admin-top h1 { margin: 0; font-size: 16px; font-weight: 500; }
.admin-top .who { font-size: 12.5px; color: #8a8a8a; }
.admin-content { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }

.admin-card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  margin-bottom: 16px;
  overflow: hidden;
}
.admin-card .card-hd {
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-card .card-hd h2 { margin: 0; font-size: 14.5px; font-weight: 500; }
.admin-card .card-bd { padding: 18px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; padding: 10px 14px;
  background: #fafafa; color: #6b6b6b; font-weight: 500;
  border-bottom: 1px solid #efefef; white-space: nowrap;
}
.admin-table td { padding: 11px 14px; border-bottom: 1px solid #f4f4f4; color: #333; vertical-align: middle; }
.admin-table tr:hover td { background: #fbfbfb; }
.admin-table .op { white-space: nowrap; text-align: right; }
.admin-table .op button {
  border: 0; background: transparent;
  color: var(--wx-link); cursor: pointer;
  font-size: 12.5px; padding: 2px 6px; border-radius: 3px;
}
.admin-table .op button:hover { background: #f0f0f0; }
.admin-table .op button.danger { color: var(--wx-red); }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 3px;
  background: #f0f0f0;
  color: #6b6b6b;
}
.tag.on { background: #e7f6ed; color: #07a054; }
.tag.off { background: #f2f2f2; color: #9a9a9a; }
.tag.warn { background: #fff4e0; color: #c07d10; }

.admin-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.admin-toolbar input {
  height: 32px; border: 1px solid #dcdcdc; border-radius: 5px;
  padding: 0 10px; font-size: 13px; outline: none; width: 220px;
}
.admin-toolbar input:focus { border-color: #a8d8bd; }
.admin-toolbar .spacer { flex: 1; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 16px 0 4px; }
.pager button {
  min-width: 32px; height: 30px;
  border: 1px solid #dcdcdc; background: #fff;
  border-radius: 4px; cursor: pointer; font-size: 12.5px; color: #444;
  padding: 0 8px;
}
.pager button:hover:not(:disabled) { border-color: #bbb; }
.pager button:disabled { color: #c4c4c4; cursor: default; }
.pager button.cur { background: var(--wx-green); border-color: var(--wx-green); color: #fff; }

.admin-empty { padding: 46px; text-align: center; color: #a8a8a8; font-size: 13px; }

/* 登录遮罩 */
.login-mask {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #cfd9df 0%, #e2ebf0 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 800;
}
.login-box {
  width: 360px;
  background: #fff;
  border-radius: 10px;
  padding: 34px 32px 30px;
  box-shadow: 0 14px 44px rgba(0,0,0,.16);
}
.login-box h2 { margin: 0 0 6px; font-size: 19px; font-weight: 500; text-align: center; }
.login-box .sub { text-align: center; font-size: 12.5px; color: #9a9a9a; margin-bottom: 24px; }
.login-box .form-row input { height: 38px; }
.login-box .btn-primary { width: 100%; height: 38px; margin-top: 8px; }
.login-err { color: var(--wx-red); font-size: 12.5px; text-align: center; min-height: 20px; margin-top: 8px; }

/* 上传区 */
.upload-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.upload-cell {
  width: 92px; height: 92px;
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  background: #f4f4f4;
}
.upload-cell img { width: 100%; height: 100%; object-fit: cover; }
.upload-cell .del {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  cursor: pointer; font-size: 13px; line-height: 20px; padding: 0;
}
.upload-cell .del:hover { background: rgba(0,0,0,.75); }
.upload-add {
  width: 92px; height: 92px;
  border: 1px dashed #ccc;
  border-radius: 5px;
  background: #fafafa;
  color: #9a9a9a;
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-size: 11.5px;
}
.upload-add:hover { border-color: var(--wx-green); color: var(--wx-green); }
.upload-add svg { width: 20px; height: 20px; }

/* ===================== 移动端返回按钮 ===================== */

.mobile-back {
  display: none;
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border: 0; background: transparent;
  color: #555; cursor: pointer;
  align-items: center; justify-content: center;
  border-radius: 4px;
  margin-right: 6px;
  padding: 0;
}
.mobile-back:hover { background: #e8e8e8; }
.mobile-back svg { width: 18px; height: 18px; }

/* ===================== 响应式：窄屏降级为单栏 ===================== */

@media (max-width: 860px) {
  /* 朋友圈与设置：内容本身就是列表，直接全宽，隐藏中间栏 */
  .wx-window.view-moments .wx-list-pane,
  .wx-window.view-settings .wx-list-pane { display: none; }

  /* 消息与通讯录：默认只显示列表栏 */
  .wx-window.view-chat .wx-main,
  .wx-window.view-contacts .wx-main { display: none; }
  .wx-window.view-chat .wx-list-pane,
  .wx-window.view-contacts .wx-list-pane {
    flex: 1 1 100%;
    width: auto;
    min-width: 0;
    overflow: hidden;
    border-right: 0;
  }

  /* 点进详情后：隐藏列表、显示内容 */
  .wx-window.view-chat.show-detail .wx-list-pane,
  .wx-window.view-contacts.show-detail .wx-list-pane { display: none; }
  .wx-window.view-chat.show-detail .wx-main,
  .wx-window.view-contacts.show-detail .wx-main { display: flex; }

  /* 详情态才显示返回按钮 */
  .wx-window.view-chat .mobile-back,
  .wx-window.view-contacts .mobile-back { display: flex; }

  .main-header { padding: 0 14px; }
  .main-header h2 { font-size: 15px; }
  .article-scroll { padding: 14px 14px 20px; }
  .msg-col { max-width: 82%; }
  .moments-cover { height: 200px; }
  .moments-body { padding: 14px 12px 30px; }
  .moment-item { padding: 13px 13px; }
  .contact-detail { padding: 22px 16px; }
  .apply-panel { padding: 20px 16px; }
  .settings-scroll { padding: 18px 14px; }
  .crow .k { width: 72px; flex: 0 0 72px; }

  /* 后台：侧栏收窄 */
  .admin-side { width: 60px; flex: 0 0 60px; }
  .admin-side .brand span:not(.dot),
  .admin-side .admin-nav button span:not(.badge),
  .admin-side .side-foot { display: none; }
  .admin-side .admin-nav button { justify-content: center; padding: 0; }
  .admin-top { padding: 0 14px; }
  .admin-content { padding: 14px 12px 30px; }
}

/* ===================== 移动端防溢出加固 ===================== */
@media (max-width: 860px) {
  /* 移动浏览器地址栏：用 dvh 避免底部被裁切（不支持时忽略） */
  .wx-window { height: 100dvh; }

  /* 后台表格：卡片内横向滚动，不再撑破布局 */
  .admin-card .card-bd { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 560px; }
  .admin-table th, .admin-table td { padding: 9px 10px; }

  /* 后台顶部 / 工具栏 / 分页 */
  .admin-top { gap: 10px; }
  .admin-top h1 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .admin-top .who { flex: 0 0 auto; font-size: 12px; white-space: nowrap; }
  .admin-toolbar input { flex: 1 1 140px; min-width: 0; }
  .pager { flex-wrap: wrap; }

  /* 文章头部：标题省略号，操作按钮不被压缩 */
  .main-header { gap: 8px; }
  .main-header h2 { flex: 1; min-width: 0; }
  .main-header .hd-actions { flex: 0 0 auto; }
  .hd-btn { white-space: nowrap; }

  /* 朋友圈九宫格自适应容器宽度（原来写死 82px 会溢出小屏） */
  .moment-images { max-width: 100%; }
  .moment-images.n1 { grid-template-columns: minmax(0, 168px); }
  .moment-images.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .moment-images.n3, .moment-images.n4,
  .moment-images.n5, .moment-images.n6,
  .moment-images.n7, .moment-images.n8,
  .moment-images.n9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .moment-images .mi { height: auto; aspect-ratio: 1 / 1; }
  .moment-images.n1 .mi { height: auto; aspect-ratio: 1 / 1; }
  .moment-social { word-break: break-word; }

  /* 定位弹窗 */
  .loc-panel { width: 100%; }
  .loc-ft { flex-wrap: wrap; row-gap: 6px; }

  /* 底部留言输入区 */
  .article-composer { padding: 10px 12px 12px; }
  .article-composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .cm-form-row { gap: 8px; }
  .cm-field { padding: 0 8px; }
  .composer-foot { gap: 8px; }
  .composer-tip { display: none; }
  .cm-counter { margin-right: auto; }

  /* 通讯录 / 联系人详情 */
  .contact-manage { margin: 8px 10px; }
  .contact-detail { padding: 18px 12px; }
  .crow .k { width: 64px; flex: 0 0 64px; }
  .contact-actions { flex-wrap: wrap; }

  /* 弹层与提示 */
  .toast { max-width: calc(100vw - 32px); }
  .modal-mask { padding: 16px; }
  .profile-card { width: calc(100vw - 32px); max-width: 380px; }
  .apply-form, .settings-wrap { max-width: 100%; }
  .apply-panel, .settings-scroll { width: 100%; }
}

/* 极窄屏（≤380px）再收一档 */
@media (max-width: 380px) {
  .cm-form-row { flex-direction: column; }
  .moment-item { gap: 9px; padding: 12px 11px; }
  .moment-avatar { width: 36px; height: 36px; flex: 0 0 36px; }
  .wx-titlebar { padding: 0 8px 0 10px; }
  .msg-col { max-width: 86%; }
  .wx-rail { width: 52px; flex: 0 0 52px; }
  .group-row { padding: 10px 12px 8px; }
  .group-letter { padding: 10px 12px 6px; }
}
