/* ============================================================
   代练俱乐部 · 接单后台  ——  浅色简洁风主题（移动端优先）
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-2: #f3f4f6;
  --line: rgba(17, 24, 39, .08);
  --line-2: rgba(17, 24, 39, .14);
  --txt: #1f2430;
  --dim: #8a909c;
  --brand: #e5342b;
  --brand-d: #d81f1f;
  --grad: linear-gradient(135deg, #ff5c4d, #e5342b);
  --accent: #ea580c;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 20px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--txt); text-decoration: none; }
small { color: var(--dim); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.dim { color: var(--dim); }
.money { color: var(--accent); font-weight: 700; }
.money.wait { color: var(--warn); }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 14px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  flex: 1; text-align: center;
  font-weight: 800; font-size: 17px; letter-spacing: .4px;
  white-space: nowrap;
  background: linear-gradient(90deg, #e5342b, #ff6a3d);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.top-right { display: flex; align-items: center; gap: 8px; }
.who {
  font-size: 11px; color: var(--dim); max-width: 80px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--txt);
  background: #fff; border: 1px solid var(--line-2);
  white-space: nowrap;
}
.pill.ghost { color: var(--dim); background: var(--card-2); }
.pill:active { transform: scale(.96); }

/* ---------------- 分类标签行 ---------------- */
.chips {
  position: sticky; top: 52px; z-index: 20;
  display: flex; gap: 8px; overflow-x: auto;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; color: var(--dim);
  background: #fff; border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.on {
  color: #fff; background: var(--grad); border-color: transparent;
  font-weight: 700; box-shadow: 0 4px 12px rgba(229, 52, 43, .28);
}

