/* MessageCard quantity pricing. Presentation only; values come from Zen Cart.
   Price cells and colspan notes are identified by structure, not row position. */
body.tpl_messagecard #productQuantityDiscounts {
  margin: 20px 0 22px;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  color: #503b35;
  box-shadow: 0 0 0 1px #eaded5;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails > tbody {
  --mc-price-columns: 5;
  display: grid;
  grid-template-columns: repeat(var(--mc-price-columns), minmax(0, 1fr));
  width: 100%;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails > tbody:has(> tr:first-child > td[colspan="6"]) {
  --mc-price-columns: 6;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails > tbody:has(> tr:first-child > td[colspan="7"]) {
  --mc-price-columns: 7;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr {
  display: contents;
  background: transparent;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails td {
  display: block;
  box-sizing: border-box;
  min-width: 0;
  text-align: center;
  vertical-align: middle;
  border: 0;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:first-child td {
  grid-column: 1 / -1;
  padding: 13px 16px;
  background: #f3e9e2;
  color: #65483f;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.6;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) td:not([colspan]) {
  padding: 16px 2px;
  background: #fff;
  color: #65483f;
  border-right: 1px solid #eee1d8;
  font-size: clamp(15px, 1.4vw, 20px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.7;
  white-space: nowrap;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) td:not([colspan])::first-line {
  color: #71655e;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .03em;
}

/* Ignore the empty colspan cell added when the standard template wraps a row. */
body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child):has(> td:not([colspan])) > td[colspan] {
  display: none;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) > td:first-child:nth-last-child(2):not([colspan]):has(+ td[colspan]) {
  background: #faf4ee;
  color: #805042;
  border-right: 0;
}

body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child):not(:has(> td:not([colspan]))) > td[colspan] {
  grid-column: 1 / -1;
  padding: 11px 14px;
  background: #fbf8f5;
  color: #71655e;
  border-top: 1px solid #eee1d8;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  body.tpl_messagecard #productQuantityDiscounts {
    margin-top: 18px;
  }

  body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails > tbody {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) td:not([colspan]) {
    padding: 12px 4px;
    font-size: 17px;
  }

  body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) td:nth-child(3n) {
    border-right: 0;
  }

  body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) td:nth-child(n+4) {
    border-top: 1px solid #eee1d8;
  }

  body.tpl_messagecard #productQuantityDiscounts #quantityDiscountsDetails tr:not(:first-child) > td:first-child:nth-last-child(2):not([colspan]):has(+ td[colspan]) {
    grid-column: 1 / -1;
    border-top: 1px solid #eee1d8;
  }
}
