/* ============ Console / Auth shared ============ */
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: 8px; }

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
select.input { cursor: pointer; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.toolbar .input { max-width: 260px; }
.date-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.date-filter .input { max-width: 160px; }

.page-hero {
  background: linear-gradient(155deg, #eef1ff 0%, #f6f1ff 40%, #fff4f6 75%, #ffffff 100%);
  padding: 60px 0;
  text-align: center;
}
.page-hero h1 {
  font-size: 38px;
  color: var(--dark);
  margin-bottom: 10px;
}
.page-hero p {
  color: var(--text-light);
  font-size: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.console-section { padding-top: 40px; }
.console-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.console-topbar h2 { font-size: 22px; color: var(--dark); }
.console-topbar p { color: var(--text-light); font-size: 14px; margin-top: 2px; }

/* ============ Auth pages ============ */
.auth-body {
  min-height: 100vh;
  background: linear-gradient(155deg, #eef1ff 0%, #f6f1ff 45%, #fff4f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; text-align: center; }
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 26px;
}
.auth-logo img { height: 40px; width: auto; }
.auth-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 32px 30px 26px;
}
.auth-tabs {
  display: flex;
  background: var(--primary-light);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(26, 29, 41, 0.08);
}
.auth-form { text-align: left; }
.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
.form-field input, .form-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field input:focus, .form-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--text-light); }
.auth-switch a { color: var(--primary); font-weight: 600; }
.auth-back {
  display: inline-block;
  margin-top: 22px;
  color: var(--text-light);
  font-size: 14px;
  transition: color 0.2s;
}
.auth-back:hover { color: var(--primary); }

/* ============ Nav user box ============ */
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-user-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
.nav-user-btn:hover { background: var(--primary-light); }
.nav-user-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.2s;
}
.nav-user-name:hover { background: var(--primary-light); color: var(--primary); }
.nu-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--grad-1), var(--grad-3));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-logout {
  font-size: 13px;
  color: var(--text-light);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}
.nav-logout:hover { color: var(--danger); border-color: var(--danger); }

/* ============ Recharge ============ */
.balance-card {
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2), var(--grad-3));
  color: #fff;
  border-radius: 14px;
  padding: 14px 22px;
  min-width: 200px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(91, 91, 240, 0.25);
}
.balance-card small { display: block; font-size: 12px; opacity: 0.85; }
.balance-card strong { font-size: 22px; font-weight: 800; }

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.pkg-card {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 26px 22px 22px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.pkg-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.pkg-card.hot { border-color: var(--primary); box-shadow: 0 10px 30px rgba(91, 91, 240, 0.18); }
.pkg-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(120deg, var(--accent), #ff5f3a);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.pkg-name { font-size: 18px; font-weight: 700; color: var(--dark); margin-bottom: 10px; }
.pkg-price { font-size: 14px; color: var(--text-light); }
.pkg-price b { font-size: 34px; color: var(--dark); font-weight: 800; }
.pkg-token { margin: 10px 0 2px; font-size: 15px; color: var(--text); }
.pkg-token b { color: var(--primary); font-weight: 800; }
.pkg-bonus {
  display: inline-block;
  margin: 4px auto 8px;
  background: #fff7f2;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
}
.pkg-desc { font-size: 13px; color: var(--text-light); min-height: 38px; margin-bottom: 8px; }
.pkg-total { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }
.pkg-total b { color: var(--success); }
.pkg-card .btn { margin-top: 4px; }

.pay-guide {
  margin-top: 36px;
  background: var(--primary-light);
  border-radius: 14px;
  padding: 22px 28px;
}
.pay-guide h3 { font-size: 17px; color: var(--dark); margin-bottom: 12px; }
.pay-guide ol { padding-left: 20px; color: var(--text); font-size: 14px; }
.pay-guide li { margin: 5px 0; }

/* ============ Modal ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 41, 0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-box.small { max-width: 400px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; color: var(--dark); }
.modal-close {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 22px 24px; }

.pay-modal-body { padding: 20px 22px 24px; }
.pay-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f7f8fc;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text);
}
.pay-summary b { color: var(--dark); font-weight: 700; }
.pay-amount { font-size: 16px; }
.pay-amount b { color: var(--accent); font-size: 24px; font-weight: 800; }
.pay-qr-box {
  text-align: center;
  padding: 20px 0 14px;
}
.pay-qr-box img {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  margin: 0 auto;
}
.qr-placeholder {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  color: var(--text-light);
  margin: 0 auto;
  font-size: 14px;
}
.pay-qr-tip { margin-top: 12px; font-size: 14px; color: var(--text-light); }
.pay-qr-tip b { color: var(--primary); }
.pay-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.pay-actions .btn { flex: 1; }

.channel-grid { display: flex; gap: 14px; padding: 8px 0; }
.channel-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s;
}
.channel-item:hover { border-color: var(--primary); box-shadow: 0 6px 16px rgba(91, 91, 240, 0.15); }
.ci-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.ci-icon.alipay { background: #1677ff; }
.ci-icon.wechat { background: #07c160; }

/* ============ Account / Member center ============ */
.me-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(120deg, var(--grad-1), var(--grad-2), var(--grad-3));
  color: #fff;
  border-radius: 16px;
  padding: 28px 32px;
  margin-bottom: 34px;
  box-shadow: 0 12px 30px rgba(91, 91, 240, 0.28);
  flex-wrap: wrap;
}
.me-avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.5);
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.me-info { flex: 1; min-width: 160px; }
.me-info h2 { font-size: 22px; margin-bottom: 2px; }
.me-info p { font-size: 13px; opacity: 0.85; }
.me-referrer { margin-top: 4px; font-size: 13px; opacity: 0.9; }
.member-badge {
  display: inline-block;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 3px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}
