/* Asistente de Personeros — burbuja flotante. Todo prefijado .cbt- */
.cbt-fab {
    position: fixed; right: 18px; bottom: 18px; z-index: 9998;
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.1rem; border: 0; border-radius: 999px; cursor: pointer;
    background: #1a365d; color: #fff; font: 600 .95rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    box-shadow: 0 6px 20px rgba(0,0,0,.28);
}
.cbt-fab:hover { background: #2c5282; }
.cbt-fab-icon { font-size: 1.15rem; }
.cbt-fab[aria-expanded="true"] { display: none; }

.cbt-panel {
    position: fixed; right: 18px; bottom: 18px; z-index: 9999;
    width: 380px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 36px);
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0,0,0,.3);
    font: 400 .94rem/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: #1f2933;
}
.cbt-panel[hidden] { display: none; }

.cbt-head {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .85rem 1rem; background: #1a365d; color: #fff;
}
.cbt-head strong { display: block; font-size: .98rem; }
.cbt-sub { font-size: .76rem; opacity: .8; }
.cbt-head-acciones { display: flex; gap: .25rem; }
.cbt-icon {
    background: transparent; border: 0; color: #fff; cursor: pointer;
    font-size: 1.05rem; line-height: 1; padding: .35rem .5rem; border-radius: 8px;
}
.cbt-icon:hover { background: rgba(255,255,255,.18); }

.cbt-mensajes { flex: 1; overflow-y: auto; padding: 1rem; background: #f6f8fb; }
.cbt-msg { max-width: 86%; margin-bottom: .7rem; padding: .6rem .8rem; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cbt-bot  { background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 4px; }
.cbt-user { background: #1a365d; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.cbt-msg a { color: inherit; text-decoration: underline; }
.cbt-bot a { color: #2c5282; }
.cbt-error { background: #fff5f5; border-color: #feb2b2; color: #822727; }

.cbt-escribiendo { display: inline-flex; gap: 4px; padding: .7rem .85rem; }
.cbt-escribiendo i { width: 6px; height: 6px; border-radius: 50%; background: #a0aec0; animation: cbt-bounce 1.1s infinite; }
.cbt-escribiendo i:nth-child(2) { animation-delay: .15s; }
.cbt-escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes cbt-bounce { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

.cbt-rapidos { display: flex; flex-wrap: wrap; gap: .35rem; padding: .6rem .75rem; border-top: 1px solid #e2e8f0; background: #fff; }
.cbt-chip {
    border: 1px solid #cbd5e0; background: #fff; color: #2c5282;
    border-radius: 999px; padding: .3rem .7rem; font-size: .8rem; cursor: pointer;
}
.cbt-chip:hover { background: #ebf4ff; border-color: #2c5282; }

.cbt-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid #e2e8f0; background: #fff; }
.cbt-form input {
    flex: 1; min-width: 0; padding: .6rem .8rem; font-size: 16px; /* 16px evita el zoom en iOS */
    border: 1px solid #cbd5e0; border-radius: 999px; outline: none;
}
.cbt-form input:focus { border-color: #2c5282; box-shadow: 0 0 0 3px rgba(44,82,130,.15); }
.cbt-form button {
    width: 42px; flex: 0 0 42px; border: 0; border-radius: 50%;
    background: #1a365d; color: #fff; font-size: 1rem; cursor: pointer;
}
.cbt-form button:disabled { opacity: .5; cursor: default; }

/* En celular ocupa toda la pantalla: se usa de pie y con una mano. */
@media (max-width: 560px) {
    .cbt-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .cbt-fab { right: 14px; bottom: 14px; }
}

/* Variante embebida (página pública): ocupa el contenedor, sin flotar. */
.cbt-embed .cbt-panel {
    position: static; width: 100%; max-width: 100%; height: 72vh; min-height: 460px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12); border-radius: 14px;
}
.cbt-embed .cbt-fab { display: none; }
