:root {
  --hb-modal-navy: #081b38;
  --hb-modal-blue: #0861d9;
  --hb-modal-green: #159447;
  --hb-modal-line: #dce3ec;
  --hb-modal-muted: #667085;
}

body.hb-cart-modal-open { overflow: hidden; }

.hb-cart-modal[hidden] { display: none !important; }
.hb-cart-modal {
  position: fixed;
  z-index: 100000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hb-cart-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(4 15 31 / 66%);
  backdrop-filter: blur(2px);
}

.hb-cart-modal__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px 18px;
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 34px;
  border: 1px solid var(--hb-modal-line);
  border-radius: 14px;
  background: #fff;
  color: var(--hb-modal-navy);
  box-shadow: 0 24px 80px rgb(8 27 56 / 24%);
  transform: translateY(var(--hb-sheet-offset, 0));
  transition: transform .22s ease;
}

.hb-cart-modal__handle { display: none; }
.hb-cart-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--hb-modal-navy);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.hb-cart-modal__success {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--hb-modal-green);
  color: #fff;
  font-size: 30px;
  font-weight: 800;
}

.hb-cart-modal__title { margin: 1px 54px 2px 0; font-size: 27px; line-height: 1.2; }
.hb-cart-modal__status { margin: 0; color: var(--hb-modal-muted); font-size: 15px; }
.hb-cart-modal__loading,
.hb-cart-modal__content,
.hb-cart-modal__error { grid-column: 1 / -1; }
.hb-cart-modal__loading,
.hb-cart-modal__error { padding: 30px; text-align: center; color: var(--hb-modal-muted); }
.hb-cart-modal__error { margin-top: 16px; border: 1px solid #fecaca; border-radius: 10px; background: #fff7f7; color: #b42318; }

.hb-cart-shipping {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 5px 14px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #bee7cc;
  border-radius: 9px;
  background: #f5fcf7;
}
.hb-cart-shipping__icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #dff5e6;
  color: var(--hb-modal-green);
  font-size: 23px;
}
.hb-cart-shipping strong { align-self: end; color: var(--hb-modal-green); font-size: 15px; }
.hb-cart-shipping__track { height: 8px; overflow: hidden; border-radius: 99px; background: #dfe5eb; }
.hb-cart-shipping__bar { display: block; height: 100%; border-radius: inherit; background: var(--hb-modal-green); }

.hb-cart-modal__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  margin-top: 18px;
}
.hb-cart-modal__product,
.hb-cart-modal__summary {
  border: 1px solid var(--hb-modal-line);
  border-radius: 10px;
}
.hb-cart-modal__product {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}
.hb-cart-modal__product img { width: 150px; height: 150px; object-fit: contain; }
.hb-cart-modal__brand { margin: 0 0 6px; color: var(--hb-modal-blue); font-size: 14px; font-weight: 800; }
.hb-cart-modal__name { margin: 0 0 8px; font-size: 21px; line-height: 1.3; }
.hb-cart-modal__sku { margin: 0 0 18px; color: var(--hb-modal-muted); }
.hb-cart-modal__quantity {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--hb-modal-line);
  border-radius: 7px;
  font-weight: 700;
}
.hb-cart-modal__quantity button,
.hb-cart-modal__quantity span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.hb-cart-modal__quantity button { border: 0; background: #fff; color: var(--hb-modal-navy); font-size: 20px; cursor: pointer; }
.hb-cart-modal__quantity button:disabled { color: #a8b0bb; cursor: not-allowed; }
.hb-cart-modal__quantity span { border-inline: 1px solid var(--hb-modal-line); }
.hb-cart-modal__product-actions { display: grid; justify-items: end; gap: 16px; }
.hb-cart-modal__line-total { white-space: nowrap; font-size: 22px; font-weight: 800; }
.hb-cart-modal__remove { min-width: 44px; min-height: 44px; border: 1px solid var(--hb-modal-line); border-radius: 7px; background: #fff; color: #b42318; cursor: pointer; }
.hb-cart-modal__summary { padding: 22px; }
.hb-cart-modal__summary h3 { margin: 0 0 14px; font-size: 20px; }
.hb-cart-modal__summary-row { display: flex; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--hb-modal-line); }
.hb-cart-modal__summary-row strong { font-size: 19px; }
.hb-cart-modal__tax { margin: 4px 0 0; color: var(--hb-modal-muted); font-size: 13px; }
.hb-cart-recommendations { margin-top: 18px; }
.hb-cart-recommendations h3 { margin: 0 0 10px; font-size: 18px; }
.hb-cart-recommendations__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hb-cart-recommendation { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--hb-modal-line); border-radius: 9px; }
.hb-cart-recommendation img { width: 72px; height: 72px; object-fit: contain; }
.hb-cart-recommendation strong { display: block; font-size: 13px; line-height: 1.25; }
.hb-cart-recommendation span { display: block; margin-top: 5px; color: var(--hb-modal-blue); font-weight: 800; }
.hb-cart-recommendation button { min-width: 62px; min-height: 44px; border: 1px solid var(--hb-modal-blue); border-radius: 7px; background: #fff; color: var(--hb-modal-blue); font-weight: 800; cursor: pointer; }

.hb-cart-modal__actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 14px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--hb-modal-line);
}
.hb-cart-modal__action {
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hb-modal-blue);
  border-radius: 7px;
  background: #fff;
  color: var(--hb-modal-blue) !important;
  font-weight: 800;
  text-decoration: none !important;
  cursor: pointer;
}
.hb-cart-modal__action--primary { background: var(--hb-modal-blue); color: #fff !important; }
.hb-cart-modal__close:focus-visible,
.hb-cart-modal__quantity button:focus-visible,
.hb-cart-modal__remove:focus-visible,
.hb-cart-modal__action:focus-visible { outline: 3px solid #8abaf5; outline-offset: 2px; }

@media (max-width: 767px) {
  .hb-cart-modal {
    place-items: end center;
    padding: 0;
  }
  .hb-cart-modal__backdrop { background: rgb(4 15 31 / 72%); }
  .hb-cart-modal__dialog {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 8px 12px;
    width: 100%;
    max-height: min(92dvh, 920px);
    padding: 46px 18px calc(18px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    overscroll-behavior: contain;
    box-shadow: 0 -16px 48px rgb(8 27 56 / 24%);
  }
  .hb-cart-modal__dialog.is-dragging { transition: none; }
  .hb-cart-modal__handle {
    position: absolute;
    top: 12px;
    left: 50%;
    display: block;
    width: 64px;
    height: 5px;
    border-radius: 99px;
    background: #d5d9df;
    transform: translateX(-50%);
    touch-action: none;
    cursor: grab;
  }
  .hb-cart-modal__close { top: 24px; right: 10px; }
  .hb-cart-modal__success { width: 44px; height: 44px; font-size: 24px; }
  .hb-cart-modal__title { margin-right: 42px; font-size: 22px; }
  .hb-cart-modal__status { font-size: 13px; }
  .hb-cart-shipping {
    grid-template-columns: 44px minmax(0, 1fr);
    margin-top: 16px;
    padding: 14px;
  }
  .hb-cart-shipping strong { font-size: 14px; }
  .hb-cart-modal__main { grid-template-columns: 1fr; margin-top: 14px; }
  .hb-cart-modal__product {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }
  .hb-cart-modal__product img { width: 92px; height: 92px; }
  .hb-cart-modal__brand { font-size: 12px; }
  .hb-cart-modal__name { font-size: 17px; }
  .hb-cart-modal__sku { margin-bottom: 12px; font-size: 12px; }
  .hb-cart-modal__product-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-items: stretch;
    padding-top: 12px;
    border-top: 1px solid var(--hb-modal-line);
  }
  .hb-cart-modal__line-total { font-size: 19px; }
  .hb-cart-modal__summary { padding: 14px; }
  .hb-cart-modal__summary h3,
  .hb-cart-modal__summary > p:not(.hb-cart-modal__tax) { display: none; }
  .hb-cart-modal__summary-row { border-top: 0; padding-top: 0; }
  .hb-cart-recommendations__list { grid-template-columns: 1fr; }
  .hb-cart-recommendation { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .hb-cart-recommendation img { width: 64px; height: 64px; }
  .hb-cart-modal__actions {
    position: sticky;
    z-index: 2;
    bottom: calc(-18px - env(safe-area-inset-bottom));
    grid-template-columns: 1fr;
    margin-inline: -18px;
    padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: 0 -8px 18px rgb(8 27 56 / 7%);
  }
  .hb-cart-modal__actions .hb-cart-modal__action:nth-child(2) {
    background: var(--hb-modal-blue);
    color: #fff !important;
  }
  .hb-cart-modal__action--primary { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-cart-modal__dialog { transition: none; }
}
