/* ═══════════════════════════════════════════════════════════════
   RACEWORX CART WIDGET  ·  v2.0
   White theme · KTM Orange · Montserrat
   All values driven by CSS variables — overridable per-widget
   ═══════════════════════════════════════════════════════════════ */

/* ── Variable defaults (overridden by inline PHP/Elementor) ───── */
.raceworx-cart-wrap {
    --rw-primary:       #FF6700;
    --rw-primary-dark:  #E55B00;
    --rw-secondary:     #1A1A1A;
    --rw-success:       #16a34a;
    --rw-danger:        #dc2626;
    --rw-bg:            #ffffff;
    --rw-surface:       #f7f7f7;
    --rw-surface-hover: #f0f0f0;
    --rw-border:        #e5e5e5;
    --rw-border-strong: #d0d0d0;
    --rw-text:          #1a1a1a;
    --rw-text-sec:      #444444;
    --rw-muted:         #888888;
    --rw-font:          'Montserrat', sans-serif;
    --rw-radius:        3px;
    --rw-ease:          cubic-bezier(.25,.46,.45,.94);
    --rw-speed:         280ms;

    font-family: var(--rw-font);
    background:  var(--rw-bg);
    color:       var(--rw-text);
    font-size:   15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Entrance animation ───────────────────────────────────────── */
.raceworx-cart-wrap.rw-animated .rw-page-header,
.raceworx-cart-wrap.rw-animated .rw-cart-grid,
.raceworx-cart-wrap.rw-animated .rw-continue-wrap {
    animation: rwFadeUp var(--rw-speed) var(--rw-ease) both;
}
.raceworx-cart-wrap.rw-animated .rw-cart-grid   { animation-delay: .06s; }
.raceworx-cart-wrap.rw-animated .rw-continue-wrap{ animation-delay: .12s; }
@keyframes rwFadeUp { from { opacity:0; transform:translateY(14px) } to { opacity:1; transform:none } }
@keyframes rwFlash  { 0%,100%{ color:var(--rw-text) } 50%{ color:var(--rw-primary) } }
@keyframes rwSpin   { to { transform:rotate(360deg) } }

/* ═══════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-page-header { margin-bottom: 28px; }

.raceworx-cart-wrap .rw-overline {
    font-size: 10px; font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--rw-primary); margin-bottom: 4px;
    display: block;
}

.raceworx-cart-wrap .rw-page-title {
    font-size: clamp(26px, 4.5vw, 44px);
    font-weight: 800; letter-spacing: -.02em;
    line-height: 1.05; text-transform: uppercase;
    color: var(--rw-text); margin: 0;
}
.raceworx-cart-wrap .rw-page-title span { color: var(--rw-primary); }

/* ═══════════════════════════════════════════════════════════════
   TWO-COLUMN GRID
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-cart-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
}

/* ═══════════════════════════════════════════════════════════════
   CART TABLE (desktop)
   6-column grid: [thumb][info][price][qty][subtotal][remove]
   The .rw-th-price / .rw-item-price cells share the class
   so they can be hidden together at tablet/mobile.
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-cart-table {
    background: var(--rw-bg);
    border: 1px solid var(--rw-border);
    border-radius: var(--rw-radius);
    overflow: hidden;
}

/* Column definition — shared by head and every item row */
.raceworx-cart-wrap .rw-cart-thead,
.raceworx-cart-wrap .rw-cart-item {
    display: grid;
    grid-template-columns: 72px 1fr 100px 130px 110px 40px;
    align-items: center;
    column-gap: 0;
}

/* ── Table head ─────────────────────────────────────────────── */
.raceworx-cart-wrap .rw-cart-thead {
    background: var(--rw-surface);
    border-bottom: 1px solid var(--rw-border);
    padding: 0 16px;
}
.raceworx-cart-wrap .rw-th {
    padding: 11px 10px;
    font-size: 10px; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--rw-muted);
}
.raceworx-cart-wrap .rw-th-thumb  { padding-left: 0; }
.raceworx-cart-wrap .rw-th-center { text-align: center; }
.raceworx-cart-wrap .rw-th-right  { text-align: right; }
.raceworx-cart-wrap .rw-th-remove { padding: 0; }

