/* Mount da tela de envio/status: coluna flex para preencher 100dvh sem “empilhar” min-height duplicado */
#frmPedidoEnvio > .screen-mount {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  box-sizing: border-box;
}

#frmPedidoEnvio > .screen-mount > .order-envio {
  flex: 1 1 auto;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
}

/* Boot / pagamento 3DS — spinner + “Preparando envio” centralizados na viewport */
.order-envio--boot {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100svh;
}

.order-envio-boot-center {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  box-sizing: border-box;
  padding-inline: 1rem;
  padding-block: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-bottom));
  text-align: center;
}

/* Viewports baixos (SE, landscape): reduz respiro vertical herdado do template */
@media (max-height: 720px) {
  .order-envio-root--status .order-envio-compact-h {
    margin-top: 0.5rem;
  }
  .order-envio-root--status .order-envio-status-stack {
    gap: 0.25rem;
  }
  .order-envio-root--status .order-envio-compact-section {
    margin-top: 0;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .order-envio-root--status .order-envio-compact-track {
    margin-top: 0.5rem;
  }
  .order-envio-root--status .order-envio-compact-label {
    margin-top: 0.5rem;
    min-height: 0;
  }
  .order-envio-root--status .order-envio-compact-footnote {
    margin-top: 0.5rem;
    font-size: 0.625rem;
    line-height: 1.35;
  }
}

@media (max-width: 380px) {
  .order-envio-root--status .order-envio-compact-card {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

/* Modal “Itens do pedido”: fade do fundo + painel sobe (sheet no mobile) */
#order-envio-itens-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

#order-envio-itens-overlay.order-envio-itens-overlay--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#order-envio-itens-overlay #order-envio-itens-panel {
  transform: translate3d(0, 100%, 0);
  opacity: 0;
  transition:
    transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease-out;
  will-change: transform;
}

#order-envio-itens-overlay.order-envio-itens-overlay--open #order-envio-itens-panel {
  transform: translate3d(0, 0, 0);
  opacity: 1;
  will-change: auto;
}

@media (min-width: 640px) {
  #order-envio-itens-overlay #order-envio-itens-panel {
    transform: translate3d(0, 1.25rem, 0) scale(0.98);
  }

  #order-envio-itens-overlay.order-envio-itens-overlay--open #order-envio-itens-panel {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  #order-envio-itens-overlay,
  #order-envio-itens-overlay #order-envio-itens-panel {
    transition-duration: 0.01ms;
  }

  #order-envio-itens-overlay #order-envio-itens-panel {
    transform: none;
  }

  #order-envio-itens-overlay:not(.order-envio-itens-overlay--open) #order-envio-itens-panel {
    opacity: 0;
  }

  #order-envio-itens-overlay.order-envio-itens-overlay--open #order-envio-itens-panel {
    opacity: 1;
  }
}

