:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #17212e;
  --ink-2: #3c4b5e;
  --muted: #7b8a9c;
  --line: #e2e9f1;
  --brand: #1b6ec2;
  --brand-dark: #124f8e;
  --brand-soft: #e8f2ff;
  --ok: #18a058;
  --ok-soft: #e7f7ef;
  --warn: #d98207;
  --warn-soft: #fff4e2;
  --danger: #d64545;
  --danger-soft: #fdeeee;
  --shadow: 0 1px 2px rgba(20, 40, 70, .05), 0 8px 24px rgba(20, 40, 70, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(100deg, #16202c, #1b2b3d 65%, #1d3a57);
  color: #fff;
  padding: 0 28px;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #2c8ef0, #1b6ec2);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(44, 142, 240, .35);
}
.brand-mark svg { width: 22px; height: 22px; fill: #fff; }
.brand h1 { font-size: 17px; letter-spacing: .3px; }
.brand p { margin: 1px 0 0; font-size: 12px; color: #9db4cc; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .12);
  color: #d8e6f5; border-radius: 999px; padding: 5px 12px; font-size: 12px;
}
.pill.good { background: rgba(55, 190, 120, .15); border-color: rgba(55, 190, 120, .3); color: #a9ecc7; }
.link-btn {
  color: #cfe3f8; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  padding: 7px 13px; border-radius: 8px; font-size: 13px;
}
.link-btn:hover { background: rgba(255,255,255,.16); text-decoration: none; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 20px 22px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 180px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: #72b2f0; box-shadow: 0 0 0 3px rgba(44,142,240,.12); }
textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
input[type=file] { width: 100%; padding: 9px; border: 1px dashed #b9cbe0; border-radius: 9px; background: var(--surface-2); }
.checkbox { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-2); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.7; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  padding: 9px 15px; border-radius: 9px; font-weight: 600; font-size: 13px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #b9cbe0; background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(27,110,194,.2); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--danger); border-color: #f0cccc; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  border: 0; background: transparent; padding: 10px 16px; color: var(--muted);
  font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: #c7ecd8; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #f3ddb4; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3cccc; }
.badge.info { background: var(--brand-soft); color: var(--brand); border-color: #cfe2f8; }

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
.stat .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- 用户端：登录 ---------- */
.auth-card { max-width: 420px; margin: 46px auto; padding: 28px; }
.auth-card h2 { font-size: 20px; margin-bottom: 4px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); padding: 3px; border-radius: 10px; margin: 18px 0 20px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgba(20,40,70,.1); }

/* ---------- 用户端：授权卡 ---------- */
.grant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.grant { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.grant-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.grant-head h3 { font-size: 16px; }
.grant-head .small { margin-top: 2px; }
.kv { display: grid; grid-template-columns: 74px 1fr; gap: 6px 10px; font-size: 13px; align-items: center; }
.kv .k { color: var(--muted); font-size: 12.5px; }
.kv .v { font-weight: 600; word-break: break-all; }
.code-box {
  background: linear-gradient(135deg, #f2f8ff, #eaf3ff);
  border: 1px solid #d5e6fb; border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.code-value { font: 700 32px/1.1 "SFMono-Regular", Consolas, monospace; letter-spacing: 9px; color: #124f8e; }
.code-value.empty { color: #9db4cc; letter-spacing: 4px; font-size: 15px; font-weight: 500; }
.code-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.progress { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; width: 0; height: 100%; background: var(--brand); border-radius: 99px; transition: width .2s linear; }
.full { width: 100%; }
.mb { margin-bottom: 18px; }
.mt { margin-top: 18px; }
.mt-sm { margin-top: 14px; }
.hint.tight { margin: 8px 0 0; }
.progress.warn > i { background: var(--warn); }
.quota { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 12px; color: var(--ink-2); }
.chip b { color: var(--brand); }
.quota-reset { margin-top: -6px; padding: 8px 11px; border-radius: 8px; font-size: 12px; line-height: 1.6; background: var(--warn-soft); color: #8b5a06; border: 1px solid #f3ddb4; }
.quota-reset b { color: #a35c00; }
.quota-reset [data-role=resetWait] { font-weight: 700; }
.msg { padding: 10px 12px; border-radius: 9px; font-size: 12.5px; line-height: 1.6; }
.msg.err { background: var(--danger-soft); color: #a83232; border: 1px solid #f3cccc; }
.msg.warn { background: var(--warn-soft); color: #8b5a06; border: 1px solid #f3ddb4; }
.empty-state { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 34px; opacity: .5; }
.empty-state h3 { color: var(--ink-2); margin: 10px 0 4px; font-size: 16px; }
.notice { background: var(--brand-soft); border: 1px solid #cfe2f8; color: #174a7c; border-radius: 12px; padding: 13px 16px; font-size: 13px; line-height: 1.7; margin-bottom: 18px; }
.notice.warn { background: var(--warn-soft); border-color: #f3ddb4; color: #7c5209; }

/* ---------- 弹窗 ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15, 27, 42, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 16px; width: min(720px, 100%); max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(10,25,45,.24); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--surface); }
.close-x { border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; padding: 2px 6px; }
.sub-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.sub-tab { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; }
.sub-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.preview-list { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.preview-list table { font-size: 12.5px; }

/* ---------- 其它 ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: #1b2634; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(10,25,45,.24); opacity: 0;
  transition: .25s; pointer-events: none; z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b33737; }
.toast.warn { background: #a96905; }
.footer { margin-top: 34px; color: var(--muted); font-size: 12px; line-height: 1.8; text-align: center; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { max-width: 320px; }
.section-title { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1.35fr; gap: 18px; align-items: start; }

/* ---------- 增强：批量操作 / 分页 / 趋势 / 公告 ---------- */
.col-check { width: 36px; text-align: center; }
.col-check input { width: 15px; height: 15px; accent-color: var(--brand); }
.bulkbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 14px;
}
.mini-select { width: auto; min-width: 130px; max-width: 190px; padding: 6px 9px; font-size: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.trend-svg { display: block; width: 100%; height: 96px; }
.notice.info { background: var(--ok-soft); border-color: #c7ecd8; color: #176b41; }
.notice.announcement { background: #fff8e8; border-color: #f0dfb8; color: #7a5510; white-space: pre-wrap; }
.mini-table td, .mini-table th { padding: 8px 10px; font-size: 12px; }
.account-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
/* 管理员 / 权限矩阵 */
.perm-off { opacity: .55; }
.perm-group { margin-top: 16px; }
.perm-group-title {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 650; color: var(--ink-2);
  padding: 7px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 9px; }
.perm-item, .perm-check {
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12px;
}
.perm-item b, .perm-check b { font-size: 12.5px; color: var(--ink); }
.perm-item span, .perm-check small { color: var(--muted); line-height: 1.5; }
.perm-item code, .perm-check code {
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px;
  color: var(--brand); background: var(--brand-soft); padding: 1px 5px; border-radius: 5px; align-self: flex-start;
}
.perm-item em, .perm-check em {
  font-style: normal; font-size: 11px; color: #8b5a06; background: var(--warn-soft);
  padding: 2px 7px; border-radius: 6px; align-self: flex-start;
}
.perm-check { flex-direction: row; align-items: flex-start; gap: 9px; cursor: pointer; }
.perm-check input { width: 16px; height: 16px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.perm-check > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.perm-check.locked { opacity: .72; cursor: not-allowed; }
/* ---------- 参照复刻站：侧边栏分组导航 + 品牌登录页 ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #16202c, #1b2b3d 60%, #17324c);
  color: #d8e6f5; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #2c8ef0, #1b6ec2); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(44,142,240,.35); }
.side-mark svg { width: 22px; height: 22px; fill: #fff; }
.side-brand .name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .3px; }
.side-brand .desc { font-size: 11px; color: #8fa9c2; margin-top: 2px; }
.side-nav { padding: 10px; flex: 1; }
.nav-group { font-size: 11px; color: #7f9ab5; letter-spacing: 1px; padding: 14px 10px 6px; font-weight: 600; }
.side-nav .tab {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; border-bottom: 0 !important; background: transparent;
  color: #b9cee2; padding: 9px 11px; border-radius: 9px;
  font-size: 13px; font-weight: 500; text-align: left; margin-bottom: 2px;
}
.side-nav .tab:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav .tab.active {
  background: linear-gradient(90deg, rgba(44,142,240,.28), rgba(44,142,240,.08));
  color: #fff; border-bottom: 0 !important; box-shadow: inset 2px 0 0 #2c8ef0;
}
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: #55708c; flex: none; }
.side-nav .tab.active .nav-dot { background: #5ab0ff; box-shadow: 0 0 8px #5ab0ff; }
.side-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.side-who { font-size: 12.5px; color: #cfe0f0; margin-bottom: 3px; }
.side-who.small { font-size: 11px; color: #8fa9c2; }
.side-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.side-links .link-btn { padding: 5px 9px; font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.main-top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 26px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.main-top h2 { font-size: 19px; }
.main-top p { margin: 2px 0 0; font-size: 12px; }
.main-top .pill { background: var(--ok-soft); border-color: #c7ecd8; color: #176b41; }
.content { padding: 22px 26px 46px; max-width: 1400px; width: 100%; }

/* 登录页左右分栏（管理端与用户端共用） */
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-hero { background: linear-gradient(140deg, #16202c, #1b3a5c 70%, #1d5486); color: #fff; padding: 76px 8vw; display: flex; flex-direction: column; justify-content: center; }
.hero-mark { width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(135deg, #2c8ef0, #1b6ec2); display: grid; place-items: center; font-size: 26px; font-weight: 700; box-shadow: 0 10px 30px rgba(44,142,240,.4); margin-bottom: 26px; }
.login-hero h1 { font-size: 30px; line-height: 1.35; margin-bottom: 14px; }
.login-hero > p { color: #b9d2e8; font-size: 14px; line-height: 1.9; max-width: 460px; }
.hero-steps { margin-top: 38px; display: flex; flex-direction: column; gap: 18px; }
.hero-step { display: flex; align-items: center; gap: 14px; font-size: 13.5px; color: #dceaf7; }
.hero-step i { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); display: grid; place-items: center; font-style: normal; font-size: 12px; flex: none; }
.login-panel { background: var(--bg); display: grid; place-items: center; padding: 40px 24px; }
.login-box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow); }
.login-box h2 { font-size: 21px; }
.login-box > p { margin: 4px 0 0; }
.hint-box { margin-top: 20px; background: var(--brand-soft); border: 1px solid #cfe2f8; color: #174a7c; border-radius: 10px; padding: 12px 14px; font-size: 12px; line-height: 1.8; }
.hint-box code { background: rgba(255,255,255,.65); padding: 1px 5px; border-radius: 4px; }
/* 登录页：忘记账号/密码 → 凭卡密找回 */
.auth-links { margin-top: 14px; text-align: center; }
.auth-back { margin: 10px 0 16px; }
.text-link { background: none; border: 0; padding: 4px 6px; cursor: pointer; color: var(--brand); font-size: 12.5px; font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.auth-back .text-link { color: var(--muted); }
.recover-found { line-height: 1.8; }
.recover-username { font-size: 16px; font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; max-height: 320px; overflow: auto; }
.code-grid > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; font-size: 12.5px; letter-spacing: .4px; }
.tutorial { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface-2); }
.tutorial h4 { font-size: 14px; margin-bottom: 6px; }
.tutorial p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.75; white-space: pre-wrap; }
.pw-hidden { letter-spacing: 3px; color: var(--muted); }

@media (max-width: 860px) {
  .two-col { grid-template-columns: 1fr; }
  .account-panel { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
  .wrap { padding: 20px 14px 44px; }
  .topbar { padding: 12px 16px; }
}
/* 登录页全屏时隐藏顶栏与主容器 */
body.auth-mode .topbar, body.auth-mode .wrap { display: none; }
body.auth-mode { background: var(--bg); }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 44px 28px; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 18px 14px 40px; }
}

/* ---------- 高密度运营看板（参照复刻站） ---------- */
.scope-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 14px; font-size: 13px;
}
.scope-bar b { font-size: 14px; }
.pill-lite {
  background: var(--brand-soft); color: var(--brand); border: 1px solid #cfe2f8;
  border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600;
}
.scope-note { color: var(--muted); font-size: 12px; margin-left: auto; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); min-width: 0;
}
.metric .m-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.metric .m-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.metric .m-icon svg { width: 17px; height: 17px; }
.metric .m-value { font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.35; }
.metric .m-foot { font-size: 11.5px; color: var(--muted); }
.metric.blue .m-icon { color: #1b6ec2; background: #e8f2ff; }
.metric.teal .m-icon { color: #0f8a6a; background: #e4f6f0; }
.metric.amber .m-icon { color: #c58a1c; background: #fff4e2; }
.metric.green .m-icon { color: #18a058; background: #e7f7ef; }
.pool-bar {
  display: flex; align-items: center; gap: 0; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  margin: 14px 0 18px; padding: 6px 10px;
}
.pool-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 18px; border-right: 1px solid var(--line); }
.pool-item:last-of-type { border-right: 0; }
.pool-item span { font-size: 11.5px; color: var(--muted); }
.pool-item b { font-size: 17px; }
.pool-note { margin-left: auto; color: var(--muted); font-size: 11.5px; padding-right: 8px; }
.two-col.dash-col { grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.dash-card { padding: 16px 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { font-size: 14.5px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.section-head h3 { font-size: 15.5px; }
.section-head span { font-size: 11.5px; color: var(--muted); }
.seg.small-seg { display: inline-flex; margin: 0 0 10px; padding: 2px; gap: 2px; width: auto; }
.seg.small-seg button { flex: none; padding: 5px 13px; font-size: 12px; font-weight: 600; }
.chart { display: block; width: 100%; height: 178px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 4px 0; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.donut-legend > div { display: flex; align-items: center; gap: 7px; }
.donut-legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.donut-legend b { font-size: 14px; color: var(--ink); }
.donut-legend span { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.rank-sub { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 4px; }
.rank-row { padding: 9px 0; border-bottom: 1px solid var(--surface-2); }
.rank-row:last-child { border-bottom: 0; }
.rank-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.rank-no { width: 19px; height: 19px; border-radius: 6px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: 11px; flex: none; }
.rank-row:first-child .rank-no { background: var(--brand-soft); color: var(--brand); }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name em { font-style: normal; color: var(--muted); }
.rank-top b { font-size: 12px; color: var(--brand); }
.rank-bar { height: 4px; background: var(--surface-2); border-radius: 99px; margin: 6px 0 4px 27px; overflow: hidden; }
.rank-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #18a058, #43c184); border-radius: 99px; }
.rank-foot { font-size: 11px; color: var(--muted); margin-left: 27px; }
.empty-row { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 12.5px; }
.dash-card .table-wrap table { font-size: 12.5px; }
.dash-card .table-wrap td, .dash-card .table-wrap th { padding: 8px 9px; }
.dash-card .table-wrap td:first-child { white-space: nowrap; }
.issue-seg { max-width: 480px; }
.stock-info { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 4px 0 14px; }
.stock-info > div { display: flex; justify-content: space-between; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; }
.stock-info span { color: var(--muted); }
.stock-info b { color: var(--ink); }
@media (max-width: 560px) { .stock-info { grid-template-columns: 1fr; } }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
  .two-col.dash-col { grid-template-columns: 1fr; }
  .pool-note { width: 100%; margin: 6px 0 2px; }
  .scope-note { margin-left: 0; }
}
@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr; }
  .pool-item { padding: 8px 12px; }
}

/* ---------- 用户端：分区导航与工作台 ---------- */
.user-nav {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 5px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.user-nav button {
  border: 0; background: transparent; color: var(--muted); font-weight: 600;
  font-size: 13px; padding: 9px 16px; border-radius: 8px;
}
.user-nav button:hover { background: var(--surface-2); color: var(--ink-2); }
.user-nav button.active { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(27,110,194,.22); }
.user-sec { min-width: 0; }
.user-metrics { margin-bottom: 18px; }
.two-col.user-home-cols { grid-template-columns: 1fr 1fr; gap: 18px; }
.user-home-cols .card { min-width: 0; }
.user-home-cols .hint { padding-left: 18px; }
#recentLogs .table-wrap td, #recentLogs .table-wrap th { padding: 7px 8px; font-size: 12px; }
@media (max-width: 980px) {
  .two-col.user-home-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .user-nav button { padding: 8px 10px; font-size: 12px; }
  .user-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================
   v2 · 视觉美化 + 手机端适配（纯样式层，不改变业务 DOM）
   ========================================================== */
:root {
  --radius: 15px;
  --shadow: 0 1px 2px rgba(20, 40, 70, .045), 0 12px 30px -14px rgba(20, 50, 90, .2);
  --shadow-hover: 0 2px 6px rgba(20, 40, 70, .06), 0 20px 44px -18px rgba(20, 50, 90, .3);
}

html { -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(920px 440px at 6% -10%, rgba(74, 156, 240, .14), transparent 68%),
    radial-gradient(760px 380px at 100% -4%, rgba(24, 170, 140, .09), transparent 66%);
  background-attachment: fixed;
  color-scheme: light;
}
::selection { background: #cfe4ff; color: #124f8e; }
:focus-visible { outline: 2px solid #2c8ef0; outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: #c9d8e8 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #c9d8e8; border: 2px solid transparent; background-clip: padding-box; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: #a9c3dd; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

@keyframes wbPop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- 顶栏 / 侧边栏 ---------- */
.topbar {
  background: linear-gradient(105deg, #101a26 0%, #1a2c40 58%, #173e63 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 28px rgba(12,26,44,.2);
  position: relative;
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90,180,255,.55), transparent);
}
.brand-mark { box-shadow: 0 6px 18px rgba(44,142,240,.45), inset 0 1px 0 rgba(255,255,255,.35); }
.brand h1 { letter-spacing: .4px; }
.pill { backdrop-filter: blur(6px); }
.side-brand { background: linear-gradient(180deg, rgba(255,255,255,.055), transparent); }
.sidebar { box-shadow: 8px 0 30px rgba(8,20,36,.14); }
.side-nav .tab { transition: background .18s, color .18s, transform .18s; }
.side-nav .tab:hover { transform: translateX(2px); }
.side-nav .tab.active {
  background: linear-gradient(90deg, rgba(44,142,240,.38), rgba(44,142,240,.07));
  box-shadow: inset 2px 0 0 #5ab0ff, 0 4px 14px -8px rgba(44,142,240,.8);
}
.main-top { background: rgba(255,255,255,.88); backdrop-filter: blur(10px); }
.main-top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn {
  display: none; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; padding: 0; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  box-shadow: 0 1px 2px rgba(20,40,70,.05); transition: background .18s, transform .12s;
}
.menu-btn:hover { background: var(--brand-soft); }
.menu-btn:active { transform: scale(.95); }
.menu-btn svg { width: 19px; height: 19px; }
.side-mask { display: none; }

/* ---------- 卡片 / 按钮 / 表单 ---------- */
.card {
  border-color: rgba(213, 226, 240, .95);
  box-shadow: var(--shadow);
  transition: box-shadow .24s, border-color .24s;
}
.card.pad:hover, .dash-card:hover, .grant:hover { border-color: #c9dcf0; box-shadow: var(--shadow-hover); }
.btn {
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: 0 1px 2px rgba(20,40,70,.05);
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(20,50,90,.13); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  background: linear-gradient(180deg, #2b86e0, #1b6ec2); border-color: #1b6ec2;
  box-shadow: 0 4px 14px rgba(27,110,194,.28), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #1f78d2, #155da8);
  box-shadow: 0 8px 22px rgba(27,110,194,.36);
}
.btn.sm { border-radius: 8px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(44,142,240,.16); }

/* ---------- 指标卡 / 统计 ---------- */
.stat, .metric {
  position: relative; overflow: hidden;
  border-color: rgba(213, 226, 240, .95); box-shadow: var(--shadow);
  transition: box-shadow .24s, border-color .24s, transform .24s;
}
.stat::before, .metric::before {
  content: ''; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, #2c8ef0, #74baff 55%, transparent);
}
.metric.teal::before { background: linear-gradient(90deg, #12a37c, #69d8b6 55%, transparent); }
.metric.amber::before { background: linear-gradient(90deg, #df9a1c, #f7d387 55%, transparent); }
.metric.green::before { background: linear-gradient(90deg, #18a058, #74d8a4 55%, transparent); }
.stat:hover, .metric:hover { transform: translateY(-2px); border-color: #c9dcf0; box-shadow: var(--shadow-hover); }
.metric .m-value { color: #14243a; }
.metric .m-icon { box-shadow: inset 0 1px 0 rgba(255,255,255,.85); border: 1px solid rgba(255,255,255,.75); }
.user-nav { gap: 3px; }
.user-nav button { transition: background .18s, color .18s, box-shadow .18s; }
.user-nav button.active {
  background: linear-gradient(180deg, #2b86e0, #1b6ec2);
  box-shadow: 0 4px 14px rgba(27,110,194,.3), inset 0 1px 0 rgba(255,255,255,.2);
}

/* ---------- 表格 / 徽章 / 提示 ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: auto; -webkit-overflow-scrolling: touch; }
th { letter-spacing: .25px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f5faff; }
.badge { letter-spacing: .2px; }
.notice { border-left: 3px solid #4a9bef; }
.notice.warn { border-left-color: #e0a020; }
.notice.info { border-left-color: #18a058; }
.notice.announcement { border-left-color: #d9a43a; }
.quota-reset { border-left: 3px solid #e0a020; }
.code-box {
  background: linear-gradient(135deg, #f0f8ff, #e6f1ff 60%, #eef6ff);
  border-color: #c9e0f8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 8px 20px -14px rgba(27,110,194,.7);
}
.code-value { text-shadow: 0 2px 10px rgba(27,110,194,.18); white-space: nowrap; }
.code-box > div { flex: 1; min-width: 0; }
.code-box > .btn { flex: none; }
.hint-box { border-left: 3px solid #7ab4ee; }

/* ---------- 登录页 / 弹窗 ---------- */
.login-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, #0f1b28, #1b3a5c 62%, #1d5486);
}
.login-hero::before {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  right: -170px; top: -190px; pointer-events: none;
  background: radial-gradient(circle, rgba(70,160,255,.3), transparent 66%);
}
.login-hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
}
.login-hero > * { position: relative; z-index: 1; }
.hero-mark { box-shadow: 0 14px 40px rgba(44,142,240,.5), inset 0 1px 0 rgba(255,255,255,.35); }
.hero-step i { background: rgba(255,255,255,.1); }
.login-box {
  border-color: #dbe6f2;
  box-shadow: 0 24px 60px -24px rgba(16,40,70,.4), 0 2px 8px rgba(16,40,70,.06);
}
.backdrop { background: rgba(12,24,40,.52); backdrop-filter: blur(3px); }
.modal { animation: wbPop .22s ease both; box-shadow: 0 30px 80px rgba(8,20,36,.3); }
.toast { border-radius: 12px; box-shadow: 0 14px 36px rgba(8,20,36,.3); }

/* ---------- 平板：≤ 980px ---------- */
@media (max-width: 980px) {
  html, body { overflow-x: hidden; overflow-x: clip; }
  .wrap, .content, .main, .card, .metric, .dash-card, .grant, .user-sec { min-width: 0; max-width: 100%; }
  .kv { grid-template-columns: 68px minmax(0, 1fr); }

  /* 管理端侧边栏改为抽屉 */
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(276px, 84vw); height: 100dvh; z-index: 70;
    transform: translateX(-102%);
    transition: transform .26s cubic-bezier(.22,.7,.3,1);
    box-shadow: 14px 0 40px rgba(8,20,36,.36);
    overscroll-behavior: contain;
  }
  body.side-open .sidebar { transform: none; }
  body.side-open { overflow: hidden; }
  .side-mask {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(9,20,34,.5); opacity: 0; pointer-events: none;
    transition: opacity .24s;
  }
  body.side-open .side-mask { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .main-top { padding: 13px 16px; }
  .main-top h2 { font-size: 17px; }
  .content { padding: 16px 14px 36px; }

  .login-hero { padding: 30px 32px; }
  .login-hero h1 { font-size: 24px; }
  .hero-steps { margin-top: 24px; gap: 12px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .user-nav::-webkit-scrollbar { display: none; }
  .user-nav button { flex: none; }
}
@media (min-width: 561px) and (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr 1fr; }
  .login-hero { padding: 40px 30px; }
  .hero-steps { display: none; }
}

/* ---------- 手机：≤ 560px ---------- */
@media (max-width: 560px) {
  body { font-size: 13.5px; }
  .wrap { padding: 16px 12px 40px; }
  .topbar { padding: 11px 13px; min-height: 0; gap: 8px; }
  .brand { gap: 9px; }
  .brand-mark { width: 33px; height: 33px; border-radius: 9px; }
  .brand-mark svg { width: 19px; height: 19px; }
  .brand h1 { font-size: 15px; }
  .brand p { font-size: 10.5px; }
  .topbar-right { gap: 6px; }
  .pill, .link-btn { font-size: 11px; padding: 5px 9px; }

  .user-nav { padding: 4px; border-radius: 11px; }
  .user-nav button { padding: 9px 13px; font-size: 12.5px; min-height: 38px; -webkit-tap-highlight-color: transparent; }
  .metric-grid, .user-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .metric { padding: 12px 13px; }
  .metric .m-value { font-size: 23px; }
  .metric .m-top { font-size: 11.5px; }
  .metric .m-icon { width: 26px; height: 26px; }
  .metric .m-icon svg { width: 15px; height: 15px; }
  .metric .m-foot { font-size: 10.5px; }

  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head h2 { font-size: 18px; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row .btn { flex: 1; }
  .card.pad, .dash-card { padding: 15px 14px; }
  .notice { font-size: 12.5px; padding: 11px 13px; }
  .section-title { font-size: 14px; }
  .row { gap: 9px; }
  #activateForm { flex-direction: column; align-items: stretch; }
  #activateForm .grow { min-width: 0; }
  #activateForm .btn { width: 100%; }
  input[type=text], input[type=password], input[type=number], select, textarea {
    font-size: 16px; padding: 11px 12px; min-height: 44px;
  }
  .btn { min-height: 40px; padding: 9px 13px; }
  .btn.sm { min-height: 34px; }
  .btn.full { width: 100%; }

  .grant-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grant { padding: 15px 14px; }
  .code-box { padding: 12px; flex-direction: column; align-items: stretch; gap: 10px; }
  .code-box > .btn { width: 100%; }
  .code-value { font-size: 26px; letter-spacing: 6px; }
  .code-value.empty { font-size: 15px; letter-spacing: 2px; }
  .code-meta { white-space: normal; }
  .quota { gap: 6px; }
  .chip { font-size: 11.5px; padding: 5px 8px; }

  .two-col, .two-col.user-home-cols, .two-col.dash-col,
  .grid-2, .account-panel, .stock-info, .perm-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .pool-bar { flex-wrap: nowrap; overflow-x: auto; }
  .pool-item { flex: none; }
  .pool-note { display: none; }
  .scope-bar { gap: 8px; font-size: 12px; }
  .scope-note { width: 100%; }
  .donut-wrap { justify-content: center; }
  .donut { width: 132px; height: 132px; }
  .chart { height: 158px; }
  .seg.small-seg button { padding: 6px 11px; }
  .card-head { gap: 8px; flex-wrap: wrap; }

  /* 宽表格在手机上横向滚动查看，列内文字不竖排 */
  .table-wrap { border-radius: 10px; }
  .wrap table, .modal table { min-width: 560px; font-size: 12px; }
  .content table { min-width: 820px; font-size: 12px; }
  .dash-card .table-wrap table { min-width: 620px; }
  th, td { padding: 8px 9px; white-space: nowrap; }
  .bulkbar, .toolbar, .pager { gap: 8px; }

  /* 登录页：压缩品牌区，登录框优先 */
  .login-wrap { grid-template-columns: 1fr; min-height: 100dvh; }
  .login-hero { padding: 22px 20px 18px; }
  .hero-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; margin-bottom: 12px; }
  .login-hero h1 { font-size: 19px; margin-bottom: 5px; }
  .login-hero > p { font-size: 12px; line-height: 1.6; }
  .hero-steps { display: none !important; }
  .login-panel { padding: 16px 13px 30px; display: block; }
  .login-box { width: 100%; padding: 22px 18px; border-radius: 15px; }
  .login-box h2 { font-size: 19px; }
  .hint-box { margin-top: 14px; font-size: 11.5px; }
  .auth-links { margin-top: 12px; }

  /* 弹窗改为底部抽屉 */
  .backdrop { padding: 0; place-items: end center; }
  .modal {
    width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .modal-head { padding: 15px 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .btn { flex: 1; }
  .toast {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    font-size: 12.5px; max-width: calc(100vw - 28px);
  }
  .footer { font-size: 11px; margin-top: 24px; }
}
@media (max-width: 400px) {
  .metric-grid, .user-metrics { gap: 8px; }
  .metric { padding: 11px; }
  .metric .m-value { font-size: 20px; }
  .brand p, .topbar-right .pill { display: none; }
  .scope-bar { padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
