/* ================= 主题变量 =================
   主色白，蓝色作为强调色。改配色基本只需要改这里。 */
:root {
  --bg:      #f5f8fc;   /* 页面底色 */
  --side:    #ffffff;   /* 左侧导航 */
  --panel:   #ffffff;   /* 卡片/面板 */
  --panel2:  #f0f5fc;   /* 输入框、次级背景 */
  --line:    #dfe7f2;   /* 分隔线、边框 */
  --text:    #16202f;   /* 正文 */
  --dim:     #64748b;   /* 次要文字 */
  --faint:   #94a3b8;   /* 更淡的说明文字 */
  --accent:  #2563eb;   /* 主蓝 */
  --accent2: #1d4ed8;   /* 深一档的蓝 */
  --ok:      #16a34a;
  --warn:    #d97706;
  --err:     #dc2626;

  --radius:  0px;
  --shadow:  0 1px 2px rgba(22,32,47,.06), 0 4px 16px rgba(22,32,47,.05);
}

* { box-sizing: border-box; }

/* hidden 属性必须能压过组件自己的 display，否则弹窗会一直显示 */
[hidden] { display: none !important; }

/* ================= 私信 ================= */
.dm-panel { max-width: 820px; }
.dm-panel .log { height: 420px; }
.dm-empty { text-align: center; margin: auto; }

