html, body { height: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.error { color: var(--rojo); font-weight: 700; margin: 12px 0 0; }
.ancho { width: 100%; margin-top: 18px; }
.espacio { justify-content: space-between; }

/* Entrada */
.entrada { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.entrada form { width: 100%; max-width: 380px; padding: 28px 24px; box-shadow: var(--sombra); }
.entrada h1 { font-size: 26px; margin: 10px 0 6px; }
.logo-grande { color: var(--tinta); }

/* App */
.app { height: 100%; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: var(--papel-2); }
@media (min-width: 780px) { .app { border-left: 1px solid var(--linea); border-right: 1px solid var(--linea); } }
.cabeza { display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--papel); border-bottom: 1px solid var(--linea); }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--acento); color: var(--acento-tinta); display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; background-size: cover; background-position: center; }
.titulos { flex: 1; min-width: 0; }
.titulos h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#estadoTele { font-size: 13px; font-weight: 600; margin-top: 2px; }
#estadoTele .chip { white-space: nowrap; padding: 2px 10px; }
.cabeza button { padding: 6px 10px; }

.mensajes { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; background: var(--burbuja-otro); box-shadow: 0 1px 2px rgba(0,0,0,.06); white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { display: block; font-size: 12px; font-weight: 600; color: var(--tinta-2); margin-top: 4px; text-align: right; }
.msg.cliente { align-self: flex-end; background: var(--burbuja-yo); border-bottom-right-radius: 4px; }
.msg.agente, .msg.soporte { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.soporte .quien { display: block; font-size: 13px; font-weight: 800; color: var(--acento); margin-bottom: 2px; }
.msg.sistema { align-self: center; background: var(--acento-suave); color: var(--tinta); font-size: 14px; font-weight: 600; text-align: center; box-shadow: none; }
.msg.sistema.ok { background: var(--verde-suave); }
.msg .fotos { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.msg .fotos img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; }

.propuesta { width: 100%; max-width: 520px; white-space: normal; }
.propuesta .pantallita { margin: 10px 0; }
.propuesta .acciones { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.propuesta .acciones button { width: 100%; }
.propuesta .resumen { font-size: 14px; color: var(--tinta-2); font-weight: 600; margin-top: 2px; }

.escribiendo { align-self: flex-start; display: flex; align-items: center; gap: 10px; color: var(--tinta-2); font-weight: 600; font-size: 14px; }
.puntos i { display: inline-block; width: 8px; height: 8px; margin: 0 2px; border-radius: 50%; background: var(--tinta-2); animation: salto 1.2s infinite ease-in-out; }
.puntos i:nth-child(2) { animation-delay: .15s; } .puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes salto { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-4px); } }

.bienvenida { white-space: normal; }
.ejemplos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ejemplos button { min-height: 38px; font-size: 14px; font-weight: 600; border-radius: 999px; background: var(--papel-2); }

.redactar { background: var(--papel); border-top: 1px solid var(--linea); padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.editando { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--acento-suave); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.adjuntos { display: flex; gap: 8px; margin-bottom: 8px; overflow-x: auto; }
.adjuntos .mini { position: relative; flex: none; }
.adjuntos img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; }
.adjuntos button { position: absolute; top: -6px; right: -6px; min-height: 24px; width: 24px; padding: 0; border-radius: 50%; font-size: 14px; }
.caja-mensaje { display: flex; align-items: flex-end; gap: 8px; }
.caja-mensaje textarea { resize: none; max-height: 140px; border-radius: 22px; padding: 11px 16px; }
.clip { margin: 0; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--tinta-2); cursor: pointer; }
.clip:hover { background: var(--papel-2); }
.enviar { width: 48px; height: 48px; padding: 0; border-radius: 50%; flex: none; }

.hoja { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.hoja-caja { background: var(--papel); width: 100%; max-width: 760px; border-radius: 18px 18px 0 0; padding: 18px 16px 24px; max-height: 92vh; overflow-y: auto; }
.hoja h2 { font-size: 18px; }
.hoja .pantallita { margin-top: 14px; }
.info-teles { margin-top: 14px; display: grid; gap: 8px; }
.info-teles .tele { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--papel-2); border: 1px solid var(--linea); }
.info-teles code { font-size: 15px; font-weight: 700; }
