:root {
  --brand: #111111;        /* 主色:近黑 */
  --brand-dark: #000000;   /* 更深:纯黑 */
  --navy: #262626;         /* 深灰 */
  --ink: #18181b;
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #f5f5f5;
  --card: #ffffff;
  --accent: #525252;       /* 中灰点缀 */
  --ok: #1f8a52;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 顶栏 ---- */
.navbar {
  background: linear-gradient(100deg, var(--brand-dark), var(--brand));
  color: #fff;
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 16px;
  height: 58px; display: flex; align-items: center; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 19px; white-space: nowrap; flex-shrink: 0; }
.logo:hover { text-decoration: none; }
.logo .badge {
  background: #fff; color: var(--brand); border-radius: 6px;
  padding: 2px 8px; font-weight: 800; letter-spacing: .5px; font-size: 15px;
}
.logo-site {
  color: #fff; opacity: .82; font-size: 12.5px; font-weight: 500;
  border: 1px solid rgba(255,255,255,.4); border-radius: 20px; padding: 2px 10px;
  margin-left: 2px;
}
.logo-site:hover { opacity: 1; text-decoration: none; background: rgba(255,255,255,.12); }
.nav-search { margin-left: 10px; }
.nav-search input {
  width: 180px; padding: 7px 14px; border: none; border-radius: 20px;
  background: rgba(255,255,255,.18); color: #fff; font-size: 13px; transition: width .2s, background .2s;
}
.nav-search input::placeholder { color: rgba(255,255,255,.7); }
.nav-search input:focus { outline: none; width: 230px; background: rgba(255,255,255,.28); }
.nav-spacer { flex: 1; }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.nav-user a { color: #fff; opacity: .95; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
a.avatar:hover { text-decoration: none; opacity: .9; }

/* ---- 布局 ---- */
.container { max-width: 1040px; margin: 22px auto; padding: 0 16px; }
.breadcrumb { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 18px; }

/* ---- 版块分组 ---- */
.group-title {
  font-size: 15px; font-weight: 700; color: var(--navy);
  padding: 12px 16px; background: #fbfbfc; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.group-title::before {
  content: ''; width: 4px; height: 15px; background: var(--brand); border-radius: 2px;
}
.cat-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: none; }
.cat-icon {
  width: 42px; height: 42px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--navy), #334366);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; letter-spacing: .3px;
}
.cat-main { flex: 1; min-width: 0; }
.cat-main .name { font-weight: 600; font-size: 15px; }
.cat-main .desc { color: var(--muted); font-size: 13px; margin-top: 1px; }
.cat-stat { color: var(--muted); font-size: 13px; text-align: center; min-width: 70px; }
.cat-stat b { display: block; color: var(--ink); font-size: 15px; }

/* ---- 主题列表 ---- */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fbfbfc;
}
.list-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.thread-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: #fafbfc; }
.thread-main { flex: 1; min-width: 0; }
.thread-title { font-weight: 600; font-size: 15px; display: block; }
.thread-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.thread-meta .cat-tag { color: var(--navy); }
.thread-stat { color: var(--muted); font-size: 12.5px; text-align: center; min-width: 56px; }
.thread-stat b { display: block; color: var(--ink); }

.tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: 1px;
}
.tag.pin { background: #ededed; color: var(--brand); }
.tag.essence { background: #fff4d9; color: #a8780d; }

/* ---- 主题详情 / 帖子 ---- */
.post {
  display: flex; gap: 14px; padding: 18px 16px; border-bottom: 1px solid var(--line);
}
.post:last-child { border-bottom: none; }
.post-side { width: 92px; flex-shrink: 0; text-align: center; }
.post-side .avatar { width: 48px; height: 48px; font-size: 20px; margin: 0 auto 6px; }
.post-side .uname { font-weight: 600; font-size: 13px; word-break: break-all; }
.post-side .ulevel { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.post-body { flex: 1; min-width: 0; }
.post-body .ptime { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.post-body .ptext { white-space: pre-wrap; word-wrap: break-word; }
.post-title {
  font-size: 21px; font-weight: 700; color: var(--ink);
  padding: 16px 16px 0; margin: 0; line-height: 1.4;
}

/* ---- 表单 / 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: none;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s; white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: #f5f5f5; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--navy); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17,17,17,.1);
}

.form-wrap { max-width: 440px; margin: 40px auto; }
.form-wrap.wide { max-width: 720px; }
.form-wrap .pad { padding: 24px; }
.form-wrap h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
.form-wrap .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.form-foot { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 16px; }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.error { background: #fdeaea; color: #b3261e; }
.msg.ok { background: #e7f6ee; color: var(--ok); }

/* ---- 分页 ---- */
.pager { display: flex; justify-content: center; gap: 6px; padding: 16px; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; font-size: 13.5px; color: var(--ink);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ---- 其它 ---- */
.empty { text-align: center; color: var(--muted); padding: 50px 16px; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 40px 16px; }
.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 28px 16px 40px; max-width: 1040px; margin: 0 auto; }
.footer-main { font-size: 13px; color: var(--ink); }
.footer-main a { color: var(--brand); }
.footer-sub { margin-top: 8px; line-height: 1.7; color: var(--muted); max-width: 760px; margin-left: auto; margin-right: auto; }

/* 首页 hero */
.hero { padding: 26px 20px; margin-bottom: 18px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--navy), #2d4066); color: #fff; box-shadow: var(--shadow); }
.hero h1 { margin: 0 0 6px; font-size: 23px; }
.hero p { margin: 0; opacity: .9; font-size: 14px; }
.hero-search { display: flex; gap: 8px; margin-top: 16px; max-width: 560px; }
.hero-search input { flex: 1; padding: 11px 16px; border: none; border-radius: 10px; font-size: 14.5px; }
.hero-search input:focus { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.hero-search .btn { background: #fff; color: var(--brand); }
.hero-search .btn:hover { background: #f3f3f3; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 22px;
  padding-top: 18px; border-top: 1px solid rgba(255,255,255,.18); }
.hero-stats .stat { display: flex; flex-direction: column; }
.hero-stats .stat b { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.hero-stats .stat span { font-size: 12.5px; opacity: .72; margin-top: 2px; }

/* 版块页标题 */
.cat-h1 { margin: 0; font-size: 18px; color: var(--navy); }
.cat-h1-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* 搜索页 */
.search-page-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-page-form input {
  flex: 1; padding: 11px 16px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: #fff;
}
.search-page-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17,17,17,.1); }
.search-snippet { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.6; }
.search-snippet mark, .thread-title mark { background: #fff2b8; color: inherit; padding: 0 1px; border-radius: 2px; }

@media (max-width: 680px) {
  .nav-search { display: none; }
}

/* 用户中心 */
.profile-card {
  display: flex; align-items: center; gap: 18px; padding: 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-weight: 700; font-size: 28px;
  display: flex; align-items: center; justify-content: center;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 19px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); background: #fbfbfc; }
.tab {
  border: none; background: none; padding: 13px 18px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab span { font-weight: 400; font-size: 12px; }
.pw-form { padding: 20px; max-width: 400px; }
.reply-box { padding: 16px; }
.reply-box h3 { margin: 0 0 12px; font-size: 15px; color: var(--navy); }
.login-hint { padding: 20px 16px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- 管理员 ---- */
.admin-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: #fbf3f5; border-bottom: 1px solid var(--line);
}
.admin-tag {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--brand);
  padding: 2px 8px; border-radius: 4px; margin-right: 4px;
}
.admin-danger { color: #b3261e; border-color: #e3b4b0; }
.admin-danger:hover { background: #fdeaea; }
.post-edit { font-size: 12px; color: var(--navy); margin-left: 8px; }
.post-edit:hover { color: var(--brand); text-decoration: underline; }
.edited { color: var(--muted); font-size: 12px; }
.edit-box { margin-top: 6px; }
.edit-box .edit-title { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; margin-bottom: 8px; }
.edit-box .edit-text { width: 100%; min-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; line-height: 1.6; resize: vertical; }
.edit-box .edit-title:focus, .edit-box .edit-text:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(17,17,17,.1); }
.edit-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.post-del { font-size: 12px; color: #b3261e; margin-left: 8px; }
.post-del:hover { text-decoration: underline; }

/* 隐藏块 / 门控内容 */
.gated { margin: 10px 0; }
.gated.open { background: #f0f9f1; border: 1px dashed #9ccfa3; border-radius: 8px; padding: 10px 14px; }
.gated.locked { background: #fbf3f5; border: 1px dashed #e3b4b0; border-radius: 8px; padding: 14px; color: var(--muted); font-size: 13.5px; text-align: center; }
.gated.locked.big { padding: 28px 16px; font-size: 14.5px; }
.gated.locked a { color: var(--brand); font-weight: 600; }
.lock-ic { margin-right: 4px; }
.field-hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.6; }
.field-hint code { background: #f0f1f3; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ================= 后台管理 ================= */
.admin-wrap { max-width: 1100px; margin: 22px auto; padding: 0 16px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.admin-head h1 { margin: 0; font-size: 22px; color: var(--navy); }
.admin-sub { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat-card.s1::before { background: #111111; } .stat-card.s2::before { background: #525252; }
.stat-card.s3::before { background: #a3a3a3; } .stat-card.s4::before { background: #737373; }
.stat-card.s5::before { background: #e06c2f; }
.stat-ico {
  width: 46px; height: 46px; border-radius: 12px; background: #f4f5f7;
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-num { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* 管理卡片 */
.admin-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-top: 20px; overflow: hidden; }
.admin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-card-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.admin-search input { width: 260px; max-width: 60vw; padding: 8px 12px; border: 1px solid var(--line); border-radius: 20px; font-size: 13.5px; background: #fbfbfc; }
.admin-search input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(17,17,17,.08); }

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { background: #fbfbfc; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: none; letter-spacing: .2px; white-space: nowrap; }
.admin-table tbody tr:hover { background: #fafbfc; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }
.admin-table .nowrap { white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.admin-table .muted { color: var(--muted); }
.ta-r { text-align: right; } .ta-c { text-align: center; }

/* 用户单元格 */
.u-cell { display: flex; align-items: center; gap: 10px; }
.u-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.u-name { font-weight: 600; color: var(--ink); }
.u-mail { color: var(--muted); font-size: 12px; }
.u-me { font-size: 10px; background: var(--navy); color: #fff; border-radius: 4px; padding: 0 5px; vertical-align: 1px; }

.badge-role { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: #eef0f3; color: var(--navy); white-space: nowrap; }
.badge-role.admin { background: #ededed; color: var(--brand); }
.badge-role.owner { background: #111111; color: #fff; }

.admin-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 22px 16px 40px; }

/* 设置行 + 开关 */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; }
.setting-name { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.setting-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; max-width: 640px; line-height: 1.6; }
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: #ccd0d6; border-radius: 26px; transition: .25s; }
.switch-slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .switch-slider { background: var(--ok); }
.switch input:checked + .switch-slider::before { transform: translateX(22px); }
.switch input:disabled + .switch-slider { opacity: .6; }

/* ---- 分享栏 ---- */
.share-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); background: #fbfbfc; }
.share-label { color: var(--muted); font-size: 13px; }
.share-btn { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.share-btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.share-btn.wa:hover { border-color: #25d366; color: #128c3e; }
.share-btn.wx:hover { border-color: #09b83e; color: #09b83e; }
.share-btn.wb:hover { border-color: #e6162d; color: #e6162d; }
.share-btn.fav { border-color: var(--accent); color: #a8780d; margin-right: auto; }
.share-btn.fav.on { background: #fff4d9; border-color: var(--accent); color: #a8780d; }
.share-btn.fav:hover { border-color: var(--accent); color: #a8780d; }

/* 微信二维码弹窗 */
.wx-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 999; }
.wx-pop { background: #fff; border-radius: 12px; padding: 24px; text-align: center; max-width: 300px; }
.wx-title { font-weight: 700; font-size: 16px; color: var(--navy); margin-bottom: 14px; }
.wx-tip { color: var(--muted); font-size: 12.5px; margin: 12px 0 16px; line-height: 1.6; }

@media (max-width: 640px) {
  .cat-stat, .thread-stat { display: none; }
  .post-side { width: 64px; }
  .post-side .avatar { width: 38px; height: 38px; font-size: 16px; }
  .nav-inner { gap: 8px; padding: 0 12px; height: 54px; }
  .logo { font-size: 17px; gap: 7px; }
  .logo .badge { font-size: 13px; padding: 2px 6px; }
  .logo-site { display: none; }          /* 移动端隐藏官网胶囊 */
  .nav-user { gap: 10px; font-size: 13px; }
  .nav-user .btn.sm { padding: 6px 10px; }
  .btn-label { display: none; }          /* "+发帖" 只留 "+" */
  .nav-user .btn.sm .plus { font-size: 17px; line-height: 1; }
}
@media (max-width: 400px) {
  .nav-user { gap: 8px; }
  .nav-link-text { font-size: 12.5px; }
}
