/* =========================================================
   业务页样式：积分中心 / 后台
   ========================================================= */

.pos { color: var(--brand-deep); }
.neg { color: #de6b32; }
html[data-theme="dark"] .neg { color: #f0a070; }

.btn.danger {
  background: linear-gradient(150deg, #ef8354, #e05a2b);
  color: #fff;
  box-shadow: 0 12px 24px -16px rgba(224, 90, 43, 0.9);
}
.btn.danger:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn.is-open { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }

/* ---------------- 页头 ---------------- */

.board-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  padding: 4px 2px 22px;
}
.bh-main { min-width: 0; }
.bh-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--brand-deep);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  padding: 3px 11px;
  border-radius: 999px;
}
.board-head h1 {
  margin: 10px 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.bh-sub { margin: 0; font-size: 13px; color: var(--muted); }
.bh-sub b { font-weight: 650; }
.bh-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- Tabs ---------------- */

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  margin-bottom: 18px;
}
.tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: var(--surface);
  color: var(--brand-deep);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}
.tab-spacer { flex: 1; }
.tab-action {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
}
.tab-action:hover { background: var(--surface-3); color: var(--brand-deep); }
.tab-action svg { width: 17px; height: 17px; }

.tab-panel { animation: fadeUp 0.28s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* ---------------- 小组卡片 ---------------- */

.group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.gcard {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.gcard-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), transparent);
}
.g-rank {
  width: 26px; height: 26px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--faint);
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.g-rank.rank-1 { color: #fff; background: linear-gradient(150deg, #ffcb45, #f2a93b); border-color: transparent; }
.g-rank.rank-2 { color: #fff; background: linear-gradient(150deg, #b9c6cc, #96a5ad); border-color: transparent; }
.g-rank.rank-3 { color: #fff; background: linear-gradient(150deg, #d9a273, #bd8351); border-color: transparent; }
.g-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.g-title h3 { margin: 0; font-size: 15px; font-weight: 650; }
.g-title em { font-style: normal; font-size: 11.5px; color: var(--faint); }
.g-score {
  margin-left: auto;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.g-score:not(.pos):not(.neg) { color: var(--faint); }

.g-members { list-style: none; margin: 0; padding: 8px; display: grid; gap: 2px; }
.gm {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.16s var(--ease);
}
.gm:hover { background: var(--surface-3); }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.gm-info { display: grid; min-width: 0; flex: 1; }
.gm-info strong { font-size: 13.5px; font-weight: 600; }
.gm-info em { font-style: normal; font-size: 11.5px; color: var(--faint); }
.gm-info em b { font-weight: 650; }
.gm-ops { display: flex; gap: 6px; flex: none; }
.op-btn {
  width: 28px; height: 28px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.16s var(--ease);
}
.op-btn.add:hover { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft); }
.op-btn.sub:hover { border-color: #e05a2b; color: #c9491f; background: #fff2ec; }
html[data-theme="dark"] .op-btn.sub:hover { background: rgba(224, 90, 43, 0.14); color: #f0a070; }
.gm-empty, .gm-none { padding: 14px; text-align: center; font-size: 12.5px; color: var(--faint); }

.gcard-foot {
  display: flex;
  gap: 14px;
  padding: 10px 18px 14px;
  border-top: 1px dashed var(--line-2);
  margin-top: auto;
}
.gc-none .gcard-head { opacity: 0.75; }

/* ---------------- 工具栏 ---------------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.select {
  appearance: none;
  padding: 9px 34px 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23798782' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center / 15px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  outline: none;
}
.select:focus { border-color: var(--brand); }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--faint);
  flex: 1;
  min-width: 180px;
  max-width: 360px;
}
.search-box:focus-within { border-color: var(--brand); }
.search-box svg { width: 15px; height: 15px; flex: none; }
.search-box input {
  border: 0; outline: none; background: transparent;
  font: inherit; font-size: 13px; color: var(--ink);
  padding: 9px 0; width: 100%;
}

/* ---------------- 记录列表 ---------------- */

.rec-ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rec {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.rec:hover { border-color: color-mix(in srgb, var(--brand) 34%, var(--line)); box-shadow: var(--shadow-sm); }
.rec-delta {
  width: 46px;
  flex: none;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 0;
  border-radius: 9px;
}
.rec-delta.add { color: var(--brand-deep); background: var(--brand-soft); }
.rec-delta.sub { color: #c9491f; background: #fff2ec; }
html[data-theme="dark"] .rec-delta.sub { background: rgba(224, 90, 43, 0.14); color: #f0a070; }
.rec-body { min-width: 0; flex: 1; }
.rec-title { display: flex; align-items: baseline; gap: 8px; }
.rec-title strong { font-size: 13.5px; font-weight: 650; }
.rec-group {
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
  line-height: 1.7;
}
.rec-desc { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.rec-note { color: var(--ink-2); }
.rec-side { display: grid; gap: 2px; justify-items: end; flex: none; }
.rec-op { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.op-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); display: inline-block; }
.rec-side em { font-style: normal; font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.rec-del {
  width: 28px; height: 28px;
  border: 0; background: transparent;
  border-radius: 8px;
  color: var(--faint);
  cursor: pointer;
  display: grid; place-items: center;
  flex: none;
  opacity: 0;
  transition: all 0.16s var(--ease);
}
.rec-del svg { width: 15px; height: 15px; }
.rec:hover .rec-del { opacity: 1; }
.rec-del:hover { background: #fff2ec; color: #c9491f; }
html[data-theme="dark"] .rec-del:hover { background: rgba(224, 90, 43, 0.16); }
.rec-sum { text-align: center; font-size: 12px; color: var(--faint); padding: 14px 0 4px; }
.load-more { text-align: center; padding: 14px 0 4px; }

/* ---------------- 排行 ---------------- */

.rank-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rank-item { display: flex; align-items: center; gap: 12px; }
.rank-no {
  width: 24px; height: 24px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--faint);
  background: var(--surface-3);
  border: 1px solid var(--line);
  flex: none;
  font-variant-numeric: tabular-nums;
}
.rank-no.r1 { color: #fff; background: linear-gradient(150deg, #ffcb45, #f2a93b); border-color: transparent; }
.rank-no.r2 { color: #fff; background: linear-gradient(150deg, #b9c6cc, #96a5ad); border-color: transparent; }
.rank-no.r3 { color: #fff; background: linear-gradient(150deg, #d9a273, #bd8351); border-color: transparent; }
.rank-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.rank-line { display: flex; align-items: baseline; gap: 8px; }
.rank-line strong { font-size: 13.5px; font-weight: 650; }
.rank-line b { margin-left: auto; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-group { font-size: 11px; color: var(--faint); }
.rank-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--line); }
.rank-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.5s var(--ease); }
.rank-bar i.neg { background: linear-gradient(90deg, #e05a2b, #ef8354); }

.rank-list.compact { gap: 11px; }
.rank-list.compact .rank-no { width: 22px; height: 22px; font-size: 11.5px; border-radius: 7px; }
.rank-list.compact .rank-line strong { font-size: 13px; }
.rank-list.compact .rank-line b { font-size: 13px; }
.rank-list.compact .rank-bar { height: 5px; }

/* ---------------- 记分弹层 ---------------- */

.modal-lg { width: min(540px, 100%); }
.score-modal { padding: 0; overflow: hidden; }
.score-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.score-sign {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 20px;
  font-weight: 700;
  flex: none;
}
.score-sign.add { color: var(--brand-deep); background: var(--brand-soft); }
.score-sign.sub { color: #c9491f; background: #fff2ec; }
html[data-theme="dark"] .score-sign.sub { background: rgba(224, 90, 43, 0.14); color: #f0a070; }
.score-head-text { min-width: 0; flex: 1; }
.score-head-text h3 { margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.score-head-text .sub { margin: 0; font-size: 12px; color: var(--muted); }

.score-body { padding: 16px 18px; display: grid; gap: 14px; max-height: 60vh; overflow-y: auto; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.chip b { font-weight: 650; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--brand); }
.chip.on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
}
.chip-custom { border-style: dashed; color: var(--faint); }

.score-inputs { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.fld { display: grid; gap: 5px; }
.fld > span { font-size: 11.5px; color: var(--faint); }
.fld input, .fld textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  resize: vertical;
}
.fld input:focus, .fld textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.fld.full { grid-column: 1 / -1; }
.score-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 2px;
}
.score-meta b { color: var(--ink); font-weight: 650; }
.score-modal .modal-actions { padding: 0 18px 18px; margin-top: 0; }

/* 选择成员 */
.pick-grid { display: grid; gap: 14px; max-height: 56vh; overflow-y: auto; padding: 2px; }
.pick-group em { display: block; font-style: normal; font-size: 11.5px; color: var(--faint); margin-bottom: 6px; }
.pick-members { display: flex; flex-wrap: wrap; gap: 7px; }
.pick-item {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.pick-item:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }

/* ---------------- 分组看板 ---------------- */

.group-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.gblock {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 12px 12px 14px;
  min-height: 128px;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.gblock.over { border-color: var(--brand); background: var(--brand-soft); }
.gblock.is-none { border-style: dashed; box-shadow: none; }

.gblock-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.gblock-name { font-size: 13px; font-weight: 650; }
.gblock-count { margin-left: auto; font-size: 11.5px; color: var(--faint); }

.gblock-members { display: flex; flex-wrap: wrap; gap: 6px; }

.mchip {
  padding: 5px 11px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s var(--ease);
}
.mchip:hover { border-color: var(--brand); color: var(--brand-deep); }
.mchip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
html[data-theme="dark"] .mchip.on { color: #04241d; }
.mchip.dragging { opacity: 0.4; }

.gblock-empty { font-size: 12px; color: var(--faint); padding: 10px 4px; }

.assign-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.assign-bar[hidden] { display: none; }
.assign-info { font-size: 13px; color: var(--ink-2); }
.assign-info b { color: var(--brand-deep); font-size: 15px; }
.assign-bar .select { padding: 7px 30px 7px 11px; }
.assign-bar .btn { padding: 8px 16px; }

.fld-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.fld-inline em { font-style: normal; color: var(--faint); }

/* ---------------- 状态 ---------------- */

.empty-state {
  padding: 48px 24px;
  text-align: center;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-2);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty-state strong { display: block; font-size: 14px; margin-bottom: 6px; }
.empty-state p { margin: 0; font-size: 12.5px; color: var(--muted); }
.empty-state .hint { margin-top: 10px; color: var(--faint); font-size: 12px; }
.empty-state code {
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11.5px;
}
.loading { padding: 40px; text-align: center; color: var(--faint); font-size: 13px; }

/* ---------------- 后台组件 ---------------- */

.admin-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.card-block {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card-head .panel-note { margin-left: auto; }
.card-head .btn { margin-left: auto; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.row-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-form .field, .row-form .select { padding: 8px 12px; font-size: 13px; }
.field {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.field.grow { flex: 1; min-width: 140px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--faint);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; font-weight: 650; }
.tbl .ops { display: flex; gap: 6px; justify-content: flex-end; }
.icon-act {
  width: 28px; height: 28px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.icon-act svg { width: 14px; height: 14px; }
.icon-act:hover { border-color: var(--brand); color: var(--brand-deep); }
.icon-act.danger:hover { border-color: #e05a2b; color: #c9491f; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
}
.pill.add { color: var(--brand-deep); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.pill.sub { color: #c9491f; background: #fff2ec; border-color: #ffd9c8; }
html[data-theme="dark"] .pill.sub { background: rgba(224, 90, 43, 0.14); border-color: transparent; color: #f0a070; }

.stat-line { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-line > div { display: grid; gap: 2px; }
.stat-line span { font-size: 11.5px; color: var(--faint); }
.stat-line b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

textarea.field { resize: vertical; line-height: 1.6; font-family: inherit; }
.hint-text { font-size: 12px; color: var(--faint); line-height: 1.7; margin: 8px 0 0; }
.hint-text code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

.soon-card-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed var(--line-2);
  color: var(--faint);
  font-size: 12.5px;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 900px) {
  .group-grid { grid-template-columns: 1fr; }
  .rank-cols { grid-template-columns: 1fr; }
  .bh-actions { width: 100%; margin-left: 0; }
  .bh-actions .btn { flex: 1; }
}

@media (max-width: 640px) {
  .board-head h1 { font-size: 23px; }
  .tabs { overflow-x: auto; }
  .tab { padding: 7px 14px; white-space: nowrap; }
  .score-inputs { grid-template-columns: 1fr; }
  .rec { flex-wrap: wrap; gap: 10px; }
  .rec-side { order: 3; width: 100%; justify-items: start; flex-direction: row; display: flex; gap: 10px; }
  .rec-del { opacity: 1; }
  .tbl th:nth-child(n+4), .tbl td:nth-child(n+4) { display: none; }
}
