:root {
  --brand-red: #e93323;
  --page-gray: rgb(240, 243, 246);
  --muted: rgb(147, 154, 161);
  --line: #eee;
  --white: #fff;
  --app-width: 750px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #333;
  background: var(--page-gray);
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: var(--app-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--page-gray);
  overflow: hidden;
}

/* 商品列表：尺寸和颜色按 pages/list/list.vue 换算 */
.list-shell {
  height: 100vh;
}

.search-header {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  gap: 8px;
  background: var(--page-gray);
}

.search-box {
  position: relative;
  width: min(620px, calc(100% - 16px));
  height: 48px;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.search-box input {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  height: 34px;
  padding: 0 10px 0 36px;
  border: 1px solid #e1e5e9;
  border-radius: 5px;
  outline: none;
  color: #333;
  background: #fff;
  font-size: 14px;
}

.search-box input:focus {
  border-color: #bbb;
}

.search-submit {
  width: 44px;
  height: 34px;
  flex: 0 0 44px;
  padding: 0;
  border-radius: 5px;
  background: var(--brand-red);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.search-submit:active {
  opacity: .82;
}

.search-icon {
  position: absolute;
  z-index: 1;
  top: 17px;
  left: 18px;
  width: 13px;
  height: 13px;
  border: 2px solid #8f969d;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  right: -5px;
  bottom: -2px;
  background: #8f969d;
  transform: rotate(45deg);
}

.fresh-toggle {
  width: 29.33%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0 6px 12px;
  border-radius: 6px;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-mark {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid #bbb;
  border-radius: 4px;
  transition: all .2s;
}

.fresh-toggle[aria-pressed="true"] .checkbox-mark {
  border-color: #007aff;
  background: #007aff;
}

.fresh-toggle[aria-pressed="true"] .checkbox-mark::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.catalog-layout {
  position: absolute;
  inset: 0;
  display: flex;
  padding-top: 56px;
}

.category-sidebar {
  width: 22%;
  height: 100%;
  flex: 0 0 22%;
  overflow-y: auto;
  scrollbar-width: none;
  background: #fff;
}

.category-sidebar::-webkit-scrollbar,
.product-scroller::-webkit-scrollbar,
.subcategories::-webkit-scrollbar {
  display: none;
}

.category-item {
  width: 100%;
  padding: 10px 0;
  background: #fff;
  color: #333;
  text-align: center;
  font-size: 13px;
  cursor: pointer;
}

.category-item.active {
  color: var(--brand-red);
  background: #f6f7f8;
  font-weight: 700;
}

.category-item img,
.category-placeholder {
  width: 45px;
  height: 45px;
  margin: 0 auto 4px;
  object-fit: contain;
}

.category-placeholder {
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #aaa;
  background: #f5f5f5;
  font-size: 22px;
}

.category-item span {
  display: block;
  line-height: 18px;
}

.product-scroller {
  width: 78%;
  height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-left: 10px;
}

.subcategories {
  position: sticky;
  z-index: 5;
  top: 0;
  overflow-x: auto;
  gap: 0;
  background: var(--page-gray);
}

.subcategories:not([hidden]) {
  display: flex;
}

.subcategory-item {
  width: 75px;
  flex: 0 0 75px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  background: transparent;
  color: #070707;
  text-align: center;
  font-size: 12.5px;
  cursor: pointer;
}

.subcategory-item.active {
  color: var(--brand-red);
}

.subcategory-item img {
  width: 45px;
  height: 45px;
  margin: 0 auto 4px;
  border-radius: 50%;
  object-fit: cover;
}

.category-section {
  margin-bottom: 10px;
}

.category-title {
  min-height: 40px;
  display: flex;
  align-items: center;
  margin: 0;
  padding-left: 5px;
  color: #777;
  font-size: 14px;
  font-weight: 400;
}

.product-grid {
  display: flex;
  flex-wrap: wrap;
  padding-right: 7.5px;
  margin-bottom: 7.5px;
}

.product-card {
  width: 100%;
  padding-bottom: 8px;
}

.product-card-inner {
  overflow: hidden;
  border-radius: 5px;
  background: #fff;
}

.product-image-link {
  position: relative;
  display: block;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  background: #fff;
}

.product-image-link img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-body {
  padding: 10px;
}

.product-card-name {
  display: block;
  margin: 0;
  color: #333;
  font-size: 15px;
  line-height: 21px;
  text-decoration: none;
}

.packing-line {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.product-card-bottom {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
}

.card-price {
  color: var(--brand-red);
  font-size: 16px;
  line-height: 16px;
}

.product-extra {
  margin-top: 4px;
  color: var(--muted);
  font-size: 16px;
  line-height: 20px;
}

.empty-state {
  padding: 30px 15px;
  color: #888;
  text-align: center;
}

/* 商品详情：尺寸和颜色按 pages/detail/detail.vue 换算 */
.detail-shell {
  background: var(--page-gray);
}

.media-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fff;
  touch-action: pan-y;
}

.back-to-list {
  flex-shrink: 0;
  align-self: center;
  margin-left: 10px;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(233, 51, 35, .38);
  border-radius: 999px;
  background: rgba(233, 51, 35, .08);
  color: var(--brand-red);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.back-to-list::after {
  content: "›";
  margin-left: 4px;
  font-size: 14px;
  line-height: 1;
}

.back-to-list:active {
  background: rgba(233, 51, 35, .18);
}

.media-content,
.media-content img,
.media-content video {
  width: 100%;
  height: 100%;
}

.media-content img,
.media-content video {
  object-fit: contain;
  background: #fff;
}

.media-content img {
  -webkit-user-drag: none;
  user-select: none;
  touch-action: pan-y;
}

.media-dots {
  position: absolute;
  left: 50%;
  bottom: 18px;
  display: flex;
  gap: 6px;
  transform: translateX(-50%);
}

.media-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .25);
}

.media-dot.active {
  background: #333;
}

.media-switch {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 34px;
  display: flex;
  overflow: hidden;
  border: 1px solid #111;
  border-radius: 16px;
  transform: translateX(-50%);
}

.media-switch button {
  min-width: 52px;
  padding: 5px 10px;
  background: #fff;
  color: #111;
  font-size: 12px;
}

.media-switch button.active {
  background: #111;
  color: #fff;
}

.product-summary {
  padding: 10px 12.5px;
  background: #fff;
}

.product-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.product-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #333;
  font-size: 18px;
  line-height: 25px;
  font-weight: 700;
}

.product-price {
  color: var(--brand-red);
  font-size: 15px;
  line-height: 30px;
  font-weight: 700;
}

.packing-quantity {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.detail-tabs {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 10px 12.5px;
  background: var(--page-gray);
}

.detail-tabs button {
  position: relative;
  width: 100px;
  height: 40px;
  background: transparent;
  color: #333;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
}

.detail-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--brand-red);
}

