:root {
  color-scheme: light;
  --ink: #162033;
  --ink-soft: #314158;
  --sky: #1d4ed8;
  --sky-soft: #e9f1ff;
  --mint: #0f8a5f;
  --mint-soft: #ecfbf5;
  --sand: #fff8e8;
  --warn: #b54708;
  --danger: #c4320a;
  --danger-soft: #fff3ef;
  --line: #dde4ee;
  --muted: #66758b;
  --surface: rgba(255, 255, 255, 0.92);
  --canvas: #f3f7fb;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 138, 95, 0.1), transparent 28%),
    linear-gradient(180deg, #f7fbff 0%, var(--canvas) 32%, #eef3f8 100%);
}

button, input, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(22, 32, 51, 0.86);
  color: white;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.topbar-inner {
  max-width: 1240px;
  height: 68px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 18px rgba(9, 14, 25, 0.25);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.header-status {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #dde7f5;
  font-size: 13px;
  font-weight: 600;
}

.header-status strong {
  color: white;
  font-size: 13px;
  font-weight: 700;
}

.header-timezone {
  color: #b8c7da;
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #57e389;
  box-shadow: 0 0 0 5px rgba(87, 227, 137, 0.12);
}

.page-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.intro {
  display: block;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--sky);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.03;
  letter-spacing: -0.05em;
  font-weight: 700;
}

.subtitle {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.7;
}

.top-picks {
  display: grid;
  gap: 14px;
}

.filter-panel,
.results-card {
  border: 1px solid rgba(189, 198, 211, 0.55);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-panel,
.results-card {
  border-radius: 22px;
}

.filter-panel {
  padding: 20px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.field > span,
.filter-label {
  display: block;
  margin-bottom: 8px;
  color: #42526a;
  font-size: 12px;
  font-weight: 700;
}

.input-wrap,
select {
  height: 46px;
  border: 1px solid #ccd6e3;
  border-radius: 14px;
  background: white;
}

.input-wrap {
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-wrap:focus-within,
select:focus {
  border-color: #8bb4ff;
  box-shadow: 0 0 0 4px rgba(95, 147, 255, 0.12);
}

.input-wrap span {
  color: #9aa7b8;
  font-size: 20px;
}

input[type="search"] {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

select {
  width: 100%;
  padding: 0 38px 0 12px;
  color: var(--ink);
  outline: 0;
}

.switch-field {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  width: 42px;
  height: 24px;
  padding: 2px;
  border-radius: 999px;
  background: #cdd6e1;
  transition: 0.18s;
}

.switch::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.2);
  transition: 0.18s;
}

.switch-field input:checked + .switch { background: var(--sky); }
.switch-field input:checked + .switch::after { transform: translateX(18px); }

.product-filter {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #edf2f8;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-label { margin: 0 4px 0 0; }

.product-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-chip input { position: absolute; opacity: 0; }

.product-chip span {
  display: block;
  padding: 8px 12px;
  border: 1px solid #d6deea;
  border-radius: 999px;
  background: white;
  color: #46576d;
  font-size: 12px;
  font-weight: 600;
  transition: 0.16s;
}

.product-chip input:checked + span {
  border-color: #bcd2ff;
  background: var(--sky-soft);
  color: #1447a6;
}

.reset-button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--sky);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.section-head h2,
.results-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.section-head p,
.results-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.pick-card,
.mobile-store-card {
  border: 1px solid #e3e9f1;
  border-radius: 18px;
  background: white;
}

.pick-card {
  padding: 18px;
}

.pick-head,
.mobile-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.pick-title,
.mobile-card-title {
  margin: 0;
  font-size: 16px;
}

.pick-subtitle,
.mobile-card-subtitle,
.pick-meta,
.mobile-card-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pick-rank {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
}

.pick-stats,
.mobile-card-stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pick-stat,
.mobile-stat {
  padding: 10px;
  border-radius: 14px;
  background: #f8fbff;
}

.pick-stat strong,
.mobile-stat strong {
  display: block;
  font-size: 18px;
}

.pick-stat span,
.mobile-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.pick-product-list,
.mobile-card-products {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.pick-product,
.mobile-product {
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pick-product > :first-child,
.mobile-product > :first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.mobile-product-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.mobile-product-link {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid #d6deea;
  background: white;
  color: var(--sky);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.mobile-product-link:active,
.mobile-product-link:hover {
  border-color: #bcd2ff;
  background: var(--sky-soft);
}

.product-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.product-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.availability {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.availability::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.availability.in { color: var(--mint); }
.availability.out { color: var(--danger); }
.availability.unknown { color: #7b8898; }

.results-card {
  margin-top: 18px;
  overflow: hidden;
}

.results-head {
  min-height: 78px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.loading-state {
  color: var(--muted);
  font-size: 12px;
}

.loading-state.ready { color: var(--mint); }
.loading-state.error { color: var(--danger); }

.retailer-tabs {
  padding: 14px 18px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.retailer-tab {
  border: 1px solid #d7deea;
  background: #f8fafc;
  color: #344054;
  border-radius: 999px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.retailer-tab.active {
  border-color: #bcd2ff;
  background: var(--sky-soft);
  color: #1447a6;
}

.retailer-tab-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
}

.mobile-store-cards {
  display: none;
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  padding: 12px 16px;
  text-align: left;
  color: #66758b;
  background: #f7fafe;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

th:not(.store-column) { width: 21%; }
.store-column { width: 37%; }

td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #edf2f7;
}

tbody tr:hover { background: #fbfdff; }
tbody tr:last-child td { border-bottom: 0; }

.store-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.store-address {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.stock-cell {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stock-main { min-width: 0; }

.stock-meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #66758b;
  font-size: 11px;
}

.price {
  color: #344054;
  font-weight: 600;
}

.product-link {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #475467;
  background: #f2f5f9;
  text-decoration: none;
  font-size: 14px;
}

.product-link:hover {
  color: var(--sky);
  background: var(--sky-soft);
}

.empty-state {
  padding: 54px 20px;
  display: grid;
  place-items: center;
  gap: 6px;
  color: var(--muted);
}

.empty-state strong { color: var(--ink-soft); }

.pagination {
  min-height: 62px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.pagination button {
  padding: 9px 14px;
  border: 1px solid #cfd7e3;
  border-radius: 10px;
  color: #344054;
  background: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.pagination button:hover:not(:disabled) {
  border-color: #9aabc2;
  background: #f9fbfd;
}

.pagination button:disabled {
  opacity: 0.42;
  cursor: default;
}

#page-info {
  color: var(--muted);
  font-size: 12px;
}

footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 28px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #8d99aa;
  font-size: 11px;
}

@media (max-width: 1080px) {
}

@media (max-width: 900px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .switch-field {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .topbar-inner,
  .page-shell,
  footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .pick-stats,
  .mobile-card-stats {
    grid-template-columns: 1fr;
  }

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

  .reset-button {
    margin-left: 0;
    padding-left: 0;
  }

  .table-scroll {
    display: none;
  }

  .header-status {
    gap: 6px;
    font-size: 12px;
  }

  .mobile-store-cards {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  .retailer-tabs {
    padding: 14px 14px 0;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .retailer-tab {
    flex: 0 0 auto;
  }

  .mobile-store-card {
    padding: 16px;
  }

  .results-head {
    align-items: start;
    flex-direction: column;
  }

  .pick-product,
  .mobile-product {
    align-items: stretch;
    flex-direction: column;
  }

  .mobile-product-side {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
  }

  footer {
    flex-direction: column;
  }
}
