:root {
  --ink: #1b2635; --ink-2: #465265; --line: #e3e6ec; --bg: #f5f6f8; --card: #fff;
  --ok: #1f9254; --bad: #c0392b; --accent: #1b2635;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.wrap { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; }
.link { color: #c8d0dc; text-decoration: none; margin-right: 8px; }
.link:hover { color: #fff; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff; padding-top: env(safe-area-inset-top); }
.topbar .bar { display: flex; align-items: center; justify-content: space-between; height: 54px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: #5ad18f; box-shadow: 0 0 0 4px rgba(90,209,143,.18); }
.who { font-size: 13px; color: #c8d0dc; max-width: 52%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main.wrap { padding: 18px 16px calc(32px + env(safe-area-inset-bottom)); }

/* 活动头 */
.hero { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; }
.hero h1 { margin: 0 0 8px; font-size: 21px; line-height: 1.35; letter-spacing: -.2px; }
.hero .summary { color: var(--ink-2); margin: 0 0 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12px; color: var(--ink-2); background: #f2f4f7; border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; }
.chip.ok { color: #146c3f; background: #e9f7ef; border-color: #c9ebd7; }
.chip.bad { color: #9c2f22; background: #fdecea; border-color: #f7d3ce; }
details.rules { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
details.rules summary { cursor: pointer; font-size: 13px; color: var(--ink-2); }
details.rules pre { white-space: pre-wrap; font: inherit; color: var(--ink-2); margin: 10px 0 0; font-size: 14px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 17px; }

/* 登录 */
.login p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }

/* 组别卡 */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.section-title h2 { margin: 0; font-size: 16px; }
.section-title span { font-size: 12px; color: var(--ink-2); }

.group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px; display: grid; gap: 10px; }
.g-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.g-name { font-weight: 600; font-size: 16px; }
.g-mode { font-size: 11px; color: var(--ink-2); background: #f2f4f7; border-radius: 6px; padding: 2px 7px; margin-left: 8px; white-space: nowrap; }
.g-desc { color: var(--ink-2); font-size: 13.5px; margin: 0; }
.bar-wrap { display: flex; align-items: center; gap: 10px; }
.bar-track { flex: 1; height: 7px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .35s ease; }
.bar-fill.low { background: #3a8ee6; } .bar-fill.mid { background: #e0a80d; } .bar-fill.high { background: #d64541; }
.bar-num { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.g-note { font-size: 12.5px; color: var(--ink-2); }
.tag-mine { font-size: 12px; font-weight: 600; color: #146c3f; }

/* 按钮 */
.btn {
  appearance: none; border: 0; border-radius: 10px; cursor: pointer; font: inherit;
  font-weight: 600; font-size: 14px; padding: 10px 18px; background: var(--accent); color: #fff;
  transition: transform .06s ease, opacity .15s ease; text-decoration: none; display: inline-block;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ok { background: #1f9254; }
.btn.danger { background: #fdecea; color: #9c2f22; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; text-align: center; }

/* 我的报名 */
.mine { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 18px; margin-bottom: 6px; }
.mine-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mine-row:last-child { border-bottom: 0; }
.mine-name { font-weight: 600; font-size: 14.5px; }
.mine-sub { font-size: 12.5px; color: var(--ink-2); }
.badge { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.badge.pending { color: #8a5a00; background: #fdf3dd; }
.badge.confirmed { color: #146c3f; background: #e9f7ef; }
.badge.waitlist { color: #1d5fa8; background: #e8f1fc; }
.badge.rejected, .badge.cancelled { color: #7b8494; background: #f0f2f5; }

/* 表单 */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--bad); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; background: #fff; color: var(--ink);
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid rgba(27,38,53,.18); border-color: #9aa6b8; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.hint { font-size: 12px; color: var(--ink-2); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); margin: 8px 0; }
.check input { width: auto; }

/* 弹层 */
.mask { position: fixed; inset: 0; z-index: 50; background: rgba(16,24,40,.42); display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px); }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 -8px 40px rgba(16,24,40,.2); animation: up .2s ease; }
@keyframes up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .mask { align-items: center; padding: 24px; } .sheet { border-radius: 18px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.icon { appearance: none; border: 0; background: transparent; font-size: 26px; line-height: 1; color: #8b94a3; cursor: pointer; padding: 0 4px; }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); overflow: auto; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; background: rgba(27,38,53,.95); color: #fff; font-size: 13.5px; padding: 10px 18px; border-radius: 999px; max-width: 86vw; text-align: center; }
.toast.bad { background: rgba(156,47,34,.96); }

.empty { text-align: center; color: var(--ink-2); padding: 40px 0; font-size: 14px; }
.err { background: #fdecea; border: 1px solid #f7d3ce; color: #9c2f22; padding: 12px 14px; border-radius: 10px; font-size: 13.5px; }

/* ---------------------------------------------------------------- 后台 */
.tabs { display: flex; gap: 6px; margin: 14px auto 0; padding: 0 16px; max-width: 860px; overflow-x: auto; }
.tabs button {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 8px 15px; border-radius: 999px; font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { flex: 1 1 96px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; }
.stat b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-2); }

.tbl-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--ink-2); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; gap: 6px; }
td.wrap-cell { white-space: normal; min-width: 180px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar select, .toolbar input { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 13.5px; background: #fff; }
.spacer { flex: 1; }