.detail-panel,
.sku-section {
  padding: 0 12.5px 10px;
}

.sku-section {
  padding: 0 0 10px;
}

.sku-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.section-heading {
  position: relative;
  width: max-content;
  margin: 14px 0 10px;
  font-size: 15px;
}

.section-heading::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 30%;
  height: 1px;
  background: var(--brand-red);
  transform: translateX(-50%);
}

.sku-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sku-option {
  padding: 7px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-size: 13px;
}

.sku-option.active {
  border-color: #333;
  background: #333;
  color: #fff;
}

.parameter-list {
  overflow: hidden;
  background: #fff;
}

.parameter-row {
  min-height: 32.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
}

.parameter-key,
.parameter-value {
  flex: 0 0 50%;
  font-size: 14.5px;
}

.parameter-key {
  color: var(--muted);
}

.parameter-value {
  color: #333;
  font-weight: 700;
}

.rich-content {
  max-width: 100%;
  overflow: hidden;
  background: transparent;
  line-height: 1.7;
  word-break: break-word;
}

.rich-content img,
.rich-content video,
.rich-content table {
  max-width: 100% !important;
  height: auto !important;
}

.line-image {
  width: 100%;
  height: auto;
  margin-top: 10px;
}

.page-loading {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(240, 243, 246, .92);
  color: #777;
  font-size: 14px;
}

