* { box-sizing: border-box; }
:root {
  --gold: #b28a4e;
  --gold-dark: #8f6b34;
  --ink: #2c2418;
  --muted: #85796a;
  --line: #e7ded0;
  --paper: #fffdf8;
  --bg: #f5f0e7;
}
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at 15% 0%, #fbf6ec 0, var(--bg) 46%, #efe8dc 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.w-page { width: min(980px, 100%); margin: 0 auto; padding: 32px 20px 28px; }
.w-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.w-brand img { width: 54px; height: 54px; object-fit: contain; border-radius: 50%; }
.w-brand h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 27px; letter-spacing: 2px; }
.w-brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; letter-spacing: 2px; }
.w-card {
  background: rgba(255,253,248,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(82,62,30,.08);
}
.w-login { max-width: 560px; padding: 30px; margin: 34px auto; }
.w-login h2 { margin: 0 0 8px; font-size: 21px; }
.w-muted { color: var(--muted); font-size: 13px; margin: 0; }
.w-login form { display: flex; gap: 10px; margin: 22px 0 12px; }
.w-login input {
  min-width: 0; flex: 1; height: 46px; padding: 0 15px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-size: 15px; color: var(--ink); outline: none;
}
.w-login input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(178,138,78,.16); }
.w-btn {
  height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; white-space: nowrap; transition: .15s ease;
}
.w-btn-primary { color: #fff; background: linear-gradient(135deg, var(--gold), var(--gold-dark)); border-color: var(--gold-dark); }
.w-btn-primary:hover { filter: brightness(1.05); }
.w-btn-primary:disabled { opacity: .55; cursor: wait; }
.w-btn-ghost { color: var(--ink); background: #fff; border-color: var(--line); }
.w-btn-ghost:hover { border-color: var(--gold); color: var(--gold-dark); }
.w-msg { min-height: 20px; margin: 8px 0 0; color: #b24a3a; font-size: 13px; }
.w-tip { margin: 16px 0 0; color: #a29684; font-size: 12px; line-height: 1.7; }
.w-result { margin-top: 10px; }
.w-result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 4px; }
.w-result-head h2 { margin: 2px 0 3px; font-size: 20px; }
.w-orders { display: grid; gap: 14px; }
.w-order {
  padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--paper); box-shadow: 0 8px 24px rgba(90,68,32,.05);
}
.w-order-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.w-order-no { margin: 0 0 5px; font-weight: 700; font-size: 16px; letter-spacing: .4px; }
.w-order-meta { color: var(--muted); font-size: 12px; line-height: 1.8; }
.w-order-total { text-align: right; white-space: nowrap; }
.w-order-total b { display: block; font-size: 20px; color: var(--gold-dark); font-family: "Songti SC", serif; }
.w-order-total span { color: var(--muted); font-size: 12px; }
.w-order-items { margin: 16px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line); color: #5b5042; font-size: 13px; line-height: 1.9; }
.w-order-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.w-empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; background: rgba(255,255,255,.45); }
.w-footer { margin-top: 36px; text-align: center; color: #a29684; font-size: 12px; line-height: 1.8; }
.w-footer p { margin: 0; }

.w-modal {
  position: fixed; inset: 0; z-index: 50; overflow: auto;
  padding: 26px 18px 36px; background: rgba(42,32,18,.45);
}
.w-modal-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; gap: 10px; width: min(210mm, 100%); margin: 0 auto 14px; }
.w-cert {
  width: min(241mm, 100%); min-height: 140mm; margin: 0 auto; padding: 6mm 7mm;
  background: #fff; color: #1f1a12; box-shadow: 0 26px 80px rgba(0,0,0,.25);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-synthesis: none;
}
.w-v-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; border-bottom: 1.5px solid #6f6251; padding-bottom: 2mm; }
.w-v-head h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: .6px; white-space: nowrap; }
.w-v-head p { margin: 2px 0 0; font-size: 9px; color: #6f6251; }
.w-v-head img { width: 46px; height: 46px; object-fit: contain; }
.w-v-top-qr { display: flex; flex-direction: column; align-items: center; gap: 1mm; flex: 0 0 auto; color: #6f6251; font-size: 7.5px; line-height: 1.2; text-align: center; }
.w-v-top-qr span { white-space: nowrap; }
.w-v-info { display: flex; flex-wrap: wrap; gap: 2px 18px; padding: 1.6mm 0; font-size: 9.5px; border-bottom: 1px solid #6f6251; }
.w-v-table-wrap { width: 100%; }
.w-cert .w-v-table-wrap table { font-size: 8.5px; }
.w-v-table-wrap th, .w-v-table-wrap td { padding: 1.6mm 1.4mm !important; line-height: 1.3; }
.w-v-table-wrap tbody tr { height: 6mm; }
.w-v-sum { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 3px 18px; padding: 1.4mm 0; font-size: 9.5px; border-bottom: 1px solid #6f6251; }
.w-v-sum b { color: #6f3f18; font-size: 10.5px; }
.w-v-paid b { font-size: 13px; color: #8f2f1f; }
.w-v-terms { column-count: 2; column-gap: 8mm; border: 1px solid #6f6251; padding: 1.5mm 2mm; margin-top: 1.6mm; font-size: 7.1px; line-height: 1.42; }
.w-v-terms p { margin: 0; break-inside: avoid; }
.w-cert-promise { font-weight: 700; }
.w-v-foot { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 3px 10px; margin-top: 1.8mm; font-size: 8px; color: #4d4234; }
.w-v-qr { display: flex; flex-direction: column; align-items: center; gap: 1mm; margin-left: auto; color: #8f6b34; text-align: center; }
.w-v-qr img { width: 12mm; height: 12mm; object-fit: contain; }
.w-v-qr em { max-width: 26mm; font-style: normal; font-size: 7.2px; line-height: 1.3; }
.w-cert-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 2px solid #8f6b34; padding-bottom: 10px; }
.w-cert-brand { display: flex; align-items: center; gap: 12px; }
.w-cert-brand img { width: 46px; height: 46px; object-fit: contain; }
.w-cert-brand h2 { margin: 0; font-size: 22px; letter-spacing: 3px; }
.w-cert-brand p { margin: 3px 0 0; color: #6f6251; font-size: 11px; letter-spacing: 2px; }
.w-cert-title { text-align: right; }
.w-cert-title h1 { margin: 0; font-size: 25px; letter-spacing: 4px; }
.w-cert-title p { margin: 4px 0 0; color: #6f6251; font-size: 11px; }
.w-cert-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; padding: 16px 0 12px; font-size: 12.5px; line-height: 1.7; }
.w-cert-meta span { color: #6f6251; }
.w-cert table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.w-cert th, .w-cert td { border: 1px solid #6f6251; padding: 6px 7px; line-height: 1.35; vertical-align: middle; }
.w-cert th { background: #f3ecdf; font-weight: 700; text-align: center; }
.w-cert td.c { text-align: center; }
.w-cert td.r { text-align: right; }
.w-cert-total { display: flex; justify-content: flex-end; gap: 28px; padding: 10px 2px; font-size: 13px; }
.w-cert-total b { font-size: 16px; color: #8f6b34; }
.w-cert-box { margin-top: 14px; border: 1px solid #6f6251; padding: 12px 14px; font-size: 12px; line-height: 1.9; }
.w-cert-box h3 { margin: 0 0 7px; font-size: 13px; letter-spacing: 2px; }
.w-cert-box p { margin: 2px 0; }
.w-cert-terms { margin-top: 7px; }
.w-cert-terms p { margin: 1px 0; }
.w-cert-promise { font-weight: 700; }
.w-cert-foot { display: flex; justify-content: space-between; margin-top: 24px; font-size: 11px; color: #6f6251; }
.w-cert-qr { display: flex; align-items: center; gap: 8px; }
.w-cert-qr img { width: 58px; height: 58px; object-fit: contain; }

/* 可视化设计器导出的电子凭证模板 */
.w-cert.template-mode {
  width: auto; min-height: 0; padding: 0; background: transparent;
  box-shadow: none;
}
.w-template-page {
  overflow: hidden; margin: 0 auto; background: #fff;
  box-shadow: 0 26px 80px rgba(0,0,0,.25);
}
.w-template-page .v-tpl-page {
  position: relative; overflow: hidden; padding: 0 !important;
  background: #fff; color: #000; box-sizing: border-box;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-synthesis: none;
}
.w-template-page .vd-el { position: absolute; box-sizing: border-box; }
.w-template-page .vd-text { width: 100%; height: 100%; white-space: pre-wrap; overflow: hidden; }
.w-template-page .vd-bordered .vd-text { padding: .45mm 1.5mm; }
.w-template-page .vd-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.w-template-page .vd-qr, .w-template-page .vd-qr img { width: 100%; height: 100%; display: block; }
.w-template-page .vd-barcode, .w-template-page .vd-barcode svg { width: 100%; height: 100%; display: block; }
.w-template-page .vd-fields { width: 100%; height: 100%; border-collapse: collapse; table-layout: fixed; }
.w-template-page .vd-fields td { border: .75pt solid #000; padding: .4mm .6mm; vertical-align: middle; white-space: nowrap; overflow: hidden; font-size: inherit; }
.w-template-page .vd-items { width: 100%; border-collapse: collapse; table-layout: fixed; }
.w-template-page .vd-items th, .w-template-page .vd-items td { border: .75pt solid #000; padding: .4mm .55mm; vertical-align: middle; font-size: inherit; line-height: 1.25; }
.w-template-page .vd-items th { height: 6mm; text-align: center; background: #f2f2f2; font-weight: 700; }
.w-template-page .vd-items .c { text-align: center; }
.w-template-page .vd-items .r { text-align: right; padding-right: 1.2mm; }
.w-template-page .vd-items .fill td { height: 5.8mm; }
.w-template-page .vd-items .vd-adjust td { height: 5mm; font-size: .88em; }
.w-template-page .vd-items .vd-adjust span:first-child { float: left; }
.w-template-page .vd-items .vd-adjust span:last-child { float: right; }
.w-template-page .vd-items .vd-total td { height: 7.4mm; font-size: 1.03em; }
.w-template-page .vd-items .upper { font-weight: 700; letter-spacing: .3pt; }
.w-template-page .vd-terms { width: 100%; height: 100%; padding: .55mm 1.6mm; overflow: hidden; }
.w-template-page .vd-terms p { margin: 0; }
.w-template-page .vd-terms .promise { text-align: center; font-weight: 700; margin-bottom: .3mm; }
.w-template-page .vd-line { width: 100%; border-top: .75pt solid #000; }
.w-template-page .vd-items tbody td.vd-note {
  white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere;
  vertical-align: top; line-height: 1.25;
}

@media (max-width: 640px) {
  .w-page { padding: 20px 14px 24px; }
  .w-brand { margin-bottom: 18px; }
  .w-brand h1 { font-size: 23px; }
  .w-login { padding: 22px 18px; margin: 18px auto; }
  .w-login form { flex-direction: column; }
  .w-order { padding: 16px; }
  .w-order-top { flex-direction: column; }
  .w-order-total { text-align: left; }
  .w-result-head { align-items: flex-start; flex-direction: column; }
  .w-modal { padding: 10px 6px 20px; }
  .w-cert { min-height: 0; padding: 4mm; }
  .w-v-head h1 { font-size: 16px; letter-spacing: 1.5px; white-space: normal; }
  .w-v-head img { width: 36px; height: 36px; }
  .w-v-head p { font-size: 8px; }
  .w-v-info { font-size: 8.5px; gap: 1px 10px; }
  .w-v-table-wrap { overflow-x: auto; }
  .w-v-table-wrap table { min-width: 620px; }
  .w-v-terms { column-count: 1; }
  .w-v-foot { flex-wrap: wrap; }
}

@media print {
  @page { size: 241mm 140mm; margin: 0; }
  body { background: #fff; }
  body.printing .w-page, body.printing .w-modal-bar { display: none !important; }
  body.printing .w-modal { position: static; display: block !important; padding: 0; background: #fff; overflow: visible; }
  body.printing .w-cert {
    width: 241mm; height: 140mm; min-height: 0; margin: 0; padding: 5mm 6mm;
    box-shadow: none; overflow: hidden;
  }
  body.printing .w-cert.template-mode { width: 203.2mm; height: 130.4mm; padding: 0; }
  body.printing .w-template-page { width: auto !important; height: auto !important; box-shadow: none; overflow: visible; }
  body.printing .w-template-page .v-tpl-page { transform: none !important; }
  body.printing .w-v-table-wrap { overflow: visible; }
  body.printing .w-v-table-wrap table { min-width: 0; }
}
