/* ==========================================================
   夜与梦 —— 主题样式
   ========================================================== */
:root {
  --brand: #6c5ce7;
  --brand-2: #4e7cff;
  --brand-soft: #f0eeff;
  --accent: #ff6b6b;
  --success: #00b894;
  --warn: #fdcb6e;
  --danger: #e74c3c;
  --gold: #f9a826;

  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --card: #ffffff;
  --text: #232a34;
  --text-2: #576070;
  --muted: #93a0b4;
  --border: #e6eaf2;
  --border-2: #d9dfea;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 2px 10px rgba(30, 40, 70, .05);
  --shadow-md: 0 8px 26px rgba(30, 40, 70, .09);
  --shadow-lg: 0 18px 50px rgba(30, 40, 70, .16);
  --header-h: 62px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-2); }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; font-weight: 700; line-height: 1.35; }
p { margin: 0 0 .9em; }
ul, ol { margin: 0 0 .9em; padding-left: 1.4em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
code { background: #f1f3f8; padding: 2px 6px; border-radius: 5px; font-size: 13px; color: #d6336c; }
pre { background: #282c34; color: #e6e6e6; padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 12px 0; }
pre code { background: none; color: inherit; padding: 0; font-size: 13px; }
blockquote {
  margin: 12px 0; padding: 10px 16px; border-left: 4px solid var(--brand);
  background: var(--brand-soft); border-radius: 0 8px 8px 0; color: var(--text-2);
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ===================== 顶部导航 ===================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(30, 40, 70, .04);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 17px; color: var(--text); white-space: nowrap;
}
.logo:hover { color: var(--brand); }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center; font-size: 17px;
  box-shadow: 0 4px 12px rgba(108, 92, 231, .35);
}
.main-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.main-nav a {
  padding: 7px 11px; border-radius: 8px; color: var(--text-2);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.main-nav a:hover { background: var(--bg-2); color: var(--brand); }
.main-nav a.active { background: var(--brand-soft); color: var(--brand); }

.header-search { position: relative; flex: 0 0 210px; }
.header-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid var(--border-2); border-radius: 20px; background: var(--bg-2);
  font-size: 13px; outline: none; transition: .15s;
}
.header-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.header-search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; color: var(--text-2); background: transparent;
  border: 0; cursor: pointer; font-size: 17px; transition: .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--brand); }
.badge-dot {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #fff; border-radius: 9px; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff; line-height: 1;
}

/* 用户菜单 */
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 22px; background: var(--bg-2); cursor: pointer; border: 0; font-size: 13px; font-weight: 600;
  color: var(--text); transition: .15s;
}
.user-chip:hover { background: var(--brand-soft); }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 7px; z-index: 200; display: none;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px;
  border-radius: 8px; color: var(--text-2); font-size: 14px; font-weight: 500;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg-2); color: var(--brand); }
.dropdown .divider { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown .dd-head { padding: 9px 11px 11px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown .dd-head .nm { font-weight: 700; color: var(--text); }
.dropdown .dd-head .tt { font-size: 12px; color: var(--muted); }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 17px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .16s;
  background: var(--bg-2); color: var(--text); white-space: nowrap;
}
.btn:hover { filter: brightness(.97); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 14px rgba(108, 92, 231, .3); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--gold); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border-2); color: var(--text-2); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ===================== 卡片 ===================== */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: #fafbfe; border-radius: 0 0 var(--radius) var(--radius); }

/* ===================== 布局 ===================== */
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; padding: 18px 0 40px; }
.layout-full { padding: 18px 0 40px; }
.sidebar { position: sticky; top: calc(var(--header-h) + 18px); }

/* ===================== 首页：板块网格 ===================== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 12px; }
.cat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; gap: 13px; transition: .18s; box-shadow: var(--shadow);
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.cat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; flex: 0 0 46px; color: #fff;
}
.cat-info { min-width: 0; flex: 1; }
.cat-name { font-weight: 700; font-size: 15px; margin-bottom: 3px; }
.cat-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; }
.cat-meta b { color: var(--text-2); font-weight: 700; }

/* ===================== Tab 过滤 ===================== */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a {
  padding: 6px 13px; border-radius: 20px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); background: #fff; border: 1px solid var(--border);
}
.tabs a:hover { border-color: var(--brand); color: var(--brand); }
.tabs a.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }

