#gst-chat,
#gst-chat-launch {
    --chat-accent: #8f3518;
    --chat-ink: #2d2520;
    --chat-line: #e5d9cf;
    --chat-soft: #fff7f0;
}

#gst-chat-launch[hidden],
#gst-chat [hidden],
#gst-chat:not([open]) {
    display: none;
}

#gst-chat-launch {
    position: fixed;
    z-index: 840;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(60px, calc(env(safe-area-inset-bottom) + 14px));
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 24px;
    background: var(--chat-accent);
    color: #fff;
    box-shadow: 0 3px 13px #38231c38;
    font-size: 14px;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: none;
}

#gst-chat-launch span {
    position: relative;
    width: 17px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 5px;
}

#gst-chat-launch span::after {
    position: absolute;
    bottom: -4px;
    left: 3px;
    width: 5px;
    height: 5px;
    border: solid currentColor;
    border-width: 0 0 1.5px 1.5px;
    background: var(--chat-accent);
    transform: skewY(-35deg);
    content: "";
}

#gst-chat {
    position: fixed;
    inset: auto max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) auto;
    width: min(400px, calc(100% - 32px));
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--chat-line);
    border-radius: 16px;
    background: #fff;
    color: var(--chat-ink);
    box-shadow: 0 14px 40px #24160f44;
    font-size: 14px;
    line-height: 1.45;
}

#gst-chat::backdrop {
    background: #24170f55;
}

html:has(#gst-chat[open]) {
    overflow: hidden;
}

.gst-chat-panel {
    display: flex;
    flex-direction: column;
    height: min(555px, calc(100dvh - 32px));
    max-height: inherit;
}

.gst-chat-head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 12px 11px 16px;
    background: var(--chat-accent);
    color: #fff;
}

#gst-chat-title {
    margin: 0 0 2px;
    color: inherit;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: 0;
}

.gst-chat-head p,
#gst-chat form,
#gst-chat .gst-chat-intro,
#gst-chat .gst-chat-status,
#gst-chat .gst-chat-consent {
    margin: 0;
}

.gst-chat-head p {
    font-size: 13px;
}

#gst-chat button,
#gst-shop-contact .gst-chat-contact-entry {
    min-height: 44px;
    margin: 0;
    padding: 5px 9px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
}

#gst-chat [data-chat-close] {
    width: 44px;
    padding: 0;
    border: 1px solid #fff6;
    background: transparent;
    color: #fff;
    font-size: 24px;
}

.gst-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#gst-chat .gst-chat-intro {
    margin-bottom: 10px;
    font-weight: 600;
}

.gst-chat-current,
.gst-chat-shortcuts {
    margin-bottom: 10px;
}

.gst-chat-shortcuts,
.gst-chat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#gst-chat .gst-chat-shortcuts button,
#gst-chat .gst-chat-links a,
#gst-chat .gst-chat-contact a,
#gst-chat .gst-chat-contact button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 8px;
    border: 1px solid var(--chat-line);
    border-radius: 8px;
    background: var(--chat-soft);
    color: var(--chat-accent);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.gst-chat-user,
.gst-chat-reply {
    width: fit-content;
    max-width: 100%;
    margin: 7px 0;
    padding: 8px 10px;
    border-radius: 12px;
    overflow-wrap: anywhere;
}

.gst-chat-user {
    margin-left: auto;
    background: var(--chat-accent);
    color: #fff;
}

.gst-chat-reply {
    background: #f7f4f1;
}

.gst-chat-reply .gst-chat-links {
    margin-top: 7px;
}

#gst-chat .gst-chat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px;
    border: 1px solid var(--chat-line);
    border-radius: 8px;
    background: #fff;
    color: var(--chat-ink);
}

.gst-chat-reply .gst-chat-item {
    margin-top: 6px;
}

.gst-chat-item img {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 5px;
    object-fit: cover;
}

.gst-chat-item :is(span, small, b) {
    display: block;
}

.gst-chat-item b {
    color: var(--chat-accent);
}

.gst-chat-foot {
    padding: 9px 10px 10px;
    border-top: 1px solid var(--chat-line);
    background: #fff;
}

.gst-chat-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

#gst-chat input[name=message] {
    min-height: 44px;
    margin: 0;
    padding: 6px 8px;
    border: 1px solid var(--chat-line);
    border-radius: 8px;
    box-shadow: none;
    font-size: 16px;
}

#gst-chat [type=submit],
#gst-chat [data-chat-consult] {
    border: 1px solid var(--chat-accent);
    background: var(--chat-accent);
    color: #fff;
}

#gst-chat .gst-chat-consent {
    margin-bottom: 6px;
    font-size: 12px;
}

#gst-chat .gst-chat-consent a {
    color: var(--chat-accent);
    text-decoration: underline;
}

#gst-chat .gst-chat-status {
    margin: 6px 0;
    font-size: 13px;
}

.gst-chat-status[data-type=success] {
    color: #256047;
    font-weight: 700;
}

.gst-chat-status[data-type=error] {
    color: #9f271b;
}

.gst-chat-contact {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 7px;
}

.gst-chat-contact:has([data-chat-consult][hidden]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#gst-chat [type=submit]:disabled {
    opacity: .65;
}

#gst-shop-contact .gst-chat-contact-entry {
    min-height: 48px;
    padding-inline: 12px;
    border: 1px solid var(--gst-shop-line);
    background: var(--gst-shop-surface);
    color: var(--gst-shop-accent);
    font-weight: 750;
    text-align: left;
}

#gst-chat :is(button, a, input):focus-visible,
#gst-chat-launch:focus-visible {
    outline: 2px solid #b95e32;
    outline-offset: 2px;
}

#gst-chat .gst-chat-head button:focus-visible {
    outline-color: #fff;
    outline-offset: -3px;
}

@media (max-width: 849px) {
    #gst-chat-launch {
        bottom: calc(max(var(--gst-chat-dock, 0px), env(safe-area-inset-bottom)) + 10px);
        right: calc(max(14px, env(safe-area-inset-right)) + 42px);
    }

    #gst-chat {
        inset: auto max(8px, env(safe-area-inset-right)) calc(var(--gst-chat-keyboard, 0px) + max(8px, env(safe-area-inset-bottom))) max(8px, env(safe-area-inset-left));
        width: auto;
    }

    .gst-chat-panel {
        height: min(555px, calc(var(--gst-chat-height, 100dvh) - 16px));
    }
}
