/* ============================================
   AGROMAN WEBSITE CHAT (salesagent/WEB_CHAT.md)
   templates/includes/chat_widget.html and static/js/chat.js. Only when the
   chat is on, and never linked in the head (improvement plan, step 4.8):
   base.html preloads it, chat.js adds it and shows the widget once it has
   loaded, so it holds back no page's first paint. Only the widget's own
   rules belong here: the two that shape the page itself (the footer's room
   for the button, k-chat-locked) are in layout.css, under html.k-chat-on,
   so they hold from the first paint. The chat button and the greeting
   bubble sit bottom right; the panel is a full-screen sheet on phones
   (modal while it is open, chat.js: step 4.6), a 440 × 700 px dialog from
   768 px and 480 × 780 px from 1400 px (see the media rules at the end).
   Arthur, 2026-10-21: the button must be
   big and plain to see on light and dark sections alike, so it has a white
   ring and, from 768 px, its words. 2026-10-27: AgroMan's face on the
   button, the bubble, the header and beside each of its messages.
   ============================================ */

.k-chat[hidden],
.k-chat [hidden] {
    display: none !important;
}

/* The button's size and its distance from the window's edges (--k-chat-button, --k-chat-edge) are the page's own
   sizes (layout.css, html.k-chat-on): the page keeps room for the button. At the right edge the button keeps clear
   of the notch of a phone held sideways (--k-chat-right; templates/base.html, viewport-fit=cover), and with no bar
   shown it stands above an iPhone's home bar (--k-chat-lift, the safe area's foot); both are 0 elsewhere */
.k-chat {
    --k-chat-lift: env(safe-area-inset-bottom, 0px);
    --k-chat-right: max(var(--k-chat-edge), env(safe-area-inset-right, 0px));
}

/* Clear of the product page's phone bar and the leasing summary bar while they show, by each bar's own height (the
   page's sizes, layout.css: the leasing bar's words take one line or three on a phone, and at 72 px the button
   stood over a taller bar) */
@media (max-width: 991.98px) {
    body:has(.k-pbar.is-shown) .k-chat {
        --k-chat-lift: calc(var(--k-pbar) + env(safe-area-inset-bottom));
    }

    body:has(.k-lbar.is-shown) .k-chat {
        --k-chat-lift: calc(var(--k-lbar) + env(safe-area-inset-bottom));
    }
}

.k-chat__button {
    position: fixed;
    right: var(--k-chat-right);
    bottom: calc(var(--k-chat-edge) + var(--k-chat-lift));
    z-index: 1035;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: var(--k-chat-button);
    height: var(--k-chat-button);
    padding: 0;
    border: 3px solid var(--k-surface);
    border-radius: 999px;
    background: var(--k-green);
    color: var(--k-white);
    box-shadow: 0 10px 28px rgba(15, 26, 46, 0.35);
    line-height: 1;
}

/* AgroMan's face (static/img/agroman/): a circle wherever it shows, decorative next to AgroMan's name or words */
.k-chat__face {
    display: block;
    flex: none;
}

.k-chat__face img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* On the button it fills the circle inside the white ring; from 768 px, the round end of the pill */
.k-chat__button .k-chat__face {
    width: calc(var(--k-chat-button) - 6px);
    height: calc(var(--k-chat-button) - 6px);
}

/* Phones: the face alone, the words for screen readers */
.k-chat__button-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Hover is for a mouse (static/css/README.md, "States"; step 4.6): on a touch screen it stayed on after the tap. A
   control whose hover was its pressed look takes that look on :active too */
@media (hover: hover) and (pointer: fine) {
    .k-chat__button:hover {
        background: var(--k-green-dark);
    }
}

.k-chat__button:active {
    background: var(--k-green-press);
}

.k-chat.is-open .k-chat__button {
    display: none;
}


