.support-preview-trigger {
    position: fixed;
    right: max(22px, env(safe-area-inset-right));
    bottom: 24px;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 52px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #087f92;
    box-shadow: 0 8px 24px rgba(3, 69, 80, .24);
    color: white;
    font-weight: 750;
    cursor: pointer;
    animation: support-preview-pulse 8s ease-in-out infinite;
}

.support-unread-badge:not([hidden]) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #d82756;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    font-weight: 800;
}

.support-preview-trigger svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.support-preview-trigger:hover,
.support-preview-trigger:focus-visible {
    background: #086b7c;
    animation: none;
}

.support-preview-trigger:focus-visible,
.support-preview-card button:focus-visible {
    outline: 3px solid #f5b73b;
    outline-offset: 3px;
}

@keyframes support-preview-pulse {
    0%, 8%, 16%, 100% { transform: scale(1); }
    12% { transform: scale(1.055); }
}

.support-preview-dialog {
    width: min(420px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 0;
    border: 1px solid #d7e7ea;
    border-radius: 20px;
    color: #193642;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .25);
}

.support-preview-dialog::backdrop {
    background: rgba(15, 35, 45, .42);
}

.support-preview-card {
    padding: 23px;
}

.support-preview-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.support-preview-card small {
    color: #087f92;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.support-preview-card h2 {
    margin: 6px 0 0;
    font-size: 23px;
}

.support-preview-card header button {
    width: 35px;
    height: 35px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: #eef5f6;
    color: #193642;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.support-preview-card p {
    margin: 20px 0;
    line-height: 1.5;
}

.support-preview-login {
    display: block;
    padding: 13px 18px;
    border-radius: 12px;
    background: #087f92;
    color: #fff;
    font-weight: 750;
    text-align: center;
    text-decoration: none;
}

.support-preview-login:hover,
.support-preview-login:focus-visible {
    background: #086b7c;
    color: #fff;
}

.support-preview-dialog.is-guest {
    width: min(420px, calc(100vw - 24px));
    height: auto;
}

.support-preview-dialog.is-guest .support-preview-card {
    height: auto;
}

.support-preview-guest-content {
    padding: 22px 24px 24px;
}

.support-preview-guest-content p {
    margin: 0 0 18px;
}

.support-preview-form {
    display: grid;
    gap: 9px;
}

.support-preview-form label {
    font-weight: 750;
}

.support-preview-guest-fields {
    display: grid;
    gap: 7px;
}

.support-preview-guest-fields input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d7e7ea;
    border-radius: 12px;
    background: #fff;
    color: #193642;
    font-size: 16px;
}

.support-preview-guest-note {
    color: #607a82 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.support-preview-hp {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.support-preview-form textarea {
    width: 100%;
    min-height: 105px;
    padding: 12px;
    border: 1px solid #d7e7ea;
    border-radius: 12px;
    background: #fff;
    color: #193642;
    resize: vertical;
}

.support-preview-form textarea:focus-visible {
    outline: 3px solid #b6e7ed;
    border-color: #087f92;
}

.support-preview-form button {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    background: #087f92;
    color: #fff;
    font-weight: 750;
    cursor: pointer;
}

.support-preview-form button:disabled {
    opacity: .6;
    cursor: wait;
}

.support-preview-card .support-preview-status {
    min-height: 1.5em;
    margin: 2px 0 0;
    font-size: 13px;
}

.support-preview-card .support-preview-status:empty {
    display: none;
}

.support-preview-history {
    display: grid;
    gap: 9px;
    max-height: min(34vh, 260px);
    overflow-y: auto;
    margin: 0 0 18px;
}

.support-preview-history:empty {
    display: none;
}

.support-preview-thread {
    padding: 11px 13px;
    border: 1px solid #d7e7ea;
    border-radius: 13px;
    background: #f5f9fa;
}

.support-preview-thread strong {
    color: #087f92;
}

.support-preview-thread small {
    display: block;
    margin-top: 4px;
    color: #607a82;
}

