/* xpay 后台 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --nav: #172033; --nav-hover: #243149; --accent: #3b82f6; --page: #f4f6f9; }
html, body { min-height: 100%; }
body { font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #333; background: var(--page); }
a { color: #2563eb; text-decoration: none; }

.topnav { position: fixed; inset: 0 auto 0 0; width: 228px; background: var(--nav); color: #cbd5e1; display: flex; flex-direction: column; z-index: 10; }
.brand { height: 72px; padding: 0 22px; display: flex; align-items: center; gap: 11px; color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .2px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 8px; font-weight: 800; font-size: 18px; }
.nav-links { padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-links a { color: #aebbd0; padding: 10px 14px; border-radius: 6px; display: block; transition: background .15s, color .15s; }
.nav-links a:hover { background: var(--nav-hover); color: #fff; }
.nav-links a.cur { background: #2d6cdf; color: #fff; box-shadow: 0 3px 10px rgba(37,99,235,.25); }
.nav-foot { margin-top: auto; padding: 16px 26px 20px; color: #64748b; font-size: 12px; }

.container { width: calc(100% - 228px); min-height: 100vh; margin: 0 0 0 228px; padding: 30px 34px 44px; }
h2 { margin-bottom: 18px; font-size: 24px; color: #172033; }
h3 { margin: 16px 0 8px; }
.hint { color: #888; font-size: 12px; }
.notice { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.twofa-qr { text-align: center; margin: 12px 0; }
.twofa-qr svg { border: 1px solid #ddd; border-radius: 6px; background: #fff; }

.cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.cards .card { background: #fff; border-radius: 10px; padding: 16px 20px; min-width: 160px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card .num { font-size: 26px; font-weight: 700; color: #1e293b; }
.card .lbl { color: #888; font-size: 12px; }

.tbl-wrap { background: #fff; border-radius: 10px; overflow: auto; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.modal-box table { table-layout: fixed; }
.modal-box th, .modal-box td { white-space: normal; word-break: break-all; }
tr.log-row { cursor: pointer; }
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal-box { background: #fff; border-radius: 12px; padding: 18px 22px; width: min(860px, 96vw); box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.modal-box h3 { margin: 0 0 12px; }
.modal-box h4 { margin: 14px 0 6px; border-top: 1px solid #eef0f3; padding-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; border-bottom: 1px solid #eef0f3; text-align: left; white-space: nowrap; }
th { background: #f8fafc; color: #64748b; font-weight: 500; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; }
.b0 { background: #dbeafe; color: #1d4ed8; }
.b1 { background: #dcfce7; color: #15803d; }
.b2 { background: #e2e8f0; color: #64748b; }
.b3 { background: #fef3c7; color: #b45309; }
.b4 { background: #ede9fe; color: #6d28d9; }

/* 统计柱状图（纯 CSS） */
.stat-bars { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding: 8px 4px 0; overflow-x: auto; }
.stat-bar { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; cursor: default; }
.stat-bar-fill { width: 100%; border-radius: 2px 2px 0 0; background: #93c5fd; min-height: 1px; transition: height .3s; }
.stat-bar-fill.bar-green { background: #86efac; }
.stat-bar-fill.bar-blue { background: #93c5fd; }
.stat-bar-lbl { font-size: 10px; color: #94a3b8; text-align: center; transform: rotate(-60deg) translate(-6px, 4px); transform-origin: top center; white-space: nowrap; margin-top: 6px; }
.stat-hours .stat-bar-lbl { transform: none; margin-top: 4px; }
.stat-bars:empty::after { content: '暂无数据'; color: #94a3b8; font-size: 13px; }

/* Toast 通知 */
#xp-toast { position: fixed; top: 18px; right: 18px; z-index: 100; max-width: min(460px, 92vw);
  padding: 12px 18px; border-radius: 8px; font-size: 14px; color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); white-space: pre-wrap; word-break: break-all;
  animation: toast-in .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast-info { background: #2563eb; }
.toast-ok { background: #16a34a; }
.toast-error { background: #dc2626; }

.ipt { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; width: 100%; max-width: 340px; }
.btn { background: #2563eb; color: #fff; border: 0; border-radius: 6px; padding: 9px 20px; font-size: 14px; cursor: pointer; }
.btn:hover { background: #1d4ed8; }
.btn.warn { background: #dc2626; }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }

.form-box { background: #fff; border-radius: 10px; padding: 14px 18px; margin: 14px 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.form-box summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.frow { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.frow label { width: 120px; color: #555; flex-shrink: 0; }
/* 开关自身是 label，不能继承 frow 的 120px 定宽 */
.frow label.switch { width: 40px; flex-shrink: 0; }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 12px; transition: .2s; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .2s; }
.switch input:checked + span { background: #2563eb; }
.switch input:checked + span::after { left: 20px; }

/* 登录 */
.login-box { max-width: 360px; margin: 10vh auto; background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.login-box h2 { text-align: center; margin-bottom: 20px; }
.login-box .ipt { margin-bottom: 12px; }
.login-box .btn { width: 100%; }
.login-tip { font-size: 13px; color: #64748b; background: #f1f5f9; border-radius: 8px; padding: 8px 10px; margin-bottom: 14px; text-align: center; }
.login-sub { text-align: center; margin-top: 14px; font-size: 13px; }
/* Turnstile 弹窗 */
.install-banner { background: #ecfdf5; border: 1px solid #6ee7b7; color: #065f46; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; line-height: 1.7; }
.ts-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; z-index: 100; }
.ts-modal { background: #fff; border-radius: 14px; padding: 24px 22px 18px; max-width: 350px; width: calc(100% - 40px); box-shadow: 0 10px 40px rgba(0,0,0,.25); text-align: center; }
.ts-title { font-size: 15px; color: #334155; margin-bottom: 16px; }
.ts-cancel { margin-top: 14px; background: none; border: none; color: #94a3b8; font-size: 13px; cursor: pointer; }
.login-err { background: #fee2e2; color: #b91c1c; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }

/* 收银台 */
.cashier { max-width: 400px; margin: 5vh auto; background: #fff; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,.09); overflow: hidden; }
/* 金额卡片 */
.pay-amount-card { padding: 18px 16px 16px; border-bottom: 1px dashed #e5e7eb; }
.pay-amount-label { color: #64748b; font-size: 13px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.pay-amount-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.pay-amount-value { display: inline-flex; align-items: baseline; color: #0f9f4d; font-weight: 900; line-height: 1; }
.pay-currency { font-size: 34px; margin-right: 6px; }
.pay-number { font-size: 46px; letter-spacing: -0.02em; }
.pay-copy-btn { height: 32px; line-height: 30px; padding: 0 14px; border: 1px solid #16a34a; border-radius: 999px; color: #15803d; background: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.pay-copy-btn:hover { background: #f0fdf4; }
.pay-amount-tip { margin-top: 10px; color: #dc2626; font-size: 14px; font-weight: 700; text-align: center; }
.cashier .notice { margin: 10px 0 0; background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.7; text-align: center; }
/* 二维码区 */
.qrbox { display: flex; flex-direction: column; align-items: center; padding: 18px 0 6px; }
.qrbox .tip { color: #666; font-size: 13px; margin-top: 10px; }
/* 深色信息栏 */
.pay-info { margin-top: 14px; padding: 14px 16px; background: #32343d; color: #f2f2f2; text-align: center; font-size: 13px; line-height: 1.9; border-radius: 0 0 16px 16px; }
.pay-info .countdown { color: #fbbf24; font-weight: 700; font-size: 14px; }
.pay-state.waiting { color: #7dd3fc; }
.pay-state.expired { color: #f87171; font-weight: 700; }
.plain-shell .container { width: 100%; margin: 0 auto; }

@media (max-width: 700px) {
  .topnav { position: static; width: 100%; min-height: 0; }
  .brand { height: 58px; padding: 0 16px; }
  .nav-links { padding: 8px; flex-direction: row; overflow-x: auto; gap: 3px; }
  .nav-links a { white-space: nowrap; padding: 7px 11px; }
  .nav-foot { display: none; }
  .container { width: 100%; min-height: calc(100vh - 58px); margin: 0; padding: 22px 14px 32px; }
  h2 { font-size: 21px; }
  .frow { align-items: flex-start; flex-wrap: wrap; }
  .frow label { width: 100%; }
  .toolbar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .pay-amount-row { flex-direction: column; gap: 8px; }
  .pay-currency { font-size: 30px; }
  .pay-number { font-size: 42px; }
}

/* ---------- 首页伪装页 ---------- */
.home { max-width: 720px; padding: 80px 16px 60px; }
.home-hero { text-align: center; padding: 30px 0; }
.home-hero h1 { font-size: 24px; margin: 0 0 14px; }
.home-hero p { color: #555; line-height: 1.9; margin: 8px 0; }
.home-foot { text-align: center; color: #999; font-size: 13px; margin-top: 60px; }
