:root { --table-offset: 0px; }

.admin-bar { --table-offset: 32px; }

.category-nav {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 12px;
}

.category-nav a {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  text-decoration: none;
}

.listing-banner {
  display: block;
  margin: 10px auto 20px;
}

.table-wrap {
  width: 100%;
  margin-top: 12px;
}

.product-table {
  width: 100%;
  border: 1px solid #b9b9b9;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 5px;
  background: #fff;
  text-align: left;
}

.product-table th,
.product-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.table-header th {
  position: sticky;
  top: var(--table-offset);
  z-index: 4;
  border-bottom: 1px solid #a8a8a8;
  background: #ccc;
  color: #000;
  font-weight: 700;
  box-shadow: 0 2px 3px rgb(0 0 0 / 14%);
}

.table-header th:first-child {
  border-top-left-radius: 4px;
}

.table-header th:last-child {
  border-top-right-radius: 4px;
}

.photo-column { width: 110px; }
.credit-column { width: 80px; text-align: center; }
.price-column { width: 130px; }
.year-column { width: 75px; }
.mileage-column { width: 95px; }
.info-column { width: 155px; }

.category-row th {
  padding: 8px 10px;
  scroll-margin-top: calc(var(--table-offset) + 60px);
  border-top: 12px solid #fff;
  border-bottom: 1px solid #aaa;
  background: #d9d9d9;
  color: #000;
  font-size: 18px;
  font-weight: 700;
}

.unit-row { font-size: 16px; }

.unit-row th,
.unit-row td {
  border-bottom: 1px solid #ddd;
}

.unit-row:nth-child(odd) { background: #fafafa; }

.unit-photo { width: 110px; }

.unit-photo img {
  width: 90px;
  height: 60px;
  border-radius: 2px;
  object-fit: cover;
}

.unit-credit {
  width: 80px;
  text-align: center;
}

.unit-credit img {
  width: 36px;
  height: auto;
  margin: auto;
}

.unit-title { font-weight: 400; }
.unit-title a { text-decoration: none; }

.status-image {
  display: inline-block;
  width: auto;
  max-width: 54px;
  max-height: 22px;
  margin-left: 4px;
  vertical-align: top;
}

.is-sold { opacity: 0.78; }
.unit-price { white-space: nowrap; }

.unit-link a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.mobile-label { display: none; }

@media (max-width: 900px) {
  .category-nav {
    justify-content: flex-start;
    margin-block: 16px;
  }

  .product-table,
  .product-table tbody {
    display: block;
    border: 0;
  }

  .table-header {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .category-row {
    display: block;
    margin-top: 18px;
  }

  .category-row th {
    display: block;
    padding: 7px 10px;
    border: 0;
  }

  .unit-row {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 2px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .product-table td,
  .unit-title {
    display: block;
    padding: 0;
    border: 0;
  }

  .unit-photo {
    grid-column: 1;
    grid-row: 1 / 6;
    width: 100%;
  }

  .unit-photo img {
    width: 100px;
    height: 75px;
  }

  .unit-title,
  .unit-credit,
  .unit-price,
  .unit-year,
  .unit-mileage,
  .unit-link {
    grid-column: 2;
    width: auto;
    text-align: left;
  }

  .unit-credit img { margin: 4px 0; }
  .unit-title { overflow-wrap: anywhere; }
  .unit-year, .unit-mileage { font-size: 0.9rem; }
  .mobile-label { display: inline; color: var(--muted); }
}

@media (max-width: 782px) {
  .admin-bar { --table-offset: 46px; }
}

@media (max-width: 420px) {
  .unit-row {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 2px 10px;
  }

  .unit-photo img {
    width: 84px;
    height: 63px;
  }
}