/* Greeting bubble (phones; from 768 px the panel itself opens): beside the button, in its row, three lines at the
   page's own spacing (qa/tools/chat_flows.js measures them at 360 px), so it never covers the page; from 768 px,
   should it show: above the button */
.k-chat__bubble {
    position: fixed;
    right: calc(var(--k-chat-right) + var(--k-chat-button) + 10px);
    bottom: calc(var(--k-chat-edge) + var(--k-chat-lift));
    z-index: 1035;
    display: flex;
    align-items: center;
    width: max-content;
    max-width: min(300px, calc(100vw - 2 * var(--k-chat-edge) - var(--k-chat-button) - 10px));
    min-height: var(--k-chat-button);
    border: 1px solid var(--k-line);
    border-radius: var(--k-radius-card);
    background: var(--k-surface);
    box-shadow: var(--k-shadow-dialog);
}

.k-chat__bubble::after {
    content: "";
    position: absolute;
    top: calc(50% - 6px);
    right: -7px;
    width: 12px;
    height: 12px;
    border-top: 1px solid var(--k-line);
    border-right: 1px solid var(--k-line);
    background: var(--k-surface);
    transform: rotate(45deg);
}

.k-chat__bubble-text {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 2px 8px 10px;
    border: 0;
    border-radius: var(--k-radius-card) 0 0 var(--k-radius-card);
    background: none;
    color: var(--k-text-strong);
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
}

/* AgroMan's face before the words; under 360 px the words keep the room, and in Armenian, whose greeting is longer,
   under 375 px: beside the face (and the phone's 44 px close) it takes a fourth line at 373 px and narrower, three
   from 374 px (Chrome, 2026-11-22: its words need 172 px), and the clamp of three lines hid that line until step 4.6.
   375, a pixel of margin for a phone's own rendering of the letters */
.k-chat__bubble .k-chat__face {
    width: 28px;
    height: 28px;
}

@media (max-width: 359.98px) {
    .k-chat__bubble .k-chat__face {
        display: none;
    }
}

@media (max-width: 374.98px) {
    :lang(hy) .k-chat__bubble .k-chat__face {
        display: none;
    }
}

/* No clamp on the words (step 4.6): with a visitor's own text spacing (WCAG 1.4.12: line height 1.5, wider letters
   and words) the Armenian greeting takes a fourth line at 375 px, which a clamp of three cut off */
.k-chat__bubble-words {
    min-width: 0;
}

.k-chat__bubble-close {
    flex: none;
    width: 40px;
    height: 40px;
    margin: 0 2px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--k-text-muted);
    font-size: 14px;
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__bubble-close:hover {
        background: var(--k-surface-2);
        color: var(--k-text-strong);
    }
}

.k-chat__bubble-close:active {
    background: var(--k-surface-2);
    color: var(--k-text-strong);
}


/* Panel: a full-screen sheet on phones */
.k-chat__panel {
    position: fixed;
    inset: 0;
    z-index: 1036;
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    background: var(--k-surface);
}

.k-chat__head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 8px 14px 16px;
    background: var(--k-band);
    color: var(--k-on-night);
}

.k-chat__head .k-chat__face {
    width: 40px;
    height: 40px;
    margin-right: 4px;
}

.k-chat__title {
    margin: 0;
    color: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.k-chat__note {
    margin: 4px 0 0;
    color: var(--k-on-night-2);
    font-size: 14px;
    line-height: 1.4;
}

.k-chat__close {
    flex: none;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--k-on-night);
    font-size: 18px;
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__close:hover {
        background: var(--k-on-night-edge);
    }
}

.k-chat__close:active {
    background: var(--k-on-night-edge);
}