/* Erro de envio — mensagens do WS com HTML legado */
.order-envio--error {
  position: relative;
  isolation: isolate;
  color: rgb(15 23 42);
  background: linear-gradient(180deg, #f0f4f8 0%, #ffffff 42%, #eef2f7 100%);
}

.dark .order-envio--error {
  color: rgb(226 232 240);
  background: linear-gradient(180deg, var(--color-xbg-dark, #121214) 0%, #14161c 48%, var(--color-xbg-dark, #121214) 100%);
}

.order-envio-error__bg {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgb(244 63 94 / 0.08) 0%, rgb(251 191 36 / 0.05) 28%, transparent 62%);
}

.dark .order-envio-error__bg {
  background: linear-gradient(180deg, rgb(244 63 94 / 0.12) 0%, rgb(251 191 36 / 0.06) 28%, transparent 62%);
}

.order-envio-error__glow {
  pointer-events: none;
  position: absolute;
  z-index: 0;
  border-radius: 9999px;
  filter: blur(48px);
}

.order-envio-error__glow--left {
  top: 6rem;
  left: -5rem;
  width: 11rem;
  height: 11rem;
  background: rgb(27 97 167 / 0.1);
}

.order-envio-error__glow--right {
  top: 10rem;
  right: -4rem;
  width: 10rem;
  height: 10rem;
  background: rgb(244 63 94 / 0.15);
}

.dark .order-envio-error__glow--left {
  background: rgb(56 189 248 / 0.12);
}

.dark .order-envio-error__glow--right {
  background: rgb(244 63 94 / 0.12);
}

.order-envio--error > :not(.order-envio-error__bg):not(.order-envio-error__glow) {
  position: relative;
  z-index: 1;
}

.order-envio-error__logo-wrap {
  border: 1px solid rgb(15 23 42 / 0.06);
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.9);
  padding: 0.5rem 1rem;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

.dark .order-envio-error__logo-wrap {
  border-color: rgb(255 255 255 / 0.1);
  background: rgb(255 255 255 / 0.06);
}

.order-envio-error__footer {
  border-top: 1px solid rgb(15 23 42 / 0.08);
  background: rgb(255 255 255 / 0.92);
  padding-top: 0.75rem;
  padding-inline: 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dark .order-envio-error__footer {
  border-top-color: rgb(255 255 255 / 0.1);
  background: rgb(20 22 28 / 0.96);
}

.order-envio-error__footer-inner {
  width: 100%;
  max-width: 32rem;
  margin-inline: auto;
}

.order-envio-error__cta {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 1rem;
  padding: 0.875rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.order-envio-error__cta:active {
  transform: scale(0.99);
}

.order-envio-error__cta--primary {
  color: var(--color-brand-on-primary, #fff);
  background: linear-gradient(
    105deg,
    var(--color-brand-primary, #c70d0d),
    var(--color-brand-primary-hover, #a00b0b)
  );
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--color-brand-primary, #c70d0d) 38%, transparent);
}

.order-envio-error__cta--primary:hover {
  filter: brightness(1.06);
}

.order-envio-error__cta--primary:active {
  background: linear-gradient(
    105deg,
    var(--color-brand-primary-hover, #a00b0b),
    var(--color-brand-primary-active, #8a0909)
  );
}

.order-envio-error__icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5.75rem;
  height: 5.75rem;
}

.order-envio-error__icon-ring {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgb(244 63 94 / 0.14), rgb(251 191 36 / 0.12), rgb(27 97 167 / 0.1));
  animation: order-envio-error-pulse 2.4s ease-in-out infinite;
}

.dark .order-envio-error__icon-ring {
  background: linear-gradient(135deg, rgb(244 63 94 / 0.2), rgb(251 191 36 / 0.14), rgb(56 189 248 / 0.12));
}

.order-envio-error__icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 9999px;
  background: linear-gradient(145deg, rgb(255 255 255 / 0.98), rgb(248 250 252 / 0.92));
  box-shadow:
    0 12px 32px -10px rgb(225 29 72 / 0.35),
    inset 0 1px 0 rgb(255 255 255 / 0.8);
  color: rgb(225 29 72);
  font-size: 2rem;
}

.dark .order-envio-error__icon {
  background: linear-gradient(145deg, rgb(30 32 40 / 0.95), rgb(20 22 28 / 0.98));
  box-shadow:
    0 12px 32px -10px rgb(0 0 0 / 0.45),
    inset 0 1px 0 rgb(255 255 255 / 0.06);
  color: rgb(251 113 133);
}

.order-envio-error__title {
  max-width: 20rem;
  margin-inline: auto;
  color: rgb(15 23 42);
}

.dark .order-envio-error__title {
  color: rgb(241 245 249);
}

.order-envio-error__lead {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgb(71 85 105);
  text-align: center;
}

.dark .order-envio-error__lead {
  color: rgb(203 213 225 / 0.88);
}

.order-envio-error__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.order-envio-error__list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid rgb(15 23 42 / 0.08);
  border-radius: 0.875rem;
  background: rgb(255 255 255 / 0.82);
  box-shadow: 0 4px 14px -8px rgb(15 23 42 / 0.25);
}

.dark .order-envio-error__list-item {
  border-color: rgb(255 255 255 / 0.1);
  background: rgb(255 255 255 / 0.05);
  box-shadow: none;
}

.order-envio-error__list-badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.625rem;
  background: rgb(225 29 72 / 0.1);
  color: rgb(190 18 60);
  font-size: 0.8rem;
}

.dark .order-envio-error__list-badge {
  background: rgb(244 63 94 / 0.16);
  color: rgb(251 113 133);
}

.order-envio-error__list-label {
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: rgb(15 23 42);
  text-align: left;
}

.dark .order-envio-error__list-label {
  color: rgb(241 245 249);
}

.order-envio-error__rich {
  font-size: 0.875rem;
  line-height: 1.55;
  color: rgb(71 85 105);
  text-align: center;
}

.dark .order-envio-error__rich {
  color: rgb(203 213 225 / 0.88);
}

.order-envio-error__rich b,
.order-envio-error__rich strong {
  font-weight: 700;
  color: rgb(15 23 42);
}

.dark .order-envio-error__rich b,
.dark .order-envio-error__rich strong {
  color: rgb(248 250 252);
}

.order-envio-error__hint {
  margin: 1.25rem auto 0;
  max-width: 22rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgb(100 116 139);
  text-align: center;
}

.dark .order-envio-error__hint {
  color: rgb(148 163 184 / 0.85);
}

@keyframes order-envio-error-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.82;
  }
}

@media (prefers-reduced-motion: reduce) {
  .order-envio-error__icon-ring {
    animation: none;
  }
}

/* Tela envio / status do pedido — scroll interno alinhado ao DS (barras discretas) */
.order-envio__scroll {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.order-envio__scroll::-webkit-scrollbar {
  display: none;
}

.order-envio__plane {
  animation: order-envio-plane 1.6s ease-in-out infinite;
}

@keyframes order-envio-plane {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-8px) scale(1.05);
    opacity: 0.92;
  }
}

.order-envio__ring {
  animation: order-envio-ring 1.2s ease-in-out infinite;
}

@keyframes order-envio-ring {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(27, 97, 167, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(27, 97, 167, 0);
  }
}

.dark .order-envio__ring {
  animation: order-envio-ring-dark 1.2s ease-in-out infinite;
}

@keyframes order-envio-ring-dark {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.25);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(56, 189, 248, 0);
  }
}

