/* ==================== 基础 ==================== */
:root {
  --blue: #2f6bff;
  --blue-dark: #2559d8;
  --blue-soft: #eef3ff;
  --ink: #1f2d3d;
  --muted: #8a94a6;
  --line: #e6ebf2;
  --bg: #f5f7fb;
  --green: #17a673;
  --red: #e5484d;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(31, 45, 61, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.view { display: none; }
.view.on { display: block; }
.view.center {
  min-height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.view.center.on { display: flex; }

/* ==================== 表单控件 ==================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field > span i { color: var(--red); font-style: normal; }

input[type="text"], input[type="password"], input[type="tel"], select {
  height: 38px;
  width: 100%;
  padding: 0 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #b6becd; }
input:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%238a94a6' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}

.btn {
  height: 38px;
  padding: 0 20px;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #c9d9ff; color: var(--blue); }
.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn.ghost { background: #fff; }
.btn.block { width: 100%; }
.btn.sm { height: 32px; padding: 0 14px; font-size: 12.5px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.err {
  color: var(--red);
  font-size: 12.5px;
  min-height: 18px;
  line-height: 1.5;
}

/* ==================== 登录卡 ==================== */
.card {
  width: 100%;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(31, 45, 61, .10);
  padding: 34px 34px 30px;
}
.login-card { max-width: 380px; }

.card-head { margin-bottom: 22px; }
.card-head h1 { margin: 0 0 8px; font-size: 20px; font-weight: 650; letter-spacing: .5px; }
.card-head p { margin: 0; font-size: 13px; color: var(--muted); }

#loginForm { display: flex; flex-direction: column; gap: 14px; }
#loginForm .btn { margin-top: 4px; }

@media (max-width: 560px) {
  .card { padding: 26px 22px 22px; }
}

/* ==================== 顶栏 ==================== */
.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 16px; font-weight: 650; letter-spacing: .5px; }
.who { display: flex; align-items: center; gap: 12px; }
.who-name { font-size: 13px; color: var(--muted); }

/* ==================== 页面 ==================== */
.page { padding: 20px 24px 32px; max-width: 1600px; margin: 0 auto; }

.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px 18px;
  margin-bottom: 16px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: flex-end;
}
.filter-row .field { flex: 1 1 150px; min-width: 118px; max-width: 340px; }
.filter-row .field.range-field { flex: 1.4 1 240px; min-width: 230px; max-width: 380px; }
.filter-row-actions { justify-content: flex-end; }
.filter-actions { display: flex; gap: 10px; margin-left: auto; }

/* 日期区间 */
.range { display: flex; align-items: center; gap: 8px; }
.range input { height: 38px; padding: 0 8px; font-size: 13px; min-width: 0; }
.range em { font-style: normal; color: var(--muted); font-size: 12.5px; }

/* 可搜索下拉 */
.combo { position: relative; }
.combo input { padding-right: 30px; }
.combo-pop {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(31, 45, 61, .14);
  padding: 4px;
}
.combo-pop.on { display: block; }

/* 换群管弹窗里：modal-body 是 overflow:auto，浮层超出会被裁掉，
   所以往下弹并压低高度，保证整块都在可视区内（反正输入即搜索，不需要一次列全） */
