/* Commerce (P-EXC-9): navbar cart, add-to-cart notice, cart and orders pages. */

[data-commerce-only][hidden], .cm-body [hidden] { display: none !important; }

/* Navbar cart */
.global-navbar__cart { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: auto; margin-right: 4px; border-radius: 10px; color: #1e293b; text-decoration: none; order: 2; }
.global-navbar__cart:hover { background: #eff6ff; color: #1d4ed8; }
.global-navbar__cart i { font-size: 18px; }
.global-navbar__cart-count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #2563eb; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-sizing: border-box; }

/* Plan cards */
.sc-btn--cart { background: #fff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.sc-btn--cart:hover { background: #eff6ff; }

/* "Added to cart" notice */
.commerce-notice { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 1000; padding: 12px 18px; border-radius: 10px; background: #0f172a; color: #fff; font: 500 14px Inter, system-ui, sans-serif; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25); transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); }
.commerce-notice--show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.commerce-notice a { color: #93c5fd; font-weight: 600; margin-left: 6px; }

/* Shared page layout */
.cm-body { background: #f6f7f9; color: #0f172a; font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
.cm-main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; display: flex; flex-direction: column; gap: 18px; }
.cm-main h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.cm-subtle { color: #475569; font-size: 14px; margin: 0; }
.cm-state { text-align: center; padding: 56px 20px; color: #475569; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cm-state i { font-size: 32px; color: #94a3b8; }
.cm-banner { padding: 12px 16px; border-radius: 10px; font-size: 14px; background: #eff6ff; border: 1px solid #bfdbfe; }
.cm-banner--warn { background: #fffbeb; border-color: #fde68a; }
.cm-banner--error { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.cm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: #0f172a; font: 600 14px inherit; font-family: inherit; cursor: pointer; text-decoration: none; }
.cm-btn:hover { background: #f8fafc; }
.cm-btn--primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.cm-btn--primary:hover { background: #1d4ed8; }
.cm-btn--block { width: 100%; min-height: 50px; font-size: 16px; }
.cm-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.cm-link { color: #1d4ed8; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cm-btn:focus-visible, .cm-link:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* Cart */
.cm-cart { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.cm-lines { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; list-style: none; margin: 0; padding: 0; }
.cm-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; padding: 18px; border-bottom: 1px solid #f1f5f9; align-items: start; }
.cm-line:last-child { border-bottom: 0; }
.cm-line__img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #eff6ff; display: flex; align-items: center; justify-content: center; color: #2563eb; font-size: 22px; }
.cm-line__name { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.cm-line__meta { font-size: 13px; color: #475569; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.cm-line__meta select { height: 36px; border-radius: 6px; border: 1px solid #cbd5e1; padding: 0 8px; font: 13px inherit; font-family: inherit; }
.cm-line__problem { margin: 8px 0 0; font-size: 13px; color: #b91c1c; font-weight: 500; }
.cm-line__right { text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.cm-line__price { font-size: 16px; font-weight: 700; white-space: nowrap; }
.cm-line__price span { font-size: 13px; font-weight: 500; color: #475569; }
.cm-summary { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 88px; }
.cm-summary h2 { margin: 0; font-size: 18px; }
.cm-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.cm-row--total { font-size: 18px; font-weight: 700; border-top: 1px solid #e2e8f0; padding-top: 12px; }
.cm-trial { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; font-size: 14px; line-height: 1.45; cursor: pointer; }
.cm-trial input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
.cm-fine { font-size: 12px; color: #64748b; margin: 0; line-height: 1.5; }

/* Orders */
.cm-orders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cm-order-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 16px 18px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; text-decoration: none; color: inherit; }
.cm-order-row:hover { border-color: #bfdbfe; }
.cm-order-row strong { display: block; font-size: 15px; }
.cm-order-row small { color: #475569; font-size: 13px; }
.cm-pill { display: inline-flex; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: #f1f5f9; color: #334155; }
.cm-pill--paid, .cm-pill--complete { background: #dcfce7; color: #166534; }
.cm-pill--pending, .cm-pill--awaiting_payment, .cm-pill--fulfilling { background: #fef3c7; color: #92400e; }
.cm-pill--cancelled, .cm-pill--failed, .cm-pill--payment_failed, .cm-pill--needs_attention { background: #fee2e2; color: #991b1b; }
.cm-pill--refunded, .cm-pill--partially_refunded { background: #e0e7ff; color: #3730a3; }
.cm-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.cm-card h2 { margin: 0; font-size: 18px; }
.cm-detail-lines { list-style: none; margin: 0; padding: 0; }
.cm-detail-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 15px; }
.cm-detail-lines li:last-child { border-bottom: 0; }
.cm-spinner { width: 28px; height: 28px; border: 3px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: cm-spin 0.8s linear infinite; }
@keyframes cm-spin { to { transform: rotate(360deg); } }

/* Cart: printed copy under its pack, quantity, delivery (EXC-289/296) */
.cm-line--child { margin-left: 40px; border-left: 3px solid #bfdbfe; background: #f8fafc; }
.cm-line__tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: #334155; }
.cm-line__tag--post { background: #fef3c7; color: #92400e; }
.cm-qty { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 8px; overflow: hidden; }
.cm-qty button { border: 0; background: #fff; width: 32px; height: 32px; cursor: pointer; font-weight: 700; font-size: 15px; }
.cm-qty button:disabled { color: #cbd5e1; cursor: not-allowed; }
.cm-qty span { min-width: 32px; text-align: center; line-height: 32px; font-variant-numeric: tabular-nums; border-inline: 1px solid #e2e8f0; }
.cm-offer { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin: 0 0 0 40px; padding: 12px 16px; border: 1px dashed #cbd5e1; border-radius: 10px; font-size: 14px; background: #fff; }
.cm-ship { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cm-ship legend { font-weight: 600; font-size: 15px; margin-bottom: 6px; padding: 0; }
.cm-ship-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: start; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 9px 10px; cursor: pointer; font-size: 14px; }
.cm-ship-opt:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.cm-ship-opt small { display: block; color: #64748b; font-size: 12px; }
.cm-ship-opt b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cm-freebar { height: 6px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.cm-freebar i { display: block; height: 100%; background: #16a34a; border-radius: 999px; }
.cm-note { margin: 0; padding: 10px 12px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; font-size: 13px; line-height: 1.5; color: #334155; }

/* Order page: delivery (EXC-289) */
#om-detail.cm-has-delivery { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.cm-address { font-style: normal; line-height: 1.6; font-size: 15px; }
.cm-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cm-step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 14px; }
.cm-step small { display: block; color: #64748b; font-size: 13px; }
.cm-step__dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1.5px solid #cbd5e1; color: #64748b; }
.cm-step--done .cm-step__dot { background: #dcfce7; border-color: transparent; color: #166534; }
.cm-step--now .cm-step__dot { border-color: #2563eb; }
.cm-post-form { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid #e2e8f0; font-size: 14px; }
.cm-post-form input { height: 38px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 10px; font: inherit; }
.cm-post-form button { margin-top: 6px; }

/* Storefront: printed-copy choice on a pack card, posted-item note (EXC-289/296) */
.sc-fmt { border: 0; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sc-fmt legend { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 6px; padding: 0; }
.sc-fmt__opt { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: start; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; line-height: 1.35; background: #fff; }
.sc-fmt__opt:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
.sc-fmt__opt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.sc-fmt__opt input { margin-top: 2px; accent-color: #2563eb; }
.sc-fmt__opt small { display: block; color: #64748b; font-size: 12px; }
.sc-fmt__opt b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-ship-note { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 12px; color: #64748b; }

@media (max-width: 860px) {
  .cm-cart { grid-template-columns: 1fr; }
  .cm-summary { position: static; }
  .cm-line { grid-template-columns: 48px minmax(0, 1fr); }
  .cm-line__right { grid-column: 2; align-items: flex-start; text-align: left; }
  .cm-order-row { grid-template-columns: 1fr; }
  .cm-line--child, .cm-offer { margin-left: 12px; }
  #om-detail.cm-has-delivery { grid-template-columns: 1fr; }
}
