/* Open Item editor. Keep these rules scoped to its Bootstrap modal. */
#openItem .modal-dialog {
  width: calc(100% - 32px);
  max-width: 960px;
  margin: 16px auto;
}

#openItem .modal-dialog-centered {
  min-height: calc(100% - 32px);
}

#openItem .modal-content {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border-radius: 16px;
  background: var(--bs-surface-bg);
  color: var(--bs-text);
  box-shadow: var(--bs-shadow-lg);
}

#openItem [hidden] {
  display: none !important;
}

#openItem button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

#openItem button:focus-visible {
  outline: 3px solid var(--bs-main);
  outline-offset: 3px;
}

#openItem .modal-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  padding: 12px 22px;
  border-bottom: 1px solid var(--bs-border-color);
}

#openItem .modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

#openItem .openitem-title-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--bs-main) 10%, var(--bs-surface-bg));
  color: var(--bs-main);
}

#openItem svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

#openItem .item_input {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--bs-input-border-color);
  border-radius: 12px;
}

#openItem .item_input:focus-within {
  border-color: var(--bs-main);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-main) 15%, transparent);
}

#openItem .item_input_title {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--bs-text-muted);
  text-transform: uppercase;
}

#openItem .item_input input {
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--bs-text);
  font-size: 16px;
  box-shadow: none;
}

#openItem .openitem-close-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  background: var(--bs-surface-bg);
  color: var(--bs-text-muted);
}

#openItem .openitem-close-btn:hover {
  background: var(--bs-surface-2-bg);
}

#openItem .modal-body {
  /* Override the legacy global .modal-body background marked !important. */
  background: var(--bs-surface-bg) !important;
  min-height: 0;
  padding: 20px 22px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#openItem .openitem-modal-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

#openItem .body_open_item {
  background: var(--bs-surface-bg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  width: 100%;
}

#openItem .leftAreaPriceContent {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
}

#openItem .leftAreaPriceContent .txtCustomPriceBtn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
  height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  background: var(--bs-surface-bg);
  color: var(--bs-text);
  text-transform: none;
  text-align: left;
  letter-spacing: normal;
  box-shadow: var(--bs-shadow-xs);
}
#openItem .leftAreaPriceContent .btnCustom-selected {
  background: var(--bs-surface-bg);
  border: 1px solid var(--bs-main) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-main) 15%, transparent);
}

#openItem .openitem-field-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--bs-surface-2-bg);
  color: var(--bs-text-muted);
}

#openItem .btnCustom-selected .openitem-field-icon {
  background: var(--bs-main);
  color: var(--bs-white);
}

#openItem .openitem-field-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#openItem .openitem-field-label {
  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--bs-text-muted);
}

#openItem .spanCustomPriceBtn {
  font-size: 19px;
  line-height: 1.25;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#openItem .rightAreaPriceContent {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  align-items: stretch;
  max-width: none;
  width: 100%;
  gap: 16px !important;
  padding: 0 !important;
  margin: 0 !important;
}

#openItem .openitem-price-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  background: var(--bs-main-50);
  color: var(--bs-text);
}

body[data-theme="dark"] #openItem .openitem-price-panel {
  background: color-mix(in srgb, var(--bs-main) 12%, var(--bs-surface-bg));
}

#openItem .openitem-panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  color: var(--bs-text-muted);
  font-size: 12px;
  line-height: 1.4;
}

#openItem .openitem-editor-title {
  font-weight: 600;
}

#openItem .openitem-fee {
  white-space: nowrap;
}

#openItem .rightAreaPriceContent .dualprice-open-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 1;
  width: 100%;
  gap: 10px;
}

#openItem .rightAreaPriceContent .dualprice-box,
#openItem .singleprice-box,
#openItem .openitem-field-editor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  width: 100%;
  min-height: 224px;
  padding: 16px;
  border: 1px solid var(--bs-border-strong);
  border-radius: 13px;
  background: var(--bs-surface-bg);
  color: var(--bs-text);
  text-align: left;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bs-main) 2%, transparent);
}
#openItem .rightAreaPriceContent .dualprice-box.active,
#openItem .singleprice-box.active {
  border: 1px solid var(--bs-main);
  background: var(--bs-main-200);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bs-main) 7%, transparent);
}

body[data-theme="dark"] #openItem .rightAreaPriceContent .dualprice-box.active,
body[data-theme="dark"] #openItem .singleprice-box.active {
  background: color-mix(in srgb, var(--bs-main) 30%, var(--bs-surface-bg));
}

#openItem .rightAreaPriceContent .dualprice-box .price-label,
#openItem .singleprice-box .price-label,
#openItem .openitem-field-editor .price-label {
  padding-right: 18px;
  margin: 0;
  color: var(--bs-text-muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
  text-align: left;
}

#openItem .rightAreaPriceContent .dualprice-box .price-value,
#openItem .singleprice-box .price-value,
#openItem .openitem-field-editor .price-value {
  width: 100%;
  margin: auto 0;
  color: var(--bs-text);
  font-size: clamp(24px, 3.4vw, 42px);
  line-height: 1.15;
  font-weight: 700;
  text-align: left;
  letter-spacing: -1px;
  overflow-wrap: anywhere;
}

#openItem .openitem-price-radio {
  position: absolute;
  top: 18px;
  right: 16px;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--bs-border-strong);
  border-radius: 50%;
}

#openItem .active .openitem-price-radio {
  border: 4px solid var(--bs-main);
  background: color-mix(in srgb, var(--bs-main) 10%, var(--bs-surface-bg));
}

#openItem .openitem-price-hint {
  color: var(--bs-text-muted);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 400;
}

