:root {
    --windsor-chat-brand: #174f64;
    --windsor-chat-dark: #0d3040;
    --windsor-chat-soft: #eef5f8;
}

.windsor-chat-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(145deg, var(--windsor-chat-brand), var(--windsor-chat-dark));
    color: #fff;
    font: 700 14px/1 "Segoe UI", sans-serif;
    cursor: pointer;
    box-shadow: 0 14px 35px rgba(13, 48, 64, .3);
}

.windsor-chat-launcher svg { width: 22px; height: 22px; fill: currentColor; }
.windsor-chat-launcher:hover { transform: translateY(-2px); }
.windsor-chat-launcher:focus-visible,
.windsor-chat-panel button:focus-visible,
.windsor-chat-panel textarea:focus-visible { outline: 3px solid #8bc5db; outline-offset: 2px; }

.windsor-chat-panel {
    position: fixed;
    right: 22px;
    bottom: 84px;
    z-index: 900;
    width: min(390px, calc(100vw - 28px));
    height: min(590px, calc(100vh - 120px));
    display: none;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border: 1px solid #cbdbe3;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(13, 48, 64, .28);
    font-family: "Segoe UI", Tahoma, sans-serif;
}

.windsor-chat-panel.is-open { display: grid; animation: windsor-chat-in .18s ease-out; }
@keyframes windsor-chat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.windsor-chat-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 15px 16px;
    background: linear-gradient(145deg, var(--windsor-chat-brand), var(--windsor-chat-dark));
    color: #fff;
}

.windsor-chat-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #fff;
}

.windsor-chat-avatar img { width: 32px; height: 32px; object-fit: contain; }
.windsor-chat-title { flex: 1; min-width: 0; }
.windsor-chat-title strong { display: block; font-size: 15px; }
.windsor-chat-title span { display: block; margin-top: 3px; font-size: 12px; opacity: .82; }
.windsor-chat-close { border: 0; background: transparent; color: #fff; padding: 6px; font-size: 24px; line-height: 1; cursor: pointer; }

.windsor-chat-messages {
    overflow-y: auto;
    padding: 17px 14px;
    background: #f4f7f9;
    scroll-behavior: smooth;
}

.windsor-chat-message { display: flex; margin: 0 0 11px; }
.windsor-chat-message.is-user { justify-content: flex-end; }
.windsor-chat-bubble {
    max-width: 84%;
    padding: 10px 12px;
    border-radius: 14px 14px 14px 4px;
    background: #fff;
    color: #213442;
    box-shadow: 0 2px 8px rgba(13, 48, 64, .08);
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.windsor-chat-message.is-user .windsor-chat-bubble {
    border-radius: 14px 14px 4px 14px;
    background: var(--windsor-chat-brand);
    color: #fff;
}

.windsor-chat-form { display: flex; align-items: flex-end; gap: 9px; padding: 12px; border-top: 1px solid #dce6eb; background: #fff; }
.windsor-chat-input { flex: 1; min-height: 42px; max-height: 110px; resize: none; border: 1px solid #cbd9e1; border-radius: 13px; padding: 10px 12px; color: #1f3340; background: #fff; font-size: 14px; outline: 0; }
.windsor-chat-send { width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--windsor-chat-brand); color: #fff; cursor: pointer; font-size: 18px; }
.windsor-chat-send:disabled { opacity: .55; cursor: wait; }

@media (max-width: 520px) {
    .windsor-chat-launcher { right: 14px; bottom: 14px; }
    .windsor-chat-panel { right: 0; bottom: 0; width: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .windsor-chat-panel.is-open { animation: none; }
    .windsor-chat-launcher:hover { transform: none; }
}
