:root {
  --ink: #0f1b2d;
  --muted: #5b6b82;
  --line: #d9e4f2;
  --paper: rgba(255, 255, 255, 0.94);
  --blue: #1a6fd0;
  --blue-deep: #0e4fa3;
  --ok: #128a4b;
  --warn: #b45309;
  --danger: #c0352b;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(8, 30, 70, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  background: #0a2748;
}

.hidden { display: none !important; }

/* ===== 前台商店 ===== */
.store {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

.store-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(90, 180, 255, 0.35), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(40, 120, 220, 0.4), transparent 50%),
    linear-gradient(165deg, #071a33 0%, #0b3a6e 42%, #1568ad 100%);
}

.store-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 85%);
  pointer-events: none;
}

.store-frame {
  position: relative;
  z-index: 1;
  width: min(560px, 96vw);
  margin: 0 auto;
  padding: 22px 14px 12px;
}

.brand {
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
  animation: rise 0.55s ease both;
}

.brand-mark {
  display: inline-block;
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  font-weight: 600;
  opacity: 0.75;
  margin-bottom: 10px;
}

.brand-name {
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: clamp(1.7rem, 6vw, 2.05rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.brand-desc {
  margin-top: 8px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.78);
}

.stage {
  background: var(--paper);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  animation: rise 0.65s ease 0.08s both;
}

.stage-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.stage-title h2 {
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: 1.05rem;
  font-weight: 650;
}

.text-action {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}

.plan-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: min(46vh, 340px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.plan-grid::-webkit-scrollbar {
  width: 4px;
}

.plan-grid::-webkit-scrollbar-thumb {
  background: rgba(26, 111, 208, 0.25);
  border-radius: 4px;
}

.plan {
  appearance: none;
  width: 100%;
  border: 2px solid var(--line);
  background: #f7fafe;
  border-radius: 12px;
  padding: 10px 14px 10px 38px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.plan:hover:not(:disabled) {
  border-color: #7eb0e8;
  background: #f0f6ff;
}

.plan.is-active {
  border-color: var(--blue);
  background: linear-gradient(90deg, #cce4ff 0%, #e8f3ff 45%, #f3f9ff 100%);
  box-shadow:
    0 0 0 3px rgba(26, 111, 208, 0.28),
    0 6px 18px rgba(26, 111, 208, 0.18);
}

.plan.is-active::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 2px 6px rgba(26, 111, 208, 0.35);
}

.plan.is-active::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 50%;
  width: 5px;
  height: 10px;
  margin-top: -7px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.plan.is-active .plan-name {
  color: var(--blue-deep);
  font-weight: 700;
}

.plan.is-active .plan-price {
  color: var(--blue);
  transform: scale(1.04);
}

.plan.is-active .plan-stock {
  color: var(--ok);
  font-weight: 600;
}

.plan-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.plan-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.plan-name {
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: 0.98rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plan-days {
  font-size: 0.72rem;
  color: var(--muted);
}

.plan-price {
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--blue-deep);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.plan-price i {
  font-style: normal;
  font-size: 0.72rem;
  margin-right: 1px;
  font-weight: 600;
}

.plan-stock {
  font-size: 0.68rem;
  color: #6f849f;
}

.plan.is-soldout {
  opacity: 0.55;
  cursor: not-allowed;
  background: #eef1f5;
}

.plan.is-soldout .plan-stock {
  color: var(--danger);
}

.primary-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #2a7de0 0%, #1760c4 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.primary-btn:hover {
  filter: brightness(1.05);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  height: 38px;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.ghost-btn.full {
  width: 100%;
  margin-top: 12px;
  height: 44px;
}

.form-msg {
  min-height: 1.2em;
  margin-top: 8px;
  text-align: center;
  color: var(--danger);
  font-size: 0.85rem;
}

.support-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(217, 228, 242, 0.95);
  box-shadow: 0 -6px 24px rgba(8, 30, 70, 0.1);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.support-bar-inner {
  width: min(560px, 96vw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.support-bar-inner a {
  color: var(--blue);
  text-decoration: none;
}

.support-bar-inner span {
  white-space: nowrap;
}

/* 兼容旧 class 名 */
.support {
  position: relative;
}

.wx-contact {
  position: relative;
  color: var(--blue);
  cursor: pointer;
  font-weight: 500;
  border-bottom: 1px dashed rgba(26, 111, 208, 0.45);
  padding-bottom: 1px;
}

.wx-contact.has-qr::after {
  content: "扫码";
  margin-left: 4px;
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid #d5e3f5;
  border-radius: 4px;
  padding: 0 4px;
}

.wx-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translateX(-50%) translateY(6px);
  width: 168px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 40, 80, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 60;
  text-align: center;
}

.wx-pop::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #fff;
  filter: drop-shadow(0 1px 0 var(--line));
}

.wx-pop img {
  width: 148px;
  height: 148px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  background: #f7fafc;
}

.wx-pop em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 0.72rem;
  color: var(--muted);
}

.wx-contact.has-qr:hover .wx-pop,
.wx-contact.has-qr:focus .wx-pop,
.wx-contact.has-qr:focus-within .wx-pop,
.wx-contact.has-qr.is-open .wx-pop {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 28px 0;
}

.pay-card {
  text-align: center;
}

.pay-lines {
  text-align: left;
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #f5f8fc;
  border-radius: 12px;
  font-size: 0.88rem;
}

.pay-lines em {
  font-style: normal;
  color: var(--muted);
  margin-right: 10px;
}

.pay-lines strong {
  font-weight: 600;
  word-break: break-all;
}

.qr-frame {
  width: 200px;
  height: 200px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: #f4f8fd;
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hint {
  color: var(--ink);
  font-size: 0.86rem;
  margin-bottom: 6px;
}

.hint.soft {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 14px;
}

.hint.left { text-align: left; }

.result-banner {
  text-align: center;
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.result-banner.ok { color: var(--ok); }
.result-banner.warn { color: var(--warn); }

.ticket {
  background: linear-gradient(180deg, #fff8ef 0%, #fff 100%);
  border: 1px solid #f0d3a8;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  margin-bottom: 12px;
}

.ticket-label {
  font-size: 0.75rem;
  color: #9a6412;
  margin-bottom: 4px;
}

.ticket-value {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  word-break: break-all;
  margin-bottom: 10px;
}

.info-rows {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f5f8fc;
  border-radius: 10px;
  font-size: 0.86rem;
}

.info-row span { color: var(--muted); flex-shrink: 0; }
.info-row b { font-weight: 600; text-align: right; word-break: break-all; }

.kami-panel { margin: 8px 0 4px; }

.kami-code {
  font-family: ui-monospace, Consolas, monospace;
  background: #eef5ff;
  border: 1px dashed #7eafeb;
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
  word-break: break-all;
  margin-bottom: 10px;
  cursor: pointer;
  user-select: all;
  font-size: 1rem;
  font-weight: 600;
}

.warn-box {
  background: #fff6e8;
  color: #8a4b08;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 8px 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 22, 44, 0.48);
  z-index: 40;
  animation: fade 0.2s ease;
}

.drawer {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  max-height: min(82vh, 820px);
  overflow: auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(72px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
  animation: slide-up 0.28s ease;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.drawer-head h2 {
  font-family: "Outfit", "Noto Sans SC", sans-serif;
  font-size: 1.05rem;
}

.field {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 0.95rem;
  margin: 8px 0 12px;
  font-family: inherit;
}

.field:focus {
  outline: none;
  border-color: #8fb6e8;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(15, 27, 45, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  z-index: 80;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { transform: translate(-50%, 24px); opacity: 0.6; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@media (min-width: 768px) {
  .store-frame {
    padding-top: 36px;
    width: min(580px, 92vw);
  }

  .plan-grid {
    max-height: min(50vh, 380px);
  }
}

/* ===== 后台沿用 ===== */
.admin-body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #0a1628 0%, #0d3a6e 50%, #1a6fb5 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
}

.admin-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 12px 28px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.admin-nav a {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 0.82rem;
  text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(255, 255, 255, 0.28);
}

.card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(10, 40, 80, 0.12);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.card h2 {
  font-size: 0.92rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.login-box {
  max-width: 400px;
  margin: 80px auto;
}

.form-row { margin-bottom: 10px; }
.form-row label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.form-row textarea { min-height: 110px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--blue-deep); }
.btn-secondary { background: #e8eef6; color: var(--ink); }
.btn-danger { background: var(--danger); }

.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-row img { height: 36px; border-radius: 6px; cursor: pointer; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 6px 6px;
  text-align: left;
  vertical-align: middle;
  word-break: break-all;
}
th { color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 0.78rem; }
table.table-compact th,
table.table-compact td { padding: 5px 6px; }
table .money { color: var(--blue); font-variant-numeric: tabular-nums; white-space: nowrap; }
table .table-total td { background: #f5f8fc; border-top: 2px solid var(--line); }
.table-hint { margin: 6px 0 0; font-size: 0.75rem; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #e8eef6;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f1f5f9; color: #64748b; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 0;
}
.stats-wide {
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 720px) {
  .stats-wide { grid-template-columns: repeat(6, 1fr); }
}
.stat {
  background: #f5f8fc;
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.stat .n { font-size: 1.05rem; font-weight: 700; color: var(--blue); line-height: 1.2; }
.stat .l { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
.filter-bar input,
.filter-bar select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
}
.filter-bar .btn {
  width: auto;
  height: 32px;
  padding: 0 12px;
  font-size: 0.82rem;
}

.alert {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.84rem;
}
.alert-ok { background: #dcfce7; color: #166534; }
.alert-err { background: #fee2e2; color: #991b1b; }

.inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form input {
  flex: 1;
  min-width: 120px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.inline-form .btn {
  width: auto;
  height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.qr-upload-preview {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 12px;
  background: #f5f8fc;
  border-radius: 10px;
}

.qr-upload-preview img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line, #d9e4f2);
}

.favicon-thumb {
  width: 64px !important;
  height: 64px !important;
}

.favicon-preview img {
  width: 64px;
  height: 64px;
}

.qr-upload-local {
  margin: 0 0 12px;
}

.qr-upload-local img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line, #d9e4f2);
}

.qr-upload-form input[type="file"] {
  padding: 8px 0;
}

.pay-tip { color: var(--muted); font-size: 0.9rem; }
.meta-list { display: grid; gap: 10px; }
.meta-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  padding: 10px 12px;
  background: #f5f8fc;
  border-radius: 8px;
}
.msg {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--danger);
  text-align: center;
}
