:root {
  color-scheme: light;
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-alt: #f5f5f4;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e7e5e4;
  --primary: #18181b;
  --primary-dark: #000000;
  --accent: #18181b;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.04);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Klara', 'Plus Jakarta Sans', Inter, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  position: relative;
  flex: 1 0 auto;
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 0 48px;
}

.app-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 16px 24px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 12px;
  text-align: center;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 10px 24px;
  background: rgba(250, 250, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.header-logo {
  width: auto;
  height: 26px;
  max-width: 56px;
  flex: 0 0 auto;
  object-fit: contain;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 0;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  padding: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.filter-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-block: 8px;
}

.filters .bar-button,
.compact-toggle {
  margin-block: 8px;
}

.filter-brand,
.filter-category,
.filter-site-filter,
.filter-sort {
  flex: 1 1 150px;
}

.filter-field select {
  flex: 1;
  font-size: 12px;
}

.combobox {
  position: relative;
  flex: 1;
  min-width: 0;
}

.combobox-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 52px 8px 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.combobox-trigger:hover {
  background: var(--surface-alt);
}

.combobox-trigger:focus-visible {
  outline: none;
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}

.combobox-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-trigger svg {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--muted);
  transform: translateY(-50%);
}

.combobox-clear {
  position: absolute;
  right: 30px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  transform: translateY(-50%);
  cursor: pointer;
}

.combobox-clear:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.combobox-clear svg {
  position: static;
  width: 12px;
  height: 12px;
  transform: none;
}

.combobox-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(24, 24, 27, 0.12);
}

.combobox-search {
  width: 100%;
  padding: 7px 9px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
}

.combobox-options {
  display: block;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
}

.combobox-option {
  display: block;
  width: 100%;
  padding: 7px 9px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.combobox-option:hover,
.combobox-option:focus-visible {
  outline: none;
  background: var(--surface-alt);
}

.combobox-option[aria-selected="true"] {
  font-weight: 700;
}

.combobox-empty {
  display: block;
  padding: 8px 9px;
  color: var(--muted);
  font-size: 12px;
}

.compact-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 11px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.compact-toggle:hover {
  background: var(--surface-alt);
}

.compact-toggle[aria-pressed="true"] {
  background: var(--surface-alt);
  border-color: #a1a1aa;
}

.compact-toggle svg {
  display: block;
  width: 15px;
  height: 15px;
}

.clear-all {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  margin-block: 8px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.clear-all:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.clear-all svg {
  display: block;
  width: 14px;
  height: 14px;
}

.result-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.field-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-left: 10px;
  color: var(--muted);
}

.field-reference {
  flex: 1 1 320px;
}

.field-brand {
  flex: 0 1 170px;
}

.field-site {
  flex: 0 1 150px;
}

.field > input,
.field > select {
  flex: 1;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  appearance: none;
}

input::placeholder {
  color: #a1a1aa;
}

input:hover,
select:hover {
  background: var(--surface-alt);
}

input:focus,
select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}

.bar-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bar-button svg {
  display: block;
  width: 18px;
  height: 18px;
}

.bar-button.is-busy svg {
  animation: spin 0.9s linear infinite;
}

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

.bar-button:hover {
  background: var(--surface);
  border-color: #d4d4d8;
}

.bar-button:focus-visible {
  outline: 3px solid rgba(24, 24, 27, 0.12);
  outline-offset: 1px;
}

.bar-button[aria-pressed="true"] {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--ink);
}

.bar-button-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.bar-button-primary:hover {
  color: #fff;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.bar-button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status.is-error {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: calc(100% - 28px);
  height: auto;
  padding: 9px 13px;
  margin: 0;
  overflow: visible;
  color: #fff;
  background: var(--danger);
  border-radius: 8px;
  font-size: 13px;
  clip: auto;
  transform: translateX(-50%);
  white-space: normal;
}

.results {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  margin-top: 18px;
}

.results.results-list {
  grid-template-columns: 1fr;
  gap: 8px;
}

.results.results-list .product-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 4px 12px;
}

.results.results-list .card-image {
  grid-row: 1 / span 3;
  height: 60px;
  padding: 4px;
}

.results.results-list .card-footer {
  grid-column: 2;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.product-card:hover,
.product-card:focus-visible {
  border-color: #a1a1aa;
  transform: translateY(-1px);
  outline: none;
}

.card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 118px;
  padding: 8px;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: 8px;
}

.card-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.card-image.placeholder::after {
  color: var(--muted);
  content: "Image indisponible";
  font-size: 11px;
}

.card-reference {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.card-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.card-brand img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  object-position: center;
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
}

.card-price {
  color: var(--accent);
  font-weight: 650;
}

.card-site {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-transform: capitalize;
}

.card-site svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  gap: 10px;
  min-height: 180px;
  padding: 32px 16px;
  text-align: center;
}