/* ---------------- 布局 ---------------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 14px 14px 88px; }
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.panel-head h3 { margin: 0; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: #fff;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 12px 12px 15px; box-shadow: var(--shadow);
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--line-2);
}
.stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-lb { color: var(--dim); font-size: 12px; margin-top: 2px; }
.stat-money { color: var(--accent); font-size: 12px; margin-top: 6px; font-weight: 600; }
.stat-card.st-pending::before { background: var(--warn); }
.stat-card.st-accepted::before { background: #6366f1; }
.stat-card.st-in_progress::before { background: #3b82f6; }
.stat-card.st-completed::before { background: var(--ok); }
.stat-card.st-settled::before { background: #14b8a6; }
.stat-card.st-cancelled::before { background: #cbd0d8; }

/* 今日 / 大数字卡片 */
.hero {
  background: linear-gradient(135deg, #fff4f2, #ffffff 62%);
  border: 1px solid rgba(229, 52, 43, .16);
  border-radius: 16px; padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.hero-row { display: flex; gap: 8px; }
.hero-item { flex: 1; text-align: center; }
.hero-num { font-size: 20px; font-weight: 800; }
.hero-lb { font-size: 12px; color: var(--dim); margin-top: 2px; }
.hero-foot {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--dim);
}
.hero-foot b { color: var(--txt); }

/* ---------------- 订单卡片 ---------------- */
.grid-orders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.ocard {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); color: var(--txt);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.ocard:hover {
  transform: translateY(-2px); border-color: rgba(229, 52, 43, .35);
  box-shadow: 0 6px 20px rgba(16, 24, 40, .1);
}
.ocard-banner {
  position: relative; height: 76px; padding: 8px 10px;
  background-image:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, .16), transparent 62%),
    linear-gradient(135deg, #33373f, #1c1f26 55%, #0d0f13);
}
.ocard-banner::after {
  content: ""; position: absolute; right: -16px; bottom: -22px;
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 70%);
}
.b-top {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 6px;
}
.chip-game {
  font-size: 10px; padding: 2px 8px; border-radius: 999px; color: #fff;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .4);
  max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ocard-title {
  position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 1;
  font-weight: 800; font-size: 13px; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ocard-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ocard-sub { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocard-meta {
  font-size: 11px; color: var(--dim);
  display: flex; justify-content: space-between; gap: 6px;
}
.ocard-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocard-price {
  margin-top: auto; display: flex; align-items: baseline; gap: 6px;
}
.ocard-price .price { font-size: 16px; font-weight: 800; color: var(--accent); }
.ocard-price .price-old {
  font-size: 11px; color: var(--dim); text-decoration: line-through;
}
.ocard-foot { font-size: 11px; color: var(--dim); }
.ocard-actions { display: flex; gap: 8px; padding: 0 10px 10px; }
.ocard-actions .btn { flex: 1; }

/* ---------------- 状态 / 角色徽章 ---------------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge.st-pending { background: #fef3c7; color: #b45309; }
.badge.st-accepted { background: #e0e7ff; color: #4338ca; }
.badge.st-in_progress { background: #dbeafe; color: #1d4ed8; }
.badge.st-completed { background: #dcfce7; color: #15803d; }
.badge.st-settled { background: #ccfbf1; color: #0f766e; }
.badge.st-cancelled { background: #eef0f3; color: #6b7280; }
.badge.role-super_admin { background: #e5342b; color: #fff; }
.badge.role-admin { background: #fee2e2; color: #b91c1c; }
.badge.role-staff { background: #dbeafe; color: #1d4ed8; }
.badge.role-booster { background: #dcfce7; color: #15803d; }
.badge.role-viewer { background: #eef0f3; color: #6b7280; }
.tag-view {
  font-style: normal; background: var(--card-2); color: var(--dim);
  padding: 1px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line);
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: #fff;
  color: var(--txt); cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #fafbfc; border-color: rgba(17, 24, 39, .22); }
.btn.primary {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 12px rgba(229, 52, 43, .3);
}
.btn.primary:hover { filter: brightness(1.06); background: var(--grad); }
.btn.danger { background: #fff; color: #dc2626; border-color: #fbc9c9; }
.btn.danger:hover { background: #fef2f2; border-color: #f5a3a3; }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; padding: 13px; font-size: 15px; border-radius: 14px; }

/* ---------------- 表单 ---------------- */
label { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 10px; }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 12px;
  font-size: 15px; font-family: inherit; color: var(--txt); background: #fff;
}
input::placeholder, textarea::placeholder { color: #aab1bb; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(229, 52, 43, .13);
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--dim) 50%),
    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 32px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid .actions { margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters input, .filters select { width: auto; min-width: 130px; margin-top: 0; }
.inline-form {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2);
}
.inline-form select { margin-top: 0; min-width: 150px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }
.ops { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.reset-form { display: flex; gap: 6px; }
.reset-form input { width: 110px; margin: 0; padding: 6px 8px; font-size: 13px; }
.club-form { display: flex; gap: 6px; align-items: center; }
.club-form select { width: auto; min-width: 104px; margin: 0; padding: 6px 26px 6px 8px; font-size: 12.5px; }
.club-form input { width: 128px; margin: 0; padding: 6px 8px; font-size: 13px; }
.note-input { width: 128px; margin: 0; padding: 6px 8px; font-size: 12.5px; }

/* ---------------- 详情 ---------------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 18px;
}
.detail-grid > div {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px dashed var(--line-2);
}
.detail-grid .k { color: var(--dim); flex: 0 0 76px; }
.detail-grid .v { flex: 1; }
.account {
  display: flex; gap: 10px; margin-top: 12px;
  padding: 12px 14px; background: #f9fafb;
  border: 1px solid var(--line); border-radius: 12px;
}
.account .k { color: var(--dim); flex: 0 0 76px; }

/* ---------------- 表格（账号页等） ---------------- */
.table-scroll { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td {
  padding: 10px; text-align: left;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
th { color: var(--dim); font-weight: 600; font-size: 12px; background: #f9fafb; }
tbody tr:hover { background: #fafbfc; }
td small { color: var(--dim); }

/* ---------------- 记录时间线 ---------------- */
.logs { list-style: none; margin: 0; padding: 0; }
.logs li {
  position: relative; padding: 10px 0 10px 20px;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.logs li:last-child { border-bottom: none; }
.logs li::before {
  content: ""; position: absolute; left: 2px; top: 16px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px rgba(229, 52, 43, .15);
}

/* ---------------- 提示 ---------------- */
.flash { margin-bottom: 14px; }
.flash-item {
  padding: 11px 14px; border-radius: 12px; margin-bottom: 8px;
  font-size: 14px; border: 1px solid var(--line);
}
.flash-item.ok {
  background: #ecfdf5; color: #047857; border-color: #a7f3d0;
}
.flash-item.error {
  background: #fef2f2; color: #b91c1c; border-color: #fecaca;
}
.empty-tip { color: var(--dim); padding: 14px 0; text-align: center; }
.empty-box {
  text-align: center; padding: 44px 20px; color: var(--dim);
  border: 1px dashed var(--line-2); border-radius: 14px; background: #fbfcfd;
}
.empty-box .ico { font-size: 34px; margin-bottom: 8px; opacity: .5; }
.empty { text-align: center; padding: 60px 20px; color: var(--dim); }
.empty h2 { font-size: 44px; margin: 0 0 8px; color: var(--brand); }

/* ---------------- 登录 ---------------- */
.login-box {
  max-width: 360px; margin: 12vh auto;
  background: #fff;
  padding: 30px 24px; border-radius: 18px;
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(16, 24, 40, .08);
}
.login-box h1 {
  font-size: 22px; text-align: center; margin: 0 0 22px;
  font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, #e5342b, #ff6a3d);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------------- 底部固定导航 ---------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; height: 56px;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 12px rgba(16, 24, 40, .05);
}
.tab {
  flex: 1; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding-top: 6px; color: var(--dim);
  font-size: 11px; font-weight: 600;
}
.tab svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.tab.on { color: var(--brand); }
.tab.on::before {
  content: ""; position: absolute; top: 0; width: 26px; height: 3px;
  border-radius: 0 0 4px 4px; background: var(--grad);
}

[hidden] { display: none !important; }

/* ---------------- 自动刷新状态条 ---------------- */
.refresh-bar {
  position: fixed; left: 14px; z-index: 45;
  bottom: calc(68px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-size: 12px; font-weight: 600; color: var(--dim);
  cursor: pointer; user-select: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.refresh-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  animation: rpulse 1.8s ease-out infinite;
}
.refresh-bar.paused { color: #98a0ac; }
.refresh-bar.paused .refresh-dot { background: #b6bcc6; animation: none; }
@keyframes rpulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
  70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .wrap { padding: 12px 12px 88px; }
  .who { display: none; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}