:root {
  --navy: #0d3c78;
  --navy-2: #15539e;
  --orange: #f57c00;
  --orange-2: #ff9d2e;
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7785;
  --line: #e2e8f0;
  --green: #2e9e5b;
  --red: #e0533d;
  --radius: 12px;
  --shadow: 0 6px 18px rgba(13, 60, 120, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { background: var(--orange); color: #fff; border-radius: 8px; padding: 4px 9px; font-size: 15px; letter-spacing: 1px; }
.brand-text { font-size: 18px; }
.nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.nav > a { color: #dce6f5; font-weight: 500; }
.nav > a.active { color: #fff; }
.nav > a:hover { color: #fff; text-decoration: none; }
.nav-auth { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }

/* 按钮基类 */
.btn { display: inline-block; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; font-weight: 600; transition: .15s; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-2); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Hero */
.hero { background: linear-gradient(120deg, var(--navy) 0%, #1b5fb0 60%, var(--navy-2) 100%); color: #fff; padding: 46px 18px 40px; }
.hero-inner { max-width: 780px; margin: 0 auto; text-align: center; }
.hero h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: 1px; }
.hero p { margin: 0 0 22px; color: #d8e6fa; font-size: 16px; }
.hero-search { display: flex; max-width: 520px; margin: 0 auto; background: #fff; border-radius: 999px; padding: 5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.hero-search input { flex: 1; border: none; outline: none; padding: 10px 18px; font-size: 15px; border-radius: 999px; color: var(--text); }
.hero-search button { border: none; background: var(--orange); color: #fff; border-radius: 999px; padding: 10px 26px; font-weight: 700; cursor: pointer; }
.hero-search button:hover { background: var(--orange-2); }

/* 容器 */
.container { max-width: 1100px; margin: 26px auto; padding: 0 18px 50px; }
.loading { text-align: center; color: var(--muted); padding: 40px; }

/* 卡片网格 */
.grid { display: grid; gap: 18px; }
.boards { grid-template-columns: repeat(4, 1fr); }
.cards { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .boards { grid-template-columns: repeat(2, 1fr); } .cards { grid-template-columns: 1fr; } }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; transition: .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(13,60,120,.14); }
.board-card { text-align: center; cursor: pointer; }
.board-icon { font-size: 30px; }
.board-card h3 { margin: 10px 0 6px; color: var(--navy); font-size: 17px; }
.board-card p { margin: 0; color: var(--muted); font-size: 13px; }
.board-count { display: inline-block; margin-top: 10px; background: #eef4fb; color: var(--navy); border-radius: 999px; padding: 2px 12px; font-size: 12px; }

.post-card { display: flex; flex-direction: column; gap: 8px; }
.post-card .pc-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.tag { background: #eef4fb; color: var(--navy); border-radius: 6px; padding: 2px 9px; font-size: 12px; }
.tag-pin { background: var(--orange); color: #fff; }
.tag-pending { background: #fff3e0; color: #b26a00; }
.post-card h3 { margin: 2px 0; font-size: 17px; color: var(--text); }
.post-card .excerpt { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.post-card .pc-bottom { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); }

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 16px; }
.section-title h2 { font-size: 20px; margin: 0; color: var(--navy); }

/* 帖子详情 */
.post-detail { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.post-detail h1 { margin: 4px 0 12px; font-size: 26px; }
.post-meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.post-body { font-size: 15px; word-break: break-word; }
.post-body img { max-width: 100%; border-radius: 8px; margin: 10px 0; }
.post-body a { color: var(--navy-2); }
.attachment { display: inline-flex; align-items: center; gap: 8px; background: #eef4fb; color: var(--navy); border-radius: 8px; padding: 10px 14px; margin: 14px 0; font-weight: 600; }
.attachment:hover { text-decoration: none; background: #dce9f8; }

/* 评论 */
.comments { margin-top: 28px; }
.comments h3 { font-size: 18px; color: var(--navy); }
.comment { background: #f7fafd; border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.comment .c-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.comment .c-body { margin: 6px 0 4px; }
.comment .c-actions { font-size: 12px; }
.comment.reply { margin-left: 34px; background: #eef4fb; }
.comment-form textarea { width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: inherit; font-size: 14px; resize: vertical; }
.comment-form .row { display: flex; gap: 10px; margin-top: 8px; align-items: center; }

/* 表单 */
.form-wrap { max-width: 760px; margin: 0 auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.form-wrap h2 { margin-top: 0; color: var(--navy); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.field input[type=text], .field input[type=password], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--text); background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--navy-2); }
.editor { border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 220px; background: #fff; }
.editor:focus { outline: none; border-color: var(--navy-2); }
.editor-toolbar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.editor-toolbar button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.editor-toolbar button:hover { border-color: var(--navy); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(10,30,60,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 18px; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 400px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal-head { background: var(--navy); color: #fff; padding: 14px 18px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }
.switch-link { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%); background: #1f2733; color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 14px; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* 用户菜单 */
.user-menu { position: relative; }
.user-menu-btn { background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.user-menu-btn:hover { background: rgba(255,255,255,.2); }
.dropdown { position: absolute; right: 0; top: 44px; background: #fff; border-radius: 10px; box-shadow: var(--shadow); min-width: 160px; overflow: hidden; display: none; }
.dropdown.show { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 10px 16px; border: none; background: #fff; color: var(--text); font-size: 14px; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: #f2f6fb; text-decoration: none; }

/* 管理后台 */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.admin-tabs button { border: none; background: none; padding: 10px 12px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.admin-tabs button.active { color: var(--navy); border-bottom-color: var(--orange); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; text-align: center; }
.stat .num { font-size: 28px; font-weight: 800; color: var(--navy); }
.stat .label { color: var(--muted); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: #f2f6fb; color: var(--navy); font-weight: 700; }
.table tr:hover td { background: #fafcff; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fff3e0; color: #b26a00; }
.badge-approved { background: #e6f6ec; color: #1f7a45; }
.badge-rejected { background: #fdecea; color: #b23a2a; }
.badge-admin { background: var(--orange); color: #fff; }
.badge-user { background: #eef4fb; color: var(--navy); }
.badge-disabled { background: #e2e8f0; color: #6b7785; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.pagination button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 13px; cursor: pointer; }
.pagination button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination button:disabled { opacity: .5; cursor: not-allowed; }

/* 移动端 */
@media (max-width: 720px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--navy); flex-direction: column; align-items: stretch; padding: 10px 18px 16px; gap: 4px; }
  .nav.open { display: flex; }
  .nav > a { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
  .nav-auth { flex-direction: column; align-items: stretch; gap: 8px; }
  .hero h1 { font-size: 26px; }
  .post-detail { padding: 18px; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}
