.soffit-chat {
    --soffit-chat-primary: #2563eb;
    --soffit-chat-accent: #f59e0b;
    width: min(100%, 680px);
    margin-inline: auto;
    overflow: hidden;
    color: #202833;
    background: #fff;
    border: 1px solid #e2e6eb;
    box-shadow: 0 10px 30px rgba(19, 33, 48, .08);
}

.soffit-chat [hidden] { display: none !important; }
.soffit-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    color: #fff;
    background: var(--soffit-chat-primary);
    border-bottom: 3px solid var(--soffit-chat-accent);
}
.soffit-chat__mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--soffit-chat-primary);
    background: #fff;
    font-weight: 700;
}
.soffit-chat__header > div { display: grid; gap: 1px; line-height: 1.2; }
.soffit-chat__header > div span { font-size: .78rem; color: rgba(255, 255, 255, .86); }
.soffit-chat .soffit-chat__back { display: inline-flex; align-items: center; align-self: flex-start; gap: 5px; padding: 5px 0; border: 0; color: var(--soffit-chat-primary); background: transparent; font: inherit; font-size: .88rem; text-transform: none; cursor: pointer; }
.soffit-chat .soffit-chat__back:hover { color: var(--soffit-chat-primary); text-decoration: underline; text-underline-offset: 3px; }
.soffit-chat__back svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.soffit-chat__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 240px;
    max-height: 420px;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f6f8fa;
}
.soffit-chat__bubble {
    width: fit-content;
    max-width: min(92%, 480px);
    padding: 10px 14px;
    border-radius: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.soffit-chat__bubble--bot { align-self: flex-start; border-bottom-left-radius: 4px; background: #fff; }
.soffit-chat__bubble--answer { align-self: flex-end; border-bottom-right-radius: 4px; background: #e6f0fc; }
.soffit-chat__choices { display: flex; flex-wrap: wrap; gap: 8px; }
.soffit-chat__choices--photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.soffit-chat .soffit-chat__choice,
.soffit-chat .soffit-chat__material {
    min-height: 48px;
    padding: 11px 16px;
    border: 0;
    border-radius: 10px;
    color: #202833;
    background: #e5f0ff;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1.3;
    text-align: left;
    text-transform: none;
    white-space: normal;
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}
.soffit-chat .soffit-chat__choice:hover,
.soffit-chat .soffit-chat__material:hover,
.soffit-chat .soffit-chat__choice:active,
.soffit-chat .soffit-chat__material:active { color: #fff; background: var(--soffit-chat-primary); }
.soffit-chat .soffit-chat__material {
    display: grid;
    grid-template-rows: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 6px;
    text-align: center;
}
.soffit-chat__choices--photos > button { width: 100%; min-width: 0; max-width: none; }
.soffit-chat .soffit-chat__choices--photos > .soffit-chat__choice { display: grid; place-items: center; text-align: center; }
.soffit-chat__material img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.soffit-chat__material span { padding: 0 4px 4px; }
.soffit-chat button:focus-visible,
.soffit-chat input:focus-visible,
.soffit-chat textarea:focus-visible,
.soffit-chat-modal__close:focus-visible { outline: 3px solid var(--soffit-chat-primary); outline-offset: 2px; }
.soffit-chat__area-entry { display: grid; gap: 8px; width: 100%; max-width: 260px; }
.soffit-chat__area-entry .uk-form-label { display: grid; gap: 5px; }
.soffit-chat__area-error { color: #a9202a; font-size: .84rem; }
.soffit-chat .soffit-chat__result {
    padding: 16px;
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
}
.soffit-chat__result-caption { display: block; font-size: .84rem; }
.soffit-chat__price { display: block; margin-top: 5px; color: var(--soffit-chat-primary); font-size: clamp(1.25rem, 4vw, 1.7rem); line-height: 1.3; font-variant-numeric: tabular-nums; }
.soffit-chat__fineprint { margin: 8px 0 0; font-size: .82rem; line-height: 1.4; }
.soffit-chat .soffit-chat__refine { margin-top: 8px; padding: 0; border: 0; color: var(--soffit-chat-primary); background: transparent; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.soffit-chat__form { padding: 18px 20px 20px; border-top: 1px solid #e2e6eb; }
.soffit-chat__form .uk-form-label { display: block; margin-bottom: 4px; font-size: .84rem; font-weight: 600; }
.soffit-chat .uk-input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid #d8dce6; border-radius: 10px; background: #f7f7fc; color: #202833; font: inherit; }
.soffit-chat__privacy { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0; font-size: .92rem; line-height: 1.4; cursor: pointer; }
.soffit-chat__privacy .uk-checkbox { flex: none; margin-top: 3px; }
.soffit-chat__form .soffit-chat__invalid .uk-form-label,
.soffit-chat__form .soffit-chat__invalid,
.soffit-chat__form .soffit-chat__invalid a { color: #b42318; }
.soffit-chat .soffit-chat__contact.soffit-chat__invalid .uk-input { border-color: #b42318; box-shadow: 0 0 0 1px #b42318; }
.soffit-chat__privacy.soffit-chat__invalid .uk-checkbox { outline: 2px solid #b42318; outline-offset: 2px; }
.soffit-chat .soffit-chat__submit,
.soffit-chat .soffit-chat__area-submit { min-height: 46px; padding: 10px 18px; border: 0; border-radius: 8px; color: #fff; background: var(--soffit-chat-primary); font: inherit; font-weight: 700; text-transform: none; cursor: pointer; }
.soffit-chat .soffit-chat__submit { width: 100%; }
.soffit-chat .soffit-chat__submit:hover,
.soffit-chat .soffit-chat__area-submit:hover { color: #fff; background: var(--soffit-chat-primary); filter: brightness(.9); }
.soffit-chat .soffit-chat__submit:disabled { opacity: .65; cursor: wait; }
.soffit-chat__status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.soffit-chat-modal {
    width: min(92vw, 540px);
    max-width: none;
    max-height: min(94dvh, 850px);
    padding: 0;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 25, 37, .3);
}
.soffit-chat-modal[open] { display: flex; }
.soffit-chat-modal::backdrop { background: rgba(14, 23, 35, .58); }
.soffit-chat-modal .soffit-chat { display: flex; flex-direction: column; width: 100%; max-height: min(94dvh, 850px); border: 0; border-radius: 0; box-shadow: none; }
.soffit-chat-modal .soffit-chat__body { flex: 1 1 auto; min-height: 0; max-height: min(70dvh, 620px); }
.soffit-chat-modal .soffit-chat__form { flex: none; }
.soffit-chat-modal__close {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .17);
    cursor: pointer;
}
.soffit-chat-modal__close svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 600px) {
    .soffit-chat__body { padding: 16px; }
    .soffit-chat__form { padding: 16px; }
    .soffit-chat__choices--photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    .soffit-chat .soffit-chat__choice,
    .soffit-chat .soffit-chat__material { transition: none; }
}
