.bag-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2990;
  background: rgba(15, 12, 10, 0.07);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.bag-drawer {
  --bag-ink: #191613;
  --bag-muted: #625b53;
  --bag-paper: #fffdf8;
  --bag-paper-deep: #f0ece4;
  --bag-line: rgba(25, 22, 19, 0.28);
  position: fixed;
  z-index: 3000;
  top: var(--bag-anchor-top, 86px);
  right: var(--bag-anchor-right, 20px);
  width: min(410px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - var(--bag-anchor-top, 86px) - 14px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bag-paper);
  color: var(--bag-ink);
  border: 1px solid rgba(25, 22, 19, 0.2);
  filter: drop-shadow(0 18px 28px rgba(15, 12, 10, 0.2));
  clip-path: polygon(
    0 0,
    100% 0,
    100% calc(100% - 10px),
    96.5% 100%,
    93% calc(100% - 10px),
    89.5% 100%,
    86% calc(100% - 10px),
    82.5% 100%,
    79% calc(100% - 10px),
    75.5% 100%,
    72% calc(100% - 10px),
    68.5% 100%,
    65% calc(100% - 10px),
    61.5% 100%,
    58% calc(100% - 10px),
    54.5% 100%,
    51% calc(100% - 10px),
    47.5% 100%,
    44% calc(100% - 10px),
    40.5% 100%,
    37% calc(100% - 10px),
    33.5% 100%,
    30% calc(100% - 10px),
    26.5% 100%,
    23% calc(100% - 10px),
    19.5% 100%,
    16% calc(100% - 10px),
    12.5% 100%,
    9% calc(100% - 10px),
    5.5% 100%,
    2.5% calc(100% - 10px),
    0 100%
  );
  transform: translateY(-8px) scale(0.985);
  transform-origin: top right;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 0.72, 0.2, 1), visibility 0s linear 0.24s;
}

