:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --brand: #1677ff;
  --brand-strong: #0f5fd0;
  --green: #12945c;
  --red: #d92d20;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.shop-header,
.section-head,
.product-top,
.pay-method,
.pay-line {
  display: flex;
  align-items: center;
}

.shop-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.pay-method {
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.pay-method img,
.pay-line img {
  width: 20px;
  height: 20px;
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.product-panel,
.lookup,
.checkout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.product-panel {
  padding: 18px;
}

.section-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.section-head h2 {
  color: var(--text);
}

.products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product {
  min-height: 234px;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.product.is-disabled {
  opacity: 0.72;
}

.product-top {
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #eef6ff;
}

.product-type,
.stock,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.product-type {
  background: var(--panel);
  color: var(--brand);
}

.stock-ok {
  background: #e8f7ef;
  color: var(--green);
}

.stock-empty {
  background: #fdecec;
  color: var(--red);
}

.product-body {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 10px;
  padding: 14px;
}

.product-name {
  min-height: 42px;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.4;
}

.product-desc {
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.price {
  align-self: end;
  font-size: 26px;
  font-weight: 900;
}

.pay-line {
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

button:disabled {
  cursor: not-allowed;
  background: #c9d3df;
  color: #6b7788;
}

.secondary-button {
  margin-top: 14px;
  background: var(--panel);
  color: var(--brand);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: var(--panel-soft);
}

.order-panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 16px;
}

.lookup {
  padding: 14px;
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 10px;
}

.lookup input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
}

.checkout {
  padding: 18px;
  display: grid;
  gap: 16px;
}

#orderMeta {
  margin-top: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-line {
  margin-top: 8px;
  color: var(--green);
  min-height: 22px;
}

.qr-box {
  min-height: 302px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.qr-box img {
  width: 280px;
  height: 280px;
}

.delivery {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--green);
  font-size: 15px;
  line-height: 1.5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 32, 51, 0.46);
}

.modal-panel {
  position: relative;
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 24px 80px rgba(23, 32, 51, 0.2);
}

.modal-head,
.payment-product,
.payment-options {
  display: grid;
  gap: 12px;
}

.modal-head {
  grid-template-columns: 1fr 40px;
  align-items: start;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  background: #eef6ff;
  color: var(--brand);
}

.payment-product {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.payment-product strong {
  overflow-wrap: anywhere;
}

.payment-product span {
  color: var(--brand);
  font-weight: 900;
}

.payment-options {
  grid-template-columns: 1fr 1fr;
}

.payment-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
}

.payment-option img {
  width: 22px;
  height: 22px;
}

.payment-option.placeholder {
  background: #f0fdf4;
  color: #138a4d;
  border: 1px solid #c9ecd8;
}

.payment-option.placeholder:hover {
  background: #e4f8ec;
}

.wechat-mark {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #18b566;
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.payment-hint {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }

  .order-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100vw - 24px, 1180px);
    padding-top: 18px;
  }

  .shop-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .products {
    grid-template-columns: 1fr;
  }

  .lookup-form {
    grid-template-columns: 1fr;
  }

  .payment-options {
    grid-template-columns: 1fr;
  }
}
