:root {
  --bg: #0b1120;
  --bg-card: #151f32;
  --bg-elevated: #1e2a42;
  --bg-hover: #243049;
  --border: rgba(148, 163, 184, 0.12);
  --text: #e8edf5;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.12);
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
  --sidebar-w: 200px;
  --topbar-h: 48px;
  --subnav-h: 40px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 13px;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: #60a5fa; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; }
.between { justify-content: space-between; align-items: center; }
.muted, .hint, .text-muted { color: var(--text-muted); font-size: .78rem; }
.small { font-size: .8rem; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: #fca5a5; }
code { background: var(--bg-elevated); padding: 2px 8px; border-radius: 6px; font-size: .85em; color: #93c5fd; }

/* Topbar */
.topbar {
  background: rgba(21, 31, 50, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
}
.topbar a { color: var(--text-muted); margin-left: 20px; font-weight: 500; }
.topbar a:hover { color: var(--text); }
.topbar-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; }
.topbar-nav a { margin-left: 16px; white-space: nowrap; }
.logo {
  font-weight: 700; font-size: 1.2rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Page structure */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.page-header h1, .page-header h2, .user-main > h2, .admin-main-inner > h2, .app-main > h2 {
  font-size: 1.15rem; font-weight: 700; margin: 0;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Hero */
.hero {
  background: var(--gradient);
  border-radius: var(--radius);
  padding: 56px 40px;
  margin: 32px 0;
  text-align: center;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 2rem; font-weight: 700; margin-bottom: 12px; color: #fff; -webkit-text-fill-color: #fff; }
.hero p { opacity: .92; font-size: 1.05rem; color: #fff; }
.hero-actions { margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Cards */
.panel, .section-card, .auth-box, .stat-card, .content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.section-card { margin-bottom: 12px; }
.section-card h3 {
  margin-bottom: 10px; font-size: .75rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.content-card { margin-bottom: 12px; }
.content-card h3 { margin: 0 0 8px; font-size: .88rem; color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 6px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: .8125rem;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); transform: translateY(-1px); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.25); color: #fff; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 4px 10px; font-size: .75rem; }
.btn-group { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Forms */
.form label {
  display: block; margin: 8px 0 4px; font-size: .78rem;
  font-weight: 500; color: var(--text-muted);
}
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.form select,
.form textarea {
  width: 100%; padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: .84rem; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):focus,
.form select:focus,
.form textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-stacked { max-width: 520px; }
.form.inline {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px;
}
.form.inline input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.form.inline select { width: auto; min-width: 160px; flex: 0 1 auto; }

/* 紧凑筛选条：横向排列、短输入框（需覆盖 .form input{width:100%}） */
.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 10px;
  max-width: none !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}
.filter-bar input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.filter-bar select {
  width: auto !important;
  min-width: 0 !important;
  max-width: none;
  flex: 0 0 auto;
  padding: 5px 8px;
  font-size: .78rem;
  box-sizing: border-box;
}
.filter-bar .filter-osn { width: 120px !important; }
.filter-bar .filter-account { width: 100px !important; }
.filter-bar .filter-status { width: 96px !important; }
.filter-bar select[name="uid"] { width: 168px !important; }
.filter-bar .filter-date { width: 132px !important; }
.filter-bar .filter-date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}
.filter-bar .filter-sep {
  color: var(--text-muted);
  font-size: .84rem;
  flex-shrink: 0;
  white-space: nowrap;
}
.filter-bar .btn { flex-shrink: 0; margin-left: auto; }

/* 订单列表页：紧凑模式（参考传统后台，筛选区占屏少、表格显示更多行） */
.order-page-compact .page-header { margin-bottom: 8px; }
.order-page-compact .page-header h1 { font-size: 1.05rem; margin: 0; }
.order-page-compact .order-toolbar.panel {
  padding: 8px 10px 6px;
  margin-bottom: 6px;
}
.order-page-compact .order-toolbar .tab-links {
  margin: 0 0 6px;
  padding: 0;
  border: none;
  gap: 4px;
}
.order-page-compact .order-toolbar .tab-links a {
  padding: 3px 10px;
  font-size: .75rem;
  border-radius: 4px;
}
.order-page-compact .order-filter-form {
  margin: 0;
}
.order-page-compact .order-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.order-page-compact .order-filter-row:last-child { margin-bottom: 0; }
.order-page-compact .order-filter-row input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.order-page-compact .order-filter-row select {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: 0 1 auto;
  padding: 4px 8px;
  font-size: .75rem;
  line-height: 1.3;
  height: 28px;
  box-sizing: border-box;
}
.order-page-compact .order-filter-row .filter-select { width: 108px !important; }
.order-page-compact .order-filter-row .filter-account { width: 96px !important; }
.order-page-compact .order-filter-row .filter-osn { width: 124px !important; }
.order-page-compact .order-filter-row .filter-date { width: 118px !important; }
.order-page-compact .order-filter-row .filter-sep {
  color: var(--text-muted);
  font-size: .75rem;
  flex-shrink: 0;
}
.order-page-compact .order-filter-row .order-filter-btns {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.order-page-compact .order-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: 6px;
  padding: 5px 8px;
  background: color-mix(in srgb, var(--primary) 6%, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  color: var(--text-muted);
}
.order-page-compact .order-meta-bar .order-meta-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.order-page-compact .order-meta-bar .order-meta-stats strong {
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
}
.order-page-compact .order-meta-bar .order-meta-pager a { margin: 0 4px; }
.order-page-compact .table-wrap { margin-bottom: 6px; }
.order-page-compact .table-compact th,
.order-page-compact .table-compact td {
  padding: 4px 6px;
  font-size: .75rem;
  line-height: 1.35;
  vertical-align: middle;
}
.order-page-compact .table-compact th {
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.order-page-compact .table-compact code {
  font-size: .72rem;
  padding: 1px 4px;
}
.order-page-compact .table-compact .actions {
  font-size: .72rem;
  white-space: nowrap;
}
.order-page-compact .table-compact .actions .link-btn {
  font-size: .72rem;
}
.order-page-compact .btn-sm {
  padding: 4px 10px;
  font-size: .75rem;
  min-height: 28px;
  line-height: 1.2;
}

/* 订单列表页：分区排版（非 compact 时备用） */
.order-list-section { margin-bottom: 20px; }
.order-list-section .stats-grid { margin-bottom: 0; }
.order-stats-note {
  margin: 12px 0 0;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  border-radius: var(--radius-sm);
  font-size: .82rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.order-toolbar.panel {
  padding: 16px 18px 14px;
  margin-bottom: 16px;
}
.order-toolbar .tab-links {
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.order-filter-form {
  max-width: none !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}
.order-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
}
.order-filter-field label {
  display: block;
  margin-bottom: 6px;
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.order-filter-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.order-filter-field select {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: .84rem;
}
.order-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.order-filter-date { min-width: min(100%, 320px); flex: 1 1 280px; }
.order-filter-date .filter-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.order-filter-date .filter-date-range input[type="date"] {
  flex: 1;
  min-width: 0;
  width: auto !important;
}
.order-filter-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.order-filter-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  line-height: 1.55;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .order-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .order-filter-grid { grid-template-columns: 1fr; }
  .order-filter-actions { flex-direction: column; align-items: stretch; }
  .order-filter-btns { margin-left: 0; width: 100%; }
  .order-filter-btns .btn { flex: 1 1 auto; justify-content: center; }
}

/* 管理后台表单：限制输入框宽度 */
.admin-shell .form:not(.filter-bar) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.admin-shell .form:not(.filter-bar) select,
.admin-shell .form:not(.filter-bar) textarea {
  max-width: 420px;
}
.admin-shell .form:not(.filter-bar) textarea { max-width: 640px; }
.admin-shell .inline-form input { max-width: none; }
.channel-toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin: 12px 0; }
.channel-toggle-item { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.form-compact .input-md { max-width: 240px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }

.user-main > form.form.filter-bar,
.app-main > form.form.filter-bar {
  background: transparent;
  border: none;
  padding: 0;
  max-width: none;
}

.form-actions { margin-top: 14px; display: flex; gap: 8px; }
.form.grid-2 {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px;
}
.form.grid-2 .full { grid-column: 1 / -1; }
.input-group {
  display: flex; gap: 10px; align-items: center;
}
.input-group input { flex: 1; }
.input-group img {
  height: 40px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: #fff;
}

/* Checkbox & Radio（全局：管理后台 + 商户中心） */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--text-muted) 55%, var(--border));
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
  transition: background .15s, border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover:not(:disabled),
input[type="radio"]:hover:not(:disabled) {
  border-color: var(--primary);
}
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  opacity: .45;
  cursor: not-allowed;
}

label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  line-height: 1.45;
  font-weight: 500;
  color: var(--text);
  margin: 6px 0;
}
.form label:has(> input[type="checkbox"]),
.form label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  margin: 8px 0;
  color: var(--text);
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 12px 0; }
.checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
  line-height: 1.45;
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin: 6px 20px 6px 0;
  line-height: 1.45;
  font-weight: 500;
  color: var(--text);
}
.checkbox-inline input[type="checkbox"],
.checkbox-inline input[type="radio"] {
  margin: 0;
}

.table th:has(input[type="checkbox"]),
.table td:has(input[type="checkbox"]),
.table th:has(input[type="radio"]),
.table td:has(input[type="radio"]) {
  text-align: center;
  vertical-align: middle;
  width: 52px;
}
.table input[type="checkbox"],
.table input[type="radio"] {
  display: inline-block;
  margin: 0 auto;
}

.checkbox-group-list { flex-direction: column; flex-wrap: nowrap; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; max-width: 720px; }
.checkbox-group-list .permission-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  line-height: 1.45;
}
.checkbox-group-list .permission-row input[type="checkbox"],
.checkbox-group-list .permission-row input[type="radio"] {
  margin: 0;
}
.checkbox-group-list .permission-row:last-child { border-bottom: 0; }
.checkbox-group-list .permission-row:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.checkbox-group-list .permission-name { flex: 0 0 auto; min-width: 120px; font-weight: 500; }
.checkbox-group-list .permission-route { flex: 1; text-align: right; font-family: ui-monospace, monospace; font-size: .8rem; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; background: var(--bg-card); }
.table th {
  text-align: left; padding: 7px 10px; color: var(--text-muted);
  font-weight: 600; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated); white-space: nowrap; font-size: .78rem;
}
.table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: .8125rem; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.table .actions { white-space: nowrap; }
.table .actions a { font-size: .78rem; color: var(--primary); }
.table .actions .inline-form { display: inline; margin: 0; padding: 0; }
.table .actions .btn-link,
.table .actions button.btn-link {
  display: inline; background: none !important; border: none !important; box-shadow: none !important;
  padding: 0; margin: 0; font: inherit; font-size: .78rem; color: #f87171; cursor: pointer;
  transform: none; vertical-align: baseline;
}
.table .actions .btn-link:hover,
.table .actions button.btn-link:hover {
  color: #fca5a5; text-decoration: underline; background: none !important; transform: none;
}

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: .72rem; font-weight: 600; background: var(--bg-elevated);
}
.badge-success { background: rgba(16,185,129,.18); color: #34d399; }
.badge-warn { background: rgba(245,158,11,.18); color: #fbbf24; }
.badge-danger { background: rgba(239,68,68,.18); color: #fca5a5; }
.badge-muted { background: rgba(148,163,184,.12); color: var(--text-muted); }

/* Alerts */
.alert {
  padding: 8px 12px; border-radius: var(--radius-sm);
  margin-bottom: 10px; font-size: .8125rem;
}
.alert-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.25); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.12); border: 1px solid rgba(16,185,129,.25); color: #6ee7b7; }
.alert-info { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.25); color: #93c5fd; }
.pay-abandon-form { margin-top: 12px; text-align: center; }
.pay-abandon-btn { background: none; border: none; color: var(--muted, #94a3b8); cursor: pointer; font-size: 14px; padding: 4px 8px; text-decoration: underline; }
.pay-abandon-btn:hover { color: #f87171; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin: 12px 0;
}
.stat-card { text-align: center; padding: 12px 10px; }
.stat-card strong {
  display: block; font-size: 1.25rem; font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-card span { font-size: .72rem; color: var(--text-muted); margin-top: 2px; display: block; }
.stats-compact .stat-card strong { font-size: 1.05rem; }

/* Auth pages */
.layout-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #1e3a5f 0%, var(--bg) 60%);
  padding: 16px;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { margin-bottom: 16px; text-align: center; font-size: 1.2rem; }
.auth-brand {
  text-align: center; margin-bottom: 24px; font-size: 1.5rem; font-weight: 700;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.oauth-links { margin-top: 16px; display: flex; gap: 16px; justify-content: center; }
.auth-links { margin-top: 18px; font-size: .875rem; }
.auth-links-sep { margin: 0 6px; color: var(--text-muted); opacity: .6; }
.layout-auth .form .form-actions { margin-top: 8px; }
.layout-auth .input-group img { height: 42px; cursor: pointer; border-radius: var(--radius-sm); }

/* ========== App Shell（后台 / 商户中心通用） ========== */
.app-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}

.app-topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 12px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 300;
}
.app-topbar-left, .app-topbar-right {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.app-topbar-brand {
  font-weight: 700; font-size: .95rem; color: #93c5fd;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-topbar-brand:hover { color: #bfdbfe; }
.user-chip {
  font-size: .8rem; color: #93c5fd; background: var(--primary-soft);
  padding: 4px 10px; border-radius: 999px; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-link { font-size: .8125rem; color: var(--text-muted); }
.topbar-link:hover { color: var(--text); }
.topbar-link.danger { color: #fca5a5; }
.topbar-msg {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.topbar-msg:hover { background: rgba(255,255,255,.05); }
.topbar-msg-icon { font-size: 1rem; line-height: 1; }
.nav-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
}
.nav-unread-badge.is-hidden { display: none; }
.nav-unread-badge--tab { margin-left: 6px; vertical-align: middle; }
.nav-unread-badge--sidebar { margin-left: auto; flex-shrink: 0; }
.sidebar-nav-item.has-unread .nav-label { font-weight: 600; }
.app-subnav-tab.has-unread { font-weight: 600; }
.msg-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  color: var(--text);
  font-size: .875rem;
  animation: msgToastIn .25s ease;
}
.msg-toast a { color: var(--primary); font-weight: 600; }
@keyframes msgToastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; padding: 0 10px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; flex-shrink: 0;
}
.sidebar-toggle span {
  display: block; height: 2px; background: var(--text);
  border-radius: 1px; transition: transform .2s;
}

.app-frame {
  flex: 1; display: flex; min-height: 0;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
}

.app-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--gradient); color: #fff; font-weight: 800; font-size: .72rem;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-text { font-weight: 700; font-size: .92rem; }
.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 0; -webkit-overflow-scrolling: touch;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; margin: 1px 6px;
  color: var(--text-muted); font-size: .8125rem; font-weight: 500;
  border-radius: var(--radius-sm); border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar-nav-item:hover {
  color: var(--text); background: rgba(255,255,255,.04);
}
.sidebar-nav-item.active {
  color: #e2e8f0; background: var(--primary-soft);
  border-left-color: var(--primary);
}
.sidebar-nav-item.danger { color: #fca5a5; }
.sidebar-nav-item.danger:hover { background: rgba(239,68,68,.1); color: #fecaca; }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; font-size: 1rem; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer {
  border-top: 1px solid var(--border); padding: 8px 0; flex-shrink: 0;
}

.app-content {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}

.app-subnav {
  flex-shrink: 0; display: flex; align-items: stretch;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  min-height: var(--subnav-h);
}
.app-subnav-label {
  display: flex; align-items: center; padding: 0 12px;
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-right: 1px solid var(--border); white-space: nowrap;
  background: rgba(0,0,0,.15);
}
.app-subnav-scroll {
  flex: 1; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.app-subnav-tabs {
  display: flex; align-items: stretch; gap: 0; min-width: min-content; height: 100%;
}
.app-subnav-tab {
  display: inline-flex; align-items: center;
  padding: 0 14px; font-size: .78rem; font-weight: 500;
  color: var(--text-muted); white-space: nowrap;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.app-subnav-tab:hover { color: var(--text); background: rgba(255,255,255,.03); }
.app-subnav-tab.active {
  color: #93c5fd; border-bottom-color: var(--primary); background: var(--primary-soft);
}

.app-main {
  flex: 1; overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 16px 20px; max-width: 100%;
}
.app-main > .form:not(.inline),
.app-main > form.form:not(.inline) {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; max-width: 640px;
}
.app-main > .table-wrap,
.app-main > .table:not(.table-wrap .table) {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 250;
  backdrop-filter: blur(2px);
}

/* Legacy user sidebar（兼容旧类名） */
.layout-user { background: var(--bg); }
.user-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg-card);
  border-right: 1px solid var(--border); padding: 20px 0; flex-shrink: 0;
}
.sidebar a {
  display: block; padding: 10px 20px; color: var(--text-muted); font-weight: 500;
  font-size: .875rem; border-left: 3px solid transparent;
}
.sidebar a:hover, .sidebar a.active {
  color: var(--text); background: var(--primary-soft); border-left-color: var(--primary);
}
.sidebar .nav-group {
  padding: 16px 20px 4px; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); opacity: .7; font-weight: 600;
}
.sidebar .nav-out { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 12px; color: #fca5a5; }
.user-main { flex: 1; overflow: auto; min-width: 0; background: var(--bg); }

/* Tabs */
.tab-links { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 10px; flex-wrap: wrap; }
.tab-links a {
  padding: 5px 12px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border); font-size: .78rem;
}
.tab-links a.active, .tab-links a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* Pay layout (base — themed overrides below) */
.pay-header { margin-bottom: 32px; }
.pay-header h1 { font-size: 1.6rem; margin-bottom: 8px; }
.pay-form {
  max-width: 480px; margin: 0 auto;
  border-radius: var(--radius); padding: 32px;
}
.layout-pay .pay-wizard .pay-form,
.layout-pay .pay-panel { max-width: none; margin: 0; width: 100%; padding: 0; border: 0; background: transparent; }
.pay-methods { display: flex; flex-direction: column; gap: 10px; }
.pay-method {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.pay-method:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.pay-order {
  max-width: 440px; margin: 0 auto; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 32px;
}
.pay-order .amount { font-size: 2.2rem; font-weight: 700; color: #f472b6; margin: 16px 0; }
.result-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; margin: 0 auto 20px;
}
.result-icon.success { background: rgba(16,185,129,.2); color: var(--success); }
.result-icon.pending { background: rgba(245,158,11,.2); color: var(--warn); }
.qrcode-box { display: inline-block; padding: 16px; background: #fff; border-radius: var(--radius); margin: 20px 0; position: relative; }
.qrcode-box,
.qrcode-box #qrcode,
.qrcode-box #qrcode img,
.qrcode-box #qrcode canvas {
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.qrcode-box #qrcode a { pointer-events: none; text-decoration: none; color: inherit; cursor: default; }
.qrcode-box.is-expired #qrcode img,
.qrcode-box.is-expired #qrcode canvas { filter: blur(10px); opacity: 0.25; pointer-events: none; }
.qrcode-expired-mask {
    position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, 0.45); border-radius: var(--radius); color: #fff;
    font-weight: 700; font-size: 1.1rem; letter-spacing: 0.05em;
}
.qrcode-box.is-expired .qrcode-expired-mask {
    display: flex;
}
.order-summary { text-align: left; background: var(--bg); padding: 20px; border-radius: var(--radius-sm); margin-bottom: 24px; }

/* Plugin grid */
.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.plugin-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; text-align: center;
  transition: border-color .15s;
}
.plugin-card:hover { border-color: var(--primary); }
.plugin-card h4 { margin-bottom: 6px; font-size: .95rem; }

/* Admin legacy aliases */
.admin-shell { /* extends .app-shell */ }
.admin-main-inner { padding: 0; max-width: none; }
.layout-admin { background: var(--bg); }
.admin-page, .admin-info { padding: 0; max-width: none; }

.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: 4px; font-weight: 400; }
.page-header h1 {
  font-size: 1.15rem; font-weight: 700; margin: 0;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.panel-title {
  font-size: .88rem; font-weight: 600; margin: 0 0 10px; color: var(--text);
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.layout-form-page { align-items: start; }
.copy-block { margin-bottom: 10px; }
.copy-block label { display: block; font-size: .72rem; color: var(--text-muted); margin-bottom: 4px; }
.copy-line {
  display: block; padding: 8px 10px; background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border); word-break: break-all; font-size: .8rem; line-height: 1.5;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.dashboard-panels { margin-top: 6px; }
.dashboard-panels .panel-wide { grid-column: 1 / -1; }
.section-title { margin: 12px 0 8px; font-size: .92rem; font-weight: 600; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 8px; }
.panel-head h3 { margin: 0; }
.table-compact th, .table-compact td { padding: 5px 8px; font-size: .75rem; }
.table-total th, .table-total td { font-weight: 600; border-top: 1px solid var(--border); background: rgba(255,255,255,.02); }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.quick-card {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); transition: all .15s;
}
.quick-card:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.quick-card span { font-size: 1.05rem; }
.info-list { list-style: none; }
.info-list li {
  padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: .8125rem;
}
.info-list li:last-child { border-bottom: none; }
.stat-card-accent { border-color: rgba(59, 130, 246, 0.35); }
.stat-card-warn { border-color: rgba(245, 158, 11, 0.35); }

.quick-links { list-style: none; display: grid; gap: 6px; }
.quick-links a {
  display: block; padding: 9px 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.quick-links a:hover { border-color: var(--primary); background: var(--primary-soft); }

.auth-title { text-align: center; margin-bottom: 14px; font-size: 1.1rem; }
.auth-tabs {
  display: flex; gap: 6px; margin-bottom: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px;
}
.auth-tab {
  flex: 1; border: 0; background: transparent; color: var(--text-muted);
  padding: 10px 12px; border-radius: calc(var(--radius-sm) - 2px); cursor: pointer; font-size: .9375rem;
}
.auth-tab.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.verify-panel.is-hidden { display: none; }
.form-msg {
  margin-bottom: 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: .875rem; line-height: 1.5; border: 1px solid transparent;
}
.form-msg.is-success { background: rgba(22,163,74,.12); border-color: rgba(22,163,74,.25); color: #166534; }
.form-msg.is-error { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); color: #b91c1c; }
.layout-auth .form-msg.is-success { color: #86efac; background: rgba(22,163,74,.15); border-color: rgba(134,239,172,.25); }
.layout-auth .form-msg.is-error { color: #fca5a5; background: rgba(239,68,68,.12); border-color: rgba(252,165,165,.25); }

/* Legacy aliases */
.layout-admin { background: var(--bg); }
.admin-page { padding: 0; max-width: none; }
.admin-info { padding: 0; }

/* User shell legacy */
.user-main-header { display: none; }
.user-main-body { min-height: 0; }
.user-main > .page-header:first-child { margin-top: 0; }
.user-main > .form:not(.inline),
.user-main > form.form:not(.inline) {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; max-width: 680px;
}
.user-main > .table-wrap { border-radius: var(--radius); }

.gap { gap: 10px; }
.flex.gap { display: flex; align-items: center; }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  .sidebar-toggle { display: flex; }
  .app-sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 280;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .app-subnav-label { display: none; }
  .app-main { padding: 10px 12px 16px; }
  .user-chip { max-width: 80px; }
}

@media (max-width: 900px) {
  .form.grid-2, .grid-2, .layout-form-page { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form.inline { flex-direction: column; align-items: stretch; }
  .form.inline input, .form.inline select { width: 100%; min-width: 0; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .btn { margin-left: 0; }
  .filter-bar .filter-osn { width: 108px !important; }
  .filter-bar .filter-account { width: 92px !important; }
  .filter-bar .filter-status { width: 88px !important; }
  .filter-bar .filter-date { width: 118px !important; }
  .table-wrap { margin: 0 -4px; border-radius: var(--radius-sm); }
  .table th, .table td { padding: 10px 12px; font-size: .8125rem; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-toolbar { width: 100%; }
  .page-toolbar .btn { flex: 1; }
}

@media (max-width: 480px) {
  .app-topbar-brand { font-size: .85rem; max-width: 140px; }
  .stats-grid { grid-template-columns: 1fr; }
  .hero { padding: 32px 16px; }
  .hero h1 { font-size: 1.35rem; }
  .app-subnav-tab { padding: 0 14px; font-size: .78rem; }
  .panel, .section-card { padding: 12px; }
  .auth-box { padding: 20px; }
  .topbar .container.flex { flex-wrap: wrap; gap: 8px; }
  .topbar-nav a { margin-left: 12px; font-size: .8125rem; }
  .container { padding: 0 16px; }
}

/* News */
.news-list { list-style: none; }
.news-list li {
  padding: 14px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.news-list li:last-child { border-bottom: none; }
.row-unread td { font-weight: 600; }
.msg-body { line-height: 1.7; margin-top: 12px; }

/* Pagination */
.pagination { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: .8125rem;
}
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }

.footer {
  padding: 32px 0; text-align: center; color: var(--text-muted);
  font-size: .8125rem; border-top: 1px solid var(--border); margin-top: 48px;
}
main.container { padding-bottom: 48px; min-height: calc(100vh - 180px); }

/* ========== Pay page theming ========== */
.layout-pay {
  color: var(--pay-text, var(--text));
  min-height: 100vh;
  padding: clamp(8px, 2vw, 24px) 0 clamp(16px, 3vw, 48px);
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
}
.layout-pay .pay-container-wide {
  max-width: min(980px, 100%);
  width: 100%;
  padding-left: clamp(8px, 2.5vw, 24px);
  padding-right: clamp(8px, 2.5vw, 24px);
  box-sizing: border-box;
}
.layout-pay .pay-header { margin-bottom: 24px; }
.layout-pay .pay-header h1 { font-size: clamp(1.5rem, 4vw, 2rem); margin-bottom: 8px; }
.pay-badge { font-size: .75rem; letter-spacing: .12em; color: var(--pay-accent, #fbbf24); margin: 0 0 8px; opacity: .95; }
.pay-shell { position: relative; z-index: 1; }
.layout-pay .pay-header h1 {
  color: var(--pay-header-color, var(--pay-text, var(--text)));
  background: linear-gradient(135deg, var(--pay-primary, var(--primary)), var(--pay-accent, var(--primary)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.layout-pay .pay-notice { color: var(--pay-notice-color, var(--pay-text-muted, var(--text-muted))); }
.layout-pay .pay-wizard .pay-form {
  background: transparent;
  border: 0;
  padding: 0;
}
.layout-pay .pay-method:has(input:checked) {
  border-color: var(--pay-primary, var(--primary));
  background: color-mix(in srgb, var(--pay-primary, var(--primary)) 12%, transparent);
}
.layout-pay .btn-primary,
.layout-pay .pay-submit {
  background: linear-gradient(135deg, var(--pay-primary, var(--primary)), var(--pay-accent, var(--primary)));
  border: none;
}
.layout-pay .btn-primary:hover { filter: brightness(1.08); }
.layout-pay input:focus,
.layout-pay select:focus,
.layout-pay textarea:focus {
  border-color: var(--pay-primary, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pay-primary, var(--primary)) 18%, transparent);
}
.pay-logo { margin-bottom: 12px; }
.pay-logo img { max-height: 72px; max-width: 220px; object-fit: contain; }
.pay-header-left { text-align: left; }
.pay-header-center { text-align: center; }
.pay-header-right { text-align: right; }
.pay-contact-bar {
  display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center;
  margin-top: 12px; font-size: .85rem; color: var(--pay-text-muted, var(--text-muted));
}
.pay-header-left + .pay-contact-bar,
.pay-header-left ~ .pay-contact-bar { justify-content: flex-start; }
.pay-header-right + .pay-contact-bar,
.pay-header-right ~ .pay-contact-bar { justify-content: flex-end; }
.pay-layout-wide .pay-form { max-width: 640px; }
.pay-layout-card .pay-form { box-shadow: var(--shadow); }
.pay-layout-banner .pay-header {
  padding: clamp(14px, 3vw, 28px) clamp(12px, 3vw, 24px);
  margin: 0 0 clamp(16px, 3vw, 32px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--pay-primary) 35%, transparent), color-mix(in srgb, var(--pay-accent) 25%, transparent));
  border-bottom: 1px solid color-mix(in srgb, var(--pay-primary) 20%, transparent);
  border-radius: var(--radius-sm);
}
.pay-card-glass .pay-form {
  backdrop-filter: blur(16px);
  background: var(--pay-card-bg, rgba(21,31,50,.75)) !important;
}
.pay-card-flat .pay-form { box-shadow: none; border-radius: 4px; }
.pay-font-small { font-size: 13px; }
.pay-font-large { font-size: 15px; }
.pay-font-large .pay-header h1 { font-size: 1.85rem; }
.pay-theme-light { --pay-text: #0f172a; --pay-text-muted: #64748b; }
.pay-theme-light .pay-form { color: #0f172a; }
.pay-theme-light .pay-header h1 {
  -webkit-text-fill-color: initial;
  color: var(--pay-header-color, var(--pay-primary));
  background: none;
}

/* ========== Shop settings (merchant) ========== */
.shop-tabs { margin-bottom: 20px; }
.shop-panel { padding: 24px; }
.form-section { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: 0; padding-bottom: 0; margin-bottom: 20px; }
.form-section h3 { font-size: 1rem; margin-bottom: 14px; color: var(--text); }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }

/* ========== Admin site config ========== */
.app-main:has(.config-form) {
  padding: 16px 24px 28px;
}
.app-main > form.config-form {
  max-width: none;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.config-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 12px;
  width: 100%;
  align-items: stretch;
}
.config-pair-row {
  display: contents;
}
.config-section {
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  box-sizing: border-box;
}
.config-section h3 {
  margin: 0 0 10px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.config-section-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px 16px;
  width: 100%;
  align-items: start;
}
.config-section .field {
  min-width: 0;
}
.config-section .field label {
  display: block;
  margin: 0 0 5px;
  font-size: .78rem;
}
.config-section .field input,
.config-section .field select,
.config-section .field textarea {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.config-section .field .hint {
  margin: 8px 0 0;
  font-size: .8rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.config-section .field.full {
  grid-column: 1 / -1;
}
.config-link-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
}
.config-link-list a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: .88rem;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.config-link-list a:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.config-form-actions {
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  box-sizing: border-box;
}
.config-form-links { display: none; }

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.detail-list dt { margin: 0; color: var(--text-muted); font-size: .84rem; }
.detail-list dd { margin: 0; word-break: break-word; }

.config-section-wide {
  grid-column: 1 / -1;
}
.config-test-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.config-test-row input {
  flex: 1 1 220px;
  max-width: 360px;
}
.config-test-panel .form-msg { margin-top: 12px; }
.template-block {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.template-block:first-of-type { border-top: 0; padding-top: 0; }
.template-block h4 {
  margin: 0 0 14px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.template-block-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px 24px;
}
textarea.code-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.55;
  min-height: 120px;
  resize: vertical;
}
.oauth-callback {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  word-break: break-all;
}
.template-partition-vars {
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.template-partition-vars-title { margin: 0 0 8px; font-size: .95rem; }
.template-partition-vars-body .field { margin-bottom: 12px; }
.template-custom-vars-editor .table input,
.template-custom-vars-editor .table select { width: 100%; min-width: 0; }
.template-var-help { margin: 0; padding: 14px 16px; }
.template-var-help-title { margin: 0 0 10px; font-size: .95rem; }
.template-var-table { margin: 12px 0; }
.template-var-table code { font-size: .85rem; }
.template-var-example { margin-top: 14px; }
.template-var-code {
    margin: 8px 0 0;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .8rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-muted);
}

@media (max-width: 900px) {
  .config-sections-grid {
    grid-template-columns: 1fr;
  }
  .config-section-body {
    grid-template-columns: 1fr;
  }
}
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.preset-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s;
}
.preset-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.preset-card input { display: none; }
.preset-swatch {
  width: 100%; height: 36px; border-radius: 6px;
  background: linear-gradient(135deg, var(--sw-primary), var(--sw-accent));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.preset-label { font-size: .78rem; text-align: center; color: var(--text-muted); }
.color-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 12px; }
.color-grid input[type=color] { width: 100%; height: 40px; padding: 4px; cursor: pointer; }
.shop-design-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.shop-preview-mini { padding: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.shop-preview-mini h3 { font-size: .9rem; margin-bottom: 12px; color: var(--text-muted); }
.shop-preview-frame { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.shop-preview-pay { padding: 20px 16px; min-height: 320px; background: #0b1120; }
.shop-preview-pay .pay-header h1 { font-size: 1.1rem; margin-bottom: 6px; color: #fff; background: none; -webkit-text-fill-color: initial; }
.shop-preview-form { margin-top: 16px; padding: 16px; border-radius: 10px; border: 1px solid rgba(255,255,255,.08); }
.preview-fake-input { height: 32px; background: rgba(255,255,255,.06); border-radius: 6px; margin-bottom: 12px; }
.upload-preview { margin: 8px 0 12px; padding: 8px; background: var(--bg); border-radius: var(--radius-sm); text-align: center; }
.upload-preview img { max-height: 80px; max-width: 100%; object-fit: contain; }
.upload-preview-wide img { max-height: 100px; width: 100%; object-fit: cover; border-radius: 6px; }
.shop-preview-full { padding: 16px; }
.shop-preview-iframe { width: 100%; height: min(72vh, 720px); border: 1px solid var(--border); border-radius: var(--radius-sm); background: #000; }

/* Template admin & merchant picker */
.tpl-thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; }
.badge-success { background: rgba(16,185,129,.15); color: var(--success); }
.badge-muted { background: var(--bg-elevated); color: var(--text-muted); }
.code-area { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; line-height: 1.5; }
.inline-form { display: inline; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0; font: inherit; }
.link-btn.danger { color: var(--danger); }
.mode-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.mode-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.mode-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-card input[type="radio"] { align-self: flex-start; margin: 0; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.template-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.template-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.template-card input { display: none; }
.template-thumb { width: 100%; height: 80px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.template-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; color: var(--text-muted);
}
.pay-custom-top, .pay-custom-bottom { position: relative; z-index: 1; }
.pay-section-title { font-size: 1rem; text-align: center; margin-bottom: 16px; color: var(--pay-text-muted, var(--text-muted)); }
.pay-group-picker, .pay-partition-picker { max-width: none; margin: 0; }
.pay-group-grid, .pay-partition-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.pay-group-card, .pay-partition-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 88px; padding: 16px 12px; text-align: center;
  background: var(--pay-card-bg, var(--bg-card)); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: inherit; cursor: pointer; transition: border-color .15s, transform .15s;
}
a.pay-group-card:hover, .pay-partition-card:hover, .pay-partition-card.active {
  border-color: var(--pay-primary, var(--primary));
  transform: translateY(-1px);
}
.pay-partition-card { font: inherit; width: 100%; }
.pay-selected-game { padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); }
.pay-selected-game strong { display: block; margin-top: 4px; font-size: 1.05rem; }
.pay-partition-list { list-style: none; margin: 0; padding: 0; }
.pay-partition-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.pay-partition-list li:last-child { border-bottom: 0; }

/* 商户分组管理 */
.group-board { display: flex; flex-direction: column; gap: 16px; }
.group-card { padding: 0; overflow: hidden; }
.group-card-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--primary) 4%, var(--bg-card));
}
.group-card-title h3 { margin: 0 0 4px; font-size: 1.15rem; }
.group-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.group-link-bar { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.group-link-copy { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.group-link-copy-sm { margin-top: 0; }
.group-link-input {
  flex: 1; min-width: 0; font-size: .82rem; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated, #1e293b); color: #fff;
}
.group-partition-wrap { padding: 0 12px 12px; }
.group-partition-table .col-narrow { width: 72px; white-space: nowrap; }
.group-partition-table .col-actions { width: 160px; white-space: nowrap; }
.group-partition-table .row-muted { opacity: .72; }
.group-empty-tip { padding: 16px 18px; margin: 0; }
.btn-danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: transparent; }
.btn-danger-outline:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.inline-form { display: inline; margin: 0; padding: 0; }

.pay-amount-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pay-preset-btn { min-width: 64px; }

.pay-wizard {
  display: flex; gap: 0; width: 100%; max-width: none; margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--pay-primary, var(--primary)) 25%, var(--border));
  border-radius: var(--radius); overflow: hidden;
  background: var(--pay-card-bg, var(--bg-card));
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.pay-panel { padding: 4px 0; }
.pay-steps { width: 200px; flex-shrink: 0; background: linear-gradient(180deg, #1e6fd9, #1557b0); color: #fff; padding: 0; margin: 0; }
.pay-steps ol { list-style: none; margin: 0; padding: 0; }
.pay-steps li { padding: 16px 16px 16px 38px; font-size: .92rem; line-height: 1.4; border-bottom: 1px solid rgba(255,255,255,.12); position: relative; }
.pay-steps li::before { content: '›'; position: absolute; left: 16px; opacity: .7; font-size: 1rem; }
.pay-steps li.active { background: #fff; color: #1557b0; font-weight: 600; }
.pay-steps li.done { opacity: .92; }
.pay-steps li.muted { opacity: .55; font-size: .84rem; }
.pay-wizard-body { flex: 1; padding: clamp(16px, 3vw, 32px); min-width: 0; }
.pay-tip-box { border: 1px solid var(--border); padding: 14px 18px; margin-bottom: 20px; font-size: .92rem; line-height: 1.65; background: var(--bg); border-radius: var(--radius-sm); }
.pay-server-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: .95rem; }
.pay-server-table th, .pay-server-table td { border: 1px solid var(--border); padding: 14px 18px; text-align: center; }
.pay-server-table th { background: var(--bg); font-weight: 600; }
.pay-server-table td:first-child { text-align: left; font-weight: 500; }
.pay-recharge-btn { min-width: 120px; padding: 10px 20px; font-size: .95rem; }
.pay-warm-tip { color: #dc2626; font-size: .88rem; margin-top: 16px; line-height: 1.6; }
.pay-game-summary { border: 1px solid var(--border); padding: 16px 20px; margin-bottom: 20px; display: grid; gap: 10px; border-radius: var(--radius-sm); }
.pay-game-summary.compact { margin-bottom: 16px; }
.pay-game-summary strong { display: inline-block; margin-left: 8px; font-size: 1.05rem; }
.pay-ratio-line { font-size: 1rem; word-break: break-word; }
.pay-ratio-line .text-danger { color: #dc2626; }
.pay-method-box { border: 1px solid var(--border); padding: 16px 20px; margin-bottom: 20px; border-radius: var(--radius-sm); }
.pay-methods-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-start; align-items: stretch; }
.pay-method-card {
  flex: 1 1 calc(33.333% - 14px); min-width: 110px; max-width: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 18px 12px; margin: 0; border: 2px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
  text-align: center;
}
.pay-method-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.pay-method-card:hover { border-color: color-mix(in srgb, var(--pay-primary, var(--primary)) 50%, var(--border)); transform: translateY(-1px); }
.pay-method-card:has(input:checked) {
  border-color: var(--pay-primary, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pay-primary, var(--primary)) 20%, transparent);
  background: color-mix(in srgb, var(--pay-primary, var(--primary)) 8%, var(--bg));
}
.pay-method-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; }
.pay-method-icon img { width: 48px; height: 48px; object-fit: contain; display: block; }
.pay-method-name { font-size: .9rem; line-height: 1.35; color: var(--pay-text, var(--text)); word-break: break-all; }
@media (max-width: 520px) {
  .pay-method-card { flex: 1 1 calc(50% - 10px); min-width: 100px; max-width: none; padding: 14px 8px; }
  .pay-method-icon { width: 48px; height: 48px; }
  .pay-method-icon img { width: 40px; height: 40px; }
}
.pay-custom-top,
.pay-custom-bottom { max-width: 100%; overflow-x: auto; word-break: break-word; }
.pay-custom-top img,
.pay-custom-bottom img { max-width: 100%; height: auto; }
.pay-form-section-title { font-size: 1rem; margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-weight: 600; }
.pay-breadcrumb { margin-top: 6px; }
.pay-form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.pay-form-actions .btn { min-width: 120px; }
.layout-pay .pay-wizard input[type="text"],
.layout-pay .pay-wizard input[type="number"],
.layout-pay .pay-wizard input[type="tel"] { font-size: 1rem; padding: 12px 14px; }

/* 充值表单紧凑：输入框适中宽度，不铺满整行 */
.layout-pay .pay-form-compact label { margin-bottom: 4px; font-size: .88rem; }
.layout-pay .pay-form-compact .hint { margin: 2px 0 10px; font-size: .78rem; line-height: 1.45; }
.layout-pay .pay-form-compact .pay-form-section-title { margin: 14px 0 8px; padding-bottom: 6px; font-size: .95rem; }
.layout-pay .pay-form-compact .pay-game-summary { padding: 10px 14px; margin-bottom: 12px; gap: 6px; }
.layout-pay .pay-form-compact input[type="text"],
.layout-pay .pay-form-compact input[type="number"],
.layout-pay .pay-form-compact input[type="tel"] {
  max-width: 280px;
  width: 100%;
  padding: 8px 10px;
  font-size: .92rem;
}
.layout-pay .pay-form-compact .pay-field-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.layout-pay .pay-form-compact .pay-field-row input[type="text"],
.layout-pay .pay-form-compact .pay-field-row input[type="number"],
.layout-pay .pay-form-compact .pay-field-row input[type="tel"] {
  width: 168px; max-width: 46vw; flex: 0 0 auto;
}
.pay-field-hint {
  font-size: .78rem; color: var(--text-muted); line-height: 1.4; flex: 1; min-width: 140px;
}
.pay-field-hint.is-error { color: #f87171; }
.pay-step-panel { display: none; }
.pay-step-panel.is-active { display: block; }
.layout-pay .pay-wizard .pay-order-inline {
  max-width: 480px; margin: 0; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
}
.layout-pay .pay-wizard .pay-order-inline .amount { font-size: 1.85rem; }
.pay-form-error {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    font-size: 14px;
}
.pay-form-error.pay-form-info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
    color: #93c5fd;
}
.layout-pay .pay-form-compact .pay-amount-presets { margin-bottom: 8px; }
.layout-pay .pay-form-compact .pay-form-actions { margin-top: 4px; }
.pay-method-box-compact { padding: 12px 14px; margin-bottom: 12px; }
.pay-method-box-compact .pay-method-card {
  flex: 0 1 auto;
  min-width: 88px;
  max-width: 120px;
  padding: 12px 10px;
  gap: 6px;
}
.pay-method-box-compact .pay-method-icon { width: 44px; height: 44px; }
.pay-method-box-compact .pay-method-icon img { width: 36px; height: 36px; }
.pay-method-box-compact .pay-method-name { font-size: .84rem; }

.pay-type-list-icon { width: 32px; height: 32px; object-fit: contain; display: block; }
.pay-type-icon-field { display: grid; gap: 8px; max-width: 420px; }
.pay-type-icon-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.pay-type-icon-preview img { width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--bg); }
.form-actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }

/* 充值页紧凑布局：窄屏或游戏内嵌小窗口（宽/高任一受限即启用） */
@media (max-width: 960px), (max-height: 720px) {
  .layout-pay { padding: 8px 0 20px; }
  .layout-pay .pay-header { margin-bottom: 12px; }
  .layout-pay .pay-header h1 { font-size: clamp(1.15rem, 4vw, 1.6rem); margin-bottom: 4px; }
  .pay-logo img { max-height: 48px; max-width: 160px; }
  .pay-contact-bar { font-size: .78rem; gap: 4px 10px; margin-top: 8px; }
  .pay-wizard { flex-direction: column; border-radius: var(--radius-sm); }
  .pay-steps { width: 100%; flex-shrink: 1; }
  .pay-steps ol { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .pay-steps li {
    flex: 1 0 auto; min-width: 88px; max-width: 140px;
    border-bottom: 0; border-right: 1px solid rgba(255,255,255,.12);
    padding: 10px 8px; text-align: center; font-size: .74rem; line-height: 1.3;
  }
  .pay-steps li::before { display: none; }
  .pay-steps li:last-child { border-right: 0; }
  .pay-wizard-body { padding: clamp(10px, 2.5vw, 16px); }
  .pay-tip-box { padding: 10px 12px; margin-bottom: 12px; font-size: .85rem; line-height: 1.5; }
  .pay-section-title { font-size: 1rem; margin-bottom: 12px; }
  .pay-server-table th, .pay-server-table td { padding: 10px 8px; font-size: .85rem; }
  .pay-recharge-btn { min-width: 88px; padding: 8px 12px; font-size: .86rem; }
  .pay-game-summary { padding: 10px 12px; margin-bottom: 12px; gap: 8px; }
  .pay-game-summary strong { font-size: .95rem; margin-left: 6px; }
  .pay-ratio-line { font-size: .9rem; }
  .pay-form-section-title { margin: 14px 0 8px; padding-bottom: 6px; font-size: .92rem; }
  .pay-method-box { padding: 12px; margin-bottom: 12px; }
  .pay-method-card { min-width: 90px; max-width: none; padding: 12px 8px; }
  .pay-method-icon { width: 44px; height: 44px; }
  .pay-method-icon img { width: 36px; height: 36px; }
  .pay-method-name { font-size: .82rem; }
  .pay-form-actions .btn { flex: 1 1 auto; min-width: 0; }
  .pay-warm-tip { font-size: .8rem; margin-top: 10px; }
  .layout-pay .pay-wizard input[type="text"],
  .layout-pay .pay-wizard input[type="number"],
  .layout-pay .pay-wizard input[type="tel"] { font-size: .92rem; padding: 9px 11px; }
  .pay-order { max-width: 100%; padding: 24px 16px; }
  .pay-order .amount { font-size: 1.75rem; margin: 10px 0; }
  .pay-order h2 { font-size: 1.15rem; }
  .result-icon { width: 56px; height: 56px; font-size: 1.5rem; margin-bottom: 12px; }
  .qrcode-box { padding: 10px; margin: 12px 0; }
}

@media (max-width: 560px) {
  .pay-server-table thead { display: none; }
  .pay-server-table,
  .pay-server-table tbody,
  .pay-server-table tr,
  .pay-server-table td { display: block; width: 100%; }
  .pay-server-table tr {
    margin-bottom: 10px; padding: 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--bg);
  }
  .pay-server-table td {
    border: 0; padding: 6px 0; text-align: left !important;
  }
  .pay-server-table td:last-child { padding-top: 10px; text-align: center !important; }
  .pay-recharge-btn { width: 100%; }
  .pay-group-grid { grid-template-columns: 1fr !important; }
}

@media (max-height: 600px) {
  .pay-badge,
  .pay-breadcrumb { display: none; }
  .pay-steps li { min-width: 72px; padding: 8px 6px; font-size: .7rem; }
  .pay-contact-bar { display: none; }
}

@media (max-height: 480px) {
  .pay-steps { display: none; }
  .layout-pay .pay-header h1 { font-size: 1.1rem; }
  .pay-notice { font-size: .8rem; margin-top: 4px; }
}

/* 文档中心 */
.doc-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.doc-sidebar { position: sticky; top: calc(var(--topbar-h) + 16px); }
.doc-nav { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.doc-nav-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.doc-nav-item:hover { background: rgba(255,255,255,.04); border-color: var(--border); }
.doc-nav-item.active { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.doc-card { display: block; padding: 20px; transition: border-color .15s, transform .15s; }
.doc-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.doc-card-link { color: var(--primary); font-size: .875rem; font-weight: 600; }
.doc-content { padding: 24px 28px; }
.doc-content-body { line-height: 1.7; font-size: .925rem; }
.doc-content-body h1, .doc-content-body h2, .doc-content-body h3 { margin: 1.4em 0 .6em; line-height: 1.35; }
.doc-content-body h1 { font-size: 1.5rem; }
.doc-content-body h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: .35em; }
.doc-content-body h3 { font-size: 1.05rem; }
.doc-content-body p { margin: .75em 0; }
.doc-content-body ul, .doc-content-body ol { margin: .75em 0; padding-left: 1.4em; }
.doc-content-body code { font-family: ui-monospace, monospace; font-size: .86em; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 4px; }
.doc-content-body pre { background: #0f172a; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; margin: 1em 0; }
.doc-content-body pre code { background: none; padding: 0; }
.doc-table-wrap { overflow-x: auto; margin: 1em 0; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.doc-table th, .doc-table td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.doc-table th { background: var(--bg-elevated); }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-sidebar { position: static; }
}

@media (max-width: 960px) {
  .shop-design-layout { grid-template-columns: 1fr; }
  .shop-preview-mini { position: static; }
  .form-grid-2 { grid-template-columns: 1fr; }
}
/* end responsive overrides moved below admin section */

/* ===== 官网首页 / 下载中心 ===== */
.web-home { display: flex; flex-direction: column; gap: 28px; margin: 8px 0 32px; }
.web-hero {
  padding: 56px 32px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.22), transparent 55%),
    linear-gradient(135deg, rgba(30,41,59,.95), rgba(15,23,42,.98));
  border: 1px solid rgba(59,130,246,.25);
}
.web-hero-inner { max-width: 720px; }
.web-hero-badge {
  display: inline-block; margin: 0 0 12px; padding: 4px 10px; border-radius: 999px;
  font-size: .75rem; color: #93c5fd; background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.2);
}
.web-hero h1 { margin: 0 0 12px; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.2; }
.web-hero-desc { margin: 0 0 24px; color: var(--text-muted); font-size: 1rem; line-height: 1.7; max-width: 640px; }
.btn-lg { padding: 12px 22px; font-size: .95rem; }
.web-stats { padding: 0 4px; }
.web-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.web-stat-item {
  text-align: center; padding: 18px 12px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
}
.web-stat-item strong { display: block; font-size: 1.35rem; color: var(--primary); margin-bottom: 4px; }
.web-stat-item span { font-size: .78rem; color: var(--text-muted); }
.web-section { margin: 0; }
.web-section-title { margin: 0 0 18px; font-size: 1.25rem; font-weight: 600; }
.web-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.web-feature-card { padding: 22px 20px; height: 100%; }
.web-feature-icon { font-size: 1.6rem; margin-bottom: 10px; }
.web-feature-card h3 { margin: 0 0 8px; font-size: 1rem; }
.web-feature-card p { margin: 0; color: var(--text-muted); font-size: .875rem; line-height: 1.6; }
.web-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.web-step { padding: 22px 20px; position: relative; }
.web-step-num {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; margin-bottom: 12px;
}
.web-step h3 { margin: 0 0 8px; font-size: 1rem; }
.web-step p { margin: 0; color: var(--text-muted); font-size: .875rem; line-height: 1.6; }
.web-news-section { padding: 22px 24px; }
.web-news-list li { padding: 12px 0; }
.web-section-more { margin: 8px 0 0; text-align: right; font-size: .875rem; }
.web-cta {
  padding: 36px 28px; text-align: center;
  background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(16,185,129,.08));
  border-color: rgba(59,130,246,.25);
}
.web-cta-inner h2 { margin: 0 0 8px; font-size: 1.35rem; }
.web-cta-inner p { margin: 0 0 18px; color: var(--text-muted); }
.web-html-body { color: var(--text-muted); line-height: 1.7; }
.web-download-page { padding: 8px 0 24px; }
.web-section-head { margin-bottom: 20px; }
.web-page-title { margin: 0 0 8px; font-size: 1.6rem; }
.web-page-desc { margin: 0; color: var(--text-muted); }
.web-download-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.web-download-card {
  display: flex; flex-direction: column; gap: 8px; padding: 22px 20px; color: var(--text);
  transition: transform .15s, border-color .15s;
}
.web-download-card:hover { transform: translateY(-2px); border-color: var(--primary); color: var(--text); }
.web-download-icon { font-size: 1.8rem; }
.web-download-card h3 { margin: 0; font-size: 1.05rem; }
.web-download-card p { margin: 0; flex: 1; color: var(--text-muted); font-size: .875rem; line-height: 1.6; }
.web-download-action { margin-top: 8px; font-size: .85rem; color: var(--primary); }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.config-block { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }

@media (max-width: 960px) {
  .web-stats-grid, .web-feature-grid, .web-steps, .web-download-grid { grid-template-columns: 1fr 1fr; }
  .web-hero { padding: 40px 20px; }
}
@media (max-width: 640px) {
  .web-stats-grid, .web-feature-grid, .web-steps, .web-download-grid { grid-template-columns: 1fr; }
}

/* 轮询池管理 */
.rotate-tips-list { margin: 8px 0 0 18px; color: var(--text-muted); }
.rotate-tips-list li { margin: 4px 0; }
.rotate-global-form { padding: 16px 20px; }
.rotate-switch-label { font-weight: 600; }
.rotate-empty { text-align: center; padding: 48px 24px; }
.rotate-empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .7; }
.rotate-empty p { color: var(--text-muted); margin-bottom: 16px; }
.rotate-pool-table .actions { white-space: nowrap; }
.rotate-pool-table .btn-link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0 6px; font-size: inherit; }
.rotate-pool-table .btn-link:hover { color: #60a5fa; }
.rotate-pool-table .inline-form { display: inline; }
.rotate-channel-row td { background: var(--bg-elevated); padding: 0 !important; }
.rotate-channel-panel { padding: 16px 20px; }
.rotate-channel-panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rotate-add-channel-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rotate-add-channel-form select { min-width: 200px; }
.rotate-channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rotate-channel-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rotate-drawer-channels { min-height: 48px; margin: 8px 0 12px; }
.rotate-drawer-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rotate-drawer-add select { flex: 1; min-width: 180px; }
body.drawer-open { overflow: hidden; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .55);
  display: none;
}
.drawer-backdrop.is-open { display: block; }
.drawer-panel {
  position: fixed; top: 0; right: 0; z-index: 201;
  width: min(420px, 100vw); height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex-direction: column;
  display: none;
  transform: translateX(100%);
  transition: transform .25s ease;
}
.drawer-panel.is-open {
  display: flex;
  transform: translateX(0);
}
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.drawer-header h3 { margin: 0; font-size: 1.1rem; color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
.drawer-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.drawer-body { flex: 1; overflow: auto; padding: 20px; }
.drawer-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 20px; border-top: 1px solid var(--border);
}
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-elevated); border-radius: 26px; transition: .2s;
  border: 1px solid var(--border);
}
.toggle-slider:before {
  content: ''; position: absolute; height: 20px; width: 20px; left: 2px; bottom: 2px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); border-color: var(--success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }
