:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-card-hover: #1f2a40;
  --bg-input: #0d1321;
  --border: #2a3548;
  --border-focus: #3b82f6;
  --text-primary: #e8ecf4;
  --text-secondary: #8896aa;
  --text-muted: #556179;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.1);
  --font-display: 'Noto Sans SC', 'PingFang SC', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-display);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary); position: relative; overflow: hidden;
}
.auth-page::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(59,130,246,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(139,92,246,0.06) 0%, transparent 50%);
  animation: drift 20s ease-in-out infinite;
}
@keyframes drift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-3%, 2%); } }
.auth-box {
  position: relative; width: 100%; max-width: 420px; padding: 40px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); animation: fadeUp 0.5s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.auth-box .logo { text-align: center; margin-bottom: 32px; }
.auth-box .logo h1 {
  font-size: 26px; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-box .logo p { color: var(--text-secondary); font-size: 14px; margin-top: 6px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%; padding: 12px 16px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 14px; font-family: var(--font-display);
  transition: var(--transition); outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-group input::placeholder { color: var(--text-muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(59,130,246,0.3); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.auth-box .btn-primary { margin-top: 8px; padding: 14px; font-size: 15px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }
.auth-link a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: none; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border);
  padding: 24px 0; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: transform 0.3s ease;
}
.sidebar-header { padding: 0 24px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-header h2 {
  font-size: 20px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-header span { font-size: 12px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 0 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: var(--transition); text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
}
.user-details { flex: 1; }
.user-details .name { font-size: 13px; font-weight: 600; }
.user-details .role { font-size: 11px; color: var(--text-muted); }
.main-content { flex: 1; margin-left: 260px; padding: 32px; min-height: 100vh; }
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
.page-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; transition: var(--transition);
}
.stat-card:hover { border-color: rgba(255,255,255,0.1); transform: translateY(-2px); }
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 18px;
}
.stat-icon.blue { background: var(--accent-glow); color: var(--accent); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 0; }
.card-body.padded { padding: 24px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 24px; text-align: left; font-size: 13px; }
th {
  color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.15);
}
tr { border-bottom: 1px solid rgba(255,255,255,0.03); }
tr:hover { background: rgba(255,255,255,0.02); }
td { color: var(--text-secondary); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-blue { background: var(--accent-glow); color: var(--accent); }
.badge-gray { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { flex: 1; min-width: 200px; position: relative; }
.search-box input {
  width: 100%; padding: 10px 16px 10px 40px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13px; outline: none; transition: var(--transition);
}
.search-box input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.filter-select {
  padding: 10px 16px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; outline: none; cursor: pointer;
}
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary);
}
.pagination-btns { display: flex; gap: 8px; }
.balance-card {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a2744 50%, #2d1b4e 100%);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
  padding: 36px; margin-bottom: 32px; position: relative; overflow: hidden;
}
.balance-card::before {
  content: ''; position: absolute; top: -50%; right: -20%; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(59,130,246,0.12) 0%, transparent 70%);
}
.balance-label { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }
.balance-amount { font-size: 42px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.balance-amount small { font-size: 22px; font-weight: 600; margin-right: 4px; }
.redeem-section { display: flex; gap: 12px; margin-top: 24px; }
.redeem-section input {
  flex: 1; padding: 12px 16px; background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm);
  color: white; font-size: 14px; font-family: var(--font-mono); letter-spacing: 1px; outline: none;
}
.redeem-section input:focus { border-color: var(--accent); }
.redeem-section .btn { flex-shrink: 0; }
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 480px;
  padding: 32px; animation: fadeUp 0.3s ease-out;
}
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
.section { display: none; }
.section.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 10px 12px; }
  .toolbar { flex-direction: column; }
  .search-box { width: 100%; }
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2); border-top-color: white;
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; }
.ad-banner-old-ignore {
  display: block; margin-bottom: 24px; padding: 18px 24px;
  background: linear-gradient(135deg, rgba(59,130,246,0.18) 0%, rgba(168,85,247,0.14) 50%, rgba(236,72,153,0.12) 100%);
  border: 1px solid rgba(59,130,246,0.3); border-radius: var(--radius);
  text-decoration: none; color: #ffffff; transition: all 0.3s ease;
  position: relative; overflow: hidden; text-align: center;
}
.ad-banner::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  animation: adShimmer 3s infinite;
}
@keyframes adShimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.ad-banner:hover {
  border-color: rgba(59,130,246,0.5);
  background: linear-gradient(135deg, rgba(59,130,246,0.25) 0%, rgba(168,85,247,0.20) 50%, rgba(236,72,153,0.16) 100%);
  transform: translateY(-2px); box-shadow: 0 6px 30px rgba(59,130,246,0.2);
}
.ad-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,0.15); padding: 3px 10px; border-radius: 20px;
  margin-bottom: 12px; letter-spacing: 1px; color: rgba(255,255,255,0.7);
  position: relative; z-index: 1;
}
.ad-main-title {
  font-size: 22px; font-weight: 800; color: #ffffff;
  margin-bottom: 8px; letter-spacing: 1px; position: relative; z-index: 1;
}
.ad-main-desc { font-size: 14px; color: rgba(255,255,255,0.8); position: relative; z-index: 1; }

