/* =====================================================================
   BURBUJA DE LEXIA (assets/lexia_burbuja.js): boton flotante abajo a la derecha y panel de chat
   Marca: azul #2a6ad6 -> #163d82 -> #0c2350, amarillo #ffd34d (como la cabecera de Soporte)
   ===================================================================== */
.lx-w { --lx-a: #2a6ad6; --lx-b: #163d82; --lx-c: #0c2350; --lx-y: #ffd34d; --lx-linea: #e3e8f2; --lx-t: #0f172a; --lx-t2: #5b6478;
  position: fixed; right: 16px; bottom: 68px; z-index: 1046; font-family: var(--ws-fuente, inherit); color: var(--lx-t); }
.lx-w *, .lx-w *::before, .lx-w *::after { box-sizing: border-box; }
.lx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Sobre la barra lateral del chat (escritorio) y el boton de accesibilidad */
@media (min-width: 992px) { html body.lxc-con-barra .lx-w { right: 66px; } }
@media (max-width: 991.98px) {
  html body.ws .lx-w { bottom: 16px; }
  html body:not(.ws) .lx-w { bottom: calc(124px + env(safe-area-inset-bottom)); }
}
html body.bl-abierto .lx-w { opacity: 0; pointer-events: none; }
html.lx-abierto .lx-w { z-index: 1085; }

/* Boton */
.lx-btn { position: relative; width: 58px; height: 58px; border: 0; border-radius: 50%; padding: 0; cursor: pointer; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, #4f8bf0 0, var(--lx-a) 35%, var(--lx-b) 75%, var(--lx-c) 100%);
  box-shadow: 0 12px 26px -8px rgb(12 35 80 / .55), 0 0 0 3px rgb(255 255 255 / .9); transition: transform .18s ease; }
.lx-btn:hover { transform: translateY(-2px) scale(1.04); }
.lx-btn:focus-visible { outline: 3px solid var(--lx-y); outline-offset: 3px; }
.lx-cabeza { width: 44px; height: 32px; margin-top: 2px; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .25)); animation: lxFlota 3.2s ease-in-out 3; }
.lx-ojos { animation: lxParpadea 5s infinite; transform-origin: 150px 112px; }
.lx-chispa { position: absolute; top: 5px; right: 7px; width: 9px; height: 9px; background: var(--lx-y); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.lx-n { position: absolute; top: -4px; left: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e11d48; color: #fff;
  font: 700 .72rem/22px var(--ws-fuente, inherit); text-align: center; box-shadow: 0 0 0 2px #fff; }
.lx-n[hidden] { display: none; }
@keyframes lxFlota { 50% { transform: translateY(-3px); } }
@keyframes lxParpadea { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.15); } }

/* Saludo del dia */
.lx-globo { position: absolute; right: 68px; bottom: 8px; width: max-content; max-width: min(280px, calc(100vw - 100px)); padding: 10px 30px 10px 14px; border-radius: 16px 16px 4px 16px;
  background: #fff; color: var(--lx-t); font-size: .9rem; line-height: 1.4; font-weight: 600; cursor: pointer; border: 1px solid var(--lx-linea);
  box-shadow: 0 14px 30px -12px rgb(12 35 80 / .45); animation: lxEntra .3s ease-out; }
.lx-globo::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 16px 0 0 4px; background: linear-gradient(var(--lx-y), var(--lx-a)); }
.lx-globo[hidden] { display: none; }
.lx-globo-x { position: absolute; top: 3px; right: 5px; border: 0; background: none; color: var(--lx-t2); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; }
@keyframes lxEntra { from { opacity: 0; transform: translateY(6px); } }

/* Panel */
.lx-panel { position: absolute; right: 0; bottom: 70px; width: min(390px, calc(100vw - 24px)); height: min(600px, calc(100vh - 160px)); height: min(600px, calc(100dvh - 160px)); min-height: 340px;
  display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 18px; border: 1px solid var(--lx-linea);
  box-shadow: 0 28px 64px -20px rgb(12 35 80 / .5); animation: lxEntra .2s ease-out; }
.lx-panel[hidden] { display: none; }
.lx-cab { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; color: #fff; flex: none;
  background: linear-gradient(120deg, var(--lx-c), var(--lx-b) 55%, var(--lx-a)); position: relative; }
