/* ============================================================
   j.wwzu.com 捐助站样式 —— 忠实移植 lobe-ui 设计令牌
   （与 ps.qiwen.cn VIP 站同源：品牌紫 #6a5ce6 / mauve 中性色 /
     8·12px 圆角 / HarmonyOS Sans / 零外链依赖）
   ============================================================ */

:root {
  --colorPrimary: #6a5ce6;
  --colorPrimaryHover: #5a4bd6;
  --colorPrimaryBg: #f0eefc;
  --colorPrimaryBorder: #ddd7f8;

  --bg: #f6f5fa;
  --surface: #ffffff;
  --text: #1c1c28;
  --text2: #6b6b80;
  --text3: #9a9aae;

  --border: #e8e6f2;
  --radius: 12px;
  --radius-sm: 8px;

  --green: #22a06b;
  --green-bg: #e9f7f0;
  --red: #d6455d;
  --red-bg: #fdeef1;
  --amber: #b45309;
  --amber-bg: #fdf3e3;

  --shadow: 0 1px 2px rgba(28, 28, 40, .05), 0 8px 24px rgba(28, 28, 40, .06);
  --font: 'HarmonyOS Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC',
          'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--colorPrimary); text-decoration: none; }
a:hover { color: var(--colorPrimaryHover); }
h1 { font-size: 20px; margin: 0; }
.muted { color: var(--text2); font-size: 13px; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.center-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.center-card { padding: 40px; text-align: center; max-width: 420px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 15px; font-family: inherit;
  cursor: pointer; transition: all .15s ease; text-align: center;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--colorPrimary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--colorPrimaryHover); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--colorPrimary); color: var(--colorPrimary); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 18px; height: 18px; }

.field-label { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 6px; }
.input {
  width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: var(--colorPrimary); box-shadow: 0 0 0 3px var(--colorPrimaryBg); }
.form-error { margin-top: 10px; color: var(--red); font-size: 13px; }

/* ---------- 捐助页（一屏双栏：左品牌面板 + 右表单卡片） ---------- */
.donate-wrap { max-width: 520px; margin: 0 auto; padding: 40px 16px 24px; }

.split { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.panel-hero {
  --accent: var(--colorPrimary);
  position: relative; overflow: hidden; text-align: center;
  background: var(--hero-bg, linear-gradient(165deg, #17132b 0%, #241d47 55%, var(--accent) 145%));
  color: #fff; padding: 46px 20px 50px;
}
.hero-glow { position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; }
.hero-glow.g1 { width: 380px; height: 380px; background: rgba(255, 255, 255, .14); top: -120px; left: -80px; }
.hero-glow.g2 { width: 300px; height: 300px; background: rgba(255, 255, 255, .10); bottom: -100px; right: -70px; }
.hero-inner { position: relative; max-width: 560px; margin: 0 auto; }
.hero-badge {
  width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
}
.hero-title { font-size: clamp(26px, 2vw + 12px, 38px); font-weight: 800; letter-spacing: 1px; margin: 0; line-height: 1.3; }
.hero-sub { margin: 10px 0 0; font-size: 14px; color: rgba(255, 255, 255, .72); letter-spacing: .5px; }
.hero-intro {
  white-space: pre-line; color: rgba(255, 255, 255, .75); font-size: 13.5px;
  line-height: 1.8; margin: 16px auto 0; max-width: 46ch;
}

.panel-form {
  flex: 1; display: flex; align-items: center; justify-content: center;
  align-items: safe center; padding: 30px 16px 36px; min-width: 0;
}
.form-stack { width: 100%; max-width: 640px; }
.form-card { padding: 26px 28px 24px; border-radius: 16px; }
.form-card .field-label { margin: 18px 0 8px; }
.form-card .field-label:first-child { margin-top: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tier-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tier-grid-2 { grid-template-columns: repeat(2, 1fr); }
.tier {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 15px 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: inherit; transition: all .15s ease;
}
.tier:hover { border-color: var(--colorPrimary); transform: translateY(-1px); }
.tier.active {
  border-color: var(--colorPrimary); background: var(--colorPrimaryBg);
  box-shadow: 0 0 0 3px var(--colorPrimaryBg);
}
.tier-amount { font-size: 18px; font-weight: 800; }
.tier-points { font-size: 12px; color: var(--text2); }
.tier.active .tier-points { color: var(--colorPrimary); }

/* 「+ 自定义」卡片：点击后下方展开金额输入框 */
.tier-custom { border-style: dashed; background: transparent; }
.tier-custom .tier-plus {
  font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--colorPrimary);
}
.tier-custom.active { border-style: solid; }
.custom-reveal {
  overflow: hidden; max-height: 0; opacity: 0; margin-top: 0;
  transform: translateY(-4px);
  transition: max-height .25s ease, opacity .25s ease, margin-top .25s ease, transform .25s ease;
}
.custom-reveal.open { max-height: 150px; opacity: 1; transform: translateY(0); }
.custom-reveal .field-label { margin-top: 14px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 96px; }
.input-affix .input-suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 13px; font-weight: 700; color: var(--colorPrimary);
  pointer-events: none; white-space: nowrap;
}
.form-card input[type='number']::-webkit-outer-spin-button,
.form-card input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.form-card input[type='number'] { -moz-appearance: textfield; appearance: textfield; }

.btn-hero {
  margin-top: 16px; padding: 13px 18px; font-size: 16px; font-weight: 700;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--colorPrimary), #9b8cf0);
  box-shadow: 0 10px 24px rgba(106, 92, 230, .35);
}
.btn-hero:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--colorPrimaryHover), #8b7af0);
}

