#cew-support, #cew-support * { box-sizing: border-box; }
#cew-support {
    position: fixed;
    inset: auto 18px 18px auto;
    z-index: 11050;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #e9f6ff;
    line-height: 1.48;
}
#cew-support [hidden] { display: none !important; }
#cew-support button { font-family: inherit; cursor: pointer; }
#cew-support button:disabled { opacity: .55; cursor: wait; }
#cew-support button:focus-visible, #cew-support input:focus-visible, #cew-support a:focus-visible {
    outline: 3px solid #82dcff;
    outline-offset: 2px;
}
#cew-support .cew-chat-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #53bfff;
    border-radius: 999px;
    padding: 13px 18px;
    color: #fff;
    font-size: 14px;
    font-weight: 750;
    background: linear-gradient(135deg, #13589b, #086b9c);
    box-shadow: 0 13px 45px rgba(0, 5, 18, .4), 0 0 30px rgba(21, 174, 239, .22);
}
#cew-support .cew-chat-launcher svg { width: 23px; height: 23px; flex: 0 0 23px; }
#cew-support .cew-chat-window {
    position: absolute;
    right: 0;
    bottom: 66px;
    width: min(380px, calc(100vw - 24px));
    height: min(590px, calc(100dvh - 95px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(97, 201, 255, .35);
    border-radius: 18px;
    color: #edf7ff;
    background: #081b2c;
    box-shadow: 0 16px 70px rgba(0, 0, 0, .68);
}
#cew-support .cew-chat-top {
    padding: 12px 13px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: linear-gradient(120deg, #154c7b, #10344f);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}
#cew-support .cew-chat-avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: #7ce2ff;
    border: 1px solid rgba(145, 224, 255, .28);
    background: rgba(104, 205, 255, .10);
    font-size: 26px;
}
#cew-support .cew-chat-title { display: flex; flex: 1; flex-direction: column; gap: 1px; }
#cew-support .cew-chat-title strong { font-size: 16px; }
#cew-support .cew-chat-title small { font-size: 11px; color: #b6d5e8; }
#cew-support .cew-chat-close {
    border: 1px solid rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .09);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 10px;
    font-size: 26px;
    line-height: 1;
}
#cew-support .cew-chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    padding: 17px 13px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: radial-gradient(ellipse at 50% -15%, rgba(35, 119, 190, .17), transparent 60%);
}
#cew-support .cew-chat-bubble {
    max-width: 91%;
    width: fit-content;
    padding: 10px 13px;
    border-radius: 13px 13px 13px 4px;
    background: #173a58;
    border: 1px solid rgba(109, 180, 217, .12);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
}
#cew-support .cew-chat-bubble--user {
    align-self: flex-end;
    color: #0f2841;
    background: #c5ecff;
    border-radius: 13px 13px 4px 13px;
}
#cew-support .cew-chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,.07);
    max-height: 108px;
    overflow-y: auto;
}
#cew-support .cew-chat-choice {
    border: 1px solid #3376a8;
    border-radius: 999px;
    background: rgba(36, 116, 175, .17);
    color: #d7f1ff;
    padding: 7px 11px;
    font-size: 12px;
}
#cew-support .cew-chat-choice:hover { background: #185480; }
#cew-support .cew-chat-compose { display: flex; align-items: stretch; gap: 7px; padding: 9px 11px; }
#cew-support .cew-chat-compose input {
    min-width: 0;
    flex: 1;
    border: 1px solid #3a637c;
    border-radius: 10px;
    padding: 11px 10px;
    font-size: 13px;
    background: #0c263c;
    color: #fff;
}
#cew-support .cew-chat-compose input::placeholder { color: #91a9b9; }
#cew-support .cew-chat-send {
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    background: #2a9fd6;
    color: #061925;
    font-size: 13px;
    font-weight: 800;
}
#cew-support .cew-chat-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    text-align: center;
    padding: 8px 10px 10px;
    font-size: 11px;
    color: #a7c3d6;
}
#cew-support .cew-chat-footer small { display: block; font-size: 10px; line-height: 1.4; margin-top: 3px; }
#cew-support .cew-chat-footer a { color: #7fd7ff; text-decoration: underline; }
#cew-support .cew-chat-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
@media (max-width: 520px) {
    #cew-support { bottom: max(10px, env(safe-area-inset-bottom)); right: 10px; }
    #cew-support .cew-chat-launcher { padding: 12px 14px; }
    #cew-support .cew-chat-window {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: max(70px, calc(62px + env(safe-area-inset-bottom)));
        width: auto;
        height: min(620px, calc(100dvh - 85px));
        border-radius: 16px;
    }
}
@media (prefers-reduced-motion: reduce) {
    #cew-support * { scroll-behavior: auto !important; transition: none !important; }
}

/* Identidad visual SoporteCEW. Se conserva el logotipo aportado por CEW. */
#cew-support .cew-chat-avatar {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    overflow: hidden;
    background: #000;
    border: 1px solid rgba(57, 208, 192, .45);
    border-radius: 15px;
    padding: 0;
}
#cew-support .cew-chat-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#cew-support .cew-chat-whatsapp {
    display: block;
    margin-top: 7px;
    border: 1px solid rgba(68, 219, 151, .38);
    border-radius: 10px;
    padding: 7px 10px;
    color: #c7ffe1;
    background: rgba(18, 123, 77, .20);
    font-weight: 700;
    text-decoration: none;
}
#cew-support .cew-chat-whatsapp:hover,
#cew-support .cew-chat-whatsapp:focus-visible {
    background: rgba(18, 123, 77, .34);
}

/* Avisos de incidencias publicados por operadores CEW */
#cew-support .cew-chat-bubble--notice {
    align-self: stretch;
    max-width: 100%;
    width: 100%;
    color: #fff3d5;
    border: 1px solid rgba(245, 184, 70, .48);
    border-left: 4px solid #f5b846;
    background: linear-gradient(120deg, #3b321e, #172c3c);
    border-radius: 12px;
    line-height: 1.55;
}
