.prep-replacement-panel {
  margin: 1rem 0;
  padding: 1rem;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  background: #f8f8f8;
}

.prep-replacement-panel-heading,
.prep-replacement-front-header,
.prep-replacement-front-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.prep-replacement-panel h2 {
  margin: 0 0 .25rem;
  font-size: 1.25rem;
}

.prep-replacement-panel p {
  margin: 0;
}

.prep-replacement-lines {
  min-width: 0;
}

.prep-replacement-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
}

.prep-replacement-card {
  display: flex;
  min-width: 0;
  min-height: 300px;
  height: 100%;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: 8px 5px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  background: #fff;
  text-align: center;
  overflow-wrap: anywhere;
}

.prep-replacement-card-image {
  display: flex;
  width: 100%;
  min-height: 82px;
  align-items: center;
  justify-content: center;
}

.prep-replacement-card-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 95px;
  max-height: 95px;
  margin: 0 auto 6px;
  object-fit: contain;
}

.prep-replacement-card-image:empty::before {
  display: block;
  width: 82px;
  height: 82px;
  border-radius: 3px;
  background: #f5f5f5;
  content: "";
}

.prep-replacement-card-name {
  display: -webkit-box;
  min-height: 56px;
  max-height: 56px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  font-size: 12px;
  line-height: 14px;
  text-align: center;
}

.prep-replacement-card-price-quantity {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35rem;
}

.prep-replacement-card-price {
  color: #62cd47;
  font-size: 13px;
  line-height: 16px;
  white-space: nowrap;
}

.prep-replacement-card-quantity {
  padding: .12rem .4rem;
  border-radius: 999px;
  background: #f0f0f0;
  color: #666;
  font-size: 10px;
  white-space: nowrap;
}

.prep-replacement-card-policy {
  display: flex;
  width: 100%;
  min-height: 74px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: .3rem;
}

.prep-replacement-policy-badge {
  display: flex;
  max-width: 100%;
  flex-direction: column;
  padding: .22rem .45rem;
  border-radius: 12px;
  background: #eee;
  font-size: 10px;
  line-height: 13px;
}

.prep-replacement-policy-badge small,
.prep-replacement-policy button small {
  font-size: .78em;
  opacity: .72;
}

.prep-replacement-card-first-choice {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 10px;
  line-height: 13px;
}

.prep-replacement-card-other-choices {
  color: #777;
  font-size: 9px;
  line-height: 12px;
}

.policy-unset .prep-replacement-policy-badge {
  background: #fff3cd;
  color: #664d03;
}

.policy-replace .prep-replacement-policy-badge {
  background: #d1e7dd;
  color: #0f5132;
}

.policy-wallet_credit .prep-replacement-policy-badge {
  background: #cff4fc;
  color: #055160;
}

.prep-replacement-card-button {
  min-width: 95px;
  margin-top: auto;
  padding: .35rem .7rem;
  border-color: #62cd47;
  background: #62cd47;
  color: #fff;
  font-size: 11px;
}

.prep-replacement-card-button:hover,
.prep-replacement-card-button:focus {
  border-color: #429d2b;
  background: #429d2b;
  color: #fff;
}

.prep-replacement-front-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10050;
  padding: 1rem;
  overflow: auto;
  background: rgba(0, 0, 0, .55);
}

.prep-replacement-front-modal.is-open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.prep-replacement-front-dialog {
  width: min(900px, 100%);
  margin: auto;
  padding: 1rem;
  border-radius: 10px;
  background: #fff;
}

.prep-replacement-front-close {
  border: 0;
  background: transparent;
  font-size: 1.75rem;
}

.prep-replacement-original-price,
.prep-replacement-choice-price {
  font-weight: 700;
}

.prep-replacement-choice-price {
  color: #62cd47;
  font-size: 13px;
  line-height: 16px;
}

.prep-replacement-price-difference {
  color: #666;
}

.prep-replacement-policy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  margin: 1rem 0;
}

.prep-replacement-policy button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .65rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.prep-replacement-policy button.active {
  border-color: #2fb5d2;
  background: #e8f8fb;
}

.prep-replacement-search {
  margin: 1rem 0;
}

.prep-replacement-search label {
  display: block;
  margin-bottom: .35rem;
  font-weight: 600;
}

.prep-replacement-search input {
  width: 100%;
  max-width: 100%;
  padding: .6rem .75rem;
  border: 1px solid #bbb;
  border-radius: 5px;
}

.prep-replacement-search-clear {
  margin-top: .4rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2fb5d2;
  font-size: .85rem;
  text-decoration: underline;
}

.prep-replacement-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.prep-replacement-choice {
  display: flex;
  min-width: 0;
  min-height: 285px;
  height: 100%;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 8px 6px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  background: #fff;
  text-align: center;
  overflow-wrap: anywhere;
}

