:root {
  --primary: #d6336c;
  --primary-dark: #a92251;
  --gold: #d8a44a;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #24242b;
  --muted: #8b8b96;
  --line: #e7e7ee;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
h1, h3 { margin: 0; }
button { font-family: inherit; cursor: pointer; }

/* 本地文件打开提示 */
.file-warn {
  background: #fff4e5; color: #a35b00; border-bottom: 1px solid #f3d5ae;
  padding: 10px 20px; font-size: 13px; line-height: 1.7; text-align: center;
}
.file-warn b { color: #8a4b00; }

/* 按钮 */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  transition: .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: #d64545; border-color: #f2c9c9; }
.btn.danger:hover { background: #d64545; color: #fff; border-color: #d64545; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; padding: 10px; font-size: 15px; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 登录 */
.mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 18, 28, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.mask.hidden { display: none; }
.login-card {
  width: 360px; padding: 32px 28px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
.brand { font-size: 26px; font-weight: 700; letter-spacing: 2px; color: var(--primary); text-align: center; }
.brand-sub { text-align: center; color: var(--muted); margin: 6px 0 22px; letter-spacing: 3px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 14px; outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.hint { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; line-height: 2; }
code {
  background: #f5f3f7; padding: 1px 5px; border-radius: 4px;
  font-size: 12px; color: #6f4a5c;
}
.err { color: #d64545; font-size: 12px; text-align: center; margin-top: 8px; min-height: 16px; }

/* 布局 */
.app { min-height: 100vh; }
.topbar {
  height: 58px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  background: #211c2e; color: #fff;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text strong { font-size: 15px; letter-spacing: 1px; }
.logo-text small { font-size: 11px; color: #b3adc4; letter-spacing: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar-right .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .18); color: #fff; }
.topbar-right .btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }

.pill {
  padding: 4px 10px; border-radius: 20px; font-size: 12px;
  background: rgba(255, 255, 255, .1); color: #cfc9dd;
}
.pill.ok { background: rgba(78, 203, 143, .18); color: #7fe0b4; }
.pill.bad { background: rgba(214, 69, 69, .2); color: #ff9b9b; }

.wrap { padding: 20px 24px 40px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.card {
  background: var(--card); border-radius: 10px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(20, 18, 28, .06);
  display: flex; flex-direction: column; gap: 6px;
  border-left: 3px solid var(--primary);
}
.card span { color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.card b { font-size: 24px; }

.panel { background: var(--card); border-radius: 10px; box-shadow: 0 1px 3px rgba(20, 18, 28, .06); }
.toolbar {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input, .filters select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); }
.filters #kw { width: 220px; }
.tilde { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; }

.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #faf9fb; text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid #f2f2f6; font-size: 13px; vertical-align: middle; }
tbody tr:hover td { background: #fcf7fa; }
.col-check { width: 38px; }
.col-no { width: 60px; }
.col-gender { width: 66px; }
.col-op { width: 110px; }
.col-time { width: 160px; }
.col-remark { min-width: 140px; max-width: 260px; }
.gender-tag { padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.gender-tag.m { background: #e8f1ff; color: #2b6cb0; }
.gender-tag.f { background: #ffeaf2; color: #c2255d; }
.op-link { color: var(--primary); background: none; border: none; padding: 0 6px; font-size: 13px; }
.op-link.del { color: #b9b9c2; }
.op-link.del:hover { color: #d64545; }

/* 空状态与排查 */
.empty { padding: 40px 24px 34px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 34px; color: #ddd8e2; line-height: 1; }
.empty-title { margin-top: 10px; font-size: 15px; color: #4a4552; font-weight: 600; }
.empty-desc { margin-top: 8px; font-size: 12px; }
.diag-list {
  max-width: 520px; margin: 14px auto 0; padding-left: 18px;
  text-align: left; font-size: 12px; line-height: 1.9; color: #7a7484;
}
.diag-list li { margin-bottom: 4px; }
.empty-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.diag-result {
  max-width: 560px; margin: 14px auto 0; padding: 12px 14px;
  background: #faf9fc; border: 1px solid var(--line); border-radius: 8px;
  text-align: left; font-size: 12px; line-height: 1.8; color: #5f5a68;
  white-space: pre-wrap; word-break: break-all;
}

.pager {
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.pager-ctl { display: flex; align-items: center; gap: 10px; }
.pager b { color: var(--text); }

/* 弹窗 */
.modal { width: 420px; max-width: 100%; background: #fff; border-radius: 12px; padding: 22px; }
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.modal input, .modal select, .modal textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; color: var(--text); outline: none; font-family: inherit;
}
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--primary); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 12px; }

.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 0; }
.qr-preview img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr-fallback { font-size: 12px; color: #d64545; text-align: center; }
.hidden { display: none !important; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: rgba(33, 28, 46, .92); color: #fff; padding: 10px 18px; border-radius: 20px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .22s; z-index: 99;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 打印区 */
.print-area { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .cards, .panel, .mask, .toast, .file-warn { display: none !important; }
  .print-area { display: block; padding: 0; }
  .print-title { text-align: center; font-size: 18px; margin-bottom: 6px; }
  .print-meta { display: flex; justify-content: space-between; font-size: 12px; color: #555; margin-bottom: 8px; }
  .print-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .print-table th, .print-table td { border: 1px solid #333; padding: 6px 8px; text-align: left; }
  .print-table th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table tr { page-break-inside: avoid; }
}
@media print and (min-width: 0) {
  body.printing-qr .print-area { display: none; }
  body.printing-qr .mask { display: flex !important; background: #fff; }
  body.printing-qr .mask .modal > *:not(.qr-preview) { display: none; }
  body.printing-qr .mask .modal { box-shadow: none; width: auto; }
}

/* ---------------- 后台登录（内部系统，与前台视觉区分） ---------------- */
.admin-login { background: radial-gradient(circle at 70% 20%, #3a2b4d, #17131f 65%); }
.admin-login .login-card {
  border: 1px solid rgba(216, 164, 74, .35);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .7);
  padding-top: 26px;
}
.login-tag {
  display: block; text-align: center; font-size: 10.5px; letter-spacing: 3px;
  color: #a9906a; border: 1px dashed rgba(216, 164, 74, .45);
  border-radius: 999px; padding: 4px 10px; width: fit-content; margin: 0 auto 18px;
}
.login-meta { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.9; }
.login-note { margin-top: 8px; font-size: 11px; color: #b0a9bb; text-align: center; letter-spacing: .3px; }

/* ---------------- 模块切换 ---------------- */
.tabs {
  display: flex; gap: 4px; padding: 0 24px;
  background: #211c2e; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.tab {
  border: none; background: none; color: #a9a2ba; font-size: 14px;
  padding: 12px 16px; position: relative; transition: color .18s;
}
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; }
.tab.is-active::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--primary)); border-radius: 2px;
}

/* ---------------- 活动管理 ---------------- */
.card.ev { border-left-color: var(--gold); }
.col-cover { width: 96px; }
.col-cat { width: 100px; }
.col-status { width: 92px; }
.ev-thumb {
  width: 76px; height: 48px; border-radius: 6px; display: block;
  background: #f2eff5 center/cover no-repeat; border: 1px solid var(--line);
}
.ev-thumb.empty-thumb {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #b3adc4;
}
.ev-name { font-size: 13.5px; color: var(--text); font-weight: 600; }
.ev-sub {
  font-size: 12px; color: var(--muted); margin-top: 3px;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.status-tag { padding: 2px 9px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.status-tag.live { background: #e6f7ee; color: #1f8b57; }
.status-tag.draft { background: #f1f0f4; color: #7a7484; }
.status-tag.past { background: #fdf1e0; color: #a87318; }

.modal-lg { width: 720px; max-height: 90vh; overflow-y: auto; }
.ev-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.ev-form .full { grid-column: 1 / -1; }
.upload-box {
  border: 1px dashed var(--line); border-radius: 8px; padding: 12px;
  background: #fcfbfd; margin-bottom: 12px;
}
.upload-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.upload-head b { font-size: 12px; color: #4a4552; }
.upload-head small { font-size: 11.5px; color: var(--muted); }
.upload-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.file-btn { display: inline-flex; align-items: center; }
.upload-hint { font-size: 12px; color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, 88px); gap: 8px; }
.photo-item {
  position: relative; width: 88px; height: 88px; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: #f2eff5;
}
.photo-item.is-cover { border-color: var(--primary); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-flag {
  position: absolute; left: 0; bottom: 0; right: 0; text-align: center;
  font-size: 10px; color: #fff; background: rgba(214, 51, 108, .9); line-height: 16px;
}
.photo-del {
  position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(20, 18, 28, .65); color: #fff; font-size: 13px; line-height: 20px;
  padding: 0;
}
.photo-del:hover { background: #d64545; }
.photo-empty { grid-column: 1 / -1; font-size: 12px; color: var(--muted); line-height: 1.8; }
.topbar-right a.btn { text-decoration: none; }

@media (max-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .wrap { padding: 14px; }
  .filters #kw { width: 100%; }
  .topbar { padding: 0 14px; }
  .topbar-right #loginUser, .topbar-right .pill { display: none; }
  .tabs { padding: 0 10px; }
  .modal-lg { width: 100%; }
  .ev-form { grid-template-columns: 1fr; }
  .col-cover, .col-cat { display: none; }
}
