:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --line: #e3e6f0;
  --text: #292942;
  --muted: #858ba1;
  --primary: #6658c7;
  --primary-strong: #5143ac;
  --primary-soft: #f0efff;
  --cyan: #2eaec4;
  --green: #2a9b71;
  --amber: #ad7b2f;
  --danger: #bd5a68;
  --radius: 14px;
  --shadow: 0 10px 35px rgba(42, 43, 80, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(102, 88, 199, .22);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.3; letter-spacing: -.8px; }
h2 { font-size: 18px; line-height: 1.4; }
h3 { font-size: 21px; line-height: 1.45; }
input, select, textarea {
  width: 100%;
  border: 1px solid #dfe3ee;
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  outline: 0;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input, select { height: 43px; padding: 0 12px; }
input::placeholder { color: #a3a8bb; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102, 88, 199, .11); }
input:disabled, select:disabled { background: #f3f4f8; color: var(--muted); }
label { display: block; margin: 19px 0 7px; color: #555b72; font-size: 12px; font-weight: 650; }
label:first-child { margin-top: 0; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; font-size: 12px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { color: #9298af; font-size: 9px; font-weight: 700; letter-spacing: 2px; }
.heading-dot { color: var(--cyan); }
.text-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: #6b7188;
  font-size: 12px;
  font-weight: 650;
}
.text-button:hover { color: var(--primary); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 37px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.button:active:not(:disabled) { transform: translateY(1px); }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 5px 14px rgba(102, 88, 199, .2); }
.button.primary:hover:not(:disabled) { background: var(--primary-strong); }
.button.secondary { border-color: #dfe2ec; background: #fff; color: #5d6379; }
.button.secondary:hover:not(:disabled) { border-color: #c7cbe0; background: #f9f9fd; }
.button.danger { border-color: #ead2d8; background: #fff; color: var(--danger); }
.button.danger:hover:not(:disabled) { background: #fff3f5; }
.button.small { min-height: 29px; padding: 4px 9px; border-radius: 6px; font-size: 11px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 760; letter-spacing: .6px; line-height: 1.25; }
.brand-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 450; letter-spacing: .5px; }
.brand-mark { position: relative; display: flex; align-items: end; gap: 4px; width: 34px; height: 36px; padding: 7px 8px; overflow: hidden; border-radius: 11px; background: linear-gradient(145deg, var(--primary), #786ee0); box-shadow: 0 5px 12px rgba(102, 88, 199, .24); transform: skew(-9deg); }
.brand-mark i { display: block; width: 5px; height: 19px; border-radius: 5px; background: #fff; opacity: .95; }
.brand-mark i:nth-child(2) { height: 24px; background: #8ee1e5; }
.brand-mark i:nth-child(3) { height: 14px; background: #d9d5ff; }

/* Public redemption page */
.redeem-page { min-height: 100vh; background: radial-gradient(ellipse at 50% 0, #eae8ff 0, transparent 43%), radial-gradient(ellipse at 90% 30%, #e7fbff 0, transparent 33%), var(--bg); }
.redeem-header { max-width: 1100px; margin: auto; padding: 27px 32px; display: flex; align-items: center; justify-content: space-between; }
.redeem-header .brand { margin: 0; }
.redeem-header-note { color: #9a9db2; font-size: 11px; letter-spacing: 1.5px; }
.redeem-header-actions { display: flex; align-items: center; gap: 18px; }
.game-chip { padding: 5px 9px; border: 1px solid #d7daf0; border-radius: 999px; background: rgba(255,255,255,.65); color: #777aa3; font-size: 10px; letter-spacing: .5px; }
.redeem-main { width: min(560px, 100%); margin: 27px auto 0; padding: 0 20px; }
.redeem-intro { margin-bottom: 27px; text-align: center; }
.redeem-intro .eyebrow { margin-bottom: 11px; color: #7d72c1; }
.redeem-intro h1 { font-size: 35px; }
.redeem-intro > p { margin-top: 10px; color: var(--muted); font-size: 13px; }
.redeem-card { padding: 30px 31px 26px; border: 1px solid #e7e8f2; border-radius: 18px; background: rgba(255,255,255,.97); box-shadow: 0 18px 48px rgba(54, 57, 103, .08); }
.redeem-steps { display: flex; gap: 10px; justify-content: space-between; list-style: none; margin: 0 0 25px; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.redeem-steps li { display: flex; align-items: center; gap: 7px; color: #a4a8b7; font-size: 11px; white-space: nowrap; }
.redeem-steps li > span { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #e4e6ef; border-radius: 50%; font-size: 10px; }
.redeem-steps li.active { color: var(--primary); font-weight: 700; }
.redeem-steps li.active > span { border-color: var(--primary); background: var(--primary); color: #fff; }
.redeem-steps li.done { color: var(--green); }
.redeem-steps li.done > span { border-color: #d8eee4; background: #edf8f3; }
.redeem-help { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.85; }
.redeem-card label { margin-top: 20px; }
.redeem-card input { height: 47px; font-size: 14px; }
.redeem-card input#redeemCode { font-family: Consolas, monospace; font-size: 15px; letter-spacing: 1px; }
.redeem-wide { width: 100%; min-height: 45px; margin-top: 18px; font-size: 13px; }
.redeem-status { color: var(--danger); font-size: 12px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.redeem-status:not(:empty) { margin-top: 17px; padding: 11px 13px; border-radius: 8px; background: #fff3f5; }
.redeem-status.success { color: #267859; background: #eef9f4; }
.redeem-status.pending { color: #8b6b35; background: #fff8e8; }
.redeem-fixture { margin-bottom: 15px; padding: 12px 15px; border: 1px solid #eadfb9; border-radius: 9px; background: #fff9e8; color: #866f36; font-size: 11px; line-height: 1.8; }
.redeem-fixture strong { display: block; margin-bottom: 2px; }
.redeem-package { margin-bottom: 24px; padding: 17px; border: 1px solid #dedcf6; border-radius: 10px; background: linear-gradient(145deg, #f8f7ff, #f4fbff); }
.redeem-package-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: #7770a5; font-size: 11px; }
.redeem-plan-row { display: flex; justify-content: space-between; gap: 10px; margin: 7px 0; font-size: 13px; }
.redeem-plan-row > span { color: #9397ad; font-size: 12px; white-space: nowrap; }
.redeem-package-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 13px; padding-top: 11px; border-top: 1px dashed #d7d7ed; }
.redeem-package-total strong { color: var(--primary); font-size: 21px; font-weight: 700; }
.redeem-package-total > span { color: #8d90a6; font-size: 11px; }
.redeem-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 17px 0 3px; padding: 4px; border-radius: 8px; background: #f0f1f7; }
.auth-tabs button { border: 0; border-radius: 6px; background: transparent; color: #969bad; padding: 8px; font-size: 12px; }
.auth-tabs button.active { background: #fff; box-shadow: 0 2px 5px rgba(46, 48, 78, .07); color: var(--text); font-weight: 700; }
.inline-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.inline-field .button { min-width: 116px; min-height: 43px; }
.redeem-change { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 25px; padding-top: 17px; border-top: 1px solid var(--line); }
.redeem-change > span { color: #9da1b2; font-size: 10px; }
.redeem-result-heading { display: flex; align-items: center; gap: 13px; }
.redeem-result-icon { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; background: #efeeff; color: var(--primary); font-size: 24px; }
.redeem-result-icon.done { background: #ebf8f2; color: var(--green); }
.redeem-result-icon.problem { background: #fff2f4; color: var(--danger); }
.redeem-order-progress { padding: 17px 0; color: #747c92; font-size: 12px; line-height: 1.9; }
.redeem-progress-track { height: 6px; margin-top: 9px; overflow: hidden; border-radius: 4px; background: #eef0f6; }
.redeem-progress-track > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width .25s; }
.redeem-member-states { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.redeem-member-state { padding: 13px; border: 1px solid var(--line); border-radius: 8px; line-height: 1.8; }
.redeem-member-state > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.redeem-member-state > strong { font-size: 13px; }
.redeem-member-state p { margin-top: 4px; color: #979cae; font-size: 11px; }
.redeem-order-meta { margin-top: 15px; color: #a1a6b4; font-size: 10px; line-height: 1.9; overflow-wrap: anywhere; }
.redeem-footnote { margin: 22px 0; color: #999eaf; font-size: 11px; line-height: 1.9; text-align: center; }
.redeem-footer { padding: 15px 15px 25px; color: #afb2c0; font-size: 10px; letter-spacing: 1px; text-align: center; }

/* Admin pages */
.admin-login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 12%, #eae8ff, transparent 55%), var(--bg); }
.admin-login-main { width: min(450px, 100%); padding: 35px 20px; }
.admin-login-brand { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 27px; font-size: 22px; font-weight: 760; }
.admin-login-brand > span:last-child > span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 450; letter-spacing: .6px; }
.admin-login-card { padding: 32px; border: 1px solid #e5e6f0; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.admin-login-card .eyebrow { margin-bottom: 10px; color: #7d72c1; }
.admin-login-card h1 { font-size: 26px; }
.admin-login-note { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.admin-login-card input { height: 47px; font-size: 13px; }
.admin-login-card button[type="submit"] { width: 100%; min-height: 45px; margin-top: 19px; font-size: 13px; }
.admin-login-status { min-height: 0; margin-top: 11px; color: var(--danger); font-size: 12px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-login-status.pending { color: #817b9c; }
.admin-login-status.success { color: var(--green); }
.admin-login-footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 24px; padding-top: 17px; border-top: 1px solid var(--line); color: #a0a5b5; font-size: 10px; }
.admin-login-footer a { color: #7d72a8; }
.admin-login-footer a:hover { color: var(--primary); }
.admin-login-copyright { margin-top: 24px; color: #aeb2c1; font-size: 10px; letter-spacing: 1px; text-align: center; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; align-self: start; display: flex; height: 100vh; flex-direction: column; gap: 6px; padding: 28px 18px; border-right: 1px solid var(--line); background: #fff; }
.sidebar .brand { margin: 0 11px 43px; }
.nav-caption { margin: 0 16px 8px; color: #a0a4b4; font-size: 10px; letter-spacing: .8px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: 10px 16px; border: 0; border-radius: 8px; background: none; color: #777d92; font-size: 12px; font-weight: 600; text-align: left; }
.nav-link:hover, .nav-link.active { background: var(--primary-soft); color: var(--primary-strong); }
.nav-link > span:first-child { width: 21px; font-size: 19px; text-align: center; }
.sidebar-bottom { margin-top: auto; padding: 17px 12px 0; border-top: 1px solid var(--line); color: #737b8f; font-size: 10px; }
.sidebar-bottom small { display: block; margin-top: 4px; padding-left: 14px; color: #a1a6b4; font-size: 10px; }
.local-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--cyan); }
.workspace { min-width: 0; }
.topbar { display: flex; height: 69px; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.86); }
.breadcrumb { color: #656b82; font-size: 11px; }
.breadcrumb span { margin: 0 11px; color: #c2c5d2; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.connection { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.connection i { width: 6px; height: 6px; border-radius: 50%; background: #d4a962; }
.connection.online i { background: var(--green); }
main.admin-main { max-width: 1600px; margin: 0 auto; padding: 31px 32px 20px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.page-heading p { margin-top: 7px; color: var(--muted); font-size: 12px; }
.heading-date { align-self: end; margin-bottom: 3px; color: #969bad; font-size: 11px; }
.notice { display: flex; align-items: center; gap: 13px; padding: 13px 17px; margin-bottom: 19px; border: 1px solid; border-radius: 9px; font-size: 12px; }
.notice.demo { border-color: #eaddb6; background: #fff9e7; color: #846e3b; }
.notice strong { display: block; margin-bottom: 2px; font-size: 12px; }
.notice span { font-size: 11px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 23px; }
.stat-card { min-height: 138px; padding: 18px 20px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card.accent { border-color: #dedbf5; background: linear-gradient(122deg, #fff 52%, #f7f6ff); }
.stat-head { display: flex; align-items: center; justify-content: space-between; color: #7b8196; font-size: 12px; }
.stat-icon { color: #9da4b8; font-size: 19px; }
.accent .stat-icon { color: var(--primary); }
.stat-card strong { display: block; margin: 13px 0 11px; font-size: 32px; font-weight: 700; letter-spacing: -.6px; line-height: 1.2; }
.stat-card strong em { color: #a1a6b7; font-size: 15px; font-style: normal; font-weight: 450; letter-spacing: 0; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #979cad; }
.stat-foot small { font-size: 10px; }
.panel { margin-bottom: 23px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); scroll-margin-top: 18px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 21px 23px 18px; border-bottom: 1px solid var(--line); }
.title-line { display: flex; align-items: center; gap: 9px; }
.count-pill { padding: 1px 6px; border-radius: 5px; background: #f0f1f6; color: #8e94a7; font-size: 10px; line-height: 1.7; }
.panel-header p { margin-top: 5px; color: #989dae; font-size: 11px; }
.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.table-wrap { position: relative; overflow: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; text-align: left; }
th, td { padding: 16px 19px; border-bottom: 1px solid #eff0f5; vertical-align: middle; }
th { padding-top: 11px; padding-bottom: 11px; background: #fafbfe; color: #9298a9; font-size: 10px; font-weight: 550; white-space: nowrap; }
td { color: #636a80; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 5px; background: #f0f1f5; color: #9398a8; font-size: 10px; white-space: nowrap; }
.status-pill.success { background: #eaf7f1; color: var(--green); }
.status-pill.pending { background: #fff7e6; color: var(--amber); }
.status-pill.danger { background: #fff0f3; color: var(--danger); }
.empty { padding: 42px 20px; color: #a3a8b7; text-align: center; }
.empty strong { display: block; margin-bottom: 5px; color: #72798d; font-size: 13px; font-weight: 650; }
.empty > span:last-child { font-size: 11px; }
.toolbar input { width: 190px; height: 34px; font-size: 11px; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 21px 23px 23px; }
.product-card { padding: 15px; border: 1px solid #e3e4f1; border-radius: 10px; background: linear-gradient(145deg, #fff, #f8f8ff); }
.product-card strong { display: block; color: var(--primary-strong); font-size: 21px; }
.product-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.product-card small { display: block; margin-top: 10px; color: #9a9fb0; font-size: 10px; }
.code-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; align-items: end; padding: 20px 23px; border-bottom: 1px solid var(--line); }
.code-form label { margin: 0 0 7px; }
.code-form .button { min-height: 43px; }
.admin-footer { display: flex; justify-content: space-between; margin-top: 25px; padding: 0 2px; color: #aaafbd; font-size: 10px; }
.toast { position: fixed; z-index: 20; bottom: 27px; left: 50%; max-width: min(660px, calc(100vw - 30px)); padding: 11px 19px; border-radius: 8px; background: #313447; color: #fff; box-shadow: 0 7px 25px rgba(36,39,66,.15); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell { grid-template-columns: 184px minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 60px; padding: 0 18px; }
  .top-actions { gap: 10px; }
  .connection { font-size: 10px; }
  main.admin-main { padding: 24px 15px 18px; }
  .page-heading { align-items: end; margin-bottom: 20px; }
  .page-heading h1 { font-size: 26px; }
  .heading-date { display: none; }
  .panel-header { align-items: flex-start; flex-wrap: wrap; padding: 18px 16px 15px; }
  .toolbar { width: 100%; justify-content: flex-start; }
  .toolbar input { flex: 1; width: auto; }
  .code-form { grid-template-columns: 1fr; padding: 17px 16px; }
  .code-form .button { width: 100%; }
  .product-grid { padding: 16px; }
}
@media (max-width: 540px) {
  .redeem-header { padding: 20px; }
  .redeem-header-note, .game-chip { display: none; }
  .redeem-main { margin-top: 18px; padding: 0 14px; }
  .redeem-intro h1 { font-size: 30px; }
  .redeem-card { padding: 24px 20px 21px; border-radius: 14px; }
  .redeem-steps { gap: 5px; }
  .redeem-steps li { gap: 5px; font-size: 10px; }
  .redeem-member-states { grid-template-columns: 1fr; }
  .inline-field { grid-template-columns: 1fr; }
  .inline-field .button { width: 100%; }
  .stat-grid { gap: 10px; }
  .stat-card { min-height: 124px; padding: 14px; }
  .stat-card strong { margin: 10px 0; font-size: 28px; }
  .product-grid { grid-template-columns: 1fr; }
  .admin-login-main { padding: 25px 16px; }
  .admin-login-card { padding: 27px 23px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

.qr-panel{text-align:center;margin:22px 0}.qr-panel img{display:block;width:220px;height:220px;object-fit:contain;margin:16px auto;padding:10px;background:white;border:1px solid #e4e2ef;border-radius:12px}.qr-panel p{font-size:14px;color:#69718a}.generated-codes{display:block;width:calc(100% - 44px);min-height:110px;margin:0 22px 22px;padding:14px;border:1px solid #dedee9;border-radius:8px;font:13px ui-monospace,monospace}.import-status{padding:0 22px;white-space:pre-wrap;font-size:13px;color:#68728a}.order-dialog{width:min(850px,94vw);max-height:85vh;border:1px solid #ddd8f0;border-radius:16px;padding:24px;box-shadow:0 20px 80px #2e255a30}.order-dialog::backdrop{background:#20233f60}.order-dialog pre{white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;max-height:55vh;overflow:auto}.redeem-order-meta{white-space:pre-wrap;overflow-wrap:anywhere}.redeem-page [hidden],.admin-page [hidden]{display:none!important}.auth-tabs button{min-width:0}.redeem-page .auth-tabs{flex-wrap:wrap}
