/* ============ 基础 ============ */
:root {
  --primary: #2f5b95;
  --primary-dark: #24487a;
  --primary-light: #eaf1fa;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #24292f;
  --muted: #667085;
  --border: #e4e8ef;
  --danger: #d93025;
  --ok: #1a7f37;
  --warn: #b45309;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ============ 顶部导航 ============ */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand img.logo { height: 32px; width: auto; }
.brand .logo-fallback {
  width: 32px; height: 32px; border-radius: 8px; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.site-header nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a {
  padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 14px;
}
.site-header nav a:hover { background: var(--primary-light); color: var(--primary); }
.site-header nav a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.site-footer {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 28px 16px 36px; margin-top: 40px;
}
.site-footer a { color: var(--muted); }

/* ============ 徽标 ============ */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-open    { background: #e7f4ea; color: var(--ok); }
.badge-not_started { background: var(--primary-light); color: var(--primary); }
.badge-ended   { background: #eef0f3; color: var(--muted); }
.badge-full    { background: #fdeeea; color: var(--danger); }
.badge-hot     { background: #fff1e6; color: #c2410c; }
.badge-draft   { background: #eef0f3; color: var(--muted); }
.badge-published { background: #e7f4ea; color: var(--ok); }
.badge-offline { background: #fdf6e3; color: var(--warn); }
.badge-finished  { background: #eef0f3; color: var(--muted); }
.badge-valid   { background: #e7f4ea; color: var(--ok); }
.badge-invalid { background: #eef0f3; color: var(--muted); }

/* ============ 首页 ============ */
.page-title { font-size: 22px; font-weight: 700; margin: 24px 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.search-bar {
  display: flex; gap: 10px; margin: 18px 0 22px;
}
.search-bar input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none; background: #fff;
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar button, .btn {
  padding: 10px 20px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 15px; background: var(--primary); color: #fff; font-weight: 600;
}
.btn:hover, .search-bar button:hover { background: var(--primary-dark); }
.btn:disabled { background: #a8b7cc; cursor: not-allowed; }
.btn-outline {
  background: #fff; color: var(--primary); border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b3261e; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-link {
  background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 4px 6px;
}
.btn-link.danger { color: var(--danger); }

.grid-acts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px;
}
.act-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .15s;
}
.act-card:hover { transform: translateY(-2px); }
.act-poster { height: 150px; background: linear-gradient(135deg, #dce7f3, #c3d5e8); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.act-poster img { width: 100%; height: 100%; object-fit: cover; }
.act-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.act-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.act-meta { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: baseline; }
.act-meta b { color: var(--text); font-weight: 600; }
.act-card .btn { margin-top: 10px; text-align: center; display: block; }
.empty-state {
  text-align: center; color: var(--muted); padding: 60px 20px; background: #fff;
  border-radius: var(--radius); border: 1px dashed var(--border);
}

/* ============ 活动详情 ============ */
.detail-hero {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin: 20px 0; display: flex; gap: 22px; flex-wrap: wrap;
}
.detail-poster { flex: 0 0 260px; }
.detail-poster .ph {
  width: 260px; height: 180px; border-radius: 10px;
  background: linear-gradient(135deg, #dce7f3, #c3d5e8);
  display: flex; align-items: center; justify-content: center; font-size: 48px;
}
.detail-poster img { width: 260px; height: 180px; object-fit: cover; border-radius: 10px; }
.detail-info { flex: 1; min-width: 280px; }
.detail-info h1 { font-size: 22px; margin-bottom: 8px; }
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px; margin-top: 12px; font-size: 14px;
}
.info-grid .k { color: var(--muted); }
.info-grid .v { font-weight: 500; }
.detail-section {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.detail-section h2 { font-size: 17px; margin-bottom: 12px; padding-left: 10px; border-left: 4px solid var(--primary); }

/* ============ 表单 ============ */
.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-item label .req { color: var(--danger); margin-left: 2px; }
.form-item input[type=text], .form-item input[type=number], .form-item textarea, .form-item select,
.form-item input[type=password] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; outline: none; background: #fff; font-family: inherit;
}
.form-item input:focus, .form-item textarea:focus, .form-item select:focus { border-color: var(--primary); }
.form-item textarea { min-height: 88px; resize: vertical; }
.form-item .err { color: var(--danger); font-size: 13px; margin-top: 4px; display: none; }
.form-item.has-err input, .form-item.has-err textarea, .form-item.has-err select { border-color: var(--danger); }
.form-item.has-err .err { display: block; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 4px 2px; }
.choice-row label { font-weight: 400; display: flex; align-items: center; gap: 6px; margin: 0; font-size: 15px; }
.form-note { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* 报名成功 */
.success-panel { text-align: center; padding: 20px 10px; }
.success-panel .icon {
  width: 64px; height: 64px; border-radius: 50%; background: #e7f4ea; color: var(--ok);
  font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}
.success-panel h2 { margin-bottom: 6px; }
.reg-no-box {
  display: inline-block; background: var(--primary-light); color: var(--primary);
  font-weight: 700; font-size: 18px; letter-spacing: 1px; padding: 8px 22px;
  border-radius: 10px; margin: 10px 0 16px;
}
.summary-table { width: 100%; border-collapse: collapse; margin: 0 auto 18px; max-width: 460px; }
.summary-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; font-size: 14px; }
.summary-table td:first-child { color: var(--muted); width: 40%; text-align: right; padding-right: 18px; }

/* ============ 弹窗 / 提示 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5); z-index: 100;
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px;
  overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  padding: 22px; position: relative; box-shadow: 0 10px 40px rgba(0,0,0,.18);
  margin-bottom: 40px;
}
.modal.wide { max-width: 900px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal .close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 20px; color: var(--muted); cursor: pointer;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

#toast-box { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 400px); }
.toast {
  padding: 10px 16px; border-radius: 10px; color: #fff; font-size: 14px;
  box-shadow: var(--shadow); animation: fadein .2s;
}
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; transform: none;} }

/* ============ 登录页 ============ */
.login-wrap {
  min-height: calc(100vh - 200px); display: flex; align-items: center; justify-content: center; padding: 30px 16px;
}
.login-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  width: 100%; max-width: 380px; padding: 32px 28px;
}
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ============ 后台 ============ */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 190px; background: #1f2b3d; color: #cdd6e4; flex-shrink: 0;
  display: flex; flex-direction: column; padding: 14px 10px;
}
.admin-side .brand-side {
  color: #fff; font-weight: 700; font-size: 16px; padding: 8px 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; display:block;
}
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side nav a {
  padding: 10px 12px; border-radius: 8px; color: #cdd6e4; font-size: 14px;
}
.admin-side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-side nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-side .side-bottom { margin-top: auto; padding: 10px 12px; font-size: 13px; }
.admin-side .side-bottom .btn-link { color: #9fb2cc; }
.admin-main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
.admin-main h1 { font-size: 20px; margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: #fff; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
.toolbar .spacer { flex: 1; }

.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.data th, table.data td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data th { background: #f8fafc; font-weight: 600; color: var(--muted); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #f8fbff; }
.table-empty { text-align: center; color: var(--muted); padding: 30px; }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.pagination button { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
.pagination button:disabled { color: #bbb; cursor: not-allowed; }

/* 表单配置表格 */
table.formcfg { min-width: 860px; }
table.formcfg td { padding: 6px 8px; }
table.formcfg input[type=text] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
}
table.formcfg select { padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.drag-handle { cursor: grab; color: #98a2b3; user-select: none; font-size: 16px; }
.row-dragging { opacity: .4; }
.type-tag { color: var(--muted); font-size: 12px; }

/* 设置页 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.settings-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.settings-card h2 { font-size: 16px; margin-bottom: 14px; }
.switch-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.switch-row .desc { color: var(--muted); font-size: 12px; }

/* 验证码 */
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; outline: none; }
.captcha-row img { height: 44px; border-radius: 8px; cursor: pointer; }

/* 查询结果 */
.query-result { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.q-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; }
.q-card .reg-no { font-weight: 700; color: var(--primary); }
.q-card .muted { color: var(--muted); font-size: 13px; }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 10px; }
  .admin-side .brand-side { border: none; margin: 0; padding: 6px 10px; white-space: nowrap; }
  .admin-side nav { flex-direction: row; }
  .admin-side .side-bottom { margin: 0 0 0 auto; padding: 6px 8px; }
  .admin-main { padding: 16px 12px 30px; }
  .detail-poster, .detail-poster .ph, .detail-poster img { width: 100%; flex: none; }
}
@media (max-width: 480px) {
  body { font-size: 14px; }
  .grid-acts { grid-template-columns: 1fr; }
  .site-header .inner { gap: 8px; }
  .site-header nav { margin-left: 0; }
  .page-title { font-size: 19px; }
  .detail-info h1 { font-size: 19px; }
  .info-grid { grid-template-columns: 1fr; }
  .modal { padding: 16px; }
}
