/* CVETI: modal for writing off an order item. Load after base template CSS. */

.writeoff-modal[hidden] {
  display: none;
}

body.writeoff-modal-open {
  overflow: hidden;
}

.writeoff-modal {
  position: fixed;
  z-index: 13000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(38, 39, 35, 0.56);
  padding: 72px 24px;
}

.writeoff-modal__backdrop {
  position: fixed;
  z-index: 0;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.writeoff-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(504px, 100%);
  background: #f4f2eb;
  box-shadow: 0 24px 80px rgba(34, 33, 28, 0.2);
}

.writeoff-modal__form {
  box-sizing: border-box;
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 44px 32px 40px;
}

.writeoff-modal__close {
  position: fixed;
  z-index: 2;
  top: 31px;
  right: 31px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #fff url("images/modal-windows/cross.svg") center / 32px 32px no-repeat;
  cursor: pointer;
  font-size: 0;
}


.writeoff-modal h2 {
  margin: 0;
  color: #3e443d;
  font: 400 24px/1.25 "Manrope", Arial, sans-serif;
  letter-spacing: 0.3px;
  text-align: center;
  text-transform: uppercase;
}

.writeoff-modal__order {
  margin: 8px 0 28px;
  color: #3e443d;
  font: 500 14px/1.4 "Manrope", Arial, sans-serif;
  text-align: center;
}

.writeoff-modal__product {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.writeoff-modal__product img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
}

.writeoff-modal__product strong,
.writeoff-modal__product span {
  display: block;
  color: #3e443d;
  font-family: "Manrope", Arial, sans-serif;
}

.writeoff-modal__product strong { font-size: 14px; font-weight: 500; line-height: 1.45; }
.writeoff-modal__product span { margin-top: 2px; color: #8c8b82; font-size: 12px; line-height: 1.4; }

.writeoff-modal__field {
  position: relative;
  display: block;
  min-height: 52px;
  margin-bottom: 16px;
  background: #fbfaf5;
}

.writeoff-modal__field span {
  position: absolute;
  z-index: 1;
  top: 17px;
  left: 16px;
  color: #aaa99f;
  font: 400 14px/1.35 "Manrope", Arial, sans-serif;
  pointer-events: none;
  transition: transform 150ms ease, font-size 150ms ease, color 150ms ease;
}

.writeoff-modal__field:focus-within span,
.writeoff-modal__field:has(input:not(:placeholder-shown)) span,
.writeoff-modal__field:has(textarea:not(:placeholder-shown)) span {
  top: 11px;
  color: #7f8179;
  font-size: 11px;
}

.writeoff-modal__field input,
.writeoff-modal__field textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid transparent;
  outline: 0;
  background: transparent;
  color: #3e443d;
  font: 500 17px/1.4 "Manrope", Arial, sans-serif;
}

.writeoff-modal__field input {
  height: 52px;
  padding: 22px 16px 5px;
}

.writeoff-modal__field input[type="number"] { appearance: textfield; }
.writeoff-modal__field input[type="number"]::-webkit-inner-spin-button,
.writeoff-modal__field input[type="number"]::-webkit-outer-spin-button { margin: 0; appearance: none; }


