:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1b9bf0;
  --primary-d: #1583d4;
  --ok: #0ea371;
  --warn: #e08a00;
  --danger: #e5484d;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(17, 24, 39, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #ffffff;
  color: var(--text);
  line-height: 1.5;
}

/* ===== 通用按钮 ===== */
button {
  cursor: pointer; border: none; border-radius: 10px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; font-family: inherit;
}
.primary { background: var(--primary); color: #fff; transition: background .15s, transform .05s; }
.primary:hover { background: var(--primary-d); }
.primary:active { transform: translateY(1px); }
.ghost {
  background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; font-family: inherit;
}
.ghost:hover { background: #e2e8f0; }
.ghost:disabled { opacity: .5; cursor: not-allowed; }
.hidden { display: none !important; }

/* ===== 用户注册页 ===== */
.container { max-width: 460px;
    margin: 0 auto;
    /* padding: 0px 16px 56px; */
    /* margin-top: -24px; */
    }
h1 { font-size: 20px; margin: 0 0 4px; font-weight: 700; }
h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.banner {
  display: block; width: 100%; height: auto;
  margin-bottom: 16px; box-shadow: var(--shadow);
}

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  margin: 0px 16px 16px;
    margin-top: -44px;
    position: relative;
    z-index: 1;
}
.hint-card { margin-top: 16px; }
.hint-card h3 { margin: 0 0 8px; font-size: 15px; }
.hint-card .hint { margin: 0 0 14px; }
.hint-card .primary { width: 100%; margin-top: 4px; }
.primary:disabled { opacity: .6; cursor: not-allowed; }
.reg-info { margin-top: 16px; }
.reg-info h3 { margin: 0 0 6px; font-size: 15px; }
.reg-info .hint { margin: 0 0 12px; }
.reg-info-text {
  background: #f1f5f9; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 14px; font-size: 13px; line-height: 1.7;
  color: #0f172a; white-space: pre-wrap; word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.reg-info .primary { width: 100%; }
label { display: block; font-size: 13px; color: #374151; margin-bottom: 14px; font-weight: 500; }
label input, label select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  border: 1px solid #d1d5db; border-radius: 10px; font-size: 16px;
  background: #fff; color: var(--text); font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
label input:focus, label select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 155, 240, .15);
}
.hint {
  font-size: 12px; color: var(--muted); margin: 0 0 14px; line-height: 1.6;
}
.hint strong { color: #475569; }
#submitBtn { width: 100%; padding: 14px; font-size: 16px; margin-top: 6px; }

/* 结果 / 错误提示 */
.result {
  display: flex; gap: 12px; align-items: flex-start;margin: 0px 16px 56px;
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  font-size: 14px; line-height: 1.5; border: 1px solid transparent;
}
.result.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.result.failed { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.result.processing { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.result-icon {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff; line-height: 1;
}
.result.success .result-icon { background: #0ea371; }
.result.failed .result-icon { background: #e5484d; }
.result.processing .result-icon { background: #1b9bf0; animation: pulse 1.2s infinite; }
.result-body { flex: 1; min-width: 0; }
.result .status { font-weight: 600; margin-bottom: 2px; }
.result .extra { font-size: 13px; opacity: .92; word-break: break-word; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* 二次确认弹窗 */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal {
  background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.modal h3 { margin-top: 0; font-size: 17px; }
.modal ul { list-style: none; padding: 0; margin: 14px 0; }
.modal li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed #eee; font-size: 14px;
}
.modal li span { color: var(--muted); flex-shrink: 0; }
.modal li b { font-weight: 600; text-align: right; word-break: break-all; }
.modal .warn {
  color: #b45309; background: #fffbeb; padding: 10px 12px;
  border-radius: 8px; font-size: 12px; margin: 4px 0 16px; line-height: 1.6;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions button { flex: 1; padding: 12px; }

/* 自定义错误弹窗 */
.alert-modal { max-width: 320px; }
.alert-icon {
  width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%;
  background: #fee2e2; color: #e5484d; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.alert-modal h3 { text-align: center; margin: 0 0 8px; font-size: 17px; }
.alert-modal .alert-msg {
  color: #475569; font-size: 14px; line-height: 1.6; margin: 0 0 18px;
  white-space: pre-line; text-align: center;
}
.alert-modal .modal-actions { justify-content: center; }
.alert-modal .modal-actions button { flex: none; min-width: 120px; }

/* 全屏结果提示 */
.result-overlay-card { max-width: 340px; text-align: center; }
.result-overlay-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #fff; line-height: 1;
}
.result-overlay-icon.processing { background: #1b9bf0; animation: pulse 1.2s infinite; }
.result-overlay-icon.success { background: #0ea371; }
.result-overlay-icon.failed { background: #e5484d; }
.result-overlay-card h3 { margin: 0 0 8px; font-size: 18px; }
.result-overlay-msg { color: #475569; font-size: 14px; margin: 0 0 10px; }
.result-overlay-extra {
  font-size: 13px; color: #0f172a; background: #f1f5f9;
  border-radius: 10px; padding: 12px 14px; line-height: 1.7;
  margin: 0 0 18px; text-align: left;
}
.result-overlay-extra b { color: #0f172a; }
.result-overlay-card .modal-actions { justify-content: center; }
.result-overlay-card .modal-actions button { flex: none; min-width: 140px; }

/* 联系客服：左二维码右文案 */
.kf-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  margin: 0 16px 56px;
}
.kf-card .kf-qrcode {
  width: 110px; height: 110px; flex-shrink: 0;
  border-radius: 10px; border: 1px solid var(--border); display: block;
}
.kf-card h3 { margin: 0 0 6px; font-size: 15px; }
.kf-card .hint { margin: 0; }

/* 复制成功提示 toast */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: rgba(15, 23, 42, .92); color: #fff; padding: 11px 20px;
  border-radius: 10px; font-size: 14px; z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); white-space: nowrap;
}

/* ===== 管理后台：登录门 ===== */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.gate-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; width: 100%; max-width: 360px; box-shadow: var(--shadow);
}
.gate-card h2 { margin: 0 0 4px; font-size: 19px; }
.gate-card label { margin-top: 16px; }
.gate-card label input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px;
  border: 1px solid #d1d5db; border-radius: 10px; font-size: 16px;
}
.gate-card .primary { width: 100%; margin-top: 8px; }

/* ===== 管理后台：全屏外壳 ===== */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.admin-header {
  height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: #0f172a; color: #fff; position: sticky; top: 0; z-index: 10;
}
.admin-header .brand { font-weight: 700; font-size: 15px; }
.admin-header .header-right { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.admin-header .ghost {
  background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; padding: 7px 12px; font-size: 13px;
}
.admin-header .ghost:hover { background: rgba(255, 255, 255, .22); }
.admin-header .muted { color: #94a3b8; }

.admin-main { flex: 1; padding: 16px; width: 100%; box-sizing: border-box; }
.panel-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel-card > h3 { font-size: 15px; color: #0f172a; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.card-head h3 { margin: 0; }
.head-actions { display: flex; gap: 8px; }

/* 筛选栏 */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filter-bar input { padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font-size: 14px; background: #fff; font-family: inherit; }
.filter-bar input[type="text"], .filter-bar input:not([type]) { flex: 1; min-width: 140px; }
.filter-bar input[type="date"] { width: auto; }
.filter-bar .tilde { color: #94a3b8; }
.filter-bar .preset-wrap { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-bar .preset-wrap .muted { font-size: 12px; }
.filter-bar .ghost.sm { padding: 7px 10px; font-size: 12px; }

/* 分页栏 */
.pager { display: flex; align-items: center; gap: 12px; padding: 12px 2px 2px; flex-wrap: wrap; }
.pager .muted { font-size: 13px; }

/* 生成令牌表单 */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.gen-grid label { margin-bottom: 0; font-size: 13px; color: #475569; }
.gen-grid label input, .gen-grid label select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid #cbd5e1; border-radius: 9px; font-size: 15px; background: #fff; font-family: inherit;
}
.gen-grid .primary { height: 44px; padding: 0 22px; white-space: nowrap; }

/* 表格区：双栏自适应，窄屏堆叠 */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.table-wrap { overflow-x: auto; border: 1px solid #eef2f7; border-radius: 12px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eef2f7; text-align: left; white-space: nowrap; }
th { background: #f8fafc; color: #64748b; font-weight: 600; position: sticky; top: 0; }
tr:hover td { background: #fafbff; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.small { font-size: 12px; margin-top: 8px; }
td .mono { white-space: normal; }

.ok { color: var(--ok); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.muted { color: #9ca3af; }

/* ===== 强制手机端：浏览器宽屏下也锁定手机宽度，居中显示为手机样式 ===== */
@media (min-width: 540px) {
  body { background: #ffffff; }
  .container, .admin-shell {
margin: 0 auto; min-height: 104vh;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .06), 0 24px 60px rgba(15, 23, 42, .18);
  }
  .admin-shell { background: var(--bg); }
  .container { padding-top: 0; }
  .admin-main { padding: 16px; }
  .panel-card { padding: 18px; }
  .gate-card { padding: 28px; }
}
