.detail-mobile-bar,
.detail-purchase-bar,
.detail-mobile-title,
.detail-unit-price,
.detail-unit-label,
.detail-wholesale,
.detail-section-heading,
.detail-total {
    display: none;
}

.detail-selection,
.detail-order,
.detail-order-before-quantity {
    display: contents;
}

@media (min-width: 768px) {
    .detail-selection > div,
    .detail-order > div,
    .detail-order-before-quantity > div,
    .detail-order > .tt-ai-page-entry {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .detail-selection > .drawer-shop__quantity-field {
        order: 1;
    }

    .detail-order-before-quantity ~ * {
        order: 2;
    }

    .detail-order-before-quantity > div:has(input[name="no_warranty_confirm"]) .form-label {
        display: block;
        margin-bottom: 13px;
        padding: 16px 18px;
        border: 1px solid #e3e6eb;
        border-radius: 14px;
        background: #fafbfc;
        color: #3f4651;
        font-size: 15px;
        font-weight: 680;
        line-height: 1.65;
    }
}

@media (max-width: 767.98px) {
    body.drawer-shop:has(.detail-mobile-bar) {
        --detail-bg: #f5f6fa;
        --detail-ink: #171923;
        --detail-muted: #6b7280;
        --detail-faint: #9ca3af;
        --detail-accent: #6d5ce8;
        --detail-line: #e5e7eb;
        --detail-success: #16a34a;
        --detail-error: #ef4444;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
        background: var(--detail-bg);
        color: var(--detail-ink);
    }

    body.drawer-shop:has(.detail-mobile-bar) .drawer-shop__header,
    body.drawer-shop:has(.detail-mobile-bar) .tt-mobile-bottom-nav,
    body.drawer-shop:has(.detail-mobile-bar) .tt-customer-service-float,
    .drawer-shop__detail-main .drawer-shop__breadcrumb,
    .detail-overview .detail-desktop-title,
    .detail-overview .drawer-shop__share {
        display: none;
    }

    .drawer-shop__layout--detail {
        padding: 12px;
    }

    .drawer-shop:not(.drawer-shop--drawer-open) .drawer-shop__layout--detail .drawer-shop__drawer {
        visibility: hidden;
        pointer-events: none;
    }

    .detail-mobile-bar {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        align-items: center;
        padding: env(safe-area-inset-top, 0px) max(0px, env(safe-area-inset-right, 0px)) 0 max(0px, env(safe-area-inset-left, 0px));
        background: #fff;
        color: var(--detail-ink);
        text-align: center;
    }

    .detail-mobile-bar strong {
        font-size: 15px;
        font-weight: 650;
    }

    .detail-mobile-bar :is(.detail-back, .shared-button) {
        display: grid;
        width: 44px;
        height: 46px;
        place-items: center;
        padding: 0;
        border: 0;
        background: transparent;
        color: inherit;
    }

    .detail-mobile-bar svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .drawer-shop__detail-main .drawer-shop__detail-card {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .detail-overview,
    .drawer-shop__purchase-form > :is(.detail-selection, .detail-order),
    .drawer-shop__detail-main .drawer-shop__description {
        min-width: 0;
        margin: 0;
        padding: 12px;
        border: 0;
        border-radius: 14px;
        background: #fff;
        box-shadow: none;
    }

    .detail-overview .detail-mobile-title {
        display: block;
        margin: 0;
        color: var(--detail-ink);
        font-size: 20px;
        font-weight: 700;
        line-height: 1.28;
        overflow-wrap: anywhere;
    }

    .detail-subtitle {
        display: block;
        margin-top: 6px;
        color: var(--detail-muted);
        font-size: 14px;
        font-weight: 400;
        line-height: 1.45;
    }

    .detail-subtitle:empty {
        display: none;
    }

    .detail-overview .drawer-shop__badges {
        gap: 6px 12px;
        margin-top: 8px;
    }

    .detail-overview .badge-soft {
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--detail-muted);
        font-size: 12px;
        line-height: 1.5;
    }

    .detail-overview .badge-soft-success:not(.item-stock),
    .detail-overview .snap-up {
        padding: 3px 5px;
        border-radius: 5px;
        background: #e8f6ed;
        color: var(--detail-success);
    }

    .detail-overview .item-stock.badge-soft-danger {
        color: var(--detail-error);
    }

    .detail-overview .snap-up {
        background: #fff1e9;
        color: #ad4c17;
    }

    .detail-overview .drawer-shop__detail-price {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 2px 8px;
        margin: 10px 0 0;
        padding: 0;
        background: transparent;
    }

    .drawer-shop__detail-price:has(.detail-unit-price) > :is(.price, small:not(.detail-unit-label)) {
        display: none;
    }

    .detail-overview .drawer-shop__detail-price > small:not(.detail-unit-label) {
        width: 100%;
        margin: 0;
        color: var(--detail-muted);
        font-size: 12px;
    }

    .detail-overview .drawer-shop__detail-price :is(.detail-unit-price, .price) {
        color: var(--detail-accent);
        font-size: 32px;
        font-weight: 650;
        line-height: 1.2;
        overflow-wrap: anywhere;
        font-variant-numeric: tabular-nums;
    }

    .detail-overview .price .unit {
        color: inherit;
        font-size: .85em;
    }

    .detail-unit-price,
    .detail-overview .detail-unit-label {
        display: inline;
    }

    .detail-overview .drawer-shop__detail-price .detail-unit-label {
        margin: 0;
        color: var(--detail-muted);
        font-size: 13px;
        font-weight: 400;
    }

    .drawer-shop__detail-main .drawer-shop__purchase-form,
    .drawer-shop__purchase-form > :is(.detail-selection, .detail-order) {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .drawer-shop__detail-main .drawer-shop__purchase-form,
    .drawer-shop__detail-main .drawer-shop__description {
        margin-top: 12px;
    }

    .drawer-shop__purchase-form > .detail-order {
        gap: 14px;
    }

    .detail-section-heading {
        display: block;
        margin: 0;
        color: var(--detail-ink);
        font-size: 20px;
        font-weight: 700;
        line-height: 1.35;
    }

    .drawer-shop__purchase-form .form-label {
        margin: 0 0 5px;
        color: var(--detail-ink);
        font-size: 14px;
        font-weight: 550;
        line-height: 1.5;
    }

    .drawer-shop__purchase-form .form-control,
    .drawer-shop__purchase-form .optional-card {
        min-width: 0;
        min-height: 44px;
        max-width: 100%;
        padding: 8px 12px;
        border: 1px solid var(--detail-line);
        border-radius: 9px;
        background: #fff;
        color: var(--detail-ink);
        font-size: 16px;
        line-height: 1.4;
    }

    .drawer-shop__purchase-form .form-control::placeholder {
        color: var(--detail-faint);
        font-size: 14px;
    }

    .drawer-shop__purchase-form .form-control:focus,
    .drawer-shop__purchase-form .qty-group:focus-within {
        border-color: var(--detail-accent);
        outline: 1px solid var(--detail-accent);
        box-shadow: none;
    }

    .drawer-shop__purchase-form .drawer-shop__field-help {
        margin: 4px 0 0;
        color: var(--detail-muted);
        font-size: 12px;
        line-height: 1.5;
    }

    .detail-selection .drawer-shop__quantity-field {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .detail-selection .drawer-shop__quantity-field .form-label {
        margin: 0;
        color: var(--detail-ink);
        font-size: 14px;
        font-weight: 600;
    }

    #detail-quantity-hint {
        margin: 0;
        color: var(--detail-error);
        font-size: 13px;
    }

    .detail-selection .input-group.qty-group {
        display: grid;
        flex: 0 1 122px;
        grid-template-columns: 32px minmax(0, 1fr) 32px;
        gap: 0;
        width: 122px;
        padding: 2px 0;
        border: 1px solid var(--detail-line);
        border-radius: 8px;
        background: #fff;
        box-shadow: none;
    }

    .detail-selection .qty-group > button {
        width: 100%;
        height: 38px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        color: var(--detail-accent);
        font-size: 19px;
        font-weight: 500;
    }

    .detail-selection #detail-quantity {
        width: 100%;
        min-height: 36px;
        margin: 0;
        padding: 0;
        border: 1px solid var(--detail-line);
        border-radius: 999px;
        background: #fff;
        color: var(--detail-ink);
        font-size: 16px;
        font-weight: 450;
        line-height: 1.2;
    }

    .detail-selection .sku {
        gap: 4px;
        max-width: 100%;
        min-height: 36px;
        padding: 5px 10px;
        border: 1px solid var(--detail-line);
        background: #fff;
        box-shadow: none;
        color: var(--detail-ink);
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .detail-selection .sku.is-primary {
        border-color: var(--detail-accent);
        background: #f5f3ff;
        color: #5547cc;
    }

    .detail-selection .sku .badge-money {
        position: static;
        flex-shrink: 0;
        padding: 0;
        border: 0;
        background: none;
        box-shadow: none;
        color: inherit;
        transform: none;
    }

    .detail-wholesale:not([hidden]):has(.detail-tier-list > li) {
        display: block;
    }

    .detail-selection .wholesale-table {
        display: none;
    }

    .detail-wholesale h2 {
        margin: 0 0 12px;
        color: var(--detail-muted);
        font-size: 14px;
        font-weight: 550;
        line-height: 1.5;
    }

    .detail-tier-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .detail-tier-list > li {
        display: grid;
        min-width: 0;
    }

    .detail-tier-list button {
        display: grid;
        min-width: 0;
        align-content: start;
        gap: 4px;
        padding: 12px;
        border: 0;
        border-radius: 8px;
        background: #f6f5fc;
        color: var(--detail-accent);
        font: inherit;
        text-align: start;
        overflow-wrap: anywhere;
        cursor: pointer;
        touch-action: manipulation;
    }

    .detail-tier-list button:active:not(:disabled) {
        background: #eeebff;
    }

    .detail-tier-list > .is-current button,
    .detail-tier-list button[aria-pressed="true"] {
        background: #eeebff;
        box-shadow: inset 0 0 0 1px var(--detail-accent);
    }

    .detail-tier-list button:focus-visible {
        outline: 2px solid var(--detail-accent);
        outline-offset: 2px;
    }

    .detail-tier-list > .is-unavailable button,
    .detail-tier-list button:disabled {
        background: #f6f5fa;
        color: var(--detail-muted);
        cursor: default;
        opacity: 1;
    }

    .detail-tier-caption,
    .detail-tier-price small {
        color: var(--detail-muted);
        font-size: 12px;
        line-height: 1.5;
    }

    .detail-tier-price {
        font-size: 24px;
        font-weight: 650;
        line-height: 1.18;
        font-variant-numeric: tabular-nums;
    }

    .detail-tier-price small {
        margin-left: 3px;
        font-weight: 500;
    }

    .drawer-shop__purchase-form .cash-pay {
        padding: 12px 0 0;
        border: 0;
        border-top: 1px solid var(--detail-line);
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    .detail-order .cash-pay .form-label i {
        width: auto;
        height: auto;
        background: none;
        box-shadow: none;
        color: var(--detail-muted);
    }

    .detail-order .cash-pay > .form-label {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 0 0 8px;
    }

    .detail-order .cash-pay > a.link-primary {
        margin-top: 4px !important;
        padding-block: 10px !important;
        color: var(--detail-accent) !important;
        font-size: 13px;
        line-height: 1.5;
        text-underline-offset: 3px;
    }

    .detail-order .cash-pay .pay-list {
        padding-top: 0;
        border: 0;
    }

    .detail-order .cash-pay .pay {
        min-height: 44px;
        padding: 7px 10px;
        border: 1px solid var(--detail-line);
        border-radius: 8px;
        background: #fff;
        box-shadow: none;
    }

    .detail-order .cash-pay .pay span {
        color: var(--detail-ink);
        font-weight: 550;
    }

    .detail-order .cash-pay .pay:is(.is-primary, .active, .selected) {
        border-color: var(--detail-accent);
        background: #f5f3ff;
        box-shadow: none;
    }

    .detail-order .cash-pay .pay:is(.is-primary, .active, .selected) span {
        color: #5547cc;
    }

    .detail-order fieldset[data-invoice-addon-fields]:not([hidden]) {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 12px;
        border: 1px solid var(--detail-line);
        border-radius: 10px;
    }

    .detail-order .form-check-label {
        color: var(--detail-ink);
        font-size: 14px;
        line-height: 1.5;
    }

    .detail-order label:has(> .form-check-input) {
        display: inline-flex;
        min-height: 40px;
        align-items: center;
        gap: 8px;
        margin: 0;
    }

    .detail-order label > .form-check-input {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        margin: 0;
    }

    .detail-order .form-check-input:checked {
        background-color: var(--detail-accent);
        border-color: var(--detail-accent);
    }

    .detail-order .form-control:user-invalid {
        border-color: var(--detail-error);
    }

    .detail-order .form-control:is([disabled], [readonly]) {
        background: #f7f8fa;
        color: var(--detail-muted);
    }

    .detail-order [data-refresh-invoice] {
        min-height: 40px;
        padding: 4px 0;
        border: 0;
        background: transparent;
        color: var(--detail-accent);
        font-size: 14px;
    }

    .drawer-shop .detail-order .tt-ai-page-entry--product {
        min-height: 44px;
        border: 0;
        background: var(--detail-bg);
        color: var(--detail-ink);
        font-size: 14px;
        font-weight: 550;
    }

    .detail-selection .optional-card,
    .detail-order .pay img,
    .detail-order .tt-ai-page-entry {
        box-shadow: none;
    }

    .detail-purchase-bar {
        position: fixed;
        z-index: 1000;
        inset: auto 0 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 9px max(12px, env(safe-area-inset-right, 0px)) calc(9px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
        border-top: 1px solid var(--detail-line);
        background: #fff;
    }

    .detail-bar-amount {
        display: flex;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        line-height: 1.3;
    }

    .detail-bar-amount small {
        color: var(--detail-muted);
        font-size: 12px;
    }

    .detail-bar-amount strong {
        color: var(--detail-accent);
        font-size: 22px;
        font-weight: 700;
        overflow-wrap: anywhere;
        font-variant-numeric: tabular-nums;
    }

    .detail-purchase-action {
        flex: 0 1 48%;
        min-height: 48px;
        padding: 8px 16px;
        border: 0;
        border-radius: 12px;
        background: var(--detail-accent);
        color: #fff;
        font: inherit;
        font-size: 16px;
        font-weight: 650;
    }

    .detail-purchase-action:disabled {
        background: #eef0f4;
        color: var(--detail-muted);
    }

    body.detail-keyboard-open .detail-purchase-bar {
        display: none;
    }

    .drawer-shop__detail-main .drawer-shop__richtext {
        min-width: 0;
        overflow-x: auto;
    }

    body.drawer-shop:has(.detail-mobile-bar) .tt-activity-float {
        position: relative;
        inset: auto;
        width: calc(100% - 24px);
        margin: 0 auto 12px;
        animation: none;
        transform: none;
    }

    .drawer-shop__detail-main :is(input, select, textarea, button, a) {
        scroll-margin-block: 12px calc(84px + env(safe-area-inset-bottom, 0px));
    }
}