.writeoff-modal__field--reason { min-height: 120px; }
.writeoff-modal__field textarea { display: block; min-height: 120px; resize: vertical; padding: 27px 16px 16px; }
.writeoff-modal__field input:focus,
.writeoff-modal__field textarea:focus { border-color: #91ad8c; }
.writeoff-modal__field.is-invalid input,
.writeoff-modal__field.is-invalid textarea { border-color: #e69189; }

.writeoff-modal__upload {
  display: flex;
  flex-wrap: wrap;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  background: #fbfaf5;
  padding: 14px 16px;
  color: #3e443d;
  cursor: pointer;
}

.writeoff-modal__upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.writeoff-modal__clip {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  background: url("images/modal-windows/clip.svg") center / contain no-repeat;
}

.writeoff-modal__upload b,
.writeoff-modal__upload small { display: block; font-family: "Manrope", Arial, sans-serif; }
.writeoff-modal__upload b { font-size: 12px; font-weight: 500; line-height: 1.4; text-transform: uppercase; }
.writeoff-modal__upload small { margin-top: 3px; color: #8c8b82; font-size: 12px; }

.writeoff-modal__previews {
  display: none;
  box-sizing: border-box;
  width: 100%;
  gap: 8px;
  padding-left: 36px;
  flex-wrap: nowrap;
}

.writeoff-modal__previews:not(:empty) { display: flex; }

.writeoff-modal__preview {
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  overflow: hidden;
  flex: 0 0 68px;
  place-items: center;
  border: 1px solid #deddd5;
  border-radius: 4px;
  background: #f4f2eb;
  color: #75776e;
  font: 700 9px/1 "Manrope", Arial, sans-serif;
  text-transform: uppercase;
}

.writeoff-modal__preview img { width: 100%; height: 100%; object-fit: cover; }
.writeoff-modal__preview--file { padding: 5px; text-align: center; }

.writeoff-modal__preview-remove {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.88) url("images/modal-windows/cross.svg") center / 18px 18px no-repeat;
  cursor: pointer;
}

.writeoff-photo-help[hidden] { display: none; }
.writeoff-photo-help {
  position: fixed;
  z-index: 13001;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(38, 39, 35, 0.56);
  padding: 24px;
}
.writeoff-photo-help__card {
  position: relative;
  box-sizing: border-box;
  width: min(504px, 100%);
  max-height: 761px;
  overflow-y: auto;
  padding: 62px 48px 48px;
  background: #f4f2eb;
  color: #3e443d;
  font: 400 14px/1.5 "Manrope", Arial, sans-serif;
}
.writeoff-photo-help__card h2 { margin: 0 28px 52px; color: #3e443d; font: 400 22px/1.35 "Manrope", Arial, sans-serif; text-align: center; text-transform: uppercase; }
.writeoff-photo-help__item + .writeoff-photo-help__item { margin-top: 56px; }
.writeoff-photo-help__item h3 { margin: 0 0 16px; font: 500 16px/1.4 "Manrope", Arial, sans-serif; text-transform: uppercase; }
.writeoff-photo-help__item p { margin: 0 0 32px; color: #676b66; font: 400 15px/1.5 "Manrope", Arial, sans-serif; }
.writeoff-photo-help__item img { display: block; width: 100%; aspect-ratio: 4 / 2.2; object-fit: cover; }
.writeoff-photo-help__close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border: 0; background: transparent url("images/modal-windows/cross.svg") center / contain no-repeat; cursor: pointer; }

.writeoff-modal__help {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  margin: 14px 0 24px;
  color: #75776e;
  font: 400 12px/1.4 "Manrope", Arial, sans-serif;
  text-decoration: underline;
}

.writeoff-modal__help span {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  background: url("images/modal-windows/help.svg") center / contain no-repeat;
}

.writeoff-modal__submit {
  width: 100%;
  height: 52px;
  margin-top: 0;
  border: 1px solid transparent;
  border-radius: 64px;
  background: #91ad8c;
  color: #fff;
  cursor: pointer;
  font: 700 15px/1 "Manrope", Arial, sans-serif;
  text-transform: uppercase;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .writeoff-modal__submit:hover { background: #748a70; }
  .writeoff-modal__close:hover { box-shadow: 0 10px 20px rgba(75, 67, 56, 0.12); }
  .writeoff-modal__upload:hover { box-shadow: inset 0 0 0 1px #c5b7ac; }
}

.writeoff-modal__submit:focus-visible,
.writeoff-modal__close:focus-visible,
.writeoff-modal__upload:focus-within {
  outline: 0;
  border-color: #556e51;
  box-shadow: 0 0 0 2px rgba(85, 110, 81, 0.18);
}

.writeoff-modal__submit:disabled { background: #d3ded1; cursor: not-allowed; }

@media (max-width: 640px) {
  .writeoff-modal { display: block; padding: 0; }
  .writeoff-modal__dialog { width: 100%; min-height: 100dvh; }
  .writeoff-modal__form { min-height: 100dvh; padding: 94px 20px 32px; }
  .writeoff-photo-help { padding: 0; }
  .writeoff-photo-help__card { width: 100%; max-height: none; min-height: 100dvh; padding: 62px 32px 40px; }
  .writeoff-modal__close { position: absolute; top: 20px; right: 20px; width: 48px; height: 48px; }
  .writeoff-modal h2 { font-size: 24px; }
  .writeoff-modal__order { margin: 12px 0 30px; font-size: 14px; }
  .writeoff-modal__product { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; margin-bottom: 24px; }
  .writeoff-modal__product img { width: 64px; height: 64px; }
  .writeoff-modal__product strong { font-size: 14px; }
  .writeoff-modal__product span { font-size: 12px; }
  .writeoff-modal__field { min-height: 60px; margin-bottom: 18px; }
  .writeoff-modal__field span { top: 19px; left: 18px; font-size: 14px; }
  .writeoff-modal__field input { height: 60px; padding: 24px 18px 5px; font-size: 15px; }
  .writeoff-modal__field--reason,
  .writeoff-modal__field textarea { min-height: 150px; }
  .writeoff-modal__field textarea { padding: 28px 18px 16px; font-size: 15px; }
  .writeoff-modal__upload { min-height: 90px; gap: 15px; padding: 18px; }
  .writeoff-modal__upload b { font-size: 13px; }
  .writeoff-modal__upload small { font-size: 12px; }
  .writeoff-modal__help { margin: 18px 0 32px; font-size: 13px; }
  .writeoff-modal__submit { height: 56px; font-size: 13px; }
}

.writeoff-modal [data-writeoff-product-field] {
    position: relative;
}

.writeoff-modal [data-writeoff-product] {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 14px 48px 14px 16px;
    border: 1px solid #D8D5CD;
    border-radius: 8px;
    background: #FCFBF9;
    color: #3E443D;
    font: inherit;
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.writeoff-modal [data-writeoff-product-field]::after {
    content: "";
    position: absolute;
    right: 18px;
    bottom: 19px;
    width: 9px;
    height: 9px;
    border-right: 1.5px solid #3E443D;
    border-bottom: 1.5px solid #3E443D;
    transform: rotate(45deg);
    pointer-events: none;
}

.writeoff-modal [data-writeoff-product]:hover {
    border-color: #8FA98B;
}

.writeoff-modal [data-writeoff-product]:focus-visible {
    outline: none;
    border-color: #8FA98B;
    box-shadow: 0 0 0 3px rgba(143, 169, 139, .2);
}

.writeoff-modal [data-writeoff-product] option {
    color: #3E443D;
    background: #FCFBF9;
}

@media (max-width: 640px) {
    .writeoff-modal [data-writeoff-product] {
        min-height: 48px;
        padding: 12px 44px 12px 14px;
    }
}

