:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --primary: #185fa5;
  --primary-2: #1d7fd6;
  --border: #e5e7eb;
  --green: #0f6e56;
  --amber: #b45309;
  --gray: #6b7280;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  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(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar.admin { background: #0f2a47; }
.topbar.admin .brand, .topbar.admin .nav a, .topbar.admin .who { color: #e8f0fb; }
.topbar.admin .nav a:hover { color: #fff; }
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand { font-weight: 600; font-size: 16px; color: var(--text); }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--text-2); font-size: 14px; }
.nav a:hover { color: var(--primary); text-decoration: none; }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { font-size: 13px; color: var(--text-2); }
.link { font-size: 13px; color: var(--primary); cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; }
.link.danger { color: #c0392b; }

/* 布局 */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
.container.narrow { max-width: 720px; }
.center { text-align: center; }
.page-title { font-size: 22px; font-weight: 600; margin: 0 0 20px; }
.section-title { font-size: 16px; margin: 28px 0 12px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head .page-title { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--text-2); font-size: 14px; }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { text-decoration: none; border-color: #cbd5e1; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { text-decoration: none; box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.card-cover {
  height: 140px;
  background-size: cover;
  background-position: center;
  background-color: #e8eef6;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-ph { color: #9aa7b8; font-size: 15px; }
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
}
.badge-upcoming { background: #1d7fd6; }
.badge-ongoing { background: var(--green); }
.badge-ended { background: var(--gray); }
.badge-internal { background: #6d28d9; }
.card-body { padding: 14px 16px; }
.card-title { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
.card-meta { font-size: 13px; color: var(--text-2); margin: 0 0 12px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.slots { color: var(--text-2); }
.slots b { color: var(--primary); }

/* 状态标签 */
.status { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid transparent; }
.status-upcoming { background: #e6f1fb; color: var(--primary); }
.status-ongoing { background: #e1f5ee; color: var(--green); }
.status-ended { background: #eef0f3; color: var(--gray); }
.status-public { background: #e6f1fb; color: var(--primary); }
.status-internal { background: #f1ebfb; color: #6d28d9; }

/* 详情页 */
.detail-cover {
  height: 220px;
  background-size: cover;
  background-position: center;
  background-color: #e8eef6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.detail-title { font-size: 24px; margin: 0 0 14px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.prose { font-size: 15px; }
.prose p { margin: 0 0 12px; }
.agenda { margin-top: 24px; }
.agenda h2 { font-size: 17px; margin: 0 0 12px; }
.agenda ul { list-style: none; padding: 0; margin: 0; }
.agenda li { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.agenda li .t { color: var(--primary); font-weight: 600; min-width: 56px; }
.detail-actions { margin-top: 26px; }

/* 表单 */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 520px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text); }
.form input, .form textarea, .form select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.form textarea { resize: vertical; }
.form .row { display: flex; gap: 14px; }
.form .row label { flex: 1; }
.form-actions { display: flex; gap: 12px; margin-top: 4px; }

/* 上传图片预览 */
.img-preview { position: relative; display: inline-block; margin-top: 8px; }
.img-preview img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.img-preview .keep { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.img-preview-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }

/* 详情页图片画廊 */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 6px 0 4px; }
.gallery img { width: 100%; border-radius: 10px; border: 1px solid var(--border); }

.callout {
  background: #e6f1fb;
  border: 1px solid #b5d4f4;
  color: #0c447c;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
}
.callout.err { background: #fcebed; border-color: #f7c1c1; color: #a32d2d; }

/* 模拟登录列表 */
.mock-list { display: flex; flex-direction: column; gap: 12px; }
.mock-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.mock-item:hover { border-color: var(--primary); text-decoration: none; }
.mock-item span { font-size: 13px; color: var(--text-2); }

/* 成功页 */
.ok {
  width: 64px; height: 64px; line-height: 64px;
  margin: 10px auto 16px;
  border-radius: 50%;
  background: var(--green); color: #fff; font-size: 32px;
}

/* 统计 */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 8px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.stat b { display: block; font-size: 26px; color: var(--primary); }
.stat span { font-size: 13px; color: var(--text-2); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #fafbfc; color: var(--text-2); font-weight: 500; }
.table tr:last-child td { border-bottom: none; }
.table .ops { display: flex; align-items: center; gap: 12px; white-space: nowrap; }

/* 报名状态徽章（员工/后台通用） */
.status-pending { background: #fdf0e0; color: #b45309; }
.status-approved { background: #e1f5ee; color: #0f6e56; }
.status-waitlist { background: #e6f1fb; color: #185fa5; }
.status-cancelled { background: #eef0f3; color: #6b7280; }

/* 行内表单（取消/审核按钮） */
.inline-form { display: inline; }
.inline-form + .inline-form { margin-left: 6px; }

/* 详情页操作区 */
.detail-actions { margin-top: 26px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* 筛选标签 */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter-tabs .tab {
  font-size: 13px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.filter-tabs .tab:hover { text-decoration: none; border-color: #cbd5e1; color: var(--text); }
.filter-tabs .tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 看板 KPI（六宫格） */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 22px; }

/* 看板面板 */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.chart-donut { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text); }
.legend.inline { flex-direction: row; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.legend .dot, .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 7px; vertical-align: middle; }

@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .form .row { flex-direction: column; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
