:root {
    --bg: #f8f9fa; --surface: #ffffff; --border: #e5e7eb; --border-focus: #d1d5db;
    --text-primary: #111827; --text-secondary: #6b7280; --text-muted: #9ca3af;
    --accent: #111827; --accent-light: #374151; --error: #dc2626; --error-bg: #fef2f2;
    --error-border: #fca5a5; --success: #16a34a; --success-bg: #f0fdf4;
    --warning: #f59e0b; --warning-bg: #fef3c7; --info: #3b82f6; --info-bg: #eff6ff;
    --gold: #d97706; --gold-bg: #fffbeb; --gold-border: #fde68a;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { min-height: 100vh; background: var(--bg); font-family: 'PingFang SC', -apple-system, 'Noto Sans SC', 'Microsoft YaHei', sans-serif; color: var(--text-primary); line-height: 1.55; }

/* ========== 登录页面 ========== */
.login-page { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 99999; }
.login-card { width: 400px; max-width: 90vw; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 40px 32px; box-shadow: 0 12px 48px rgba(0,0,0,0.08); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 28px; font-weight: 700; }
.login-brand p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }
.lf { margin-bottom: 18px; }
.lf label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 7px; }
.lf input { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; outline: none; }
.lf input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.login-btn { width: 100%; height: 44px; margin-top: 24px; background: var(--accent); color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 500; cursor: pointer; }
.login-btn:hover { opacity: 0.88; }
.login-err { text-align: center; color: var(--error); font-size: 13px; margin-top: 14px; display: none; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.login-hint a { color: var(--info); cursor: pointer; text-decoration: underline; }

/* ========== 导航栏 ========== */
.navbar { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,0.88); backdrop-filter: blur(12px) saturate(180%); border-bottom: 1px solid var(--border); padding: 0 40px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.navbar-brand { font-size: 22px; font-weight: 700; letter-spacing: -0.8px; }
.navbar-brand span { color: var(--text-muted); font-size: 14px; font-weight: 500; margin-left: 10px; }
.navbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 5px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }

.nav-btn { height: 32px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: transparent; cursor: pointer; font-size: 12.5px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 5px; transition: all 0.15s; text-decoration: none; }
.nav-btn:hover { background: #f9fafb; border-color: var(--border-focus); }
.nav-btn.danger:hover { background: var(--error-bg); border-color: var(--error-border); color: var(--error); }
.nav-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }

/* ========== 选项卡栏 ========== */
.tabbar { padding: 0 40px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.6); display: flex; gap: 0; }
.tab-item { height: 48px; padding: 0 22px; border-bottom: 2px solid transparent; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 500; color: var(--text-muted); transition: all 0.18s; user-select: none; text-decoration: none; }
.tab-item:hover { color: var(--text-primary); background: rgba(0,0,0,0.02); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-item svg { width: 17px; height: 17px; stroke-width: 1.8; fill: none; }

/* ========== 主内容 ========== */
.main { width: 100%; padding: 28px 36px; max-width: 1200px; margin: 0 auto; }
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.6px; }
.page-header p { font-size: 14.5px; color: var(--text-secondary); margin-top: 4px; }

/* ========== 统计卡片 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.stat-value.gold { color: var(--gold); }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--error); }
.stat-icon { float: right; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; margin-top: -4px; }
.stat-icon svg { width: 19px; height: 19px; stroke-width: 1.8; fill: none; }

/* ========== 表格区域 ========== */
.table-section { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.toolbar { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search-box { position: relative; width: 240px; }
.search-box input { width: 100%; height: 36px; padding: 0 14px 0 34px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: var(--bg); transition: all 0.18s; }
.search-box input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--text-muted); fill: none; stroke-width: 2; }

