/* ==========================================================
 * 后台维护端专属样式（在 base.css 之后加载）
 * 设计语言：Windows 11 Fluent
 * 只含后台特有组件：门控页、定额模板表格、采纳按钮等
 * 通用组件（按钮/表单/规则表格/模态框）复用 base.css
 * ========================================================== */

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }

/* ========== 顶栏：Win11 卡片式标题栏 ========== */
header {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 22px 20px; margin-bottom: 20px; box-shadow: var(--raised-1);
  position: relative; overflow: hidden;
}
/* 2026-10-25：去掉左侧 4px 品牌竖条（新拟物禁止单侧强调条） */
header::before { display: none; }
header h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
header p { color: var(--muted); margin-top: 6px; font-size: 13px; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* ========== 访问门控页 ==========
 * 2026-10-25：满宽大卡 → 居中引导卡（原 1080px 宽、上下 500px 空白，像没做完） */
.gate { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 28px; text-align: center; box-shadow: var(--raised-2); max-width: 480px; margin: 40px auto 0; }
.gate .ic { font-size: 40px; margin-bottom: 12px; }
.gate h2 { font-size: 17px; margin-bottom: 8px; }
.gate p { color: var(--muted); font-size: 13px; margin-bottom: 20px; max-width: 32ch; margin-left: auto; margin-right: auto; line-height: 1.7; }
.gate .btn { min-width: 160px; }

/* ========== 后台主界面 ========== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--raised-1); }
.admin-panel { display: flex; flex-direction: column; }

/* ========== 标签页（后台，多页签） ========== */
.tabs { display: flex; background: rgba(0,0,0,0.05); border-radius: var(--radius); padding: 3px; margin-bottom: 16px; flex-wrap: wrap; }
body.dark .tabs { background: rgba(255,255,255,0.05); }
.tab { flex: 1; min-width: 100px; border: none; background: none; padding: 9px; font-size: 13px; color: var(--muted); cursor: pointer; border-radius: var(--radius-sm); white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

/* ========== 规则表格（后台：含内联编辑输入框 + 采纳按钮） ========== */
.rules-toolbar input, .rules-toolbar select { padding: 9px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; background: var(--sunken-bg); color: var(--text); box-shadow: var(--sunken-1); }
.rules-toolbar input:focus, .rules-toolbar select:focus { outline: none; border-color: transparent; box-shadow: var(--sunken-focus); }
.rules-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); min-height: 260px; background: var(--card); }
.rules-table th { background: var(--card); text-align: left; padding: 9px 10px; font-weight: 600; border-bottom: 1px solid var(--line); position: sticky; top: 0; white-space: nowrap; z-index: 1; color: var(--muted); }
.rules-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rules-table tr:hover td { background: var(--fill-hover); }
.rules-table input { width: 100%; padding: 5px 8px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; background: var(--sunken-bg); color: var(--text); box-sizing: border-box; }
.rules-table input:focus { outline: none; border-color: transparent; box-shadow: var(--sunken-focus); }
.rules-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.rules-cell .muted { color: var(--muted); font-size: 11px; }
.rules-op { display: flex; gap: 6px; flex-wrap: wrap; }
.rules-op .adopt { border-color: rgba(78,205,196,0.4); color: var(--down); }
.rules-op .adopt:hover { background: rgba(78,205,196,0.12); border-color: var(--down); }
.rules-empty { text-align: center; color: var(--muted); padding: 44px; font-size: 13px; }
.rules-pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 14px; }
.rules-pager span { font-size: 13px; color: var(--muted); }
.meta { font-size: 12px; color: var(--muted); }
.hint2 { color: var(--muted); font-size: 12px; margin-bottom: 10px; }

/* ========== 表单（复用 base 的 rf-*，此处补后台细节） ========== */
.rules-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: var(--card); box-shadow: var(--shadow-1); }
.rf-title { font-weight: 600; font-size: 13px; margin-bottom: 12px; color: var(--text); }
.rf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.rf-group { display: flex; flex-direction: column; gap: 6px; }
.rf-group label { font-size: 12px; color: var(--muted); }
.rf-group input { padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; background: var(--sunken-bg); color: var(--text); box-shadow: var(--sunken-1); }
.rf-group input:focus { outline: none; border-color: transparent; box-shadow: var(--sunken-focus); }
.rf-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rf-foot select { padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; background: var(--sunken-bg); color: var(--text); box-shadow: var(--sunken-1); }
.rf-foot .err { width: 100%; margin: 0; color: var(--up); font-size: 12px; }

