/* ================= 跨境收银台样式 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1677ff;
  --primary-dark: #0958d9;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #f59e0b;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- 收银台 ---------- */
.pay-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.pay-card { background: var(--card); width: 100%; max-width: 460px; border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.08); overflow: hidden; }
.pay-head { background: linear-gradient(135deg, #1677ff, #0958d9); color: #fff; padding: 22px 24px; }
.pay-head h1 { font-size: 20px; font-weight: 600; }
.pay-head .agent-name { font-size: 13px; opacity: .9; margin-top: 4px; }
.pay-body { padding: 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.field input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 22px; outline: none; transition: border-color .2s;
}
.field input:focus { border-color: var(--primary); }
.field input.small { font-size: 15px; }
.convert-box { background: #f0f7ff; border: 1px dashed #91caff; border-radius: 10px; padding: 14px 16px; text-align: center; margin-bottom: 18px; }
.convert-box .lbl { font-size: 13px; color: var(--muted); }
.convert-box .amount { font-size: 28px; font-weight: 700; color: var(--primary-dark); margin: 4px 0; }
.convert-box .rate { font-size: 12px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.btn {
  display: inline-block; width: 100%; padding: 13px; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer; background: var(--primary); color: #fff;
  transition: opacity .2s, background .2s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #f0f7ff; }

/* ---------- 支付结果 ---------- */
.result-card { text-align: center; }
.qr-box { display: inline-block; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 12px; margin: 12px 0; }
.qr-box img, .qr-box canvas { display: block; margin: 0 auto; }
.qr-img { width: 280px; height: 280px; max-width: 100%; image-rendering: auto; border-radius: 4px; cursor: zoom-in; }
.qr-tip { font-size: 15px; color: #374151; font-weight: 500; margin-top: 12px; line-height: 1.6; }
.qr-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.88); align-items: center; justify-content: center; padding: 20px; }
.qr-overlay-inner { background: #fff; border-radius: 16px; padding: 24px; text-align: center; max-width: 92vw; }
.qr-overlay-inner img { width: min(80vw, 460px); height: auto; display: block; margin: 0 auto; }
.qr-overlay-tip { font-size: 15px; color: #374151; margin: 14px 0; }
.qr-overlay-inner .btn { width: 160px; }
.status-pill { display: inline-block; padding: 6px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-paid { background: #dcfce7; color: #166534; }
.status-fail { background: #fee2e2; color: #991b1b; }
.spinner { width: 22px; height: 22px; border: 3px solid #e5e7eb; border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.step-tip { font-size: 14px; color: #374151; background: #f9fafb; border-radius: 8px; padding: 12px; text-align: left; margin-top: 14px; line-height: 1.7; }
.step-tip ol { margin-left: 18px; }
.step-tip li { margin: 4px 0; }

/* ---------- 后台 ---------- */
.admin-body { background: #f0f2f5; min-height: 100vh; }
.admin-header { background: #001529; color: #fff; height: 56px; display: flex; align-items: center; }
.admin-header .container { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.admin-logo { font-size: 18px; font-weight: 600; }
.admin-logo a { color: #fff; }
.admin-user { font-size: 14px; }
.admin-user a { color: #fff; opacity: .8; margin-left: 14px; }
.admin-layout { display: flex; max-width: 1280px; margin: 20px auto; gap: 20px; padding: 0 16px; align-items: flex-start; }
.sidebar { width: 200px; flex-shrink: 0; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.sidebar a { display: block; padding: 13px 20px; color: var(--text); font-size: 14px; border-left: 3px solid transparent; }
.sidebar a:hover { background: #f5f7fa; }
.sidebar a.active { border-left-color: var(--primary); background: #f0f7ff; color: var(--primary); font-weight: 600; }
.main-content { flex: 1; min-width: 0; }
.panel { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.panel h2 { font-size: 18px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-box { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.stat-box .label { font-size: 13px; color: var(--muted); }
.stat-box .value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-box.green .value { color: var(--success); }
.stat-box.blue .value { color: var(--primary); }
.stat-box.orange .value { color: var(--warn); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { background: #fafafa; font-weight: 600; color: #374151; }
.tbl tr:hover td { background: #fafcff; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #fef3c7; color: #92400e; }

/* 表单 */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-actions { display: flex; gap: 10px; }
.btn-sm { width: auto; padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filter-bar .form-group { margin: 0; }
.filter-bar input, .filter-bar select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }

/* 登录 */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 8px 30px rgba(0,0,0,.1); }
.login-card h2 { text-align: center; margin-bottom: 24px; font-size: 22px; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-err { background: #fee2e2; color: #991b1b; }
.alert-ok { background: #dcfce7; color: #166534; }
.alert-info { background: #f0f7ff; color: #1e40af; }
.text-muted { color: var(--muted); font-size: 13px; }
/* 支付宝风格收款码: 蓝边 + 中间"支"字 logo */
.qr-mini { position: relative; display: inline-block; width: auto; height: auto; background: #fff; border: 4px solid #1677ff; border-radius: 10px; padding: 6px; }
.qr-mini canvas, .qr-mini img { display: block; width: 88px !important; height: 88px !important; }
.ali-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #1677ff; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); pointer-events: none; }
.qr-mini .ali-logo { width: 24px; height: 24px; font-size: 15px; border-width: 2px; }
#modalQr { position: relative; padding: 10px; background: #fff; border: 6px solid #1677ff; border-radius: 14px; }
#modalQr .ali-logo { width: 58px; height: 58px; font-size: 38px; border-width: 4px; }
.ali-tip { display: inline-block; background: #ffd21e; color: #1a1a1a; font-size: 13px; font-weight: 600; padding: 5px 16px; border-radius: 14px; margin-top: 12px; }
.code-box { font-family: monospace; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 99; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; max-width: 420px; width: 90%; text-align: center; }
.pagination { margin-top: 16px; text-align: center; }
.pagination a, .pagination span { display: inline-block; padding: 5px 11px; margin: 0 2px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.pagination .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
