.hwg-affiliate-products__grid,
.hwg-products {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
}

.hwg-affiliate-products__grid > .hwg-product-card,
.hwg-products > .hwg-product,
.hwg-acm-card-shell > .hwg-product-card,
.hwg-acm-card-shell > .hwg-product {
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: 72px minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-items: center !important;
  gap: 6px 10px !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 108px !important;
  margin: 0 !important;
  padding: 10px !important;
  overflow: hidden !important;
  border: 1px solid #dfe4df !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: #253026 !important;
  text-decoration: none !important;
}

/* WordPress can insert line-break nodes between card elements. Without this
 * guard those nodes become extra CSS-grid rows and make an otherwise compact
 * card several hundred pixels tall. */
.hwg-product-card > br,
.hwg-product > br {
  display: none !important;
}

.hwg-product-card img,
.hwg-product img {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  display: block !important;
  width: 72px !important;
  height: 72px !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  background: #fff !important;
}

.hwg-product-card > span:not(.hwg-product-card__button),
.hwg-product > span:not(.hwg-buy) {
  grid-column: 2 !important;
  min-width: 0 !important;
}

.hwg-product-card__title,
.hwg-product > strong {
  display: block !important;
  margin: 0 0 3px !important;
  color: #10822b !important;
  font-weight: 700 !important;
  line-height: 1.18 !important;
}

.hwg-product-card__description {
  display: block !important;
  color: #273127 !important;
  font-size: 13px !important;
  line-height: 1.38 !important;
}

.hwg-product-card__button,
.hwg-buy {
  grid-column: 2 !important;
  justify-self: start !important;
  align-self: end !important;
  margin: 2px 0 0 !important;
}

.hwg-acm-card-shell {
  position: relative;
  display: flex;
  min-width: 0;
}

.hwg-acm-card-shell > .hwg-product-card,
.hwg-acm-card-shell > .hwg-product {
  flex: 1 1 auto;
}

.hwg-acm-edit,
.hwg-acm-grid-tools button {
  border: 1px solid #185f29;
  border-radius: 999px;
  background: #fff;
  color: #185f29;
  font: 600 12px/1.2 system-ui, sans-serif;
  cursor: pointer;
}

.hwg-acm-edit {
  position: absolute;
  z-index: 3;
  top: auto;
  bottom: 7px;
  right: 7px;
  padding: 4px 7px;
  box-shadow: 0 2px 9px rgb(0 0 0 / 12%);
}

.hwg-acm-grid-tools {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px dashed #6c9d75;
  border-radius: 9px;
  background: #f5fbf6;
}

.hwg-acm-grid-tools button { padding: 7px 12px; }

.hwg-acm-modal[hidden] { display: none !important; }
.hwg-acm-modal {
  position: fixed;
  z-index: 1000000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 58%);
}
.hwg-acm-dialog {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 70px rgb(0 0 0 / 35%);
  color: #1f2b21;
}
.hwg-acm-dialog h2 { margin-top: 0; }
.hwg-acm-dialog label { display: block; margin: 12px 0 4px; font-weight: 700; }
.hwg-acm-dialog input,
.hwg-acm-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #aeb9b0;
  border-radius: 7px;
  font: inherit;
}
.hwg-acm-dialog textarea { min-height: 72px; resize: vertical; }
.hwg-acm-dialog__actions { display: flex; gap: 10px; margin-top: 16px; }
.hwg-acm-dialog__actions button { padding: 9px 15px; border-radius: 7px; cursor: pointer; }
.hwg-acm-save { border: 1px solid #147a2b; background: #147a2b; color: #fff; }
.hwg-acm-cancel { border: 1px solid #9aa39b; background: #fff; color: #253026; }
.hwg-acm-message { min-height: 1.4em; margin-top: 10px; color: #8a231e; }

@media (max-width: 700px) {
  .hwg-affiliate-products__grid,
  .hwg-products { grid-template-columns: minmax(0, 1fr) !important; }
  .hwg-affiliate-products__grid > .hwg-product-card,
  .hwg-products > .hwg-product,
  .hwg-acm-card-shell > .hwg-product-card,
  .hwg-acm-card-shell > .hwg-product {
    grid-template-columns: 64px minmax(0, 1fr) !important;
    min-height: 102px !important;
    padding: 9px !important;
  }
  .hwg-product-card img,
  .hwg-product img { width: 64px !important; height: 64px !important; }
}
