:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-secondary: #f8f8fa;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-press: #006edb;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --success: #34c759;
  --danger: #ff3b30;
  --warning: #ff9500;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);

  /* 兼容后台旧模板中的配色变量 */
  --gold: var(--accent);
  --gold-hi: #1685ef;
  --gold-soft: var(--accent-soft);
  --text: var(--text-primary);
  --text-2: var(--text-secondary);
  --muted: var(--text-secondary);
  --line: var(--border);
  --line-2: var(--border-strong);
  --card: var(--surface);
  --input: var(--surface);
  --ok: var(--success);
  --warn: var(--warning);
  --err: var(--danger);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(0, 113, 227, 0.16);
}

/* ===== 前台：Apple 风格浅色授权页 ===== */
.ambient-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 50% at 50% 0%, rgba(0, 113, 227, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(88, 86, 214, 0.04) 0%, transparent 50%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 52%);
}

body.front-page {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: clamp(28px, 9vh, 86px) 16px max(24px, env(safe-area-inset-bottom, 24px));
  overflow-x: hidden;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-block: auto;
}

.glass-pane {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: paneIn 0.5s var(--ease-spring);
}

@keyframes paneIn {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.site-notice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid rgba(0, 113, 227, 0.1);
  border-radius: var(--radius-md);
  background: rgba(0, 113, 227, 0.06);
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
}

.site-notice-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.12);
  color: var(--accent);
}

.site-notice-track {
  flex: 1;
  min-width: 0;
}

.site-notice-text {
  display: block;
  color: var(--text-secondary);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.brand-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.brand-emblem {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 8px 18px rgba(0, 113, 227, 0.2));
  transition: transform 0.25s var(--ease);
}

.brand-emblem:active {
  transform: scale(0.94);
}

.brand-emblem .mark {
  display: block;
}

.brand-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.brand-sub {
  margin: -6px 0 0;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.brand-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}

.brand-tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.045);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.field-label .ui-icon {
  color: var(--accent);
}

#redeemForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1), var(--shadow-sm);
}

.input-shell > .ui-icon {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  transition: color 0.2s var(--ease);
}

.input-shell:focus-within > .ui-icon {
  color: var(--accent);
}

.input-native {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.input-native::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.service-main,
.service-current {
  display: flex;
  align-items: center;
}

.service-main {
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.service-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
}

.service-current {
  flex-shrink: 0;
  gap: 4px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}

.service-current .ui-icon {
  color: var(--text-tertiary);
}

.btn-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3);
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.btn-main:hover {
  background: var(--accent-hover);
}

.btn-main:active {
  background: var(--accent-press);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
  transform: scale(0.98);
}

