/* 代理后台样式。和运营后台（internal/web/admin/static/admin.css）同一套颜色和字体，改成手机优先：
   顶栏 + 内容 + 底部一排固定导航，列表用一行一条的卡片，宽屏时内容居中、最宽 760。
   不引外部资源、不用脚本（内容安全策略只放行同源样式），所以图标是 CSS 画的。 */
:root {
  --indigo: #4f6aed;
  --indigo-deep: #3d55cf;
  --indigo-wash: #eef1fe;
  --ink: #101a33;
  --paper: #f4f6fb;
  --card: #fff;
  --line: #e4e8f1;
  --text: #1c2434;
  --muted: #6b7487;
  --ok: #1f8f62;
  --ok-wash: #e6f5ee;
  --bad: #c9382f;
  --bad-wash: #fdecea;
  --gold: #a8741a;       /* 金额 */
  --radius: 14px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgba(16, 26, 51, .05), 0 4px 14px rgba(16, 26, 51, .04);
  --num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --tabs-h: 58px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--paper);
}
a { color: var(--indigo-deep); text-decoration: none; }
h1 { font-size: 17px; font-weight: 600; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h2.sec { margin: 20px 4px 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---------- 框架 ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px;
  background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line);
}
.top h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .who { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.seal {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--bad); color: #fff;
  font: 600 16px/1 "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "SimSun", serif;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35);
}
main { max-width: 760px; margin: 0 auto; padding: 14px 12px calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); }

/* 底部导航：五项平分，当前项用主色 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; }
.tabs a.cur { color: var(--indigo); font-weight: 600; }
/* 图标：几何图形拼的，不用图片和字体 */
.ic { position: relative; display: block; width: 20px; height: 20px; }
.ic::before, .ic::after { content: ""; position: absolute; box-sizing: border-box; border: 2px solid currentColor; }
.ic-home::before { left: 3px; right: 3px; top: 8px; bottom: 2px; border-radius: 2px; }
.ic-home::after { left: 4px; top: 3px; width: 12px; height: 12px; border-width: 2px 0 0 2px; transform: rotate(45deg); }
.ic-players::before { left: 6px; top: 1px; width: 8px; height: 8px; border-radius: 50%; }
.ic-players::after { left: 2px; right: 2px; bottom: 1px; height: 8px; border-radius: 8px 8px 2px 2px; }
.ic-orders::before { left: 2px; right: 2px; top: 4px; bottom: 3px; border-radius: 3px; }
.ic-orders::after { left: 2px; right: 2px; top: 8px; height: 0; border-width: 2px 0 0 0; }
.ic-team::before { left: 7px; top: 1px; width: 6px; height: 6px; border-radius: 50%; }
.ic-team::after { left: 2px; right: 2px; bottom: 2px; top: 11px; border-width: 2px 2px 0 2px; border-radius: 3px 3px 0 0; }
.ic-me::before { left: 1px; top: 1px; right: 1px; bottom: 1px; border-radius: 50%; }
.ic-me::after { left: 7px; top: 5px; width: 6px; height: 6px; border-radius: 50%; }

