: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: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --sidebar-w: 220px;
  --topbar-h: 56px;
  --subnav-h: 48px;
}

* { 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.6;
  min-height: 100vh;
  font-size: 14px;
}

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: .875rem; }
.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: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1, .page-header h2, .user-main > h2, .admin-main-inner > h2, .app-main > h2 {
  font-size: 1.45rem; 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: 24px;
  box-shadow: var(--shadow);
}
.section-card { margin-bottom: 20px; }
.section-card h3 {
  margin-bottom: 16px; font-size: .8rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.content-card { margin-bottom: 20px; }
.content-card h3 { margin: 0 0 12px; font-size: .95rem; color: var(--text); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: .875rem;
  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: 6px 12px; font-size: .8rem; }
.btn-group { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* Forms */
.form label {
  display: block; margin: 12px 0 6px; font-size: .8125rem;
  font-weight: 500; color: var(--text-muted);
}
.form input, .form select, .form textarea {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: .9rem; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form input: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: 560px; }
.form.inline {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px;
}
.form.inline input, .form.inline select { width: auto; min-width: 160px; flex: 0 1 auto; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }
.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-group { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 12px 0; }
.checkbox-group label { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.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: 12px; width: 100%; margin: 0; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s;
}
.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: 12px 16px; color: var(--text-muted);
  font-weight: 600; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.table .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.table .actions a { font-size: .8125rem; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; 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: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: .875rem;
}
.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; }

/* Stats */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; margin: 20px 0;
}
.stat-card { text-align: center; padding: 20px 16px; }
.stat-card strong {
  display: block; font-size: 1.6rem; font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.stat-card span { font-size: .78rem; color: var(--text-muted); margin-top: 4px; display: block; }
.stats-compact .stat-card strong { font-size: 1.2rem; }

/* 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: 24px;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box h2 { margin-bottom: 24px; text-align: center; font-size: 1.4rem; }
.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; }

/* ========== 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; }

.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: 10px;
  padding: 16px 14px; 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: 10px;
  padding: 11px 14px; margin: 2px 8px;
  color: var(--text-muted); font-size: .875rem; 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 16px;
  font-size: .75rem; 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 18px; font-size: .8125rem; 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: 20px 24px 32px; 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: 24px; max-width: 720px;
}
.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: 8px; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.tab-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border); font-size: .875rem;
}
.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; }
.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(200px, 1fr)); gap: 16px; }
.plugin-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; 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.45rem; font-weight: 700; margin: 0;
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.panel-title {
  font-size: .95rem; font-weight: 600; margin: 0 0 16px; color: var(--text);
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.layout-form-page { align-items: start; }
.copy-block { margin-bottom: 16px; }
.copy-block label { display: block; font-size: .75rem; color: var(--text-muted); margin-bottom: 6px; }
.copy-line {
  display: block; padding: 12px 14px; 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: 20px; }
.dashboard-panels { margin-top: 8px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-card {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  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.2rem; }
.info-list { list-style: none; }
.info-list li {
  padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: .875rem;
}
.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: 8px; }
.quick-links a {
  display: block; padding: 12px 16px; 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: 20px; font-size: 1.25rem; }

/* 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: 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; }
  .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: 16px; }
  .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: 24px 0 48px;
}
.layout-pay .pay-container-wide { max-width: 980px; width: 100%; }
.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: 28px 24px; margin: -40px -24px 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);
}
.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; }
.checkbox-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.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: 6px; 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 { margin-bottom: 4px; }
.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; }

.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; }
.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-method-category { font-weight: 600; margin: 0 0 12px; }
.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; }
@media (max-width: 768px) {
  .layout-pay { padding: 12px 0 32px; }
  .layout-pay .pay-container-wide { padding: 0 12px; }
  .pay-wizard { flex-direction: column; border-radius: var(--radius-sm); }
  .pay-steps { width: 100%; }
  .pay-steps ol { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pay-steps li { flex: 1 0 auto; min-width: 110px; border-bottom: 0; border-right: 1px solid rgba(255,255,255,.12); padding: 12px 10px; text-align: center; font-size: .78rem; }
  .pay-steps li::before { display: none; }
  .pay-steps li:last-child { border-right: 0; }
  .pay-wizard-body { padding: 16px; }
  .pay-server-table th, .pay-server-table td { padding: 10px 8px; font-size: .88rem; }
  .pay-recharge-btn { min-width: 96px; padding: 8px 12px; font-size: .88rem; }
  .pay-form-actions .btn { flex: 1 1 auto; }
}

@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 */
