* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e6e9ee;
  --text: #1f2430;
  --muted: #7b8494;
  --primary: #17876b;
  --primary-d: #116b55;
  --amber: #d98016;
  --radius: 12px;
}

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6f8;
  background: var(--bg);
  color: #1f2430;
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: #c0392b; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- 登录 ---------- */
.mask {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;   /* 不用 inset：老内核不认 */
  background: rgba(24, 30, 40, .45);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  z-index: 50;
}
.login-card {
  background: #ffffff;
  background: var(--card);
  border-radius: 16px; padding: 32px;
  width: 360px; max-width: 100%;
  margin: auto;                            /* flex 下两轴居中；不支持 flex 时至少水平居中 */
  box-shadow: 0 8px 40px rgba(20, 30, 45, .16);
}
.login-card h1 { font-size: 19px; font-weight: 600; margin-bottom: 6px; }
.login-card p { margin-bottom: 20px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.login-card input {
  width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: #fafbfc;
}
.login-card input:focus { outline: none; border-color: var(--primary); background: #fff; }

.brand-dot {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, #1f9d7e, #2ec4a0);
  margin-bottom: 16px;
}
.brand-dot.small { width: 22px; height: 22px; border-radius: 7px; margin: 0; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.side {
  width: 210px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 600; padding: 0 8px 20px;
}
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  color: #47505e; font-size: 14px; transition: background .15s;
}
.nav-item:hover { background: #f2f5f4; }
.nav-item.active { background: #e7f4f0; color: var(--primary-d); font-weight: 500; }

.side-foot {
  margin-top: auto; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #c8cdd6; }
.dot.ok { background: #24a97f; }
.dot.bad { background: #d9534f; }
.side-foot .btn { margin-left: auto; }

.main { flex: 1; padding: 26px 30px 60px; min-width: 0; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.page-head h2 { font-size: 20px; font-weight: 600; }
.page-head > div { display: flex; gap: 8px; align-items: center; }

/* ---------- 控件 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 14px; font-size: 13.5px; cursor: pointer;
  background: #eef1f4; color: #2b3240; transition: all .15s;
  font-family: inherit;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.ghost:hover { border-color: #cfd6de; }
.btn.tiny { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; padding: 11px; margin-top: 4px; }
.btn.danger { color: #c0392b; border-color: #f0d6d2; background: #fdf3f2; }

select, input, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; background: #fff;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { width: 100%; resize: vertical; line-height: 1.55; }

.filters {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.filters input { flex: 1; min-width: 180px; }

/* ---------- 卡片 ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 18px; border: 1px solid var(--line);
}
.card .k { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.card .v { font-size: 25px; font-weight: 600; letter-spacing: -.5px; }
.card .v small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 3px; }

.panel {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 18px 20px; margin-bottom: 18px;
}
.panel h3 { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } .side { width: 160px; } }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid #f1f3f6; vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #fafbfc; }
.stem { max-width: 460px; line-height: 1.55; word-break: break-word; }

.tag {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  font-size: 11.5px; background: #eef1f4; color: #5b6472; white-space: nowrap;
}
.tag.g { background: #e7f4f0; color: #116b55; }
.tag.y { background: #fdf3e3; color: #a86a10; }
.tag.r { background: #fdeceb; color: #b03a2e; }

.pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding-top: 14px;
}

/* ---------- 分布条 ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .lab { width: 96px; color: var(--muted); flex: none; }
.bar-track { display: block; flex: 1; height: 9px; background: #f0f2f5; border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #2ea88a; border-radius: 5px; }
.bar-row .num { width: 48px; text-align: right; color: var(--muted); flex: none; }

.mini-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow: auto; }
.mini-item {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 13px;
}
.mini-item .s { color: #3a4150; line-height: 1.5; margin-bottom: 6px; }
.mini-item .m { color: var(--muted); font-size: 12px; display: flex; gap: 12px; }

/* ---------- 弹窗 ---------- */
.modal {
  background: #fff; border-radius: 14px; padding: 24px;
  width: 680px; max-width: 100%; max-height: 88vh; overflow: auto;
}
.modal.narrow { width: 520px; }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.modal label input, .modal label select, .modal label textarea { margin-top: 5px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%);
  background: #23303c; color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13.5px; z-index: 100; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}

/* ---------- 游戏开关 ---------- */
.game-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.game-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: #fafbfc;
}
.game-row .g-name { flex: 1; font-size: 14px; color: var(--text); }
.game-row .g-type { font-size: 12px; color: var(--muted); margin-left: 8px; }
.game-row .g-order { width: 70px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.switch { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #d8dee6; cursor: pointer; transition: background .2s; }
.switch.on { background: var(--primary); }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on::after { left: 23px; }
