:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --accent: #d64545;
  --accent-dark: #ad3030;
  --teal: #147d92;
  --teal-dark: #0b5f70;
  --soft-teal: #e3f4f7;
  --soft-red: #fff0f0;
  --shadow: 0 10px 28px rgba(16, 42, 67, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--canvas);
}

a {
  color: inherit;
}

.site-header {
  background: var(--ink);
  color: #ffffff;
}

.header-inner,
.catalog-shell,
.footer-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.15;
}

.brand small {
  margin-top: 3px;
  color: #b9c9d8;
  font-size: 11px;
}

.merchant-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid #5b7893;
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  text-decoration: none;
}

.merchant-link:hover,
.merchant-link:focus-visible {
  border-color: #ffffff;
  outline: 0;
}

.catalog-shell {
  padding: 28px 0 48px;
}

.catalog-toolbar {
  display: grid;
  gap: 20px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
}

h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(25px, 4vw, 38px);
  line-height: 1.2;
}

.catalog-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.search-control,
.select-control {
  display: grid;
  gap: 6px;
}

.control-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
}

input:focus,
select:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(20, 125, 146, 0.16);
}

.ad-slot {
  margin-top: 24px;
}

.ad-slot:empty {
  display: none;
}

.ad-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 88px;
  padding: 12px;
  border: 1px solid #b8dfe5;
  border-radius: 8px;
  background: var(--soft-teal);
  text-decoration: none;
}

.ad-card:hover,
.ad-card:focus-visible {
  border-color: var(--teal);
  outline: 0;
}

.ad-image {
  width: 72px;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  background: #c5e8ed;
}

.ad-label {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
}

.ad-title,
.ad-copy {
  margin: 0;
}

.ad-title {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.ad-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ad-arrow {
  color: var(--teal-dark);
  font-size: 20px;
}

.catalog-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
}

.catalog-status,
.catalog-updated {
  margin: 0;
}

.catalog-status {
  color: var(--muted);
  font-size: 13px;
}

.catalog-updated {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
  text-align: right;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  align-items: stretch;
}

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

.product-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #e7eef4;
}

.product-body {
  display: flex;
  min-height: 216px;
  flex: 1;
  flex-direction: column;
  padding: 15px;
}

.product-category,
.product-title,
.product-subtitle,
.product-meta {
  margin: 0;
}

.product-category {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
}

.product-title {
  margin-top: 6px;
  font-size: 17px;
  line-height: 1.35;
}

.product-subtitle {
  display: -webkit-box;
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.tag {
  padding: 3px 7px;
  border-radius: 4px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 11px;
}

.product-price {
  margin-top: auto;
  padding-top: 15px;
  color: var(--accent-dark);
  font-size: 20px;
  font-weight: 800;
}

.product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.product-actions a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.buy-action {
  background: var(--accent);
  color: #ffffff;
}

.buy-action:hover,
.buy-action:focus-visible {
  background: var(--accent-dark);
  outline: 0;
}

.consult-action {
  border: 1px solid #9ccfd5;
  background: #f3fbfc;
  color: var(--teal-dark);
}

.consult-action:hover,
.consult-action:focus-visible {
  border-color: var(--teal);
  outline: 0;
}

.inline-ad {
  grid-column: 1 / -1;
}

.empty-state {
  margin: 28px 0;
  padding: 32px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
  color: var(--muted);
  font-size: 12px;
}

.footer-inner a {
  color: var(--teal-dark);
  text-decoration: none;
}

@media (min-width: 720px) {
  .catalog-shell {
    padding-top: 42px;
  }

  .catalog-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.9fr);
  }

  .catalog-controls {
    grid-template-columns: minmax(0, 1.55fr) minmax(150px, 0.75fr);
  }

  .ad-card {
    grid-template-columns: 96px minmax(0, 1fr) auto;
    padding: 14px 16px;
  }

  .ad-image {
    width: 96px;
  }
}

@media (max-width: 460px) {
  .header-inner,
  .catalog-shell,
  .footer-inner {
    width: min(100% - 24px, 1180px);
  }

  .catalog-shell {
    padding-top: 24px;
  }

  .ad-card {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .ad-image {
    width: 56px;
  }

  .product-body {
    min-height: 224px;
  }

  .catalog-status-row {
    align-items: flex-start;
  }

  .catalog-updated {
    width: 100%;
    text-align: left;
  }
}
