:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #6b7280;
  --line: #e5e8ef;
  --brand: #1d4ed8;
  --brand-2: #3b82f6;
  --gold: #b45309;
  --ok: #059669;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, #0f2557 0%, #1d4ed8 60%, #3b82f6 100%);
  color: #fff;
  padding: 18px 20px;
}
.topbar .inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: 1px; }
.topbar .sub { font-size: 12px; opacity: .85; }
.topbar nav a {
  color: #fff;
  font-size: 13px;
  background: rgba(255, 255, 255, .16);
  padding: 6px 14px;
  border-radius: 999px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .28); }

.layout {
  max-width: 1120px;
  margin: 20px auto 60px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .step {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.card .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- 选项 chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1.5px solid var(--line);
  background: #fafbfd;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
  font-size: 14px;
}
.chip:hover { border-color: var(--brand-2); }
.chip.active {
  border-color: var(--brand);
  background: #eef4ff;
  color: var(--brand);
  font-weight: 600;
}
.chip small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.chip.active small { color: var(--brand-2); }

/* ---------- 表单 ---------- */
input[type="text"], input[type="tel"], textarea, select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--brand-2); }
#plateInput {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 4px;
  font-size: 20px;
  text-align: center;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label.field input, label.field textarea { margin-top: 6px; font-size: 14px; color: var(--ink); }

/* ---------- 预览区 ---------- */
.preview-stage {
  background:
    radial-gradient(ellipse at 50% 0%, #2b3550 0%, #161c2e 70%),
    #161c2e;
  border-radius: 12px;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}
.plate-card { text-align: center; max-width: 100%; }
.plate-card canvas {
  width: 100%;
  max-width: 420px;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .45));
}
.plate-card .label {
  margin-top: 8px;
  font-size: 12px;
  color: #93a0bd;
  letter-spacing: 2px;
}
.preview-empty { color: #7c88a6; font-size: 13px; padding: 30px 0; }

/* ---------- 价格 ---------- */
.price-lines { font-size: 13px; color: var(--muted); }
.price-lines .row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}
.price-lines .row:last-child { border-bottom: none; }
.price-lines .row b { color: var(--ink); font-weight: 600; }
.price-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}
.price-total .num { font-size: 26px; font-weight: 800; color: var(--gold); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { opacity: .92; transform: translateY(-1px); }
.btn-ghost {
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
  padding: 8px 16px;
}
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand); }
.btn-danger { background: var(--danger); color: #fff; font-size: 13px; padding: 8px 16px; }

/* ---------- 提示条 ---------- */
.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.success-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  display: none;
}
.success-box .oid { font-size: 20px; font-weight: 800; color: var(--ok); letter-spacing: 1px; }

/* ---------- 后台表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: middle;
}
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
.tbl input[type="text"], .tbl input[type="number"], .tbl select {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 8px;
  width: 100%;
  min-width: 60px;
}
.tbl input[type="number"] { width: 80px; }
.tbl .del { color: var(--danger); cursor: pointer; font-size: 16px; border: none; background: none; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.order-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #eff6ff;
  color: var(--brand);
}
.admin-wrap { max-width: 1120px; margin: 20px auto 60px; padding: 0 20px; }
.admin-wrap .card { margin-bottom: 20px; }

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 0 40px;
}

/* ---------- 后台登录 ---------- */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-box h2 { margin: 0 0 16px; font-size: 18px; }
.login-box input { text-align: center; letter-spacing: 2px; }
.login-box .btn { margin-top: 14px; }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ---------- 支付面板 ---------- */
.pay-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 12px;
}
.pay-qr {
  margin: 16px auto 6px;
  text-align: center;
}
.pay-qr img {
  width: 220px;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.pay-status {
  margin: 10px 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
.pay-status.paid { color: var(--ok); font-weight: 700; }

/* ---------- 订单状态徽标 ---------- */
.st-paid { background: #ecfdf5 !important; color: var(--ok) !important; }
.st-unpaid { background: #fff7ed !important; color: #c2410c !important; }
.st-cancelled { background: #f3f4f6 !important; color: var(--muted) !important; }

/* ---------- 手机端底部悬浮条 ---------- */
#mobileBar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .1);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#mobileBar .mb-total { font-size: 13px; color: var(--muted); }
#mobileBar .mb-total b { color: var(--gold); font-size: 20px; margin-left: 4px; }
#mobileBar .btn { width: auto; padding: 10px 30px; margin: 0; }

/* ---------- 手机端适配 ---------- */
@media (max-width: 640px) {
  body { font-size: 14px; padding-bottom: 78px; }
  .layout { padding: 0 12px; margin: 14px auto 36px; gap: 14px; }
  .card { padding: 14px 14px; border-radius: 12px; margin-bottom: 12px; }
  .card h2 { font-size: 14px; margin-bottom: 10px; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 17px; }
  .topbar nav a { padding: 5px 12px; }
  .chips { gap: 8px; }
  .chip { padding: 10px 14px; font-size: 14px; border-radius: 12px; }
  .chip small { font-size: 11px; }
  input[type="text"], input[type="tel"], textarea, select { font-size: 16px; padding: 10px 12px; } /* ≥16px 防 iOS 自动缩放 */
  #plateInput { font-size: 18px; letter-spacing: 3px; }
  .form-row { grid-template-columns: 1fr; }
  .price-lines { font-size: 12px; }
  .price-total .num { font-size: 22px; }
  .btn-primary { padding: 14px; font-size: 16px; }
  .notice { font-size: 12px; padding: 8px 12px; }
  .admin-actions .btn { padding: 10px 16px; }
  .pay-amount { font-size: 24px; }
  .pay-qr img { width: 190px; height: 190px; }
  #mobileBar { display: flex; }
  .preview-stage { padding: 18px 12px; }
  .plate-card .label { letter-spacing: 1px; }
}

