/* Keep the existing catalog markup and inquiry-maintenance markers intact. */
body.qiai-brand-card-actions .products-section .product-card {
    --qiai-card-action-color: var(--primary-dark, #1a3a2a);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

body.qiai-brand-card-actions .products-section .product-info {
    display: grid;
    flex: 1;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(min-content, 1fr) auto auto;
    column-gap: 10px;
}

body.qiai-brand-card-actions .products-section .product-info > .product-tag {
    grid-area: 1 / 1 / 2 / -1;
    justify-self: start;
}

body.qiai-brand-card-actions .products-section .product-info > .product-name {
    grid-area: 2 / 1 / 3 / -1;
    min-width: 0;
}

body.qiai-brand-card-actions .products-section .product-info > .product-desc {
    grid-area: 3 / 1 / 4 / -1;
    min-width: 0;
}

/* Flatten only the two presentational footers, preserving their link order. */
body.qiai-brand-card-actions .products-section .product-info > .product-footer {
    display: contents;
}

body.qiai-brand-card-actions .products-section .product-footer > .product-price {
    grid-area: 4 / 1 / 5 / -1;
    min-width: 0;
    padding-top: 14px;
    padding-bottom: 12px;
    border-top: 1px solid #eee;
}

body.qiai-brand-card-actions .products-section .product-footer > .btn-detail {
    grid-area: 5 / 1 / 6 / 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 10px 8px;
    border: 1px solid var(--qiai-card-action-color);
    border-radius: 8px;
    background: #fff;
    color: var(--qiai-card-action-color);
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: none;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

body.qiai-brand-card-actions .products-section .product-footer > .btn-detail[data-product-inquiry] {
    grid-column: 2 / 3;
    background: var(--qiai-card-action-color);
    color: #fff;
}

/* Fuaitang has one existing shop link and no individual inquiry link. */
body.qiai-brand-card-actions .products-section .product-footer:only-of-type > .btn-detail {
    grid-column: 1 / -1;
    background: var(--qiai-card-action-color);
    color: #fff;
}

body.qiai-brand-card-actions .products-section .product-footer > .btn-detail:hover {
    background: #eef4ee;
    color: var(--qiai-card-action-color);
    transform: none;
    box-shadow: none;
}

body.qiai-brand-card-actions .products-section .product-footer > .btn-detail[data-product-inquiry]:hover,
body.qiai-brand-card-actions .products-section .product-footer:only-of-type > .btn-detail:hover {
    background: #4a7a3d;
    border-color: #4a7a3d;
    color: #fff;
}

body.qiai-brand-card-actions .products-section .product-footer > .btn-detail:focus-visible {
    outline: 3px solid var(--qiai-card-action-color);
    outline-offset: 3px;
}

/* Keep the original QR panel available without covering catalog actions. */
body.qiai-brand-card-actions .qiai-brand-wechat {
    position: fixed;
    right: 12px;
    bottom: 168px;
    z-index: 999;
}

body.qiai-brand-card-actions .qiai-brand-wechat > summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 44px;
    border: 1px solid var(--primary-dark, #1a3a2a);
    border-radius: 8px;
    background: var(--primary-dark, #1a3a2a);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    list-style: none;
    cursor: pointer;
}

body.qiai-brand-card-actions .qiai-brand-wechat > summary::-webkit-details-marker {
    display: none;
}

body.qiai-brand-card-actions .qiai-brand-wechat > summary:focus-visible {
    outline: 3px solid var(--primary-dark, #1a3a2a);
    outline-offset: 3px;
}

body.qiai-brand-card-actions .qiai-brand-wechat:not([open]) > .floating-qrcode {
    display: none !important;
}

/* The shared polish sheets pin this panel with important declarations. */
body.qiai-brand-card-actions .qiai-brand-wechat[open] > .floating-qrcode {
    display: block !important;
    position: absolute !important;
    right: 0 !important;
    bottom: 54px !important;
    top: auto !important;
    width: 140px !important;
    max-height: calc(100vh - 238px);
    max-height: calc(100dvh - 238px);
    overflow-y: auto;
    transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
    body.qiai-brand-card-actions .products-section .product-footer > .btn-detail {
        transition: none;
    }
}