#openItem .singleprice-open-item {
  display: flex;
  flex: 1;
  width: 100%;
}

#openItem .openitem-field-editor {
  flex: 1;
}

#openItem .rightAreaPriceContent .customPrice_area {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, .9fr);
  grid-template-rows: repeat(4, minmax(62px, 1fr));
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  align-self: stretch;
}

#openItem .customPrice_area .btnt.btnCustomPrice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 62px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--bs-border-color);
  border-bottom: 2px solid var(--bs-border-strong);
  border-radius: 12px;
  background: var(--bs-keyboard-bg);
  color: var(--bs-text);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  box-shadow: none;
}

#openItem .customPrice_area .btnt.btnCustomPrice:hover {
  background: color-mix(in srgb, var(--bs-main) 10%, var(--bs-surface-bg));
}

#openItem .customPrice_area .btnt.btnCustomPrice:active {
  background: color-mix(in srgb, var(--bs-main) 15%, var(--bs-surface-bg));
  transform: translateY(1px);
}

#openItem .customPrice_area .btnt.discount-backspace-btn {
  grid-column: 4;
  grid-row: 1 / 3;
  flex-direction: column;
  gap: 6px;
  background: color-mix(in srgb, var(--bs-red) 8%, var(--bs-surface-bg));
  color: var(--bs-red);
  font-size: 12px;
}

#openItem .customPrice_area .btnt.discount-backspace-btn:hover {
  background: color-mix(in srgb, var(--bs-red) 14%, var(--bs-surface-bg));
}

#openItem .customPrice_area .btnt.discount-clear-btn {
  grid-column: 4;
  grid-row: 3 / 5;
  font-size: 16px;
}

#openItem .footer_open_item {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: calc(100% + 44px);
  margin: 20px -22px 0;
  padding: 14px 22px max(14px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bs-border-color);
  background: var(--bs-surface-2-bg);
}

#openItem .openitem-payment-note {
  min-width: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--bs-text-muted);
}

#openItem .openitem-footer-actions {
  display: flex;
  flex-shrink: 0;
  gap: 10px;
}

#openItem .openitem-cancel-btn,
#openItem .footer_open_item .btnCustomP_add {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: auto;
  padding: 10px 24px;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

#openItem .openitem-cancel-btn {
  background: var(--bs-surface-bg);
  color: var(--bs-text);
}

#openItem .footer_open_item .btnCustomP_add {
  min-width: 220px;
  background: var(--bs-main);
  color: var(--bs-white);
  border-color: transparent;
}

#openItem .footer_open_item .btnCustomP_add:disabled {
  background: var(--bs-border-color);
  color: var(--bs-text-muted);
  cursor: default;
}

#openItem .footer_open_item .btnCustomP_add:hover {
  transform: none;
}

#openItem .footer_open_item .btnCustomP_add:not(:disabled):hover {
  background: var(--bs-main-hover);
}


@media (max-width: 767.98px) {
  #openItem .modal-dialog {
    width: calc(100% - 16px);
    margin: 8px auto;
  }

  #openItem .modal-dialog-centered {
    min-height: calc(100% - 16px);
  }

  #openItem .modal-content {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  #openItem .modal-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 14px;
  }

  #openItem .modal-title {
    font-size: 17px;
  }

  #openItem .item_input {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  #openItem .openitem-close-btn {
    grid-column: 2;
    grid-row: 1;
  }

  #openItem .modal-body {
    padding: 14px 14px 0;
  }

  #openItem .leftAreaPriceContent {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #openItem .leftAreaPriceContent .txtCustomPriceBtn {
    height: 62px;
    padding: 10px;
    gap: 10px;
  }

  #openItem .spanCustomPriceBtn {
    font-size: 17px;
  }

  #openItem .openitem-field-icon {
    flex-basis: 32px;
    height: 34px;
  }

  #openItem .rightAreaPriceContent {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px !important;
  }

  #openItem .openitem-price-panel {
    padding: 12px;
    gap: 10px;
  }

  #openItem .rightAreaPriceContent .dualprice-box,
  #openItem .singleprice-box,
  #openItem .openitem-field-editor {
    min-height: 128px;
    padding: 12px;
    gap: 14px;
  }

  #openItem .rightAreaPriceContent .dualprice-box .price-value,
  #openItem .singleprice-box .price-value,
  #openItem .openitem-field-editor .price-value {
    font-size: clamp(26px, 7vw, 38px);
  }

  #openItem .openitem-price-radio {
    top: 14px;
    right: 12px;
  }

  #openItem .rightAreaPriceContent .customPrice_area {
    gap: 8px;
    grid-template-rows: repeat(4, minmax(48px, 1fr));
  }

  #openItem .customPrice_area .btnt.btnCustomPrice {
    min-height: 48px;
    font-size: 22px;
    border-radius: 10px;
  }

  #openItem .customPrice_area .btnt.discount-backspace-btn {
    font-size: 11px;
  }

  #openItem .customPrice_area .btnt.discount-clear-btn {
    font-size: 14px;
  }

  #openItem .footer_open_item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: calc(100% + 28px);
    margin: 14px -14px 0;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom, 0px));
  }

  #openItem .openitem-footer-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 8px;
  }

  #openItem .footer_open_item .btnCustomP_add {
    min-width: 0;
  }

  #openItem .openitem-cancel-btn,
  #openItem .footer_open_item .btnCustomP_add {
    padding: 10px;
  }

}

@media (max-width: 359.98px) {
  #openItem .openitem-field-icon {
    display: none;
  }

  #openItem .openitem-panel-heading {
    font-size: 10px;
  }

  #openItem .openitem-price-hint {
    font-size: 10px;
  }

}
