/* 平台后台公共样式 */
:root {
  --ad-ink: #0f172a;
  --ad-muted: #64748b;
  --ad-line: #e2e8f0;
  --ad-bg: #f1f5f9;
  --ad-card: #ffffff;
  --ad-accent: #0f766e;
  --ad-accent-2: #115e59;
  --ad-warn: #c2410c;
  --ad-danger: #b91c1c;
  --ad-ok: #047857;
}
* { box-sizing: border-box; }
html {
  overflow-x: hidden;
  max-width: 100%;
}
body.admin-body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #e8eef2, var(--ad-bg));
  color: var(--ad-ink);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.ad-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px;
  background: linear-gradient(120deg, #0f766e, #134e4a);
  color: #fff;
  min-width: 0;
}
.ad-top a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.ad-top h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 800;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.ad-top > span {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 0;
}
.ad-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: min(1180px, 100%);
  margin: 0 auto;
  min-height: calc(100vh - 52px);
  min-width: 0;
}
.ad-nav { display: none; }
.ad-nav .who {
  font-size: 12px;
  color: var(--ad-muted);
  padding: 6px 10px 12px;
  line-height: 1.4;
}
.ad-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ad-ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ad-nav a:hover, .ad-nav a.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--ad-accent-2);
}
.ad-nav a[disabled] { opacity: 0.35; pointer-events: none; }
.ad-nav, .ad-main, .ad-card {
  min-width: 0;
  max-width: 100%;
}
.ad-main { padding: 12px; overflow-x: hidden; }
.ad-card {
  background: var(--ad-card);
  border: 1px solid var(--ad-line);
  border-radius: 14px;
  padding: 14px 12px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  overflow-x: hidden;
}
.ad-card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--ad-accent-2);
}
.ad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.ad-stat {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--ad-line);
}
.ad-stat .n { font-size: 22px; font-weight: 800; color: var(--ad-accent); }
.ad-stat .l { font-size: 12px; color: var(--ad-muted); margin-top: 4px; }
.ad-stat.is-tap {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ad-stat.is-tap .l::after {
  content: ' · 点开';
  color: var(--ad-accent);
  font-weight: 600;
}
.ad-stat.is-tap:active,
.ad-stat.is-tap.is-on {
  border-color: var(--ad-accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
  background: #f0fdfa;
}
.ad-drill {
  margin-top: 10px;
  padding-top: 4px;
  border-top: 1px dashed var(--ad-line);
}
.ad-table-wrap,
#teams, #players, #list, #users, #offers, #orders, #paid-orders, #active-memberships {
  overflow-x: hidden;
  max-width: 100%;
  min-width: 0;
}
table.ad-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 13px;
}
table.ad-table th, table.ad-table td {
  border-bottom: 1px solid var(--ad-line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}
table.ad-table th { color: var(--ad-muted); font-weight: 700; font-size: 12px; }
.ad-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.ad-row {
  min-width: 0;
}
.ad-row input, .ad-row select, .ad-row textarea {
  border: 1px solid var(--ad-line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 140px;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.ad-row textarea {
  width: 100%;
  min-height: 110px;
  flex: 1 1 100%;
  display: block;
  resize: vertical;
}
.ad-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(120deg, #0f766e, #115e59);
  color: #fff;
}
.ad-btn.ghost {
  background: #fff;
  color: var(--ad-accent-2);
  border: 1px solid #99f6e4;
}
.ad-btn.sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
  flex: 0 0 auto;
}
.ad-btn.danger { background: #b91c1c; }
.ad-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ad-msg { font-size: 13px; color: var(--ad-muted); }
.ad-msg.err { color: var(--ad-danger); }
.ad-msg.ok { color: var(--ad-ok); }
.ad-mod-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--ad-line);
  background: #fff;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ad-mod-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.12);
}
.ad-mod-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--ad-accent-2); }
.ad-mod-card p { margin: 0; font-size: 13px; color: var(--ad-muted); line-height: 1.5; }
.ad-mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 12px;
}
.ad-gate {
  max-width: 420px;
  margin: 48px auto;
  text-align: center;
  padding: 24px;
}

.ad-list { min-width: 0; }
/* 折叠列表：JS 用 ad-hidden 收起；此前缺规则导致「展开/收起」只改文案不隐藏 */
.ad-hidden { display: none !important; }
.ad-li {
  padding: 10px 0;
  border-bottom: 1px solid var(--ad-line);
  min-width: 0;
}
.ad-li:last-child { border-bottom: none; }
.ad-li-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.ad-li-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ad-li-sub {
  margin-top: 3px;
  padding-right: 4px;
  font-size: 12px;
  color: var(--ad-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ad-li.ad-li-current {
  background: #f0fdfa;
  border-radius: 10px;
  padding-left: 8px;
  padding-right: 8px;
  border: 1px solid rgba(15, 118, 110, 0.28);
}
.ad-li.ad-li-muted {
  opacity: 0.72;
}
.ad-li.ad-li-muted .ad-li-title {
  font-weight: 600;
  color: var(--ad-muted);
}
.ad-stop-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--ad-danger);
  vertical-align: middle;
}
.ad-li.ad-li-stopped {
  border-left: 3px solid var(--ad-danger);
  padding-left: 8px;
}
.ad-sanction {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--ad-line);
}
.ad-save-status {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}
.ad-save-status.ok { color: var(--ad-ok); }
.ad-save-status.err { color: var(--ad-danger); }
.ad-h2-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: var(--ad-accent-2);
  text-align: left;
  font-family: inherit;
}
.ad-h2-btn .hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--ad-accent);
  flex-shrink: 0;
}
.ad-result-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 2px 0 0;
  padding: 8px 0 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--ad-muted);
  text-align: left;
}
.ad-result-bar.is-on { display: flex; }
.ad-result-bar .n { font-weight: 700; color: var(--ad-ink); }
.ad-result-bar .hint {
  color: var(--ad-accent);
  font-weight: 600;
  flex-shrink: 0;
}

.ad-confirm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.ad-confirm[hidden] { display: none !important; }
.ad-confirm-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.ad-confirm-box {
  position: relative;
  z-index: 1;
  width: min(320px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 18px 16px 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}
.ad-confirm-msg {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ad-ink);
  line-height: 1.5;
  text-align: center;
}
.ad-confirm-actions {
  display: flex;
  gap: 10px;
}
.ad-confirm-actions .ad-btn {
  flex: 1;
  text-align: center;
}

.ad-edit {
  display: none;
  margin-top: 10px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 10px;
}
/* 仅当前条目直接子级表单展开，避免点「组织/球队修改」时把队内用户表单一起打开 */
.ad-li.is-editing > .ad-edit { display: block; }
.ad-team-members {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--ad-line);
}
.ad-team-members > .ad-msg {
  margin: 0 0 6px;
  font-weight: 600;
}
.ad-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ad-edit-grid .full { grid-column: 1 / -1; }
.ad-edit label {
  display: block;
  font-size: 11px;
  color: var(--ad-muted);
  margin-bottom: 3px;
}
.ad-edit input, .ad-edit select, .ad-edit textarea {
  border: 1px solid var(--ad-line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  background: #fff;
  -webkit-user-select: text;
  user-select: text;
}