.m-form .combo-pop { max-height: 148px; }
.combo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.combo-item:hover { background: var(--blue-soft); }
.combo-item.clear { color: var(--muted); border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; margin-bottom: 2px; }
.combo-item.clear.on { color: var(--blue); font-weight: 600; }
.combo-item .ci-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-item .ci-meta { color: var(--muted); font-size: 11.5px; flex: 0 0 auto; }
.combo-empty { padding: 12px 10px; color: var(--muted); font-size: 12.5px; text-align: center; }
.combo input:disabled { background: var(--bg-2, #f5f6f8); cursor: not-allowed; color: var(--muted); }

@media (max-width: 1180px) {
  .filter-row .field { flex: 1 1 160px; }
  .filter-row .field.range-field { flex: 1 1 280px; }
}
@media (max-width: 720px) {
  .filters { padding: 14px; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-row .field, .filter-row .field.range-field { flex: 1 1 auto; min-width: 0; }
  .filter-actions { margin-left: 0; justify-content: flex-end; }
  .page { padding: 14px; }
}

/* ==================== 表格 ==================== */
.table-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-wrap { overflow: auto; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f9fc;
  color: #5b6675;
  font-weight: 500;
  text-align: left;
  padding: 13px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.grid td {
  padding: 11px 16px;
  border-bottom: 1px solid #f0f3f8;
  vertical-align: middle;
  white-space: nowrap;
}
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: #fafbfe; }

td.idx { color: var(--muted); width: 62px; }
td.avatar-cell { width: 64px; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: #eef1f7;
  display: block;
}
.avatar.ph { display: block; }
.nick { color: var(--blue); }
td.nick-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ok { color: var(--green); }
.muted { color: var(--muted); }
.tag {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 4px 2px 0;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11.5px;
}

/* 状态 */
.state {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.state .big { font-size: 15px; color: var(--ink); font-weight: 600; margin-bottom: 8px; }
.state .retry { margin-top: 14px; }

/* ==================== 分页 ==================== */
.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px 0;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.pager .btn { height: 32px; padding: 0 14px; font-size: 12.5px; }
.pager .spacer { flex: 1; }

/* ==================== 提示 ==================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: rgba(31, 45, 61, .92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  z-index: 100;
  max-width: 80vw;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: rgba(229, 72, 77, .95); }

/* 会员列表的状态页签：审批通过 / 待审核 / 小黑屋 */
.subtabs {
  display: flex;
  gap: 6px;
  margin: -4px 0 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.subtab {
  position: relative;
  height: 34px;
  padding: 0 16px;
  font-size: 13px;
  font-family: inherit;
  color: #5b6675;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.subtab:hover { color: var(--blue); }
.subtab.on {
  color: var(--blue);
  font-weight: 600;
  border-bottom-color: var(--blue);
}
.subtab b {
  display: inline-block;
  margin-left: 4px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.subtab.on b { color: var(--blue); }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== 表格补充 ==================== */
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: #f5f8ff; }
tr.row-click:hover .nick { text-decoration: underline; }
tr.row-click.sel td { background: #f2f6ff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num-h { text-align: right; }

/* 会员列表（后台会员管理 → 会员列表同款列） */
table.list-grid td.num-id { font-variant-numeric: tabular-nums; color: #5b6675; }
table.list-grid td.ellip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list-grid td.gm-cell { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.list-grid td.ops { white-space: nowrap; }

/* 标签列：一个会员可能挂多个标签，允许换行，限宽避免挤走后面的列 */
table.list-grid td.tag-cell { max-width: 240px; white-space: normal; line-height: 1.9; }
.tag-chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  font-size: 11.5px;
  line-height: 18px;
  color: #2b5fd9;
  background: #eef3ff;
  border: 1px solid #d8e3ff;
  border-radius: 10px;
  white-space: nowrap;
}

table.list-grid th:nth-child(1), table.list-grid td:nth-child(1) { width: 48px; }
table.list-grid th:nth-child(2), table.list-grid td:nth-child(2) { width: 60px; }
/* 只给「标签」以外的列定宽，多出来的宽度全部给标签列，标签才不会挤成一条 */
table.list-grid th:nth-child(4), table.list-grid td:nth-child(4) { width: 300px; }
table.list-grid th:nth-child(5), table.list-grid td:nth-child(5) { width: 110px; }
table.list-grid th:nth-child(6), table.list-grid td:nth-child(6) { width: 340px; }
table.list-grid th:nth-child(7), table.list-grid td:nth-child(7) { width: 80px; }
table.list-grid th:nth-child(8), table.list-grid td:nth-child(8) { width: 160px; }
table.list-grid th:nth-child(9), table.list-grid td:nth-child(9) { width: 200px; }
table.list-grid th:last-child, table.list-grid td:last-child { width: 84px; }
a.link { color: var(--blue); cursor: pointer; text-decoration: none; }
a.link:hover { text-decoration: underline; }
.warn { color: #b26a00; }

/* 多选列 */
th.cb-col, td.cb-cell { width: 42px; padding-left: 14px; padding-right: 4px; text-align: center; }
td.cb-cell input, th.cb-col input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--blue);
  vertical-align: middle;
}
/* 表格上方操作条 */
.table-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}
.table-bar .spacer { flex: 1; }
.sel-info { font-size: 13px; color: var(--muted); }
.sel-info b { color: var(--blue); font-weight: 650; }

/* ==================== 明细页 ==================== */
.back {
  height: 30px;
  padding: 0 12px;
  margin-right: 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: #5b6675;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.back:hover { border-color: #c9d9ff; color: var(--blue); }
.topbar .brand { display: flex; align-items: center; }

.card-sec {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.sec-title {
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 14px;
  padding-left: 9px;
  border-left: 3px solid var(--blue);
  line-height: 1.1;
}

.info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px 24px;
  font-size: 13.5px;
}
.info > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info span { color: var(--muted); }
.info b { color: var(--ink); font-weight: 600; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.stat {
  background: #fff;
  padding: 14px 8px;
  text-align: center;
}
.stat span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 7px;
  line-height: 1.35;
}
.stat b { font-size: 14px; font-weight: 650; color: var(--ink); word-break: break-all; }

@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.toolbar .field.inline { min-width: 150px; }
.toolbar .field.inline.grow { flex: 1; min-width: 200px; }
.toolbar .field > span { font-size: 12px; }
.toolbar input, .toolbar select { height: 34px; font-size: 13px; }
.toolbar .btn { height: 34px; }
.toolbar-hint { font-size: 12px; color: var(--muted); align-self: center; }

/* 会员统计列多，用紧凑排版尽量在一屏内放下 */
table.grid.compact { font-size: 12.5px; }
table.grid.compact th { padding: 10px 9px; font-size: 12.5px; }
table.grid.compact td { padding: 9px 9px; }
table.grid.compact td.idx { width: 46px; }
table.grid.compact th.cb-col, table.grid.compact td.cb-cell { width: 38px; padding-left: 10px; }

/* ==================== 弹窗 ==================== */
.mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 28, 40, .42);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mask.on { display: flex; }

.modal {
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(20, 28, 40, .28);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 650;
}
.modal-head .x {
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.modal-head .x:hover { background: #f2f4f8; color: var(--ink); }

.modal-body { padding: 16px 20px 4px; overflow: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
}

.m-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.m-title.mt { margin-top: 18px; }
.m-table { border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 190px; }
.m-table table.grid { font-size: 12.5px; }
.m-table th { padding: 9px 10px; }
.m-table td { padding: 8px 10px; }
.m-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.m-note {
  margin-top: 14px;
  padding: 10px 12px;
  background: #fff8ec;
  border: 1px solid #ffe4bd;
  border-radius: 8px;
  color: #8a6320;
  font-size: 12.5px;
  line-height: 1.6;
}
.modal .err { margin-top: 8px; }
/* 「提交后需审批」提示：和上面那条黄色警告区分开，用蓝色 */
.m-note.submit {
  margin-top: 8px;
  background: #eef3ff;
  border-color: #d8e3ff;
  color: #2b5fd9;
}

@media (max-width: 560px) {
  .m-form { grid-template-columns: 1fr; }
}
