/* Animal catalog: readable cards, stable action rows, no horizontal clipping. */
#panel-ranch #ranchCatalog,
#panel-ranch #ranchCatalog > header,
#panel-ranch .ranch-v2-catalog,
#panel-ranch .ranch-v2-catalog-card,
#panel-ranch .ranch-v2-catalog-card > * {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#panel-ranch #ranchCatalog {
  overflow: hidden;
}

#panel-ranch #ranchCatalog > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 40%);
  align-items: end;
  gap: 18px;
}

#panel-ranch #ranchCatalog > header > span {
  justify-self: end;
  max-width: 42ch;
  text-align: right;
  line-height: 1.65;
  white-space: normal;
}

#panel-ranch .ranch-v2-catalog {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-columns: auto !important;
  align-items: stretch !important;
  gap: 18px !important;
  width: 100% !important;
  overflow: visible !important;
  padding: 0 !important;
}

#panel-ranch .ranch-v2-catalog-card {
  display: grid !important;
  grid-template-columns: 112px minmax(0, 1fr) !important;
  grid-template-areas:
    "image copy"
    "meta meta"
    "actions actions" !important;
  grid-template-rows: auto auto 1fr !important;
  align-content: start !important;
  gap: 14px 16px !important;
  width: 100% !important;
  height: auto !important;
  min-height: 420px !important;
  padding: 18px !important;
  overflow: hidden !important;
}

#panel-ranch .ranch-v2-catalog-card__image,
#panel-ranch .ranch-v2-catalog-card > img,
#panel-ranch .ranch-v2-catalog-card > .ranch-v2-fallback {
  grid-area: image !important;
  width: 112px !important;
  height: 112px !important;
  align-self: start !important;
  object-fit: contain !important;
  object-position: center !important;
}

#panel-ranch .ranch-v2-catalog-card__copy {
  grid-area: copy !important;
  align-self: start !important;
}

#panel-ranch .ranch-v2-catalog-card__copy small,
#panel-ranch .ranch-v2-catalog-card__copy strong,
#panel-ranch .ranch-v2-catalog-card__copy p,
#panel-ranch .ranch-v2-catalog-card__copy span,
#panel-ranch .ranch-v2-catalog-card__copy em {
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

#panel-ranch .ranch-v2-catalog-card__copy strong {
  display: block;
  margin: 6px 0 8px;
  font-size: 19px;
  line-height: 1.25;
}

#panel-ranch .ranch-v2-catalog-card__copy p {
  margin: 0 0 9px;
  line-height: 1.65;
}

#panel-ranch .ranch-v2-catalog-card__copy span,
#panel-ranch .ranch-v2-catalog-card__copy em {
  display: block;
  line-height: 1.6;
}

#panel-ranch .ranch-v2-catalog-card__meta {
  grid-area: meta !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px 14px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 12px 0 !important;
  border-block: 1px solid #dce7e3 !important;
}

#panel-ranch .ranch-v2-catalog-card__actions {
  grid-area: actions !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: end !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

#panel-ranch .ranch-v2-catalog-card__actions > button,
#panel-ranch .ranch-v2-owned-entry > button {
  position: static !important;
  inset: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 9px 14px !important;
  border: 1px solid #477a6b !important;
  border-radius: 12px !important;
  color: #fff !important;
  background: #4f8272 !important;
  font: inherit !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
  text-align: center !important;
  white-space: normal !important;
  writing-mode: horizontal-tb !important;
  overflow-wrap: normal !important;
}

#panel-ranch .ranch-v2-catalog-card__actions > button.is-record {
  color: #27675e !important;
  background: #eef8f5 !important;
  border-color: #8eb9ae !important;
}

#panel-ranch .ranch-v2-catalog-card__actions > button:disabled {
  color: #8b9b96 !important;
  background: #edf1ee !important;
  border-color: #d4dfdb !important;
  cursor: not-allowed !important;
}

#panel-ranch .ranch-v2-owned-entry {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 82px 104px !important;
  align-items: center !important;
  gap: 9px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 12px 0 0 !important;
  border-top: 1px solid #dce7e3 !important;
}

#panel-ranch .ranch-v2-owned-entry > span {
  min-width: 0 !important;
  line-height: 1.45 !important;
  white-space: normal !important;
}

#panel-ranch .ranch-v2-owned-entry > input {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  margin: 0 !important;
}

@media (max-width: 1280px) {
  #panel-ranch .ranch-v2-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

@media (max-width: 760px) {
  #panel-ranch #ranchCatalog > header {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }

  #panel-ranch #ranchCatalog > header > span {
    justify-self: start;
    max-width: 100%;
    text-align: left;
  }

  #panel-ranch .ranch-v2-catalog {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }

  #panel-ranch .ranch-v2-catalog-card {
    grid-template-columns: 88px minmax(0, 1fr) !important;
    min-height: 0 !important;
    gap: 12px !important;
    padding: 16px !important;
  }

  #panel-ranch .ranch-v2-catalog-card__image,
  #panel-ranch .ranch-v2-catalog-card > img,
  #panel-ranch .ranch-v2-catalog-card > .ranch-v2-fallback {
    width: 88px !important;
    height: 88px !important;
  }

  #panel-ranch .ranch-v2-catalog-card__copy strong { font-size: 18px; }
  #panel-ranch .ranch-v2-catalog-card__actions { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #panel-ranch .ranch-v2-owned-entry {
    grid-template-columns: minmax(0, 1fr) 112px !important;
  }
  #panel-ranch .ranch-v2-owned-entry > span { grid-column: 1 / -1 !important; }
}

@media (max-width: 380px) {
  #panel-ranch .ranch-v2-catalog-card { grid-template-columns: 76px minmax(0, 1fr) !important; padding: 14px !important; }
  #panel-ranch .ranch-v2-catalog-card__image,
  #panel-ranch .ranch-v2-catalog-card > img,
  #panel-ranch .ranch-v2-catalog-card > .ranch-v2-fallback { width: 76px !important; height: 76px !important; }
  #panel-ranch .ranch-v2-catalog-card__actions { grid-template-columns: minmax(0, 1fr) !important; }
  #panel-ranch .ranch-v2-owned-entry { grid-template-columns: minmax(0, 1fr) !important; }
  #panel-ranch .ranch-v2-owned-entry > span { grid-column: auto !important; }
}
