/* ============================================================
   管理后台 — 设计系统
   重写版 2026-08-22

   原则：
   1. 一套元件。同一种东西全站只有一种写法与一种样子。
   2. 输入框、下拉、按钮的高度一律 36px，放在同一排就会自然对齐。
   3. 不用装饰性造型（胶囊、大圆球）。
   ============================================================ */

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

:root {
  /* 侧栏 */
  --nav: #0E1520;
  --nav-2: #161F2D;
  --nav-line: rgba(255,255,255,.07);
  --nav-text: #8A97A8;
  --nav-sec: #55627A;

  /* 强调色：只用在「当前位置」与「主要金额」 */
  --gold: #C9A227;
  --gold-deep: #A8871B;
  --gold-soft: #FFF8E6;
  --gold-line: #F0DFAE;

  /* 内容区 */
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --line: #E3E7ED;
  --line-soft: #EFF2F6;
  --head: #F7F9FB;

  --ink: #111823;
  --muted: #6B7684;
  --faint: #9AA4B2;

  --ok: #1F9D63;      --ok-bg: #E4F5EC;
  --warn: #D48806;    --warn-bg: #FDF2DC;
  --bad: #D3413F;     --bad-bg: #FBE7E7;
  --info: #2563C9;

  --r: 10px;
  --r-sm: 8px;
  --ctl-h: 36px;                 /* 所有输入框、下拉、按钮共用高度 */
  --shadow: 0 1px 2px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.16);
  --sidebar-w: 214px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.55 "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: .01em; }
a { color: var(--info); text-decoration: none; }

/* ============ 表单控制项：全站共用 ============ */
.ctl {
  height: var(--ctl-h);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  padding: 0 11px;
  font: inherit; font-size: 13px; color: var(--ink);
  min-width: 0; max-width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
select.ctl { padding-right: 28px; }
textarea.ctl { height: auto; min-height: 78px; padding: 9px 11px; resize: vertical; }
.ctl:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.16); }
.ctl:disabled { background: var(--head); color: var(--faint); cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field > small { font-size: 11.5px; color: var(--faint); }

/* ============ 按钮：跟输入框同高 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl-h); padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--nav); color: #fff; }
.btn-primary:hover { background: #1B2637; }
.btn-plain { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-plain:hover { border-color: #C7CFDA; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #BC3634; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-icon {
  width: var(--ctl-h); height: var(--ctl-h); padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--muted); cursor: pointer;
}
.btn-icon:hover { color: var(--ink); border-color: #C7CFDA; }

/* 表格内的文字动作 */
.act {
  background: none; border: 0; padding: 2px 0; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--info);
}
.act:hover { text-decoration: underline; }
.act.danger { color: var(--bad); }
.act.primary { color: var(--gold-deep); }
.act:disabled { color: var(--faint); cursor: not-allowed; text-decoration: none; }
.acts { display: flex; gap: 12px; flex-wrap: wrap; }

/* 文字连结（表格里点名称进详情） */
.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--info); text-align: left;
}
.link:hover { text-decoration: underline; }

/* ============ 图标 ============ */
.ic { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }

/* ============ 登录 ============ */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1000px 600px at 50% -10%, #1B2637 0%, transparent 60%), linear-gradient(160deg, #0E1520, #131C2A);
}
.login-title { position: absolute; top: 26px; left: 28px; color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.login-card {
  width: min(390px, 100%); background: #fff; border-radius: 14px;
  padding: 30px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 15px;
}
.login-card h1 { font-size: 21px; }
.login-card > p { color: var(--muted); font-size: 13px; margin-top: -8px; }
.login-card .btn { width: 100%; }
.login-msg { font-size: 12.5px; color: var(--bad); min-height: 18px; }

/* ============ 外框 ============ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.side {
  background: var(--nav); display: flex; flex-direction: column; padding-bottom: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none;
}
.side::-webkit-scrollbar { display: none; }
.side-title { padding: 18px 18px 16px; border-bottom: 1px solid var(--nav-line); color: #fff; font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.side-group { color: var(--nav-sec); font-size: 11px; letter-spacing: .14em; font-weight: 700; padding: 17px 18px 6px; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 18px; border: 0; border-left: 3px solid transparent;
  background: none; color: var(--nav-text); font: inherit; font-size: 13.5px;
  text-align: left; cursor: pointer; transition: background .12s, color .12s;
}
.side-item:hover { color: #C7D0DC; background: rgba(255,255,255,.03); }
.side-item.on { background: var(--nav-2); color: #fff; border-left-color: var(--gold); font-weight: 600; }
.side-item.on .side-ic { color: var(--gold); }
.side-ic { display: grid; place-items: center; color: #55627A; }
.side-ic .ic { width: 18px; height: 18px; }
.side-foot {
  margin-top: auto; padding: 14px 18px 0; border-top: 1px solid var(--nav-line);
  display: flex; align-items: center; gap: 9px; color: var(--nav-sec); font-size: 11.5px;
}
.side-foot strong { display: block; color: #C7D0DC; font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,157,99,.2); flex: none; }
.side-mask { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ============ 顶栏 ============ */
.top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: #fff; position: sticky; top: 0; z-index: 20;
}
.top h1 { font-size: 19px; }
.top-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 9px; position: relative; }
.top-clock {
  display: flex; align-items: center; gap: 7px; height: var(--ctl-h);
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--muted); font-size: 12.5px; white-space: nowrap;
}
.top-user {
  display: flex; align-items: center; gap: 9px; height: var(--ctl-h);
  padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; font: inherit; cursor: pointer;
}
.top-user strong { display: block; font-size: 13px; font-weight: 600; }
.top-user small { display: block; font-size: 11px; color: var(--faint); }
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; min-width: 150px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg); padding: 5px;
}
.menu button { display: block; width: 100%; text-align: left; padding: 8px 11px; border: 0; border-radius: 6px; background: none; font: inherit; font-size: 13px; cursor: pointer; }
.menu button:hover { background: var(--head); }
.burger { display: none; }

.page { padding: 20px 22px 44px; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.page-intro { color: var(--muted); font-size: 12.5px; max-width: 76ch; }
.page-intro strong { color: var(--ink); }

/* ============ 卡片 ============ */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; }
.card-head p { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.card-head .acts, .card-head .btn { flex: none; }
.card-body { padding: 15px 16px; min-width: 0; }

/* ============ 指标 ============ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 15px 17px; box-shadow: var(--shadow); min-width: 0; }
.stat > span { display: block; font-size: 12.5px; color: var(--muted); }
.stat > strong { display: block; font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.015em; margin: 6px 0 4px; }
.stat > small { display: block; font-size: 11.5px; color: var(--faint); }
.stat .unit { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.stat.lead { background: linear-gradient(135deg, #131C2A, #0E1520); border-color: #0E1520; }
.stat.lead > span { color: #9AA9BC; }
.stat.lead > strong { color: var(--gold); }
.stat.lead > small, .stat.lead .unit { color: #7E8DA1; }
.stat small.up { color: var(--ok); font-weight: 600; }
.stat small.down { color: var(--bad); font-weight: 600; }

/* ============ 筛选列 ============ */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding: 15px 16px;
}
.filters .field { flex: 1 1 168px; }
.filters .field-scope { flex: 0 0 200px; }
.filters .btns { display: flex; gap: 9px; flex: 0 0 auto; margin-left: auto; }

