/* ============================================================================
   若盈易支付 · 后台样式
   设计取向：浅色侧栏 + 高信息密度表格 + 抽屉式编辑。
   所有尺寸/颜色走变量，避免各处硬编码导致「看起来不成套」。
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --brand: #2f6fed;
  --brand-600: #1f5ede;
  --brand-50: #eef4ff;
  --brand-100: #dbe7ff;

  --bg: #f5f7fb;
  --panel: #fff;
  --line: #e9edf4;
  --line-strong: #dae1ec;

  --text: #172033;
  --text-2: #445068;
  --muted: #8b97ac;

  --ok: #0d8a4f;
  --ok-bg: #e9f8f0;
  --warn: #a15c07;
  --warn-bg: #fdf5e4;
  --danger: #d92d20;
  --danger-bg: #fdecea;
  --info: #1f5ede;
  --info-bg: #eef4ff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 10px 30px rgba(16, 24, 40, .10);
  --sidebar-w: 236px;
  --sidebar-w-collapsed: 68px;
  --header-h: 58px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Courier New", monospace;
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 13px; color: var(--text); }
::selection { background: var(--brand-100); }

/* 统一滚动条，Windows 下默认样式太抢眼 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3dae6; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9c4d4; background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 登录 ============================ */

/* 四个认证视图（登录/注册/忘记密码/重置）共用同一套骨架，
   用 class 而不是 id 选中，避免每加一个视图就复制一遍布局 */
