/* Shared cart and purchase surfaces. The active identity supplies all visual tokens. */
body[data-store-theme] #cart-overlay { background:var(--theme-commerce-overlay); backdrop-filter:none; }
body[data-store-theme] #cart-sidebar { width:min(100%,var(--theme-cart-width)); max-width:var(--theme-cart-width); background:var(--theme-commerce-surface); color:var(--theme-commerce-text); border-color:var(--theme-commerce-border); box-shadow:none; backdrop-filter:none; }
body[data-store-theme] #cart-sidebar.open { box-shadow:-12px 0 40px color-mix(in srgb,var(--theme-commerce-text) 12%,transparent); }
body[data-store-theme] #cart-sidebar .cart-header { padding:18px var(--theme-cart-padding); min-height:76px; gap:12px; background:var(--theme-commerce-surface); color:var(--theme-commerce-text); border-color:var(--theme-commerce-border); flex-shrink:0; }
body[data-store-theme] #cart-sidebar .cart-header h3 { color:inherit; font-size:var(--theme-cart-heading-size)!important; font-family:var(--theme-commerce-heading-font)!important; font-weight:var(--theme-heading-weight); line-height:1.25; }
body[data-store-theme] #cart-sidebar :is(.cart-close,.remove-item) { background:transparent; color:var(--theme-commerce-muted); border:1px solid transparent; border-radius:var(--theme-commerce-radius); box-shadow:none; opacity:1; min-width:44px; min-height:44px; width:44px; height:44px; padding:0; flex-shrink:0; transform:none; }
body[data-store-theme] #cart-sidebar :is(.cart-close,.remove-item):hover { background:var(--theme-commerce-soft); color:var(--theme-commerce-text); box-shadow:none; transform:none; }
body[data-store-theme] #cart-sidebar .cart-content { padding:0 var(--theme-cart-padding); scrollbar-color:var(--theme-commerce-border) var(--theme-commerce-surface); }
body[data-store-theme] #cart-sidebar .cart-item { gap:var(--theme-cart-gap); padding:20px 0; border:0; border-bottom:1px solid var(--theme-commerce-border); border-radius:0; background:transparent; box-shadow:none; }
body[data-store-theme] #cart-sidebar .cart-item-image-container { width:var(--theme-cart-image-width); height:var(--theme-cart-image-height); border:1px solid var(--theme-commerce-border); border-radius:var(--theme-commerce-radius); background:var(--theme-commerce-soft); }
body[data-store-theme] #cart-sidebar .cart-item-image { object-fit:contain; padding:4px; }
body[data-store-theme] #cart-sidebar .cart-item-image-placeholder { background:var(--theme-commerce-soft); color:var(--theme-commerce-muted); }
body[data-store-theme] #cart-sidebar .cart-item-head { gap:5px; }
body[data-store-theme] #cart-sidebar .cart-item-name { color:var(--theme-commerce-text); font-size:var(--theme-cart-title-size)!important; font-weight:600; line-height:1.5; -webkit-line-clamp:3; line-clamp:3; padding-top:4px; }
body[data-store-theme] #cart-sidebar .cart-item-price { color:var(--theme-commerce-muted); font-size:12px!important; line-height:1.5; font-weight:400; }
body[data-store-theme] #cart-sidebar .cart-item-price .cart-item-unit { color:inherit; opacity:1; font-size:11px; }
body[data-store-theme] #cart-sidebar .cart-item-foot { flex-wrap:wrap; gap:10px; margin-top:12px; }
body[data-store-theme] #cart-sidebar :is(.cart-item-subtotal,.summary-amount,.total-amount,.discount-amount) { font-family:var(--font-body)!important; font-variant-numeric:tabular-nums; letter-spacing:0; }
body[data-store-theme] #cart-sidebar .cart-item-subtotal { color:var(--theme-commerce-text); font-size:14px!important; font-weight:600; margin-left:auto; overflow-wrap:anywhere; white-space:normal; }
body[data-store-theme] #cart-sidebar .quantity-control { background:var(--theme-commerce-surface); border:1px solid var(--theme-commerce-border); border-radius:var(--theme-commerce-radius); }
body[data-store-theme] #cart-sidebar .quantity-btn { width:36px; min-width:36px; height:36px; min-height:36px; color:var(--theme-commerce-text); background:transparent; }
body[data-store-theme] #cart-sidebar .quantity-btn:hover:not(:disabled) { background:var(--theme-commerce-soft); }
body[data-store-theme] #cart-sidebar .quantity-btn:disabled { opacity:.4; }
body[data-store-theme] #cart-sidebar .quantity-input { width:34px; height:36px; color:var(--theme-commerce-text); background:transparent; border:0; font-size:14px; font-weight:500; font-variant-numeric:tabular-nums; }
body[data-store-theme] #cart-sidebar .cart-footer { padding:16px var(--theme-cart-padding) max(16px,env(safe-area-inset-bottom)); border-color:var(--theme-commerce-border); background:var(--theme-commerce-surface); flex-shrink:0; }
body[data-store-theme] #cart-sidebar .discount-code-link-container { margin-bottom:8px; }
body[data-store-theme] #cart-sidebar .discount-code-link { padding:8px 0; min-height:44px; border:0; border-radius:var(--theme-commerce-radius); color:var(--theme-commerce-text); background:transparent; font-size:12px; }
body[data-store-theme] #cart-sidebar .discount-code-link:hover { background:var(--theme-commerce-soft); }
body[data-store-theme] #cart-sidebar .cart-summary { padding:0; margin-bottom:14px; background:transparent; border:0; border-radius:0; color:var(--theme-commerce-text); }
body[data-store-theme] #cart-sidebar :is(.summary-row,.shipping-row) { gap:12px; padding:5px 0; background:transparent; }
body[data-store-theme] #cart-sidebar :is(.summary-label,.summary-amount,.shipping-label,.shipping-amount,.discount-label,.discount-amount) { font-size:13px; line-height:1.5; }
body[data-store-theme] #cart-sidebar :is(.summary-label,.shipping-label,.discount-label) { color:var(--theme-commerce-muted); }
body[data-store-theme] #cart-sidebar :is(.summary-amount,.shipping-amount.standard) { color:var(--theme-commerce-text); font-weight:500; }
body[data-store-theme] #cart-sidebar .shipping-section { margin:0; padding:0; border:0; }
body[data-store-theme] #cart-sidebar .shipping-label { min-width:0; align-items:flex-start; }
body[data-store-theme] #cart-sidebar .shipping-amount { flex-shrink:0; }
body[data-store-theme] #cart-sidebar .total-row { border-top:1px solid var(--theme-commerce-border); margin-top:8px; padding-top:12px; }
body[data-store-theme] #cart-sidebar :is(.total-label,.total-amount) { color:var(--theme-commerce-text); font-size:var(--theme-cart-total-size); font-weight:600; line-height:1.3; overflow-wrap:anywhere; }
body[data-store-theme] #cart-sidebar .cart-actions { flex-direction:column; gap:8px; }
body[data-store-theme] #cart-sidebar .cart-action-btn { background:var(--theme-commerce-action); color:var(--theme-commerce-action-text); border:1px solid var(--theme-commerce-action); border-radius:var(--theme-commerce-radius); min-height:48px; padding:12px 18px; font-family:var(--font-body)!important; font-size:14px; font-weight:600; box-shadow:none; backdrop-filter:none; transform:none; }
body[data-store-theme] #cart-sidebar .cart-action-btn i { color:inherit; transform:none; }
body[data-store-theme] #cart-sidebar .cart-action-btn:hover:not(:disabled) { background:var(--theme-commerce-action-hover); border-color:var(--theme-commerce-action-hover); box-shadow:none; transform:none; }
body[data-store-theme] #cart-sidebar .cart-action-btn:disabled { background:var(--theme-commerce-soft); color:var(--theme-commerce-muted); border-color:var(--theme-commerce-border); opacity:1; }
body[data-store-theme] #cart-sidebar .cart-continue { min-height:44px; padding:8px 12px; border:1px solid var(--theme-commerce-border); border-radius:var(--theme-commerce-radius); background:transparent; color:var(--theme-commerce-text); font-size:13px; }
body[data-store-theme] #cart-sidebar .cart-continue:hover { background:var(--theme-commerce-soft); }
body[data-store-theme] #cart-sidebar .cart-empty { padding:48px 12px; color:var(--theme-commerce-muted); }
body[data-store-theme] #cart-sidebar .cart-empty>i { width:64px; height:64px; display:inline-grid; place-items:center; font-size:28px; border-radius:var(--theme-commerce-radius); background:var(--theme-commerce-soft); color:var(--theme-commerce-muted); }
body[data-store-theme] #cart-sidebar .cart-empty h4 { color:var(--theme-commerce-text); font-family:var(--theme-commerce-heading-font)!important; font-size:22px!important; font-weight:var(--theme-heading-weight); margin:8px 0; }
body[data-store-theme] #cart-sidebar .cart-empty p { color:var(--theme-commerce-muted); font-size:14px; line-height:1.6; }
body[data-store-theme] #cart-sidebar .cart-empty .cart-continue { display:inline-flex; align-items:center; justify-content:center; margin-top:24px; }
body[data-store-theme] #cart-sidebar :is(button,input):focus-visible { outline:2px solid var(--theme-commerce-action); outline-offset:2px; }
body[data-store-theme] #cart-sidebar .quantity-input:focus-visible { outline-offset:-3px; }
body[data-store-theme] #cart-sidebar :is(.cart-sync-notice,.cart-item-badge,.price-flag) { border-radius:var(--theme-commerce-radius); }
body[data-store-theme] #cart-sidebar :is(.cart-sync-notice.crit,.cart-item-badge.crit) { background:color-mix(in srgb,var(--color-error) 8%,var(--theme-commerce-surface)); color:var(--color-error); border-color:color-mix(in srgb,var(--color-error) 25%,var(--theme-commerce-border)); }
body[data-store-theme] #cart-sidebar :is(.cart-sync-notice.warn,.cart-item-badge.warn) { background:color-mix(in srgb,var(--color-warning) 8%,var(--theme-commerce-surface)); color:var(--color-warning); border-color:var(--color-warning); }
body[data-store-theme] #cart-sidebar :is(.cart-sync-notice.info,.cart-item-badge.soft,.price-flag) { background:var(--theme-commerce-soft); color:var(--theme-commerce-text); border-color:var(--theme-commerce-border); }
body[data-store-theme] #cart-sidebar :is(.price-now,.discount-amount,.shipping-amount.free,.shipping-icon.free) { color:var(--color-success); }
body[data-store-theme] #cart-sidebar .price-was { color:var(--theme-commerce-muted); }
@media(max-width:767px) {
 body[data-store-theme] { --theme-cart-padding:20px; --theme-cart-image-width:73px; --theme-cart-gap:13px; }
 body[data-mobile-product-heading="sector"] { --theme-cart-image-width:75px; --theme-cart-image-height:94px; --theme-cart-gap:14px; --theme-cart-total-size:17px; }
 body[data-store-theme] #cart-sidebar { width:100%; max-width:100%; }
 body[data-store-theme] #cart-sidebar .cart-header { min-height:68px; padding-block:12px; }
 body[data-store-theme] #cart-sidebar .quantity-btn { width:44px; min-width:44px; height:44px; min-height:44px; }
 body[data-store-theme] #cart-sidebar .quantity-input { height:44px; font-size:16px; }
}
@media(max-height:560px) {
 body[data-store-theme] #cart-sidebar { overflow-y:auto; }
 body[data-store-theme] #cart-sidebar :is(.cart-header,.cart-footer) { position:static; }
 body[data-store-theme] #cart-sidebar .cart-content { flex:none; max-height:none!important; overflow:visible; }
}
@media(prefers-reduced-motion:reduce) {
 body[data-store-theme] :is(#cart-sidebar,#cart-overlay),body[data-store-theme] #cart-sidebar * { transition:none; animation:none!important; }
}

/* Purchase dialogs share the active storefront's commerce tokens. No payment logic. */
body[data-store-theme] :is(.payment-method-modal-overlay,.discount-modal-overlay) {
    background:var(--theme-commerce-overlay) !important;
    backdrop-filter:none;
}
body[data-store-theme] :is(#client-capture-modal,#payment-success-modal) {
    background:var(--theme-commerce-overlay) !important;
    padding:16px;
}
body[data-store-theme] :is(.payment-method-modal-content,.discount-modal-content,#client-capture-modal>div,#payment-success-modal>div) {
    width:min(480px,calc(100vw - 32px));
    max-width:480px;
    max-height:calc(100vh - 32px);
    max-height:calc(100dvh - 32px);
    overflow:auto;
    overscroll-behavior:contain;
    background:var(--theme-commerce-surface) !important;
    color:var(--theme-commerce-text) !important;
    border:1px solid var(--theme-commerce-border);
    border-radius:var(--theme-commerce-radius);
    box-shadow:0 18px 56px color-mix(in srgb,var(--theme-commerce-text) 18%,transparent);
    font-family:var(--font-body);
}
body[data-store-theme] :is(.payment-method-modal-header,.discount-modal-header,#client-capture-modal>div>div:first-child,#payment-success-modal>div>div:first-child) {
    padding:20px;
    gap:12px;
    border-color:var(--theme-commerce-border) !important;
}
body[data-store-theme] :is(.payment-method-modal-header h3,.discount-modal-header h3,#client-capture-modal h3,#payment-success-modal h2) {
    color:var(--theme-commerce-text) !important;
    font-family:var(--theme-commerce-heading-font) !important;
    font-size:clamp(1.1rem,3vw,1.4rem);
    font-weight:var(--theme-heading-weight);
    line-height:1.3;
    letter-spacing:-.025em;
    min-width:0;
}
body[data-store-theme] :is(.payment-method-modal-header h3,.discount-modal-header h3) i {
    color:inherit;
    font-size:16px;
    flex:none;
}
body[data-store-theme] :is(.payment-method-modal-close,.discount-modal-close,#close-client-modal) {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 44px;
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px;
    padding:0;
    border:1px solid var(--theme-commerce-border);
    border-radius:var(--theme-control-radius);
    color:var(--theme-commerce-text) !important;
    background:var(--theme-commerce-surface) !important;
    box-shadow:none;
}
body[data-store-theme] :is(.payment-method-modal-close,.discount-modal-close,#close-client-modal):hover {
    color:var(--theme-commerce-text) !important;
    background:var(--theme-commerce-soft) !important;
}
body[data-store-theme] :is(.payment-method-modal-body,.discount-modal-body,#client-form,#payment-success-modal>div>div+div) { padding:20px; }
body[data-store-theme] .payment-method-list { gap:10px; }
body[data-store-theme] .payment-method-option {
    grid-template-columns:44px minmax(0,1fr) auto;
    min-height:76px;
    gap:12px;
    padding:14px;
    border:1px solid var(--theme-commerce-border);
    border-radius:var(--theme-commerce-radius);
    color:var(--theme-commerce-text) !important;
    background:var(--theme-commerce-surface) !important;
    box-shadow:none;
    transition:background-color .15s,border-color .15s;
}
body[data-store-theme] .payment-method-option:hover {
    border-color:var(--theme-commerce-text) !important;
    color:var(--theme-commerce-text) !important;
    background:var(--theme-commerce-soft) !important;
    transform:none;
}
body[data-store-theme] .payment-method-icon {
    width:44px;
    height:44px;
    background:var(--theme-commerce-soft) !important;
    color:var(--theme-commerce-text) !important;
    border:1px solid var(--theme-commerce-border);
    border-radius:var(--theme-control-radius);
}
body[data-store-theme] .payment-method-copy strong { color:var(--theme-commerce-text) !important; font-size:14px; line-height:1.4; }
body[data-store-theme] .payment-method-copy small { color:var(--theme-commerce-muted) !important; font-size:12px; line-height:1.5; }
body[data-store-theme] .payment-method-arrow { color:var(--theme-commerce-muted) !important; }
body[data-store-theme] :is(.discount-modal-description,#client-form label,#payment-success-modal p) {
    color:var(--theme-commerce-muted) !important;
    line-height:1.6;
}
body[data-store-theme] :is(.discount-code-input-modal,#client-form input:not([type="hidden"])) {
    min-width:0;
    min-height:46px;
    font-size:16px;
    line-height:1.4;
    background:var(--theme-commerce-surface) !important;
    color:var(--theme-commerce-text) !important;
    border:1px solid var(--theme-commerce-border);
    border-radius:var(--theme-control-radius);
    box-shadow:none;
    padding:11px 12px;
}
body[data-store-theme] :is(.discount-code-input-modal,#client-form input)::placeholder { color:var(--theme-commerce-muted) !important; opacity:1; }
body[data-store-theme] :is(.discount-code-input-modal,#client-form input):focus {
    border-color:var(--theme-commerce-text) !important;
    outline:2px solid var(--theme-commerce-text);
    outline-offset:2px;
    box-shadow:none;
}
body[data-store-theme] :is(.apply-discount-btn-modal,#client-form button,#payment-success-modal button) {
    min-height:46px;
    border:1px solid transparent;
    border-radius:var(--theme-control-radius);
    font-size:14px;
    font-weight:600;
    line-height:1.4;
    box-shadow:none;
    transform:none;
}
body[data-store-theme] :is(.apply-discount-btn-modal,#client-form button[type="submit"],#payment-success-modal button) {
    color:var(--theme-commerce-action-text) !important;
    background:var(--theme-commerce-action) !important;
}
body[data-store-theme] :is(.apply-discount-btn-modal,#client-form button[type="submit"],#payment-success-modal button):hover:not(:disabled) {
    color:var(--theme-commerce-action-text) !important;
    background:var(--theme-commerce-action-hover) !important;
    box-shadow:none;
    transform:none;
}
body[data-store-theme] #cancel-client-form {
    color:var(--theme-commerce-text) !important;
    background:var(--theme-commerce-surface) !important;
    border-color:var(--theme-commerce-border) !important;
}
body[data-store-theme] #cancel-client-form:hover { background:var(--theme-commerce-soft) !important; }
body[data-store-theme] :is(.payment-method-modal,.discount-modal,#client-capture-modal,#payment-success-modal) :is(button,input):focus-visible {
    outline:2px solid var(--theme-commerce-text);
    outline-offset:2px;
}
body[data-store-theme] .discount-code-input-modal:disabled {
    color:var(--theme-commerce-muted) !important;
    background:var(--theme-commerce-soft) !important;
}
body[data-store-theme] .apply-discount-btn-modal:disabled {
    color:var(--theme-commerce-muted) !important;
    background:var(--theme-commerce-soft) !important;
    border-color:var(--theme-commerce-border) !important;
    opacity:1;
}
body[data-store-theme] .discount-code-message-modal { border-radius:var(--theme-control-radius); line-height:1.5; }
body[data-store-theme] #payment-success-modal :is(.bg-green-100,.bg-green-50) {
    background:var(--theme-commerce-soft) !important;
    border-color:var(--theme-commerce-border) !important;
    border-radius:var(--theme-commerce-radius);
}
body[data-store-theme] #payment-success-modal :is(svg,.text-green-800) { color:var(--theme-commerce-text) !important; }
body[data-store-theme] #payment-success-modal .animate-checkmark { stroke-dashoffset:0; opacity:1; }
body[data-store-theme] #payment-success-modal .rounded-lg { border-radius:var(--theme-commerce-radius); }
@media(max-width:480px) {
    body[data-store-theme] :is(.payment-method-modal-header,.discount-modal-header,.payment-method-modal-body,.discount-modal-body,#client-form,#client-capture-modal>div>div:first-child,#payment-success-modal>div>div) { padding:16px; }
    body[data-store-theme] :is(.payment-method-modal-header h3,.discount-modal-header h3) { font-size:18px; }
    body[data-store-theme] .payment-method-option { padding:12px; gap:10px; }
    body[data-store-theme] .discount-code-input-group-modal { flex-direction:column; gap:10px; }
    body[data-store-theme] .apply-discount-btn-modal { justify-content:center; }
}
@media(prefers-reduced-motion:reduce) {
    body[data-store-theme] :is(.payment-method-modal,.discount-modal,#client-capture-modal,#payment-success-modal) * { animation:none !important; transition:none !important; }
}

/* Purchase overlays remain above the open cart on every theme. */
body[data-store-theme] :is(#payment-method-modal,#discount-code-modal,#client-capture-modal) { z-index:10020; }
body[data-store-theme] #payment-success-modal { z-index:10021; }

body[data-store-theme] #cart-sidebar .shipping-icon:not(.free) { color:var(--theme-commerce-muted); }
