:root {
  --ink: #15181d; --ink2: #4a5260; --ink3: #8a919e;
  --bg: #f5f4f1; --card: #ffffff; --line: #e6e3dc;
  --red: #c4352b; --red-soft: #fbeceb; --blue: #2b62d9; --blue-soft: #eaf0fd;
  --gold: #a8741a; --gold-soft: #fbf3e2; --green: #1f7a4d; --green-soft: #e7f5ee;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; padding-bottom: 76px; }
body.admin { padding-bottom: 32px; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 18px; } h3 { font-size: 15px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 16px; }
.top { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; }
.brand { font-weight: 700; letter-spacing: .5px; }
.brand b { color: #ff7a6e; }
.who { font-size: 13px; opacity: .9; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.pad0 { padding: 0; overflow: hidden; }
.card h3 { margin-bottom: 8px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .k { font-size: 12.5px; color: var(--ink3); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--blue-soft); color: var(--blue); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.gray { background: #eceae5; color: var(--ink2); }
.muted { color: var(--ink3); font-size: 13px; }
.note { background: var(--gold-soft); color: #6b4a0e; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.note.red { background: var(--red-soft); color: #8a241d; }
.note.blue { background: var(--blue-soft); color: #1f4aa8; }
.note.green { background: var(--green-soft); color: #165a39; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap !important; overflow-wrap: normal !important; }
button, .btn { font: inherit; border: 0; border-radius: 10px; padding: 9px 16px; background: var(--ink); color: #fff; cursor: pointer; min-height: 40px; }
button.red { background: var(--red); }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.small { padding: 4px 11px; min-height: 30px; font-size: 13px; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid #d3cfc6; border-radius: 10px; background: #fff; color: var(--ink); min-height: 42px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
label { display: block; font-size: 13px; color: var(--ink2); margin: 12px 0 4px; }
.form { max-width: 440px; margin: 0 auto; }
.tabs { display: flex; gap: 6px; margin: 8px 0 4px; overflow-x: auto; }
.tabs button { background: #ece9e2; color: var(--ink2); white-space: nowrap; }
.tabs button.on { background: var(--ink); color: #fff; }
.tblwrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
th { font-size: 12.5px; color: var(--ink3); font-weight: 600; background: #faf9f6; position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #faf9f6; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav a { flex: 1; text-align: center; padding: 10px 0 9px; color: var(--ink3); font-size: 12.5px; }
.nav a b { display: block; font-size: 17px; font-weight: 400; line-height: 1.1; }
.nav a.on { color: var(--red); font-weight: 600; }
.anav { display: flex; gap: 4px; flex-wrap: wrap; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px; position: sticky; top: 0; z-index: 4; }
body.admin .top { position: static; }
.anav a { padding: 6px 12px; border-radius: 8px; color: var(--ink2); font-size: 14px; }
.anav a.on { background: var(--ink); color: #fff; }
.bar { height: 10px; background: #ece9e2; border-radius: 99px; overflow: hidden; margin: 4px 0 2px; }
.bar i { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.bar.ok i { background: var(--green); }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding-top: 8px; }
.chart i { flex: 1; background: var(--blue); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.chart i:hover { opacity: 1; }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 24, .5); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; padding: 20px; max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 17px; margin-bottom: 6px; }
.modal .btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); box-shadow: 0 6px 24px rgba(0,0,0,.25); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 30; font-size: 14px; max-width: 90vw; }
.toast.err { background: var(--red); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink3); } .kv dd { margin: 0; word-break: break-all; }
.code { font: 700 20px/1 ui-monospace, Menlo, monospace; letter-spacing: 2px; background: #f1efe9; padding: 8px 12px; border-radius: 8px; display: inline-block; }
.empty { text-align: center; color: var(--ink3); padding: 28px 8px; }
.pill { cursor: pointer; }
.tree ul { list-style: none; margin: 0; padding-left: 20px; border-left: 2px solid var(--line); }
.tree li { padding: 4px 0; }
.small-print { font-size: 12px; color: var(--ink3); }
@media (min-width: 760px) {
  .nav { display: none; } body { padding-bottom: 32px; }
  .topnav { display: flex !important; }
}
.topnav { display: none; gap: 4px; }
.topnav a { color: #d6d9df; padding: 4px 12px; border-radius: 8px; font-size: 14px; }
.topnav a.on { background: #ffffff22; color: #fff; }

td .small-print, td .muted { white-space: normal; max-width: 280px; }
.tblwrap { max-width: 100%; }
.nw { white-space: nowrap !important; overflow-wrap: normal !important; }

/* 排序 */
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: ' ⇅'; opacity: .35; font-size: 11px; }
th.sortable.asc::after { content: ' ▲'; opacity: 1; color: var(--red); }
th.sortable.desc::after { content: ' ▼'; opacity: 1; color: var(--red); }
/* 每日激励语 */
.quote { background: linear-gradient(135deg, #1b1f27, #2a2f3a); color: #f4f1ea; border-radius: var(--radius); padding: 16px 18px; margin: 4px 0 12px; position: relative; overflow: hidden; }
.quote::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--red); }
.quote .q-k { font-size: 12px; letter-spacing: 2px; color: #ff9a8f; }
.quote .q-t { font-size: 17px; line-height: 1.6; margin-top: 4px; font-weight: 600; }
/* 报白状态 */
.acct { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; background: #fff; }
.acct .tip { font-size: 13px; margin-top: 6px; color: var(--ink2); }
.acct .tip.red { color: var(--red); } .acct .tip.gold { color: var(--gold); } .acct .tip.green { color: var(--green); }
/* 升级条件、规则块（与等级表风格统一） */
.upg { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; background: #faf9f6; }
.upg .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.upg .hd .arrow { color: var(--ink3); }
.upg .rt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px dashed var(--line); margin-top: 8px; font-size: 14px; color: var(--ink); }
.upg .rt:first-of-type { border-top: 0; }
.upg .rt .tag { flex: none; font-size: 12px; padding: 1px 9px; border-radius: 99px; background: var(--blue-soft); color: var(--blue); font-weight: 600; margin-top: 2px; }
.rules-note { font-size: 13px; color: var(--ink2); line-height: 1.7; margin-top: 10px; }
.rules-note b { color: var(--ink); }
.minigrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); margin: 10px 0; }
.minigrid .stat { padding: 10px 12px; } .minigrid .stat .v { font-size: 17px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.seg > div { flex: 1; min-width: 130px; }
/* 文字列保底宽度：窄屏时表格整体左右滑动，不再把字一个个挤成竖排 */
th:not(.num), td:not(.num) { min-width: 5.5em; }
td:last-child:empty, th:last-child:empty { min-width: 0; }
.tblwrap { -webkit-overflow-scrolling: touch; }
@media (max-width: 520px) {
  table { font-size: 13px; }
  th, td { padding: 8px 6px; }
  th:not(.num), td:not(.num) { min-width: 4.4em; }
  th { font-size: 12px; }
}

[hidden] { display: none !important; }
/* 分页条 */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); background: #faf9f6; font-size: 13px; }
.pager .pg-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager .pg-size { margin: 0 6px 0 0; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink2); }
.pager select { width: auto; min-height: 30px; padding: 2px 8px; }
.pager button.small { min-width: 32px; padding: 3px 9px; }
.pager .pg-gap { color: var(--ink3); padding: 0 2px; }

/* 手机端：加了 stack 的表格不再左右滑动，每一行直接铺成一张卡片 */
.m-only { display: none; }
.m-sort { display: none; }
@media (max-width: 640px) {
  .m-only { display: inline; }
  .m-sort { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #faf9f6; font-size: 13px; color: var(--ink2); }
  .m-sort select { width: auto; flex: 1; min-height: 36px; padding: 4px 10px; }
  table.stack, table.stack tbody { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px; border-bottom: 8px solid var(--bg); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0; border: 0; min-width: 0 !important; white-space: normal !important; font-size: 15px; }
  table.stack td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ink3); margin-bottom: 1px; }
  table.stack td.num { text-align: left; }
  table.stack td.s-name { grid-column: 1 / -1; font-size: 16px; }
  table.stack td.s-name::before, table.stack td.s-btn::before { display: none; }
  table.stack td.s-hide { display: none; }
  table.stack td.s-btn { grid-column: 1 / -1; }
  table.stack td.s-btn button { width: 100%; }
  table.stack td.s-wide { grid-column: 1 / -1; }
  /* 卡片内顺序：先看钱，再看资料 */
  table.stack.team td:nth-child(1) { order: 0; }
  table.stack.team td:nth-child(9) { order: 1; }
  table.stack.team td:nth-child(8) { order: 2; }
  table.stack.team td:nth-child(7) { order: 3; }
  table.stack.team td:nth-child(10) { order: 4; }
  table.stack.team td:nth-child(11) { order: 5; }
  table.stack.team td:nth-child(6) { order: 6; }
  table.stack.team td:nth-child(4) { order: 7; }
  table.stack.team td:nth-child(5) { order: 8; }
  table.stack.team td:nth-child(12) { order: 9; }
}
td button.small { white-space: nowrap; }

/* 固定每排2个（团队页的6张统计卡：2×3） */
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g2 .stat .v { font-size: 20px; }
.grid.g2 .stat .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 手机卡片模式下，"没有数据"的提示占满整行、居中，不挤成窄条 */
@media (max-width: 640px) {
  table.stack td.empty { grid-column: 1 / -1; text-align: center; padding: 18px 8px; }
  table.stack td.empty::before { display: none; }
  table.stack tbody tr:has(td.empty) { display: block; }
}
/* 隐私说明/规则说明页 */
.legal h1 { font-size: 22px; margin: 16px 0 2px; }
.legal h2 { font-size: 16px; margin-bottom: 8px; }
.legal p, .legal li { font-size: 14.5px; line-height: 1.8; }
.legal ul { padding-left: 20px; margin: 6px 0; }
/* 手机卡片表：名字行最前，核心金额（s-key）紧跟其后，再是其他字段，按钮最后 */
@media (max-width: 640px) {
  table.stack td.s-name { order: -2; }
  table.stack td.s-key { order: -1; }
  table.stack td.s-btn { order: 99; }
  table.stack.team td.s-name { order: -2; }
}
/* 手机上，所有按钮、输入框、标签页都加高到手指好点的大小（约44像素） */
@media (max-width: 640px) {
  button, .btn { min-height: 44px; }
  button.small { min-height: 44px; padding: 8px 16px; }
  .pager button.small { min-width: 44px; }
  .pager select { min-height: 44px; }
  .tabs button { min-height: 44px; }
  input, select, textarea { min-height: 46px; }
  .nav a { padding-top: 12px; padding-bottom: 11px; }
}