.rate-note { margin: 14px 0 0; }

.donate-foot { text-align: center; margin-top: 14px; }

/* ---------- 支付弹窗（不跳转：下单 → 扫码 → 成功） ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23, 21, 34, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  position: relative; width: 520px; max-width: 100%; max-height: 92vh; overflow: auto;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow);
  padding: 24px 26px 20px; text-align: center;
  animation: modal-in .22s ease;
}
@keyframes modal-in {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-close {
  position: absolute; top: 8px; right: 12px; border: 0; background: transparent;
  font-size: 24px; line-height: 1; color: var(--text3); cursor: pointer;
}
.modal-close:hover { color: var(--text); }

/* 弹窗内成功视图：压缩纵向节奏，避免 92vh 内出现滚动条 */
.modal-card .result-icon { width: 48px; height: 48px; font-size: 22px; margin: 0 auto 10px; }
.modal-card .result-title { font-size: 20px; }
.modal-card .code-box { margin: 12px 0; padding: 12px 14px; }
.modal-card .code-text { font-size: 16px; letter-spacing: 1.2px; margin-bottom: 8px; }
.modal-card .redeem-steps { font-size: 13.5px; line-height: 1.9; margin: 0 0 12px; }
.modal-card .mail-line { margin: 10px 0 6px; }
.modal-card .resend-msg { min-height: 0; margin-top: 4px; }

@media (min-width: 900px) {
  .split { flex-direction: row; }
  .panel-hero {
    flex: 0 0 46%; padding: 32px 4vw;
    display: flex; align-items: center; justify-content: center;
  }
  .panel-hero .hero-inner { max-width: 520px; }
  .panel-form { padding: 28px 4vw; }
}

@media (max-width: 899px) {
  .tier-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .panel-hero { padding: 40px 16px 44px; }
  .form-card { padding: 18px 16px 16px; }
}

/* ---------- 收银页 / 结果页 ---------- */
.pay-card { padding: 28px; text-align: center; }
.pay-head { margin-bottom: 18px; }
.pay-title { font-size: 16px; font-weight: 600; }
.pay-amount { font-size: 34px; font-weight: 800; margin: 6px 0 2px; letter-spacing: .5px; }

.qr-box { display: flex; justify-content: center; margin: 6px 0 8px; }
.qr-box svg { width: 224px; height: 224px; }
.qr-tips { margin-bottom: 14px; }

