.evy-affiliate-products__grid,
.evy-products {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
}

.evy-affiliate-products__grid > .evy-product-card,
.evy-products > .evy-product,
.evy-acm-card-shell > .evy-product-card,
.evy-acm-card-shell > .evy-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. */
.evy-product-card > br,
.evy-product > br {
  display: none !important;
}

.evy-product-card img,
.evy-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;
}

.evy-product-card > span:not(.evy-product-card__button),
.evy-product > span:not(.evy-buy) {
  grid-column: 2 !important;
  min-width: 0 !important;
}

.evy-product-card__title,
.evy-product > strong {
  display: block !important;
  margin: 0 0 3px !important;
  color: #10822b !important;
  font-weight: 700 !important;
  line-height: 1.18 !important;
}

/* Older cards nested the title inside the description with no separating
 * whitespace. This scoped fallback remains readable even before JS finishes
 * normalizing that legacy structure. */
.evy-product-card__description > strong:first-child {
  display: block !important;
  margin: 0 0 3px !important;
  color: #10822b !important;
  font-weight: 700 !important;
  line-height: 1.18 !important;
}

.evy-product-card__description {
  display: block !important;
  color: #273127 !important;
  font-size: 13px !important;
  line-height: 1.38 !important;
}

.evy-product-card__button,
.evy-buy {
  grid-column: 2 !important;
  justify-self: start !important;
  align-self: end !important;
  margin: 2px 0 0 !important;
}

.evy-acm-card-shell {
  position: relative;
  display: flex;
  min-width: 0;
}

.evy-acm-card-shell > .evy-product-card,
.evy-acm-card-shell > .evy-product {
  flex: 1 1 auto;
}

.evy-acm-edit,
.evy-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;
}

.evy-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%);
}

.evy-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;
}

.evy-acm-grid-tools button { padding: 7px 12px; }

.evy-acm-modal[hidden] { display: none !important; }
.evy-acm-modal {
  position: fixed;
  z-index: 1000000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 58%);
}
.evy-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;
}
.evy-acm-dialog h2 { margin-top: 0; }
.evy-acm-dialog label { display: block; margin: 12px 0 4px; font-weight: 700; }
.evy-acm-dialog input,
.evy-acm-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #aeb9b0;
  border-radius: 7px;
  font: inherit;
}
.evy-acm-dialog textarea { min-height: 72px; resize: vertical; }
.evy-acm-dialog__actions { display: flex; gap: 10px; margin-top: 16px; }
.evy-acm-dialog__actions button { padding: 9px 15px; border-radius: 7px; cursor: pointer; }
.evy-acm-save { border: 1px solid #147a2b; background: #147a2b; color: #fff; }
.evy-acm-cancel { border: 1px solid #9aa39b; background: #fff; color: #253026; }
.evy-acm-message { min-height: 1.4em; margin-top: 10px; color: #8a231e; }

@media (max-width: 700px) {
  .evy-affiliate-products__grid,
  .evy-products { grid-template-columns: minmax(0, 1fr) !important; }
  .evy-affiliate-products__grid > .evy-product-card,
  .evy-products > .evy-product,
  .evy-acm-card-shell > .evy-product-card,
  .evy-acm-card-shell > .evy-product {
    grid-template-columns: 64px minmax(0, 1fr) !important;
    min-height: 102px !important;
    padding: 9px !important;
  }
  .evy-product-card img,
  .evy-product img { width: 64px !important; height: 64px !important; }
}

/* Section wrapper, matching HWGrow article product rows */
.evy-affiliate-products{margin:1.5rem 0;padding:1rem 0;border-top:1px solid #e3e7e3;border-bottom:1px solid #e3e7e3}
.evy-affiliate-products__disclosure{margin:10px 0 0;color:#5a615a;font-size:12px;line-height:1.45}
.evy-affiliate-products__grid>.evy-product-card:only-child{grid-column:1/-1}
.evy-affiliate-products .evy-product-card:not(:has(img)){grid-template-columns:minmax(0,1fr)!important}
.evy-affiliate-products .evy-product-card:not(:has(img))>span{grid-column:1!important}
.evy-product-card__button{display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:6px 12px;border-radius:999px;background:#247a2e;color:#fff!important;font-size:12px;font-weight:800;line-height:1;letter-spacing:.02em;text-transform:uppercase}
.evy-product-card:hover .evy-product-card__button{background:#16571d}
.evy-product-card:hover{border-color:#7cad80!important;box-shadow:0 2px 10px rgba(24,80,32,.08)}
.atbs-dark-mode .evy-affiliate-products{border-color:#435448}
.atbs-dark-mode .evy-affiliate-products .evy-product-card{background:#202822!important;border-color:#435448!important;color:#f5f7f5!important}
.atbs-dark-mode .evy-product-card__title{color:#f5f7f5!important}
.atbs-dark-mode .evy-product-card__description{color:#d4dfd5!important}
.atbs-dark-mode .evy-product-card__button{background:#2d861b}