/* The one scroll area between the header and the message box: the conversation and what follows it */
.k-chat__body {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* The conversation takes the keyboard's focus, so that arrow keys scroll it (step 4.6). Its own ring stood around
   all of it, mostly out of view: a short chat showed a 3 px line at its foot, a scrolled one none. The ring is drawn
   instead around what the scroll area shows, inside its edges and over the messages, wherever it is scrolled, and
   moves nothing: a layer as tall as the scroll area (100cqh, its own height), which stays at its top. The house's
   ring (base.css): Harvest outside, the inner line inside; in forced colours the outline alone, as everywhere */
@supports (height: 1cqh) and selector(:has(*)) {
    .k-chat__body {
        container-type: size;
    }

    .k-chat__body::before {
        content: "";
        position: sticky;
        top: 0;
        z-index: 1;
        flex: none;
        height: 100cqh;
        margin-bottom: -100cqh;
        pointer-events: none;
    }

    .k-chat__body:has(> .k-chat__log:focus-visible)::before {
        outline: 3px solid var(--k-harvest);
        outline-offset: -3px;
        box-shadow: inset 0 0 0 5px var(--k-focus-inner);
    }

    .k-chat__log:focus-visible {
        outline: none;
        box-shadow: none;
    }
}

.k-chat__log {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.k-chat__msg {
    max-width: 85%;
    padding: 9px 12px;
    border-radius: var(--k-radius-card);
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* AgroMan: its face in the bubble's left margin, by the bubble's last line (the colleague's and the visitor's
   messages have none) */
.k-chat__msg--agent {
    position: relative;
    align-self: flex-start;
    max-width: calc(92% - 36px);
    margin-left: 36px;
    border-bottom-left-radius: var(--k-radius-badge);
    background: var(--k-surface-2);
    color: var(--k-text-strong);
}

.k-chat__msg .k-chat__face {
    position: absolute;
    bottom: 0;
    left: -36px;
    width: 28px;
    height: 28px;
}

.k-chat__msg--buyer {
    align-self: flex-end;
    border-bottom-right-radius: var(--k-radius-badge);
    background: var(--k-green);
    color: var(--k-white);
}

/* A Kultiva colleague, answering from the Telegram staff group: named, and framed unlike AgroMan */
.k-chat__msg--staff {
    align-self: flex-start;
    border: 1px solid var(--k-green);
    border-bottom-left-radius: var(--k-radius-badge);
    background: var(--k-surface);
    color: var(--k-text-strong);
}

.k-chat__who {
    display: block;
    margin-bottom: 2px;
    color: var(--k-text-green-strong);
    font-size: 14px;
    font-weight: 700;
    white-space: normal;
}

.k-chat__msg a {
    color: inherit;
    text-decoration: underline;
}

.k-chat__msg--agent a,
.k-chat__msg--staff a {
    color: var(--k-text-green-strong);
}

/* The WhatsApp channel invite after the welcome: a button under the words, in WhatsApp's green as in the footer,
   its words on one line from 360 px in both languages */
.k-chat__msg .k-chat__join {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--k-radius-button);
    background: var(--k-whatsapp);
    color: var(--k-night);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    white-space: normal;
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__msg .k-chat__join:hover {
        background: var(--k-whatsapp-hover);
        color: var(--k-night);
    }
}

.k-chat__msg .k-chat__join:active {
    background: var(--k-whatsapp-hover);
    color: var(--k-night);
}

/* AgroMan's Telegram bot: the same button in Telegram's blue */
.k-chat__msg .k-chat__join--telegram {
    background: var(--k-telegram);
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__msg .k-chat__join--telegram:hover {
        background: var(--k-telegram-hover);
    }
}

.k-chat__msg .k-chat__join--telegram:active {
    background: var(--k-telegram-hover);
}

.k-chat__join .bi {
    font-size: 18px;
    line-height: 1;
}

/* Two invites in one bubble (2026-11-11): their buttons side by side. The bubble may be as wide as the chat, so
   that both fit on a 360 px phone. "Telegram" is one word and keeps its width; the other button takes the rest of
   the row, and its words go onto two lines where even that is too narrow */
.k-chat__msg--agent.k-chat__msg--pair {
    max-width: calc(100% - 36px);  /* all of the row beside AgroMan's face */
}

.k-chat__joins {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.k-chat__msg .k-chat__joins .k-chat__join {
    flex: 1 1 0;
    min-width: 0;
    margin-top: 0;
    padding-inline: 8px;
}

.k-chat__msg .k-chat__joins .k-chat__join--telegram {
    flex: 0 0 auto;
}

/* From 768 px the chat is a window of 440 px or more: room for two buttons of the same width */
@media (min-width: 768px) {
    .k-chat__msg .k-chat__joins .k-chat__join--telegram {
        flex: 1 1 0;
    }
}

/* A message on its way (is-pending) looks like any other (step 4.6): faded to 70 %, its white words on the green
   read 2.97:1. "AgroMan is typing…" under it shows that it is on its way; a failed one goes, with the alert */

.k-chat__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0 16px 10px;
    color: var(--k-text-muted);
    font-size: 14px;
}

.k-chat__dots {
    display: inline-flex;
    gap: 4px;
}

.k-chat__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--k-field);
}