.auth-view {
  min-height: 100vh;
  display: flex;
  background: #0e1a33;
}
.login-brand {
  position: relative;
  flex: 1 1 55%;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  overflow: hidden;
  background:
    radial-gradient(900px 480px at 12% 10%, rgba(72, 128, 255, .55), transparent 60%),
    radial-gradient(700px 520px at 88% 88%, rgba(38, 90, 200, .45), transparent 62%),
    linear-gradient(140deg, #10203f 0%, #162a52 45%, #0f1c36 100%);
}
.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 30% 35%, #000, transparent 78%);
  pointer-events: none;
}
.login-brand .lb-logo { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.login-brand .lb-logo .dot { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(145deg, #5b9bff, #2f6fed); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(47, 111, 237, .45); }
.login-brand h2 { font-size: 30px; line-height: 1.35; margin: 44px 0 12px; font-weight: 650; letter-spacing: .5px; }
.login-brand p.lead { color: rgba(226, 235, 252, .74); font-size: 14px; margin: 0 0 34px; max-width: 410px; line-height: 1.8; }
.lb-points { display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 1; }
.lb-point { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: rgba(232, 239, 252, .9); }
.lb-point .ic { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 255, 255, .1); display: grid; place-items: center; }
.lb-point b { color: #fff; font-weight: 600; }
.lb-foot { position: absolute; left: 60px; bottom: 34px; font-size: 12px; color: rgba(200, 215, 240, .45); }

.login-panel { flex: 0 0 460px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 100%; max-width: 330px; }
.login-card h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: .3px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 26px; }
.login-field { margin-bottom: 15px; }
.login-field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.login-field input {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line-strong);
  border-radius: 9px; font-size: 14px; background: #fbfcfe; transition: .15s;
}
.login-field input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.login-btn {
  width: 100%; height: 43px; margin-top: 6px; border: none; border-radius: 9px; color: #fff;
  font-size: 14.5px; font-weight: 600; letter-spacing: 1px;
  background: linear-gradient(180deg, #3b7bf5, #2f6fed);
  box-shadow: 0 6px 16px rgba(47, 111, 237, .28); transition: .15s;
}
.login-btn:hover { filter: brightness(1.04); }
.login-btn:active { transform: translateY(1px); }
.login-err { min-height: 20px; font-size: 12.5px; color: var(--danger); margin-bottom: 6px; }
.login-err.ok { color: var(--ok); }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* 验证码：输入框 + 可点击刷新的图片 */
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1 1 auto; min-width: 0; }
.captcha-img {
  flex: 0 0 126px; height: 42px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #f7f9fc; cursor: pointer; object-fit: cover;
}
.captcha-img:hover { border-color: var(--brand); }
.captcha-tip { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* 认证页底部链接 */
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-size: 12.5px; }
.auth-links a, .auth-links button.link {
  color: var(--brand); text-decoration: none; background: none; border: none;
  padding: 0; font: inherit; cursor: pointer;
}
.auth-links a:hover, .auth-links button.link:hover { text-decoration: underline; }
.auth-links .muted-link { color: var(--muted); }
.auth-title { font-size: 22px; margin: 0 0 6px; letter-spacing: .3px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; line-height: 1.7; }
.login-card .field-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

@media (max-width: 900px) {
  .login-brand { display: none; }
  .login-panel { flex: 1 1 auto; background: #fff; }
}

/* ============================ 骨架 ============================ */

#app-view { display: none; min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: width .18s ease, transform .22s ease;
}
.sidebar .brand {
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 auto;
  background: linear-gradient(145deg, #4f8dff, #2f6fed);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 4px 12px rgba(47, 111, 237, .3);
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .4px; white-space: nowrap; }
.brand-name small { display: block; font-size: 10.5px; font-weight: 400; color: var(--muted); letter-spacing: 1.4px; }

.nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 10px 18px; }
.nav-group { margin-bottom: 4px; }
.nav-group > span {
  display: block; padding: 12px 10px 6px; font-size: 10.5px; color: #a3aec0;
  letter-spacing: 1.2px; font-weight: 600; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px;
  border-radius: 8px; color: var(--text-2); font-size: 13.5px; cursor: pointer;
  position: relative; white-space: nowrap; margin-bottom: 2px; transition: .14s;
}
.nav-item:hover { background: #f4f7fd; color: var(--text); }
.nav-item.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.nav-item .ico { flex: 0 0 auto; width: 18px; height: 18px; display: grid; place-items: center; opacity: .85; }
.nav-item .nav-badge {
  margin-left: auto; font-size: 10.5px; padding: 0 6px; height: 17px; line-height: 17px;
  border-radius: 9px; background: var(--danger-bg); color: var(--danger); font-weight: 600;
}
.nav-foot { border-top: 1px solid var(--line); padding: 10px; flex: 0 0 auto; }
.who { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 9px; cursor: pointer; }
.who:hover { background: #f5f7fb; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(145deg, #dbe7ff, #b9d0ff); color: #1e4fbf;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.who .meta { min-width: 0; }
.who .meta b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .meta span { display: block; font-size: 11px; color: var(--muted); }

/* 登录信息移到顶栏后：整体收窄以匹配 icon-btn 的视觉高度 */
.header-actions .who { gap: 8px; padding: 3px 8px 3px 3px; }
.header-actions .avatar { width: 26px; height: 26px; font-size: 12px; }
.header-actions .who .meta b { font-size: 12.5px; line-height: 1.25; }
.header-actions .who .meta span { font-size: 10.5px; line-height: 1.2; }

/* 折叠态：只留图标 */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-group > span,
.sidebar.collapsed .nav-item span.label,
.sidebar.collapsed .nav-item .nav-badge,
.sidebar.collapsed .who .meta { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }
.sidebar.collapsed .nav-item.active::before { left: -10px; }
.sidebar.collapsed .brand { justify-content: center; padding: 0; }
.sidebar.collapsed .who { justify-content: center; }

.main {
  flex: 1 1 auto; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  transition: margin-left .18s ease;
}
.sidebar.collapsed ~ .main { margin-left: var(--sidebar-w-collapsed); }

.header {
  position: sticky; top: 0; z-index: 20; height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); display: grid; place-items: center;
}
.icon-btn:hover { background: #f2f5fa; border-color: var(--line); color: var(--text); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 600; font-size: 14px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* 退出是低频但不可逆的操作：和刷新之间加一道竖线隔开，hover 变红提示别手滑 */
.header-sep { width: 1px; height: 16px; background: var(--line-strong); margin: 0 2px; }
.icon-btn.quit:hover { background: var(--danger-bg); border-color: #f7cdc8; color: var(--danger); }
.env-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--ok-bg); color: var(--ok);
}
.env-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(13, 138, 79, .15); }

.content { padding: 22px 22px 40px; width: 100%; max-width: 1580px; margin: 0 auto; }

/* 页头 */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: .2px; font-weight: 650; }
.page-head p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================ 通用组件 ============================ */

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card, .card + .grid, .grid + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 14px; margin: 0; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 500; white-space: nowrap; transition: .14s;
}
.btn:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost { background: #fff; border-color: var(--line-strong); color: var(--text-2); }
.btn.ghost:hover { border-color: #c3cfe0; background: #fafbfe; color: var(--text); }
.btn.danger { background: #fff; border-color: #f3c9c5; color: var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { filter: brightness(.94); background: var(--danger); border-color: var(--danger); }
.btn.soft { background: var(--brand-50); border-color: transparent; color: var(--brand-600); }
.btn.soft:hover { background: var(--brand-100); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 25px; padding: 0 8px; font-size: 12px; border-radius: 6px; gap: 4px; }
.btn.block { width: 100%; }
.btn .ico { width: 14px; height: 14px; }

.link-btn {
  background: none; border: none; padding: 0; color: var(--brand-600);
  font-size: 12.5px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn.muted { color: var(--muted); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field > label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff; transition: .14s;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .1);
}
.input::placeholder, .textarea::placeholder { color: #b3bccb; }
.input.mono, .textarea.mono { font-family: var(--mono); font-size: 12px; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b97ac' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 26px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.hint.warn { color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
}

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 3px; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: #f2f4f8; color: var(--text-2);
}
.badge.ok, .badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.err, .badge.failed { background: var(--danger-bg); color: var(--danger); }
.badge.info, .badge.refunded { background: var(--info-bg); color: var(--info); }
.badge.ghost { background: #f4f6fa; color: var(--muted); }
.badge.xs { height: 18px; padding: 0 6px; font-size: 10.5px; gap: 3px; }
.badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag {
  display: inline-block; padding: 0 6px; height: 19px; line-height: 19px; border-radius: 5px;
  font-size: 11px; background: var(--brand-50); color: var(--brand-600); margin-left: 6px;
}
.tag.gray { background: #f1f3f8; color: var(--muted); }
.tag.amber { background: var(--warn-bg); color: var(--warn); }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  background: #fafbfd; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: #fafcff; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
table.tbl .row-actions { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.table-empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.table-empty .ic { color: #c7d0de; margin-bottom: 8px; }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.copied { color: var(--ok) !important; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 13px 16px; border-top: 1px solid var(--line); }
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-info b { color: var(--text); font-weight: 600; }
.pager-btns { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.pg {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong);
  background: #fff; border-radius: 7px; font-size: 12.5px; color: var(--text-2);
}
.pg:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-600); }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg-gap { color: var(--muted); padding: 0 2px; }
.pager-size { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.pager-size select, .pager-size input {
  height: 30px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 7px; font-size: 12.5px;
}
.pager-size input { width: 54px; }

/* 指标卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1180px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: minmax(0, 1fr); } }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.stat .top .ic {
  margin-left: auto; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-600);
}
.stat .val { font-size: 26px; font-weight: 680; letter-spacing: -.4px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat .foot { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .foot .up { color: var(--ok); font-weight: 600; }
.stat .foot .down { color: var(--danger); font-weight: 600; }
.stat.accent-ok .top .ic { background: var(--ok-bg); color: var(--ok); }
.stat.accent-warn .top .ic { background: var(--warn-bg); color: var(--warn); }
.stat.accent-info .top .ic { background: var(--info-bg); color: var(--info); }

/* 两列布局 */
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .split, .split-even { grid-template-columns: minmax(0, 1fr); } }

/* 趋势图 */
.chart { padding: 8px 12px 4px; }
.chart svg { width: 100%; height: 210px; display: block; overflow: visible; }
.chart .axis { stroke: #eef1f7; stroke-width: 1; }
.chart .lbl { font-size: 10.5px; fill: #9aa5b8; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#gArea); }
.chart .dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.chart .dot-hit { fill: transparent; cursor: pointer; }
.chart .bar { fill: #cfe0ff; }
.chart .bar.hot { fill: var(--brand); }

/* 排行 / 占比条 */
.rank { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #eef1f7; }
.rank-row:last-child { border-bottom: none; }
.rank-row .name { flex: 0 0 96px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .track { flex: 1 1 auto; height: 8px; border-radius: 6px; background: #f1f4fa; overflow: hidden; }
.rank-row .track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #7aa7ff, var(--brand)); }
.rank-row .val { flex: 0 0 auto; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rank-row .val b { font-weight: 600; color: var(--text); }

/* 提示条 */
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px;
  background: var(--brand-50); border: 1px solid #dbe7ff; color: #23478f; font-size: 12.5px; line-height: 1.7;
}
.notice .ic { flex: 0 0 auto; margin-top: 1px; }
.notice.warn { background: var(--warn-bg); border-color: #f7e3b8; color: #7c4a06; }
.notice.gray { background: #f7f9fc; border-color: var(--line); color: var(--text-2); }
.notice b { font-weight: 600; }
.notice code, code.kv {
  font-family: var(--mono); font-size: 11.5px; background: rgba(47, 111, 237, .08);
  padding: 1px 5px; border-radius: 4px; word-break: break-all;
}
code.kv { background: #f2f5fa; color: #33415c; }

/* 状态/空态 */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ic { color: #ccd5e3; margin-bottom: 10px; }
.empty h4 { margin: 0 0 6px; font-size: 14px; color: var(--text-2); font-weight: 600; }
.empty p { margin: 0 0 14px; font-size: 12.5px; }

.skeleton { background: linear-gradient(90deg, #f2f5fa 25%, #e9eef6 37%, #f2f5fa 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============================ 抽屉 / 弹窗 / Toast ============================ */

.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(18, 27, 45, .42);
  opacity: 0; transition: opacity .2s ease; display: flex;
}
.overlay.show { opacity: 1; }
.overlay.center { align-items: center; justify-content: center; padding: 20px; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(620px, 100%); background: #fff; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
  box-shadow: -12px 0 40px rgba(16, 24, 40, .14);
}
.drawer.show { transform: translateX(0); }
.drawer.wide { width: min(780px, 100%); }
.drawer-head {
  flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.drawer-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 18px 20px 24px; }
.drawer-foot {
  flex: 0 0 auto; padding: 12px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px; align-items: center; background: #fff;
}
.drawer-foot .left { margin-right: auto; font-size: 12.5px; color: var(--muted); }

.modal {
  background: #fff; border-radius: 14px; width: min(820px, 100%); max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow); transform: scale(.97); transition: transform .18s ease;
}
.overlay.show .modal { transform: scale(1); }
.modal.narrow { width: min(460px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h4 { margin: 0; font-size: 15px; font-weight: 650; }
.modal-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.confirm-body { padding: 22px 22px 8px; display: flex; gap: 14px; }
.confirm-body .ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); }
.confirm-body.danger .ic { background: var(--danger-bg); color: var(--danger); }
.confirm-body h4 { margin: 0 0 6px; font-size: 15px; }
.confirm-body p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.65; }

#toasts { position: fixed; top: 14px; right: 14px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 240px; max-width: 380px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 11px 13px;
  display: flex; gap: 9px; align-items: flex-start; font-size: 13px;
  transform: translateX(12px); opacity: 0; transition: .22s ease; pointer-events: auto;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast .ic { flex: 0 0 auto; margin-top: 1px; }
.toast.ok .ic { color: var(--ok); }
.toast.err .ic { color: var(--danger); }
.toast.warn .ic { color: var(--warn); }
.toast.info .ic { color: var(--brand); }
.toast .msg { flex: 1 1 auto; line-height: 1.55; color: var(--text); word-break: break-word; }

/* ============================ 渠道卡片 ============================ */

.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.ch-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: relative; transition: .16s; }
.ch-card:hover { border-color: #cfdcf3; box-shadow: 0 8px 24px rgba(16, 24, 40, .07); }
.ch-card.off { background: #fbfcfe; }
.ch-card.off .ch-name { color: var(--muted); }
.ch-head { display: flex; align-items: center; gap: 11px; }
.ch-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto; display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: #fff;
}
.ch-logo.alipay { background: linear-gradient(145deg, #4d9bff, #1677ff); }
.ch-logo.wechat { background: linear-gradient(145deg, #62d16b, #1aad19); }
.ch-logo.unionpay { background: linear-gradient(145deg, #f26a6a, #d0021b); }
.ch-name { font-size: 14px; font-weight: 650; line-height: 1.3; }
.ch-merchant { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ch-head .badge { margin-left: auto; }
.ch-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.ch-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 13px 0; padding: 11px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.ch-kv .k { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; }
.ch-kv .v { font-size: 12.5px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.ch-state { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 12px; }
.ch-state.ok { color: var(--ok); }
.ch-state.err { color: var(--danger); }
.ch-state.muted { color: var(--muted); }
.ch-actions { display: flex; gap: 8px; align-items: center; }
.ch-actions .spacer { margin-left: auto; }

/* 展示型键值列表 */
.kv-list { display: grid; grid-template-columns: 92px 1fr; gap: 10px 14px; font-size: 13px; align-items: center; }
.kv-list .k { color: var(--muted); font-size: 12.5px; }
.kv-list .v { min-width: 0; word-break: break-all; }
.kv-list .v.mono { font-family: var(--mono); font-size: 12px; }
.copy-row { display: flex; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 6px 10px; }
.copy-row > span { flex: 1 1 auto; font-family: var(--mono); font-size: 12px; word-break: break-all; min-width: 0; }
.copy-row .btn { flex: 0 0 auto; }

/* 代码块 / 步骤 / Tab */
pre.code {
  background: #0f172a; color: #dbe6f5; padding: 14px 16px; border-radius: 10px;
  font-size: 11.5px; line-height: 1.7; overflow-x: auto; font-family: var(--mono);
  margin: 10px 0 0; white-space: pre; tab-size: 2;
}
.steps { font-size: 12.5px; color: var(--text-2); line-height: 2; counter-reset: s; padding-left: 0; margin: 0; list-style: none; }
.steps li { position: relative; padding-left: 26px; }
.steps li::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600);
  font-size: 11px; font-weight: 600; display: grid; place-items: center;
}
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0 0; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 8px 13px; font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.tabs button.on { color: var(--brand-600); border-bottom-color: var(--brand); }

/* 支付测试 */
.tp-wrap { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 22px; }
@media (max-width: 720px) { .tp-wrap { grid-template-columns: minmax(0, 1fr); } }
.tp-qr-col { text-align: center; }
.tp-qr {
  width: 250px; height: 250px; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px;
  display: grid; place-items: center; padding: 6px; background: #fff;
}
.tp-qr svg { width: 100%; height: 100%; display: block; }
.tp-ph { font-size: 12px; color: var(--muted); line-height: 1.7; padding: 0 16px; }
.tp-tip { margin-top: 12px; font-size: 12.5px; color: var(--muted); min-height: 20px; line-height: 1.65; }
.tp-tip.ok { color: var(--ok); font-weight: 600; }
.tp-tip.err { color: var(--danger); }
.tp-report { margin-top: 14px; border-radius: 10px; padding: 13px 14px; border: 1px solid var(--line); }
.tp-report.ok { background: #f4fdf8; border-color: #c9eed9; }
.tp-report.err { background: #fff7f6; border-color: #f7d3cf; }
.tp-report .head { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.tp-report.ok .head { color: var(--ok); }
.tp-report .err .head, .tp-report.err .head { color: var(--danger); }
.tp-report .hint { font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.tp-report .raw { margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; }
.tp-pub { margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--line); }

/* 权限字典 */
.perm-group { margin-bottom: 16px; }
.perm-group > b { display: block; font-size: 12.5px; margin-bottom: 8px; color: var(--text-2); }
.perm-codes { display: flex; flex-wrap: wrap; gap: 6px; }

/* 小工具 */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* 筛选条：一行放不完自动换行，控件宽度各自固定，不会被拉伸成奇葩比例 */
.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
/* 卡片头里的筛选条：输入控件默认 width:100%，在 flex 行里会把整行撑满导致逐个换行，
   这里必须显式收回自适应宽度，否则四个控件会竖着堆成一列。 */
.filters .input, .filters .select { height: 33px; font-size: 12.5px; width: auto; }
.filters .select { min-width: 112px; }
.track { height: 8px; border-radius: 6px; background: #f1f4fa; overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #7aa7ff, var(--brand)); }

.mt0 { margin-top: 0; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* 移动端：侧栏变抽屉 */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); box-shadow: 12px 0 40px rgba(16, 24, 40, .12); }
  .sidebar.open { transform: translateX(0); }
  .main, .sidebar.collapsed ~ .main { margin-left: 0; }
  .content { padding: 16px 14px 32px; }
  .header { padding: 0 14px; }
  .crumb { display: none; }
  .page-head .actions { margin-left: 0; width: 100%; }
}

/* ============================================================================
   资金链路（仪表盘顶部）
   把「下游商户 → 本平台 → 上游通道」这条主线画出来，
   数字分别落在三个节点上，一眼能看出是哪个环节出了问题。
   ========================================================================== */
.flow { display: flex; align-items: stretch; gap: 10px; margin-top: 16px; }
.flow-node {
  flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.flow-node .fn-top {
  font-size: 11.5px; color: var(--muted); letter-spacing: .4px;
  display: flex; align-items: center; gap: 6px;
}
.flow-node .fn-val { font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -.4px; }
.flow-node .fn-val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.flow-node .fn-sub { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.flow-node.peak { border-color: var(--brand-100); background: linear-gradient(180deg, #fbfdff, #fff); }
.flow-node.peak .fn-val { color: var(--brand-600); }
.flow-arrow {
  display: flex; align-items: center; justify-content: center;
  color: #c2ccdd; font-size: 16px; padding: 0 2px; flex: 0 0 auto;
}
@media (max-width: 900px) {
  .flow { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); padding: 2px 0; }
}

/* ============================================================================
   RBAC：角色授权矩阵
   ========================================================================== */
.role-list { display: flex; flex-direction: column; gap: 8px; }
.role-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px;
  cursor: pointer; transition: .15s; background: #fff;
}
.role-item:hover { border-color: #cfdcf3; }
.role-item.on { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(47, 111, 237, .08); }
.role-item .ri-head { display: flex; align-items: center; gap: 7px; }
.role-item .ri-name { font-weight: 600; font-size: 13px; }
.role-item .ri-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); }
.role-item .ri-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; }

.perm-matrix { display: flex; flex-direction: column; gap: 14px; }
.pm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.pm-group-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  background: #fafbfe; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600;
}
.pm-group-head .count { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.pm-group-head .right { margin-left: auto; display: flex; gap: 8px; }
.pm-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 8px; }
@media (max-width: 1180px) { .pm-items { grid-template-columns: 1fr; } }
.pm-item {
  display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px;
  border-radius: var(--radius-sm); cursor: pointer; transition: .12s;
}
.pm-item:hover { background: #f7f9fd; }
.pm-item input { margin-top: 2px; accent-color: var(--brand); width: 14px; height: 14px; cursor: pointer; }
.pm-item .pi-name { font-size: 12.5px; font-weight: 500; line-height: 1.5; }
.pm-item .pi-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--muted); }
.pm-item .pi-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.pm-item.disabled { opacity: .62; cursor: not-allowed; }

.grant-bar {
  position: sticky; bottom: 0; margin-top: 16px; padding: 12px 16px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px; box-shadow: 0 -6px 20px rgba(16, 24, 40, .05);
}
.grant-bar .grow { flex: 1; font-size: 12.5px; color: var(--muted); }

/* 用户页：表格里的行内操作按钮不换行、不抢主信息 */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.u-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.u-cell .u-name { font-weight: 600; font-size: 12.5px; }
.u-cell .u-nick { font-size: 11.5px; color: var(--muted); }

/* 操作日志 */
.stat.accent-danger .top .ic { background: var(--danger-bg); color: var(--danger); }
/* 详情列是一句话的变更摘要，超宽就省略——完整内容点开看，别把表格撑变形 */
.lg-detail {
  max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; color: var(--text-2);
}
tr.log-row { cursor: pointer; }

.lg-detail-box {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.lg-kv {
  display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 10px;
  padding: 9px 12px; font-size: 12.5px; border-bottom: 1px solid var(--line);
}
.lg-kv:last-child { border-bottom: none; }
.lg-kv:nth-child(odd) { background: #fafbfe; }
.lg-kv .k { color: var(--muted); }
.lg-kv .v { min-width: 0; word-break: break-all; }

.lg-sec { margin-top: 16px; }
.lg-sec h4 {
  margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}
.lg-pre {
  margin: 0; padding: 10px 12px; border-radius: 9px; background: #f7f9fd;
  border: 1px solid var(--line); font-size: 12px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto;
}
