:root {
  color-scheme: light;
  --ink: #111827;
  --soft-ink: #263244;
  --muted: #667085;
  --line: #d9e0e8;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --page: #eef3f7;
  --teal: #08756f;
  --blue: #3157d5;
  --amber: #af6b16;
  --rose: #b4234b;
  --mint: #e7f8f3;
  --wash: #f6f7f2;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f7fafc 0%, var(--page) 430px),
    var(--page);
}

a { color: inherit; }

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(260px, 1fr);
  gap: 24px;
  align-items: center;
  padding: 18px 30px;
  border-bottom: 1px solid rgba(217, 224, 232, 0.82);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: white;
  font-weight: 840;
  background: linear-gradient(135deg, #111827 0%, #08756f 55%, #3157d5 100%);
  box-shadow: 0 10px 22px rgba(8, 117, 111, 0.18);
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.search-wrap input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  outline: none;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
}

.search-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.12);
}

.layout {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: calc(100vh - 84px);
}

.sidebar {
  position: sticky;
  top: 84px;
  height: calc(100vh - 84px);
  overflow: auto;
  padding: 26px 18px 34px 30px;
  border-right: 1px solid rgba(217, 224, 232, 0.9);
  background: rgba(255, 255, 255, 0.72);
}

.sidebar section + section { margin-top: 26px; }

.sidebar h2 {
  margin-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .08em;
}

.filter-stack {
  display: grid;
  gap: 8px;
}

.filter-stack.compact {
  max-height: 346px;
  overflow: auto;
  padding-right: 4px;
}

.filter-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 39px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--soft-ink);
  background: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.filter-button:hover {
  border-color: #b9c4d1;
  background: #fff;
}

.filter-button[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--mint);
  color: #084c47;
}

.filter-count {
  color: var(--muted);
  font-size: 12px;
}

.catalog {
  min-width: 0;
  padding: 26px 30px 52px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-band > div {
  min-height: 78px;
  padding: 15px 16px;
  border: 1px solid rgba(217, 224, 232, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
}

.stat {
  display: block;
  font-size: 27px;
  line-height: 1;
  font-weight: 840;
}

.stat-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

.toolbar select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--soft-ink);
  background: white;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid rgba(217, 224, 232, 0.92);
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.03);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card:hover {
  border-color: #c2ccd8;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  background: #eef2f6;
  cursor: pointer;
}

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

.placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: white;
  font-size: 12px;
  font-weight: 760;
  background: var(--blue);
}

.pill.fragrance { background: var(--teal); }
.pill.wellness { background: var(--amber); }
.pill.status { background: #334155; }
.pill.unavailable { background: var(--rose); }
.pill.restocking, .pill.inbound { background: var(--blue); }
.pill.low-stock { background: var(--amber); }

.card .pill {
  position: absolute;
  top: 10px;
  left: 10px;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.13);
}

.price-pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 0 11px;
  color: white;
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.18);
  font-size: 17px;
  font-weight: 840;
}

.sale-pill {
  position: absolute;
  right: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 9px;
  color: white;
  background: #b4234b;
  box-shadow: 0 10px 22px rgba(180, 35, 75, 0.22);
  font-size: 12px;
  font-weight: 840;
}

.price-line s,
.detail-price-row s {
  color: var(--muted);
  text-decoration-thickness: 2px;
}

.card-body {
  display: grid;
  gap: 11px;
  align-content: start;
  padding: 13px;
}

.eyebrow {
  min-height: 16px;
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.card-title {
  min-height: 44px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 780;
}

.price-line {
  display: grid;
  gap: 4px;
  min-height: 42px;
  border-top: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;
  padding: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.price-line span:first-child {
  color: var(--soft-ink);
  font-weight: 740;
}

.meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.badge {
  color: var(--rose);
  font-size: 12px;
  font-weight: 760;
}

.open-button {
  min-height: 34px;
  min-width: 64px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.open-button:hover {
  background: #253043;
}

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

.dialog {
  width: min(1040px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  font-weight: 800;
  z-index: 2;
}

.detail {
  display: grid;
  grid-template-columns: minmax(292px, 430px) 1fr;
  gap: 24px;
  padding: 24px;
}

.detail-media {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f6;
}

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

.detail-content {
  min-width: 0;
  padding-right: 36px;
}

.detail h2 {
  margin: 9px 0 12px;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: 0;
}

.detail-price-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-price-row div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--wash);
}

.detail-price-row span,
.detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.detail-price-row strong {
  display: block;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.1;
}

.detail-summary {
  color: var(--muted);
  line-height: 1.55;
}

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

.detail-grid div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.detail ul {
  margin: 12px 0 0;
  padding-left: 18px;
  line-height: 1.55;
}

.detail h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .08em;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.source-list a,
.source-list span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--ink);
  background: white;
  font-size: 12px;
  text-decoration: none;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: white;
  font-size: 13px;
}

.footer strong {
  color: var(--ink);
  margin-right: 8px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 1080px) {
  .summary-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

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

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar section + section { margin-top: 0; }

  .catalog {
    padding: 16px 14px 36px;
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .detail-content {
    padding-right: 0;
  }

  .footer {
    display: grid;
  }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

  h1 { font-size: 19px; }

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

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

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

  .card-body {
    padding: 10px;
  }

  .card-title {
    font-size: 13px;
    min-height: 54px;
  }

  .price-pill {
    min-height: 30px;
    font-size: 14px;
    padding: 0 9px;
  }

  .sale-pill {
    min-height: 24px;
    font-size: 11px;
    padding: 0 8px;
  }

  .price-line {
    min-height: 46px;
    font-size: 11px;
  }

  .meta {
    font-size: 11px;
  }

  .summary-band > div {
    min-height: 66px;
  }

  .stat {
    font-size: 22px;
  }

  .detail {
    padding: 14px;
  }

  .detail h2 {
    font-size: 21px;
  }

  .detail-price-row,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