.me-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.me-stat { text-align: center; }
.me-stat small { display: block; font-size: 12px; opacity: 0.85; }
.me-stat strong { font-size: 20px; font-weight: 800; }

/* ============ Table ============ */
.table-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  overflow-x: auto;
  margin-bottom: 30px;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--border);
  background: #fafbff;
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbff; }
.td-empty { text-align: center; color: var(--text-light); padding: 36px 16px !important; }
.td-sub { display: block; font-size: 12px; color: var(--text-light); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.strong { font-weight: 700; }

.status {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
}
.status-pending { background: #fff7e8; color: #d48806; }
.status-paid { background: #e8f0ff; color: var(--primary); }
.status-done { background: #e7f9ef; color: var(--success); }
.status-cancel { background: #f2f3f7; color: var(--text-light); }
.status-reject { background: #feebee; color: var(--danger); }

.level-chip { font-weight: 700; font-size: 13px; }
.ops { white-space: nowrap; }
.op-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  margin-right: 6px;
  transition: all 0.2s;
}
.op-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.op-btn.ok { color: var(--success); }
.op-btn.ok:hover { border-color: var(--success); background: #e7f9ef; }
.op-btn.danger { color: var(--danger); }
.op-btn.danger:hover { border-color: var(--danger); background: #feebee; }

.member-rules { margin-top: 26px; }
.member-rules h3 { font-size: 19px; color: var(--dark); margin-bottom: 16px; }
.member-level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.level-item {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.level-item strong { font-size: 15px; color: var(--dark); }
.level-item small { display: block; color: var(--text-light); margin: 4px 0 10px; font-size: 12px; }
.level-item p { font-size: 13px; color: var(--text); line-height: 1.8; }
.level-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}

/* ============ Admin ============ */
.admin-entry {
  text-align: center;
  padding: 10px 0 22px;
  font-size: 12px;
  color: var(--text-light);
  background: var(--dark-2);
}
.admin-entry a { color: rgba(255,255,255,0.5); transition: color 0.2s; }
.admin-entry a:hover { color: #fff; }
.admin-body {
  background: #f4f5fa;
  min-height: 100vh;
}
.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #eef1ff 0%, #f6f1ff 45%, #fff4f6 100%);
  padding: 24px;
}
.admin-login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
}
.admin-login-head { text-align: center; margin-bottom: 26px; }
.admin-login-head img { height: 46px; width: auto; margin: 0 auto 12px; }
.admin-login-head h2 { font-size: 20px; color: var(--dark); }
.admin-login-head p { font-size: 13px; color: var(--text-light); margin-top: 4px; }

#adminApp {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 220px;
  background: var(--dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 800;
  font-size: 15px;
}
.sidebar-brand img { height: 30px; width: auto; }
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-nav a {
  padding: 11px 14px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.sidebar-nav a.active {
  color: #fff;
  background: linear-gradient(120deg, var(--grad-1), var(--grad-3));
}
.sidebar-foot {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}
.sidebar-foot a { color: #fff; text-decoration: underline; }

.admin-main {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}
.admin-view { display: none; }
.admin-view.active { display: block; }
.view-title {
  font-size: 22px;
  color: var(--dark);
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}
.stat-card small { display: block; font-size: 13px; color: var(--text-light); }
.stat-card strong { font-size: 26px; font-weight: 800; color: var(--dark); }
.stat-card.member-dist { grid-column: 1 / -1; }
.stat-card.member-dist h3 { font-size: 15px; color: var(--text); margin-bottom: 12px; }
.stat-card.referrer-stat-card { grid-column: 1 / -1; margin-top: 16px; }
.stat-card.referrer-stat-card h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.stat-hint { font-size: 12px; color: var(--text-light); margin-bottom: 12px; }
.td-muted { color: var(--text-light); }
.order-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.member-dist { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dist-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  background: #f7f8fc;
  padding: 8px 16px;
  border-radius: 10px;
}
.dist-item b { font-size: 18px; }

.form-card { padding: 24px 26px; max-width: 480px; }
.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-right: 12px;
}
.switch-line input { width: 18px; height: 18px; accent-color: var(--primary); }

.qr-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.qr-config-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.qr-config-card h3 { font-size: 15px; color: var(--dark); margin-bottom: 14px; }
.qr-preview {
  width: 200px;
  height: 200px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafbff;
}
.qr-preview img { width: 100%; height: 100%; object-fit: contain; }
.qr-config-actions { display: flex; gap: 10px; justify-content: center; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .pkg-grid { grid-template-columns: repeat(2, 1fr); }
  .member-level-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-sidebar { width: 190px; }
  .stat-grid, .order-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .pkg-grid, .member-level-grid, .qr-config-grid { grid-template-columns: 1fr; }
  .stat-grid, .order-summary { grid-template-columns: 1fr; }
  .me-panel { flex-direction: column; text-align: center; }
  .me-stats { justify-content: center; }
  .admin-main { padding: 20px 16px; }
}
