/* Quimika · Chat privado · Paleta azul cielo.
   Hereda los tokens --q-* globales y dispone de colores de respaldo.
   Se conservan las medidas, las posiciones y los estados del chat. */
/* Colores locales del chat: compatibles con y sin quimika.css. */
.q-chat-root {
    --q-chat-acento: var(--q-action, #0075B4);
    --q-chat-acento-hover: var(--q-action-hover, #00649B);
    --q-chat-acento-texto: #FFFFFF;
    --q-chat-suave: var(--q-soft, #EAF6FF);
    --q-chat-fondo: var(--q-background, #F5FAFF);
    --q-chat-panel: var(--q-surface, #FFFFFF);
    --q-chat-texto: var(--q-text, #14283F);
    --q-chat-secundario: var(--q-muted, #52677B);
    --q-chat-borde: var(--q-border, #D6E4EF);
    --q-chat-error: var(--q-danger, #B42336);
    --q-chat-sombra: 0 18px 65px rgba(20, 64, 95, 0.18);
    color: var(--q-chat-texto);
    color-scheme: light;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    position: relative;
    z-index: 1200;
}
[data-theme='dark'] .q-chat-root {
    --q-chat-acento: var(--q-action, #7DD3FC);
    --q-chat-acento-hover: var(--q-action-hover, #BAE6FD);
    --q-chat-acento-texto: #082F49;
    --q-chat-suave: var(--q-soft, #142E40);
    --q-chat-fondo: var(--q-background, #101923);
    --q-chat-panel: var(--q-surface, #172532);
    --q-chat-texto: var(--q-text, #F7F8FA);
    --q-chat-secundario: var(--q-muted, #B1B7C1);
    --q-chat-borde: var(--q-border, #3F5366);
    --q-chat-error: var(--q-danger, #FFB3BD);
    --q-chat-sombra: 0 18px 65px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
}
.q-chat-root *,
.q-chat-root *::before,
.q-chat-root *::after {
    box-sizing: border-box;
}
.q-chat-root [hidden],
[data-chat-unread][hidden] {
    display: none !important;
}
.q-chat-root button,
.q-chat-root textarea {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

.q-chat-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px;
    border-bottom: 1px solid var(--q-chat-borde);
}
.q-chat-search {
    min-width: 0;
    flex: 1;
    padding: 10px;
    border: 1px solid var(--q-chat-borde);
    border-radius: 12px;
    background: var(--q-chat-fondo);
    color: var(--q-chat-texto);
    font: inherit;
    font-size: 12px;
}
.q-chat-unread-filter {
    flex: none;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--q-chat-borde);
    border-radius: 10px;
    background: transparent;
    color: var(--q-chat-secundario);
    font-size: 10px !important;
}
.q-chat-unread-filter[aria-pressed='true'] {
    border-color: var(--q-chat-acento);
    color: var(--q-chat-acento);
    background: var(--q-chat-suave);
}
.q-chat-avatar { position: relative; overflow: hidden; }
.q-chat-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.q-chat-root button {
    cursor: pointer;
}
.q-chat-root button:disabled {
    opacity: 0.55;
    cursor: wait;
}
.q-chat-root button:focus-visible,
.q-chat-root textarea:focus-visible,
.q-chat-root input:focus-visible {
    outline: 3px solid var(--q-chat-acento);
    outline-offset: 3px;
}
.q-chat-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.q-chat-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: inherit;
    flex-shrink: 0;
}
.q-chat-icon-button:hover {
    background: var(--q-chat-suave);
}
.q-chat-menu {
    display: flex;
    align-items: center;
    gap: 13px;
    width: 100%;
    padding: 13px 14px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--q-muted, #52677B);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.q-chat-menu:hover {
    background: var(--q-soft, #EAF6FF);
}
.q-chat-menu .icon {
    width: 20px;
    height: 20px;
}
.q-chat-menu-badge {
    margin-left: auto;
    border-radius: 20px;
    padding: 2px 7px;
    background: var(--q-action, #0075B4);
    color: #FFFFFF;
    font-size: 11px;
}
.q-member-action.q-chat-start {
    position: relative;
    z-index: 3;
    cursor: pointer;
}
.q-chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 19px;
    border: 0;
    border-radius: 18px;
    background: var(--q-chat-acento);
    color: var(--q-chat-acento-texto);
    box-shadow: var(--q-chat-sombra);
    font-weight: 700 !important;
    z-index: 25;
}
.q-chat-launcher .q-chat-count {
    background: var(--q-chat-panel);
    color: var(--q-chat-texto);
    padding: 2px 7px;
    border-radius: 14px;
    font-size: 11px;
}
.q-chat-drawer {
    position: fixed;
    right: 24px;
    bottom: 88px;
    width: 390px;
    height: min(600px, calc(100dvh - 125px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--q-chat-borde);
    border-radius: 22px;
    background: var(--q-chat-panel);
    box-shadow: var(--q-chat-sombra);
    z-index: 30;
}
.q-chat-drawer-header {
    padding: 21px 20px 13px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--q-chat-borde);
}
.q-chat-drawer-header > div:first-child {
    flex: 1;
}
.q-chat-eyebrow {
    margin: 0 0 4px;
    color: var(--q-chat-acento);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.q-chat-drawer-title {
    margin: 0;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 25px;
    font-weight: 700;
    color: inherit;
}
.q-chat-state {
    display: inline-flex;
    margin-top: 8px;
    padding: 3px 9px;
    background: var(--q-chat-suave);
    color: var(--q-chat-acento);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.q-chat-toolbar {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--q-chat-borde);
}
.q-chat-text-button {
    border: 0;
    border-radius: 9px;
    padding: 8px 11px;
    background: transparent;
    color: var(--q-chat-secundario);
    font-size: 12px !important;
    font-weight: 600 !important;
}
.q-chat-text-button[aria-pressed='true'] {
    color: var(--q-chat-acento);
    background: var(--q-chat-suave);
}
.q-chat-drawer-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 8px;
    overscroll-behavior: contain;
}
.q-chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 11px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: inherit;
    text-align: left;
}
.q-chat-item:hover {
    background: var(--q-chat-suave);
}
.q-chat-avatar {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    flex-shrink: 0;
    border-radius: 15px;
    background: var(--q-chat-suave);
    color: var(--q-chat-acento);
    font-weight: 800;
}
.q-chat-item-main {
    min-width: 0;
    flex: 1;
}
.q-chat-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.q-chat-item-name {
    display: block;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 700;
}
.q-chat-item-time {
    color: var(--q-chat-secundario);
    font-size: 10px;
    flex-shrink: 0;
}
.q-chat-item-preview {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--q-chat-secundario);
    font-size: 12px;
}
.q-chat-unread {
    display: inline-grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    background: var(--q-chat-acento);
    color: var(--q-chat-acento-texto);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}
.q-chat-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--q-chat-secundario);
}
.q-chat-empty > .q-chat-icon {
    width: 39px;
    height: 39px;
    color: var(--q-chat-acento);
    margin-bottom: 12px;
}
.q-chat-empty strong {
    display: block;
    margin-bottom: 8px;
    color: var(--q-chat-texto);
    font-size: 16px;
    font-weight: 700;
}
.q-chat-empty p {
    margin: 0 0 15px;
    font-size: 13px;
}
.q-chat-primary {
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--q-chat-acento);
    color: var(--q-chat-acento-texto);
    font-weight: 700 !important;
}
.q-chat-footer {
    padding: 11px 18px;
    border-top: 1px solid var(--q-chat-borde);
    color: var(--q-chat-secundario);
    font-size: 10px;
    text-align: center;
}
.q-chat-load {
    display: block;
    margin: 9px auto;
    border: 0;
    border-radius: 12px;
    padding: 9px 14px;
    background: var(--q-chat-suave);
    color: var(--q-chat-acento);
    font-size: 12px !important;
}
.q-chat-plan-intro {
    margin: 12px 10px 18px;
    color: var(--q-chat-secundario);
    font-size: 13px;
}
.q-chat-plan-group {
    margin: 10px;
    border: 1px solid var(--q-chat-borde);
    border-radius: 15px;
    padding: 16px;
}
.q-chat-plan-group h3 {
    margin: 0 0 6px;
    font-size: 15px;
    letter-spacing: 0.05em;
}
.q-chat-plan-group p {
    color: var(--q-chat-secundario);
    font-size: 11px;
    margin: 5px 0 14px;
}
.q-chat-plan-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    align-items: baseline;
    border-top: 1px solid var(--q-chat-borde);
}
.q-chat-plan-row span:first-child {
    flex: 1;
    font-size: 13px;
}
.q-chat-plan-row strong {
    font-size: 17px;
    color: var(--q-chat-acento);
}
.q-chat-windows {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 86px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    justify-content: flex-end;
    pointer-events: none;
}
.q-chat-window {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 310px;
    flex: 0 0 310px;
    height: min(470px, calc(100dvh - 120px));
    min-height: 220px;
    border: 1px solid var(--q-chat-borde);
    border-radius: 18px;
    background: var(--q-chat-panel);
    box-shadow: var(--q-chat-sombra);
    pointer-events: auto;
    overflow: hidden;
}
.q-chat-window-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 65px;
    padding: 11px 9px 11px 12px;
    border-bottom: 1px solid var(--q-chat-borde);
}
.q-chat-window-header .q-chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 12px;
}
.q-chat-window-heading {
    min-width: 0;
    flex: 1;
    cursor: pointer;
}
.q-chat-window-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}
.q-chat-window-subtitle {
    display: block;
    color: var(--q-chat-secundario);
    font-size: 10px;
    margin-top: 2px;
}
.q-chat-window-header .q-chat-icon-button {
    width: 28px;
    height: 32px;
    border-radius: 8px;
}
.q-chat-window-header .q-chat-icon {
    width: 17px;
    height: 17px;
}
.q-chat-mobile-back {
    display: none;
}
.q-chat-window-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    background: var(--q-chat-fondo);
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.q-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.q-chat-date {
    margin: 7px auto;
    padding: 3px 9px;
    color: var(--q-chat-secundario);
    font-size: 10px;
}
.q-chat-bubble {
    align-self: flex-start;
    max-width: 89%;
    padding: 9px 11px 6px;
    border-radius: 13px 13px 13px 4px;
    background: var(--q-chat-panel);
    border: 1px solid var(--q-chat-borde);
    color: inherit;
    min-width: 56px;
}
.q-chat-bubble.is-mine {
    align-self: flex-end;
    background: var(--q-chat-acento);
    color: var(--q-chat-acento-texto);
    border-color: transparent;
    border-radius: 13px 13px 4px 13px;
}
.q-chat-message-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.5;
}
.q-chat-message-meta {
    display: block;
    margin-top: 4px;
    text-align: right;
    font-size: 9px;
    opacity: 1;
    color: var(--q-chat-secundario);
}
.q-chat-bubble.is-mine .q-chat-message-meta {
    color: inherit;
}
.q-chat-compose {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 5px;
    padding: 10px 9px;
    border-top: 1px solid var(--q-chat-borde);
}
.q-chat-input {
    width: 100%;
    min-height: 38px;
    max-height: 104px;
    margin: 0;
    resize: none;
    padding: 9px 10px;
    border: 1px solid var(--q-chat-borde);
    border-radius: 12px;
    background: var(--q-chat-panel);
    color: var(--q-chat-texto);
    font-size: 12px !important;
    line-height: 1.5;
}
.q-chat-input::placeholder {
    color: var(--q-chat-secundario);
}
.q-chat-send {
    background: var(--q-chat-acento);
    color: var(--q-chat-acento-texto);
    height: 38px;
    width: 36px;
    border-radius: 12px;
}
.q-chat-send:hover {
    background: var(--q-chat-acento-hover);
}
.q-chat-alert {
    padding: 9px 12px;
    font-size: 11px;
    color: var(--q-chat-secundario);
    background: var(--q-chat-suave);
    border-top: 1px solid var(--q-chat-borde);
}
.q-chat-error-action {
    margin-left: 5px;
    border: 0;
    padding: 1px;
    background: transparent;
    color: var(--q-chat-acento);
    text-decoration: underline;
    font-size: inherit !important;
}
.q-chat-popup {
    position: absolute;
    top: 57px;
    right: 8px;
    min-width: 210px;
    padding: 6px;
    background: var(--q-chat-panel);
    border: 1px solid var(--q-chat-borde);
    border-radius: 12px;
    box-shadow: var(--q-chat-sombra);
    z-index: 4;
}
.q-chat-popup button {
    display: block;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    text-align: left;
    background: transparent;
    color: var(--q-chat-texto);
    font-size: 12px !important;
}
.q-chat-popup button:hover {
    background: var(--q-chat-suave);
}
.q-chat-popup .is-danger {
    color: var(--q-chat-error);
}
.q-chat-emojis {
    position: absolute;
    bottom: 66px;
    left: 9px;
    right: 9px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    border: 1px solid var(--q-chat-borde);
    border-radius: 14px;
    background: var(--q-chat-panel);
    box-shadow: var(--q-chat-sombra);
    z-index: 5;
}
.q-chat-emojis button {
    width: 100%;
    height: 35px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 23px !important;
}
.q-chat-emojis button:hover {
    background: var(--q-chat-suave);
}
.q-chat-window.is-minimized {
    height: 65px;
    min-height: 0;
}
.q-chat-window.is-minimized > :not(.q-chat-window-header) {
    display: none !important;
}
.q-chat-window.is-minimized .q-chat-window-header {
    border-bottom: 0;
}
.q-chat-window.is-locked .q-chat-compose {
    display: none;
}
.q-chat-window.is-locked .q-chat-window-body {
    display: grid;
    place-items: center;
}
.q-chat-toast {
    position: fixed;
    left: 50%;
    bottom: 92px;
    transform: translateX(-50%);
    max-width: min(470px, calc(100vw - 32px));
    padding: 12px 18px;
    border-radius: 13px;
    background: #14283F;
    color: #fff;
    box-shadow: var(--q-chat-sombra);
    text-align: center;
    z-index: 50;
    font-size: 12px;
}
.q-chat-validating .q-chat-window-body,
.q-chat-validating .q-chat-input,
.q-chat-validating .q-chat-drawer-content {
    visibility: hidden;
}
.q-chat-validating .q-chat-window::after {
    content: 'Verificando acceso…';
    position: absolute;
    inset: 65px 0 0;
    display: grid;
    place-items: center;
    color: var(--q-chat-secundario);
    font-size: 12px;
    background: var(--q-chat-panel);
}
@media (min-width: 761px) {
    .q-chat-windows {
        overflow-x: auto;
        padding: 25px 8px 8px;
        scrollbar-width: thin;
        justify-content: safe flex-end;
    }
    .q-chat-windows::-webkit-scrollbar {
        height: 6px;
    }
    .q-chat-windows::-webkit-scrollbar-thumb {
        border-radius: 9px;
        background: var(--q-chat-borde);
    }
}
@media (max-width: 760px) {
    body.q-chat-mobile-open {
        overflow: hidden;
    }
    .q-chat-launcher {
        right: 17px;
        bottom: calc(87px + env(safe-area-inset-bottom, 0px));
        width: 56px;
        height: 56px;
        min-height: 56px;
        padding: 0;
        border-radius: 19px;
    }
    .q-chat-launcher > .q-chat-launcher-label {
        display: none;
    }
    .q-chat-launcher .q-chat-count {
        position: absolute;
        top: -5px;
        right: -4px;
    }
    body.q-chat-mobile-open .q-chat-launcher {
        display: none;
    }
    .q-chat-drawer {
        inset: var(--q-chat-vv-top, 0px) 0 auto;
        width: 100%;
        height: var(--q-chat-vh, 100dvh);
        max-height: none;
        border: 0;
        border-radius: 0;
    }
    .q-chat-drawer-header {
        padding-top: max(20px, env(safe-area-inset-top));
    }
    .q-chat-drawer-content {
        padding: 10px;
    }
    .q-chat-drawer .q-chat-footer {
        padding-bottom: max(13px, env(safe-area-inset-bottom));
    }
    .q-chat-windows {
        inset: 0;
        display: block;
        pointer-events: none;
    }
    .q-chat-window {
        position: fixed;
        inset: var(--q-chat-vv-top, 0px) 0 auto;
        width: 100%;
        height: var(--q-chat-vh, 100dvh);
        max-height: none;
        min-height: 0;
        border-radius: 0;
        border: 0;
    }
    .q-chat-window[data-active='false'],
    .q-chat-window.is-minimized {
        display: none;
    }
    .q-chat-window-header {
        min-height: 75px;
        padding-top: max(13px, env(safe-area-inset-top));
        gap: 10px;
    }
    .q-chat-window-header .q-chat-avatar {
        width: 39px;
        height: 39px;
    }
    .q-chat-window-name {
        font-size: 14px;
    }
    .q-chat-window-header .q-chat-icon-button {
        width: 35px;
        height: 40px;
    }
    .q-chat-mobile-back {
        display: inline-flex;
    }
    .q-chat-minimize {
        display: none;
    }
    .q-chat-window-body {
        padding: 17px 14px;
    }
    .q-chat-bubble {
        max-width: 84%;
        padding: 11px 13px 7px;
    }
    .q-chat-message-text {
        font-size: 14px;
    }
    .q-chat-message-meta {
        font-size: 10px;
    }
    .q-chat-compose {
        padding: 11px 11px max(11px, env(safe-area-inset-bottom));
        gap: 8px;
    }
    .q-chat-input {
        min-height: 43px;
        font-size: 16px !important;
    }
    .q-chat-compose .q-chat-icon-button {
        width: 40px;
        height: 43px;
    }
    .q-chat-popup {
        top: max(66px, calc(env(safe-area-inset-top) + 59px));
        right: 12px;
    }
    .q-chat-emojis {
        bottom: calc(75px + env(safe-area-inset-bottom));
        grid-template-columns: repeat(7, 1fr);
    }
    .q-chat-emojis button {
        height: 42px;
        font-size: 27px !important;
    }
    .q-chat-toast {
        bottom: calc(95px + env(safe-area-inset-bottom));
    }
}
@media (prefers-reduced-motion: no-preference) {
    .q-chat-primary,
    .q-chat-launcher {
        transition:
            filter 0.15s ease,
            box-shadow 0.15s ease;
    }
}

.q-chat-fullpage-link { display: block; margin-top: 7px; color: var(--q-chat-acento); text-decoration: none; font-weight: 700; }

/* Contraste de los controles y colores del menú cuando está fuera de la raíz del chat. */
.q-chat-primary:hover:not(:disabled),
.q-chat-launcher:hover:not(:disabled) {
    background: var(--q-chat-acento-hover);
}
.q-chat-search::placeholder {
    color: var(--q-chat-secundario);
    opacity: 1;
}
.q-chat-root input:focus,
.q-chat-root textarea:focus {
    border-color: var(--q-chat-acento);
    outline-color: var(--q-chat-acento);
}
[data-theme='dark'] .q-chat-menu {
    color: var(--q-muted, #B1B7C1);
}
[data-theme='dark'] .q-chat-menu:hover {
    background: var(--q-soft, #142E40);
}
[data-theme='dark'] .q-chat-menu-badge {
    background: var(--q-action, #7DD3FC);
    color: #082F49;
}