/* ── Cart item row ──────────────────────────────────────────── */
.raceworx-cart-wrap .rw-cart-item {
    padding: 16px;
    border-bottom: 1px solid var(--rw-border);
    position: relative;
    overflow: hidden;
    transition: background var(--rw-speed) var(--rw-ease);
}
.raceworx-cart-wrap .rw-cart-item:last-child { border-bottom: none; }
.raceworx-cart-wrap .rw-cart-item:hover { background: var(--rw-surface-hover); }

/* Hover accent bar */
.raceworx-cart-wrap .rw-cart-item::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--rw-primary);
    transform: scaleY(0); transform-origin: bottom;
    transition: transform var(--rw-speed) var(--rw-ease);
}
.raceworx-cart-wrap .rw-cart-item:hover::before { transform: scaleY(1); }

/* Remove animation */
.raceworx-cart-wrap .rw-cart-item.rw-removing {
    opacity: 0; transform: translateX(12px);
    transition: opacity var(--rw-speed) var(--rw-ease), transform var(--rw-speed) var(--rw-ease);
    pointer-events: none;
}

/* ── Thumbnail ──────────────────────────────────────────────── */
.raceworx-cart-wrap .rw-item-thumb {
    width: 72px; height: 72px; min-width: 72px;
    background: var(--rw-surface); border: 1px solid var(--rw-border);
    border-radius: var(--rw-radius); overflow: hidden;
}
.raceworx-cart-wrap .rw-item-thumb a { display: block; width: 100%; height: 100%; }
.raceworx-cart-wrap .rw-thumb-img    { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Product info ───────────────────────────────────────────── */
.raceworx-cart-wrap .rw-item-info {
    display: flex; flex-direction: column; gap: 3px;
    padding: 0 12px; min-width: 0;
}
.raceworx-cart-wrap .rw-item-name {
    font-size: 14px; font-weight: 600; color: var(--rw-text);
    text-decoration: none; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color var(--rw-speed);
}
.raceworx-cart-wrap .rw-item-name:hover { color: var(--rw-primary); }

.raceworx-cart-wrap .rw-item-meta { font-size: 12px; color: var(--rw-muted); }
.raceworx-cart-wrap .rw-item-meta span { color: var(--rw-text-sec); margin-left: 3px; }
.raceworx-cart-wrap .rw-item-sku  { font-size: 10px; color: var(--rw-muted); letter-spacing: .06em; text-transform: uppercase; font-weight: 500; }

/* ── Unit price ─────────────────────────────────────────────── */
.raceworx-cart-wrap .rw-item-price {
    text-align: center; padding: 0 8px;
    font-size: 14px; font-weight: 600; color: var(--rw-text);
}

/* ── Qty control ────────────────────────────────────────────── */
.raceworx-cart-wrap .rw-qty-cell {
    display: flex; justify-content: center; align-items: center;
}
.raceworx-cart-wrap .rw-qty-control {
    display: inline-flex; align-items: center;
    border: 1px solid var(--rw-border); border-radius: var(--rw-radius);
    overflow: hidden;
}
.raceworx-cart-wrap .rw-qty-btn {
    width: 34px; height: 36px;
    background: var(--rw-surface); border: none; outline: none;
    color: var(--rw-text-sec); font-size: 18px; line-height: 1;
    cursor: pointer; display: grid; place-items: center;
    flex-shrink: 0; padding: 0;
    font-family: var(--rw-font); font-weight: 500;
    transition: background var(--rw-speed), color var(--rw-speed);
}
.raceworx-cart-wrap .rw-qty-btn:hover    { background: var(--rw-primary); color: #fff; }
.raceworx-cart-wrap .rw-qty-btn:disabled { opacity: .4; cursor: default; }

.raceworx-cart-wrap .rw-qty-input {
    width: 44px; height: 36px; border: none; outline: none;
    border-left: 1px solid var(--rw-border); border-right: 1px solid var(--rw-border);
    background: var(--rw-bg); color: var(--rw-text);
    font-family: var(--rw-font); font-size: 14px; font-weight: 700;
    text-align: center; -moz-appearance: textfield;
    transition: border-color var(--rw-speed);
}
.raceworx-cart-wrap .rw-qty-input:focus { border-color: var(--rw-primary); }
.raceworx-cart-wrap .rw-qty-input::-webkit-inner-spin-button,
.raceworx-cart-wrap .rw-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Line-item subtotal ─────────────────────────────────────── */
.raceworx-cart-wrap .rw-item-total {
    text-align: right; padding-right: 8px;
    font-size: 14px; font-weight: 700; color: var(--rw-text);
}
.raceworx-cart-wrap .rw-item-total.rw-flash { animation: rwFlash .5s var(--rw-ease); }

/* ── Remove button ──────────────────────────────────────────── */
.raceworx-cart-wrap .rw-remove-btn {
    width: 32px; height: 32px; padding: 0;
    background: transparent; border: 1px solid var(--rw-border);
    border-radius: 50%; cursor: pointer;
    display: grid; place-items: center;
    color: var(--rw-muted);
    transition: all var(--rw-speed) var(--rw-ease);
    margin-left: auto;
}
.raceworx-cart-wrap .rw-remove-btn:hover { background: var(--rw-danger); border-color: var(--rw-danger); color: #fff; }
.raceworx-cart-wrap .rw-remove-btn svg   { width: 13px; height: 13px; fill: currentColor; }

/* ═══════════════════════════════════════════════════════════════
   CART FOOTER (coupon + checkout button row)
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-cart-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 14px 16px;
    background: var(--rw-surface); border-top: 1px solid var(--rw-border);
}

/* Coupon row */
.raceworx-cart-wrap .rw-coupon-form {
    display: flex; align-items: center; flex-wrap: nowrap; gap: 0;
}
.raceworx-cart-wrap .rw-coupon-input {
    height: 40px; padding: 0 14px;
    background: var(--rw-bg); border: 1px solid var(--rw-border); border-right: none;
    border-radius: var(--rw-radius) 0 0 var(--rw-radius);
    font-family: var(--rw-font); font-size: 13px; color: var(--rw-text);
    outline: none; width: 180px;
    transition: border-color var(--rw-speed);
}
.raceworx-cart-wrap .rw-coupon-input::placeholder { color: var(--rw-muted); }
.raceworx-cart-wrap .rw-coupon-input:focus { border-color: var(--rw-primary); }

.raceworx-cart-wrap .rw-btn-apply {
    height: 40px; padding: 0 16px;
    background: var(--rw-secondary); border: 1px solid var(--rw-secondary);
    border-radius: 0 var(--rw-radius) var(--rw-radius) 0;
    color: #fff; font-family: var(--rw-font);
    font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    cursor: pointer; white-space: nowrap;
    transition: background var(--rw-speed), border-color var(--rw-speed);
}
.raceworx-cart-wrap .rw-btn-apply:hover { background: var(--rw-primary); border-color: var(--rw-primary); }
.raceworx-cart-wrap .rw-btn-apply:disabled { opacity: .6; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 46px; padding: 0 22px;
    background: var(--rw-primary); border: 1px solid var(--rw-primary);
    border-radius: var(--rw-radius); color: #fff;
    font-family: var(--rw-font); font-size: 13px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background var(--rw-speed), border-color var(--rw-speed);
}
.raceworx-cart-wrap .rw-btn-primary:hover  { background: var(--rw-primary-dark); border-color: var(--rw-primary-dark); }
.raceworx-cart-wrap .rw-btn-primary:focus  { outline: 3px solid rgba(255,103,0,.35); outline-offset: 2px; }
.raceworx-cart-wrap .rw-btn-primary svg    { width: 15px; height: 15px; fill: currentColor; transition: transform var(--rw-speed) var(--rw-ease); }
.raceworx-cart-wrap .rw-btn-primary:hover svg { transform: translateX(3px); }

/* CTA (sidebar) */
.raceworx-cart-wrap .rw-btn-cta {
    width: 100%; height: 52px;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    background: var(--rw-primary); border: 1px solid var(--rw-primary);
    border-radius: var(--rw-radius); color: #fff;
    font-family: var(--rw-font); font-size: 14px; font-weight: 800;
    letter-spacing: .08em; text-transform: uppercase;
    cursor: pointer; padding: 0;
    transition: background var(--rw-speed), border-color var(--rw-speed);
}
.raceworx-cart-wrap .rw-btn-cta:hover  { background: var(--rw-primary-dark); border-color: var(--rw-primary-dark); }
.raceworx-cart-wrap .rw-btn-cta:focus  { outline: 3px solid rgba(255,103,0,.35); outline-offset: 2px; }
.raceworx-cart-wrap .rw-btn-cta svg    { width: 17px; height: 17px; fill: currentColor; }

/* ═══════════════════════════════════════════════════════════════
   ORDER SUMMARY SIDEBAR
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-summary-sidebar {
    position: sticky; top: 80px;
}
.raceworx-cart-wrap .rw-summary {
    background: var(--rw-bg); border: 1px solid var(--rw-border);
    border-radius: var(--rw-radius); overflow: hidden;
}
.raceworx-cart-wrap .rw-summary-head {
    padding: 14px 20px;
    background: var(--rw-surface); border-bottom: 1px solid var(--rw-border);
}
.raceworx-cart-wrap .rw-summary-title {
    font-size: 11px; font-weight: 700; letter-spacing: .14em;
    text-transform: uppercase; color: var(--rw-muted); margin: 0;
}

.raceworx-cart-wrap .rw-summary-rows {
    padding: 16px 20px; display: flex; flex-direction: column; gap: 11px;
}
.raceworx-cart-wrap .rw-summary-row {
    display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.raceworx-cart-wrap .rw-sr-label { color: var(--rw-muted); font-weight: 500; }
.raceworx-cart-wrap .rw-sr-value {
    font-weight: 600; font-size: 14px; color: var(--rw-text); text-align: right;
}
.raceworx-cart-wrap .rw-sr-discount { color: var(--rw-success); }
.raceworx-cart-wrap .rw-summary-divider { height: 1px; background: var(--rw-border); margin: 2px 0; }

.raceworx-cart-wrap .rw-summary-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-top: 2px solid var(--rw-primary);
    background: var(--rw-surface);
}
.raceworx-cart-wrap .rw-summary-total-label {
    font-size: 10px; font-weight: 700; letter-spacing: .16em;
    text-transform: uppercase; color: var(--rw-muted);
}
.raceworx-cart-wrap .rw-summary-total-value {
    font-size: 26px; font-weight: 800; color: var(--rw-text); letter-spacing: -.02em;
    transition: color var(--rw-speed);
}
.raceworx-cart-wrap .rw-sr-total.rw-flash { animation: rwFlash .6s var(--rw-ease); }

.raceworx-cart-wrap .rw-summary-cta { padding: 16px 20px; border-top: 1px solid var(--rw-border); }

/* Trust badges */
.raceworx-cart-wrap .rw-trust-badges {
    display: flex; gap: 6px; flex-wrap: wrap;
    padding: 10px 20px 14px; border-top: 1px solid var(--rw-border);
}
.raceworx-cart-wrap .rw-trust-badge {
    display: flex; align-items: center; gap: 4px; flex: 1;
    font-size: 9px; font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase; color: var(--rw-muted); white-space: nowrap;
}
.raceworx-cart-wrap .rw-trust-badge svg { width: 12px; height: 12px; fill: var(--rw-muted); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   CONTINUE SHOPPING
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-continue-wrap { margin-top: 14px; }
.raceworx-cart-wrap .rw-continue-link {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--rw-muted); text-decoration: none; transition: color var(--rw-speed);
}
.raceworx-cart-wrap .rw-continue-link:hover { color: var(--rw-primary); }
.raceworx-cart-wrap .rw-continue-link svg   { width: 13px; height: 13px; fill: currentColor; }

/* ═══════════════════════════════════════════════════════════════
   EMPTY CART
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-empty-cart {
    text-align: center; padding: 64px 32px;
    background: var(--rw-surface); border: 1px solid var(--rw-border);
    border-radius: var(--rw-radius);
}
.raceworx-cart-wrap .rw-empty-icon {
    width: 68px; height: 68px; margin: 0 auto 18px;
    background: var(--rw-border); border-radius: 50%; display: grid; place-items: center;
}
.raceworx-cart-wrap .rw-empty-icon svg { width: 32px; height: 32px; fill: var(--rw-muted); }
.raceworx-cart-wrap .rw-empty-title {
    font-size: 20px; font-weight: 800; text-transform: uppercase;
    letter-spacing: -.01em; margin-bottom: 6px;
}
.raceworx-cart-wrap .rw-empty-text { font-size: 14px; color: var(--rw-muted); margin-bottom: 22px; }

/* ═══════════════════════════════════════════════════════════════
   SPINNER / LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap .rw-cart-item .rw-row-overlay {
    position: absolute; inset: 0; background: rgba(255,255,255,.75);
    display: grid; place-items: center; z-index: 2;
    pointer-events: none;
}
.rw-spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--rw-border, #e5e5e5);
    border-top-color: var(--rw-primary, #FF6700);
    border-radius: 50%;
    animation: rwSpin .55s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */
.rw-toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #fff; border: 1px solid #e5e5e5;
    border-left: 3px solid #16a34a;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    padding: 11px 16px; display: flex; align-items: center; gap: 9px;
    font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 500; color: #1a1a1a;
    z-index: 99999; max-width: 300px;
    transform: translateX(calc(100% + 32px));
    transition: transform .32s cubic-bezier(.34,1.56,.64,1);
    border-radius: 3px;
}
.rw-toast.rw-toast-show  { transform: translateX(0); }
.rw-toast.rw-toast-error { border-left-color: #dc2626; }
.rw-toast .rw-toast-icon { width: 15px; height: 15px; fill: #16a34a; flex-shrink: 0; }
.rw-toast.rw-toast-error .rw-toast-icon { fill: #dc2626; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  769px – 1099px
   Keep 2-column layout but shrink sidebar; hide unit price
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1099px) {

    .raceworx-cart-wrap .rw-cart-grid {
        grid-template-columns: 1fr 280px;
        gap: 18px;
    }

    /* Drop price column at tablet — merge into info */
    .raceworx-cart-wrap .rw-cart-thead,
    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 60px 1fr 120px 90px 38px;
    }
    .raceworx-cart-wrap .rw-th-price,
    .raceworx-cart-wrap .rw-item-price { display: none; }

    .raceworx-cart-wrap .rw-item-thumb { width: 60px; height: 60px; min-width: 60px; }
    .raceworx-cart-wrap .rw-item-info  { padding: 0 10px; }
    .raceworx-cart-wrap .rw-qty-btn    { width: 28px; }
    .raceworx-cart-wrap .rw-qty-input  { width: 36px; }
    .raceworx-cart-wrap .rw-summary-total-value { font-size: 22px; }
    .raceworx-cart-wrap .rw-coupon-input { width: 130px; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  ≤ 768px
   Single column, card layout per item — no overlapping columns
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Stack grid */
    .raceworx-cart-wrap .rw-cart-grid { grid-template-columns: 1fr; gap: 20px; }
    .raceworx-cart-wrap .rw-summary-sidebar { position: relative; top: auto; }

    /* Hide desktop head */
    .raceworx-cart-wrap .rw-cart-thead { display: none; }

    /* ───────────────────────────────────────────────────────────
       Card layout:
       Row 1: [thumb]  [name · sku · meta]
       Row 2: [thumb]  [qty — subtotal — remove]
       ─────────────────────────────────────────────────────────── */
    .raceworx-cart-wrap .rw-cart-item {
        display: grid;
        grid-template-columns: 68px 1fr;
        grid-template-rows: auto auto;
        grid-template-areas:
            "thumb  info"
            "thumb  controls";
        padding: 14px;
        gap: 0;
        align-items: start;
    }

    .raceworx-cart-wrap .rw-item-thumb {
        grid-area: thumb;
        width: 68px; height: 68px; min-width: 68px;
        margin-right: 12px; align-self: start;
    }

    .raceworx-cart-wrap .rw-item-info {
        grid-area: info;
        padding: 0 0 10px 0;
    }
    /* Allow name to wrap on mobile */
    .raceworx-cart-wrap .rw-item-name { white-space: normal; }

    /* Hide unit price */
    .raceworx-cart-wrap .rw-item-price { display: none; }

    /* Controls row: qty · subtotal · remove */
    .raceworx-cart-wrap .rw-qty-cell,
    .raceworx-cart-wrap .rw-item-total,
    .raceworx-cart-wrap .rw-remove-btn {
        grid-area: controls;
    }

    /* Wrap all three controls into one flex row using a pseudo-container.
       We use `display:contents` on a non-existent wrapper — instead we
       override positioning by making the ITEM grid place them correctly. */
    .raceworx-cart-wrap .rw-cart-item .rw-qty-cell    { display: flex; align-items: center; }
    .raceworx-cart-wrap .rw-cart-item .rw-item-total  { display: flex; align-items: center; flex: 1; justify-content: flex-end; font-size: 15px; font-weight: 700; padding: 0; }
    .raceworx-cart-wrap .rw-cart-item .rw-remove-btn  { display: flex; align-items: center; }

    /* Grid area trick: make controls row a sub-flex via explicit column */
    .raceworx-cart-wrap .rw-cart-item {
        grid-template-areas:
            "thumb  info"
            "thumb  ctrlrow";
    }
    /* The three cells all land in ctrlrow — override: use a sub-flex */
    .raceworx-cart-wrap .rw-qty-cell   { grid-area: ctrlrow; }
    .raceworx-cart-wrap .rw-item-total { grid-area: ctrlrow; }
    .raceworx-cart-wrap .rw-remove-btn { grid-area: ctrlrow; }

    /* Cleanest approach: make all three overlap in ctrlrow then position with flex */
    .raceworx-cart-wrap .rw-cart-item .rw-qty-cell,
    .raceworx-cart-wrap .rw-cart-item .rw-item-total,
    .raceworx-cart-wrap .rw-cart-item .rw-remove-btn {
        grid-area: ctrlrow;
        position: static;
    }

    /* Override the item grid with subgrid for the ctrlrow using CSS order trick */
    /* Actually the cleanest CSS-only solution: redefine grid cols for mobile */
    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 68px auto 1fr auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "thumb info    info    info"
            "thumb qty-w   subtot  remove";
        gap: 0 0;
    }

    .raceworx-cart-wrap .rw-item-thumb { grid-area: thumb; }
    .raceworx-cart-wrap .rw-item-info  { grid-area: info;   }
    .raceworx-cart-wrap .rw-qty-cell   { grid-area: qty-w;   align-self: center; padding-left: 0; }
    .raceworx-cart-wrap .rw-item-total { grid-area: subtot;  align-self: center; text-align: right; font-size: 15px; padding: 0 8px; }
    .raceworx-cart-wrap .rw-remove-btn { grid-area: remove;  align-self: center; margin-left: 4px; }

    /* ── Cart footer ─────────────────────────────────────────── */
    .raceworx-cart-wrap .rw-cart-footer { flex-direction: column; align-items: stretch; gap: 10px; }
    .raceworx-cart-wrap .rw-coupon-form { width: 100%; }
    .raceworx-cart-wrap .rw-coupon-input { flex: 1; width: auto; min-width: 0; }
    .raceworx-cart-wrap .rw-btn-primary { width: 100%; }

    /* ── Summary ─────────────────────────────────────────────── */
    .raceworx-cart-wrap .rw-summary-total-value { font-size: 22px; }

    /* ── Misc ───────────────────────────────────────────────── */
    .raceworx-cart-wrap .rw-empty-cart { padding: 48px 20px; }
}

/* ═══════════════════════════════════════════════════════════════
   SMALL MOBILE  ≤ 480px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 58px auto 1fr auto;
        padding: 12px;
    }
    .raceworx-cart-wrap .rw-item-thumb { width: 58px; height: 58px; min-width: 58px; margin-right: 10px; }
    .raceworx-cart-wrap .rw-item-name  { font-size: 13px; }
    .raceworx-cart-wrap .rw-qty-btn    { width: 28px; height: 32px; font-size: 16px; }
    .raceworx-cart-wrap .rw-qty-input  { width: 36px; height: 32px; font-size: 13px; }
    .raceworx-cart-wrap .rw-remove-btn { width: 28px; height: 28px; }
    .raceworx-cart-wrap .rw-btn-cta    { font-size: 13px; height: 46px; }
    .raceworx-cart-wrap .rw-cart-footer { padding: 12px; }
    .raceworx-cart-wrap .rw-summary-rows { padding: 12px 14px; }
    .raceworx-cart-wrap .rw-summary-head,
    .raceworx-cart-wrap .rw-summary-total,
    .raceworx-cart-wrap .rw-summary-cta,
    .raceworx-cart-wrap .rw-trust-badges { padding-left: 14px; padding-right: 14px; }
}


/* ═══════════════════════════════════════════════════════════════
   MODERN RESPONSIVE HARDENING
   Better sizing, overflow handling, and cross-device consistency
   ═══════════════════════════════════════════════════════════════ */
.raceworx-cart-wrap,
.raceworx-cart-wrap *,
.raceworx-cart-wrap *::before,
.raceworx-cart-wrap *::after {
    box-sizing: border-box;
}

.raceworx-cart-wrap {
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.raceworx-cart-wrap img,
.raceworx-cart-wrap svg {
    max-width: 100%;
}

.raceworx-cart-wrap .rw-page-header,
.raceworx-cart-wrap .rw-cart-grid,
.raceworx-cart-wrap .rw-cart-main,
.raceworx-cart-wrap .rw-cart-table,
.raceworx-cart-wrap .rw-summary-sidebar,
.raceworx-cart-wrap .rw-summary,
.raceworx-cart-wrap .rw-continue-wrap,
.raceworx-cart-wrap .rw-cart-footer,
.raceworx-cart-wrap .rw-coupon-form,
.raceworx-cart-wrap .rw-summary-row,
.raceworx-cart-wrap .rw-summary-total {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.raceworx-cart-wrap .rw-cart-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}

.raceworx-cart-wrap .rw-cart-main,
.raceworx-cart-wrap .rw-item-info,
.raceworx-cart-wrap .rw-summary-sidebar,
.raceworx-cart-wrap .rw-summary,
.raceworx-cart-wrap .rw-sr-value,
.raceworx-cart-wrap .rw-summary-total-value {
    min-width: 0;
}

.raceworx-cart-wrap .rw-cart-table,
.raceworx-cart-wrap .rw-summary,
.raceworx-cart-wrap .rw-empty-cart {
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.raceworx-cart-wrap .rw-cart-thead,
.raceworx-cart-wrap .rw-cart-item {
    width: 100%;
}

.raceworx-cart-wrap .rw-th,
.raceworx-cart-wrap .rw-item-price,
.raceworx-cart-wrap .rw-item-total,
.raceworx-cart-wrap .rw-sr-value,
.raceworx-cart-wrap .rw-summary-total-value {
    overflow-wrap: anywhere;
}

.raceworx-cart-wrap .rw-item-name,
.raceworx-cart-wrap .rw-item-meta,
.raceworx-cart-wrap .rw-item-sku {
    max-width: 100%;
}

.raceworx-cart-wrap .rw-coupon-form {
    gap: 10px;
    flex-wrap: wrap;
}

.raceworx-cart-wrap .rw-coupon-input,
.raceworx-cart-wrap .rw-btn-primary,
.raceworx-cart-wrap .rw-btn-apply,
.raceworx-cart-wrap .rw-btn-cta {
    max-width: 100%;
}

.raceworx-cart-wrap .rw-btn-primary,
.raceworx-cart-wrap .rw-btn-apply,
.raceworx-cart-wrap .rw-btn-cta,
.raceworx-cart-wrap .rw-remove-btn,
.raceworx-cart-wrap .rw-qty-btn,
.raceworx-cart-wrap .rw-qty-input,
.raceworx-cart-wrap .rw-coupon-input {
    touch-action: manipulation;
}

.raceworx-cart-wrap .rw-btn-primary,
.raceworx-cart-wrap .rw-btn-apply,
.raceworx-cart-wrap .rw-btn-cta,
.raceworx-cart-wrap .rw-remove-btn,
.raceworx-cart-wrap .rw-qty-btn {
    min-height: 44px;
}

.raceworx-cart-wrap .rw-remove-btn {
    min-width: 44px;
}

.raceworx-cart-wrap .rw-qty-btn {
    min-width: 34px;
}

.raceworx-cart-wrap .rw-coupon-input {
    min-width: 180px;
}

.raceworx-cart-wrap .rw-trust-badges {
    row-gap: 8px;
}

.raceworx-cart-wrap .rw-trust-badge {
    min-width: 0;
    justify-content: center;
}

.rw-toast {
    width: min(300px, calc(100vw - 32px));
}

@media (max-width: 1279px) {
    .raceworx-cart-wrap .rw-cart-grid {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
        gap: 22px;
    }

    .raceworx-cart-wrap .rw-cart-thead,
    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 64px minmax(0, 1fr) 96px 124px 108px 40px;
    }
}

@media (max-width: 1024px) {
    .raceworx-cart-wrap .rw-page-header {
        margin-bottom: 22px;
    }

    .raceworx-cart-wrap .rw-cart-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .raceworx-cart-wrap .rw-summary-sidebar {
        position: static;
    }

    .raceworx-cart-wrap .rw-summary-total-value {
        font-size: clamp(22px, 3vw, 26px);
    }
}

@media (min-width: 769px) and (max-width: 1099px) {
    .raceworx-cart-wrap .rw-cart-thead,
    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 60px minmax(0, 1fr) 116px 94px 40px;
    }

    .raceworx-cart-wrap .rw-coupon-form {
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .raceworx-cart-wrap {
        font-size: 14px;
        line-height: 1.5;
    }

    .raceworx-cart-wrap .rw-page-title {
        line-height: 1.08;
    }

    .raceworx-cart-wrap .rw-cart-table,
    .raceworx-cart-wrap .rw-summary,
    .raceworx-cart-wrap .rw-empty-cart {
        border-radius: max(10px, var(--rw-radius));
    }

    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 68px minmax(0, auto) minmax(0, 1fr) auto;
        gap: 10px 0;
    }

    .raceworx-cart-wrap .rw-item-info {
        gap: 4px;
        padding-bottom: 8px;
    }

    .raceworx-cart-wrap .rw-item-name,
    .raceworx-cart-wrap .rw-item-meta,
    .raceworx-cart-wrap .rw-item-sku {
        white-space: normal;
        word-break: break-word;
    }

    .raceworx-cart-wrap .rw-cart-footer {
        padding: 14px;
    }

    .raceworx-cart-wrap .rw-coupon-form {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .raceworx-cart-wrap .rw-coupon-input,
    .raceworx-cart-wrap .rw-btn-apply,
    .raceworx-cart-wrap .rw-btn-primary,
    .raceworx-cart-wrap .rw-btn-cta {
        width: 100%;
    }

    .raceworx-cart-wrap .rw-summary-head,
    .raceworx-cart-wrap .rw-summary-rows,
    .raceworx-cart-wrap .rw-summary-total,
    .raceworx-cart-wrap .rw-summary-cta,
    .raceworx-cart-wrap .rw-trust-badges {
        padding-left: 16px;
        padding-right: 16px;
    }

    .raceworx-cart-wrap .rw-trust-badge {
        flex: 1 1 calc(50% - 6px);
        justify-content: flex-start;
        white-space: normal;
    }

    .rw-toast {
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 640px) {
    .raceworx-cart-wrap .rw-summary-row,
    .raceworx-cart-wrap .rw-summary-total {
        gap: 12px;
        align-items: flex-start;
    }

    .raceworx-cart-wrap .rw-summary-row {
        flex-wrap: wrap;
    }

    .raceworx-cart-wrap .rw-sr-value,
    .raceworx-cart-wrap .rw-summary-total-value {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .raceworx-cart-wrap .rw-page-header {
        margin-bottom: 18px;
    }

    .raceworx-cart-wrap .rw-cart-item {
        grid-template-columns: 58px minmax(0, auto) minmax(0, 1fr) auto;
        padding: 12px;
        column-gap: 0;
    }

    .raceworx-cart-wrap .rw-item-total {
        font-size: 14px;
        padding-right: 4px;
    }

    .raceworx-cart-wrap .rw-summary-total {
        flex-wrap: wrap;
    }

    .raceworx-cart-wrap .rw-trust-badge {
        flex-basis: 100%;
    }

    .rw-toast {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 12px;
    }
}
