:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f1f5f9;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b45309;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

h1, h2, h3, p {
  margin-top: 0;
}

a {
  color: inherit;
}

.pay-body,
.admin-body {
  min-height: 100vh;
}

.hero-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 20px 14px 40px;
}

.admin-shell {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 64px 20px;
}

.dashboard-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero-card,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px 18px;
}

.admin-card {
  padding: 24px;
}

.hero-card h1,
.admin-card h1,
.dashboard-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

.dashboard-head h1 {
  font-size: 24px;
}

.hero-copy,
.hint,
.inline-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.amount-panel {
  margin: 24px 0;
  padding: 20px;
  border-radius: 8px;
  background: var(--soft);
  display: grid;
  gap: 8px;
}

.amount-panel span {
  color: var(--muted);
  font-size: 14px;
}

.amount-panel strong {
  font-size: 40px;
  line-height: 1.1;
  font-weight: 800;
}

.primary-btn,
.ghost-btn {
  min-height: 44px;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

.primary-btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.small-btn {
  width: auto;
  min-height: 38px;
  padding: 9px 13px;
}

.hidden {
  display: none !important;
}

.input-stack,
.toggle-stack {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.input-stack span,
.toggle-stack span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.input-stack input,
.input-stack textarea,
.filter-bar input,
.filter-bar select {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.input-stack textarea {
  resize: vertical;
}

.toggle-stack {
  align-content: end;
}

.toggle-stack input {
  width: 22px;
  height: 22px;
}

.pay-shell {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.pay-shell-head,
.dashboard-head,
.result-actions,
.admin-nav,
.filter-bar,
.inline-note {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pay-shell-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.pay-shell-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

#checkout-frame {
  margin-top: 16px;
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.fallback-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #fff7ed;
  color: var(--danger);
}

.dashboard-head {
  margin-bottom: 18px;
}

.admin-nav a {
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.admin-nav a.active {
  color: var(--ink);
  background: white;
  border-color: var(--line);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.filter-bar {
  margin-bottom: 16px;
  justify-content: flex-start;
}

.filter-bar input,
.filter-bar select {
  width: auto;
  min-width: 150px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.detail-grid,
.payload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-grid div,
.payload-grid article {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
}

.detail-grid span {
  color: var(--muted);
  font-size: 13px;
}

.detail-grid strong {
  overflow-wrap: anywhere;
}

pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.result-card {
  text-align: center;
}

.result-status {
  margin: 20px auto;
  padding: 10px 14px;
  border-radius: 8px;
  width: fit-content;
  background: #ccfbf1;
  color: var(--accent-dark);
  font-weight: 800;
}

.site-footer {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

@media (min-width: 769px) {
  .hero-shell {
    padding-top: 56px;
  }

  .hero-card {
    padding: 30px;
  }
}

@media (max-width: 768px) {
  .dashboard-shell {
    width: calc(100% - 24px);
    padding: 18px 0 36px;
  }

  .admin-card {
    padding: 18px;
  }

  .grid-two,
  .detail-grid,
  .payload-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar button,
  .admin-nav,
  .admin-nav a,
  .admin-nav button,
  .result-actions,
  .result-actions a {
    width: 100%;
  }

  #checkout-frame {
    min-height: 480px;
  }
}
