/* Chat asesor de PickySaaS. Usa los colores del tema con valores de respaldo. */
.psc-chat { position: fixed; right: 16px; bottom: 16px; z-index: 900; font-family: var(--f-texto, system-ui, sans-serif); font-size: 15px; line-height: 1.45; color: var(--tinta, #172033); }
.psc-chat *, .psc-chat *::before, .psc-chat *::after { box-sizing: border-box; }

.psc-chat__boton { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--rojo, #c8102e); color: #fff; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 2px 4px rgba(23, 32, 51, .15), 0 8px 24px rgba(23, 32, 51, .18); }
.psc-chat__boton:hover { background: var(--rojo-hover, #a30c25); }
.psc-chat__boton:focus-visible, .psc-chat__cerrar:focus-visible, .psc-chat__enviar:focus-visible, .psc-chat__chip:focus-visible, .psc-chat__enlace:focus-visible, .psc-chat textarea:focus-visible { outline: 3px solid var(--enlace, #1d4ed8); outline-offset: 2px; }
.psc-chat--abierto .psc-chat__boton { display: none; }

.psc-chat__panel { display: flex; flex-direction: column; width: 380px; max-width: calc(100vw - 32px); height: min(620px, calc(100dvh - 32px)); background: var(--blanco, #fff); border: 1px solid var(--linea, #d8dcd6); border-radius: 12px; box-shadow: 0 4px 12px rgba(23, 32, 51, .12), 0 16px 40px rgba(23, 32, 51, .18); overflow: hidden; }
.psc-chat__panel[hidden] { display: none; }

.psc-chat__cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; background: var(--tinta, #172033); color: #fff; }
.psc-chat__cab strong { font-family: var(--f-titulo, Georgia, serif); font-size: 1.05rem; font-weight: 600; }
.psc-chat__acciones { display: flex; align-items: center; gap: 10px; }
.psc-chat__enlace { background: none; border: 0; padding: 4px; color: #dfe4ee; font: inherit; font-size: .8125rem; text-decoration: underline; cursor: pointer; }
.psc-chat__cerrar { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.psc-chat__cerrar:hover { background: rgba(255, 255, 255, .14); }

.psc-chat__aviso { margin: 0; padding: 8px 14px; background: var(--papel-2, #eef0ec); color: var(--grafito, #586176); font-size: .8125rem; border-bottom: 1px solid var(--linea, #d8dcd6); }
.psc-chat__aviso a { color: var(--enlace, #1d4ed8); }

.psc-chat__registro { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--papel, #f6f7f5); }
.psc-chat__msg { max-width: 92%; padding: 9px 12px; border-radius: 10px; overflow-wrap: anywhere; }
.psc-chat__msg p { margin: 0 0 .55em; }
.psc-chat__msg p:last-child, .psc-chat__msg ul:last-child { margin-bottom: 0; }
.psc-chat__msg ul { margin: 0 0 .55em; padding-left: 1.2em; }
.psc-chat__msg a { color: var(--enlace, #1d4ed8); text-decoration: underline; }
.psc-chat__msg--bot { align-self: flex-start; background: var(--blanco, #fff); border: 1px solid var(--linea, #d8dcd6); }
.psc-chat__msg--yo { align-self: flex-end; background: var(--tinta, #172033); color: #fff; }
.psc-chat__msg--espera { color: var(--grafito, #586176); font-style: italic; }

.psc-chat__sugerencias { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 10px; background: var(--papel, #f6f7f5); }
.psc-chat__sugerencias[hidden] { display: none; }
.psc-chat__chip { text-align: left; padding: 8px 12px; border: 1px solid var(--linea-fuerte, #b9bfb7); border-radius: 8px; background: var(--blanco, #fff); color: inherit; font: inherit; font-size: .875rem; cursor: pointer; }
.psc-chat__chip:hover { border-color: var(--rojo, #c8102e); }

.psc-chat__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--linea, #d8dcd6); background: var(--blanco, #fff); }
.psc-chat__form textarea { flex: 1 1 auto; resize: none; min-height: 40px; max-height: 110px; padding: 9px 10px; border: 1px solid var(--linea-fuerte, #b9bfb7); border-radius: 8px; font: inherit; color: inherit; background: #fff; }
.psc-chat__enviar { flex: 0 0 auto; min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--rojo, #c8102e); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.psc-chat__enviar:hover { background: var(--rojo-hover, #a30c25); }
.psc-chat__enviar:disabled { opacity: .55; cursor: default; }

@media (max-width: 520px) {
	.psc-chat { right: 12px; bottom: 12px; }
	.psc-chat__boton-texto { display: none; }
	.psc-chat__boton { width: 52px; height: 52px; padding: 0; justify-content: center; }
	.psc-chat__panel { position: fixed; inset: 8px; width: auto; max-width: none; height: auto; }
}
@media (prefers-reduced-motion: no-preference) {
	.psc-chat__panel { animation: psc-chat-in .16s ease-out; }
	@keyframes psc-chat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media print { .psc-chat { display: none; } }

/* Captura de datos dentro del chat */
.psc-chat__tarjeta { align-self: stretch; padding: 12px; background: var(--blanco, #fff); border: 1px solid var(--linea-fuerte, #b9bfb7); border-left: 4px solid var(--rojo, #c8102e); border-radius: 8px; }
.psc-chat__tarjeta p { margin: 0 0 10px; }
.psc-chat__fila { display: flex; flex-wrap: wrap; gap: 8px; }
.psc-chat__secundario { min-height: 40px; padding: 0 14px; border: 1px solid var(--linea-fuerte, #b9bfb7); border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.psc-chat__secundario:hover { border-color: var(--tinta, #172033); }
.psc-chat__lead { display: flex; flex-direction: column; gap: 10px; }
.psc-chat__campo { display: flex; flex-direction: column; gap: 3px; font-size: .8125rem; color: var(--grafito, #586176); }
.psc-chat__campo input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--linea-fuerte, #b9bfb7); border-radius: 8px; font: inherit; font-size: .9375rem; color: var(--tinta, #172033); background: #fff; }
.psc-chat__casilla { display: flex; align-items: flex-start; gap: 8px; font-size: .8125rem; color: var(--tinta, #172033); }
.psc-chat__casilla input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; }
.psc-chat__casilla a { color: var(--enlace, #1d4ed8); }
.psc-chat__error { margin: 0; padding: 8px 10px; background: var(--no-fondo, #fbe9ec); color: var(--no, #a30c25); border-radius: 6px; font-size: .8125rem; }
.psc-chat__error[hidden] { display: none; }
.psc-chat__trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.psc-chat__lead input:focus-visible, .psc-chat__secundario:focus-visible { outline: 3px solid var(--enlace, #1d4ed8); outline-offset: 2px; }

/* Cabecera en dos filas: título y cerrar arriba, enlaces debajo */
.psc-chat__cab { flex-wrap: wrap; row-gap: 4px; }
.psc-chat__cab strong { order: 0; flex: 1 1 auto; }
.psc-chat__acciones { display: contents; }
.psc-chat__cerrar { order: 1; }
.psc-chat__cab::after { content: ''; order: 2; flex-basis: 100%; height: 0; }
.psc-chat__enlace { order: 3; padding: 2px 0; margin-right: 14px; white-space: nowrap; }