.prep-replacement-choice.is-selected {
  border-color: #62cd47;
  box-shadow: inset 0 0 0 1px #62cd47;
}

.prep-replacement-choice-visual {
  display: flex;
  width: 100%;
  height: 90px;
  flex: 0 0 90px;
  align-items: center;
  justify-content: center;
}

.prep-replacement-choice-visual:empty::before {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 3px;
  background: #f5f5f5;
  content: "";
}

.prep-replacement-choice img {
  display: block;
  width: auto;
  height: auto;
  max-width: 90px;
  max-height: 90px;
  margin: 0 auto 4px;
  object-fit: contain;
}

.prep-replacement-choice-details {
  display: flex;
  width: 100%;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
}

.prep-replacement-origin-badge {
  display: inline-block;
  max-width: 100%;
  padding: .15rem .4rem;
  border-radius: 999px;
  background: #eef2f4;
  color: #4b555b;
  font-size: 9px;
  line-height: 12px;
}

.prep-replacement-origin-badge.origin-personal_history {
  background: #e4f5e0;
  color: #28621b;
}

.prep-replacement-origin-badge.origin-global_history {
  background: #e8f3fb;
  color: #245a7a;
}

.prep-replacement-search-grid {
  margin-top: .5rem;
}

.prep-replacement-search-empty {
  color: #666;
}

.prep-replacement-choice-title {
  display: -webkit-box;
  min-height: 42px;
  max-height: 42px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 11px;
  line-height: 14px;
}

.prep-replacement-choice-details > small {
  font-size: 9px;
  line-height: 12px;
}

.prep-replacement-measurement {
  display: flex;
  min-height: 16px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .2rem .4rem;
  color: #56616a;
}

.prep-replacement-measurement strong {
  color: #35424a;
  font-size: 10px;
  white-space: nowrap;
}

.prep-replacement-price-block {
  display: flex;
  min-height: 20px;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: .25rem .4rem;
}

.prep-replacement-regular-price {
  color: #777;
  font-size: 10px;
  white-space: nowrap;
}

.prep-replacement-contribution-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .12rem .4rem;
  border-radius: 999px;
  background: #e4f5e0;
  color: #28621b;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
}

.prep-replacement-contribution-badge .material-icons {
  width: 13px;
  overflow: hidden;
  font-size: 13px;
  line-height: 14px;
}

.prep-replacement-financial-message {
  min-height: 24px;
  color: #666;
}

.prep-replacement-financial-message.is-wallet-credit {
  color: #28621b;
  font-weight: 600;
}

.prep-replacement-financial-message.is-wallet-debit {
  color: #8a4b08;
  font-weight: 600;
}

.prep-replacement-choice-button {
  min-width: 95px;
  max-width: 100%;
  margin-top: auto;
  padding: .35rem .65rem;
  border: 1px solid #62cd47;
  border-radius: 4px;
  background: #62cd47;
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}

.prep-replacement-choice-button:hover,
.prep-replacement-choice-button:focus {
  border-color: #429d2b;
  background: #429d2b;
  color: #fff;
}

.prep-replacement-order-controls {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: .3rem;
}

.prep-replacement-order-controls button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #f7f7f7;
}

.prep-replacement-priority {
  font-size: 10px;
  font-weight: 600;
}

.prep-replacement-front-actions {
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (min-width: 1600px) and (max-width: 1919px) {
  .prep-replacement-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .prep-replacement-card {
    min-height: 280px;
  }
}

@media (min-width: 1920px) {
  .prep-replacement-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .prep-replacement-card {
    min-height: 260px;
  }

  .prep-replacement-card-image img {
    max-width: 110px;
    max-height: 110px;
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .prep-replacement-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .prep-replacement-card {
    min-height: 280px;
  }

  .prep-replacement-card-image img {
    max-width: 90px;
    max-height: 90px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .prep-replacement-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .prep-replacement-card {
    min-height: 280px;
  }

  .prep-replacement-card-image img {
    max-width: 90px;
    max-height: 90px;
  }

  .prep-replacement-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .prep-replacement-panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .prep-replacement-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .prep-replacement-card {
    min-height: 240px;
  }

  .prep-replacement-card-image img {
    max-width: 80px;
    max-height: 80px;
  }

  .prep-replacement-card-name {
    min-height: 42px;
    max-height: 42px;
    -webkit-line-clamp: 3;
  }

  .prep-replacement-policy {
    grid-template-columns: minmax(0, 1fr);
  }

  .prep-replacement-front-modal {
    padding: .5rem;
  }

  .prep-replacement-front-dialog {
    padding: .75rem;
  }

  .prep-replacement-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .prep-replacement-choice {
    min-height: 270px;
  }
}

@media (max-width: 359px) {
  .prep-replacement-grid,
  .prep-replacement-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