/* 没登录时 */
body.guest { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: linear-gradient(160deg, #101a33 0%, #1b2748 55%, #2a3a6e 100%); }
.auth { padding: 0; width: 100%; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; padding: 26px 22px 20px; background: var(--card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .28); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--muted); }
.auth-card h1 { font-size: 20px; margin-bottom: 14px; }
.auth-card .box { margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
.auth-card button[type=submit] { width: 100%; padding: 11px; }

/* ---------- 提示 ---------- */
.flash { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-s); border: 1px solid transparent; }
.flash.ok { background: var(--ok-wash); color: #17694a; border-color: #bfe5d3; }
.flash.err { background: var(--bad-wash); color: #9c2a23; border-color: #f5c6c1; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 4px; }
.count { margin: 4px 4px 8px; color: var(--muted); font-size: 13px; }

/* ---------- 表单 ---------- */
.box { display: flex; flex-direction: column; gap: 14px; margin: 0 0 16px; padding: 18px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.box label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
input, button { font: inherit; }
input {
  width: 100%; padding: 9px 12px; min-height: 44px;
  border: 1px solid #cfd6e4; border-radius: var(--radius-s); background: #fff; color: var(--text); font-size: 16px; /* 16px 起 iOS 不会自动放大 */
}
input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(79, 106, 237, .18); }
button {
  padding: 9px 18px; min-height: 44px;
  border: 1px solid var(--indigo); border-radius: var(--radius-s);
  background: var(--indigo); color: #fff; cursor: pointer; font-weight: 600;
}
button:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); }
button.link { padding: 0; min-height: 0; border: 0; background: none; color: var(--indigo-deep); font-weight: 400; }
button.link.danger { color: var(--bad); }

.filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 12px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filter label { flex: 1 1 130px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.filter button { flex: 0 0 auto; }

/* 分段切换：含全部下级 / 只看直属 */
.seg { display: flex; margin: 0 0 12px; padding: 3px; background: #e7ebf4; border-radius: 10px; }
.seg a { flex: 1; text-align: center; padding: 7px 0; border-radius: 8px; color: var(--muted); font-size: 14px; }
.seg a.cur { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 26, 51, .08); }

/* ---------- 卡片、数字 ---------- */
.card { margin: 0 0 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head small { color: var(--muted); font-size: 12px; }
.card p { margin: 6px 0; }
.money { color: var(--gold); font-family: var(--num); font-variant-numeric: tabular-nums; }
.big { font: 600 28px/1.2 var(--num); margin: 2px 0 8px; }

.hero { margin: 0 0 12px; padding: 18px 18px 16px; border-radius: var(--radius); color: #fff;
  background: linear-gradient(135deg, #3d55cf 0%, #4f6aed 60%, #6a82f2 100%); box-shadow: 0 8px 24px rgba(61, 85, 207, .25); }
.hero-label { font-size: 12px; opacity: .85; }
.hero-num { font: 600 32px/1.25 var(--num); font-variant-numeric: tabular-nums; margin: 4px 0 6px; }
.hero-sub { font-size: 13px; opacity: .9; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.kpis div { padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.kpis dt { color: var(--muted); font-size: 12px; }
.kpis dd { margin: 2px 0 0; font: 600 22px/1.2 var(--num); font-variant-numeric: tabular-nums; }
.kpis.flat { margin: 0; }
.kpis.flat div { padding: 8px 0; border: 0; border-radius: 0; }

.kv { margin: 0; }
.kv div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.code { padding: 10px 12px; background: #f8f9fc; border: 1px dashed #c3cbdc; border-radius: var(--radius-s);
  font: 600 18px/1.4 Consolas, Menlo, monospace; letter-spacing: .04em; word-break: break-all; user-select: all; }
.code.link { font-size: 14px; font-weight: 400; letter-spacing: 0; }
.menu { display: flex; flex-direction: column; gap: 0; padding: 4px 16px; }
.menu > a, .menu > form { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--text); }
.menu > :last-child { border-bottom: 0; }

/* 柱状图是服务端画的 SVG，字号按画布单位放大，缩到手机宽度后还看得清 */
.chart { display: block; width: 100%; height: auto; }
.chart .bar { fill: #c7d0f9; }
.chart .bar.today { fill: var(--indigo); }
.chart .axis { stroke: var(--line); }
.chart text { font: 22px var(--num); fill: var(--muted); }
.chart text.val { fill: var(--text); font-weight: 600; }

/* ---------- 一行一条的列表 ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card .list { border: 0; border-radius: 0; margin: 0 -16px -14px; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li .row { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 12px; color: inherit; }
.list li:has(.row) { padding: 0; }
.list li .row { padding: 12px 16px; }
.list .main { min-width: 0; display: flex; flex-direction: column; }
.list .main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list small { color: var(--muted); font-size: 12px; }
.list .trail { flex: none; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.list .trail b { font-size: 16px; }
.list .empty { justify-content: center; color: var(--muted); }

table.days { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
table.days th, table.days td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.days th { color: var(--muted); font-weight: 400; font-size: 12px; }
table.days .num { text-align: right; }
table.days tbody tr:last-child td { border-bottom: 0; }

.crumbs { margin: 0 4px 10px; color: var(--muted); font-size: 13px; }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 400; vertical-align: 2px; background: #eef0f5; color: var(--muted); }
.tag.ok { background: var(--ok-wash); color: #17694a; }
.tag.bad { background: var(--bad-wash); color: #9c2a23; }
.tag.warn { background: #fdf3e0; color: #8a5a12; }
.pager { display: flex; justify-content: center; gap: 18px; align-items: center; color: var(--muted); font-size: 14px; }

/* 宽屏：KPI 一行四个，图表的字恢复正常大小 */
@media (min-width: 700px) {
  main { padding-left: 20px; padding-right: 20px; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .chart text { font-size: 14px; }
}
