/* Final inventory behavior for catalogue cards and single-product pages. */

/* 0.15.001: show a thin green outline when this product currently has a
 * quantity in the customer's WooCommerce cart. The class is maintained by
 * the existing catalogue-cart-controls script, so this is part of the
 * canonical plugin card styling rather than a second add-on. */
html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product).graham-card-in-cart {
    border-color: #13883f !important;
}

/* 0.15.003: keep the cart state visible without changing card layout. */
html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    > .graham-card-in-cart-badge {
    background: #13883f !important;
    border: 0 !important;
    border-radius: 0 0 5px 5px !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    color: #fff !important;
    display: block !important;
    font: 700 10px/1.2 Arial, sans-serif !important;
    left: 50% !important;
    padding: 4px 7px !important;
    pointer-events: none !important;
    position: absolute !important;
    top: 0 !important;
    transform: translateX(-50%) !important;
    white-space: nowrap !important;
    z-index: 40 !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    > .graham-card-in-cart-badge[hidden] {
    display: none !important;
}

/* 0.15.002: customer purchase history uses the same shared card footer and
 * above-footer panel placement as staff inventory. */
html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    > .graham-card-footer > .graham-product-history:not(.graham-product-history--single) {
    align-self: stretch !important;
    display: block !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    min-width: 0 !important;
    position: static !important;
    width: 100% !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    > .graham-card-footer > .graham-product-history:not(.graham-product-history--single)
    .graham-product-history__toggle {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #526878 !important;
    display: flex !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    height: 30px !important;
    justify-content: center !important;
    margin: 0 !important;
    min-height: 30px !important;
    padding: 0 3px !important;
    width: 100% !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    > .graham-card-footer > .graham-product-history:not(.graham-product-history--single)
    .graham-product-history__toggle .dashicons {
    color: currentColor !important;
    font-size: 15px !important;
    height: 15px !important;
    width: 15px !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    > .graham-card-footer > .graham-product-history:not(.graham-product-history--single)
    .graham-product-history__panel {
    background: #fff !important;
    border: 1px solid #b9ceda !important;
    border-radius: 7px !important;
    bottom: 34px !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    left: 0 !important;
    margin: 0 !important;
    max-height: min(420px, calc(100vh - 32px)) !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: auto !important;
    padding: 8px !important;
    position: absolute !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    z-index: 2147483000 !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product).graham-history-open {
    contain: none !important;
    content-visibility: visible !important;
    overflow: visible !important;
    z-index: 1001 !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product):has(.graham-staff-inventory__panel:not([hidden])) {
    height: auto !important;
    min-height: 404px !important;
    grid-template-rows: 176px 14px 40px 18px 28px 36px 10px auto !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product):has(.graham-staff-inventory__panel:not([hidden]))
    > .graham-card-footer {
    align-items: stretch !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: 30px auto !important;
    height: auto !important;
    min-height: 30px !important;
    overflow: visible !important;
    position: relative !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product):has(.graham-staff-inventory__panel:not([hidden]))
    > .graham-card-footer > .graham-staff-inventory__panel,
html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product):has(.graham-staff-inventory__panel:not([hidden]))
    > .graham-card-footer .graham-staff-inventory__panel {
    background: #fff !important;
    border: 1px solid #b9ceda !important;
    border-radius: 7px !important;
    box-sizing: border-box !important;
    display: block !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    left: auto !important;
    margin: 6px 0 0 !important;
    max-height: 190px !important;
    max-width: 100% !important;
    overflow: auto !important;
    padding: 6px !important;
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    z-index: 2 !important;
}

html body.graham-catalog-view:not(.graham-product-view)
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, ul.products li.product)
    .graham-staff-inventory__panel[hidden] {
    display: none !important;
}

html body.graham-catalog-view .graham-staff-inventory__toggle {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__panel {
    display: block !important;
    max-height: none !important;
    max-width: 100% !important;
    overflow: visible !important;
    position: static !important;
    transform: none !important;
    width: 100% !important;
}

html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__warehouse-details {
    display: block !important;
}

.graham-staff-inventory__warehouse-toggle {
    display: none !important;
}

/* 0.14.078: show warehouse 00 first, with a compact control for the other
 * locations. The same JS state is applied to every open inventory panel. */
.graham-staff-inventory__panel-header {
    align-items: center;
    display: flex;
    height: 18px;
    justify-content: flex-end;
    margin: -3px -3px 2px;
}

.graham-staff-inventory__warehouse-toggle {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 4px !important;
    color: #607888 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    height: 18px !important;
    justify-content: center !important;
    margin: 0 !important;
    min-height: 18px !important;
    padding: 0 2px !important;
    width: 20px !important;
}

.graham-staff-inventory__warehouse-toggle:hover,
.graham-staff-inventory__warehouse-toggle:focus-visible {
    background: #edf6fb !important;
    color: #075b9d !important;
}

.graham-staff-inventory__warehouse-toggle .dashicons {
    font-size: 16px !important;
    height: 16px !important;
    line-height: 16px !important;
    width: 16px !important;
}

.graham-staff-inventory__warehouse.is-additional[hidden] {
    display: none !important;
}

/* 0.14.079: explicitly place the open footer after the purchase row.  The
 * Woo product card leaves row 2 available, so auto-placement can put a newly
 * generated footer before the title even when the panel itself is static. */
html body.graham-catalog-view .graham-card-footer.graham-inventory-footer-open {
    bottom: auto !important;
    display: grid !important;
    grid-column: 1 / -1 !important;
    grid-row: 8 !important;
    height: auto !important;
    left: auto !important;
    min-height: 30px !important;
    overflow: visible !important;
    position: static !important;
    right: auto !important;
    width: 100% !important;
}

html body.graham-catalog-view .graham-inventory-open {
    height: auto !important;
    min-height: 404px !important;
    overflow: visible !important;
}

html body.graham-catalog-view .graham-inventory-open > .graham-card-footer.graham-inventory-footer-open
    > .graham-staff-inventory__panel:not([hidden]),
html body.graham-catalog-view .graham-inventory-open > .graham-card-footer.graham-inventory-footer-open
    .graham-staff-inventory__panel:not([hidden]) {
    bottom: auto !important;
    display: block !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    inset: auto !important;
    left: auto !important;
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
}

/* 0.14.082: compact, card-centered inventory with no clipped/scrolling rows. */
html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__panel:not([hidden]) {
    box-sizing: border-box !important;
    box-shadow: none !important;
    margin-left: var(--graham-inventory-panel-left, 0px) !important;
    margin-right: 0 !important;
    max-height: none !important;
    max-width: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    padding: 4px 6px !important;
    width: var(--graham-inventory-panel-width, 100%) !important;
}

/* 0.15.009: single-product panels must honor the HTML hidden state. The
 * single-product layout rule below intentionally makes an open panel flow
 * normally, but must never force a closed panel to remain visible. */
html body:not(.graham-catalog-view) .graham-staff-inventory__panel[hidden] {
    display: none !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__panel-header {
    height: 0 !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 3 !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__warehouse-toggle {
    position: absolute !important;
    right: -2px !important;
    top: 0 !important;
    height: 16px !important;
    min-height: 16px !important;
    width: 18px !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__warehouses {
    gap: 3px !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__warehouse {
    padding-bottom: 3px !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__warehouse h4 {
    box-sizing: border-box !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    margin-bottom: 2px !important;
    overflow: hidden !important;
    padding-right: 18px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__warehouse dt {
    font-size: 9px !important;
}

html body.graham-catalog-view .graham-inventory-open .graham-staff-inventory__warehouse dd {
    font-size: 10px !important;
}

/* 0.14.085: product-page inventory always shows every warehouse and uses the
 * full product-content width instead of the compact card panel rules. */
html body:not(.graham-catalog-view) .graham-staff-inventory--single {
    box-sizing: border-box !important;
    max-width: none !important;
    width: 100% !important;
}

html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__panel {
    box-shadow: none !important;
    box-sizing: border-box !important;
    display: block !important;
    max-height: none !important;
    max-width: none !important;
    overflow: visible !important;
    padding: 10px !important;
    position: static !important;
    transform: none !important;
    width: 100% !important;
}

html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__panel-header,
html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__warehouse-toggle {
    display: none !important;
}

html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__warehouses {
    gap: 10px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__warehouse {
    min-width: 0 !important;
    overflow: visible !important;
}

/* 0.15.010: the product-page layout intentionally makes an open panel flow
 * in the document, but a closed panel must still obey the HTML hidden state.
 * Keep this override after every product-page display rule above. */
html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__panel[hidden] {
    display: none !important;
}

/* 0.14.077: the open inventory is part of the card flow.  This intentionally
 * does not use :has(): WooCommerce changes the card wrapper between grid and
 * list views, while staff-inventory.js applies .graham-inventory-open to the
 * actual card after it moves the panel into the footer. */
html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-inventory-open {
    contain: none !important;
    content-visibility: visible !important;
    height: auto !important;
    min-height: 404px !important;
    overflow: visible !important;
    grid-template-rows: 176px 14px 40px 18px 28px 36px 10px auto !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-inventory-open
    > .graham-card-footer {
    bottom: auto !important;
    display: grid !important;
    grid-area: 8 / 1 / 9 / -1 !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: 30px auto !important;
    height: auto !important;
    left: auto !important;
    min-height: 30px !important;
    overflow: visible !important;
    position: static !important;
    right: auto !important;
    width: 100% !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-inventory-open
    > .graham-card-footer > .graham-staff-inventory__panel:not([hidden]),
html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-inventory-open
    > .graham-card-footer .graham-staff-inventory__panel:not([hidden]) {
    bottom: auto !important;
    display: block !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    inset: auto !important;
    left: auto !important;
    margin: 6px 0 0 !important;
    max-height: 190px !important;
    max-width: 100% !important;
    overflow: auto !important;
    padding: 6px !important;
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    z-index: 2 !important;
}

/* 0.15.004: customer history follows the same normal-flow expansion as the
 * staff inventory panel. Every history control shares one open state, so the
 * customer's cards expand together instead of covering the purchase row. */
html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-history-open {
    contain: none !important;
    content-visibility: visible !important;
    height: auto !important;
    min-height: 404px !important;
    overflow: visible !important;
    grid-template-rows: 176px 14px 40px 18px 28px 36px 10px auto !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-history-open
    > .graham-card-footer.graham-history-footer-open {
    bottom: auto !important;
    display: grid !important;
    grid-area: 8 / 1 / 9 / -1 !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: 30px auto !important;
    height: auto !important;
    left: auto !important;
    min-height: 30px !important;
    overflow: visible !important;
    position: static !important;
    right: auto !important;
    width: 100% !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-history-open
    > .graham-card-footer.graham-history-footer-open
    > .graham-product-history:not(.graham-product-history--single) {
    display: contents !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-history-open
    > .graham-card-footer.graham-history-footer-open
    > .graham-product-history:not(.graham-product-history--single)
    > .graham-product-history__toggle {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product).graham-history-open
    > .graham-card-footer.graham-history-footer-open
    > .graham-product-history:not(.graham-product-history--single)
    > .graham-product-history__panel:not([hidden]) {
    bottom: auto !important;
    display: block !important;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    inset: auto !important;
    left: auto !important;
    margin: 6px 0 0 !important;
    max-height: none !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding: 6px !important;
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    z-index: 2 !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    .graham-product-history__rows-toggle {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    color: #526878 !important;
    cursor: pointer !important;
    display: flex !important;
    font: 600 10px/1.2 Arial, sans-serif !important;
    gap: 3px !important;
    justify-content: flex-end !important;
    margin: 5px 0 0 auto !important;
    padding: 1px 3px !important;
}

html body.graham-catalog-view.graham-catalog-view
    .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    .graham-product-history__rows-toggle .dashicons {
    font-size: 13px !important;
    height: 13px !important;
    width: 13px !important;
}

/* 0.15.007: available stock is green when positive and red at zero or below. */
html body.graham-catalog-view .graham-staff-inventory__warehouse dd.is-positive,
html body:not(.graham-catalog-view) .graham-staff-inventory__warehouse dd.is-positive {
    color: #13883f !important;
}

html body.graham-catalog-view .graham-staff-inventory__warehouse dd.is-negative,
html body:not(.graham-catalog-view) .graham-staff-inventory__warehouse dd.is-negative {
    color: #b42318 !important;
}

/* 0.15.010: keep a closed product-page panel out of layout. This must be the
 * final rule because the product-page flow rules above use display:block. */
html body:not(.graham-catalog-view) .graham-staff-inventory--single .graham-staff-inventory__panel[hidden] {
    display: none !important;
}

/* 0.15.082: keep the four card actions in one compact footer row. */
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
}

html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer > .graham-product-history,
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer > .graham-staff-inventory {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer > .graham-quote-add,
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer > .graham-quote-list-button {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer .graham-add-list-trigger {
    align-items: center !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #516877 !important;
    display: flex !important;
    font-size: 11px !important;
    grid-column: 3 !important;
    grid-row: 1 !important;
    height: 30px !important;
    justify-content: center !important;
    margin: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 0 3px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    width: 100% !important;
}

html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product):has(.graham-add-list-trigger) > .graham-card-footer .graham-favorite-form {
    grid-column: 4 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
}

/* Company-only assisted orders: give each remaining footer action its own
 * column. The older four-action rule placed Stock and History together. */
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-product-history {
    grid-column: 1 !important;
    grid-row: 1 !important;
}
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-staff-inventory {
    grid-column: 2 !important;
    grid-row: 1 !important;
}
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-quote-add {
    grid-column: 3 !important;
    grid-row: 1 !important;
}
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-quote-list-button,
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-add-list-trigger {
    grid-column: 4 !important;
    grid-row: 1 !important;
}

/* Keep the cart badge centered when Multi Select is active. The selection tag
 * stays at the upper-left, so the two indicators no longer overlap. */
html body.graham-multi-select-active .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-in-cart-badge {
    left: 50% !important;
    top: 0 !important;
    transform: translateX(-50%) !important;
}

/* Final footer placement: flatten the legacy saved-actions wrapper first so
 * every visible action is a real grid item. This prevents Stock and History
 * from falling into the same auto-placed cell during the late card refresh. */
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-product-save-actions-loop {
    display: contents !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-product-history {
    grid-column: 1 !important;
    grid-row: 1 !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-product-save-actions-loop > .graham-product-history {
    grid-column: 1 !important;
    grid-row: 1 !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-staff-inventory {
    grid-column: 2 !important;
    grid-row: 1 !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-quote-add {
    grid-column: 3 !important;
    grid-row: 1 !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-quote-list-button,
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-add-list-trigger {
    grid-column: 4 !important;
    grid-row: 1 !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > *,
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer > .graham-product-save-actions-loop > * {
    min-width: 0 !important;
    overflow: hidden !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-product-history__toggle,
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-staff-inventory__toggle {
    gap: 2px !important;
    overflow: hidden !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-product-history__toggle .dashicons,
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-staff-inventory__toggle .dashicons {
    flex: 0 0 13px !important;
    font-size: 13px !important;
    height: 13px !important;
    width: 13px !important;
}
html body.graham-catalog-view:not(.graham-product-view) .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer .graham-favorite-form {
    grid-column: 5 !important;
    grid-row: 1 !important;
}

/* Company-only assisted ordering has no website user or Favorites list. */
html body.graham-previewing-staged-customer .graham-catalog-main .graham-favorite-form,
html body.graham-impersonating-customer:has(.graham-impersonation-banner--staged) .graham-catalog-main .graham-favorite-form {
    display: none !important;
}

/* Keep the centered In cart badge in the same header position after card
 * selection state is refreshed. */
html body.graham-multi-select-active .graham-card-in-cart-badge {
    left: 50% !important;
    top: 0 !important;
    transform: translateX(-50%) !important;
}
html body.graham-catalog-view .graham-card-bulk-selected > .graham-card-in-cart-badge {
    top: 36px !important;
}
html body.graham-previewing-staged-customer.graham-catalog-view .graham-catalog-main
    :is(li.graham-lightweight-product, li.wc-block-product, li.product, .wc-block-product)
    > .graham-card-footer {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