.support-preview-thread p {
    margin: 9px 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.support-preview-thread .support-preview-answer {
    padding-left: 10px;
    border-left: 3px solid #087f92;
}

.support-preview-thread p b {
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    color: #607a82;
}

.support-preview-page {
    max-width: 760px;
    padding: 22px;
    border: 1px solid #d7e7ea;
    border-radius: 18px;
    background: #fff;
}

.support-preview-page .support-preview-history {
    display: block;
    max-height: none;
    overflow: visible;
}

.support-preview-page .support-preview-thread {
    border: 0;
    background: transparent;
    padding: 0;
}

.support-preview-page .support-preview-thread strong {
    display: none;
}

.support-preview-page .support-preview-thread p {
    width: fit-content;
    max-width: 85%;
    padding: 10px 13px;
    border: 0;
    border-radius: 13px;
    background: #eef5f6;
}

.support-preview-page .support-preview-thread .support-preview-customer {
    margin-left: auto;
    background: #e1f3f5;
}

.support-preview-page .support-preview-thread .support-preview-answer {
    background: #f2f5f7;
}

@media (max-width: 720px) {
    .support-preview-trigger {
        right: max(14px, env(safe-area-inset-right));
        bottom: calc(94px + env(safe-area-inset-bottom));
        justify-content: center;
        gap: 0;
        width: 50px;
        min-width: 50px;
        height: 50px;
        min-height: 50px;
        padding: 0;
    }

    .support-preview-trigger > span:first-of-type {
        display: none;
    }

    .support-preview-trigger .support-unread-badge:not([hidden]) {
        position: absolute;
        top: -5px;
        right: -5px;
    }

    .product-flow .support-preview-trigger,
    .cart-flow .support-preview-trigger {
        bottom: calc(158px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-preview-trigger { animation: none; }
}

/* Shared messenger layout for the floating window and account page. */
.support-preview-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.support-preview-dialog {
    width: min(460px, calc(100vw - 20px));
    height: min(640px, calc(100dvh - 28px));
    max-height: calc(100dvh - 28px);
    overflow: hidden;
}

.support-preview-card,
.support-preview-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.support-preview-card {
    height: 100%;
    padding: 0;
}

.support-preview-card header {
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e0e9eb;
}

.support-preview-card h2 {
    margin-top: 2px;
    font-size: 20px;
}

.support-preview-history,
.support-preview-page .support-preview-history {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 9px;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    margin: 0;
    padding: 16px;
    background: #f5f8f9;
    overscroll-behavior: contain;
}

.support-preview-card .support-preview-empty,
.support-preview-page .support-preview-empty {
    align-self: center;
    margin: auto 8px;
    color: #607a82;
    text-align: center;
    font-size: 14px;
}

.support-preview-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.support-preview-message.is-customer {
    align-items: flex-end;
}

.support-preview-bubble {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-width: 86%;
    padding: 9px 12px 7px;
    border: 1px solid #e0e9eb;
    border-radius: 13px 13px 13px 4px;
    background: #fff;
    color: #193642;
    box-shadow: 0 1px 2px rgba(15, 50, 58, .04);
}

.is-customer .support-preview-bubble {
    border-color: #cce9e9;
    border-radius: 13px 13px 4px 13px;
    background: #e1f4f3;
}

.support-preview-author {
    color: #087f92;
    font-size: 11px;
    font-weight: 750;
}

.support-preview-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.4;
    font-size: 14px;
}

.support-preview-time {
    color: #69818a;
    font-size: 11px;
}

.support-preview-meta {
    display: flex;
    align-self: flex-end;
    align-items: center;
    gap: 5px;
}

.support-preview-checks {
    color: #69818a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -3px;
    padding-right: 3px;
}

.support-preview-checks.is-answered {
    color: #087f92;
}

.support-preview-checks.is-failed {
    color: #b34436;
}

.support-preview-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e0e9eb;
    background: #fff;
}

.support-preview-form textarea {
    min-height: 42px;
    max-height: 132px;
    padding: 9px 12px;
    border-radius: 17px;
    line-height: 22px;
    resize: none;
    overflow-y: auto;
}

.support-preview-form button {
    width: 44px;
    height: 42px;
    min-height: 42px;
    border-radius: 14px;
    font-size: 20px;
    line-height: 1;
}

.support-preview-card .support-preview-status,
.support-preview-page .support-preview-status {
    grid-column: 1 / -1;
    min-height: 0;
    margin: 0;
    color: #b34436;
    font-size: 12px;
}

.support-preview-status:empty {
    display: none;
}

.support-preview-page {
    height: min(680px, 70dvh);
    max-width: 800px;
    padding: 0;
    overflow: hidden;
}

.support-preview-page .support-preview-history {
    min-height: 200px;
}

@media (max-width: 720px) {
    .support-preview-dialog {
        width: calc(100vw - 16px);
        height: min(680px, calc(100dvh - 20px));
    }

    .support-preview-dialog.is-guest {
        width: min(420px, calc(100vw - 24px));
        height: auto;
    }

    .mobile-bottom-nav::after,
    .storefront .mobile-bottom-nav::after {
        display: block !important;
        position: absolute;
        top: 100%;
        bottom: auto;
        left: 0;
        right: 0;
        height: 220px;
        background: #fff;
        pointer-events: none;
    }

    .support-preview-page {
        height: min(640px, 65dvh);
    }
}