.filter-group { display: flex; gap: 5px; }
.filter-chip { height: 31px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); font-size: 12.5px; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.filter-chip.active { background: var(--gold-bg); border-color: var(--gold-border); color: var(--gold); font-weight: 600; }
.filter-chip:hover:not(.active) { background: #f3f4f6; }

.btn-sm { height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; cursor: pointer; background: var(--surface); transition: all 0.15s; display: inline-flex; align-items: center; gap: 5px; }
.btn-sm:hover { background: #f9fafb; border-color: var(--border-focus); }
.btn-sm svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn-sm.primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 500; }
.btn-sm.primary:hover { opacity: 0.88; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
thead th { text-align: left; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 600; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--bg); }

.amount-pos { color: var(--success); font-weight: 700; }
.amount-neg { color: var(--error); font-weight: 700; }
.time-cell { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; }
.type-tag { display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.tt-recharge { background: #d1fae5; color: #065f46; }
.tt-spend { background: #fee2e2; color: #991b1b; }
.tt-refund { background: #dbeafe; color: #1e40af; }
.tt-adjust { background: #fef3c7; color: #92400e; }

.empty-state { text-align: center; padding: 48px; color: var(--text-muted); }
.empty-state svg { width: 46px; height: 46px; stroke: #d1d5db; stroke-width: 1.3; fill: none; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.table-footer { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; }
.page-btn { min-width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.page-btn:hover { background: var(--bg); }
.page-btn.active { background: var(--accent); color: #fff; }

/* ========== 充值页面专用 ========== */
.balance-info-bar { display: flex; gap: 16px; margin-bottom: 24px; }
.bal-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.bal-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.bal-val { font-size: 32px; font-weight: 700; }
.bal-val.gold { color: var(--gold); }

.record-section { margin-top: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.section-header h3 { font-size: 16px; font-weight: 600; }
.refresh-btn { height: 30px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 5px; transition: all 0.15s; }
.refresh-btn:hover { background: #f9fafb; border-color: var(--border-focus); }
.refresh-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }

.record-list { max-height: 360px; overflow-y: auto; }
.record-item { display: grid; grid-template-columns: 1fr auto auto 160px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); transition: background 0.12s; font-size: 13.5px; }
.record-item:hover { background: var(--bg); }
.record-item:last-child { border-bottom: none; }
.rec-desc { color: var(--text-primary); font-weight: 500; }
.rec-amount { font-weight: 700; font-size: 14px; white-space: nowrap; }
.rec-amount.pos { color: var(--success); }
.rec-operator { color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; text-align: center; }
.rec-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; text-align: right; }
.record-empty { text-align: center; padding: 48px 24px; color: var(--text-muted); font-size: 14px; }
.record-empty svg { width: 40px; height: 40px; stroke: #d1d5db; stroke-width: 1.3; fill: none; margin-bottom: 10px; }
.loading-row { text-align: center; padding: 28px; color: var(--text-muted); font-size: 13px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(0,0,0,0.1); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; margin-right: 6px; vertical-align: middle; }
@keyframes spin{to{transform:rotate(360deg)}}

/* ========== 弹窗 ========== */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999; justify-content: center; align-items: center; }
.overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 28px 24px; max-width: 520px; width: 90%; box-shadow: 0 12px 48px rgba(0,0,0,0.1); }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }

.mf { margin-bottom: 16px; }
.mf label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.mf input, .mf select { width: 100%; height: 42px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; font-family: inherit; background: var(--surface); }
.mf input:focus, .mf select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }

.modal-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-btn { height: 40px; padding: 0 20px; border-radius: 10px; font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--bg); color: var(--text-secondary); transition: all 0.15s; }
.modal-btn:hover { background: var(--border); color: var(--text-primary); }
.modal-btn.del-btn { color: var(--error); border-color: rgba(220,38,38,0.2); background: var(--error-bg); }
.modal-btn.del-btn:hover { background: var(--error); color: #fff; }
.modal-btn.submit-btn { background: var(--accent); color: #fff; border: transparent; font-weight: 500; }
.modal-btn.submit-btn:hover { opacity: 0.88; }

.confirm-modal { max-width: 380px; text-align: center; }
.confirm-modal p { font-size: 14px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 22px; }

/* Alert */
.alert-overlay { display:none;position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1200;justify-content:center;align-items:center; }
.alert-overlay.open { display:flex; }
.alert-box { background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:24px 28px 20px;max-width:360px;width:85%;text-align:center; }
.alert-icon{width:40px;height:40px;margin:0 auto 14px;border-radius:50%;background:var(--error-bg);border:1px solid rgba(220,38,38,0.2);display:flex;align-items:center;justify-content:center;}
.alert-icon svg{width:20px;height:20px;stroke:var(--error);stroke-width:2.2;fill:none}
.alert-text{font-size:14px;color:var(--text-secondary);line-height:1.6;margin-bottom:18px}
.alert-btn{height:36px;padding:0 24px;background:var(--accent);color:#fff;border:none;border-radius:10px;font-size:14px;font-weight:600;cursor:pointer;transition:all 0.25s}
.alert-btn:hover{opacity:0.88}

/* Loading */
.loading { text-align:center;padding:48px;color:var(--text-muted); }
.loading .spinner { width:32px;height:32px;border:3px solid rgba(0,0,0,0.1);border-top:3px solid var(--accent);border-radius:50%;animation:spin 0.7s linear infinite;margin:0 auto 12px; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .main { padding: 24px 20px; }
    .navbar { padding: 0 20px; height: 52px; }
    .navbar-brand span { display: none; }
    .tabbar { padding: 0 20px; }
    .tab-item { padding: 0 14px; font-size: 12.5px; }
    .balance-info-bar { flex-direction: column; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-box { width: 100%; order: -1; }
    .toolbar { padding: 12px 14px; }
    .stat-value { font-size: 24px; }
    thead th, tbody td { padding: 10px 12px; font-size: 12px; }
    .page-header h2 { font-size: 21px; }
    .tab-item { padding: 0 10px; font-size: 12px; }
    .login-card { width: 94%; padding: 34px 24px 28px; }
}
