/* 迅联支付 XLPAY 管理后台设计系统（亮色主题） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #2563eb; --primary-h: #1d4ed8; --success: #16a34a; --warning: #d97706; --danger: #dc2626;
  --bg: #f1f5f9; --card: #ffffff; --card2: #f8fafc; --border: #e2e8f0; --text: #0f172a; --muted: #64748b;
  --input: #ffffff; --input-border: #cbd5e1; --hover: #f8fafc;
}
html, body { height: 100%; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, #eef2ff 0%, #e0f2fe 55%, #f0f9ff 100%); }
.login-card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(15, 23, 42, .12); }
.login-card .logo { text-align: center; margin-bottom: 26px; }
.login-card .logo h1 { font-size: 24px; letter-spacing: 2px; color: var(--text); }
.login-card .logo h1 span { color: var(--primary); }
.login-card .logo p { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* 主布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: #ffffff; color: #475569; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--border); }
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px; }
.sidebar .brand .logo-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #2563eb, #3b82f6); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; color: #fff; letter-spacing: -1px; box-shadow: 0 4px 14px rgba(37,99,235,.35); flex-shrink: 0; }
.sidebar .brand .logo-text { line-height: 1.25; }
.sidebar .brand .logo-text b { display: block; color: #0f172a; font-size: 15.5px; letter-spacing: 2px; }
.sidebar .brand .logo-text span { font-size: 10.5px; color: #2563eb; letter-spacing: 3px; font-weight: 600; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.sidebar .group { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 6px 0 2px; font-size: 13.5px; color: #475569; border-radius: 10px; cursor: pointer; user-select: none; transition: background .15s; }
.sidebar .group:hover { background: #f1f5f9; color: #0f172a; }
.sidebar .group .chev { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; transition: transform .15s ease; }
.sidebar .group .chev svg { width: 14px; height: 14px; }
.sidebar .group.open .chev { transform: rotate(90deg); }
.sidebar .gitems { display: none; }
.sidebar .gitems.open { display: block; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0; color: #475569; text-decoration: none; font-size: 13.5px; border-radius: 10px; transition: all .15s ease; }
.sidebar a .ico { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.sidebar a .ico svg { width: 17px; height: 17px; }
.sidebar a:hover { background: #f1f5f9; color: #0f172a; }
.sidebar a.active { background: linear-gradient(135deg, #2563eb, #3b82f6); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .3); }
.sidebar .foot { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; }
.sidebar .foot a { display: flex; align-items: center; gap: 8px; color: #94a3b8; text-decoration: none; transition: color .15s; }
.sidebar .foot a:hover { color: #2563eb; }
.sidebar .foot a svg { width: 14px; height: 14px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 13px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.content { padding: 20px 24px; flex: 1; }

/* 组件 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; box-shadow: 0 1px 4px rgba(15, 23, 42, .05); margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 1px 4px rgba(15, 23, 42, .05); }
.metric .label { font-size: 12px; color: var(--muted); }
.metric .value { font-size: 22px; font-weight: 700; margin-top: 6px; }
.metric .value.primary { color: var(--primary); } .metric .value.success { color: var(--success); }
.metric .value.warning { color: var(--warning); } .metric .value.danger { color: var(--danger); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
input, select, textarea { padding: 8px 12px; border: 1px solid var(--input-border); border-radius: 8px; font-size: 13.5px; font-family: inherit; outline: none; background: var(--input); color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { width: 100%; min-height: 80px; resize: vertical; }

.btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; text-decoration: none; transition: all .15s; }
.btn.primary { background: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-h); }
.btn.success { background: var(--success); color: #fff; } .btn.success:hover { filter: brightness(1.08); }
.btn.warning { background: var(--warning); color: #fff; } .btn.warning:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); color: #fff; } .btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { background: #fff; color: #334155; border: 1px solid var(--input-border); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
th { background: var(--card2); color: #475569; font-weight: 600; font-size: 12px; }
tr:hover td { background: var(--hover); }
td .ops { display: flex; gap: 6px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.yellow { background: #fef3c7; color: #b45309; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.purple { background: #f3e8ff; color: #7e22ce; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--muted); }
.pager button { padding: 5px 12px; border: 1px solid var(--input-border); background: #fff; color: #334155; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 560px; max-width: 100%; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.modal.lg { width: 780px; }
.modal .m-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; }
.modal .m-head .close { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }
.modal .m-head .close:hover { color: var(--text); }
.modal .m-body { padding: 18px 20px; max-height: 72vh; overflow-y: auto; }
.modal .m-foot { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: #334155; margin-bottom: 5px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { font-size: 11.5px; color: #94a3b8; margin-top: 3px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { display: none; }
.switch .track { width: 36px; height: 20px; border-radius: 20px; background: #cbd5e1; position: relative; transition: .2s; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .2s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { left: 18px; }

.toast-box { position: fixed; top: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(15, 23, 42, .25); animation: slideIn .2s; max-width: 380px; }
.toast.ok { background: var(--success); } .toast.err { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { text-align: center; color: #94a3b8; padding: 40px 0; font-size: 13px; }
.detail-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; font-size: 13px; }
.detail-rows .row { display: flex; } .detail-rows .k { color: var(--muted); width: 110px; flex-shrink: 0; }
.code { font-family: Consolas, monospace; font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; color: #1d4ed8; }
.mono { font-family: Consolas, monospace; }

/* 仪表盘图表 */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.legend-row .lname { color: #334155; }
.legend-row .lval { margin-left: auto; color: #64748b; font-size: 12px; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; font-size: 12.5px; }
.hbar .hlabel { width: 110px; color: #334155; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: 14px; background: #f1f5f9; border-radius: 7px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 7px; transition: width .5s ease; min-width: 2px; }
.hbar .hval { width: 90px; text-align: right; color: #64748b; flex-shrink: 0; }
