/* MED-004: opened legacy overlays must sit above the fixed ui2 shell. */
body.mama-ui2-shell .base-popup,
body.mama-ui2-shell .i-simple-popup:not(.ready) {
  display: none;
}
body.mama-ui2-shell .i-simple-popup.ready {
  display: block;
}
body.mama-ui2-shell .popup.not_display {
  display: none !important;
}
body.mama-ui2-shell .popup:not(.not_display),
body.mama-ui2-shell .i-simple-popup.ready,
body.mama-ui2-shell .b-picture-preview,
body.mama-ui2-shell .b-certificates__popup {
  z-index: var(--mama-z-modal) !important;
}
body.mama-ui2-shell .b-picture-preview {
  position: fixed;
  box-sizing: border-box;
  inset: 0;
  width: 100vw;
  height: 100dvh !important;
  overflow: auto;
  background: rgb(22 17 15 / 88%);
}
body.mama-ui2-shell .b-picture-preview:not(.video) .b-picture-preview__wrapper {
  width: fit-content !important;
  max-width: calc(100vw - 48px);
  height: auto !important;
  margin: 0 auto;
}
body.mama-ui2-shell .b-picture-preview.video .b-picture-preview__content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100% !important;
  margin: 0 !important;
}
body.mama-ui2-shell .b-picture-preview.video .b-picture-preview__wrapper {
  width: min(
    calc(100vw - 48px),
    800px,
    calc((100dvh - 88px) * 4 / 3)
  ) !important;
  height: auto !important;
}
body.mama-ui2-shell .b-picture-preview.video .b-picture-preview__img {
  display: none;
}
body.mama-ui2-shell .b-picture-preview.video .b-picture-preview__video {
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 4 / 3;
}
body.mama-ui2-shell .b-picture-preview.video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
body.mama-ui2-shell .b-picture-preview__img {
  box-sizing: border-box;
  max-width: calc(100vw - 48px) !important;
  max-height: calc(100dvh - 120px) !important;
  border: 8px solid #fff;
  border-radius: 8px;
  object-fit: contain;
}
body.mama-ui2-shell .b-picture-preview__close {
  position: fixed;
  top: 16px;
  right: 16px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  background: #fff;
  color: transparent;
  font-size: 0;
  box-shadow: 0 4px 20px rgb(0 0 0 / 25%);
  z-index: 2;
}
body.mama-ui2-shell .b-picture-preview__close::after {
  content: "×";
  position: static;
  width: auto;
  height: auto;
  background: none;
  color: #2c2522;
  font:
    32px/1 Arial,
    sans-serif;
}
body.mama-ui2-shell .b-picture-preview__close:hover {
  background: #fff1ec;
}
body.mama-ui2-shell
  .b-picture-preview
  :is(
    .b-picture-preview__plane,
    .b-picture-preview__balloon,
    .b-picture-preview__cube,
    .b-picture-preview__ball
  ) {
  display: none;
}
body.mama-ui2-shell .i-simple-popup.popup {
  box-sizing: border-box;
  background: rgb(22 17 15 / 75%);
  color: var(--mama-color-text);
  font-family: var(--mama-font-sans);
}
body.mama-ui2-shell .i-simple-popup.popup.ready:not(.not_display) {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100dvh !important;
  padding: 24px 16px;
  overflow-y: auto;
}
body.mama-ui2-shell .i-simple-popup__content {
  position: relative;
  box-sizing: border-box;
  width: min(calc(100% - 32px), 620px);
  max-width: 620px;
  min-height: 0;
  padding: 24px;
  border: 1px solid var(--mama-color-border);
  border-radius: var(--mama-radius-lg);
  background: var(--mama-color-surface);
  box-shadow: var(--mama-shadow-overlay);
  color: var(--mama-color-text);
  font-family: var(--mama-font-sans);
}
body.mama-ui2-shell
  .i-simple-popup.popup.ready:not(.not_display)
  > .i-simple-popup__content {
  flex: 0 1 620px;
  margin: auto !important;
}
body.mama-ui2-shell .i-simple-popup__content .h2 {
  margin: 0 52px 20px 0;
  color: var(--mama-color-heading);
  font: 600 clamp(22px, 3vw, 28px)/1.2 var(--mama-font-sans);
}
body.mama-ui2-shell .i-simple-popup__content .h2 .comment {
  margin-left: 16px;
  color: var(--mama-color-text-muted);
  font: 500 15px/1.4 var(--mama-font-sans);
}
body.mama-ui2-shell .i-simple-popup__content .b-form__group {
  margin: 0 0 16px;
}
body.mama-ui2-shell
  .i-simple-popup__content
  .b-form__group
  :is(.controls, .b-form__widget, .b-form__widget-wrapper) {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
}
body.mama-ui2-shell .i-simple-popup__content .control-label {
  display: block;
  float: none;
  width: auto;
  margin: 0 0 8px;
  text-align: left;
  font-weight: 600;
}
body.mama-ui2-shell
  .i-simple-popup__content
  .b-form
  :is(
    input[name="USER_LOGIN"],
    input[name="USER_PASSWORD"],
    input[name="USER_EMAIL"]
  ) {
  width: 100%;
}
body.mama-ui2-shell .i-simple-popup__content::after {
  display: none;
}
body.mama-ui2-shell
  .i-simple-popup__content
  :where(h2, h3, p, label, legend, .control-label) {
  color: var(--mama-color-text);
  font-family: var(--mama-font-sans);
}
body.mama-ui2-shell .i-simple-popup__content :where(h2, h3) {
  margin: 0 52px 20px 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.2;
}
body.mama-ui2-shell .i-simple-popup__content form {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--mama-color-text);
  font-family: var(--mama-font-sans);
}
body.mama-ui2-shell
  .i-simple-popup__content
  :where(input:not([type="hidden"]):not([type="checkbox"]), textarea, select) {
  box-sizing: border-box;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--mama-color-border);
  border-radius: var(--mama-radius-sm);
  background: var(--mama-color-surface);
  color: var(--mama-color-text);
  font: 400 16px/1.4 var(--mama-font-sans);
}
body.mama-ui2-shell
  .i-simple-popup__content
  :where(button:not(.mama-button), input[type="submit"]) {
  min-height: 44px;
  border: 0;
  border-radius: var(--mama-radius-sm);
  background: var(--mama-color-action);
  color: var(--mama-color-action-text);
  font: 600 16px/1.3 var(--mama-font-sans);
  box-shadow: none;
}
body.mama-ui2-shell .i-simple-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--mama-color-border);
  border-radius: var(--mama-radius-sm);
  background: var(--mama-color-surface);
  cursor: pointer;
}
body.mama-ui2-shell .i-simple-popup__close::after {
  content: "×";
  position: static;
  width: auto;
  height: auto;
  background: none;
  color: var(--mama-color-text);
  font:
    30px/1 Arial,
    sans-serif;
}
body.mama-ui2-shell .base-popup {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: var(--mama-z-modal);
  height: 100dvh !important;
  overflow-y: auto;
  background: rgb(22 17 15 / 75%);
}
body.mama-ui2-shell .base-popup .base-popup-box {
  box-sizing: border-box;
  position: relative;
  top: auto !important;
  left: auto;
  width: min(calc(100% - 32px), 620px);
  max-width: 620px;
  margin: max(32px, 6vh) auto;
  padding: 24px;
  border: 1px solid var(--mama-color-border);
  border-radius: var(--mama-radius-lg);
  background: var(--mama-color-surface);
  box-shadow: var(--mama-shadow-overlay);
}
body.mama-ui2-shell .base-popup .base-popup-box-inner {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  padding: 0;
  background: none;
  color: var(--mama-color-text);
  font-family: var(--mama-font-sans);
}
body.mama-ui2-shell .base-popup .base-popup-close {
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--mama-color-border);
  border-radius: var(--mama-radius-sm);
  background-color: var(--mama-color-surface);
}
body.mama-ui2-shell
  .base-popup
  :where(h2, h3, label, .control-label, .checkbox) {
  color: var(--mama-color-text);
  font-family: var(--mama-font-sans);
}
body.mama-ui2-shell
  .base-popup
  :where(input:not([type="hidden"]):not([type="checkbox"]), textarea, select) {
  box-sizing: border-box;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--mama-color-border);
  border-radius: var(--mama-radius-sm);
  background: var(--mama-color-surface);
  color: var(--mama-color-text);
  font: 400 16px/1.4 var(--mama-font-sans);
}
body.mama-ui2-shell .b-certificates__popup {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: auto;
  text-align: center;
  background: rgb(22 17 15 / 88%);
}
body.mama-ui2-shell .b-certificates__popup img {
  box-sizing: border-box;
  max-width: calc(100vw - 48px);
  max-height: calc(100dvh - 100px);
  margin-top: 72px;
  border: 8px solid #fff;
  border-radius: 8px;
}
body.mama-ui2-shell .b-certificates__popup .b-picture-preview__close {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  background: #fff;
  color: transparent;
  font-size: 0;
  z-index: 2;
}
body.mama-ui2-shell .b-certificates__popup .b-picture-preview__close::after {
  content: "×";
  position: static;
  width: auto;
  height: auto;
  background: none;
  color: var(--mama-color-text);
  font:
    32px/1 Arial,
    sans-serif;
}
@media (max-width: 767px) {
  body.mama-ui2-shell .b-picture-preview__content {
    margin-top: 88px !important;
  }
}

/* M10: восстановление пароля использует ту же ширину поля и кнопку формы. */
body.mama-ui2-shell
  .i-simple-popup__content
  #remember-area
  .b-form__button
  .b-button__content {
  background: none;
  color: inherit;
  font: inherit;
}

body.mama-review-dialog-open,
body.mama-ui2-shell:has(.i-simple-popup.ready:not(.not_display)) {
  overflow: hidden;
}
