:root {
    --al-chat-ink: #0b192b;
    --al-chat-navy: #10233a;
    --al-chat-ivory: #f7f3ec;
    --al-chat-white: #ffffff;
    --al-chat-copper: #dd772a;
    --al-chat-copper-dark: #b85c10;
    --al-chat-muted: #697587;
    --al-chat-border: rgba(221, 119, 42, 0.22);
    --al-chat-shadow: 0 22px 70px rgba(4, 13, 25, 0.28);
}

.al-chat-root,
.al-chat-root * {
    box-sizing: border-box;
}

.al-chat-root {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147482000;
    font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
    color: var(--al-chat-ink);
}

.al-chat-launcher {
    min-height: 52px;
    max-width: calc(100vw - 32px);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 19px;
    border: 1px solid rgba(221, 119, 42, 0.55);
    border-radius: 3px;
    color: var(--al-chat-white);
    background: rgba(11, 25, 43, 0.97);
    box-shadow: 0 12px 34px rgba(4, 13, 25, 0.28);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.al-chat-launcher:hover,
.al-chat-launcher:focus-visible {
    border-color: var(--al-chat-copper);
    background: var(--al-chat-navy);
    transform: translateY(-1px);
    outline: none;
}

.al-chat-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: #39b86a;
    box-shadow: 0 0 0 4px rgba(57, 184, 106, 0.13);
}

.al-chat-dot.is-offline {
    background: var(--al-chat-copper);
    box-shadow: 0 0 0 4px rgba(221, 119, 42, 0.13);
}

.al-chat-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 390px;
    height: min(590px, calc(100vh - 44px));
    height: min(590px, calc(100dvh - 44px));
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--al-chat-border);
    border-radius: 4px;
    background: var(--al-chat-ivory);
    box-shadow: var(--al-chat-shadow);
    transform-origin: right bottom;
}

.al-chat-panel[hidden],
.al-chat-launcher[hidden],
.al-chat-proactive[hidden] {
    display: none;
}

.al-chat-header {
    min-height: 92px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 21px 20px 17px;
    color: var(--al-chat-white);
    background: linear-gradient(145deg, #0b192b 0%, #132b46 100%);
    border-bottom: 2px solid var(--al-chat-copper);
}

.al-chat-title {
    margin: 0 0 6px;
    color: var(--al-chat-white);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.05;
}

.al-chat-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    line-height: 1.45;
}

.al-chat-minimize {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    margin: -5px -7px 0 0;
    border: 0;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.84);
    background: transparent;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.al-chat-minimize:hover,
.al-chat-minimize:focus-visible {
    color: var(--al-chat-white);
    background: rgba(255, 255, 255, 0.09);
    outline: none;
}

.al-chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    color: var(--al-chat-muted);
    background: #f1ece3;
    border-bottom: 1px solid rgba(11, 25, 43, 0.08);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.al-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 16px 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.al-chat-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0 0 14px;
}

.al-chat-message.is-visitor {
    align-items: flex-end;
}

.al-chat-sender {
    margin: 0 8px 5px;
    color: var(--al-chat-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.al-chat-sender span {
    display: block;
    margin-top: 2px;
    color: #8c95a2;
    font-size: 9px;
    font-weight: 500;
}

.al-chat-bubble {
    max-width: 84%;
    padding: 11px 13px;
    border: 1px solid rgba(11, 25, 43, 0.09);
    border-radius: 3px 12px 12px 12px;
    color: #263447;
    background: var(--al-chat-white);
    box-shadow: 0 4px 15px rgba(11, 25, 43, 0.05);
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.al-chat-message.is-visitor .al-chat-bubble {
    color: var(--al-chat-white);
    background: var(--al-chat-navy);
    border-color: var(--al-chat-navy);
    border-radius: 12px 3px 12px 12px;
}

.al-chat-message.is-pending .al-chat-bubble {
    opacity: 0.66;
}

.al-chat-contact-form {
    width: min(100%, 310px);
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--al-chat-border);
    background: rgba(255, 255, 255, 0.7);
}

.al-chat-contact-form label {
    display: block;
    margin-bottom: 7px;
    color: var(--al-chat-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.al-chat-contact-row {
    display: flex;
    gap: 7px;
}

.al-chat-contact-form input {
    min-width: 0;
    flex: 1 1 auto;
    height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(11, 25, 43, 0.2);
    border-radius: 2px;
    color: var(--al-chat-ink);
    background: var(--al-chat-white);
    font: inherit;
    font-size: 12px;
}

.al-chat-contact-form button {
    flex: 0 0 auto;
    padding: 0 13px;
    border: 0;
    border-radius: 2px;
    color: var(--al-chat-white);
    background: var(--al-chat-copper-dark);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.al-chat-composer {
    flex: 0 0 auto;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(11, 25, 43, 0.09);
    background: var(--al-chat-white);
}

.al-chat-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.al-chat-input {
    min-height: 42px;
    max-height: 104px;
    flex: 1 1 auto;
    resize: none;
    padding: 11px 12px;
    border: 1px solid rgba(11, 25, 43, 0.17);
    border-radius: 3px;
    color: var(--al-chat-ink);
    background: #fbfaf7;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
}

.al-chat-input:focus {
    border-color: var(--al-chat-copper);
    outline: 2px solid rgba(221, 119, 42, 0.12);
}

.al-chat-send {
    width: 44px;
    height: 42px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 3px;
    color: var(--al-chat-white);
    background: var(--al-chat-copper-dark);
    cursor: pointer;
    font: inherit;
    font-size: 18px;
}

.al-chat-send:hover,
.al-chat-send:focus-visible {
    background: var(--al-chat-copper);
    outline: none;
}

.al-chat-send:disabled,
.al-chat-input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.al-chat-error {
    min-height: 16px;
    margin-top: 6px;
    color: #9f352c;
    font-size: 10px;
}

.al-chat-proactive {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: 270px;
    padding: 13px 15px;
    border: 1px solid var(--al-chat-border);
    border-radius: 3px;
    color: var(--al-chat-ink);
    background: var(--al-chat-white);
    box-shadow: 0 10px 30px rgba(4, 13, 25, 0.17);
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 17px;
    line-height: 1.3;
    cursor: pointer;
}

@media (max-width: 600px) {
    .al-chat-root {
        right: 12px;
        bottom: 12px;
    }

    .al-chat-panel {
        position: fixed;
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        height: min(620px, calc(100vh - 24px));
        height: min(620px, calc(100dvh - 24px));
    }

    .al-chat-header {
        min-height: 82px;
        padding: 17px 17px 14px;
    }

    .al-chat-messages {
        padding: 15px 12px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .al-chat-launcher,
    .al-chat-messages {
        transition: none;
        scroll-behavior: auto;
    }
}
