:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --brand: #16746f;
  --brand-dark: #0f5652;
  --chip: #eef7f6;
  --shadow: 0 10px 28px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
select,
input {
  font: inherit;
}

.page {
  width: 100%;
  max-width: 1360px;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.filter-toggle {
  display: none;
}

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(8, minmax(104px, 1fr)) auto auto;
  gap: 10px;
  padding: 12px;
  background: rgba(244, 246, 248, 0.94);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

label {
  display: grid;
  gap: 6px;
  color: #425066;
  font-size: 13px;
  font-weight: 700;
}

.search-label,
.image-search-label {
  grid-column: span 2;
}

.text-search-button {
  min-width: 72px;
}

.image-search-label input[type="file"] {
  height: auto;
  min-height: 40px;
  padding: 8px 10px;
  line-height: 1.4;
}

.image-search-status {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.is-hidden {
  display: none !important;
}

select,
input,
button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

select,
input {
  width: 100%;
  padding: 0 10px;
}

select:focus,
input:focus,
button:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 116, 111, 0.14);
}

button {
  align-self: end;
  padding: 0 14px;
  color: var(--brand-dark);
  background: var(--chip);
  border-color: #cce4e1;
  cursor: pointer;
  white-space: nowrap;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 42px;
  color: var(--muted);
  font-size: 13px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding-bottom: 24px;
}

.product-card {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-card.has-audit {
  border-color: #d85b45;
}

.product-card.is-blocked {
  background: #fffafa;
}

.product-media {
  display: grid;
  gap: 8px;
  padding: 0 0 10px;
  background: #ffffff;
  border-bottom: 1px solid #eef2f5;
}

.product-image {
  width: 100%;
  min-height: 140px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  display: block;
  background: #ffffff;
}

.thumb-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 10px;
}

.thumb-button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  padding: 2px;
  align-self: auto;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

.thumb-button.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(22, 116, 111, 0.16);
}

.thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.product-body {
  display: grid;
  gap: 11px;
  padding: 12px;
}

.product-name {
  min-height: 44px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.price-box {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2px 10px;
  align-items: end;
  padding: 10px;
  background: var(--chip);
  border: 1px solid #cce4e1;
  border-radius: 6px;
}

.price-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.price-box strong {
  color: #b13f2d;
  font-size: 22px;
  line-height: 1;
}

.price-box em {
  grid-column: 1 / -1;
  color: #425066;
  font-size: 12px;
  font-style: normal;
}

.series-style-button {
  align-self: center;
  min-height: 28px;
  padding: 0 9px;
  color: #006b67;
  background: #ffffff;
  border: 1px solid #b8dcd8;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.series-style-button:hover {
  border-color: var(--accent);
}

.audit-box {
  padding: 8px 10px;
  color: #a43725;
  background: #fff0ec;
  border: 1px solid #efb8ac;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.audit-box.is-warning {
  color: #8a5a00;
  background: #fff8e6;
  border-color: #f1d48a;
}

.spec-list {
  display: grid;
  gap: 7px;
}

.spec-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
  line-height: 1.35;
}

.spec-label {
  color: var(--muted);
}

.spec-value {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.card-quote-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-top: 2px;
}

.card-quote-actions button {
  width: 100%;
  height: 36px;
  align-self: auto;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed #c7d0dc;
  border-radius: 8px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 0 0 28px;
}

.load-more-button {
  min-width: 180px;
  height: 42px;
  align-self: auto;
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.load-more-button[hidden] {
  display: none;
}

.quote-preview {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.64);
}

.quote-preview.is-open {
  display: grid;
}

.quote-preview-panel {
  width: 100%;
  max-width: 760px;
  width: min(760px, 100%);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
}

.quote-preview-head,
.quote-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.quote-preview-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.quote-preview-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-preview-close,
.quote-preview-download {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--brand-dark);
  background: var(--chip);
  border: 1px solid #cce4e1;
  border-radius: 6px;
  text-decoration: none;
}

.quote-preview-body {
  overflow: auto;
  padding: 12px;
  background: #edf1f5;
}

.quote-preview-image {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

.quote-status {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  display: none;
  transform: translateX(-50%);
  padding: 10px 14px;
  color: #fff;
  background: rgba(15, 23, 42, 0.88);
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.22);
}

body.is-quote-busy .quote-status {
  display: block;
}

.download-card-quote:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 820px) {
  .page {
    padding: 10px;
  }

  .filter-toggle {
    position: sticky;
    top: 0;
    z-index: 6;
    display: block;
    width: 100%;
    margin-bottom: 8px;
  }

  .filter-bar {
    top: 48px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 70vh;
    overflow: auto;
    visibility: visible;
    pointer-events: auto;
    transition: max-height 0.2s ease, padding 0.2s ease, border-width 0.2s ease;
  }

  .filter-bar.is-collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
  }

  .search-label,
  .image-search-label {
    grid-column: 1 / -1;
  }

  button {
    grid-column: 1 / -1;
  }

  .card-quote-actions button {
    grid-column: auto;
  }

  .load-more-button {
    grid-column: auto;
    width: 100%;
    max-width: 260px;
    width: min(260px, 100%);
  }
}

@media (max-width: 480px) {
  .page {
    padding: 8px;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  button {
    grid-column: auto;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-card {
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(22, 32, 42, 0.06);
  }

  .product-media {
    gap: 0;
    padding-bottom: 0;
  }

  .product-image {
    min-height: 120px;
  }

  .thumb-row {
    display: none;
  }

  .product-body {
    gap: 8px;
    padding: 8px;
  }

  .product-name {
    min-height: 38px;
    font-size: 12px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .price-box {
    display: block;
    padding: 7px;
  }

  .price-box span,
  .price-box em {
    display: none;
  }

  .price-box strong {
    font-size: 17px;
  }

  .spec-list {
    gap: 4px;
  }

  .spec-row {
    grid-template-columns: 42px 1fr;
    gap: 5px;
    font-size: 10px;
    line-height: 1.25;
  }

  .spec-row:nth-child(n + 4) {
    display: none;
  }

  .audit-box {
    padding: 6px;
    font-size: 11px;
    line-height: 1.25;
  }

  .card-quote-actions {
    gap: 6px;
  }

  .card-quote-actions button {
    height: 32px;
    padding: 0 6px;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
  }
}