.mock-box { background: var(--amber-bg); border: 1px dashed #eccf9a; border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; }
.mock-note { font-size: 13px; color: var(--amber); margin-bottom: 12px; }

.pay-state { margin-top: 14px; }
.pay-state::after {
  content: ''; display: inline-block; width: 14px; text-align: left;
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75% { content: '···'; } }
.pay-closed { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pay-back { display: inline-block; margin-top: 18px; }

.result-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 4px auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.result-icon.ok { background: var(--green-bg); color: var(--green); }
.result-icon.err { background: var(--red-bg); color: var(--red); }
.result-icon.wait { background: var(--colorPrimaryBg); color: var(--colorPrimary); }
.result-title { margin: 0 0 4px; }

.code-box {
  background: var(--colorPrimaryBg); border: 1px solid var(--colorPrimaryBorder);
  border-radius: var(--radius-sm); padding: 16px; margin: 16px 0;
}
.code-label { margin-bottom: 6px; }
.code-text {
  font-family: Consolas, Menlo, monospace; font-size: 19px; font-weight: 700;
  letter-spacing: 2px; word-break: break-all; margin-bottom: 10px;
}
.redeem-steps { text-align: left; font-size: 14px; margin: 0 0 16px; padding-left: 20px; line-height: 2; }
.mail-line { margin: 14px 0 8px; }
.resend-msg { min-height: 20px; font-size: 13px; color: var(--green); margin-top: 6px; }

/* ---------- 后台 /union ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-side {
  width: 220px; flex: none; background: #171522; color: #cfcae4;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.admin-brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, #6a5ce6, #9b8cf0);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800;
}
.admin-brand-name { font-weight: 700; color: #fff; font-size: 15px; }
.admin-brand-sub { font-size: 11px; color: #8f89ab; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-sm); color: #b9b3d4; font-size: 14px;
}
.admin-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-nav a.active { background: var(--colorPrimary); color: #fff; }
.admin-side-foot { font-size: 12px; color: #6f6990; padding: 10px; }

.admin-main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.admin-topbar h1 { font-size: 19px; }
.admin-flash {
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px;
  margin-bottom: 16px; border: 1px solid;
}
.admin-flash.ok { background: var(--green-bg); color: var(--green); border-color: #bfe6d4; }
.admin-flash.err { background: var(--red-bg); color: var(--red); border-color: #f2c3cc; }
.admin-flash.secret { background: var(--colorPrimaryBg); border-color: var(--colorPrimaryBorder); }
.admin-flash code { font-family: Consolas, Menlo, monospace; font-weight: 700; word-break: break-all; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { padding: 16px 18px; }
.stat-label { font-size: 13px; color: var(--text2); }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--text3); }

.panel { padding: 18px 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-title { font-size: 15px; font-weight: 700; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filter-bar .input { width: auto; padding: 7px 10px; font-size: 13px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 8px 10px; color: var(--text3); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: #faf9fe; }
.table .mono { font-family: Consolas, Menlo, monospace; font-size: 12px; }
.table td a:hover { text-decoration: underline; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.b-created { background: var(--amber-bg); color: var(--amber); }
.badge.b-paid, .badge.b-sent, .badge.b-active, .badge.b-used, .badge.b-unused-ok { background: var(--green-bg); color: var(--green); }
.badge.b-closed, .badge.b-failed, .badge.b-void { background: var(--red-bg); color: var(--red); }
.badge.b-pending, .badge.b-disabled { background: #eeeaf7; color: var(--text2); }
.badge.b-sending { background: var(--colorPrimaryBg); color: var(--colorPrimary); }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--text2); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text2); }
.kv dd { margin: 0; word-break: break-all; }

.inline-form { display: inline; }

/* 项目编辑：双栏分组，压缩页面高度 */
.project-edit-panel { max-width: 1160px; margin: 0 auto 12px; padding: 16px 20px 14px; }
.project-edit-panel .field-label { margin: 10px 0 4px; }
.project-edit-panel .filter-bar { margin-bottom: 4px; }
.edit-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 44px; }
.edit-col { min-width: 0; }
.edit-sec {
  font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--text3);
  margin: 2px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border);
}
.edit-col .edit-sec:not(:first-child) { margin-top: 16px; }
.edit-col .filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .form-grid2 { grid-template-columns: 1fr; } }
@media (max-width: 1080px) {
  .edit-cols { grid-template-columns: 1fr; }
  .edit-col + .edit-col { margin-top: 22px; }
}

/* 项目编辑：捐助页配色方案选择 */
.scheme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.scheme-card {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; gap: 5px;
}
.scheme-card input { position: absolute; opacity: 0; pointer-events: none; }
.scheme-card:hover { border-color: var(--colorPrimary); }
.scheme-card.active { border-color: var(--colorPrimary); box-shadow: 0 0 0 3px var(--colorPrimaryBg); }
.scheme-swatch { display: block; height: 40px; border-radius: 6px; border: 1px solid rgba(28, 28, 40, .1); }
.scheme-name { font-size: 12px; color: var(--text2); }
.scheme-custom-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.scheme-custom-row input[type='color'] {
  width: 44px; height: 36px; padding: 2px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer;
}
.scheme-custom-row .input { max-width: 120px; }
.scheme-preview {
  margin-top: 8px; height: 48px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, #17132b 0%, #241d47 55%, #6a5ce6 145%);
}

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 360px; padding: 32px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }

@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .admin-side { width: auto; flex-direction: row; align-items: center; padding: 10px; }
  .admin-nav { flex-direction: row; overflow-x: auto; margin: 0 0 0 8px; }
  .admin-side-foot { display: none; }
  .admin-main { padding: 16px; }
  .kv { grid-template-columns: 110px 1fr; }
}
