* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: #2c2416;
  background-color: #f5f0e8;
  background-image: url("/static/img/底图.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
.page { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
.stack-img { display: block; width: 100%; height: auto; }
.stack-img--logo { width: 52%; max-width: 220px; margin: 0 auto; }
.stack-img + .stack-img { margin-top: 12px; }
.query-wrap + .stack-img { margin-top: 48px; }
.query-wrap + .stack-img + .stack-img { margin-top: 40px; margin-bottom: 56px; }

.query-wrap {
  position: relative;
  margin-top: 24px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(60, 40, 20, 0.12);
  min-height: 320px;
  background: #fffdf8;
}
.query-banner { display: block; width: 100%; height: auto; min-height: 320px; object-fit: cover; }
.query-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  padding: 6% 6% 7%;
}
.query-overlay-inner { width: 100%; max-height: 100%; overflow-y: auto; padding: 8px 6px 10px; }
.query-panel { margin: 0; padding: 0; }
.is-hidden { display: none !important; }

#loading { text-align: center; font-size: 15px; color: #5c4d3a; padding: 16px 8px 18px; }
.spinner {
  width: 36px; height: 36px; margin: 0 auto 14px;
  border: 3px solid rgba(140, 118, 82, 0.25);
  border-top-color: #8c7652;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.line-title { text-align: center; font-size: 18px; font-weight: 700; color: #2c2416; margin-bottom: 10px; }
.line-ok {
  text-align: center; font-size: 17px; font-weight: 700; line-height: 1.6;
  color: #1f7a33; white-space: pre-line; margin-bottom: 12px;
}
.line-goods { font-size: 15px; font-weight: 600; text-align: center; color: #111; padding: 8px 0; }
#resultBlock .line-row { font-size: 14px; line-height: 1.75; color: #111; padding: 6px 0; text-align: left; }
#resultBlock .line-row.is-warn { color: #a35a00; }
.line-hint {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed rgba(160, 140, 110, 0.35);
  font-size: 10px; line-height: 1.6; color: #3e7811; white-space: pre-line; text-align: center;
}
#errorBlock { text-align: center; color: #8b2e2e; font-size: 15px; line-height: 1.6; }

/* ---------------- 后台 ---------------- */
.admin-body { background-image: none; background: #f4f5f7; color: #1f2430; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: #1f2430; color: #fff; padding: 12px 20px;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar a, .topbar form button {
  color: #cfd6e4; text-decoration: none; font-size: 13px;
  background: none; border: 1px solid #3b4457; border-radius: 6px; padding: 5px 10px; cursor: pointer;
}
.topbar a:hover, .topbar form button:hover { color: #fff; border-color: #5b6880; }
.wrap { max-width: 1200px; margin: 20px auto; padding: 0 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid #e3e6ec; border-radius: 10px; padding: 14px; }
.stat b { display: block; font-size: 22px; color: #1f2430; }
.stat span { font-size: 12px; color: #6b7488; }
.card { background: #fff; border: 1px solid #e3e6ec; border-radius: 10px; padding: 18px; margin-bottom: 20px; }
.card h2 { font-size: 15px; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
label.field { display: block; margin-bottom: 12px; font-size: 13px; color: #414a5e; }
label.field input, label.field textarea, label.field select {
  display: block; width: 100%; margin-top: 5px; padding: 8px 10px;
  border: 1px solid #cfd4de; border-radius: 7px; font-size: 14px; font-family: inherit;
}
.hint { font-size: 12px; color: #8b93a5; margin-top: 4px; }
button.primary {
  background: #2f6fed; color: #fff; border: 0; border-radius: 7px;
  padding: 9px 16px; font-size: 14px; cursor: pointer;
}
button.primary:disabled { opacity: .6; cursor: default; }
button.ghost { background: #fff; border: 1px solid #cfd4de; border-radius: 7px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid #eef0f4; vertical-align: middle; }
th { color: #6b7488; font-weight: 600; font-size: 12px; background: #fafbfd; }
td.num, th.num { text-align: right; }
td.mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
td.ops a { margin-right: 10px; color: #2f6fed; text-decoration: none; }
td.empty, tr.empty td { text-align: center; color: #8b93a5; padding: 28px 0; }
.pager { margin-top: 14px; font-size: 13px; }
.pager a { display: inline-block; padding: 3px 9px; margin-right: 4px; border: 1px solid #d8dce5; border-radius: 6px; color: #2f6fed; text-decoration: none; }
.pager a.cur { background: #2f6fed; color: #fff; border-color: #2f6fed; }
.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input { flex: 1; padding: 8px 10px; border: 1px solid #cfd4de; border-radius: 7px; }
.msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg.err { color: #c0392b; }
.msg.ok { color: #1f7a33; }

/* 登录 */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1f2430; }
.login-box { background: #fff; padding: 30px; border-radius: 12px; width: 340px; }
.login-box h1 { font-size: 18px; margin: 0 0 6px; }
.login-box p.sub { font-size: 12px; color: #8b93a5; margin: 0 0 20px; }

/* 打印 */
.print-toolbar { position: sticky; top: 0; background: #fff; border-bottom: 1px solid #e3e6ec; padding: 10px 16px; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px; }
.label { border: 1px dashed #c9cfda; border-radius: 6px; padding: 8px 6px; text-align: center; page-break-inside: avoid; }
.label img { width: 100%; max-width: 150px; height: auto; }
.label .code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; margin-top: 4px; letter-spacing: .3px; }
.label .gname { font-size: 10px; color: #5c6578; margin-top: 2px; }
@media print {
  .print-toolbar { display: none; }
  .labels { grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 0; }
  .label { border: 0; }
  .label .gname { display: none; }
  @page { margin: 8mm; }
}