body.bag-drawer-open .bag-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.bag-drawer-open .bag-drawer {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.bag-drawer-header {
  position: relative;
  min-height: 122px;
  padding: 18px 54px 14px;
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 9px;
  border-bottom: 1px dashed var(--bag-line);
}

.bag-drawer-logo {
  display: block;
  width: min(248px, 88%);
  height: auto;
}

.bag-drawer-receipt-meta {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  color: var(--bag-muted);
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bag-drawer-receipt-meta span::before {
  content: "·";
  margin-right: 8px;
}

.bag-drawer-heading {
  margin: 0;
  font: inherit;
  line-height: 1;
}

.bag-drawer-close,
.bag-order-back {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.bag-drawer-close {
  position: absolute;
  top: 11px;
  right: 11px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--bag-muted);
  font-size: 1.35rem;
  line-height: 1;
}

.bag-drawer-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.bag-drawer-view {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.bag-drawer-view[hidden] {
  display: none;
}

.bag-drawer-items {
  padding: 0 20px;
}

.bag-drawer-empty {
  margin: auto;
  padding: 54px 34px 66px;
  text-align: center;
}

.bag-drawer-empty h3 {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.3rem;
  font-weight: 400;
}

.bag-drawer-empty p {
  margin: 0 0 26px;
  color: var(--bag-muted);
  line-height: 1.65;
}

.bag-drawer-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 17px 0;
  border-bottom: 1px dashed var(--bag-line);
}

.bag-drawer-item-image {
  width: 64px;
  height: 72px;
  object-fit: contain;
  background: var(--bag-paper-deep);
}

.bag-drawer-item-copy {
  min-width: 0;
}

.bag-drawer-item-brand {
  margin-bottom: 4px;
  color: var(--bag-muted);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bag-drawer-item-name {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.05;
}

.bag-drawer-item-meta {
  margin-top: 5px;
  color: var(--bag-muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.bag-drawer-item-price {
  align-self: center;
  max-width: 88px;
  text-align: right;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
}

.bag-drawer-item-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.bag-line-quantity {
  height: 28px;
  display: grid;
  grid-template-columns: 26px 24px 26px;
  align-items: center;
  border: 1px solid var(--bag-line);
}

.bag-line-quantity button {
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.bag-line-quantity span {
  text-align: center;
  font-size: 0.74rem;
}

.bag-drawer-remove {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  padding: 0 0 3px;
  color: var(--bag-muted);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  cursor: pointer;
}

.bag-drawer-summary {
  margin-top: auto;
  padding: 20px 20px 32px;
  border-top: 0;
  background: var(--bag-paper);
}

.bag-drawer-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bag-drawer-total strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.bag-drawer-note {
  margin: 9px 0 20px;
  color: var(--bag-muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.bag-drawer-primary,
.bag-drawer-secondary {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bag-ink);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  cursor: pointer;
}

.bag-drawer-primary {
  background: var(--bag-ink);
  color: var(--bag-paper);
  text-decoration: none;
}

.bag-drawer-secondary {
  margin-top: 8px;
  border-color: transparent;
  background: transparent;
  color: var(--bag-ink);
  text-decoration: none;
}

.bag-order-view {
  padding: 20px 22px 34px;
}

.bag-order-back {
  align-self: flex-start;
  margin-bottom: 24px;
  padding: 0 0 4px;
  border-bottom: 1px solid currentColor;
  color: var(--bag-muted);
  font-size: 0.61rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bag-order-intro h3 {
  margin: 0 0 10px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1;
}

.bag-order-intro p {
  margin: 0 0 26px;
  color: var(--bag-muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.bag-order-form {
  display: grid;
  gap: 15px;
}

.bag-order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.bag-order-field {
  display: grid;
  gap: 7px;
}

.bag-order-field label {
  font-size: 0.59rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bag-order-field input,
.bag-order-field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--bag-line);
  border-radius: 0;
  background: transparent;
  padding: 10px 0;
  outline: none;
}

.bag-order-field textarea {
  min-height: 82px;
  resize: vertical;
}

.bag-order-field input:focus,
.bag-order-field textarea:focus {
  border-bottom-color: var(--bag-ink);
}

.bag-order-submit {
  margin-top: 8px;
}

.bag-payment-methods {
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 0;
}

.bag-payment-methods[hidden] {
  display: none;
}

.bag-payment-methods legend {
  width: 100%;
  margin-bottom: 10px;
  font-size: 0.59rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bag-payment-methods label {
  position: relative;
  display: block;
  cursor: pointer;
}

.bag-payment-methods input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.bag-payment-choice {
  min-height: 58px;
  padding: 10px 11px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--bag-line);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.bag-payment-choice b {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.bag-payment-choice small {
  color: var(--bag-muted);
  font-size: 0.62rem;
  line-height: 1.3;
}

.bag-payment-methods input:checked + .bag-payment-choice {
  border-color: var(--bag-ink);
  background: var(--bag-paper-deep);
}

.bag-payment-methods input:focus-visible + .bag-payment-choice {
  outline: 2px solid var(--bag-ink);
  outline-offset: 2px;
}

.bag-payment-note,
.bag-order-error {
  font-size: 0.65rem;
  line-height: 1.5;
}

.bag-payment-note {
  color: var(--bag-muted);
}

.bag-order-terms {
  margin: -4px 0 0;
  color: var(--bag-muted);
  font-size: 0.62rem;
  line-height: 1.55;
}

.bag-order-terms a {
  color: var(--bag-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bag-payment-note[hidden],
.bag-order-error[hidden] {
  display: none;
}

.bag-order-error {
  padding: 10px 12px;
  border-left: 2px solid #8f2f2f;
  background: rgba(143, 47, 47, 0.08);
  color: #702424;
}

.bag-drawer-primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.bag-order-success {
  margin: auto;
  padding: 64px 30px;
  text-align: center;
}

.bag-order-success h3 {
  margin: 0 0 12px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2.5rem;
  font-weight: 400;
}

.bag-order-success p {
  margin: 0 auto 22px;
  max-width: 330px;
  color: var(--bag-muted);
  line-height: 1.65;
}

.bag-order-reference {
  margin-bottom: 28px;
  font-size: 0.67rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bag-success-mark {
  width: 42px;
  height: 42px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}

@media (max-width: 520px) {
  .bag-drawer {
    top: 8px;
    right: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .bag-drawer-header {
    min-height: 112px;
    padding: 16px 46px 12px;
  }

  .bag-drawer-logo {
    width: min(220px, 92%);
  }

  .bag-drawer-items,
  .bag-drawer-summary,
  .bag-order-view {
    padding-left: 18px;
    padding-right: 18px;
  }

  .bag-drawer-item {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .bag-drawer-item-image {
    width: 56px;
    height: 64px;
  }

  .bag-drawer-item-price {
    max-width: 76px;
    font-size: 0.66rem;
  }

  .bag-order-grid,
  .bag-payment-methods {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bag-drawer,
  .bag-drawer-backdrop {
    transition-duration: 0.001ms;
  }
}
