.parish-chat {
    --chat-gold: #b69a2c;
    --chat-wine: #7f1d2d;
    --chat-ink: #20242c;
    --chat-muted: #687384;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: inherit;
}

.parish-chat *,
.parish-chat *::before,
.parish-chat *::after {
    box-sizing: border-box;
}

.parish-chat__toggle {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-left: auto;
    padding: 0;
    color: #fff;
    background: linear-gradient(145deg, #c2aa42, var(--chat-gold));
    border: 0;
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(46, 32, 17, .28);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

.parish-chat__toggle:hover,
.parish-chat__toggle:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(46, 32, 17, .34);
}

.parish-chat__toggle:focus-visible,
.parish-chat button:focus-visible,
.parish-chat textarea:focus-visible {
    outline: 3px solid rgba(182, 154, 44, .35);
    outline-offset: 3px;
}

.parish-chat__close-icon,
.parish-chat--open .parish-chat__open-icon {
    display: none;
}

.parish-chat--open .parish-chat__close-icon {
    display: block;
}

.parish-chat__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(380px, calc(100vw - 32px));
    height: min(600px, calc(100vh - 120px));
    min-height: 470px;
    overflow: hidden;
    color: var(--chat-ink);
    background: #fff;
    border: 1px solid rgba(31, 41, 55, .1);
    border-radius: 20px;
    box-shadow: 0 26px 70px rgba(24, 27, 35, .24);
}

.parish-chat__panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    animation: parish-chat-enter .2s ease-out;
}

@keyframes parish-chat-enter {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.parish-chat__header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 16px;
    color: #fff;
    background: linear-gradient(120deg, var(--chat-wine), #a52a3c);
}

.parish-chat__avatar {
    width: 42px;
    height: 42px;
    padding: 3px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
}

.parish-chat__header h2 {
    margin: 0 0 2px;
    color: inherit;
    font-size: 16px;
    line-height: 1.2;
}

.parish-chat__header p {
    margin: 0;
    color: rgba(255, 255, 255, .82);
    font-size: 11px;
    line-height: 1.3;
}

.parish-chat__header p span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 3px;
    background: #6ee7a5;
    border-radius: 50%;
}

.parish-chat__panel-close {
    width: 34px;
    height: 34px;
    margin-left: auto;
    padding: 0;
    color: #fff;
    font-size: 25px;
    line-height: 1;
    background: rgba(255, 255, 255, .1);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.parish-chat__messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f7f7f5;
}

.parish-chat__message {
    align-self: flex-start;
    max-width: 86%;
}

.parish-chat__message p {
    margin: 0;
    padding: 10px 13px;
    color: #29313d;
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #fff;
    border: 1px solid #e6e7e8;
    border-radius: 14px 14px 14px 4px;
}

.parish-chat__message time {
    display: block;
    margin: 4px 4px 0;
    color: #8a93a0;
    font-size: 10px;
}

.parish-chat__message--user {
    align-self: flex-end;
}

.parish-chat__message--user p {
    color: #fff;
    background: var(--chat-wine);
    border-color: var(--chat-wine);
    border-radius: 14px 14px 4px 14px;
}

.parish-chat__message--user time {
    text-align: right;
}

.parish-chat__message--pending p {
    color: var(--chat-muted);
    font-style: italic;
}

.parish-chat__notice {
    padding: 9px 11px;
    color: #765715;
    font-size: 11px;
    line-height: 1.4;
    background: #fff8df;
    border: 1px solid #eddfaa;
    border-radius: 10px;
}

.parish-chat__suggestions {
    display: flex;
    gap: 7px;
    padding: 10px 12px 4px;
    overflow-x: auto;
    background: #fff;
}

.parish-chat__suggestions button {
    flex: 0 0 auto;
    padding: 6px 9px;
    color: #694f11;
    font-size: 11px;
    background: #fffbeb;
    border: 1px solid #eadb9c;
    border-radius: 999px;
    cursor: pointer;
}

.parish-chat__form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 9px 12px 5px;
    background: #fff;
}

.parish-chat__form textarea {
    flex: 1;
    min-height: 40px;
    max-height: 92px;
    padding: 10px 13px;
    resize: none;
    color: var(--chat-ink);
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    background: #f8fafc;
    border: 1px solid #d9dde3;
    border-radius: 18px;
}

.parish-chat__send {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: var(--chat-gold);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.parish-chat__send:disabled,
.parish-chat__form textarea:disabled {
    cursor: wait;
    opacity: .62;
}

.parish-chat__privacy {
    margin: 0;
    padding: 1px 13px 10px;
    color: #808897;
    font-size: 9.5px;
    line-height: 1.35;
    background: #fff;
}

@media (max-width: 520px) {
    .parish-chat { right: 16px; bottom: 16px; }
    .parish-chat__panel {
        position: fixed;
        inset: 12px 12px 84px;
        width: auto;
        height: auto;
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .parish-chat__panel:not([hidden]) { animation: none; }
    .parish-chat__toggle { transition: none; }
}
