.hidden { display: none !important; }

:root {
  --brand: #3d6df2;
  --brand-dark: #2b56d8;
  --ink: #1e293b;
  --muted: #5b6980;
  --line: #eceef3;
  --bg: #f6f8fb;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(30, 41, 59, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button, input, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== 顶部 ===== */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  height: 60px; display: flex; align-items: center; justify-content: center;
}
.site-header .inner {
  width: 100%; max-width: 900px; padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.logo-mark svg { width: 20px; height: 20px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.brand-name span { color: var(--brand); }

/* ===== 主体 ===== */
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
.hero { padding: 12px 2px 26px; }
.hero h1 { font-size: 26px; line-height: 1.35; margin: 0 0 8px; font-weight: 800; }
.hero p { color: var(--muted); font-size: 14px; margin: 0; }

.sec-title { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; }
.sec-title h2 { font-size: 17px; margin: 0; font-weight: 700; }
.sec-title .bar { width: 3px; height: 16px; background: var(--brand); border-radius: 2px; }

/* ===== 商品卡片 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30,41,59,.1); }
.thumb {
  height: 170px; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.thumb svg { width: 118px; height: 118px; }
.badge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(255,255,255,.92); color: var(--brand);
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
}
.card-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.card-sub { font-size: 12px; color: var(--muted); margin: 0 0 14px; flex: 1; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.price { color: #e5484d; font-size: 22px; font-weight: 800; }
.price small { font-size: 13px; }
.price-old { color: #9aa5b5; font-size: 12px; text-decoration: line-through; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 11px 16px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  background: var(--brand); color: #fff; width: 100%;
  transition: background .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-ghost:hover { background: #f0f4ff; }
.btn svg { width: 17px; height: 17px; }

/* ===== 弹窗 ===== */
.mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 50; display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .mask { align-items: center; } }
.modal {
  background: #fff; width: 100%; max-width: 460px;
  border-radius: 18px 18px 0 0; padding: 24px 22px 28px;
  max-height: 92vh; overflow-y: auto;
}
@media (min-width: 640px) { .modal { border-radius: 18px; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.close-x {
  width: 30px; height: 30px; border: none; background: #f1f3f7;
  border-radius: 50%; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.close-x svg { width: 16px; height: 16px; }

.pick-product {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 16px;
}
.pick-product .mini-icon { width: 46px; height: 46px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.pick-product .mini-icon svg { width: 30px; height: 30px; }
.pick-product .pname { font-weight: 700; font-size: 14px; }
.pick-product .pprice { color: #e5484d; font-weight: 700; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field label .req { color: #e5484d; }
.field input, .field textarea {
  width: 100%; border: 1px solid #dfe3ea; border-radius: 10px;
  padding: 11px 12px; outline: none; background: #fff; color: var(--ink);
}
.field input:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(61,109,242,.1); }
.field textarea { resize: vertical; min-height: 64px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qty-box { display: flex; align-items: center; gap: 12px; }
.qty-box button { width: 34px; height: 34px; border: 1px solid #dfe3ea; background: #fff; border-radius: 8px; cursor: pointer; font-size: 18px; color: var(--ink); }
.qty-box span { min-width: 24px; text-align: center; font-weight: 700; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 4px; }
.total-line .t-label { font-size: 13px; color: var(--muted); }
.total-line .t-val { font-size: 24px; font-weight: 800; color: #e5484d; }
.tip-test { margin-top: 10px; background: #fff8e8; color: #a16207; border-radius: 8px; padding: 8px 10px; font-size: 12px; }

/* ===== 支付 ===== */
.pay-card { text-align: center; }
.pay-amount { font-size: 30px; font-weight: 800; color: #e5484d; margin: 4px 0 2px; }
.pay-amount small { font-size: 15px; }
.qr-box { margin: 18px auto; display: inline-flex; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; position: relative; }
.qr-box img { width: 210px; height: 210px; }
.qr-box .qr-loading { width: 210px; height: 210px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.qr-box .center-logo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 38px; height: 38px; border-radius: 9px; background: #fff;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
  display: flex; align-items: center; justify-content: center;
}
.qr-box .center-logo svg { width: 24px; height: 24px; color: var(--brand); }
.pay-hint { font-size: 13px; color: var(--muted); }
.pay-hint b { color: var(--ink); }
.status-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 14px 0; }
.spin { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.order-sn { font-size: 12px; color: #9aa5b5; word-break: break-all; margin-top: 6px; }

/* ===== 成功 ===== */
.success-box { text-align: center; padding: 12px 0; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: #e8f7ee; color: #12a150; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.success-icon svg { width: 34px; height: 34px; }
.success-box h3 { margin: 0 0 8px; font-size: 20px; }
.success-box p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.footer { text-align: center; color: #9aa5b5; font-size: 12px; padding: 30px 0 10px; }

/* ===== 管理后台 ===== */
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .label { font-size: 12px; color: var(--muted); }
.stat-card .value { font-size: 25px; font-weight: 800; margin-top: 6px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select { border: 1px solid #dfe3ea; border-radius: 9px; padding: 9px 11px; outline: none; background: #fff; }
.filters input:focus, .filters select:focus { border-color: var(--brand); }
.table-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfc; color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.tag-paid { background: #e8f7ee; color: #12a150; }
.tag-pending { background: #fff5e6; color: #c47a09; }
.tag-closed { background: #f1f3f7; color: #8a94a6; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13px; }
.pager button { border: 1px solid #dfe3ea; background: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.pager button:disabled { opacity: .5; cursor: not-allowed; }
.login-box { max-width: 380px; margin: 80px auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.login-box h2 { margin: 0 0 20px; font-size: 20px; }