/* Quick replies under the welcome, until the visitor's first message */
.k-chat__starters {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}

.k-chat__starter {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--k-green);
    border-radius: 999px;
    background: var(--k-surface);
    color: var(--k-text-green-strong);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__starter:hover {
        background: var(--k-success-bg);
    }
}

.k-chat__starter:active {
    background: var(--k-success-bg);
}

.k-chat__alert {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin: 0 16px 10px;
    padding: 9px 12px;
    border-radius: var(--k-radius-control);
    background: var(--k-danger-bg);
    color: var(--k-danger);
    font-size: 14px;
    line-height: 1.4;
}

.k-chat__alert.is-limit {
    background: var(--k-warning-bg);
    color: var(--k-warning);
}

.k-chat__retry {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
}

/* Keeps its colour under the pointer (Bootstrap's link hover would change it): the one hover outside the gate */
.k-chat__retry:hover {
    color: inherit;
}

.k-chat__done {
    margin: 0 16px 10px;
    padding: 9px 12px;
    border-radius: var(--k-radius-control);
    background: var(--k-success-bg);
    color: var(--k-success);
    font-size: 14px;
    line-height: 1.4;
}


/* Telegram: in the footer while it is on, except after a hand-over (the request form is the way on then) */
.k-chat__foot {
    display: flex;
    flex: none;
    justify-content: center;
    padding: 0 12px max(8px, env(safe-area-inset-bottom));
    background: var(--k-surface);
}

.k-chat__tg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    font-weight: 700;
    min-height: 36px;
    padding: 4px 8px;
    background: none;
    color: var(--k-text-navy);
    font-size: 14px;
    text-decoration: underline;
}

.k-chat__linked {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    margin: 0;
    color: var(--k-text-muted);
    font-size: 14px;
}


/* Hand-over: the visitor's contact, with the request form's checks: a card at the end of the conversation,
   scrolling with it (never a second scroll box) */
.k-chat__contact {
    position: relative;
    display: grid;
    flex: none;
    gap: 12px;
    margin: 0 16px 16px;
    padding: 14px 14px 16px;
    border: 1px solid var(--k-line);
    border-radius: var(--k-radius-card);
    background: var(--k-surface);
    box-shadow: var(--k-shadow-raised);
}

/* Its room for the close button is a margin: the title takes the focus when the form appears (step 4.6), and its ring
   stops beside the button instead of around it */
.k-chat__contact-title {
    margin: 0 36px 0 0;
    color: var(--k-text-strong);
    font-weight: 700;
    line-height: 1.4;
}

/* Closing the form keeps the chat with AgroMan: a close button in its corner and a plain one under "Send" */
.k-chat__contact-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--k-text-muted);
    font-size: 16px;
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__contact-close:hover {
        background: var(--k-surface-2);
        color: var(--k-text-strong);
    }
}

.k-chat__contact-close:active {
    background: var(--k-surface-2);
    color: var(--k-text-strong);
}