.lx-cab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--lx-y), transparent 70%); }
.lx-av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgb(255 255 255 / .14); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .3); }
.lx-av-svg { width: 32px; height: 23px; }
.lx-cab-t { flex: 1; min-width: 0; }
.lx-cab-t strong { display: block; font-size: 1rem; letter-spacing: .01em; }
.lx-cab-t small { display: block; font-size: .74rem; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-cab-acc { display: flex; gap: 2px; }
.lx-cab-acc > * { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: #fff !important; display: inline-grid; place-items: center; cursor: pointer; font-size: .88rem; text-decoration: none !important; }
.lx-cab-acc > *:hover, .lx-cab-acc > *:focus-visible { background: rgb(255 255 255 / .18); outline: none; }
.lx-cab-acc > [hidden] { display: none; }
.lx-cuerpo { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain;
  background: #f3f6fb linear-gradient(180deg, rgb(42 106 214 / .05), transparent 140px); }

/* Mensajes */
.lx-m { display: flex; gap: 6px; align-items: flex-end; max-width: 92%; }
.lx-m.yo { align-self: flex-end; }
.lx-m-av { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--lx-a), var(--lx-c)); }
.lx-m-svg { width: 20px; height: 14px; }
.lx-m-b { min-width: 0; padding: 8px 11px; border-radius: 14px 14px 14px 4px; background: #fff; border: 1px solid var(--lx-linea); font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.lx-m.yo .lx-m-b { background: var(--lx-b); border-color: transparent; color: #fff; border-radius: 14px 14px 4px 14px; }
.lx-m.yo .lx-m-b a { color: #fff; }
.lx-m-b p { margin: 0 0 6px; } .lx-m-b p:last-child { margin-bottom: 0; }
.lx-m-b ol, .lx-m-b ul { margin: 4px 0 6px; padding-left: 20px; }
.lx-m-b img.lx-inl { max-width: 100%; border-radius: 8px; display: block; margin: 4px 0; }
.lx-quien { display: block; font-size: .68rem; font-weight: 700; color: var(--lx-a); margin-bottom: 2px; }
.lx-hora { display: block; text-align: right; font-size: .64rem; opacity: .65; margin-top: 3px; }
.lx-m.sis { align-self: center; max-width: 100%; }
.lx-m.sis span { font-size: .7rem; color: var(--lx-t2); background: rgb(15 23 42 / .05); padding: 3px 10px; border-radius: 999px; text-align: center; }
.lx-adjs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lx-adjs a { font-size: .78rem; color: inherit; }
.lx-adjs img { max-width: 140px; max-height: 110px; border-radius: 8px; display: block; object-fit: cover; }
.lx-tema { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #fff; border: 1px solid var(--lx-linea); font-size: .84rem; }
.lx-tema b { min-width: 0; overflow-wrap: anywhere; }
.lx-chip { flex: none; font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eef2f7; color: #475569; }
.lx-chip.info { background: #e0ecff; color: #1d4ed8; } .lx-chip.warn { background: #fff4d1; color: #8a5a00; } .lx-chip.ok { background: #dcfce7; color: #166534; } .lx-chip.err { background: #fee2e2; color: #b91c1c; }
.lx-estado { font-size: .82rem; padding: 8px 10px; border-radius: 12px; background: #eef4ff; color: #1e3a8a; }
.lx-estado.warn { background: #fff7db; color: #7a4f00; }
.lx-estado.ok { background: #e8f8ee; color: #14532d; }
.lx-estado .lx-pie-acc { margin-top: 8px; }
.lx-sol { font-size: .82rem; padding: 8px 10px; border-radius: 12px; background: #fff; border: 1px dashed #9fb6e3; }
.lx-nota { margin: 0; font-size: .76rem; color: var(--lx-t2); text-align: center; }
.lx-nota a { color: var(--lx-a); }
.lx-limite { font-size: .76rem; line-height: 1.35; padding: 7px 10px; border-radius: 10px; background: #fff8dc; color: #6b4e00; border: 1px solid #f5dd8a; }
.lx-aviso { align-self: center; font-size: .8rem; padding: 7px 12px; border-radius: 10px; background: #fee2e2; color: #991b1b; }
.lx-aviso.ok { background: #dcfce7; color: #166534; }
.lx-cargando { display: flex; gap: 5px; justify-content: center; padding: 30px 0; }
.lx-cargando span { width: 8px; height: 8px; border-radius: 50%; background: var(--lx-a); opacity: .35; animation: lxPunto 1s infinite; }
.lx-cargando span:nth-child(2) { animation-delay: .15s; } .lx-cargando span:nth-child(3) { animation-delay: .3s; }
@keyframes lxPunto { 50% { opacity: 1; transform: translateY(-3px); } }

/* Sugerencias, categorias, listas */
.lx-sugs, .lx-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.lx-cats small, .lx-otras small { width: 100%; font-size: .72rem; color: var(--lx-t2); font-weight: 600; }
.lx-sug { border: 1px solid #c9d7f2; background: #fff; color: var(--lx-b); border-radius: 999px; padding: 6px 11px; font: 600 .78rem/1.2 var(--ws-fuente, inherit); cursor: pointer; }
.lx-sug:hover, .lx-sug:focus-visible { background: #eef4ff; outline: none; border-color: var(--lx-a); }
.lx-sug[aria-pressed="true"] { background: var(--lx-b); color: #fff; border-color: var(--lx-b); }
.lx-otras { display: grid; gap: 6px; }
.lx-fila-t { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 1px solid var(--lx-linea); background: #fff; border-radius: 12px; padding: 8px 10px; cursor: pointer; font: inherit; color: inherit; }
.lx-fila-t:hover { border-color: #9fb6e3; }
.lx-fila-t > span:first-child { flex: 1; min-width: 0; }
.lx-fila-t b { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-fila-t small { display: block; font-size: .7rem; color: var(--lx-t2); }
.lx-fila-t.nueva { border-color: var(--lx-a); box-shadow: inset 3px 0 0 var(--lx-a); }
.lx-fila-n { font-style: normal; min-width: 20px; height: 20px; border-radius: 999px; background: #e11d48; color: #fff; font-size: .68rem; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; }
.lx-ir { display: flex; width: max-content; max-width: 100%; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 999px; background: var(--lx-y); color: var(--lx-c) !important; font-weight: 700; font-size: .8rem; text-decoration: none !important; }
.lx-ir:hover { filter: brightness(.96); }
.lx-mini { display: inline-block; margin-top: 6px; font-size: .76rem; color: var(--lx-a); }
.lx-datos { list-style: none; padding: 0 !important; margin: 0 !important; display: grid; gap: 4px; }
.lx-datos i { width: 16px; color: var(--lx-a); }
.lx-buscar { display: flex; gap: 6px; margin-top: 8px; }
.lx-buscar input { flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid #c9d7f2; border-radius: 999px; font: inherit; font-size: .84rem; }
.lx-buscar input:focus { outline: none; border-color: var(--lx-a); box-shadow: 0 0 0 3px rgb(42 106 214 / .15); }
.lx-buscar button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--lx-b); color: #fff; cursor: pointer; flex: none; }
.lx-ficha { margin-top: 8px; padding: 9px 10px; border-radius: 12px; background: #f6f9ff; border: 1px solid #dbe5f7; }
.lx-ficha > b { display: block; color: var(--lx-c); }
.lx-ficha p { margin: 4px 0; font-size: .8rem; color: #334155; }
.lx-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .74rem; color: var(--lx-t2); }
.lx-meta i { color: var(--lx-a); }
.lx-ficha details { margin-top: 4px; font-size: .78rem; }
.lx-ficha summary { cursor: pointer; color: var(--lx-a); font-weight: 600; }
.lx-ficha .lx-ir { margin-top: 6px; }
.lx-datosf { display: grid; gap: 7px; margin-top: 8px; }
.lx-datosf label { display: grid; gap: 3px; font-size: .74rem; font-weight: 600; color: var(--lx-t2); }
.lx-datosf input { height: 34px; padding: 0 10px; border: 1px solid #c9d7f2; border-radius: 9px; font: inherit; font-size: .86rem; color: var(--lx-t); min-width: 0; width: 100%; }
.lx-datosf input:focus { outline: none; border-color: var(--lx-a); box-shadow: 0 0 0 3px rgb(42 106 214 / .15); }
.lx-trampa { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.lx-estrellas { display: flex; gap: 2px; margin: 6px 0; }
.lx-estrellas button { border: 0; background: none; font-size: 1.5rem; line-height: 1; color: #cbd5e1; cursor: pointer; padding: 0 2px; }
.lx-estrellas button.on { color: #f5b400; }
.lx-com { width: 100%; border: 1px solid #c9d7f2; border-radius: 9px; padding: 6px 9px; font: inherit; font-size: .84rem; resize: vertical; }

/* Pie: campo para escribir */
.lx-pie { flex: none; border-top: 1px solid var(--lx-linea); background: #fff; padding: 8px; }
.lx-pie:empty, .lx-pie[hidden] { display: none; }
.lx-pie-acc { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.lx-prim, .lx-sec { border: 0; border-radius: 999px; padding: 8px 14px; font: 700 .8rem/1.2 var(--ws-fuente, inherit); cursor: pointer; text-decoration: none !important; display: inline-flex; align-items: center; gap: 6px; }
.lx-prim { background: var(--lx-b); color: #fff !important; }
.lx-prim:hover { background: var(--lx-c); }
.lx-sec { background: #eef2f7; color: #334155 !important; }
.lx-prim:disabled { opacity: .6; cursor: wait; }
.lx-form { display: grid; gap: 6px; }
.lx-fila { display: flex; align-items: flex-end; gap: 4px; }
.lx-fila textarea { flex: 1; min-width: 0; min-height: 38px; max-height: 120px; resize: none; padding: 9px 12px; border: 1px solid #c9d7f2; border-radius: 19px; font: 500 .88rem/1.35 var(--ws-fuente, inherit); color: var(--lx-t); background: #f8faff; }
.lx-fila textarea:focus { outline: none; border-color: var(--lx-a); background: #fff; box-shadow: 0 0 0 3px rgb(42 106 214 / .12); }
.lx-ico { width: 36px; height: 38px; border: 0; background: none; color: var(--lx-t2); display: inline-grid; place-items: center; cursor: pointer; border-radius: 50%; flex: none; margin: 0; }
.lx-ico:hover { color: var(--lx-a); background: #eef4ff; }
.lx-env { width: 38px; height: 38px; border: 0; border-radius: 50%; background: linear-gradient(135deg, var(--lx-a), var(--lx-b)); color: #fff; cursor: pointer; flex: none; }
.lx-env:disabled { opacity: .55; cursor: wait; }
.lx-form.enviando .lx-env i { animation: lxPunto 1s infinite; }
.lx-urge { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--lx-t2); padding-left: 6px; cursor: pointer; }
.lx-tira { display: flex; flex-wrap: wrap; gap: 6px; }
.lx-tira[hidden] { display: none; }
.lx-adj { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 170px; padding: 4px 24px 4px 4px; border: 1px solid var(--lx-linea); border-radius: 10px; background: #f8faff; font-size: .72rem; }
.lx-adj img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; }
.lx-adj small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-adj button { position: absolute; top: 2px; right: 3px; border: 0; background: none; font-size: 16px; line-height: 1; cursor: pointer; color: var(--lx-t2); }

/* Celular: panel a pantalla completa */
@media (max-width: 600px) {
  .lx-panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-height: none; min-height: 0; border-radius: 0; border: 0; z-index: 1085; }
  html.lx-abierto, html.lx-abierto body { overflow: hidden; }
  html.lx-abierto .lx-btn, html.lx-abierto .lx-globo { visibility: hidden; }
  html.lx-abierto .ax-btn, html.lx-abierto .ax-panel, html.lx-abierto .lxc-fab { visibility: hidden; }
  .lx-cab { padding-top: calc(10px + env(safe-area-inset-top)); }
  .lx-pie { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .lx-fila textarea { font-size: 16px; }   /* sin zoom automatico al escribir en iOS */
  .lx-datosf input, .lx-buscar input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .lx-cabeza, .lx-ojos, .lx-globo, .lx-panel, .lx-cargando span, .lx-form.enviando .lx-env i { animation: none !important; }
  .lx-btn { transition: none; }
}

/* En las pantallas de diseno de tramites ya esta el panel de LexIA arquitecta: la burbuja de soporte no se muestra */
html.lxa-presente .lx-w { display: none !important; }