.page-loading[hidden] {
  display: none;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #ddd;
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.error-state {
  padding: 80px 20px;
  color: #777;
  text-align: center;
}

.error-state a {
  color: #007aff;
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 90px;
  max-width: 80%;
  padding: 9px 14px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 13px;
  text-align: center;
  transform: translateX(-50%);
}

/* 电脑端商品二维码页 */
.pc-page {
  min-width: 1100px;
  background: #f4f6f8;
}

.pc-shell {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.pc-access-denied {
  padding: 120px 24px;
  color: #8a929b;
  text-align: center;
  font-size: 16px;
}

.pc-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.pc-eyebrow {
  margin: 0 0 8px;
  color: var(--brand-red);
  font-size: 13px;
  letter-spacing: 2px;
}

.pc-header h1 {
  margin: 0;
  color: #222;
  font-size: 32px;
}

.pc-subtitle {
  margin: 10px 0 0;
  color: #8a929b;
  font-size: 14px;
}

.pc-list-link {
  padding: 10px 18px;
  border: 1px solid #e1e5e9;
  border-radius: 20px;
  background: #fff;
  color: #444;
  text-decoration: none;
  font-size: 14px;
}

.pc-state {
  margin: 0;
  color: #8a929b;
  font-size: 14px;
}

.pc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin-bottom: 14px;
}

.pc-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.pc-export-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  color: #fff;
  background: var(--brand-red, #d43c33);
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
}

.pc-export-btn:hover {
  filter: brightness(1.08);
}

.pc-export-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.pc-qr-only-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #555d65;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.pc-qr-only-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-red);
}

.pc-error {
  color: var(--brand-red);
}

.pc-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.pc-product-card {
  display: flex;
  min-height: 410px;
  flex-direction: column;
  align-items: center;
  padding: 20px 18px 18px;
  border: 1px solid #edf0f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(31, 43, 56, .05);
}

.pc-product-image {
  width: 140px;
  height: 140px;
  overflow: hidden;
  border-radius: 8px;
  background: #f7f8f9;
}

.pc-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pc-product-info {
  width: 100%;
  min-width: 0;
  text-align: center;
}

.pc-product-name {
  display: block;
  min-height: 42px;
  margin-bottom: 5px;
  color: #2f3337;
  font-size: 15px;
  line-height: 21px;
  text-decoration: none;
}

.pc-product-price {
  margin: 5px 0 8px;
  color: var(--brand-red);
  font-size: 16px;
  font-weight: 700;
}

.pc-qr {
  margin: 0 auto;
  width: 156px;
  height: 156px;
  padding: 4px;
  border: 1px solid #eef0f2;
  background: #fff;
}

.pc-qr img,
.pc-qr canvas {
  display: block;
  width: 148px !important;
  height: 148px !important;
}

.pc-qr-name {
  margin-top: 8px;
  color: #4a4f54;
  font-size: 13px;
  line-height: 19px;
  text-align: center;
}

.pc-card-export {
  margin-top: 10px;
  width: 100%;
  padding: 7px 0;
  border: 1px solid var(--brand-red, #d43c33);
  border-radius: 6px;
  color: var(--brand-red, #d43c33);
  background: #fff;
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
}

.pc-card-export:hover {
  color: #fff;
  background: var(--brand-red, #d43c33);
}

.pc-card-export:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.pc-qr-tip {
  margin: 6px 0 0;
  color: #9aa1a8;
  font-size: 11px;
}

.pc-qr-only-mode .pc-product-image,
.pc-qr-only-mode .pc-product-name {
  display: none;
}

.pc-qr-only-mode .pc-product-card {
  min-height: 210px;
  justify-content: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 751px) {
  body {
    background: #dfe4e9;
  }

  .app-shell {
    box-shadow: 0 0 24px rgba(0, 0, 0, .08);
  }
}