.btn-main:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.btn-main.loading .button-icon {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.action-strip {
  display: flex;
  gap: 8px;
  width: 100%;
}

.action-strip .btn-ghost {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.btn-ghost:hover {
  background: rgba(0, 113, 227, 0.06);
}

.btn-ghost:active {
  background: rgba(0, 113, 227, 0.1);
}

.btn-ghost.copied {
  color: var(--success);
}

.footer-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 0 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-align: center;
}

.footer-tag .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

/* ===== 兑换结果 ===== */
.ticket {
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.ticket.pop {
  animation: ticketPop 0.35s var(--ease-spring);
}

@keyframes ticketPop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ticket-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 16px;
}

.ticket-summary {
  min-width: 0;
}

.status-badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.status-ok {
  background: rgba(52, 199, 89, 0.1);
  color: #248a3d;
}

.status-info {
  background: rgba(0, 113, 227, 0.09);
  color: var(--accent);
}

.ticket-product {
  margin-top: 10px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ticket-meta {
  flex: 0 0 auto;
  text-align: right;
}

.ticket-meta .k {
  margin-bottom: 4px;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ticket-meta .v {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.ticket-cut {
  position: relative;
  height: 1px;
  margin: 0 18px;
  border-top: 1px dashed var(--border-strong);
}

.ticket-cut::before,
.ticket-cut::after {
  content: "";
  position: absolute;
  top: -7px;
  width: 13px;
  height: 13px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
}

.ticket-cut::before { left: -25px; }
.ticket-cut::after { right: -25px; }

.ticket-body {
  padding: 16px 18px 18px;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.content-head .btn-ghost {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
}

.content-box {
  max-height: 260px;
  overflow: auto;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-secondary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-box {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: rgba(255, 149, 0, 0.07);
  color: #8a5a00;
  font-size: 12px;
  line-height: 1.6;
}

.ticket-key-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--text-tertiary);
  font-size: 10.5px;
}

.ticket-key-row code {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  word-break: break-all;
}

/* ===== 使用说明 ===== */
.help-panel {
  width: 100%;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  scroll-margin-top: 24px;
}

.help-dialog {
  width: min(calc(100% - 32px), 400px);
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.help-dialog[open] {
  animation: modalPopIn 0.32s var(--ease-spring);
}

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.055);
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.09);
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.help-head h2 {
  margin: 3px 0 0;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
}

.section-kicker {
  color: var(--text-tertiary);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.6px;
}

.help-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.steps {
  display: flex;
  flex-direction: column;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.step:first-child {
  padding-top: 2px;
  border-top: 0;
}

.step:last-child {
  padding-bottom: 0;
}

.step .num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.step .txt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.step .txt strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

/* ===== 通用提示 ===== */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.55;
}

.alert-err {
  border: 1px solid rgba(255, 59, 48, 0.12);
  background: rgba(255, 59, 48, 0.06);
  color: #c22a23;
}

.alert-ok {
  border: 1px solid rgba(52, 199, 89, 0.14);
  background: rgba(52, 199, 89, 0.07);
  color: #237b39;
}

.alert-warn {
  border: 1px solid rgba(255, 149, 0, 0.16);
  background: rgba(255, 149, 0, 0.08);
  color: #8a5a00;
}

/* ===== 登录 / 安装 ===== */
.auth-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 32px 16px;
  background:
    radial-gradient(ellipse 80% 55% at 50% 0%, rgba(0, 113, 227, 0.08), transparent 60%),
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 70%);
}

.auth-box {
  width: min(100%, 400px);
}

.auth-box-wide {
  width: min(100%, 760px);
}

.auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  margin-bottom: 20px;
  text-align: center;
}

.auth-head .mark {
  filter: drop-shadow(0 8px 16px rgba(0, 113, 227, 0.2));
}

.auth-head h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.auth-head p {
  margin: -3px 0 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  letter-spacing: 0.6px;
}

/* ===== 基础卡片与表单 ===== */
.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.card > h3:first-child,
.card > .page-head:first-child {
  margin-top: 0;
}

.brand {
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.2px;
}

.lead {
  margin-top: -8px;
  line-height: 1.7;
}

