.caa-widget {
    --caa-primary: #2563eb;
    bottom: 24px;
    color: #172033;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position: fixed;
    right: 0;
    z-index: 99999;
}

.caa-launcher,
.caa-submit,
.caa-close {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.caa-launcher {
    align-items: center;
    background: var(--caa-primary);
    border-radius: 999px 0 0 999px;
    box-shadow: 0 14px 36px rgba(23, 32, 51, 0.22);
    color: #fff;
    display: flex;
    height: 56px;
    justify-content: center;
    min-width: 64px;
    padding: 0;
    width: 64px;
}

.caa-launcher svg {
    display: block;
    fill: currentColor;
    height: 30px;
    width: 30px;
}

.caa-panel {
    background: #fff;
    border: 1px solid #d8dde8;
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(23, 32, 51, 0.24);
    display: grid;
    grid-template-rows: auto minmax(180px, 1fr) auto;
    max-height: min(640px, calc(100vh - 48px));
    overflow: hidden;
    width: min(380px, calc(100vw - 32px));
}

.caa-panel[hidden],
.caa-launcher[hidden] {
    display: none;
}

.caa-header {
    align-items: center;
    background: var(--caa-primary);
    color: #fff;
    display: grid;
    gap: 2px 12px;
    grid-template-columns: 1fr auto;
    padding: 14px 16px;
}

.caa-header strong,
.caa-header span {
    grid-column: 1;
    line-height: 1.2;
}

.caa-header span {
    font-size: 12px;
    opacity: 0.86;
}

.caa-close {
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    color: #fff;
    display: flex;
    grid-column: 2;
    grid-row: 1 / span 2;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.caa-messages {
    background: #f6f8fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 16px;
}

.caa-message {
    border-radius: 8px;
    line-height: 1.4;
    max-width: 88%;
    overflow-wrap: anywhere;
    padding: 10px 12px;
}

.caa-message--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #d8dde8;
}

.caa-message--visitor {
    align-self: flex-end;
    background: var(--caa-primary);
    color: #fff;
}

.caa-form {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.caa-input,
.caa-field {
    border: 1px solid #c9d0dd;
    border-radius: 8px;
    box-sizing: border-box;
    font: inherit;
    padding: 10px 12px;
    width: 100%;
}

.caa-input {
    min-height: 86px;
    resize: vertical;
}

.caa-details {
    display: grid;
    gap: 8px;
}

.caa-submit {
    background: var(--caa-primary);
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    min-height: 42px;
    padding: 0 14px;
}

.caa-submit:disabled {
    cursor: progress;
    opacity: 0.7;
}

@media (max-width: 520px) {
    .caa-widget {
        bottom: 16px;
        right: 0;
    }

    .caa-panel {
        max-height: calc(100vh - 32px);
    }
}
