/* ==========================================================
   新论坛 · 前台样式（PC / 移动端自适应，纯 CSS 无框架）
   ========================================================== */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --text: #1b2430;
  --muted: #6b7785;
  --line: #e6eaf0;
  --brand: #0f766e;
  --brand-dark: #0b5b55;
  --brand-soft: #e7f4f1;
  --danger: #c0392b;
  --warn: #b7791f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 2px 6px rgba(16, 24, 40, .05), 0 12px 28px rgba(16, 24, 40, .07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; border: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.page { padding-top: 22px; padding-bottom: 40px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.icon { vertical-align: -3px; flex: none; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner { display: flex; align-items: center; gap: 22px; height: 66px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex: none; }
.brand:hover { color: var(--text); }

.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #14a08f);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(15, 118, 110, .22);
}
.brand-mark-sm { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
.brand-text strong { display: block; font-size: 17px; letter-spacing: .5px; font-weight: 700; }
.brand-text em { display: block; font-style: normal; font-size: 11px; color: var(--muted); letter-spacing: .3px; }

.nav-main { display: flex; align-items: center; gap: 4px; }
.nav-main a {
  padding: 8px 12px; border-radius: 9px; color: var(--muted); font-size: 14.5px;
}
.nav-main a:hover { background: var(--surface-2); color: var(--text); }
.nav-main a.is-active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search-inline {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; color: var(--muted);
}
.search-inline input {
  border: 0; background: transparent; outline: none; width: 132px; font-size: 13.5px;
}
.search-inline:focus-within { border-color: var(--brand); background: #fff; }

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(15, 118, 110, .2); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: #d7ece8; color: var(--brand-dark); }
.btn-danger { background: #fff1ef; color: var(--danger); border-color: #f5d5d0; }
.btn-danger:hover { background: #ffe3e0; }
.btn-sm { padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-lg { padding: 12px 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }

.user-chip { position: relative; }
.user-chip-link { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 14px; padding: 4px 8px 4px 4px; border-radius: 9px; }
.user-chip-link:hover { background: var(--surface-2); color: var(--text); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 40;
}
.user-menu a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 13.5px; }
.user-menu a:hover { background: var(--surface-2); }
.user-chip:hover .user-menu, .user-chip:focus-within .user-menu { display: block; }

/* ---------------- 头像 ---------------- */

.avatar {
  width: var(--av-size, 40px); height: var(--av-size, 40px); min-width: var(--av-size, 40px);
  border-radius: 50%; background: var(--av-bg, var(--brand)); color: #fff;
  font-size: var(--av-font, 16px); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; user-select: none;
}

/* ---------------- 提示条 ---------------- */

.flash {
  padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 14px; border: 1px solid transparent;
}
.flash-success { background: #e9f7f0; color: #166534; border-color: #cbead9; }
.flash-warn { background: #fff7e6; color: #92400e; border-color: #fde3b3; }
.flash-error { background: #fdeae8; color: #b42318; border-color: #f7cec8; }

/* ---------------- 首页 ---------------- */

.hero {
  background: linear-gradient(120deg, #0f766e 0%, #11907f 48%, #17a58d 100%);
  border-radius: 20px; color: #fff; padding: 38px 40px; position: relative; overflow: hidden;
  box-shadow: 0 18px 40px rgba(15, 118, 110, .22);
}
.hero::after {
  content: ""; position: absolute; right: -70px; top: -90px; width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 68%); border-radius: 50%;
}
.hero::before {
  content: ""; position: absolute; left: 38%; bottom: -140px; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%); border-radius: 50%;
}
.hero-inner { position: relative; z-index: 1; max-width: 640px; }
.hero h1 { margin: 0 0 10px; font-size: 30px; letter-spacing: .5px; line-height: 1.3; }
.hero p { margin: 0 0 22px; color: rgba(255, 255, 255, .85); font-size: 15.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .btn-light { background: #fff; color: var(--brand); }
.hero .btn-light:hover { background: #eef7f5; color: var(--brand-dark); }
.hero .btn-outline { border-color: rgba(255,255,255,.55); color: #fff; background: rgba(255,255,255,.08); }
.hero .btn-outline:hover { background: rgba(255,255,255,.18); color: #fff; }

.hero-stats { display: flex; gap: 26px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats div { min-width: 84px; }
.hero-stats strong { display: block; font-size: 22px; font-weight: 700; }
.hero-stats span { font-size: 12.5px; color: rgba(255, 255, 255, .78); letter-spacing: .5px; }

.hero-visual {
  position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
  width: 358px; z-index: 1; display: flex; flex-direction: column; gap: 10px;
}
.hv-bubble {
  max-width: 300px; padding: 12px 15px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.65; box-shadow: 0 12px 26px rgba(6, 60, 54, .18);
}
.hv-q {
  align-self: flex-end; background: rgba(255, 255, 255, .95); color: #0f172a;
  border-bottom-right-radius: 4px;
}
.hv-a {
  align-self: flex-start; background: rgba(255, 255, 255, .16); color: #fff;
  border: 1px solid rgba(255, 255, 255, .28); border-bottom-left-radius: 4px;
  box-shadow: none;
}
.hv-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: rgba(255, 255, 255, .85); }
.hv-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: #5eead4; box-shadow: 0 0 0 3px rgba(94, 234, 212, .22); }
@media (max-width: 1020px) { .hero-visual { display: none; } }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 306px; gap: 22px; margin-top: 22px; }
.main-col, .side-col { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--brand); }
.card-head a.more { font-size: 13px; color: var(--muted); }
.card-body { padding: 14px 18px; }
.card-body.tight { padding: 6px 0; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px -6px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title a { font-size: 13px; color: var(--muted); }

.forum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }

.forum-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.forum-card:hover {
  color: var(--text); border-color: #cfe3df; box-shadow: var(--shadow); transform: translateY(-2px);
}
.fc-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: 21px; flex: none;
}
.fc-body { flex: 1; min-width: 0; }
.fc-body h3 { margin: 0 0 3px; font-size: 15px; font-weight: 600; }
.fc-body p { margin: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-count { text-align: right; flex: none; }
.fc-count strong { display: block; font-size: 15px; color: var(--brand); }
.fc-count span { font-size: 11px; color: var(--muted); }

/* ---------------- 主题列表 ---------------- */

.topic-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.topic-item:last-child { border-bottom: 0; }
.topic-item:hover { background: var(--surface-2); }
.ti-avatar { flex: none; padding-top: 2px; }
.ti-main { flex: 1; min-width: 0; }
.ti-title { margin: 0 0 3px; font-size: 15.5px; font-weight: 600; line-height: 1.5; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ti-title a { color: var(--text); }
.ti-title a:hover { color: var(--brand); }
.ti-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.ti-meta i { font-style: normal; color: #c3cad4; }
.ti-forum { color: var(--muted); }
.ti-forum:hover { color: var(--brand); }
.ti-stats { display: flex; gap: 12px; flex: none; font-size: 12.5px; color: var(--muted); padding-top: 4px; }
.ti-stats span { display: inline-flex; align-items: center; gap: 4px; }

.badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 600; line-height: 1.7; vertical-align: middle; flex: none;
}
.badge-pin { background: #fff1e6; color: #c2410c; }
.badge-feature { background: #fef3c7; color: #a16207; }
.badge-lock { background: #f1f2f4; color: #6b7280; }
.badge-new { background: var(--brand-soft); color: var(--brand); }

/* ---------------- 侧栏 ---------------- */

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-grid div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stat-grid strong { display: block; font-size: 19px; color: var(--text); }
.stat-grid span { font-size: 12px; color: var(--muted); }

.announce-body { font-size: 13.5px; color: var(--muted); }

.service-card { padding: 16px 18px; }
.service-card h3 { margin: 0 0 6px; font-size: 15px; }
.service-card p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.service-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }

/* ---------------- 板块页 / 列表页 ---------------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; line-height: 1.3; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }
.crumb i { font-style: normal; color: #c3cad4; }

.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar .count { font-size: 13px; color: var(--muted); }

.empty {
  text-align: center; padding: 46px 20px; color: var(--muted); font-size: 14px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty strong { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ---------------- 分页 ---------------- */

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 20px; }
.page-link {
  min-width: 38px; height: 38px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px;
}
.page-link:hover { border-color: var(--brand); color: var(--brand); }
.page-link.current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.page-link.disabled { opacity: .5; pointer-events: none; }
.page-dots { color: var(--muted); padding: 0 2px; }

/* ---------------- 表单 ---------------- */

.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 24px; }
.form-grid { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.field input[type="text"], .field input[type="password"], .field input[type="email"], .field input[type="search"],
.field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); outline: none; font-size: 14.5px; transition: border-color .15s, background .15s;
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); background: #fff; }
.field .counter { font-size: 12px; color: var(--muted); text-align: right; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: var(--danger); font-size: 13px; background: #fdeae8; border: 1px solid #f7cec8; padding: 9px 12px; border-radius: 9px; }

/* ---------------- 主题详情 ---------------- */

.topic-head { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.topic-head h1 { margin: 0 0 10px; font-size: 23px; line-height: 1.45; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topic-sub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.topic-author { display: flex; align-items: center; gap: 8px; }
.topic-author strong { color: var(--text); font-weight: 600; }

.post { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: 0; }
.post-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.post-top .who { display: flex; align-items: center; gap: 8px; }
.post-top .who strong { font-size: 14px; }
.post-top .floor { margin-left: auto; font-size: 12px; color: var(--muted); }
.post-body { font-size: 15px; line-height: 1.85; color: #26303d; word-break: break-word; }
.post-img { display: block; max-width: 100%; max-height: 560px; border-radius: 10px; margin: 10px 0; border: 1px solid var(--line); }
.post-actions { display: flex; gap: 8px; margin-top: 12px; }

.composer { margin-top: 18px; }
.composer-tools { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.composer-tools .left { display: flex; align-items: center; gap: 8px; }
.upload-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.upload-btn:hover { border-color: var(--brand); color: var(--brand); }
.upload-btn input { display: none; }

.locked-tip { background: #fff7e6; border: 1px dashed #f0c36d; color: #92400e; border-radius: 10px; padding: 14px 16px; font-size: 13.5px; }

/* ---------------- 注册 / 登录 ---------------- */

.auth-wrap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: stretch; margin: 10px 0 30px; }
.auth-card { padding: 30px 32px; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.auth-card p.lead { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.auth-aside {
  background: linear-gradient(150deg, #0f766e, #12a08d 70%);
  color: #fff; border-radius: var(--radius); padding: 32px; display: flex; flex-direction: column; justify-content: center;
  box-shadow: var(--shadow);
}
.auth-aside h2 { margin: 0 0 14px; font-size: 22px; }
.auth-aside ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.auth-aside li { display: flex; gap: 10px; font-size: 14px; color: rgba(255,255,255,.9); }
.auth-aside li .icon { color: rgba(255,255,255,.75); }

/* ---------------- 个人中心 ---------------- */

.profile-head { display: flex; align-items: center; gap: 18px; padding: 24px; flex-wrap: wrap; }
.profile-head .avatar { width: 72px; height: 72px; font-size: 28px; }
.profile-head h1 { margin: 0; font-size: 22px; }
.profile-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.profile-stats { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.profile-stats div { text-align: center; }
.profile-stats strong { display: block; font-size: 19px; }
.profile-stats span { font-size: 12px; color: var(--muted); }
.role-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------------- 客服聊天挂件 ---------------- */

.chat-widget { position: fixed; right: 22px; bottom: 24px; z-index: 60; }

.chat-fab {
  width: 56px; height: 56px; border-radius: 50%; border: 0; color: #fff;
  background: linear-gradient(135deg, var(--brand), #16a085);
  box-shadow: 0 10px 26px rgba(15, 118, 110, .35);
  display: flex; align-items: center; justify-content: center; position: relative;
  transition: transform .15s;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.02); }
.chat-fab-dot {
  position: absolute; top: 12px; right: 13px; width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 0 2px rgba(255,255,255,.85);
}
.chat-fab-dot.off { background: #cbd5e1; }

.chat-panel {
  position: absolute; right: 0; bottom: 70px; width: 372px; height: 552px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  display: flex; flex-direction: column; overflow: hidden;
  animation: chatIn .18s ease-out;
}
.chat-panel[hidden] { display: none; }
@keyframes chatIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; color: #fff;
  background: linear-gradient(120deg, #0f766e, #149c88);
}
.chat-head-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.chat-head strong { display: block; font-size: 14px; line-height: 1.3; }
.chat-head small { display: block; font-size: 11.5px; color: rgba(255,255,255,.82); }
.chat-close { background: transparent; border: 0; color: rgba(255,255,255,.9); padding: 6px; border-radius: 8px; }
.chat-close:hover { background: rgba(255,255,255,.15); }

.chat-body { flex: 1; overflow-y: auto; padding: 16px 14px; background: var(--bg); -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb { background: #d7dee6; border-radius: 3px; }
.chat-msg { display: flex; margin-bottom: 12px; }
.chat-msg.visitor { justify-content: flex-end; }
.chat-msg.system { justify-content: center; }
.chat-bubble {
  max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.6;
  background: #fff; border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word;
}
.chat-msg.visitor .chat-bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.agent .chat-bubble { border-bottom-left-radius: 4px; }
.chat-msg.system .chat-bubble { background: transparent; border: 0; color: var(--muted); font-size: 12px; padding: 4px 8px; text-align: center; max-width: 92%; }
.chat-time { font-size: 11px; color: var(--muted); align-self: flex-end; margin: 0 4px 2px; }

.chat-quick { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid var(--line); background: #fff; scrollbar-width: none; }
.chat-quick::-webkit-scrollbar { display: none; }
.quick-chip {
  flex: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; white-space: nowrap;
}
.quick-chip:hover { border-color: var(--brand); color: var(--brand); }

.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: #fff; }
.chat-form textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; max-height: 96px; min-height: 40px; background: var(--surface-2); outline: none;
  font-size: 13.5px; line-height: 1.5;
}
.chat-form textarea:focus { border-color: var(--brand); background: #fff; }
.chat-send {
  width: 40px; height: 40px; border-radius: 12px; border: 0; flex: none;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
}
.chat-send:hover { background: var(--brand-dark); }
.chat-send[disabled] { opacity: .55; }

/* ---------------- 底部 / 移动端导航 ---------------- */

.site-footer { background: #fff; border-top: 1px solid var(--line); margin-top: 30px; padding: 26px 0 14px; }
.footer-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { display: flex; gap: 12px; align-items: flex-start; }
.footer-brand strong { font-size: 15px; }
.footer-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); max-width: 420px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand); }
.footer-copy { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line); }
.footer-copy p { margin: 0; font-size: 12px; color: var(--muted); }

.tabbar { display: none; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1020px) {
  .layout-grid { grid-template-columns: minmax(0, 1fr); }
  .side-col { order: -1; }
  .side-col .card.announce-card { display: block; }
  .nav-main a { padding: 8px 9px; font-size: 14px; }
  .search-inline input { width: 104px; }
}

@media (max-width: 860px) {
  .nav-main { display: none; }
  .search-inline { display: none; }
  .btn-publish span { display: none; }
  .btn-publish { padding: 9px 11px; }
  .brand-text em { display: none; }
  .topbar-inner { gap: 12px; height: 58px; }
  .topbar-right { gap: 8px; }
  .user-chip-link span { display: none; }
  .user-menu { right: -6px; }

  .wrap { padding: 0 14px; }
  .page { padding-top: 14px; padding-bottom: 86px; }

  .hero { padding: 26px 22px; border-radius: 16px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; margin-bottom: 18px; }
  .hero-stats { gap: 18px; margin-top: 20px; }
  .hero-stats strong { font-size: 19px; }

  .layout-grid { margin-top: 16px; gap: 16px; }
  .forum-grid { grid-template-columns: 1fr; }

  .topic-item { padding: 12px 14px; gap: 10px; }
  .ti-stats { display: none; }
  .ti-title { font-size: 15px; }

  .page-head h1 { font-size: 20px; }
  .form-card { padding: 18px; border-radius: 12px; }
  .form-row { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-card { padding: 22px 18px; }

  .topic-head { padding: 18px 16px; }
  .topic-head h1 { font-size: 19px; }
  .post { padding: 16px; }
  .post-body { font-size: 14.5px; }

  .profile-head { padding: 18px; }
  .profile-head .avatar { width: 56px; height: 56px; font-size: 22px; }
  .profile-stats { margin-left: 0; gap: 18px; }

  .site-footer { padding-bottom: 10px; }
  .footer-inner { gap: 14px; }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    display: flex; align-items: center; justify-content: space-around;
    height: 62px; padding: 0 8px calc(2px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(16, 24, 40, .06);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 56px; padding: 6px 4px; border: 0; background: transparent;
    color: var(--muted); font-size: 11.5px; line-height: 1.2;
  }
  .tabbar a.is-active { color: var(--brand); }
  .tabbar .tab-add {
    width: 48px; height: 48px; min-width: 48px; border-radius: 50%;
    background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(15,118,110,.3);
    margin-top: -22px;
  }
  .tabbar .tab-add .icon { stroke-width: 2.2; }

  .chat-widget { right: 14px; bottom: 78px; }
  .chat-fab { width: 50px; height: 50px; }
  .chat-panel {
    position: fixed; inset: 0; width: auto; height: auto; max-height: none;
    border-radius: 0; border: 0; z-index: 100; bottom: 0;
  }
  .chat-body { padding-bottom: 12px; }
  body.chat-open { overflow: hidden; }
}

@media (max-width: 420px) {
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-stats div { min-width: 72px; }
  .ti-avatar .avatar { width: 36px; height: 36px; }
  .card-head { padding: 13px 14px; }
  .card-body { padding: 12px 14px; }
}

/* ==========================================================
   客服工作台
   ========================================================== */

.workbench {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 250px);
  min-height: 520px;
}

.wb-list { display: flex; flex-direction: column; min-height: 0; }
.wb-list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border-bottom: 1px solid var(--line);
}
.wb-list-head h2 { margin: 0; font-size: 15px; }

.wb-filters { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.wb-filters button {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px;
}
.wb-filters button.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.wb-sessions { flex: 1; overflow-y: auto; padding: 6px; }
.wb-placeholder { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 13px; }

.wb-item {
  width: 100%; display: flex; align-items: flex-start; gap: 9px;
  padding: 10px; border: 0; background: transparent; border-radius: 10px; text-align: left;
}
.wb-item:hover { background: var(--surface-2); }
.wb-item.is-current { background: var(--brand-soft); }
.wb-av {
  width: 32px; height: 32px; border-radius: 50%; background: #e2e8f0; color: #475569;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex: none;
}
.wb-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wb-item-title { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; flex-wrap: wrap; }
.wb-item-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-item-time { font-size: 11px; color: var(--muted); flex: none; }
.wb-unread {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: 10.5px; display: inline-flex; align-items: center; justify-content: center;
}

.wb-chat { display: flex; flex-direction: column; min-height: 0; }
.wb-chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.wb-chat-head strong { display: block; font-size: 15px; }
.wb-chat-head small { display: block; font-size: 12px; color: var(--muted); }
.wb-body { flex: 1; overflow-y: auto; padding: 16px; background: var(--bg); min-height: 0; }
.wb-form { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; }
.wb-form textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; min-height: 42px; max-height: 120px; background: var(--surface-2); outline: none;
  font-size: 14px; line-height: 1.5;
}
.wb-form textarea:focus { border-color: var(--brand); background: #fff; }

@media (max-width: 900px) {
  .workbench { grid-template-columns: 1fr; height: auto; gap: 14px; }
  .wb-list { max-height: 260px; }
  .wb-chat { height: 66vh; min-height: 380px; }
  .wb-body { padding: 12px; }
}

/* 数据表格（安装自检页与后台共用） */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); font-size: 12.5px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }


