:root {
  --bg: #0b0f14;
  --panel: #121922;
  --panel-2: #172130;
  --line: #223044;
  --text: #e6edf6;
  --muted: #8fa1b8;
  --ok: #2ecc8f;
  --bad: #ff6b6b;
  --accent: #4c8dff;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #16233a 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 16px; font-weight: 600; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 20, .97);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar strong { letter-spacing: .4px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }

label { display: block; margin: 14px 0; font-size: 13px; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px;
  background: #0d141d; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; outline: none;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

button {
  cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  background: #1b2635; color: var(--text); padding: 10px 16px; font-size: 14px;
}
button:hover { border-color: #33507a; }
button.primary {
  width: 100%; margin-top: 14px;
  background: linear-gradient(180deg, #5b9bff, #3d78e8);
  border-color: #3d78e8; color: #fff; font-weight: 600;
}
button.primary.compact { width: auto; margin-top: 0; padding: 10px 16px; white-space: nowrap; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.link { background: none; border: none; color: var(--muted); padding: 6px; }
button.link:hover { color: var(--text); }

button.mini { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
button.mini.danger { color: #ffb4b4; border-color: #4a2c2c; }
td.actions { white-space: nowrap; }
td.actions button + button { margin-left: 4px; }
#merchant-editor, #amount-editor { margin-top: 16px; }

.message { margin-top: 14px; font-size: 14px; min-height: 20px; }
.message.error { color: var(--bad); }
.message.ok { color: var(--ok); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #24344a; }
.badge.ok { background: rgba(46, 204, 143, .15); color: var(--ok); }
.badge.bad { background: rgba(255, 107, 107, .15); color: var(--bad); }

/* ================================================================== */
/* 收银台（浅色、简洁）                                                */
/* ================================================================== */

.checkout-page {
  background: linear-gradient(180deg, #f3f6fb 0%, #e9eef7 100%);
  color: #0f172a;
  min-height: 100vh;
}

.pay-wrap { display: flex; justify-content: center; padding: 7vh 18px 40px; }

.pay-card {
  width: 100%; max-width: 430px;
  background: #fff;
  border: 1px solid #e6ebf3;
  border-radius: 22px;
  padding: 30px 30px 24px;
  box-shadow: 0 24px 60px -30px rgba(15, 23, 42, .35);
}

.pay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.pay-logo { font-weight: 700; letter-spacing: .3px; font-size: 16px; }
.pay-badge {
  font-size: 12px; color: #2563eb; background: #eff4ff;
  padding: 4px 10px; border-radius: 999px;
}

.pay-to { color: #64748b; font-size: 13px; margin: 0 0 4px; }
.pay-card h1 { font-size: 22px; margin: 0 0 26px; letter-spacing: .2px; }

.amount-label { display: block; color: #64748b; font-size: 13px; margin-bottom: 8px; }
.amount-input {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid #dbe3ee; border-radius: 14px;
  padding: 10px 14px; transition: border-color .15s;
}
.amount-input:focus-within { border-color: #2563eb; }
.amount-currency { font-size: 26px; font-weight: 600; color: #0f172a; }
.amount-input input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 32px; font-weight: 700; color: #0f172a;
  padding: 6px 0; margin: 0; letter-spacing: -.5px;
}
.amount-input input::placeholder { color: #c3ccda; }
.amount-input input.invalid { color: #dc2626; }
.amount-unit { font-size: 13px; color: #94a3b8; }
.amount-hint { margin: 8px 0 22px; font-size: 12px; color: #94a3b8; }

.pay-btn {
  width: 100%; padding: 14px 18px;
  border: none; border-radius: 14px;
  background: #111827; color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .05s;
}
.pay-btn:hover { background: #1f2937; }
.pay-btn:active { transform: translateY(1px); }
.pay-btn:disabled { opacity: .55; cursor: progress; }
#pay { background: #2563eb; }
#pay:hover { background: #1d4ed8; }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 18px; color: #94a3b8; font-size: 12px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #eef2f7; }

.field-label { display: block; font-size: 12px; color: #64748b; margin: 0 0 6px; }
.field-box {
  min-height: 48px; padding: 0; overflow: hidden;
  border: none; border-radius: 12px; background: #fff;
}
.field-box iframe { width: 100% !important; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 20px; }
.field-row > div > .field-box { margin-top: 0; }

.pay-message { min-height: 20px; margin: 14px 0 0; font-size: 13px; color: #64748b; }
.pay-message.error { color: #dc2626; }

.pay-success { text-align: center; padding: 18px 0 8px; }
.pay-check {
  width: 54px; height: 54px; margin: 0 auto 16px;
  border-radius: 50%; background: #e8f7ef; color: #10b981;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.pay-success-title { margin: 0; color: #64748b; font-size: 14px; }
.pay-success-amount { margin: 8px 0 6px; font-size: 34px; font-weight: 700; letter-spacing: -.5px; }
.pay-success-id { margin: 0; color: #94a3b8; font-size: 12px; word-break: break-all; }

.pay-foot { margin: 26px 0 0; text-align: center; font-size: 11px; color: #b6c0ce; }

.auth-wrap { display: flex; justify-content: center; padding: 9vh 18px; }
.auth-card { width: 100%; max-width: 380px; }
.seed { display: block; padding: 10px 12px; background: #0d141d; border: 1px dashed var(--line); border-radius: 10px; word-break: break-all; font-size: 13px; }

.tabs { display: flex; gap: 4px; }
.tabs button { background: none; border: none; color: var(--muted); padding: 8px 14px; border-radius: 8px; }
.tabs button.active { background: #1b2635; color: var(--text); }

.content { padding: 24px; max-width: 1200px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { font-size: 26px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

.merchant-table { table-layout: fixed; }
.merchant-table th:nth-child(1) { width: 20%; }
.merchant-table th:nth-child(2) { width: 16%; }
.merchant-table th:nth-child(3) { width: 8%; }
.merchant-table th:nth-child(4) { width: 12%; }
.merchant-table th:nth-child(5) { width: 12%; }
.merchant-table td { vertical-align: top; }
.merchant-table td:nth-child(2) { overflow: hidden; }
.merchant-table td:nth-child(3) { white-space: nowrap; }
.merchant-table td:nth-child(4) { white-space: nowrap; }
.merchant-table .badge { white-space: nowrap; }
.merchant-table td.actions { white-space: normal; }
.merchant-table td.actions button { margin-bottom: 4px; }
.merchant-table td:first-child .mono { word-break: break-all; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.toolbar-title { margin: 0; font-size: 16px; flex: 1; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }
.toolbar input, .toolbar select { margin: 0; max-width: 260px; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

/* ================================================================== */
/* 后台布局                                                            */
/* ================================================================== */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px; height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  padding: 26px 18px 22px;
  border-right: 1px solid var(--line);
  background: rgba(13, 18, 26, .65);
}
.side-brand { font-size: 19px; font-weight: 700; letter-spacing: .3px; padding: 0 10px 28px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav button {
  text-align: left; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; padding: 11px 12px; border-radius: 10px;
}
.side-nav button:hover { color: var(--text); }
.side-nav button.active { background: #1b2635; color: var(--text); font-weight: 500; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 10px; }
.side-user { color: var(--muted); font-size: 13px; }

.main { flex: 1; min-width: 0; padding: 34px 40px 70px; max-width: 1160px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-sub { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.stat span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stat strong { font-size: 26px; font-weight: 650; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 24px; margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 500;
  padding: 10px 8px; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px 8px; border-bottom: 1px solid #1a2534; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.right { text-align: right; }
.cell-title { font-weight: 500; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.amount-cell { font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 36px 0 !important; }

.text-btn { background: none; border: none; cursor: pointer; color: #8fb4ff; font-size: 13px; padding: 4px 6px; }
.text-btn:hover { text-decoration: underline; }
.text-btn.danger { color: #ff8b8b; }

.btn {
  border: 1px solid var(--line); background: #1b2635; color: var(--text);
  border-radius: 10px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  width: auto; margin-top: 0;
}
button.btn { width: auto; margin-top: 0; }
.btn:hover { border-color: #33507a; }
.btn.primary { background: #2f6fed; border-color: #2f6fed; color: #fff; font-weight: 600; }
.btn.primary:hover { background: #3b7bf5; }
.btn.ghost { background: none; }
.btn.small { padding: 6px 12px; font-size: 13px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid.narrow { grid-template-columns: 1fr; max-width: 420px; }
.form-grid .span2 { grid-column: span 2; }
.editor { margin-top: 20px; }
.editor-actions { display: flex; gap: 10px; margin-top: 18px; }
.form-message { min-height: 18px; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.form-message.error { color: #ff6b6b; }
.form-message.ok { color: #2ecc8f; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.check input { width: auto; margin: 0; }
.sub-editor { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.pager-text { color: var(--muted); font-size: 13px; }

.auth-card {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px;
}
.auth-brand { font-size: 20px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 6px 0 24px; }
.auth-note { color: var(--muted); font-size: 13px; }
.auth-message { min-height: 18px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.auth-message.error { color: #ff6b6b; }
.auth-message.ok { color: #2ecc8f; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 24px 20px 60px; }
}

@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; gap: 14px; padding: 14px 16px; }
  .side-brand { padding: 0; }
  .side-nav { flex-direction: row; overflow-x: auto; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
}