/* ===================== 帖子列表 ===================== */
.thread-list { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.thread-item {
  display: flex; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  transition: background .15s; align-items: flex-start;
}
.thread-item:last-child { border-bottom: 0; }
.thread-item:hover { background: #fafbff; }
.thread-item.pinned { background: linear-gradient(90deg, #fffaf0, #fff); }
.avatar {
  width: 40px; height: 40px; border-radius: 11px; object-fit: cover; flex: 0 0 40px;
  background: var(--bg-2); box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}
.avatar.sm { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
.avatar.lg { width: 68px; height: 68px; flex-basis: 68px; border-radius: 16px; }
.avatar-round { border-radius: 50%; }
.thread-main { flex: 1; min-width: 0; }
.thread-title {
  font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 1.45;
}
.thread-title a { color: var(--text); }
.thread-title a:hover { color: var(--brand); }
.thread-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.thread-meta .author { color: var(--text-2); font-weight: 600; }
.thread-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex: 0 0 auto; padding-top: 3px; }
.thread-stats b { display: block; text-align: center; color: var(--text-2); font-size: 14px; font-weight: 700; }
.thread-cat-link {
  font-size: 12px; padding: 2px 9px; border-radius: 6px; font-weight: 600; flex: 0 0 auto;
  color: #fff; display: inline-block;
}

/* 标签 */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px;
  font-weight: 600; background: var(--bg-2); color: var(--text-2); margin-right: 5px;
}
.tag:hover { background: var(--brand-soft); color: var(--brand); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.pill {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; line-height: 1.6;
}
.pill-top { background: #ffeaa7; color: #b8860b; }
.pill-pin { background: #ffe0e0; color: #d63031; }
.pill-good { background: #d6f5e3; color: #0a8a5a; }
.pill-lock { background: #e4e8f0; color: #6b7280; }
.pill-poll { background: #e3f2fd; color: #1565c0; }
.pill-question { background: #fff3e0; color: #e65100; }
.pill-guide { background: #f3e8ff; color: #7b1fa2; }

/* 头衔 */
.title-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; border: 1px solid currentColor; line-height: 1.55;
}
.role-admin { color: #d63031; }
.role-mod { color: #0984e3; }

/* 等级进度条 */
.exp-bar { height: 6px; background: var(--bg-2); border-radius: 4px; overflow: hidden; margin: 6px 0 3px; }
.exp-bar > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .4s; }

/* ===================== 侧边栏组件 ===================== */
.side-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.side-card h3 {
  margin: 0; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.side-card h3 .more { font-size: 12px; font-weight: 500; color: var(--muted); }
.side-card .body { padding: 14px 16px; }

.checkin-card { background: linear-gradient(135deg, #6c5ce7, #4e7cff); color: #fff; border: 0; }
.checkin-card h3 { border-bottom-color: rgba(255, 255, 255, .18); color: #fff; }
.checkin-card .body { padding: 16px; }
.checkin-streak { font-size: 30px; font-weight: 800; line-height: 1; margin: 4px 0 2px; }
.checkin-card .sub { font-size: 12.5px; opacity: .85; margin-bottom: 12px; }
.btn-checkin {
  width: 100%; padding: 11px; border-radius: 10px; border: 0; cursor: pointer;
  background: #fff; color: var(--brand); font-weight: 800; font-size: 14.5px; transition: .15s;
}
.btn-checkin:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.btn-checkin:disabled { background: rgba(255, 255, 255, .22); color: rgba(255, 255, 255, .85); cursor: default; }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.rank-list li:last-child { border-bottom: 0; }
.rank-no {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; background: var(--bg-2); color: var(--muted); flex: 0 0 20px;
}
.rank-no.t1 { background: linear-gradient(135deg, #ffd700, #ffb142); color: #fff; }
.rank-no.t2 { background: linear-gradient(135deg, #dfe6e9, #b2bec3); color: #fff; }
.rank-no.t3 { background: linear-gradient(135deg, #e8a87c, #cd7f32); color: #fff; }
.rank-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-exp { font-size: 12px; color: var(--muted); font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: var(--bg-2); border-radius: 10px; padding: 10px; text-align: center; }
.stat-box b { display: block; font-size: 18px; font-weight: 800; color: var(--brand); }
.stat-box span { font-size: 11.5px; color: var(--muted); }

.topic-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; color: #fff;
}
.notice-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.notice-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); }
.notice-list li:last-child { border-bottom: 0; }

/* ===================== 帖子详情 ===================== */
.thread-head { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; box-shadow: var(--shadow); }
.thread-head h1 { font-size: 23px; margin-bottom: 10px; line-height: 1.4; }
.thread-head-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.thread-head-meta .avatar { width: 36px; height: 36px; flex-basis: 36px; }

.post-item {
  display: flex; gap: 14px; padding: 18px; border-bottom: 1px solid var(--border);
  background: #fff; position: relative;
}
.post-item:last-child { border-bottom: 0; }
.post-item.op .post-body-wrap { background: #fcfcff; border-radius: 10px; padding: 12px 14px; }
.post-side { flex: 0 0 92px; text-align: center; }
.post-side .avatar { width: 56px; height: 56px; flex-basis: 56px; margin: 0 auto 6px; border-radius: 14px; }
.post-side .pname { font-size: 13px; font-weight: 700; word-break: break-all; margin-bottom: 4px; }
.post-main { flex: 1; min-width: 0; }
.post-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.floor-tag {
  position: absolute; right: 16px; top: 14px; font-size: 12px; color: var(--border-2); font-weight: 700;
}
.post-content { font-size: 15px; line-height: 1.8; color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; }
.post-content img.md-img { max-width: 100%; border-radius: 10px; margin: 8px 0; }
.post-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.act-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--bg-2);
  border: 0; cursor: pointer; transition: .15s;
}
.act-btn:hover { background: var(--brand-soft); color: var(--brand); }
.act-btn.on { background: var(--brand-soft); color: var(--brand); }
.act-btn.danger:hover { background: #ffeaea; color: var(--danger); }

.sub-replies { background: #fafbfe; border-radius: 10px; padding: 10px 12px; margin-top: 12px; }
.sub-reply { display: flex; gap: 8px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px dashed var(--border); }
.sub-reply:last-child { border-bottom: 0; }
.sub-reply .avatar { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; }
.sub-reply .sr-body { flex: 1; min-width: 0; }
.sub-reply .sr-name { font-weight: 700; color: var(--brand); font-size: 13px; }

.best-flag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px;
  background: #e8f7ef; color: #0a8a5a; font-size: 11.5px; font-weight: 700;
}

/* 投票区 */
.poll-box { background: #fafbff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 14px 0; }
.poll-title { font-weight: 700; margin-bottom: 10px; font-size: 14.5px; }
.poll-option {
  position: relative; border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 14px;
  margin-bottom: 9px; cursor: pointer; overflow: hidden; background: #fff; transition: .15s;
  display: flex; align-items: center; gap: 10px;
}
.poll-option:hover { border-color: var(--brand); }
.poll-option.selected { border-color: var(--brand); background: var(--brand-soft); }
.poll-option.voted { cursor: default; }
.poll-option .fill {
  position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(108, 92, 231, .18), rgba(78, 124, 255, .12));
  transition: width .5s cubic-bezier(.2, .8, .3, 1); z-index: 0;
}
.poll-option > * { position: relative; z-index: 1; }
.poll-option .pct { margin-left: auto; font-weight: 700; color: var(--brand); font-size: 13px; }
.poll-option .cnt { font-size: 12px; color: var(--muted); }
.poll-check {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-2); flex: 0 0 18px;
  display: grid; place-items: center; font-size: 11px; color: #fff;
}
.poll-option.selected .poll-check { background: var(--brand); border-color: var(--brand); }
.poll-meta { font-size: 12.5px; color: var(--muted); margin-top: 10px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ===================== 编辑器 ===================== */
.editor-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.editor-toolbar {
  display: flex; gap: 3px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: #fafbfe; flex-wrap: wrap;
}
.editor-toolbar button {
  padding: 5px 10px; border: 0; background: transparent; border-radius: 7px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.editor-toolbar button:hover { background: var(--brand-soft); color: var(--brand); }
.form-row { margin-bottom: 16px; }
.form-label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 6px; color: var(--text-2); }
.form-label .req { color: var(--accent); }
.input, .textarea, .select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-2); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; color: var(--text); background: #fff; outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108, 92, 231, .12); }
.textarea { min-height: 190px; resize: vertical; line-height: 1.75; }
.textarea.short { min-height: 110px; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }

/* 投票选项编辑 */
.poll-editor { background: #fafbfe; border: 1px dashed var(--border-2); border-radius: 12px; padding: 14px; }
.poll-opt-row { display: flex; gap: 8px; margin-bottom: 8px; }
.poll-opt-row .input { flex: 1; }

/* ===================== 提示消息 ===================== */
.messages { margin-bottom: 14px; }
.msg {
  padding: 11px 15px; border-radius: 10px; margin-bottom: 9px; font-size: 14px;
  display: flex; align-items: center; gap: 9px; border: 1px solid transparent;
}
.msg-success { background: #e8f7ef; color: #0a8a5a; border-color: #b8e6cd; }
.msg-error, .msg-danger { background: #ffeaea; color: #c0392b; border-color: #f5c6c6; }
.msg-warn { background: #fff6e0; color: #b8860b; border-color: #ffe4a0; }
.msg-info { background: #e8f1ff; color: #1565c0; border-color: #c3ddff; }
.error-box { background: #ffeaea; border: 1px solid #f5c6c6; color: #c0392b; padding: 12px 15px; border-radius: 10px; margin-bottom: 14px; }
.error-box ul { margin: 0; padding-left: 18px; }

/* 空状态 */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ico { font-size: 46px; margin-bottom: 10px; opacity: .55; }
.empty p { margin: 0 0 14px; }

/* ===================== 分页 ===================== */
.pagination { display: flex; gap: 5px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 13px; border-radius: 9px; background: #fff; border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled { opacity: .45; }

/* ===================== 用户主页 ===================== */
.profile-head {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: var(--radius); padding: 26px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.profile-head::after {
  content: ''; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px;
  background: rgba(255, 255, 255, .09); border-radius: 50%;
}
.profile-head .ph-inner { position: relative; z-index: 1; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-avatar {
  width: 92px; height: 92px; border-radius: 22px; object-fit: cover;
  border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); background: #fff;
}
.profile-name { font-size: 24px; font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.profile-sub { font-size: 13.5px; opacity: .9; margin-bottom: 10px; }
.profile-exp { max-width: 340px; }
.profile-exp .bar { height: 8px; background: rgba(255, 255, 255, .28); border-radius: 5px; overflow: hidden; }
.profile-exp .bar > i { display: block; height: 100%; background: #fff; border-radius: 5px; }
.profile-exp .txt { font-size: 12px; margin-top: 5px; opacity: .9; }
.profile-stats { display: flex; gap: 26px; margin-left: auto; }
.profile-stats div { text-align: center; }
.profile-stats b { display: block; font-size: 22px; font-weight: 800; }
.profile-stats span { font-size: 12px; opacity: .85; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(126px, 1fr)); gap: 10px; }
.badge-item {
  background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 12px 10px; text-align: center;
}
.badge-item .bi { font-size: 26px; margin-bottom: 5px; }
.badge-item .bn { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.badge-item .bd { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* ===================== 后台 ===================== */
.admin-layout { display: grid; grid-template-columns: 210px 1fr; gap: 18px; padding: 18px 0 40px; align-items: start; }
.admin-side { position: sticky; top: calc(var(--header-h) + 18px); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-side .as-title { padding: 14px 16px; font-weight: 800; font-size: 14px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.admin-side a {
  display: flex; align-items: center; gap: 9px; padding: 10px 16px; font-size: 14px;
  color: var(--text-2); border-bottom: 1px solid #f4f6fb; font-weight: 600;
}
.admin-side a:hover { background: var(--bg-2); color: var(--brand); }
.admin-side a.active { background: var(--brand-soft); color: var(--brand); border-left: 3px solid var(--brand); }
.admin-side a .cnt { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 700; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 13px; box-shadow: var(--shadow);
}
.stat-card .sci { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff; }
.stat-card .scv { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-card .scl { font-size: 12.5px; color: var(--muted); }

.chart-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 14px; }
.bar-group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; position: relative; }
.bar { width: 26%; border-radius: 5px 5px 0 0; min-height: 3px; transition: height .6s cubic-bezier(.2, .8, .3, 1); position: relative; }
.bar:hover::after {
  content: attr(data-v); position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 5px; white-space: nowrap;
}
.bar-users { background: linear-gradient(180deg, #6c5ce7, #a29bfe); }
.bar-threads { background: linear-gradient(180deg, #00b894, #55efc4); }
.bar-posts { background: linear-gradient(180deg, #fdcb6e, #ffeaa7); }
.chart-labels { display: flex; gap: 10px; margin-top: 8px; }
.chart-labels div { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.chart-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 11px 14px; background: #fafbfe; font-size: 12.5px; font-weight: 700;
  color: var(--text-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #f2f4f9; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbff; }
.cell-user { display: flex; align-items: center; gap: 9px; }
.cell-user img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; }
.cell-user .cu-name { font-weight: 600; }
.cell-user .cu-sub { font-size: 12px; color: var(--muted); }
.cell-banned { color: var(--danger); font-weight: 700; }

/* 表单行（后台） */
.inline-form { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.inline-form .input, .inline-form .select { width: auto; min-width: 110px; padding: 6px 10px; font-size: 13.5px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 140px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.switch input { width: 17px; height: 17px; accent-color: var(--brand); }

.tag-input-row { display: flex; gap: 7px; flex-wrap: wrap; }

/* ===================== 模态框 ===================== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 26, 40, .5); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%;
  max-width: 460px; max-height: 88vh; overflow-y: auto; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: 0; background: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: #fafbfe; border-radius: 0 0 16px 16px; }

/* ===================== Toast ===================== */
.toast-wrap { position: fixed; top: 76px; right: 20px; z-index: 900; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: #fff; border-left: 4px solid var(--brand); border-radius: 10px; padding: 12px 17px;
  box-shadow: var(--shadow-lg); font-size: 14px; min-width: 200px; max-width: 340px;
  animation: slideIn .22s ease-out; display: flex; gap: 9px; align-items: flex-start;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--gold); }

/* ===================== 页脚 ===================== */
.site-footer {
  background: #fff; border-top: 1px solid var(--border); padding: 26px 0; margin-top: 30px;
  color: var(--muted); font-size: 13px;
}
.site-footer .foot-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--brand); }
.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ===================== 认证页 ===================== */
.auth-page { max-width: 420px; margin: 40px auto; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 30px; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 21px; margin-bottom: 5px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.code-input {
  font-size: 26px !important; letter-spacing: 10px; text-align: center; font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.code-tip {
  background: #fff6e0; border: 1px dashed #ffe4a0; color: #b8860b;
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px;
}
.code-tip b { font-family: ui-monospace, monospace; font-size: 16px; letter-spacing: 3px; }

/* ===================== 头像选择 ===================== */
.avatar-uploader { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.avatar-preview {
  width: 96px; height: 96px; border-radius: 20px; object-fit: cover; border: 3px solid #fff;
  box-shadow: var(--shadow-md); background: var(--bg-2);
}
.frame-list { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 10px; }
.frame-opt {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--border-2); cursor: pointer;
  display: grid; place-items: center; font-size: 20px; background: var(--bg-2); transition: .15s;
}
.frame-opt.on { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.06); }

/* ===================== 签到日历 ===================== */
.checkin-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  border-radius: var(--radius); padding: 30px; text-align: center; box-shadow: var(--shadow-md);
}
.checkin-hero .big { font-size: 46px; font-weight: 800; line-height: 1.1; }
.checkin-hero .lbl { font-size: 13.5px; opacity: .9; margin-bottom: 18px; }
.checkin-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; margin-top: 16px; }
.checkin-day {
  aspect-ratio: 1; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center;
  font-size: 12.5px; color: var(--muted); font-weight: 700;
}
.checkin-day.on { background: linear-gradient(135deg, var(--gold), #ffcc5c); color: #fff; box-shadow: 0 3px 10px rgba(249, 168, 38, .35); }

/* ===================== 响应式 ===================== */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .admin-side a { display: inline-flex; }
  .main-nav { display: none; }
}
@media (max-width: 640px) {
  .header-search { display: none; }
  .post-side { flex-basis: 56px; }
  .post-side .avatar { width: 44px; height: 44px; flex-basis: 44px; }
  .thread-stats { display: none; }
  .profile-stats { margin-left: 0; gap: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .password-row { flex-direction: column; }
}

/* 隐藏 */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warn { color: #e6a700; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: #f1f3ff;
  color: var(--brand, #6c5ce7);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