.k-chat__contact-keep {
    justify-self: center;
    min-height: 40px;
    padding: 4px 8px;
    border: 0;
    background: none;
    color: var(--k-text-navy);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
}

.k-chat__field {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.k-chat__field > label,
.k-chat__field > legend {
    display: block;
    margin-bottom: 6px;
    color: var(--k-text-strong);
    font-size: 14px;
    font-weight: 600;
}

.k-chat__field .k-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.k-chat__field .k-choice {
    min-height: var(--k-control);
    font-size: 14px;
}

.k-chat__field > .k-chat__consent {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0;
    color: var(--k-text);
    font-weight: 400;
    line-height: 1.4;
}

.k-chat__consent input {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--k-green);
}

.k-chat__error {
    margin: 6px 0 0;
    color: var(--k-danger);
    font-size: 14px;
}


/* The message box: Enter sends, Shift+Enter starts a line */
.k-chat__form {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 4px 8px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--k-line);
    background: var(--k-surface);
}

.k-chat__count {
    flex-basis: 100%;
    color: var(--k-text-muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* The box's line and its words to be show it as the other fields do (.form-control, components.css; step 4.6): the
   field's line, 3:1 and more on the page in both looks (the chip's line it had was 1.64:1), on the page's own
   surface (the dark preview's box was Chrome's grey), and the muted text for the words to be, 4.5:1 and more on the
   box (Chrome's own grey read 2.43:1 on the dark box). Disabled: set back; focused: the green line */
.k-chat__text {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    max-height: 140px;
    padding: 10px 12px;
    border: 1px solid var(--k-field);
    border-radius: var(--k-radius-control);
    background: var(--k-surface);
    color: var(--k-text-strong);
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    resize: none;
    field-sizing: content;
}

.k-chat__text::placeholder {
    color: var(--k-text-muted);
    opacity: 1;
}

.k-chat__text:focus {
    border-color: var(--k-green);
}

.k-chat__text:disabled {
    background: var(--k-surface-2);
}

.k-chat__send {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--k-green);
    color: var(--k-white);
    font-size: 18px;
}

@media (hover: hover) and (pointer: fine) {
    .k-chat__send:hover {
        background: var(--k-green-dark);
    }
}

.k-chat__send:active {
    background: var(--k-green-dark);
}

/* Send disabled: nothing more can be sent (the daily limit). Grey under the pointer and pressed too (it comes last) */
.k-chat__send:disabled {
    background: var(--k-chip-line);
}

/* A button whose request is on its way is busy, not disabled (static/css/README.md, "Disabled and busy differ"; step
   4.6): its own colour at 70 %, the progress pointer, and a mouse's press passes through. It keeps the focus and its
   place (aria-busy with aria-disabled, chat.js). Send, the form's close and "Not now", "Continue in Telegram"; the
   form's own Send is a .k-btn, which components.css draws busy */
.k-chat__send[aria-busy="true"],
.k-chat__contact-close[aria-busy="true"],
.k-chat__contact-keep[aria-busy="true"],
.k-chat__tg[aria-busy="true"] {
    opacity: 0.7;
    cursor: progress;
    pointer-events: none;
}


/* Phones: every control of the chat answers a thumb, 44 × 44 at least (static/css/README.md, "Controls"; step 4.6):
   the quick replies, the bubble's and the form's close buttons, "Not now", "Continue in Telegram", the form's fields
   and the consent's row. "Try again" and "Send a request" stand in the alert's line, which keeps its height: their
   area grows around their words instead (as the card's "Ask for a price", components.css). From 768 px nothing
   changes */
@media (max-width: 767.98px) {
    .k-chat__starter,
    .k-chat__contact-keep,
    .k-chat__tg,
    .k-chat__contact .form-control,
    .k-chat__field > .k-chat__consent {
        min-height: var(--k-control);
    }

    .k-chat__bubble-close,
    .k-chat__contact-close {
        width: var(--k-control);
        height: var(--k-control);
    }

    .k-chat__retry {
        position: relative;
    }

    .k-chat__retry::after {
        content: "";
        position: absolute;
        inset: -12px -8px;
    }
}

/* Forced colours (Windows' high contrast) draw no backgrounds: a line keeps each message's shape (step 4.6) */
@media (forced-colors: active) {
    .k-chat__msg {
        border: 1px solid;
    }
}


/* From 768 px: the button with its words, and a dialog bottom right, over the page: 440 × 700 px (Arthur,
   2026-10-23: bigger than the first 380 × 560), 480 × 780 px on wide screens, never taller than the window */
@media (min-width: 768px) {
    .k-chat {
        --k-chat-edge: 24px;
    }

    .k-chat__button {
        width: auto;
        padding: 0 24px 0 0;
        gap: 12px;
    }

    .k-chat__button-label {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        font-size: 17px;
        font-weight: 700;
    }

    .k-chat__bubble {
        right: var(--k-chat-right);
        bottom: calc(var(--k-chat-edge) + var(--k-chat-lift) + var(--k-chat-button) + 12px);
        align-items: flex-start;
        max-width: 300px;
        min-height: 0;
    }

    .k-chat__bubble::after {
        top: auto;
        right: 22px;
        bottom: -7px;
        border-top: 0;
        border-bottom: 1px solid var(--k-line);
    }

    .k-chat__bubble-text {
        padding: 12px 4px 12px 14px;
        font-size: 15px;
    }

    .k-chat__bubble-close {
        margin-top: 2px;
    }

    .k-chat__panel {
        inset: auto var(--k-chat-right) calc(var(--k-chat-edge) + var(--k-chat-lift)) auto;
        width: min(440px, calc(100vw - 2 * var(--k-chat-edge)));
        height: min(700px, calc(100vh - 2 * var(--k-chat-edge) - var(--k-chat-lift)));
        border: 1px solid var(--k-line);
        border-radius: var(--k-radius-dialog);
        box-shadow: var(--k-shadow-dialog);
        overflow: hidden;
    }
}

@media (min-width: 1400px) {
    .k-chat__panel {
        width: 480px;
        height: min(780px, calc(100vh - 2 * var(--k-chat-edge) - var(--k-chat-lift)));
    }
}

@media (prefers-reduced-motion: no-preference) {
    .k-chat__button,
    .k-chat__bubble {
        transition: bottom var(--k-base) var(--k-ease);
    }

    /* The greeting slides in, AgroMan's welcome and invite rise into the chat, and the button pulses twice after the
       page loads: 4.8 s, under the five seconds after which moving content needs a way to stop it (WCAG 2.2.2;
       three pulses ran 7.2 s until step 4.6) */
    .k-chat__panel,
    .k-chat__bubble,
    .k-chat__msg--welcome,
    .k-chat__msg--invite {
        animation: k-chat-in var(--k-slow) var(--k-ease);
    }

    .k-chat__button::before {
        content: "";
        position: absolute;
        inset: -3px;
        border-radius: inherit;
        animation: k-chat-pulse 2.4s ease-out 1s 2;
        pointer-events: none;
    }

    .k-chat__dots span {
        animation: k-chat-dot 1.2s infinite ease-in-out;
    }

    .k-chat__dots span:nth-child(2) {
        animation-delay: 0.15s;
    }

    .k-chat__dots span:nth-child(3) {
        animation-delay: 0.3s;
    }
}

@keyframes k-chat-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@keyframes k-chat-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(47, 122, 59, 0.55);
    }

    80%,
    100% {
        box-shadow: 0 0 0 18px rgba(47, 122, 59, 0);
    }
}

@keyframes k-chat-dot {
    0%,
    80%,
    100% {
        opacity: 0.3;
    }

    40% {
        opacity: 1;
    }
}
