:root {
  --primary: #2a7ff2;
  --primary-dark: #1a5fd0;
  --grad: linear-gradient(135deg, #4d9bff 0%, #2a7ff2 45%, #1a5fd0 100%);
  --grad-orange: linear-gradient(135deg, #ff8a50 0%, #ff6b35 50%, #e8552f 100%);
  --grad-green: linear-gradient(135deg, #3ecf8e 0%, #21b573 100%);
  --grad-red: linear-gradient(135deg, #ff7a7a 0%, #f04b4b 100%);
  --grad-purple: linear-gradient(135deg, #9b6bff 0%, #7c3aed 100%);
  --bg: #f2f5fa;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #7b8794;
  --line: #e6ebf3;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(31, 39, 51, .06);
  --shadow-lg: 0 12px 40px rgba(31, 39, 51, .16);
  --glow: 0 6px 18px rgba(42, 127, 242, .35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
}

/* ============ 登录页 ============ */
.login-page { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #0f2c5c 0%, #1a5fd0 45%, #2a7ff2 70%, #6db0ff 100%);
}
.login-bg::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 15% 20%, rgba(255,255,255,.18), transparent 60%),
              radial-gradient(500px 260px at 85% 75%, rgba(255,255,255,.14), transparent 60%);
}
.login-card {
  position: relative; width: 420px; max-width: 92vw;
  background: rgba(255,255,255,.97); border-radius: 22px;
  padding: 44px 42px 34px;
  box-shadow: 0 30px 90px rgba(5, 20, 50, .45);
  backdrop-filter: blur(10px);
  animation: rise .5s cubic-bezier(.2,.8,.3,1);
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo-icon {
  width: 62px; height: 62px; margin: 0 auto 12px; border-radius: 18px;
  background: var(--grad); color: #fff; font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow); animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.login-logo-text { font-size: 22px; font-weight: 700; color: var(--ink); }
.login-logo-sub { font-size: 12px; color: var(--muted); margin-top: 4px; letter-spacing: 2px; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 8px; font-weight: 500; }
.input-box input {
  width: 100%; height: 46px; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 0 16px; font-size: 14px; outline: none; background: #fafbfd;
  transition: all .25s;
}
.input-box input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(42,127,242,.12); }
.login-error { min-height: 22px; color: #e8552f; font-size: 13px; margin-bottom: 6px; }
.login-tip { text-align: center; color: #aab4c0; font-size: 12px; margin-top: 18px; }

/* ============ 按钮 ============ */
.btn-gradient {
  border: none; cursor: pointer; color: #fff; font-size: 15px; font-weight: 600;
  height: 46px; padding: 0 24px; border-radius: 12px;
  background: var(--grad); box-shadow: var(--glow);
  transition: all .25s;
}
.btn-gradient:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(42,127,242,.45); }
.btn-gradient:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-orange { background: var(--grad-orange); box-shadow: 0 6px 18px rgba(255,107,53,.35); }
.btn-orange:hover { box-shadow: 0 10px 26px rgba(255,107,53,.5); }
.btn-green { background: var(--grad-green); box-shadow: 0 6px 18px rgba(33,181,115,.35); }
.btn-green:hover { box-shadow: 0 10px 26px rgba(33,181,115,.5); }
.btn-ghost {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  height: 38px; padding: 0 18px; border-radius: 10px; cursor: pointer; font-size: 13px;
  transition: all .25s;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 4px 12px rgba(42,127,242,.15); transform: translateY(-1px); }
.btn-danger { border: 1.5px solid #f3c3c3; color: #e8552f; background: #fff; }
.btn-danger:hover { border-color: #e8552f; box-shadow: 0 4px 12px rgba(232,85,47,.18); }
.btn-sm { height: 32px; padding: 0 14px; border-radius: 8px; font-size: 12.5px; }

/* ============ 布局 ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; color: #cdd8ea; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #12264b 0%, #0f2142 60%, #0c1a35 100%);
  position: sticky; top: 0; height: 100vh;
}
.side-logo { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; }
.side-logo-icon {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 4px 14px rgba(42,127,242,.5);
}
.side-logo-text { font-size: 17px; font-weight: 700; color: #fff; line-height: 1.2; }
.side-logo-text span { display: block; font-size: 11px; color: #7d92b8; font-weight: 400; letter-spacing: 1px; }
.side-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 4px;
  border-radius: 10px; cursor: pointer; font-size: 14px; color: #a9b8d4;
  transition: all .25s; position: relative;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; transform: translateX(3px); }
.nav-item.active {
  background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(42,127,242,.4);
}
.side-footer { padding: 14px 20px; font-size: 12px; color: #5f7399; border-top: 1px solid rgba(255,255,255,.06); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; background: rgba(255,255,255,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-link { color: var(--primary); text-decoration: none; font-size: 13px; }
.topbar-link:hover { text-decoration: underline; }
.admin-badge {
  width: 36px; height: 36px; border-radius: 50%; background: var(--grad);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; box-shadow: var(--glow);
}
.content { padding: 26px 28px 40px; }

/* ============ 统计卡片 ============ */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: all .3s;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
}
.stat-card.c-blue::before { background: var(--grad); }
.stat-card.c-green::before { background: var(--grad-green); }
.stat-card.c-orange::before { background: var(--grad-orange); }
.stat-card.c-purple::before { background: var(--grad-purple); }
.stat-card.c-red::before { background: var(--grad-red); }
.stat-icon {
  position: absolute; right: 16px; top: 18px; width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff;
}
.c-blue .stat-icon { background: var(--grad); box-shadow: var(--glow); }
.c-green .stat-icon { background: var(--grad-green); box-shadow: 0 4px 12px rgba(33,181,115,.35); }
.c-orange .stat-icon { background: var(--grad-orange); box-shadow: 0 4px 12px rgba(255,107,53,.35); }
.c-purple .stat-icon { background: var(--grad-purple); box-shadow: 0 4px 12px rgba(124,58,237,.35); }
.c-red .stat-icon { background: var(--grad-red); box-shadow: 0 4px 12px rgba(240,75,75,.35); }
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: .5px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-extra { font-size: 12px; color: #9aa5b1; margin-top: 8px; }

/* ============ 面板 ============ */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.panel-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.panel-title::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: var(--grad); }
.panel-tools { margin-left: auto; display: flex; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }

/* ============ 图表 ============ */
.chart-box { width: 100%; height: 240px; position: relative; }
.chart-svg { width: 100%; height: 100%; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #fafbfd;
}
table.data td { padding: 12px; border-bottom: 1px solid #f1f4f9; font-size: 13.5px; vertical-align: middle; }
table.data tbody tr { transition: background .2s; }
table.data tbody tr:hover { background: #f6f9ff; }
.row-actions { display: flex; gap: 8px; }
.link-btn { color: var(--primary); cursor: pointer; font-size: 13px; background: none; border: none; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #e8552f; }

/* ============ 标签 / 徽章 ============ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-success { background: #e4f8ee; color: #158a52; }
.badge-failed { background: #fdeaea; color: #d64545; }
.badge-refunded { background: #f1f2f6; color: #6b7280; }
.badge-active { background: #e8f1ff; color: #2a7ff2; }
.badge-pending { background: #fff4e0; color: #c47b00; }
.badge-closed { background: #f1f2f6; color: #6b7280; }

/* ============ 筛选 tab ============ */
.filter-tabs { display: flex; gap: 10px; margin-bottom: 16px; }
.filter-tab {
  padding: 8px 18px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: #eef2f8; color: #5b6779; transition: all .25s; border: none;
}
.filter-tab:hover { background: #e2eaf8; }
.filter-tab.active { background: var(--grad); color: #fff; box-shadow: var(--glow); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 20, 40, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .25s;
  backdrop-filter: blur(3px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 18px; width: 680px; max-width: 94vw; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(5,20,50,.4);
  animation: pop .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal.sm { width: 480px; }
.modal-head {
  padding: 20px 26px 14px; font-size: 17px; font-weight: 700; display: flex; align-items: center;
}
.modal-head .close { margin-left: auto; cursor: pointer; color: #aab4c0; font-size: 22px; line-height: 1; transition: all .2s; background: none; border: none; }
.modal-head .close:hover { color: #e8552f; transform: rotate(90deg); }
.modal-body { padding: 8px 26px 22px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 14px 26px 20px; display: flex; justify-content: flex-end; gap: 12px; border-top: 1px solid #f1f4f9; }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }
.f-label { display: block; font-size: 13px; color: #4b5563; margin: 14px 0 7px; font-weight: 500; }
.f-input, .f-select, .f-textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0 14px; font-size: 14px; outline: none; background: #fafbfd; transition: all .25s;
  font-family: inherit; color: var(--ink);
}
.f-input, .f-select { height: 42px; }
.f-textarea { padding: 10px 14px; min-height: 96px; resize: vertical; line-height: 1.6; }
.f-input:focus, .f-select:focus, .f-textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(42,127,242,.12); }

/* 图片上传 */
.upload-box {
  border: 2px dashed #cfd9ea; border-radius: 12px; min-height: 110px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all .25s; position: relative; overflow: hidden; background: #fafbfd;
}
.upload-box:hover { border-color: var(--primary); background: #f2f7ff; }
.upload-box img { max-width: 100%; max-height: 180px; display: block; }
.upload-box .upload-hint { color: #9aa5b1; font-size: 13px; text-align: center; }
.upload-box .upload-hint b { color: var(--primary); display: block; font-size: 22px; font-weight: 400; margin-bottom: 4px; }

/* toast */
.toast {
  position: fixed; top: 26px; left: 50%; transform: translateX(-50%); z-index: 999;
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: rise .3s;
}
.toast.ok { background: linear-gradient(135deg, #21b573, #158a52); }
.toast.err { background: linear-gradient(135deg, #f04b4b, #c92f2f); }

/* 支付设置 */
.pay-modes { display: flex; flex-direction: column; gap: 12px; }
.pay-mode {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: all .25s;
}
.pay-mode:hover { border-color: #9cc2f8; background: #f6f9ff; transform: translateX(4px); }
.pay-mode.active {
  border-color: var(--primary); background: linear-gradient(135deg, rgba(42,127,242,.06), rgba(42,127,242,.12));
  box-shadow: 0 4px 14px rgba(42,127,242,.18);
}
.pay-mode-icon {
  width: 42px; height: 42px; border-radius: 12px; background: #eef2f8;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.pay-mode.active .pay-mode-icon { background: var(--grad); box-shadow: var(--glow); }
.pay-mode-name { font-size: 15px; font-weight: 700; }
.pay-mode-desc { font-size: 12.5px; color: var(--muted); }

/* 空状态 */
.empty { text-align: center; color: #aab4c0; padding: 40px 0; font-size: 13.5px; }

/* 响应式 */
@media (max-width: 1200px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
