/* ==========================================================================
   장바구니·주문서 전용 (v2) — 외주본 purchase.css(bag-item·checkout-*·purchase-summary) 위에 우리 기능만 외주본 언어로.
   쿠폰 코드 입력·적용 칩 · 품절/사전예약 표시 · 주문서(주문 상품 줄·주소록·주소 검색·적립금) · 어두운 화면.
   주문서 결제 스크립트는 원문 그대로라 그 스크립트가 만드는 이름(.cart-line·.addr-chip·.qty)을 여기서 입힌다.
   ========================================================================== */

/* ── 담긴 줄(외주본 .bag-item) 안의 우리 표시 ─────────────────────── */
.bag-item.is-soldout .bag-photo,
.bag-item.is-soldout .bag-name { opacity: 0.6; }
.wm-soldout-tag { margin-left: 6px; font-size: 12px; color: #b34635; }
.bag-options .wm-preorder { margin-left: 6px; color: #777; }
.bag-unit-price del { margin-left: 4px; color: #bbb; }
.bag-photo .tile { position: static; width: 94px; height: 125px; }
.bag-item > input[type="checkbox"]:disabled { opacity: 0.35; }

/* ── 쿠폰 코드 — 외주본 쿠폰 칸(select) 모양으로 입력 + 적용 ───────── */
.wm-coupon-row { display: flex; gap: 8px; }
.wm-coupon-row input {
    flex: 1;
    min-width: 0;
    padding: 13px 11px;
    border: 1px solid #d6d6d6;
    border-radius: 0;
    background: #fff;
    font: inherit;
    font-size: 14px;
}
.wm-coupon-row input:focus { outline: 0; border-color: #171717; }
.wm-coupon-row button {
    flex: none;
    padding: 0 18px;
    border: 1px solid #171717;
    background: #171717;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}
.wm-coupon-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cpn-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid #ddd; background: #fff; font-size: 13px; }
.cpn-chip b { font-weight: 650; }
.cpn-chip__x { padding: 0 2px; color: #999; font-size: 12px; }
.purchase-coupon .coupon-msg { margin: 8px 0 0; min-height: 1.6em; color: #999; font-size: 12px; line-height: 1.6; }
.coupon-msg[data-tone="ok"] { color: #2a8f4f; }
.coupon-msg[data-tone="err"] { color: #b34635; }

/* ── 금액 요약 ──────────────────────────────────────────── */
.purchase-totals dt em { margin-left: 4px; font-style: normal; font-size: 12px; color: #aaa; }
#sum-bundle,
#sum-discount,
#ck-bundle,
#ck-discount,
#ck-points-amt { color: #ac513c; }

/* ── 주문서: 주문 상품 줄 (결제 스크립트가 그리는 .cart-line 을 외주본 .checkout-item 모양으로) ── */
.checkout-layout > form,
.checkout-layout > aside { min-width: 0; }
.wm-checkout-lines .cart-line { display: grid; gap: 18px; padding: 16px 0; border-bottom: 1px solid #eee; }
.wm-checkout-lines .cart-line:first-child { padding-top: 0; }
.wm-checkout-lines .cart-line__img { position: relative; width: 60px; height: 80px; overflow: hidden; background: #f7f7f7; }
.wm-checkout-lines .cart-line__name { font-size: 15px !important; font-weight: 500; line-height: 1.6; }
.wm-checkout-lines .cart-line__meta { margin-top: 6px; font-size: 13px; color: #999; }
.wm-checkout-lines .qty { display: inline-flex; align-items: center; height: 32px; border: 1px solid #ddd; }
.wm-checkout-lines .qty button { width: 30px; height: 30px; padding: 0; font-size: 16px; }
.wm-checkout-lines .qty span { min-width: 32px; font-size: 14px; text-align: center; }
.wm-checkout-lines .cart-line__remove { color: #aaa; }
.wm-checkout-lines .cart-line__price { font-size: 15px; font-weight: 500; white-space: nowrap; }
.wm-checkout-lines .text-mute { font-size: 14px; color: #999; }

/* ── 주문서: 입력칸 (외주본 checkout-fields 위에 주소 검색·메모) ── */
.wm-field-row { display: flex; gap: 8px; }
.wm-field-row input { flex: 1; }
.wm-field-btn { flex: none; height: 48px; padding: 0 16px; border: 1px solid #171717; background: #171717; color: #fff; font-size: 14px; white-space: nowrap; }
.checkout-fields input[readonly] { background: #fafafa; cursor: pointer; }
.checkout-fields textarea { width: 100%; min-height: 96px; padding: 12px; border: 1px solid #ddd; border-radius: 0; background: #fff; font: inherit; font-size: 15px; resize: vertical; }
.checkout-fields textarea::placeholder { color: #bbb; }
.checkout-fields + .checkout-fields { margin-top: 22px; }

/* ── 주문서: 저장된 배송지(회원) 칩 + 현재 주소 저장 ── */
.addr-book { margin-bottom: 22px; }
.addr-book__head { margin-bottom: 10px; font-size: 14px; color: #777; }
.addr-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.addr-chip { display: inline-flex; align-items: stretch; max-width: 100%; border: 1px solid #ddd; }
.addr-chip:hover { border-color: #171717; }
.addr-chip__pick { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 9px 12px; text-align: left; }
.addr-chip__pick b { font-size: 14px; font-weight: 600; }
.addr-chip__pick i { max-width: 220px; overflow: hidden; font-size: 12px; font-style: normal; color: #999; white-space: nowrap; text-overflow: ellipsis; }
.addr-chip__del { padding: 0 12px; border-left: 1px solid #ddd; color: #999; font-size: 16px; }
.addr-save { margin: 22px 0 0; }
.addr-save__toggle { width: 100%; padding: 12px 14px; border: 1px dashed #bbb; color: #777; font-size: 14px; }
.addr-save__toggle:hover { border-color: #171717; color: #171717; }
.addr-save__panel { margin-top: 12px; padding: 16px; border: 1px solid #ddd; background: #f7f7f5; }
.addr-save__labels { display: flex; gap: 8px; align-items: center; }
.addr-label-btn { padding: 9px 16px; border: 1px solid #ddd; background: #fff; font-size: 14px; white-space: nowrap; }
.addr-label-btn.on { background: #171717; color: #fff; border-color: #171717; }
.addr-save__labels input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid #ddd; background: #fff; font: inherit; font-size: 14px; }
.addr-save__actions { display: flex; gap: 8px; margin-top: 10px; }
.addr-save__actions .wm-btn-dark { flex: 1; min-height: 44px; background: #171717; color: #fff; font-size: 14px; font-weight: 500; }
.addr-save__actions .wm-btn-ghost { min-height: 44px; padding: 0 16px; border: 1px solid #ccc; font-size: 14px; }
.addr-save .coupon-msg { margin: 8px 0 0; font-size: 12px; color: #999; }

/* ── 주문서: 결제수단(외주본 payment-methods) 안 우리 설명 줄 ── */
.payment-methods > label > span { display: block; line-height: 1.5; }
.payment-methods > label small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: #999; }
.checkout-helper a { text-decoration: underline; }

/* ── 주문서 요약: 무료배송 게이지(main.js fsg) = 외주본 shipping-benefit 모양 · 적립금/쿠폰 ── */
.purchase-summary .fsg { margin: 0; padding: 17px 0 20px; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; font-size: 13px; line-height: 1.7; color: #777; }
.purchase-summary .fsg__txt b { color: #171717; font-weight: 500; }
.purchase-summary .fsg__txt--done { font-weight: 500; color: #171717; }
.purchase-summary .fsg__bar { height: 3px; margin-top: 13px; background: #dfdfda; }
.purchase-summary .fsg__bar > span { background: #171717; }
.purchase-coupon + .purchase-coupon { margin-top: 20px; }
.purchase-coupon label small { font-size: 12px; font-weight: 400; color: #aaa; }
.purchase-coupon select.coupon-select { margin-bottom: 8px; }
.purchase-coupon .wm-coupon-chips { margin: 0 0 10px; }
.purchase-summary .purchase-primary:disabled { background: #ccc; border-color: #ccc; cursor: wait; }
.purchase-summary-foot a { text-decoration: underline; }
@media (max-width: 767px) {
    .checkout-fields { grid-template-columns: 1fr; }
    .payment-methods { grid-template-columns: 1fr; }
}

/* ── 어두운 화면 ─────────────────────────────────────────── */
[data-theme="dark"] .purchase-summary { background: #161616; }
[data-theme="dark"] .bag-toolbar,
[data-theme="dark"] .checkout-section-title { border-top-color: #eee; border-bottom-color: #333; }
[data-theme="dark"] .bag-item { border-color: #2a2a2a; }
[data-theme="dark"] .bag-photo { background: #1c1c1c; }
[data-theme="dark"] .bag-quantity,
[data-theme="dark"] .wm-coupon-row input,
[data-theme="dark"] .cpn-chip,
[data-theme="dark"] .checkout-fields input,
[data-theme="dark"] .checkout-fields select,
[data-theme="dark"] .checkout-fields textarea,
[data-theme="dark"] .addr-chip,
[data-theme="dark"] .addr-save__panel,
[data-theme="dark"] .addr-label-btn,
[data-theme="dark"] .addr-save__labels input,
[data-theme="dark"] .payment-methods > label,
[data-theme="dark"] .purchase-coupon select { border-color: #333; background: #1a1a1a; color: #eee; }
[data-theme="dark"] .bag-quantity input { background: transparent; color: #eee; }
[data-theme="dark"] .checkout-fields input[readonly] { background: #161616; }
[data-theme="dark"] .payment-methods > label:has(input:checked) { border-color: #eee; background: #222; }
[data-theme="dark"] .shipping-benefit,
[data-theme="dark"] .purchase-coupon,
[data-theme="dark"] .purchase-grand-total,
[data-theme="dark"] .purchase-summary .fsg { border-color: #333; }
[data-theme="dark"] .shipping-benefit strong,
[data-theme="dark"] .purchase-steps .current,
[data-theme="dark"] .purchase-summary .fsg__txt b,
[data-theme="dark"] .purchase-summary .fsg__txt--done { color: #eee; }
[data-theme="dark"] .shipping-meter,
[data-theme="dark"] .purchase-summary .fsg__bar { background: #2a2a2a; }
[data-theme="dark"] .shipping-meter > span,
[data-theme="dark"] .purchase-summary .fsg__bar > span { background: #eee; }
[data-theme="dark"] .purchase-primary,
[data-theme="dark"] .wm-coupon-row button,
[data-theme="dark"] .wm-field-btn,
[data-theme="dark"] .addr-label-btn.on,
[data-theme="dark"] .addr-save__actions .wm-btn-dark { background: #eee; color: #111; border-color: #eee; }
[data-theme="dark"] .purchase-primary:hover { background: #fff; }
[data-theme="dark"] .purchase-primary[aria-disabled="true"],
[data-theme="dark"] .purchase-summary .purchase-primary:disabled { background: #444; border-color: #444; color: #999; }
[data-theme="dark"] .purchase-secondary { border-color: #555; color: #eee; }
[data-theme="dark"] .purchase-empty { border-top-color: #eee; }
[data-theme="dark"] .bag-remove { border-bottom-color: #444; }
[data-theme="dark"] .bag-guidance a { border-bottom-color: #666; }
[data-theme="dark"] .purchase-page input[type="checkbox"],
[data-theme="dark"] .purchase-page input[type="radio"] { accent-color: #eee; }
[data-theme="dark"] .wm-checkout-lines .cart-line,
[data-theme="dark"] .checkout-agreements { border-color: #2a2a2a; }
[data-theme="dark"] .wm-checkout-lines .cart-line__img { background: #1c1c1c; }
[data-theme="dark"] .wm-checkout-lines .qty { border-color: #333; }
[data-theme="dark"] .addr-save__toggle { border-color: #555; color: #bbb; }
[data-theme="dark"] .addr-chip__del { border-left-color: #333; }
