.page {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.hero {
  display: grid;
  gap: 16px;
  max-width: 640px;
}

.intro {
  color: #4f5d79;
  max-width: 56ch;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.cart-panel {
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(93, 112, 154, 0.14);
  box-shadow: 0 20px 60px rgba(23, 32, 51, 0.12);
  padding: 18px;
}

.cart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cart-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(93, 112, 154, 0.16);
}

.cart-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.cart-row p {
  color: #5a6987;
  margin-top: 4px;
}

.cart-row-meta {
  display: grid;
  gap: 4px;
}

.cart-row-actions,
.item-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.cart-row-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-pill {
  min-width: 42px;
  text-align: center;
  padding: 8px 10px;
  background: #eef2fa;
  color: #24314c;
  font-weight: bold;
}

.small-button {
  padding: 10px 12px;
}

.empty-cart-message {
  color: #5a6987;
}

.item-card,
.summary-panel,
.modal-panel {
  border: 1px solid rgba(93, 112, 154, 0.14);
  box-shadow: 0 20px 60px rgba(23, 32, 51, 0.12);
  box-shadow: -3px 2px 3px rgba(0,0,0,0.25);
}

.modal-panel {
  background-color: #ECECEC;
}

.summary-panel {
  background-color: #FFFFFF;
}

.item-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
}

.item-card p {
  color: #5a6987;
  margin-top: 6px;
}

.primary-button,
.secondary-button,
.icon-button {
  font-size: 15px;
}

.primary-button {
  background: black;
  color: white;
  width: fit-content;
  padding: 14px 18px;
  font-weight: bold;
}

.primary-button:hover:not(:disabled) {
  background: #090909;
}

.primary-button:active:not(:disabled) {
  background: #1A1A1A;
}

.secondary-button {
  background: white;
  color: black;
  padding: 14px 18px;
  font-weight: bold;
}

.icon-button {
  width: 40px;
  height: 40px;
  background: white;
  color: #555;
  font-size: 1.6rem;
  line-height: 1;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  opacity: 0.92;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

#submit-button {
  min-width: 170px;
}

.modal.hidden,
.status-banner.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(98, 98, 98, 0.75);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100% - 100px));
  max-height: calc(100vh - 74px);
  overflow: scroll;
  margin: 12px auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

#checkout-title {
  margin-top: 0px;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 20px;
}

.summary-panel {
  padding: 18px;
  align-self: start;
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 16px;
}

.summary-list li,
.summary-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-list li {
  color: #555;
  font-size: 14px;
}

#shipping-li {
  margin-top: 18px;
}

.summary-total {
  border-top: 1px solid rgba(93, 112, 154, 0.2);
  margin-top: 18px;
  padding-top: 18px;
}

.payment-form {
  display: grid;
  gap: 16px;
  margin-right: -4px;
}

.status-banner {
  padding: 12px 14px;
  background: #e8edf8;
  color: #26324d;
  max-height: 18px;
}

.status-banner.error {
  background: #fdeceb;
  color: #932d2d;
}

.status-banner.success {
  background: #e7f7ef;
  color: #11633f;
}

#email-input,
.element-shell {
  width: calc(100% - 30px);
  border: 1px solid #AAAAAA;
  background: #fff;
}

#email-input {
  padding: 12px;
}

.element-shell {
  min-height: 56px;
  padding: 12px;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding-right: 4px;
}

.field-label {
  font-weight: bold;
}

.field-note {
  color: #777777;
  font-size: 14px;
}

.button-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
  margin-right: 4px;
}


.summary-line-muted {
  color: #5a6987;
}

.invalid-input {
  background: #fdeceb !important;
}

@media (max-width: 900px) {
  .page {
    padding-top: 48px;
  }

  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    order: 2;
  }

  .payment-form {
    order: 1;
  }
}

@media (max-width: 600px) {
  .modal-panel {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 18px;
  }

  .button-row {
    flex-direction: column-reverse;
  }

  .cart-header,
  .cart-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .cart-row-actions,
  .item-actions {
    justify-items: stretch;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
