/* Código de entrega desktop v2: preserva exatamente a estrutura real do HTML. */
@media (min-width: 769px) {
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen {
    display: block !important;
    position: relative !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 24px 26px 36px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #fff !important;
    color: #000000 !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen::before,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen::after,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-art,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-lottie {
    display: none !important;
    content: none !important;
  }
  /* A ordem permanece: screen > header > hero > body. */
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-head {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 0 34px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-head > .sd-delivery-code-back {
    position: static !important;
    display: grid !important;
    place-items: center !important;
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    margin: 0 10px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    outline: 0 !important;
    background: #f3f3f3 !important;
    color: #111827 !important;
    box-shadow: none !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-head > .sd-delivery-code-back svg,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-head > .sd-delivery-code-back svg path {
    width: 16px !important;
    height: 16px !important;
    color: #111827 !important;
    stroke: #111827 !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-head > .sd-subhead-text {
    display: block !important;
    margin: 0 !important;
    color: #000000 !important;
    font: 600 17px/1.25 "Inter", sans-serif !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-hero-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 108px !important;
    margin: 0 0 18px !important;
    padding: 20px 22px !important;
    border: 1px solid #e3e3e3 !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: none !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-hero-card .sd-delivery-code-label-hero {
    display: block !important;
    margin: 0 0 8px !important;
    color: #000000 !important;
    font: 400 14px/1.25 "Inter", sans-serif !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-hero-card .sd-delivery-hero-copy,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-hero-card .sd-delivery-hero-copy p {
    display: block !important;
    margin: 0 !important;
    color: #000000 !important;
    font: 500 16px/1.35 "Inter", sans-serif !important;
    text-align: left !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-body {
    position: static !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-code-box {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 78px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 0 18px !important;
    padding: 16px 20px !important;
    transform: none !important;
    border: 1px solid #e3e3e3 !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: none !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-code-digit {
    color: #000000 !important;
    font: 600 24px/1 "Inter", sans-serif !important;
    letter-spacing: .08em !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-store-block {
    margin: 0 0 24px !important;
    padding: 0 !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-howto,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-orders {
    width: 100% !important;
    margin: 0 0 22px !important;
    padding: 0 !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-howto h3,
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen .sd-delivery-orders h3 {
    margin: 0 0 10px !important;
    color: #000000 !important;
    font: 600 15px/1.25 "Inter", sans-serif !important;
  }
}

/* v3: contorno lateral do painel, sem linhas internas no cabeçalho. */
@media (min-width: 769px) {
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen {
    border-top: 0 !important;
    border-right: 1px solid #e3e3e3 !important;
    border-bottom: 0 !important;
    border-left: 1px solid #e3e3e3 !important;
    border-radius: 0 !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > .sd-delivery-code-head {
    border: 0 !important;
    border-radius: 0 !important;
  }
}

/* v4: borda superior no header real da tela. */
@media (min-width: 769px) {
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > header.sd-subpage-head.sd-delivery-code-head {
    border-top: 1px solid #e3e3e3 !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
  }
}

/* v5: header encostado no topo do painel, como na referência. */
@media (min-width: 769px) {
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen {
    padding-top: 0 !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay .sd-delivery-code-screen > header.sd-subpage-head.sd-delivery-code-head {
    height: 64px !important;
    min-height: 64px !important;
    margin-top: 0 !important;
    margin-bottom: 34px !important;
    padding: 0 !important;
    border-top: 1px solid #e3e3e3 !important;
  }
}

/* Padronização de margens do perfil desktop.
   A estrutura completa do drawer evita que os resets legados mais específicos
   anulem os recuos. Nenhuma regra abaixo é aplicada no mobile. */
@media (min-width: 769px) {
  html body.sd-desktop #overlay {
    --sd-profile-inset-top: 24px;
    --sd-profile-inset-side: 26px;
    --sd-profile-inset-bottom: 36px;
    --sd-profile-head-gap: 22px;
  }

  html body.sd-desktop #overlay.sd-profile-overlay:has(#notificationsBody) > .drawer.profile-drawer > .sd-status-page,
  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer > :is(.sd-profile-screen, .sd-subpage, .sd-hist-page, .sd-notif-page, .wallet-ref, .wallet-mobile),
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer > .sd-delivery-code-screen,
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer > .sd-order-track-detail-screen {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: var(--sd-profile-inset-top) var(--sd-profile-inset-side) var(--sd-profile-inset-bottom) !important;
    overflow-x: hidden !important;
  }

  html body.sd-desktop #overlay.sd-profile-overlay:has(#notificationsBody) > .drawer.profile-drawer > .sd-status-page > .sd-subpage-head,
  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer > :is(.sd-profile-screen, .sd-subpage, .sd-hist-page, .sd-notif-page, .wallet-ref, .wallet-mobile) > :is(.sd-subpage-head, .sd-profile-head, .sd-hist-head),
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer > .sd-delivery-code-screen > header.sd-subpage-head.sd-delivery-code-head {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 40px !important;
    height: auto !important;
    margin: 0 0 var(--sd-profile-head-gap) !important;
    padding: 0 !important;
    gap: 10px !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer .sd-subpage-head .sd-subhead-text,
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer .sd-delivery-code-head .sd-subhead-text {
    position: static !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: normal !important;
    transform: none !important;
  }

  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer .sd-subpage-head .sd-subpage-back,
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer .sd-delivery-code-head .sd-delivery-code-back {
    position: static !important;
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }

  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer > .sd-status-page > .sd-notif-body,
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer > .sd-delivery-code-screen > .sd-delivery-code-body {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }

  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer > .sd-delivery-code-screen > .sd-delivery-hero-card {
    box-sizing: border-box !important;
    width: 100% !important;
    margin: 0 0 18px !important;
  }

  /* O acompanhamento usa somente a rolagem do drawer no desktop.
     O mapa, os detalhes e todas as ações permanecem no HTML original. */
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer {
    overflow-y: auto !important;
  }
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer > .sd-order-track-detail-screen {
    display: block !important;
    height: auto !important;
    min-height: 100% !important;
    overflow-y: visible !important;
  }
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer > .sd-order-track-detail-screen > .sd-order-track-map-hero {
    box-sizing: border-box !important;
    width: 100% !important;
    margin: 0 0 22px !important;
  }
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer > .sd-order-track-detail-screen > .sd-order-track-sheet {
    box-sizing: border-box !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }
}

/* Revisão desktop: remove espaço vazio e recuos duplicados sem mudar ações. */
@media (min-width: 769px) {
  html body.sd-desktop #overlay {
    --sd-profile-text: #000000;
    --sd-profile-tab-text: #000000;
    --sd-profile-tab-active: #000000;
    --sd-profile-tab-border: #d8d8d8;
    --sd-profile-surface: #fff;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer > .sd-delivery-code-screen > .sd-delivery-hero-card {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  html body.sd-desktop #overlay.sd-profile-overlay:has(#notificationsBody) > .drawer.profile-drawer > .sd-status-page > .sd-subpage-head .sd-subhead-text {
    color: var(--sd-profile-text) !important;
    font: 600 17px/1.25 "Inter", sans-serif !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer .sd-delivery-orders #deliveryCodeOrderFilters {
    display: flex !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 0 22px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer #deliveryCodeOrderFilters > .sd-hist-tab {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    border: 1px solid var(--sd-profile-tab-border) !important;
    border-radius: 10px !important;
    background: var(--sd-profile-surface) !important;
    color: var(--sd-profile-tab-text) !important;
    font: 400 14px/1.2 "Inter", sans-serif !important;
    box-shadow: none !important;
    transform: none !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer #deliveryCodeOrderFilters > .sd-hist-tab.is-active,
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer #deliveryCodeOrderFilters > .sd-hist-tab[aria-selected="true"] {
    color: var(--sd-profile-tab-active) !important;
    font-weight: 600 !important;
  }
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer.sd-drawer-lateral {
    display: block !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden auto !important;
    scrollbar-width: none !important;
  }
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer.sd-drawer-lateral > .sd-order-track-detail-screen {
    height: auto !important;
    min-height: 100% !important;
    overflow: visible !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer > .sd-delivery-code-screen {
    overflow: visible !important;
  }
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer,
  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer,
  html body.sd-desktop #overlay.sd-profile-overlay .sd-status-page {
    scrollbar-width: none !important;
  }
  html body.sd-desktop #overlay.sd-order-track-detail-active > .drawer.sd-order-track-detail-drawer::-webkit-scrollbar,
  html body.sd-desktop #overlay.sd-delivery-overlay > .drawer.sd-delivery-drawer::-webkit-scrollbar,
  html body.sd-desktop #overlay.sd-profile-overlay > .drawer.profile-drawer::-webkit-scrollbar,
  html body.sd-desktop #overlay.sd-profile-overlay .sd-status-page::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  html:has(body.sd-desktop #overlay:not(.hidden):is(.sd-order-track-detail-active, .sd-delivery-overlay, .sd-profile-overlay)),
  body.sd-desktop:has(#overlay:not(.hidden):is(.sd-order-track-detail-active, .sd-delivery-overlay, .sd-profile-overlay)) {
    overflow: hidden !important;
  }
}
