#ifoodCodeDialog.bb-delivery-code-sheet {
  --code-panel: #fff;
  --code-field: #f4f8fb;
  --code-accent: #f28b30;
  position: fixed;
  inset: auto 0 calc(var(--bb-footer-height, 64px) + var(--bb-safe-bottom, 0px));
  box-sizing: border-box;
  width: min(100%, 480px);
  max-width: 100%;
  max-height: calc(100dvh - var(--bb-footer-height, 64px) - var(--bb-safe-bottom, 0px) - 12px);
  margin: 0 auto;
  padding: 18px 18px 20px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px 14px 0 0;
  background: var(--code-panel);
  color: var(--text);
  overscroll-behavior: contain;
}

body[data-theme="dark"] #ifoodCodeDialog.bb-delivery-code-sheet,
html[data-theme="dark"] #ifoodCodeDialog.bb-delivery-code-sheet {
  --code-panel: #102b38;
  --code-field: #15303d;
  --code-accent: #f69a44;
}

#ifoodCodeDialog.bb-delivery-code-sheet::backdrop {
  background: rgba(8, 22, 31, .56);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

#ifoodCodeDialog.bb-delivery-code-sheet[open] {
  animation: bb-code-sheet-in 170ms ease-out;
}

@keyframes bb-code-sheet-in {
  from { opacity: .72; translate: 0 8px; }
  to { opacity: 1; translate: 0 0; }
}

.bb-delivery-code-sheet form {
  display: grid;
  gap: 12px;
}

.bb-delivery-code-sheet form::before {
  content: "";
  display: block;
  width: 34px;
  height: 3px;
  margin: -7px auto 0;
  border-radius: 3px;
  background: var(--line);
}

.bb-delivery-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#ifoodCodeDialog .bb-delivery-code-header h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.bb-delivery-code-close,
.bb-delivery-code-back {
  border: none;
  background: transparent;
  color: inherit;
}

.bb-delivery-code-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  border-radius: 6px;
}

.bb-delivery-code-close:active,
.bb-delivery-code-back:active {
  background: var(--code-field);
}

.bb-delivery-code-order {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-field);
  overflow-wrap: anywhere;
}

.bb-delivery-code-order small,
.bb-delivery-code-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.bb-delivery-code-help,
#ifoodCodeDialog .bb-delivery-code-label {
  margin: 0;
  text-align: center;
}

#ifoodCodeDialog .bb-delivery-code-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.bb-delivery-code-field {
  --code-slots: 4;
  position: relative;
  width: min(100%, 230px);
  margin: 0 auto 16px;
  border-radius: 8px;
}

#ifoodCodeSlots {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 8px;
}

#ifoodCodeSlots span {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--code-field);
  font-size: 24px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

#ifoodCodeSlots span.is-empty {
  color: var(--muted);
}

#ifoodCodeSlots span.is-current {
  border-color: var(--code-accent);
  outline: 1px solid var(--code-accent);
  outline-offset: 1px;
}

#ifoodCodeDialog #ifoodDeliveryCode,
#ifoodCodeDialog #ifoodDeliveryCode:focus {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 0 0 calc((230px / var(--code-slots) - 10px) / 2);
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: calc(230px / var(--code-slots) - 10px);
}

#ifoodCodeDialog #ifoodDeliveryCode::selection {
  background: transparent;
}

#ifoodCodeDialog #ifoodCodeSubmit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

.bb-delivery-code-back {
  justify-self: center;
  min-height: 40px;
  padding: 7px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body[data-view="entregas"] #toast.bb-delivery-completion:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
  position: fixed;
  inset: calc(10px + var(--bb-safe-top, 0px)) 12px auto;
  width: min(calc(100% - 24px), 450px);
  max-width: none;
  margin: 0 auto;
  padding: 10px 13px;
  transform: none;
  border: 1px solid #85cead;
  border-radius: 8px;
  background: #e2f6e9;
  color: #0e6245;
  text-align: left;
}

body[data-view="entregas"][data-theme="dark"] #toast.bb-delivery-completion:not([hidden]),
html[data-theme="dark"] body[data-view="entregas"] #toast.bb-delivery-completion:not([hidden]) {
  background: #153f36;
  border-color: #2a735a;
  color: #75e0a8;
}

.bb-delivery-completion-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.bb-delivery-completion strong,
.bb-delivery-completion small {
  display: block;
}

.bb-delivery-completion small {
  margin-top: 2px;
  font-size: 11px;
}

@media (prefers-reduced-motion: reduce) {
  #ifoodCodeDialog.bb-delivery-code-sheet[open] {
    animation: none;
  }
}
