:root {
  --neu-blue: #1a3a8f;
  --neu-blue-2: #2a5bd7;
  --neu-red: #c8161d;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2533;
  --muted: #6b7280;
  --line: #e3e8f0;
  --ok: #1f9d55;
  --shadow: 0 4px 18px rgba(26, 58, 143, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(120deg, var(--neu-blue), var(--neu-blue-2));
  color: #fff; padding: 14px 26px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 10px; background: #fff; color: var(--neu-blue);
  display: grid; place-items: center; font-weight: 800; letter-spacing: 1px; font-size: 16px;
}
.brand-text h1 { margin: 0; font-size: 18px; }
.brand-text p { margin: 2px 0 0; font-size: 12px; opacity: 0.85; }
.tabs { display: flex; gap: 8px; }
.tab {
  border: 1px solid rgba(255,255,255,0.4); background: transparent; color: #fff;
  padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; transition: 0.15s;
}
.tab:hover { background: rgba(255,255,255,0.15); }
.tab.active { background: #fff; color: var(--neu-blue); font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.campus-switch {
  display: flex; border: 1px solid rgba(255,255,255,0.4); border-radius: 8px; overflow: hidden;
}
.campus-btn {
  border: none; background: transparent; color: #fff; padding: 8px 16px; cursor: pointer;
  font-size: 13.5px; transition: 0.15s; border-right: 1px solid rgba(255,255,255,0.25);
}
.campus-btn:last-child { border-right: none; }
.campus-btn:hover { background: rgba(255,255,255,0.15); }
.campus-btn.active { background: #fff; color: var(--neu-blue); font-weight: 700; }

/* ---------- 首次进入的校区选择门禁 ---------- */
.campus-gate {
  position: fixed; inset: 0; z-index: 999;
  background: linear-gradient(135deg, #16307a 0%, #2f5cff 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.campus-gate-box {
  background: #fff; border-radius: 16px; padding: 32px 36px; text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25); max-width: 420px; width: 100%;
}
.campus-gate-logo {
  width: 52px; height: 52px; border-radius: 12px; background: var(--neu-blue-2); color: #fff;
  display: grid; place-items: center; font-weight: 800; margin: 0 auto 14px; font-size: 17px;
}
.campus-gate-box h2 { margin: 0 0 6px; font-size: 19px; color: #1b2a4a; }
.campus-gate-box .hint { margin: 0 0 20px; font-size: 12.5px; color: #8a93a6; }
.campus-gate-btns { display: flex; gap: 12px; }
.campus-gate-btn {
  flex: 1; border: 1.5px solid #dfe5f2; background: #fff; border-radius: 12px; padding: 16px 10px;
  cursor: pointer; transition: 0.15s; display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.campus-gate-btn:hover { border-color: var(--neu-blue-2); background: #f5f8ff; }
.campus-gate-btn b { font-size: 15px; color: #1b2a4a; }
.campus-gate-btn span { font-size: 11px; color: #93a0b5; }

main { max-width: 1100px; margin: 24px auto; padding: 0 18px; }
.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--card); border-radius: 14px; padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h2 { margin: 0 0 6px; font-size: 18px; color: var(--neu-blue); }
.card h3 { margin: 0 0 14px; font-size: 15px; color: var(--neu-blue); }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 12px; }

.form-row { display: flex; gap: 10px; align-items: center; }
.form-row.wrap { flex-wrap: wrap; }
input, select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  outline: none; background: #fff; color: var(--ink); min-width: 130px;
}
input:focus { border-color: var(--neu-blue-2); box-shadow: 0 0 0 3px rgba(42,91,215,0.12); }

.btn {
  border: none; border-radius: 8px; padding: 9px 18px; cursor: pointer; font-size: 14px;
  font-weight: 600; transition: 0.15s; white-space: nowrap;
}
.btn.primary { background: var(--neu-blue-2); color: #fff; }
.btn.primary:hover { background: var(--neu-blue); }
.btn.ghost { background: #eef1f8; color: var(--neu-blue); }
.btn.ghost:hover { background: #e1e7f6; }
.btn.warning { background: #fff; color: #d4380d; border: 1px solid #ffa39e; }
.btn.warning:hover { background: #fff1f0; }
.batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff7f6; border: 1px solid #ffccc7; border-radius: 8px;
  padding: 8px 14px; margin: 0 0 12px; font-size: 13px; color: #a8071a;
}
.batch-bar b { font-size: 14px; }
.row-check { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; accent-color: #2f5cff; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.list-head h3 { margin: 0; }
.site-footer { text-align: center; padding: 24px 16px 34px; font-size: 12.5px; color: #8a93a6; }
.site-footer a { color: var(--neu-blue-2, #2f5cff); text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
/* 选择列默认隐藏，仅在「批量选择」模式下显示 */
#members-table .col-select { display: none; }
#members-table.select-mode .col-select { display: table-cell; }
#sub-tasks .t-check { display: none; }
#sub-tasks.select-mode .t-check { display: inline-block; vertical-align: middle; }

.btn.danger { background: #fdeaea; color: var(--neu-red); }
.btn.danger:hover { background: #fbdada; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }

.query-card { max-width: 800px; margin: 10px auto; }
.stat-line { font-weight: 600; color: var(--neu-blue); }

.login-card { max-width: 420px; margin: 30px auto; }
.admin-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow); margin-bottom: 16px; border: 1px solid var(--line);
}
.admin-actions { display: flex; gap: 8px; }

.subtabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.subtab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
}
.subtab.active { background: var(--neu-blue); color: #fff; border-color: var(--neu-blue); font-weight: 600; }
.subview { display: none; }
.subview.active { display: block; }

.table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
}
.data-table thead th { background: #f0f3fb; color: var(--neu-blue); position: sticky; top: 0; }
.data-table tbody tr:hover { background: #f7f9ff; }
.data-table .ops { display: flex; gap: 6px; }

.matrix-wrap { max-height: 560px; overflow: auto; }
.matrix-table { border-collapse: collapse; font-size: 12px; }
.matrix-table th, .matrix-table td {
  border: 1px solid var(--line); padding: 4px 6px; text-align: center; white-space: nowrap;
}
.matrix-table thead th {
  background: #eef1f8; color: var(--neu-blue); position: sticky; top: 0; z-index: 2;
  min-width: 96px; max-width: 140px;
}
.matrix-table tbody th {
  background: #f7f9ff; text-align: left; position: sticky; left: 0; z-index: 1;
  min-width: 110px; font-weight: 600;
}
.matrix-table .total-col { background: #fff8e6; font-weight: 700; color: var(--neu-red); }
.matrix-table td input {
  width: 54px; padding: 4px 4px; text-align: center; border: 1px solid transparent;
  border-radius: 4px; min-width: 0; font-size: 12px;
}
.matrix-table td input:focus { border-color: var(--neu-blue-2); background: #fff; }
.matrix-bar { display: flex; justify-content: space-between; align-items: baseline; }

.export-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.export-preview { margin-top: 18px; padding: 16px; border: 1px dashed var(--line); border-radius: 10px; background: #fbfcff; }
.export-preview table { border-collapse: collapse; font-size: 12px; }
.export-preview th, .export-preview td { border: 1px solid var(--line); padding: 4px 8px; }

.result-card { margin-top: 16px; }
.result-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 16px; border-radius: 12px; background: linear-gradient(120deg, var(--neu-blue), var(--neu-blue-2)); color: #fff;
}
.result-head .name { font-size: 20px; font-weight: 700; }
.result-head .meta { font-size: 12.5px; opacity: 0.9; }
.result-head .total { font-size: 30px; font-weight: 800; color: #ffd86b; }
.result-head .rank { font-size: 13px; opacity: 0.9; }
.detail-table { margin-top: 14px; }
.detail-table th { background: #f0f3fb; }
.empty { color: var(--muted); padding: 14px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: #1f2533; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.25); z-index: 999; max-width: 80vw;
}
.toast.err { background: var(--neu-red); }
.toast.ok { background: var(--ok); }
.hidden { display: none !important; }

/* ---------- 排行榜 ---------- */
.ranking-card { max-width: 800px; margin: 0 auto 18px; }
.ranking-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ranking-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: 0.15s;
}
.rank-row:hover { border-color: var(--neu-blue-2); box-shadow: 0 2px 10px rgba(42,91,215,0.12); }
.rank-row.highlight { border-color: var(--neu-red); background: #fff7f7; }
.medal {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: #fff; font-size: 14px;
}
.medal-1 { background: linear-gradient(135deg,#f6c343,#e0a000); }
.medal-2 { background: linear-gradient(135deg,#cfd6e4,#9aa6bd); }
.medal-3 { background: linear-gradient(135deg,#e0a072,#bd7a45); }
.rank-no { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center; background: #eef1f8; color: var(--muted); font-weight: 700; font-size: 13px; }
.tie-tag { flex: 0 0 auto; align-self: center; margin-left: 2px; padding: 1px 7px; border-radius: 10px; background: #fff3e0; color: #d97706; font-size: 11px; font-weight: 700; border: 1px solid #fde0b0; }
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: 14px; }
.rank-dept { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.rank-bar { height: 6px; background: #eef1f8; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--neu-blue-2), var(--neu-blue)); border-radius: 4px; }
.rank-score { font-weight: 800; font-size: 16px; color: var(--neu-blue); min-width: 48px; text-align: right; }

/* ---------- 个人查询结果：活动明细 ---------- */
.result-sub { display: flex; gap: 18px; flex-wrap: wrap; margin: 12px 0 4px; color: var(--muted); font-size: 13px; }
.result-sub b { color: var(--ink); }
.result-title { margin: 14px 0 8px; font-size: 14px; color: var(--neu-blue); }
.act-list { display: flex; flex-direction: column; gap: 10px; }
.act-item { background: #f8faff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.act-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.act-name { font-weight: 600; }
.act-score { font-weight: 800; color: var(--neu-red); font-size: 15px; white-space: nowrap; }
.act-score i { color: var(--muted); font-weight: 400; font-style: normal; font-size: 12px; }
.act-meta { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.act-bar { height: 7px; background: #e6ebf5; border-radius: 4px; overflow: hidden; }
.act-bar span { display: block; height: 100%; background: linear-gradient(90deg,#34c77b,#1f9d55); border-radius: 4px; }

/* ---------- 活动表单网格 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field .req { color: var(--neu-red); }
.field input { min-width: 0; width: 100%; }

/* ---------- 活动卡片列表 ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.act-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.act-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.act-card-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.badge.points { background: #e7f0ff; color: var(--neu-blue); }
.act-card-date { color: var(--muted); font-size: 12.5px; }
.act-card-desc { font-size: 13px; color: #44506a; background: #f7f9ff; border-radius: 8px; padding: 8px 10px; line-height: 1.5; }
.act-card-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.act-card-foot b { color: var(--ink); }
.act-card-foot .ops { margin-left: auto; display: flex; gap: 6px; }

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 600px; max-height: 90vh;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25); display: flex; flex-direction: column;
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; font-size: 16px; color: var(--neu-blue);
}
.modal-head .close-btn {
  border: none; background: transparent; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1;
}
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 活动卡片内打分 ---------- */
.task-score-editor { background: #f8faff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 14px 0; }
.task-score-editor h4 { margin: 0 0 10px; font-size: 13.5px; color: var(--neu-blue); }
.score-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.score-row { display: flex; align-items: center; gap: 10px; }
.score-row .m-name {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 600; color: var(--neu-blue);
  background: linear-gradient(135deg, #f0f7ff, #e6f0ff);
  padding: 6px 10px; border-radius: 8px;
  border-left: 3px solid var(--neu-blue-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.score-row input[type="number"] { width: 90px; text-align: right; }
.activity-score-row { display: flex; align-items: center; gap: 10px; }
.activity-score-row .m-name { flex: 1; min-width: 0; font-size: 13.5px; }
.activity-score-row.scored .m-name {
  font-weight: 600; color: #0a7d3e;
  background: linear-gradient(135deg, #e9f9ef, #c8f0d8);
  padding: 6px 10px; border-radius: 8px;
  border-left: 3px solid var(--ok);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-score-row input[type="number"] { width: 90px; text-align: right; }
.score-add-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.member-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; max-height: 160px; overflow-y: auto; padding: 4px; }
.member-chip {
  appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 12px;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink);
  transition: all .12s ease;
}
.member-chip:hover { border-color: var(--neu-blue); background: #f0f7ff; }
.member-chip.selected { background: var(--neu-blue); color: #fff; border-color: var(--neu-blue); }
.member-chip.selected .chip-dept { background: rgba(255,255,255,0.25); color: #fff; }
.chip-dept { font-size: 11px; color: var(--muted); background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }
.score-add-row input[type="number"] { width: 90px; }

.new-member-inline {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.new-member-inline label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.new-member-inline input { flex: 1; min-width: 100px; }

.dept-tag { font-size: 11px; color: var(--muted); background: #eef1f8; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }

/* ---------- 成员编辑弹窗 ---------- */
.member-edit-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.member-edit-fields .field.full { grid-column: 1 / -1; }
.score-list { display: flex; flex-direction: column; gap: 8px; }
.score-list .empty { text-align: left; padding: 0; }
.score-list-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.score-list-item .task-name { flex: 1; font-size: 13.5px; }
.score-list-item input { width: 80px; text-align: right; }
.score-list-item .btn.danger { padding: 5px 8px; }

/* ---------- 考核细则 ---------- */
.rules-card { padding: 26px 30px; }
.rules-hero {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px; margin-bottom: 18px; border-bottom: 2px solid #eef2fa;
}
.rules-hero-icon {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #2f5cff, #6a8bff); color: #fff;
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 6px 16px rgba(47, 92, 255, 0.28);
}
.rules-hero h2 { margin: 0 0 3px; font-size: 20px; color: #1b2a4a; }
.rules-hero .hint { margin: 0; }
.doc-content { font-size: 14.5px; line-height: 1.9; color: #2a3448; word-break: break-word; }
.doc-content > *:first-child { margin-top: 0; }
.doc-content > *:last-child { margin-bottom: 0; }
.doc-content h1 {
  font-size: 21px; color: #16307a; margin: 28px 0 14px;
  padding-left: 12px; border-left: 4px solid #2f5cff; line-height: 1.5;
}
.doc-content h2 {
  font-size: 17.5px; color: #1b3a8f; margin: 24px 0 12px;
  padding-bottom: 7px; border-bottom: 1px solid #e8eefb;
}
.doc-content h3 { font-size: 15.5px; color: #22417f; margin: 20px 0 10px; }
.doc-content h4, .doc-content h5, .doc-content h6 { font-size: 14.5px; color: #33456b; margin: 16px 0 8px; }
.doc-content p { margin: 10px 0; }
.doc-content ul, .doc-content ol { margin: 10px 0; padding-left: 26px; }
.doc-content li { margin: 5px 0; }
.doc-content li::marker { color: #2f5cff; }
.doc-content strong, .doc-content b { color: #1b3a8f; }
.doc-content a { color: #2f5cff; }
.doc-content blockquote {
  margin: 14px 0; padding: 10px 16px; color: #55627a;
  background: #f7faff; border-left: 4px solid #b9cdf5; border-radius: 0 8px 8px 0;
}
.doc-content hr { border: none; border-top: 1px dashed #dbe3f2; margin: 22px 0; }
.doc-content table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin: 16px 0;
  border: 1px solid #e2e9f7; border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(31, 61, 135, 0.06); font-size: 13.5px;
}
.doc-content th {
  background: #eef3ff; color: #16307a; font-weight: 700;
  padding: 11px 13px; text-align: left; border-bottom: 1px solid #dbe4f6;
}
.doc-content td { padding: 10px 13px; border-bottom: 1px solid #eef2fa; }
.doc-content tr:last-child td { border-bottom: none; }
.doc-content tbody tr:nth-child(even) td { background: #fafcff; }
.doc-content code { background: #f1f4fb; color: #c0392b; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.upload-zone {
  border: 2px dashed #c6d3ee; border-radius: 12px; padding: 30px 20px;
  text-align: center; cursor: pointer; transition: 0.18s; background: #fbfcff;
}
.upload-zone:hover, .upload-zone.dragging { border-color: #2f5cff; background: #f3f7ff; }
.upload-zone.dragging { transform: scale(1.01); }
.upload-icon { font-size: 30px; margin-bottom: 8px; }
.upload-zone p { margin: 4px 0; color: #33456b; }
.upload-sub { font-size: 12px; color: #8a93a6; }
.rules-preview-box {
  background: #fff; border: 1px solid #e6ebf5; border-radius: 10px;
  padding: 20px 24px; margin-top: 10px; max-height: 520px; overflow-y: auto;
}
/* 考核细则：富文本编辑器（工具栏 + 可编辑区） */
.rules-editor-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 8px 10px; margin-top: 10px;
  background: #f7f9fd; border: 1px solid #e6ebf5; border-radius: 10px 10px 0 0;
}
.rules-editor-toolbar select {
  height: 30px; padding: 0 6px; border: 1px solid #dbe3f2; border-radius: 7px;
  background: #fff; color: #2a3448; font-size: 13px; outline: none; cursor: pointer;
}
.rules-editor-toolbar button {
  height: 30px; min-width: 32px; padding: 0 9px; border: 1px solid #dbe3f2;
  border-radius: 7px; background: #fff; color: #2a3448; font-size: 13px;
  line-height: 1; cursor: pointer; transition: 0.15s;
}
.rules-editor-toolbar button:hover { background: #eef3ff; border-color: #b9cdf7; color: #1b3a8f; }
.rules-editor-toolbar button:active { background: #e2ebff; }
.rules-editor-toolbar .rt-sep { width: 1px; height: 18px; background: #dbe3f2; margin: 0 4px; }
.rules-editor-toolbar + .rules-preview-box {
  margin-top: 0; border-radius: 0 0 10px 10px; border-top: none;
}
.rules-preview-box[contenteditable="true"] { cursor: text; }
.rules-preview-box[contenteditable="true"]:focus { outline: 2px solid #b9cdf7; outline-offset: -2px; }
.rules-preview-box[contenteditable="true"]:empty::before {
  content: "在此输入或粘贴内容…"; color: #a8b2c6; pointer-events: none;
}
.rules-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

@media (max-width: 640px) {
  /* 顶栏改为纵向堆叠，标签与校区按钮撑满整行 */
  .topbar { flex-direction: column; gap: 12px; align-items: stretch; padding: 12px 14px; }
  .brand { gap: 10px; }
  .logo { width: 38px; height: 38px; font-size: 13px; border-radius: 9px; }
  .brand-text h1 { font-size: 16px; }
  .brand-text p { font-size: 11.5px; }
  .topbar-right { flex-direction: column; align-items: stretch; gap: 10px; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 9px 8px; font-size: 13.5px; }
  .campus-switch { width: 100%; }
  .campus-btn { flex: 1; text-align: center; padding: 10px 8px; font-size: 13px; }
  /* 内容区 */
  main { padding: 0 12px; margin: 14px auto; }
  .card { padding: 14px; border-radius: 10px; }
  .form-row { flex-wrap: wrap; }
  .form-row input { flex: 1 1 44%; min-width: 0; }
  .form-row .btn { flex: 1 1 44%; }
  .form-grid { grid-template-columns: 1fr; }
  .ranking-card { max-width: 100%; }
  .member-edit-fields { grid-template-columns: 1fr; }
  .modal { max-width: 100%; padding: 16px; }
  /* 表格：横向滚动 + 紧凑 */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { font-size: 12.5px; }
  .data-table th, .data-table td { padding: 6px 8px; white-space: nowrap; }
  /* 导出与操作条 */
  .export-btns { flex-direction: column; }
  .export-btns .btn { width: 100%; }
  .admin-bar { flex-wrap: wrap; gap: 8px; }
  .act-card-foot { flex-wrap: wrap; gap: 8px; }
  .list-head { flex-wrap: wrap; gap: 8px; }
  /* 校区门禁 */
  .campus-gate-box { padding: 24px 20px; }
  .campus-gate-btns { flex-direction: column; }
  .campus-gate h2 { font-size: 17px; }
  /* 考核细则 */
  .rules-card { padding: 18px 16px; }
  .rules-hero-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
  .rules-hero h2 { font-size: 17px; }
  .doc-content { font-size: 14px; line-height: 1.85; }
  .doc-content h1 { font-size: 18px; }
  .doc-content h2 { font-size: 16px; }
  .doc-content table { font-size: 12.5px; display: block; overflow-x: auto; white-space: nowrap; }
  .doc-content th, .doc-content td { padding: 8px 10px; }
  .rules-preview-box { padding: 14px; max-height: 400px; }
  .upload-zone { padding: 22px 14px; }
  /* 页脚 */
  .site-footer { padding: 18px 12px 26px; font-size: 11.5px; }
}