/* ========== 模态框（复用 base，补后台宽度细节） ========== */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); width: 400px; max-width: 92vw; padding: 24px; box-shadow: var(--raised-3); color: var(--text); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head b { font-size: 16px; }
.close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; border-radius: var(--radius-sm); width: 28px; height: 28px; }
.close:hover { background: var(--fill-hover); color: var(--text); }
.msg-bar { background: rgba(219,0,0,0.10); color: var(--up); font-size: 12px; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.field { margin-bottom: 12px; }
.field input { width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 14px; box-sizing: border-box; background: var(--sunken-bg); color: var(--text); box-shadow: var(--sunken-1); }
.field input:focus { outline: none; border-color: transparent; box-shadow: var(--sunken-focus); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.err { color: var(--up); font-size: 12px; margin-top: 4px; min-height: 16px; }
.wechat-tip { color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 14px; }
.btn-lg { padding: 13px 26px; font-size: 15px; width: 100%; justify-content: center; }

/* ========== 企业风控页签 ========== */
#adminPanel-enterprise .rules-table td:last-child { white-space: nowrap; }
#adminPanel-enterprise .rules-table .btn {
  padding: 4px 10px; font-size: 12px; border-radius: var(--radius-sm); box-shadow: none;
}
#adminPanel-enterprise .rules-table td { vertical-align: middle; }
#adminPanel-enterprise .rules-table td .badge { white-space: nowrap; }

/* ==========================================================
 * 凸凹材质补丁（2026-10-21）：本文件重复声明了 base 的 .tabs / .card，
 * 同特异性下会盖掉 base，所以凹面轨道与输入框要在这里再声明一次。
 * ========================================================== */
.tabs { background: var(--sunken-bg); box-shadow: var(--sunken-1); }
.tab.active { box-shadow: var(--raised-1); }
.rules-table input { background: var(--sunken-bg); box-shadow: var(--sunken-1); }
.rules-table input:focus { box-shadow: var(--sunken-focus); }
.rules-table-wrap { box-shadow: var(--sunken-1); }

/* ==========================================================
 * 账号监控（C93，2026-11-10）
 * 设计口径：统计卡只做「数字 + 标签」，不加图表 —— 后台是查问题的，
 * 一眼看到数量就够；异常色只在**有值时**出现，避免满屏红色。
 * 颜色只用既有 4 色（--up / --warn / --down / --brand），不新增色相。
 * ========================================================== */
.acct-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.acct-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; box-shadow: var(--raised-1);
}
.acct-stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--text); }
.acct-stat span { font-size: 11px; color: var(--muted); }
.acct-stat.is-warn b { color: var(--up); }

.acct-only { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
/* ⚠️ base.css 的 `.rules-toolbar input { flex: 1; padding: 9px 12px }` 会连复选框一起套上 ——
   实测被压成 0 宽（padding 吃掉 14px 的框）+ 被弹到最右，看着像被「刷新」按钮盖住。
   这里把复选框的输入框样式整套重置。 */
.acct-only input[type="checkbox"] {
  flex: 0 0 auto; width: 15px; height: 15px; min-width: 0; margin: 0; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 3px; box-shadow: none;
  background: var(--card); accent-color: var(--brand); cursor: pointer;
}

.acct-row { cursor: pointer; }
.acct-flag {
  display: inline-block; font-size: 11px; line-height: 1.6; padding: 1px 7px; border-radius: 8px;
  background: rgba(255,107,107,0.14); color: var(--up); white-space: nowrap;
}
.acct-flags { display: flex; gap: 4px; flex-wrap: wrap; }
.acct-fail { color: var(--up); font-weight: 600; }

.acct-detail {
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--sunken-bg); box-shadow: var(--sunken-1);
}
.acct-detail-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.acct-detail-h b { font-size: 13px; }
.acct-detail-h .muted { font-size: 12px; }
.acct-detail-h .btn { margin-left: auto; }
.acct-detail-list { max-height: 30vh; overflow: auto; }
.acct-ev {
  display: grid; grid-template-columns: 76px 128px 116px 1fr; gap: 10px; align-items: baseline;
  padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 12px;
}
.acct-ev:last-child { border-bottom: 0; }
.acct-ev-k { color: var(--text); }
.acct-ev-fail .acct-ev-k, .acct-ev-lock .acct-ev-k { color: var(--up); font-weight: 600; }
.acct-ev-t { color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-ev-ip { color: var(--muted); font-variant-numeric: tabular-nums; }
.acct-ev-ua { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-empty { color: var(--muted); font-size: 12px; padding: 14px 2px; }

@media (max-width: 1180px) {
  .acct-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .acct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acct-ev { grid-template-columns: 68px 1fr; }
  .acct-ev-ip, .acct-ev-ua { grid-column: 2; }
}
