/* ==========================================================================
   Cart page (Figma 5469:4283 · mobile 5498:12618)
   Also provides shared commerce pieces used by checkout.html:
   .co-page, .co-head, .co-layout, .field, .coupon, .summary
   ========================================================================== */

/* ---------- Page shell ---------- */
.co-page { padding-bottom: 100px; }
.co-page > .container { display: flex; flex-direction: column; gap: 24px; padding-top: 48px; }

.co-head { display: flex; align-items: center; gap: 16px; }
.co-head__back { display: block; width: 32px; height: 32px; flex: none; transition: transform .15s ease; }
.co-head__back:hover { transform: translateX(-3px); }
.co-head__back img { width: 32px; height: 32px; }
.co-head__title { font-size: 22px; line-height: 30px; font-weight: 600; color: #000; }

/* ---------- Two-column layout: 834 + 406, gap 40 ---------- */
.co-layout {
  display: grid;
  grid-template-columns: minmax(0, 834fr) minmax(320px, 406fr);
  column-gap: 40px;
  row-gap: 24px;
  align-items: start;
}
.co-layout > .summary { grid-column: 2; grid-row: 1 / -1; }
.co-layout > :not(.summary) { grid-column: 1; }
.co-layout--cart { grid-template-rows: auto auto 1fr; }

/* ---------- Floating-label field ---------- */
.field { position: relative; display: flex; flex-direction: column; align-items: flex-start; isolation: isolate; min-width: 0; }
.field__label {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; margin: 0 0 -9px 8px; padding: 0 4px 0 14px;
  border-radius: 100px; background: var(--c-white);
  font-size: 14px; line-height: 20px; color: var(--c-text); white-space: nowrap;
  text-box: normal;
}
.field__control {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  width: 100%; height: 52px; padding: 2px 16px 0 24px;
  border: 1px solid var(--c-stroke); border-radius: 1000px;
  background: #fbfbfb;
  transition: border-color .15s ease;
}
.field__control--white { background: var(--c-white); padding-right: 12px; }
.field__control:focus-within { border-color: #000; }
.field__control input,
.field__control select {
  flex: 1 1 auto; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent; padding: 0;
  font-size: 16px; line-height: 24px; color: var(--c-blue-900);
  appearance: none; -webkit-appearance: none;
}
.field__control input::placeholder { color: var(--c-blue-900); opacity: 1; }
.field__control select { cursor: pointer; }
.field__control select:invalid { color: var(--c-blue-900); }
.field__control input[type="date"]::-webkit-calendar-picker-indicator,
.field__control input[type="time"]::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; right: 0; width: 56px; height: 100%; cursor: pointer; }
.field__icon { width: 20px; height: 20px; flex: none; pointer-events: none; }

/* ---------- Coupon row ---------- */
.coupon { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.coupon__field { width: 618px; max-width: 100%; flex: 0 1 618px; }
.coupon__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; flex: none;
  min-width: 198px; height: 52px; padding: 0 24px; border-radius: 100px;
  background: #eaeaea; color: #000; font-size: 16px; line-height: 24px; white-space: nowrap;
  text-box: trim-both cap alphabetic;
  transition: background-color .15s ease;
}
.coupon__btn:hover { background: #dedede; }
.coupon__btn img { width: 16px; height: 16px; }

/* ---------- Cart table (desktop) ---------- */
.cart-table { border: 1px solid var(--c-stroke); border-radius: 16px; overflow: hidden; }
.cart-table__head {
  display: flex; align-items: center; gap: 30px;
  height: 40px; padding: 16px; border-bottom: 1px solid var(--c-stroke);
}
.cart-table__th { flex: none; font-size: 16px; line-height: 24px; color: var(--c-text); white-space: nowrap; }
.cart-table__th--product { width: 367px; }
.cart-table__th--price { width: 87px; }
.cart-table__th--qty { width: 148px; }

.cart-item { display: flex; align-items: center; gap: 16px; padding: 16px; }
.cart-item__product { position: relative; display: flex; align-items: center; gap: 12px; width: 380px; flex: none; }
.cart-item__remove { display: flex; width: 24px; height: 24px; flex: none; border-radius: 50%; transition: opacity .15s ease; }
.cart-item__remove:hover { opacity: .7; }
.cart-item__remove img { width: 24px; height: 24px; }
.cart-item__thumb {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 64px; height: 64px; margin-right: 4px;
  border: 1px solid var(--c-stroke); border-radius: 16px; overflow: hidden; background: var(--c-white);
}
.cart-item__crop { position: relative; display: block; width: 30px; height: 56px; overflow: hidden; }
/* product shot is cropped from a multi-view sheet, exactly as in Figma */
.cart-item__crop img { position: absolute; left: -14.5%; top: -42.46%; width: 489.17%; height: 170.63%; max-width: none; }
.cart-item__info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cart-item__name { font-size: 18px; line-height: 26px; font-weight: 500; color: #000; white-space: nowrap; }
.cart-item__plan { font-size: 14px; line-height: 20px; color: var(--c-text); white-space: nowrap; }

.cart-item__nums { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cart-item__price { font-size: 16px; line-height: 24px; color: #000; white-space: nowrap; }
.cart-item__subtotal { width: 125px; text-align: center; font-size: 16px; line-height: 24px; color: #000; white-space: nowrap; }
.cart-item__subtotal-label { display: none; }

/* Quantity stepper */
.qty { display: flex; align-items: center; height: 36px; flex: none; }
.qty__btn { display: block; width: 44px; height: 36px; flex: none; }
.qty__btn img { width: 44px; height: 36px; }
.qty__btn:first-child { margin-right: -1px; }
.qty__btn:hover img { filter: brightness(.96); }
.qty__value {
  width: 44px; height: 36px; margin-right: -1px; padding: 0;
  border: 1px solid var(--c-stroke); background: var(--c-white); outline: 0;
  font-size: 20px; line-height: 30px; text-align: center; color: #000;
}

/* ---------- Help / support box ---------- */
.help-box {
  display: flex; flex-direction: column; align-items: flex-start; gap: 24px;
  padding: 16px; border: 1px solid rgba(243, 41, 41, 0.24); border-radius: 16px; overflow: hidden;
  background: linear-gradient(191.28deg, rgba(243, 41, 41, 0) 24.36%, rgba(243, 41, 41, 0.11) 112.6%);
}
.help-box__text, .help-box__body { display: flex; flex-direction: column; gap: 16px; }
.help-box__eyebrow { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--c-primary); }
.help-box__title { font-size: 22px; line-height: 30px; font-weight: 600; color: #000; }
.help-box__body p { font-size: 16px; line-height: 24px; color: var(--c-text); }
.help-box__call {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  width: 253px; max-width: 100%; height: 54px; padding: 14px 24px 14px 0;
  border: 1px solid var(--c-text); border-radius: 100px; background: var(--c-white);
  transition: box-shadow .15s ease;
}
.help-box__call:hover { box-shadow: var(--shadow-btn); }
.help-box__call img { width: 32px; height: 32px; flex: none; }
.help-box__call-text { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: center; white-space: nowrap; }
.help-box__phone { font-size: 18px; line-height: 28px; font-weight: 600; color: #000; }
.help-box__hours { font-size: 14px; line-height: 20px; color: var(--c-text); }

/* ---------- Order summary card ---------- */
.summary {
  display: flex; flex-direction: column; gap: 24px;
  padding: 24px; border: 1px solid var(--c-stroke); border-radius: 24px; background: #fafafa;
}
.summary__title { font-size: 20px; line-height: 28px; font-weight: 500; color: #000; }
.summary__rows { display: flex; flex-direction: column; gap: 24px; }
.summary__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 16px; line-height: 24px; color: #000; }
.summary__item { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.summary__plan { font-size: 14px; line-height: 20px; color: var(--c-text); }
.summary__amt { font-weight: 500; line-height: 22px; text-align: center; white-space: nowrap; flex: none; }
.summary__total {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 20px; border-top: 1px solid var(--c-gray-100); border-bottom: 1px solid var(--c-gray-100);
  font-size: 18px; line-height: 26px; font-weight: 500; color: #000; white-space: nowrap;
}
.summary__cta { gap: 12px; }
.summary__cta img { width: 16px; height: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .co-layout { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 24px; }
  .cart-table__head { display: none; }
  .cart-item { flex-wrap: wrap; }
  .cart-item__product { width: 100%; }
  .cart-item__nums { flex-basis: 100%; padding-left: 36px; }
  .cart-item__name, .cart-item__plan { white-space: normal; }
}

@media (max-width: 900px) {
  .co-layout,
  .co-layout--cart { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; }
  .co-layout > .summary, .co-layout > :not(.summary) { grid-column: 1; grid-row: auto; }
  .co-layout--cart > .cart-table { order: 1; }
  .co-layout--cart > .coupon { order: 2; }
  .co-layout--cart > .summary { order: 3; }
  .co-layout--cart > .help-box { order: 4; }
}

@media (max-width: 768px) {
  .co-page { padding-bottom: 32px; }

  /* Mobile item card (Figma 5499:13397) */
  .cart-item {
    position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 12px; row-gap: 24px; align-items: start; padding: 16px;
  }
  .cart-item__product { display: contents; }
  .cart-item__remove { position: absolute; top: 10px; right: 10px; }
  .cart-item__thumb { grid-column: 1; grid-row: 1 / span 2; width: 72px; height: 94px; border-radius: 12px; margin-right: 0; }
  .cart-item__crop { width: 43px; height: 82.33px; }
  .cart-item__info { grid-column: 2; grid-row: 1; padding-right: 20px; }
  .cart-item__nums { grid-column: 2; grid-row: 2; padding-left: 0; flex-basis: auto; }
  .cart-item__price { display: none; }
  .cart-item__subtotal { order: -1; width: auto; text-align: left; font-size: 14px; line-height: 20px; font-weight: 600; }

  .coupon { gap: 13px; }
  .coupon__field { flex: 1 1 auto; width: auto; }
  .coupon__btn { min-width: 0; padding: 0 16px; gap: 10px; }

  .help-box__body p { font-size: 16px; }
}

@media (max-width: 400px) {
  .cart-item__name { font-size: 16px; white-space: normal; }
  .cart-item__plan { white-space: normal; font-size: 12px; }
  .coupon { flex-wrap: wrap; }
  .coupon__btn { width: 100%; }
}