.thread-list { max-height: 320px; overflow-y: auto; }
.thread {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.thread:hover { background: var(--panel2); }
.thread.active { background: #eef4ff; box-shadow: inset 3px 0 0 var(--accent); }
.th-main { min-width: 0; flex: 1; }
.th-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.th-last { font-size: 12px; color: var(--dim); overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; }
.th-time { font-size: 11px; color: var(--faint); white-space: nowrap; }
.mini-badge {
  background: #dc2626; color: #fff; border-radius: 0;
  font-size: 11px; font-weight: 600; padding: 0 6px; line-height: 17px;
}

/* 私信里自己发的消息靠右显示（具体样式见下方「聊天消息」一节） */

/* ================= 红色信息提醒条 ================= */
.notice-bar {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 14px;
  padding: 13px 16px;
  background: #dc2626;
  color: #fff;
  border-radius: 0;
  font-size: 13.5px;
  line-height: 1.65;
  box-shadow: 0 2px 10px rgba(220,38,38,.22);
  animation: pageIn .4s cubic-bezier(.22,.7,.3,1) both;
}
.notice-bar .nb-icon {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; color: #dc2626;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-top: 1px;
}
.notice-bar b { font-weight: 600; }
.notice-bar .nb-close {
  margin-left: auto; flex: none; background: transparent; border: none;
  color: rgba(255,255,255,.75); font-size: 18px; line-height: 1;
  padding: 0 2px; cursor: pointer;
}
.notice-bar .nb-close:hover { color: #fff; filter: none; }

/* 聊天室未读消息角标 */
.nav-item { position: relative; }
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 0;
  background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 600; line-height: 20px;
  text-align: center;
  animation: popIn .24s ease-out both;
}
.nav-item.active .nav-badge { background: #fff; color: #dc2626; }

/* ================= 分割条 =================
   两个框之间放几段蓝色短线，比画一整条实线轻盈，不会显得违和 */
.sep {
  display: flex; align-items: center; gap: 6px;
  height: 22px; margin: 4px 0;
}
.sep i {
  display: block; height: 3px; border-radius: 0;
  background: linear-gradient(90deg, var(--accent), #7fb0ff);
  opacity: .5;
}
.sep i:nth-child(1) { width: 46px; }
.sep i:nth-child(2) { width: 14px; opacity: .32; }
.sep i:nth-child(3) { width: 7px;  opacity: .2; }
.sep.right i:nth-child(1) { width: 7px; }
.sep.right i:nth-child(2) { width: 14px; }
.sep.right i:nth-child(3) { width: 46px; background: linear-gradient(90deg, #7fb0ff, var(--accent)); }
.sep.center { justify-content: center; }

/* ================= 动画 ================= */
@keyframes appIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes itemIn {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes maskIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes boxIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes dotIn {
  from { opacity: 0; transform: scale(.4); }
  to   { opacity: 1; transform: none; }
}

/* 进页面时的整体淡入 */
.app { animation: appIn .32s cubic-bezier(.22,.7,.3,1) both; }

/* 侧边栏逐项滑入 */
.sidebar > * { animation: itemIn .4s cubic-bezier(.22,.7,.3,1) both; }
.sidebar > *:nth-child(1) { animation-delay: .04s; }
.sidebar > *:nth-child(2) { animation-delay: .10s; }
.sidebar > *:nth-child(3) { animation-delay: .16s; }
.sidebar > *:nth-child(4) { animation-delay: .22s; }

/* 内容区逐块淡入，切页面时重新播放 */
.page > * { animation: pageIn .42s cubic-bezier(.22,.7,.3,1) both; }
.page > *:nth-child(1) { animation-delay: .05s; }
.page > *:nth-child(2) { animation-delay: .11s; }
.page > *:nth-child(3) { animation-delay: .17s; }
.page > *:nth-child(4) { animation-delay: .23s; }
.page > *:nth-child(5) { animation-delay: .29s; }
.page > *:nth-child(6) { animation-delay: .35s; }

@media (prefers-reduced-motion: reduce) {
  .app, .sidebar > *, .page > * { animation: none; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--dim); }
.req { color: var(--err); }

/* ================= 登录 ================= */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { width: 100%; max-width: 390px; background: var(--panel);
            border: 1px solid var(--line); border-radius: 0;
            padding: 32px 28px; box-shadow: var(--shadow); }
.auth-box h2 { margin: 0 0 4px; font-size: 21px; text-align: center; color: var(--accent2); }
.auth-sub { margin: 0 0 22px; text-align: center; color: var(--dim); font-size: 13px; }
.auth-box label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
                  font-size: 13px; color: var(--dim); }
.auth-box .remember { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 20px; }
.remember input { flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.auth-btns { display: flex; gap: 10px; }
.auth-btns button { flex: 1; }
.auth-msg { min-height: 18px; margin: 14px 0 0; font-size: 13px; text-align: center; }
.auth-msg.ok { color: var(--ok); }
.auth-msg.err { color: var(--err); }
.auth-note { margin: 10px 0 0; font-size: 12px; color: var(--faint); text-align: center; }
.auth-box .btn-link { display: block; margin-top: 16px; text-align: center; }

/* ================= 布局：左侧导航 + 内容 ================= */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 20px;
}
.brand { font-size: 17px; font-weight: 700; padding: 0 10px; color: var(--accent2); letter-spacing: .5px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  color: var(--dim); font-size: 14px; transition: .15s;
}
/* 用文字方块代替 emoji，避免系统缺少 emoji 字体时显示成豆腐块 */
.ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--panel2); color: var(--accent);
  font-size: 12px; font-weight: 600; flex: none;
}
/* 悬停和选中都不再铺色块，改成一条细蓝线把文字框起来 */
.nav-item:hover,
.nav-item.active {
  background: transparent;
  color: var(--accent2);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.nav-item.active { font-weight: 600; }

.me { display: flex; align-items: center; gap: 10px; padding: 12px 10px;
      border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.me-text { min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; }
.me-user { font-size: 12px; color: var(--faint); }

.sidebar-foot { display: flex; gap: 8px; margin-top: auto; padding: 0 4px; }
.sidebar-foot .mini { flex: 1; }

.content { padding: 24px 28px; min-width: 0; }
.page { max-width: 1100px; }
.page h2 { margin: 0 0 6px; font-size: 21px; }
.page > p { margin: 0; }

/* 头像：改成方角 */
.avatar { object-fit: cover; background: var(--panel2); flex: none;
          border: 1px solid var(--line); border-radius: 0; }
.avatar.lg { width: 40px; height: 40px; }
.avatar.xl { width: 76px; height: 76px; }
.avatar-initial {
  flex: none; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 600;
  border-radius: 0;
}
.avatar-initial.lg { width: 40px; height: 40px; font-size: 17px; }
.avatar-initial.xl { width: 76px; height: 76px; font-size: 30px; }

/* ================= 论坛 ================= */
.forum {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.forum-head {
  padding: 12px 16px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--dim);
}

.post-form { padding: 16px; display: flex; flex-direction: column; gap: 10px;
             border-bottom: 1px solid var(--line); background: #fbfdff; }
.post-form .row { display: flex; align-items: center; gap: 10px; }
.post-form .grow { flex: 1; }

.post-list { padding: 0 16px; max-height: 900px; overflow-y: auto; }
.post { padding: 18px 0; border-bottom: 1px solid var(--line);
        animation: pageIn .34s cubic-bezier(.22,.7,.3,1) both; }
.post-list .post:nth-child(1) { animation-delay: .02s; }
.post-list .post:nth-child(2) { animation-delay: .07s; }
.post-list .post:nth-child(3) { animation-delay: .12s; }
.post-list .post:nth-child(4) { animation-delay: .17s; }
.post-list .post:nth-child(n+5) { animation-delay: .22s; }
.post:last-child { border-bottom: none; }
.post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.post-head .who { color: var(--accent); font-weight: 600; font-size: 14px; }
.post-time { color: var(--faint); font-size: 11px; margin-left: auto; }
.post-head .p-del { margin-left: 8px; }

.post-title { margin: 0 0 8px; font-size: 17px; font-weight: 600; line-height: 1.4; }
.post-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; color: #2c3748; }
.post-img { display: block; max-width: 340px; max-height: 260px; margin-top: 10px;
            border-radius: 0; border: 1px solid var(--line); cursor: zoom-in; }

.cmt-count { margin-top: 12px; font-size: 12px; color: var(--faint); }
.cmt-list { margin: 8px 0 0; }
.cmt {
  background: #f7faff; border-left: 2px solid #d6e4ff;
  padding: 8px 12px; margin-bottom: 6px; border-radius: 0;
  font-size: 13px; word-break: break-word;
}
.cmt .who { color: var(--accent2); font-weight: 600; margin-right: 6px; }
.cmt .post-time { margin-left: 8px; }
.cmt .c-del { margin-left: 8px; padding: 1px 7px; font-size: 11px; }

.cmt-add { display: flex; gap: 8px; margin-top: 10px; }
.cmt-input { flex: 1; padding: 7px 11px; font-size: 13px; }

/* ================= 公告 ================= */
.owner-tag { font-size: 11px; color: var(--accent); background: #eff5ff;
            border: 1px solid #d6e4ff; border-radius: 0; padding: 1px 6px; margin-left: 8px; }

.ann-compose { display: flex; flex-direction: column; gap: 10px; padding: 14px 15px; }
.ann-compose textarea { resize: vertical; }

.ann-item { display: flex; align-items: flex-start; gap: 10px;
            padding: 9px 0; border-bottom: 1px dashed var(--line); }
.ann-item:last-child { border-bottom: none; }
.ann-text { flex: 1; white-space: pre-wrap; word-break: break-word; }
.ann-item .t { color: var(--faint); font-size: 11px; white-space: nowrap; }

/* 公告在聊天里显示的样子 */
.msg.notice {
  background: #eff5ff; border-left: 3px solid var(--accent);
  border-radius: 0; padding: 8px 12px;
}
.msg.notice .who { color: var(--accent2); }

/* ================= 首页轮播图 ================= */
.carousel {
  position: relative;
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 21 / 7;
}
.carousel.empty { display: none; }

/* 没上传图时的占位块 */
.carousel.placeholder { aspect-ratio: auto; }
.carousel.placeholder .slide { display: flex; }
.car-empty {
  width: 100%;
  padding: 30px 20px;
  text-align: center;
  background: repeating-linear-gradient(45deg, #fbfdff, #fbfdff 12px, #f2f7fd 12px, #f2f7fd 24px);
  border-radius: 0;
}
.car-empty-title { font-size: 15px; font-weight: 600; color: var(--dim); }
.car-empty-sub { font-size: 13px; color: var(--faint); margin-top: 4px; }
.carousel.placeholder .car-btn { display: none; }

.carousel .track {
  display: flex;
  height: 100%;
  transition: transform .5s cubic-bezier(.4, 0, .2, 1);
}
.carousel .slide { flex: 0 0 100%; height: 100%; }
.carousel .slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel .slide a { display: block; height: 100%; }

.car-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.85); color: var(--accent2);
  border: 1px solid var(--line); font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer; box-shadow: var(--shadow);
}
.car-btn:hover { background: #fff; }
.car-btn.prev { left: 12px; }
.car-btn.next { right: 12px; }

.dots { position: absolute; bottom: 12px; left: 0; right: 0;
        display: flex; justify-content: center; gap: 7px; }
.dot-btn { width: 8px; height: 8px; border-radius: 50%; cursor: pointer;
           background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.8); }
.dot-btn.on { background: var(--accent); width: 22px; border-radius: 0; }

/* 轮播图管理 */
.banner-add { display: flex; gap: 10px; margin-bottom: 14px; }
.member.bn { gap: 12px; }
.bn-thumb { width: 56px; height: 34px; object-fit: cover; border-radius: 0;
            border: 1px solid var(--line); flex: none; }
.bn-ops { display: flex; gap: 6px; margin-left: auto; }
.mini.danger { color: var(--err); border-color: #f3c9c9; }
.mini.danger:hover { border-color: var(--err); background: #fef2f2; color: var(--err); }

/* ================= 首页 ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
             gap: 14px; margin: 22px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 0;
        padding: 20px 18px; text-align: center; box-shadow: var(--shadow); }
.stat .num { font-size: 27px; font-weight: 700; color: var(--accent); line-height: 1.2; }
.stat .lbl { font-size: 12px; color: var(--dim); margin-top: 2px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 0;
        margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow); }
.card-head { padding: 11px 15px; background: var(--panel2); font-size: 13px; color: var(--dim);
             border-bottom: 1px solid var(--line); }
.card > div:not(.card-head) { padding: 14px 15px; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--panel2); border: 1px solid var(--line);
        border-radius: 0; padding: 3px 12px; font-size: 12px; color: var(--accent2); }

.feed-item { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.feed-item:last-child { border-bottom: none; }
.feed-item b { color: var(--accent); }
.feed-item img.feed-img { max-width: 72px; max-height: 72px; border-radius: 0;
                         vertical-align: middle; margin-left: 6px; border: 1px solid var(--line); }
.feed-item .t { color: var(--faint); font-size: 11px; margin-left: 6px; }

/* ================= 聊天室 ================= */
.chat-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
/* 只有聊天一块时让它占满整屏，并把窗口拉高 */
.chat-grid .log { height: calc(100vh - 380px); min-height: 360px; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; gap: 12px; overflow-x: auto; padding: 12px; }
  .nav { flex-direction: row; }
  .me { border: none; padding: 0; }
  .sidebar-foot { margin: 0 0 0 auto; }
}

/* ================= 启动加载中 =================
   刷新页面时先显示这个，避免「登录框闪一下再消失」 */
.boot {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg);
}
.boot-spin {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.boot-text { color: var(--dim); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 站长后台 ================= */
/* 入口用蓝色字区分，但选中时底色也是蓝的，文字必须换成白色才看得见 */
.nav-item.admin-only { color: var(--accent); font-weight: 600; }
.nav-item.admin-only:hover { color: var(--accent2); }
.nav-item.admin-only.active,
.nav-item.admin-only.active:hover { color: #fff; }

.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: none; }
.user-row.banned { opacity: .6; }
.u-main { min-width: 0; flex: 1; }
.u-name { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.u-avatar { width: 22px; height: 22px; border-radius: 0; border: 1px solid var(--line); }
.u-meta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.u-ops { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.image-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px; margin-top: 12px;
}
.img-cell {
  border: 1px solid var(--line); border-radius: 0; overflow: hidden;
  background: var(--panel2); display: flex; flex-direction: column;
}
.img-cell img { width: 100%; height: 100px; object-fit: cover; display: block; cursor: zoom-in; }
.img-info { padding: 6px 8px; font-size: 11px; color: var(--dim); word-break: break-all; }
.img-info .t { color: var(--faint); }
.img-cell .img-del { margin: 0 8px 8px; }

.admin-msg {
  padding: 7px 0; border-bottom: 1px dashed var(--line);
  font-size: 13px; word-break: break-word;
}
.admin-msg:last-child { border-bottom: none; }
.admin-msg .t { color: var(--faint); font-size: 11px; margin-right: 8px; }
.admin-msg .who { color: var(--accent); font-weight: 600; margin-right: 6px; }
.admin-msg .att { color: var(--accent); margin-left: 6px; }

.danger-card .card-head { background: #fef2f2; color: var(--err); }
.card-body.pad { padding: 6px 16px 14px; }

/* ================= 全局提示条 ================= */
.toast-box {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
  max-width: min(92vw, 520px);
}
.toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: 0;
  background: #263243; color: #fff;
  font-size: 13.5px; line-height: 1.5;
  box-shadow: 0 6px 20px rgba(22,32,47,.24);
  animation: toastIn .26s cubic-bezier(.22,.7,.3,1) both;
  word-break: break-word;
}
.toast-out, .toast.out { animation: toastOut .38s ease-in both; }
.toast-err { background: #dc2626; }
.toast-ok { background: #16a34a; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-10px); }
}

@media (max-width: 640px) {
  .toast-box { top: 8px; left: 8px; right: 8px; transform: none; align-items: stretch; }
}

/* ================= 手机端适配 =================
   手机上重点解决三件事：字太小点不准、输入框被键盘挡住、聊天窗口太矮 */
@media (max-width: 640px) {
  body { font-size: 15px; }

  /* 顶栏：品牌名让位给导航，横着滑 */
  .sidebar {
    position: sticky; top: 0; z-index: 20;
    flex-wrap: nowrap; gap: 10px;
    padding: 10px 12px;
    border-right: none; border-bottom: 1px solid var(--line);
    -webkit-overflow-scrolling: touch;
  }
  .brand { display: none; }
  .nav { flex-direction: row; gap: 6px; flex: 1; }
  .nav-item { padding: 8px 12px; white-space: nowrap; font-size: 14px; }
  .me { padding: 0 4px; }
  .me-text { display: none; }
  .sidebar-foot { margin: 0; flex: none; }

  .content { padding: 14px 12px 24px; }

  /* 所有可点的元素都要够大，手指不好点 */
  button, .nav-item, .mini, .tab { min-height: 40px; }
  input, select, textarea { font-size: 16px; /* 小于 16px 浏览器会自动放大 */ }

  /* 聊天窗口：用动态视口高度，键盘弹起时不会被遮 */
  .chat-grid .log { height: calc(100dvh - 300px); min-height: 260px; }
  .dm-panel .log { height: calc(100dvh - 320px); min-height: 240px; }
  .thread-list { max-height: 240px; }

  .msg img.pic { max-width: 78vw; max-height: 46dvh; }
  .post-img { max-width: 90vw; max-height: 40dvh; }

  /* 输入区固定在底部，聊天记录滚动时始终能点到 */
  .input-row {
    position: sticky; bottom: 0; z-index: 10;
    background: var(--panel); padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .input-row input { min-width: 0; }

  .picker { padding: 10px 12px; }
  .notice-bar { font-size: 13px; padding: 11px 13px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 14px 10px; }
  .stat .num { font-size: 22px; }

  .post { padding: 14px 0; }
  .cmt-add { flex-wrap: wrap; }
  .cmt-input { flex: 1 1 100%; }

  .tabs { flex-wrap: wrap; }
  .tab { flex: 1 1 44%; }

  /* 侧边栏红点别挡住文字 */
  .nav-badge { min-width: 18px; height: 18px; line-height: 18px; font-size: 10px; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 0;
         display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.panel-head { padding: 11px 15px; background: var(--panel2); font-size: 13px; color: var(--dim);
              border-bottom: 1px solid var(--line);
              display: flex; justify-content: space-between; align-items: center; }

.status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px rgba(22,163,74,.5); }
.dot.off { background: var(--err); }

.log { height: 440px; overflow-y: auto; padding: 14px 16px; display: flex;
       flex-direction: column; gap: 12px; }
.log::-webkit-scrollbar { width: 9px; }
.log::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 0; }
.log::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ================= 顶部灰色系统提示条 =================
   「xx 加入了聊天室」这类消息只在这里短暂显示，不进聊天记录，避免刷屏 */
.sysbar {
  background: #f2f5f9;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 12.5px;
  text-align: center;
  padding: 7px 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: sysIn .28s ease-out both;
}
.sysbar.out { animation: sysOut .4s ease-in both; }
@keyframes sysIn {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: none; }
}
@keyframes sysOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ================= 聊天消息 =
   自己发的靠右、别人发的靠左，头像都在名字前面 */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 78%;
  word-break: break-word;
  animation: popIn .22s ease-out both;
}
/* 别人的在左 */
.msg:not(.mine) { align-self: flex-start; }
/* 自己的在右：头像挪到右边 */
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }

/* 头像 */
.msg .cav {
  width: 32px; height: 32px;
  flex: none;
  object-fit: cover;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.msg .cav-t {
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* 气泡 */
.msg .bubble {
  background: var(--panel2);
  border: 1px solid var(--line);
  padding: 7px 11px;
  min-width: 0;
}
.msg.mine .bubble { background: #e6f0ff; border-color: #c7dcff; }

/* 名字行 */
.msg .chead {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 3px;
}
.msg .who { color: var(--accent); font-weight: 600; }
.msg.mine .who { color: var(--accent2); }
.msg .cicon { font-size: 12px; }
.msg .time { color: var(--faint); font-size: 11px; margin-left: auto; }
/* 自己那条时间紧贴右边，就不占间距了 */
.msg.mine .time { margin-left: 4px; }

/* 正文 */
.msg .ctext { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }

.msg.sys { color: var(--dim); font-size: 13px; font-style: italic; }
.msg.k-form .who { color: var(--warn); }
.msg.k-form .bubble { background: #fffbeb; border-color: #fde68a; }
.msg img.pic { max-width: 260px; max-height: 320px; border-radius: 0;
               display: block; margin-top: 6px; cursor: zoom-in;
               border: 1px solid var(--line); }

/* 图片待发送预览 */
.picker { display: flex; align-items: center; gap: 12px; padding: 10px 15px;
          border-top: 1px solid var(--line); background: var(--panel2); }
.picker img { max-height: 74px; border-radius: 0; border: 1px solid var(--line); }

.input-row { display: flex; gap: 8px; padding: 12px 15px; border-top: 1px solid var(--line); }
.icon { background: #fff; border: 1px solid var(--line); font-size: 16px; padding: 7px 13px;
        border-radius: 0; color: var(--accent2); }
.icon:hover { border-color: var(--accent); background: var(--panel2); }

input, textarea, select {
  flex: 1; background: #fff; border: 1px solid var(--line); color: var(--text);
  border-radius: 0; padding: 9px 12px; font: inherit; outline: none; transition: .15s;
}
input::placeholder, textarea::placeholder { color: #a8b5c6; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[readonly] { background: var(--panel2); color: var(--dim); cursor: not-allowed; }
textarea { resize: vertical; width: 100%; }
select { width: 100%; flex: none; cursor: pointer; }

button { background: var(--accent); border: none; color: #fff; padding: 9px 20px;
         border-radius: 0; cursor: pointer; font: inherit; white-space: nowrap;
         transition: .15s; }
button:hover { background: var(--accent2); }
button:disabled { opacity: .5; cursor: not-allowed; }

.ghost { background: #fff; border: 1px solid var(--line); color: var(--dim); }
.ghost:hover { border-color: var(--accent); color: var(--accent2); background: var(--panel2); }

.mini { background: #fff; border: 1px solid var(--line); color: var(--dim);
        padding: 6px 12px; font-size: 12px; border-radius: 0; }
.mini:hover { border-color: var(--accent); color: var(--accent2); background: var(--panel2); }
.link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; }

/* ================= 表单 ================= */
.form { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--dim); }
.form-msg { margin: 0; min-height: 18px; font-size: 13px; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }

.form-list { max-height: 260px; overflow-y: auto; padding: 12px 15px; }
.form-list .item { border-left: 3px solid var(--accent); padding: 6px 0 6px 12px; margin-bottom: 12px; }
.form-list .item b { color: var(--accent); }
.form-list .item .meta { color: var(--faint); font-size: 12px; margin-bottom: 3px; }
.form-list .empty { color: var(--dim); font-size: 13px; }

/* ================= 设置弹窗 ================= */
.modal { position: fixed; inset: 0; background: rgba(22,32,47,.42); display: flex;
         align-items: center; justify-content: center; z-index: 50;
         animation: maskIn .2s ease-out both; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 0;
             padding: 24px; width: 380px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
             box-shadow: 0 12px 40px rgba(22,32,47,.16);
             animation: boxIn .26s cubic-bezier(.22,.7,.3,1) both; }
.modal-box.wide { width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; color: var(--accent2); }

.tabs { display: flex; gap: 4px; background: var(--panel2); border-radius: 0;
        padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; background: transparent; color: var(--dim); padding: 7px 4px;
       font-size: 13px; border-radius: 0; }
.tab:hover { color: var(--accent2); }
.tab.active { background: var(--accent); color: #fff; }

.modal-box label { display: flex; flex-direction: column; gap: 6px;
                   font-size: 13px; color: var(--dim); margin-bottom: 14px; }
.modal-box .remember { flex-direction: row; align-items: center; gap: 8px; }
.avatar-row { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.avatar-row > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns button { flex: 1; }

.tip { font-size: 12px; color: var(--faint); margin-top: 4px; }

.sec-row { display: flex; align-items: center; justify-content: space-between;
           gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.sec-row:last-child { border-bottom: none; }
.sec-title { font-size: 14px; }

.member-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 8px; padding: 9px 0;
          border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: none; }
.member .m-name { font-weight: 500; }
.member .m-user { color: var(--faint); font-size: 12px; margin-right: auto; }
.member .empty { color: var(--dim); }

/* ================= 界面偏好 ================= */
body.fs-sm { font-size: 13px; }
body.fs-lg { font-size: 16px; }
body.compact .log { gap: 6px; }
body.compact .msg .pic { max-width: 180px; max-height: 200px; }
body.compact .form { gap: 9px; padding: 12px; }

/* 站长标识：跟名字紧挨着的一个小蓝框 */
.badge-owner {
  display: inline-block;
  vertical-align: 1px;
  margin: 0 5px 0 -2px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  background: var(--accent);
  border-radius: 0;
}
.msg.k-form .badge-owner { background: var(--warn); }
.chip-owner { border-color: var(--accent); color: var(--accent); }

/* 时间默认隐藏，在「设置 → 界面偏好」里打开 */
.msg .time { display: none; }
body.show-time .msg .time { display: inline; }

/* ================= 图片灯箱 ================= */
.lightbox { position: fixed; inset: 0; background: rgba(15,23,42,.9); display: flex;
            align-items: center; justify-content: center; z-index: 60; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 0; }