.muted {
  color: var(--text-secondary);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.form input,
.form select,
.form textarea,
.filters select,
.filters input {
  width: 100%;
  border: 1px solid var(--border);
  outline: 0;
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}

.form input,
.form select {
  height: 44px;
  padding: 0 12px;
}

.form textarea {
  min-height: 90px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.filters select:focus,
.filters input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.09);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

.form label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.form label.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-section {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.inline-pair {
  display: flex;
  gap: 8px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filters select,
.filters input {
  width: auto;
  height: 36px;
  padding: 0 10px;
  font-size: 12.5px;
}

.filters .spacer {
  flex: 1;
}

/* ===== 按钮 ===== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
.btn-pink {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.2);
  color: #fff;
}

.btn-primary:hover,
.btn-pink:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.btn-ghost {
  color: var(--accent);
  border-color: var(--border);
  background: transparent;
}

.btn-ghost:hover {
  border-color: rgba(0, 113, 227, 0.2);
  background: var(--accent-soft);
}

.btn-danger {
  color: #c22a23;
  border-color: rgba(255, 59, 48, 0.18);
  background: transparent;
}

.btn-danger:hover {
  border-color: rgba(255, 59, 48, 0.3);
  background: rgba(255, 59, 48, 0.06);
}

.btn-sm {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ===== 后台 ===== */
body.admin {
  display: block;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 35% at 50% 0%, rgba(0, 113, 227, 0.045), transparent 65%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 10px max(20px, calc((100vw - 1360px) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(251, 251, 253, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.logo .mark {
  display: block;
  flex: 0 0 auto;
  border-radius: 9px;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.topbar nav > a {
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.topbar nav > a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.topbar nav > a.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-form {
  margin: 0 0 0 5px;
}

.nav-form button {
  max-width: 150px;
  overflow: hidden;
  padding: 8px 11px;
  border: 0;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.045);
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.admin-wrap {
  width: min(100%, 1360px);
  margin: 0 auto;
  padding: 28px 24px 44px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.page-head h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.page-head h3 {
  color: var(--text-primary);
}

.card {
  margin-bottom: 16px;
}

.card h3.brand {
  margin: 0 0 16px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat .n {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat .l {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.7px;
}

.batch-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(0, 113, 227, 0.12);
  border-radius: var(--radius-md);
  background: rgba(0, 113, 227, 0.06);
}

.batch-title {
  margin-bottom: 3px;
  font-size: 14px;
  font-weight: 600;
}

.batch-title b {
  color: var(--accent);
  font-size: 18px;
}

/* ===== 数据表格 ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th,
table.data td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

table.data th {
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover td {
  background: rgba(0, 113, 227, 0.025);
}

table.data code {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.cell-content {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}

.pill-new {
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
}

.pill-on {
  background: rgba(52, 199, 89, 0.1);
  color: #248a3d;
}

.pill-off {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
}

.pill-exp {
  background: rgba(255, 59, 48, 0.08);
  color: #c22a23;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 12px;
}

/* ===== 详情卡 / 安全状态 ===== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.info-item {
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-secondary);
}

.info-item .k {
  margin-bottom: 5px;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.info-item .v {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding: 11px 0 11px 26px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.check-list li:last-child {
  border-bottom: 0;
}

.check-list li::before {
  position: absolute;
  left: 2px;
  top: 10px;
  font-weight: 700;
}

.check-list li.ok::before {
  content: "✓";
  color: var(--success);
}

.check-list li.bad::before {
  content: "!";
  color: var(--warning);
}

.footer {
  padding-top: 10px;
  color: var(--text-tertiary);
  font-size: 11px;
  text-align: center;
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
  }

  .topbar nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .admin-wrap {
    padding: 20px 14px 36px;
  }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .form-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 17px;
    border-radius: 16px;
  }

  .page-head h2 {
    font-size: 21px;
  }

  .filters {
    align-items: stretch;
  }

  .filters select,
  .filters input {
    flex: 1 1 130px;
    width: auto;
  }

  .filters .spacer {
    display: none;
  }
}

@media (max-width: 360px) {
  body.front-page {
    padding: 12px;
  }

  .glass-pane {
    gap: 22px;
  }

  .brand-emblem,
  .brand-emblem .mark {
    width: 48px;
    height: 48px;
  }

  .brand-title {
    font-size: 19px;
  }

  .input-shell {
    height: 48px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .service-row {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .service-current {
    font-size: 10.5px;
  }

  .btn-main {
    height: 46px;
    border-radius: 12px;
    font-size: 14.5px;
  }

  .help-panel {
    padding: 18px;
    border-radius: 16px;
  }

  .ticket-top {
    flex-direction: column;
    gap: 10px;
  }

  .ticket-meta {
    text-align: left;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  body.front-page {
    align-items: flex-start;
    padding-top: 12px;
  }

  .glass-pane {
    gap: 16px;
  }

  .brand-row {
    gap: 8px;
  }

  .brand-emblem,
  .brand-emblem .mark {
    width: 44px;
    height: 44px;
  }

  .form-section,
  #redeemForm {
    gap: 10px;
  }

  .input-shell,
  .service-row,
  .btn-main {
    height: 44px;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
