.cclea-chatbot {
    --chat-blue: var(--institutional, #2f328a);
    --chat-blue-dark: var(--institutional-dark, #252873);
    --chat-pink: var(--accent, #df1683);
    --chat-text: var(--ink, #242d3d);
    --chat-muted: var(--muted, #616d7d);
    --chat-line: var(--line, #dfe3e9);
    --chat-focus: var(--focus, #18a9d4);
    position: fixed;
    right: max(22px, env(safe-area-inset-right));
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 1000;
    font-family: "Visby CF", Arial, Helvetica, sans-serif;
    line-height: 1.4;
}

.cclea-chatbot *,
.cclea-chatbot *::before,
.cclea-chatbot *::after { box-sizing: border-box; }

.cclea-chatbot__toggle {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 20px;
    color: #fff;
    background: var(--chat-blue);
    box-shadow: 0 10px 26px rgb(24 32 93 / .28);
    cursor: pointer;
    animation: cclea-chat-entrance .45s ease-out both;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.cclea-chatbot__toggle:hover {
    background: var(--chat-blue-dark);
    box-shadow: 0 13px 30px rgb(24 32 93 / .34);
    transform: translateY(-2px);
}

.cclea-chatbot__toggle:focus-visible,
.cclea-chatbot button:focus-visible,
.cclea-chatbot a:focus-visible,
.cclea-chatbot input:focus-visible {
    outline: 3px solid var(--chat-focus);
    outline-offset: 3px;
}

.cclea-chatbot__toggle-mark,
.cclea-chatbot__brand-mark {
    display: block;
    overflow: hidden;
    background-image: url("../assets/images/logos/Logoblancocorto.png");
    background-repeat: no-repeat;
    background-position: left center;
}

.cclea-chatbot__toggle-mark {
    width: 42px;
    height: 45px;
    background-size: 191px auto;
}

.cclea-chatbot__toggle-close {
    display: none;
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.cclea-chatbot.is-open .cclea-chatbot__toggle-mark { display: none; }
.cclea-chatbot.is-open .cclea-chatbot__toggle-close { display: block; }

.cclea-chatbot__hint {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: max-content;
    padding: 9px 13px;
    border: 1px solid var(--chat-line);
    border-radius: 8px;
    color: var(--chat-blue-dark);
    background: #fff;
    box-shadow: 0 6px 18px rgb(31 39 78 / .12);
    font-family: "Visby CF Bold", "Visby CF", Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    opacity: 1;
    transform: translateY(0);
    transition: opacity .2s ease, transform .2s ease;
}

.cclea-chatbot__hint::after {
    content: "";
    position: absolute;
    right: 22px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    border-right: 1px solid var(--chat-line);
    border-bottom: 1px solid var(--chat-line);
    background: #fff;
    transform: rotate(45deg);
}

.cclea-chatbot__hint.is-hidden {
    visibility: hidden;
    opacity: 0;
    transform: translateY(6px);
}

.cclea-chatbot__panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: min(390px, calc(100vw - 32px));
    height: min(600px, calc(100dvh - 116px));
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--chat-line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 48px rgb(25 32 72 / .22);
    animation: cclea-chat-panel-in .2s ease-out both;
}

.cclea-chatbot__panel:not([hidden]) { display: flex; flex-direction: column; }

.cclea-chatbot__header {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px 10px 14px;
    color: #fff;
    background: var(--chat-blue);
}

.cclea-chatbot__brand-mark {
    flex: 0 0 auto;
    width: 32px;
    height: 35px;
    background-size: 149px auto;
}

.cclea-chatbot__heading { min-width: 0; flex: 1; }

.cclea-chatbot__heading h2 {
    margin: 0;
    color: #fff;
    font-family: "Visby CF Bold", "Visby CF", Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.cclea-chatbot__heading p {
    margin: 3px 0 0;
    color: rgb(255 255 255 / .84);
    font-size: 10.5px;
    line-height: 1.2;
}

.cclea-chatbot__header-button {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: transparent;
    cursor: pointer;
}

.cclea-chatbot__header-button:hover { background: rgb(255 255 255 / .13); }

.cclea-chatbot__header-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cclea-chatbot__messages {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 17px 15px 20px;
    background: #fff;
    scrollbar-color: #b8bec9 transparent;
    scrollbar-width: thin;
}

.cclea-chatbot__message-row { display: flex; margin-bottom: 10px; }
.cclea-chatbot__message-row--user { justify-content: flex-end; }

.cclea-chatbot__message {
    max-width: 88%;
    padding: 10px 12px;
    border: 1px solid #e3e7ee;
    border-radius: 5px 13px 13px 13px;
    color: var(--chat-blue-dark);
    background: #f3f5f9;
    font-size: 13px;
}

.cclea-chatbot__message-row--user .cclea-chatbot__message {
    border-color: var(--chat-blue);
    border-radius: 13px 5px 13px 13px;
    color: #fff;
    background: var(--chat-blue);
}

.cclea-chatbot__message p { margin: 0; }
.cclea-chatbot__message p + p { margin-top: 7px; }

.cclea-chatbot__steps,
.cclea-chatbot__documents {
    margin: 8px 0 0;
    padding-left: 20px;
}

.cclea-chatbot__steps li,
.cclea-chatbot__documents li { margin: 4px 0; }

.cclea-chatbot__quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 1px 0 15px;
}

.cclea-chatbot__quick-action {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid #c9cedd;
    border-radius: 8px;
    color: var(--chat-blue);
    background: #fff;
    font-family: "Visby CF Bold", "Visby CF", Arial, sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.cclea-chatbot__quick-action:hover {
    border-color: var(--chat-blue);
    color: var(--chat-blue-dark);
    background: #f5f6fb;
}

.cclea-chatbot__quick-action--primary {
    border-color: var(--chat-pink);
    color: #fff;
    background: var(--chat-pink);
}

.cclea-chatbot__quick-action--primary:hover {
    border-color: #b4106a;
    color: #fff;
    background: #b4106a;
}

.cclea-chatbot__footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--chat-line);
    background: #fff;
}

.cclea-chatbot__composer {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 10px 7px;
}

.cclea-chatbot__composer input {
    min-width: 0;
    min-height: 42px;
    flex: 1;
    padding: 9px 11px;
    border: 1px solid #bdc5d2;
    border-radius: 8px;
    color: var(--chat-text);
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.cclea-chatbot__composer input::placeholder { color: #737d8d; }

.cclea-chatbot__composer button {
    width: 42px;
    height: 42px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--chat-pink);
    cursor: pointer;
}

.cclea-chatbot__composer button:hover { background: #b4106a; }

.cclea-chatbot__composer svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cclea-chatbot__legal {
    margin: 0;
    padding: 0 11px 9px;
    color: var(--chat-muted);
    font-size: 9px;
    line-height: 1.25;
}

.cclea-chatbot__sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes cclea-chat-entrance {
    from { opacity: 0; transform: translateY(8px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cclea-chat-panel-in {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 560px) {
    .cclea-chatbot {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .cclea-chatbot__toggle {
        width: 58px;
        height: 58px;
        border-radius: 18px;
    }

    .cclea-chatbot__panel {
        position: fixed;
        right: 10px;
        bottom: calc(82px + env(safe-area-inset-bottom));
        left: 10px;
        width: auto;
        height: min(620px, calc(100dvh - 100px - env(safe-area-inset-bottom)));
        min-height: min(400px, calc(100dvh - 100px));
        border-radius: 12px;
    }

    .cclea-chatbot__message { max-width: 92%; }
    .cclea-chatbot__messages { padding-inline: 12px; }
    .cclea-chatbot__quick-action { min-height: 40px; }
}

@media (max-height: 560px) and (orientation: landscape) {
    .cclea-chatbot__panel {
        right: 82px;
        bottom: max(8px, env(safe-area-inset-bottom));
        left: 8px;
        width: auto;
        height: calc(100dvh - 16px);
        min-height: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cclea-chatbot__toggle,
    .cclea-chatbot__panel { animation: none; }

    .cclea-chatbot__toggle,
    .cclea-chatbot__hint,
    .cclea-chatbot__quick-action { transition: none; }
}
