/* Medateka cart modal */
.mdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  box-sizing: border-box;
}

.mdk-noscroll {
  overflow: hidden;
}

.mdk-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  font-family: Verdana, Arial, sans-serif;
  color: #222;
}

.mdk-modal-wide {
  max-width: 820px;
}

.mdk-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  background: #b4213b;
  color: #fff;
  border-radius: 12px 12px 0 0;
}

.mdk-modal-title {
  font-size: 18px;
  font-weight: 600;
}

.mdk-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.mdk-modal-body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.mdk-modal-foot {
  padding: 12px 20px 20px;
  text-align: right;
}

.mdk-btn {
  border: 1px solid #a42037;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 8px;
}

.mdk-btn-primary {
  background: #b4213b;
  color: #fff;
}

.mdk-btn-primary:hover {
  background: #cf435b;
}

.mdk-btn-secondary {
  background: #f3f3f3;
  color: #333;
  border-color: #ccc;
}

.mdk-btn-secondary:hover {
  background: #eee;
}

.mdk-cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mdk-cart-table th,
.mdk-cart-table td {
  border-bottom: 1px solid #eee;
  padding: 8px 6px;
  vertical-align: top;
  text-align: left;
}

.mdk-cart-table th {
  font-weight: 600;
  color: #555;
}

.mdk-qty-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  vertical-align: middle;
}

.mdk-qty-btn {
  border: none;
  background: #f3f3f3;
  color: #333;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.mdk-qty-btn:hover {
  background: #e6e6e6;
}

.mdk-qty-val {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  font-size: 13px;
  padding: 0 4px;
  line-height: 28px;
}

.mdk-remove {
  border: none;
  background: #eee;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.mdk-totals {
  text-align: right;
  margin-top: 12px;
  font-size: 14px;
}

.mdk-total-line {
  margin: 4px 0;
}

.mdk-discount {
  color: #2a7a2a;
}

.mdk-total-final {
  font-size: 16px;
  margin-top: 8px;
}

.mdk-checkout-cart {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.mdk-checkout-cart .mdk-cart-table {
  font-size: 12px;
}

.mdk-checkout-cart .mdk-cart-table th,
.mdk-checkout-cart .mdk-cart-table td {
  padding: 6px 4px;
}

.mdk-sku {
  color: #777;
  font-size: 12px;
}

.mdk-empty {
  text-align: center;
  color: #666;
  padding: 24px 0;
}

.mdk-form label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
}

.mdk-form input,
.mdk-form textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
}

.mdk-req {
  color: #b4213b;
}

.mdk-hint {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
}

.mdk-pdn {
  font-size: 12px;
  color: #555;
  line-height: 1.45;
  margin: 12px 0 0;
  text-align: center;
}

.mdk-pdn a {
  color: #b4213b;
}

.mdk-promo-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 12px;
}

.mdk-promo-input-group {
  flex: 1 1 auto;
  min-width: 0;
}

.mdk-promo-caption {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.mdk-promo-input-group input {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  margin: 0;
}

.mdk-promo-apply {
  margin: 0 !important;
  flex-shrink: 0;
  height: 38px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.mdk-promo-msg {
  font-size: 12px;
  color: #2a7a2a;
  margin: -4px 0 12px;
}

#medateka-cart,
#easynetshop-cart {
  position: relative;
}

#medateka-cart-count,
#easynetshop-cart-count {
  position: absolute;
  top: -7px;
  right: -8px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  padding: 0 4px;
  box-sizing: border-box;
  text-align: center;
  background: #BD2600;
  color: #fff !important;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  z-index: 2;
  margin: 0;
  border: none;
  pointer-events: none;
}

#medateka-cart-count:empty,
#easynetshop-cart-count:empty {
  display: none;
}

/* Десктоп: pill-кнопка «Корзина», бейдж на углу */
@media screen and (min-width: 791px) {
  .Menu a.KNOP-6#medateka-cart,
  .Menu a.KNOP-6#easynetshop-cart {
    position: relative;
    display: inline-block;
  }

  .Menu a.KNOP-6 .KORZ-LABEL {
    display: inline;
  }

  .Menu a.KNOP-6#medateka-cart #medateka-cart-count,
  .Menu a.KNOP-6#easynetshop-cart #easynetshop-cart-count {
    top: -8px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .mdk-overlay {
    padding: 16px 10px;
  }

  .mdk-modal-body {
    padding: 14px 12px;
  }

  .mdk-modal-foot {
    padding: 12px;
  }

  .mdk-cart-table thead {
    display: none;
  }

  .mdk-cart-table tr {
    display: block;
    margin-bottom: 12px;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
  }

  .mdk-cart-table td {
    display: block;
    border: none;
    padding: 4px 0;
  }

  .mdk-cart-table td:nth-child(2)::before {
    content: "Цена: ";
    color: #777;
  }

  .mdk-cart-table td:nth-child(3)::before {
    content: "Кол-во: ";
    color: #777;
  }

  .mdk-cart-table td:nth-child(4)::before {
    content: "Сумма: ";
    color: #777;
  }

  .mdk-cart-table td:last-child {
    text-align: right;
  }

  .mdk-qty-wrap {
    margin-top: 4px;
  }

  .mdk-modal-foot {
    text-align: center;
  }

  .mdk-btn {
    display: block;
    width: 100%;
    margin: 8px 0 0;
  }

  .mdk-promo-row {
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 8px;
  }

  .mdk-promo-apply {
    display: inline-flex;
    width: auto;
    margin: 0 !important;
    flex-shrink: 0;
    white-space: nowrap;
    padding-left: 12px;
    padding-right: 12px;
    height: 38px;
  }

  .mdk-checkout-cart .mdk-cart-table {
    font-size: 13px;
  }
}

/* Мобильная шапка: только чтобы корзина не обрезалась (Sm-* в HTML = 115%) */
@media screen and (max-width: 790px) {
  .Menu > tbody > tr > td.S-10.Sm-15 {
    overflow: visible !important;
    position: relative;
  }

  .Menu a.KNOP-6#medateka-cart,
  .Menu a.KNOP-6#easynetshop-cart,
  .KORZ-HEADER {
    overflow: visible !important;
  }

  /* Убираем лишние 15% только за счёт лого и телефона; корзина и бургер — как были */
  .Menu > tbody > tr > td.S-20.Sm-55 {
    width: 47% !important;
  }

  .Menu > tbody > tr > td.NET.Sm-35 {
    width: 28% !important;
  }
}