/* Pagar.me 3DS — iframe centralizado (padrão POC) */
#pagarme-3ds-portal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}

#pagarme-3ds-portal[aria-hidden='true'] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#pagarme-3ds-portal[aria-hidden='false'] {
  display: block;
  visibility: visible;
  pointer-events: auto;
}

.pagarme-tds-method-hidden {
  display: none !important;
}

.pagarme-tds-challenge-container {
  position: relative;
  z-index: 2147483002;
  pointer-events: none;
}

.pagarme-3ds-challenge-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.pagarme-3ds-challenge-dismiss {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 2147483005;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.pagarme-3ds-challenge-dismiss:hover {
  background: rgba(0, 0, 0, 0.62);
}

.pagarme-tds-challenge-container iframe,
#pagarme-tds-challenge-container iframe,
#pagarme-3ds-portal iframe {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: min(92vw, 500px) !important;
  height: min(85dvh, 600px) !important;
  max-width: 500px !important;
  max-height: 600px !important;
  min-height: 360px !important;
  border: 2px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35) !important;
  background: #fff !important;
  z-index: 2147483004 !important;
  pointer-events: auto !important;
}

body.pagarme-3ds-challenge-active {
  overflow: hidden;
}

/* PagBank / Cardinal (Songbird) — modal 3DS em produção */
.pagseguro-3ds-challenge-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

body.pagseguro-3ds-challenge-active {
  overflow: hidden;
}

#Cardinal-Modal,
#Cardinal-ModalContent,
#Cardinal-ModalOverlay,
.cardinalOverlay,
#Cardinal-Overlay {
  z-index: 2147483002 !important;
}

#Cardinal-CCA-IFrame,
#CardinalCollectionFrame,
#Cardinal-ModalContent iframe {
  z-index: 2147483004 !important;
  pointer-events: auto !important;
}

@media (max-width: 480px) {
  #Cardinal-ModalContent,
  #Cardinal-ModalContent iframe,
  #Cardinal-CCA-IFrame {
    max-width: 96vw !important;
    max-height: 85dvh !important;
  }

  .pagarme-tds-challenge-container iframe,
  #pagarme-tds-challenge-container iframe,
  #pagarme-3ds-portal iframe {
    width: min(96vw, 500px) !important;
    height: min(78dvh, 560px) !important;
    min-height: 320px !important;
  }
}
