.factory-directory {
  padding: 34px 0 72px;
  background: #fbfaf6;
}

.filter-panel {
  overflow: hidden;
  border: 1px solid #e2ded3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(11, 32, 57, .05);
}

.filter-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 17px 20px;
}

.filter-row + .filter-row {
  border-top: 1px solid #ece8de;
}

.filter-row > strong {
  padding-top: 7px;
  color: #17283a;
  font-size: 14px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #54606c;
  font-size: 13px;
  font-weight: 650;
  transition: .18s ease;
}

.filter-chip:hover {
  color: #0b2039;
  border-color: #d8ca9e;
  background: #faf6e9;
}

.filter-chip.active {
  color: #fff;
  border-color: #0b2039;
  background: #0b2039;
  box-shadow: 0 5px 14px rgba(11, 32, 57, .16);
}

.factory-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 24px 2px 18px;
}

.factory-toolbar > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.factory-toolbar > div strong {
  color: #0b2039;
  font-size: 20px;
}

.factory-toolbar > div span {
  color: #7b838b;
  font-size: 13px;
}

.sort-form {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #67717b;
  font-size: 13px;
}

.sort-form select {
  min-height: 40px;
  padding: 0 34px 0 13px;
  border: 1px solid #d9d5ca;
  border-radius: 10px;
  background: #fff;
  color: #1c2936;
  font: inherit;
}

.reset-filter {
  padding: 8px 11px;
  color: #8a6718;
  font-weight: 700;
}

.factory-grid {
  align-items: stretch;
}

.factory-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.factory-card.is-preferred {
  border-color: #dfc26c;
  background: linear-gradient(155deg, #fffdf5 0%, #fff 55%);
  box-shadow: 0 18px 44px rgba(120, 88, 20, .11);
}

.factory-card-media {
  position: relative;
  min-height: 180px;
  background: linear-gradient(145deg, #e9eef1, #dbe3e7);
}

.factory-card-media .thumb {
  height: 180px;
  margin: 0;
  border-radius: 0;
}

.factory-placeholder {
  height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #102a46, #25516f);
  color: #fff;
}

.factory-placeholder span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 18px;
  background: rgba(255, 255, 255, .1);
  font: 700 28px Georgia, "Songti SC", serif;
}

.factory-placeholder small {
  color: #cbd7e1;
  letter-spacing: .12em;
}

.factory-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px 21px 18px;
}

.factory-status {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.factory-region {
  margin-left: auto;
  color: #707984;
  font-size: 12px;
}

.factory-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.factory-badge.preferred {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  color: #392703;
  background: linear-gradient(135deg, #f7d978, #d5a72f);
  box-shadow: 0 8px 24px rgba(94, 65, 5, .22);
}

.factory-badge.verified {
  color: #166247;
  background: #e6f5ee;
}

.factory-badge.source {
  color: #795914;
  background: #f7efd7;
}

.factory-card h3 {
  margin: 10px 0 12px;
  color: #142438;
  font-size: 20px;
}

.factory-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.factory-tags span {
  max-width: 100%;
  overflow: hidden;
  padding: 5px 9px;
  border-radius: 8px;
  background: #f2f4f5;
  color: #53616e;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.factory-card p {
  margin: 0 0 15px;
}

.factory-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #ece8de;
  font-size: 12px;
}

.factory-card-foot span {
  color: #7b838b;
}

.factory-card-foot strong {
  color: #173e63;
}

.factory-empty {
  grid-column: 1 / -1;
}

.factory-empty h2 {
  margin-top: 0;
  font-size: 25px;
}

.factory-empty .btn {
  display: inline-flex;
  margin-top: 10px;
}

@media (max-width: 760px) {
  .factory-directory {
    padding-top: 22px;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
  }

  .filter-row > strong {
    padding-top: 0;
  }

  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    flex: 0 0 auto;
  }

  .factory-toolbar,
  .factory-toolbar > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .factory-toolbar {
    padding: 20px 0 16px;
  }

  .sort-form {
    width: 100%;
  }

  .sort-form select {
    flex: 1;
  }
}
