:root {
  --cw-paper: #fbf7f1;
  --cw-white: #fff;
  --cw-ink: #2c2822;
  --cw-muted: #6b6057;
  --cw-line: rgba(82, 63, 47, .14);
  --cw-terracotta: #a95334;
  --cw-terracotta-soft: #c97149;
  --cw-green: #4e7464;
  --cw-sand: #efe4d6;
}

.cw-lock {
  overflow: hidden;
}

.cw-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1580;
  width: 58px;
  height: 58px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--cw-ink);
  color: #fff;
  box-shadow: 0 16px 36px rgba(44, 40, 34, .28);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.cw-fab:hover {
  background: var(--cw-terracotta);
  transform: translateY(-2px);
}

.cw-fab.cw-visible {
  display: flex;
}

.cw-fab svg {
  width: 25px;
  height: 25px;
}

.cw-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid var(--cw-paper);
  border-radius: 999px;
  background: var(--cw-terracotta);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.cw-overlay {
  position: fixed;
  inset: 0;
  z-index: 1585;
  opacity: 0;
  pointer-events: none;
  border: 0;
  background: rgba(30, 25, 21, .5);
  backdrop-filter: blur(4px);
  transition: opacity .22s ease;
}

.cw-overlay.cw-open {
  opacity: 1;
  pointer-events: auto;
}

.cw-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1590;
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  transform: translateX(104%);
  border-left: 1px solid var(--cw-line);
  background: var(--cw-paper);
  box-shadow: -24px 0 70px rgba(44, 40, 34, .18);
  transition: transform .26s ease;
}

.cw-panel.cw-open {
  transform: none;
}

.cw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 17px;
  border-bottom: 1px solid var(--cw-line);
}

.cw-head h2 {
  margin: 0;
  color: var(--cw-ink);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px;
}

.cw-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cw-line);
  border-radius: 50%;
  background: #fff;
  color: var(--cw-ink);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.cw-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px 24px;
}

.cw-empty {
  padding: 44px 18px;
  color: var(--cw-muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.cw-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--cw-line);
}

.cw-item-image {
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--cw-sand);
}

.cw-item-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cw-item-info {
  min-width: 0;
}

.cw-item-name {
  overflow: hidden;
  color: var(--cw-ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cw-item-price {
  margin-top: 4px;
  color: var(--cw-terracotta);
  font-size: 12px;
  font-weight: 800;
}

.cw-item-actions {
  display: grid;
  grid-template-columns: auto 34px;
  gap: 7px;
  align-items: center;
}

.cw-qty {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cw-qty button,
.cw-del {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cw-line);
  border-radius: 9px;
  background: #fff;
  color: var(--cw-ink);
  cursor: pointer;
}

.cw-qty span {
  min-width: 18px;
  color: var(--cw-ink);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.cw-del {
  color: #8b4330;
  font-size: 16px;
}

.cw-foot {
  max-height: 58vh;
  overflow-y: auto;
  padding: 17px 24px 24px;
  border-top: 1px solid var(--cw-line);
  background: #fff;
}

.cw-section-label {
  margin: 4px 0 9px;
  color: var(--cw-ink);
  font-size: 12px;
  font-weight: 850;
}

.cw-pay-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cw-pay-option {
  cursor: pointer;
}

.cw-pay-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cw-pay-box {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 9px 10px;
  border: 1px solid var(--cw-line);
  border-radius: 12px;
  background: var(--cw-paper);
}

.cw-pay-box strong {
  color: var(--cw-ink);
  font-size: 12px;
}

.cw-pay-box small {
  margin-top: 2px;
  color: var(--cw-muted);
  font-size: 10px;
}

.cw-pay-option input:focus-visible + .cw-pay-box {
  outline: 3px solid rgba(169, 83, 52, .25);
  outline-offset: 2px;
}

.cw-pay-option input:checked + .cw-pay-box {
  border-color: var(--cw-terracotta);
  background: rgba(201, 113, 73, .08);
}

.cw-select,
.cw-input {
  width: 100%;
  min-height: 43px;
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid var(--cw-line);
  border-radius: 11px;
  background: #fff;
  color: var(--cw-ink);
  font: inherit;
  font-size: 13px;
}

.cw-input:focus,
.cw-select:focus {
  outline: 3px solid rgba(169, 83, 52, .17);
  border-color: var(--cw-terracotta);
}

.cw-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cw-textarea {
  min-height: 58px;
  resize: vertical;
}

.cw-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--cw-line);
  color: var(--cw-ink);
  font-size: 14px;
  font-weight: 750;
}

.cw-total strong {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
}

.cw-installment-line {
  min-height: 18px;
  margin-top: 2px;
  color: var(--cw-terracotta);
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.cw-error {
  display: none;
  margin-top: 9px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #fbe9e4;
  color: #8d351f;
  font-size: 12px;
}

.cw-error.cw-show {
  display: block;
}

.cw-checkout {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 11px;
  border: 0;
  border-radius: 999px;
  background: #147a46;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.cw-checkout:hover {
  background: #0f6539;
}

.cw-note {
  margin: 9px 0 0;
  color: var(--cw-muted);
  font-size: 10.5px;
  line-height: 1.45;
  text-align: center;
}

.cw-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1600;
  opacity: 0;
  transform: translate(-50%, 18px);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--cw-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.cw-toast.cw-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 620px) {
  .cw-fab {
    right: 16px;
    bottom: 16px;
    width: 54px;
    height: 54px;
  }

  .cw-panel {
    top: auto;
    left: 0;
    width: 100%;
    height: min(91vh, 790px);
    transform: translateY(104%);
    border-top: 1px solid var(--cw-line);
    border-left: 0;
    border-radius: 24px 24px 0 0;
  }

  .cw-head {
    padding: 17px 18px 13px;
  }

  .cw-head h2 {
    font-size: 23px;
  }

  .cw-items {
    padding: 7px 18px;
  }

  .cw-foot {
    padding: 14px 18px 20px;
  }

  .cw-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .cw-item-image {
    width: 48px;
    height: 48px;
  }

  .cw-item-actions {
    grid-column: 1 / -1;
    grid-template-columns: auto 34px;
    justify-content: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-fab,
  .cw-overlay,
  .cw-panel,
  .cw-toast {
    transition: none;
  }
}