/* ========== Mobile Menu ========== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.mobile-overlay.active { display: block; }
@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .main-content { padding-top: 72px; }
}

/* ========== 紧凑布局 ========== */
.card { margin-bottom: 12px !important; }
.card-header { padding: 10px 16px !important; }
.card-header h3 { font-size: 14px !important; }
.card-body, .card-body.padded { padding: 12px 16px !important; }
.page-header { margin-bottom: 12px !important; }
.page-header h1 { font-size: 20px !important; }
.page-header p { font-size: 12px !important; }
.form-group label { font-size: 12px !important; margin-bottom: 2px !important; }
.filter-select { height: 34px !important; font-size: 13px !important; padding: 4px 8px !important; }
.btn { font-size: 13px !important; }
.balance-card { padding: 16px !important; margin-bottom: 12px !important; }
.balance-label { font-size: 12px !important; }
.balance-amount { font-size: 28px !important; }
.redeem-section { margin-top: 10px !important; }
.redeem-section input { height: 34px !important; font-size: 13px !important; padding: 4px 10px !important; }
.redeem-section button { height: 34px !important; padding: 6px 16px !important; }
.ad-banner { margin-bottom: 12px !important; padding: 12px !important; }
.sms-note { padding: 8px 12px !important; font-size: 12px !important; margin-bottom: 10px !important; }
table th, table td { padding: 8px 12px !important; font-size: 13px !important; }
#buyBtn { height: 34px !important; padding: 6px 16px !important; }
#activeOrderCard [style*='font-size:24px'] { font-size: 18px !important; }
#activeOrderCard [style*='font-size:36px'] { font-size: 28px !important; }
#activeOrderCard [style*='padding:20px'] { padding: 12px !important; }
#activeOrderCard [style*='gap:24px'] { gap: 16px !important; }
#activeOrderCard [style*='margin-bottom:20px'] { margin-bottom: 12px !important; }
.stats-grid .stat-card { padding: 14px !important; }

/* 修复充值框比例 */
.redeem-section input { flex: none !important; width: 40% !important; }
.redeem-section .btn { flex: 1 !important; max-width: none !important; width: auto !important; }

/* 手机端适配 */
@media (max-width: 768px) {
  .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }
  #sec-sms .card-body > div[style*='grid'] { display: flex !important; flex-wrap: wrap !important; gap: 10px !important; }
  #sec-sms .card-body > div[style*='grid'] > div { width: calc(50% - 5px) !important; min-width: 0 !important; }
  #sec-sms .card-body > div[style*='grid'] > div select { width: 100% !important; }
  #sec-sms .card-body > div[style*='grid'] > button { width: 100% !important; }
  .redeem-section { flex-direction: column !important; }
  .redeem-section input { width: 100% !important; flex: none !important; }
  .redeem-section .btn { width: 100% !important; flex: none !important; max-width: none !important; }
  .main-content { padding: 12px !important; padding-top: 56px !important; }
  .page-header { margin-bottom: 8px !important; }
  .page-header h1 { font-size: 18px !important; }
  .page-header p { font-size: 11px !important; }
  .ad-banner { padding: 12px !important; }
  .ad-main-title { font-size: 16px !important; }
  .ad-main-desc { font-size: 12px !important; }
}
