:root {
  color-scheme: light;
  --ink: #1b1d1f;
  --muted: #667078;
  --line: #d9dee2;
  --paper: #f7f5ef;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-2: #b42318;
  --wash: #eef6f3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
}

.summary {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

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

.summary button {
  padding: 0 14px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 18px 0;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}

input {
  min-height: 40px;
  padding: 0 12px;
}

select {
  min-height: 40px;
  padding: 0 36px 0 12px;
}

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

.card {
  min-width: 0;
}

.flip {
  position: relative;
  height: 420px;
  transform-style: preserve-3d;
  transition: transform 180ms ease;
}

.card.is-flipped .flip {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backface-visibility: hidden;
}

.front {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(96px, auto);
}

.back {
  padding: 18px;
  transform: rotateY(180deg);
}

.imageWrap {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: 0;
  place-items: center;
  background: var(--wash);
}

.imageWrap img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.placeholder {
  display: none;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.imageWrap.is-missing img {
  display: none;
}

.imageWrap.is-missing .placeholder {
  display: grid;
}

.imageCount {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(27, 29, 31, 0.74);
  color: #fff;
  font-size: 12px;
}

.cardMeta {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  min-height: 96px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.supplier,
.colour {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.colour {
  color: var(--accent-2);
}

.name {
  min-height: 40px;
  font-size: 15px;
  line-height: 1.25;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.35;
}

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

.actions button {
  width: 100%;
}

.empty {
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

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

  .topbar {
    display: grid;
    align-items: start;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  h1 {
    font-size: 28px;
  }

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