.state-container svg {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.state-title {
  font-size: 14px;
  font-weight: 650;
}

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

.loader {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}

body.is-compact .app {
  width: min(1600px, calc(100% - 20px));
}

body.is-compact .results {
  gap: 8px;
  margin-top: 10px;
}

body.is-compact .product-card {
  gap: 4px;
  padding: 6px;
  border-radius: 9px;
}

body.is-compact .card-image {
  height: 58px;
  padding: 4px;
  border-radius: 6px;
}

body.is-compact .card-image.placeholder::after {
  font-size: 9px;
}

body.is-compact .card-reference {
  font-size: 10.5px;
}

body.is-compact .card-brand {
  min-height: 15px;
  gap: 4px;
  font-size: 9.5px;
}

body.is-compact .card-brand img {
  width: 14px;
  height: 14px;
}

body.is-compact .card-title {
  -webkit-line-clamp: 1;
  font-size: 9px;
  line-height: 1.2;
}

body.is-compact .card-footer {
  padding-top: 4px;
  font-size: 9px;
}

body.is-compact .card-site {
  font-size: 9px;
}

body.is-compact .card-site svg {
  width: 10px;
  height: 10px;
}

.filters-fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(24, 24, 27, 0.28);
  cursor: pointer;
}

.filters-fab svg {
  width: 22px;
  height: 22px;
}

.filters-fab-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: #fff;
  background: var(--primary);
  border: 2px solid var(--surface);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.filters-backdrop {
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(24, 24, 27, 0.32);
  backdrop-filter: blur(2px);
}

.filters-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 39;
  max-height: 82vh;
  overflow: hidden;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -16px 40px rgba(24, 24, 27, 0.16);
  animation: drawer-up 0.18s ease-out;
}

@keyframes drawer-up {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}

.filters-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
}

.filters-drawer-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.filters-drawer-body {
  max-height: calc(82vh - 58px);
  overflow-y: auto;
  padding: 0 18px 24px;
}

.filters-drawer .filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  background: transparent;
  border-bottom: 0;
}

.filters-drawer .filter-field {
  margin-block: 0;
}

.filters-drawer .filters .bar-button,
.filters-drawer .compact-toggle,
.filters-drawer .clear-all {
  justify-self: stretch;
  width: 100%;
}

.filters-drawer .compact-toggle {
  justify-content: center;
}

.filters-drawer .result-count {
  justify-self: start;
}

body.filters-open .filters-fab,
body.detail-open .filters-fab {
  display: none;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(24, 24, 27, 0.28);
  backdrop-filter: blur(2px);
}

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  width: min(520px, 100%);
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-radius: 18px 0 0 18px;
  box-shadow: -18px 0 60px rgba(24, 24, 27, 0.1);
  animation: detail-in 0.18s ease-out;
}

@keyframes detail-in {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.detail-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  word-break: break-word;
}

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

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.detail-body {
  padding: 24px;
}

.detail-hero {
  display: grid;
  gap: 14px;
}

.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.detail-brand img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  object-position: center;
}

.detail-category {
  color: var(--muted);
  font-size: 11px;
}

.detail-title {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.detail-price-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.detail-price {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.detail-availability {
  color: var(--muted);
  font-size: 11px;
}

.detail-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  padding: 16px;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: 10px;
}

.detail-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.detail-image.placeholder::after {
  color: var(--muted);
  content: "Image indisponible";
  font-size: 12px;
}

.detail-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-description {
  margin: 0;
  color: #3f3f46;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-line;
}

.attributes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px 14px;
  margin: 0;
  font-size: 12px;
}

.attributes dt {
  color: var(--muted);
  font-size: 11px;
}

.attributes dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
}

.chip img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  object-position: center;
}

.detail-link {
  display: inline-block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 1300px) {
  .results {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 8px;
  }

  .filters .bar-button,
  .compact-toggle,
  .clear-all {
    justify-self: start;
  }

  .result-count {
    justify-self: end;
  }

  .results {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-header {
    flex-wrap: nowrap;
    padding: 10px 16px;
  }

  .search-bar {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .field-reference {
    flex: 1 1 auto;
    min-width: 0;
  }

  .search-bar .bar-button {
    flex: 0 0 34px;
  }

  .results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app > .filters {
    display: none;
  }

  .filters-fab:not([hidden]) {
    display: grid;
  }

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

  .result-count {
    justify-self: start;
  }

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

@media (max-width: 620px) {
  .app-header {
    gap: 6px;
    padding: 8px 10px;
  }

  .header-logo {
    height: 20px;
    max-width: 34px;
  }

  .search-bar {
    gap: 5px;
  }

  .search-bar .bar-button {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }

  .field-reference input {
    padding: 8px 9px;
  }

  .detail {
    border-radius: 0;
  }

  .detail-body,
  .detail-header {
    padding: 18px;
  }
}

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

  .filters .bar-button,
  .compact-toggle,
  .clear-all {
    justify-self: stretch;
    width: 100%;
  }

  .compact-toggle {
    justify-content: center;
  }

  .result-count {
    grid-column: auto;
    justify-self: start;
  }
}

@media (max-width: 420px) {
  .app {
    width: calc(100% - 16px);
  }

  .app-header {
    gap: 6px;
    padding: 7px 8px;
  }

  .header-logo {
    height: 18px;
    max-width: 28px;
  }

  .search-bar .bar-button {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
  }

  .field-reference input {
    padding: 7px 8px;
  }

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