/* ============ 表格 ============ */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  padding: 9px 12px; background: var(--head); border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFBFC; }
td.neg { color: var(--bad); font-weight: 600; }
td.tr, th.tr { text-align: right; }
td.tcell-act { white-space: nowrap; width: 1%; }
td small { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; font-weight: 400; }
.cell-empty { text-align: center; color: var(--faint); padding: 30px 12px !important; }
.soft { color: var(--faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.tc { text-align: center; padding-top: 4px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ============ 状态标签 ============ */
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.tag-info { background: #E6EEFB; color: var(--info); }
.tag-mute { background: #EEF1F5; color: var(--muted); }

/* ============ 空状态 ============ */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 44px 20px; text-align: center; }
.empty strong { font-size: 14px; color: var(--muted); }
.empty p { font-size: 12.5px; color: var(--faint); max-width: 48ch; }

/* ============ 说明区块 ============ */
.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.callout { background: var(--gold-soft); border: 1px solid var(--gold-line); border-left: 3px solid var(--warn); border-radius: 7px; padding: 10px 13px; font-size: 12.5px; color: #6B4E08; }
.callout b { color: #8A6206; }
.callout.ok { background: var(--ok-bg); border-color: #BFE6D1; border-left-color: var(--ok); color: #145F3E; }
.callout.bad { background: var(--bad-bg); border-color: #F0C4C3; border-left-color: var(--bad); color: #8A2E2C; }

/* 唯读资料列 */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.row:last-child { border-bottom: 0; }
.row > span { color: var(--muted); font-size: 12.5px; }
.row > strong { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.rows.boxed { background: var(--head); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 13px; }

/* 待办列：左边可能有两行字，按钮固定在右边 */
.row-top { align-items: flex-start; }
.row-main { flex: 1; color: var(--ink) !important; font-size: 13px !important; }
.row-main small { display: block; margin-top: 3px; font-size: 11.5px; }
.row-top .act { flex: none; margin-top: 2px; }

/* 卡片底部的说明 + 主要按钮 */
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 13px 16px; border-top: 1px solid var(--line); background: var(--head);
  font-size: 12px; color: var(--muted);
}
.card-foot .btns { display: flex; gap: 9px; }
.card-body + .card-foot { border-radius: 0 0 var(--r) var(--r); }

/* 勾选清单（开放游戏） */
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 9px; min-height: var(--ctl-h);
  padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12.5px; cursor: pointer; background: #fff;
}
.pick:hover { border-color: #C7CFDA; }
.pick input { width: 15px; height: 15px; accent-color: var(--gold-deep); flex: none; cursor: pointer; }
.pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.off { background: var(--head); color: var(--faint); cursor: not-allowed; }
.pick.off input { cursor: not-allowed; }

/* 表格内的小输入框（奖池设定） */
.ctl-sm { height: 30px; padding: 0 9px; font-size: 12.5px; width: 100%; min-width: 92px; }

/* ============ 弹窗 ============ */
.modal-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 22px; }
.modal-mask { position: absolute; inset: 0; background: rgba(14,21,32,.55); }
.modal {
  position: relative; z-index: 1; width: min(600px, 100%); max-height: calc(100vh - 44px);
  background: #fff; border-radius: 13px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 19px; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 19px; border-top: 1px solid var(--line); background: var(--head); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: span 2; }
.form-split {
  grid-column: span 2; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em;
}
.modal-note { font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.modal-note strong { color: var(--ink); }
.modal-warn { font-size: 12.5px; font-weight: 600; color: var(--bad); }

/* ============ Toast ============ */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 9px; }
.toast { background: var(--nav); color: #fff; padding: 11px 16px; border-radius: var(--r-sm); font-size: 13px; box-shadow: var(--shadow-lg); max-width: 360px; animation: pop .18s ease-out; }
.toast.bad { background: var(--bad); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 图表 ============ */
.legend { display: flex; gap: 15px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-bottom: 11px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar { display: grid; grid-template-columns: minmax(96px, 140px) 1fr auto; gap: 11px; align-items: center; font-size: 12.5px; }
.bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 18px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #1F2A3A, #3A4A63); min-width: 3px; }
.bar-fill.ok { background: linear-gradient(90deg, #157A4B, #2FB278); }
.bar-fill.warn { background: linear-gradient(90deg, #B87708, #E0A030); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 两栏 / 三栏排版 */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.split-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }

/* ============ 响应式 ============ */
@media (max-width: 1240px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .split, .split-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 70; transform: translateX(-100%); transition: transform .22s; }
  .side.open { transform: none; }
  .side-mask { display: block; position: fixed; inset: 0; background: rgba(14,21,32,.5); z-index: 65; opacity: 0; pointer-events: none; transition: opacity .22s; }
  .side-mask.open { opacity: 1; pointer-events: auto; }
  .burger { display: grid; }
  .top { padding: 12px 16px; }
  .top-clock { display: none; }
  .page { padding: 16px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .form-split { grid-column: span 1; }
}
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr; }
  .filters .btns { margin-left: 0; width: 100%; }
  .top-user span { display: none; }
}
