/* Chat del panel con la mascota animada de Omnexia. Paleta blanca (app-theme.css); animación igual que nexovant.es. */
.pchat { --omx: #25BCF6; --pc-ink: #0b1b2b; --pc-soft: #3d4e60; --pc-line: #dde5ec; --pc-brand: #0a4f86; font-family: var(--font, 'DM Sans', system-ui, sans-serif); }
.pchat .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.pchat[hidden] { display: none; }

/* Mascota (mismo dibujo y animación que la web de Nexovant) */
.pchat .mascot-figure { position: relative; display: inline-grid; place-items: center; }
.pchat .mascot-figure img { position: relative; z-index: 1; display: block; width: 100%; height: auto; transform-origin: 50% 90%; filter: drop-shadow(0 8px 14px rgba(11, 27, 43, .22)); }
.pchat .mascot-glow { position: absolute; inset: 8% 6% 4%; border-radius: 50%; background: radial-gradient(circle, rgba(37, 188, 246, .55), rgba(37, 188, 246, 0) 68%); filter: blur(10px); opacity: .7; }
@media (prefers-reduced-motion: no-preference) {
  .pchat-launcher .mascot-figure { animation: pc-float 4.5s ease-in-out infinite; }
  .pchat .mascot-figure img { animation: pc-wave 6s ease-in-out infinite; }
  .pchat .mascot-glow { animation: pc-pulse 3.2s ease-in-out infinite; }
  .pchat.is-talking .mascot-glow { animation: pc-talk .45s ease-in-out infinite alternate; }
  .pchat.is-talking .pchat-avatar img { animation: pc-nod .5s ease-in-out infinite alternate; }
  .pchat-typing i { animation: pc-dot 1.1s ease-in-out infinite; }
  .pchat-typing i:nth-child(3) { animation-delay: .15s; } .pchat-typing i:nth-child(4) { animation-delay: .3s; }
  .pchat-panel { animation: pc-in .18s ease-out; }
  .pchat-bubble { animation: pc-in .25s ease-out; }
}
@keyframes pc-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pc-wave { 0%, 82%, 100% { transform: rotate(0); } 86% { transform: rotate(-7deg); } 90% { transform: rotate(6deg); } 94% { transform: rotate(-4deg); } }
@keyframes pc-pulse { 0%, 100% { opacity: .45; transform: scale(.92); } 50% { opacity: .85; transform: scale(1.06); } }
@keyframes pc-talk { from { opacity: .5; transform: scale(.9); } to { opacity: 1; transform: scale(1.18); } }
@keyframes pc-nod { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-2px) rotate(2deg); } }
@keyframes pc-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes pc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Botón flotante */
.pchat-launcher { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 84px; height: 84px; padding: 4px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.pchat-launcher .mascot-figure { width: 76px; }
.pchat-launcher:focus-visible { outline: 3px solid #0a6fa8; outline-offset: 2px; }
.pchat-badge { position: absolute; top: 2px; right: 2px; z-index: 2; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #e5484d; color: #fff; font: 800 12px/22px var(--font, sans-serif); text-align: center; box-shadow: 0 0 0 3px #fff; }
.pchat-badge[hidden] { display: none; }
.pchat-bubble { position: fixed; right: 108px; bottom: 44px; z-index: 60; max-width: 240px; border: 1px solid var(--pc-line); border-radius: 16px 16px 4px 16px; background: #fff; color: var(--pc-ink); padding: 10px 14px; font: 600 14px/1.35 var(--font, sans-serif); text-align: left; box-shadow: 0 14px 34px -16px rgba(11, 27, 43, .4); cursor: pointer; }
.pchat-bubble[hidden] { display: none; }
.pchat-bubble:focus-visible { outline: 3px solid #0a6fa8; outline-offset: 2px; }
.pchat.open .pchat-launcher { transform: scale(.82); transform-origin: bottom right; }

/* Panel */
.pchat-panel { position: fixed; right: 24px; bottom: 108px; z-index: 61; width: min(400px, calc(100vw - 48px)); height: min(680px, calc(100vh - 130px)); display: flex; flex-direction: column; background: #fff; color: var(--pc-ink); border: 1px solid var(--pc-line); border-radius: 20px; box-shadow: 0 24px 60px -24px rgba(11, 27, 43, .45); overflow: hidden; }
.pchat-panel[hidden] { display: none; }
.pchat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f6f8fb; border-bottom: 1px solid var(--pc-line); }
.pchat-avatar { width: 46px; height: 46px; border-radius: 50%; background: #e6f3fa; display: grid; place-items: center; overflow: hidden; flex: none; }
.pchat-avatar .mascot-figure { width: 44px; }
.pchat-title { flex: 1; min-width: 0; display: grid; }
.pchat-title b { font: 800 16px/1.2 var(--display, 'Manrope', sans-serif); }
.pchat-title small { color: var(--pc-soft); font-size: 12px; }
.pchat-close, .pchat-clear { border: 0; background: none; color: var(--pc-soft); cursor: pointer; border-radius: 10px; }
.pchat-close { width: 40px; height: 40px; font-size: 26px; line-height: 1; }
.pchat-clear { font: 600 12px/1 var(--font, sans-serif); padding: 8px; text-decoration: underline; text-underline-offset: 3px; }
.pchat-close:hover, .pchat-clear:hover { background: #e9eef4; color: var(--pc-ink); }
.pchat-close:focus-visible, .pchat-clear:focus-visible, .pchat-log:focus-visible { outline: 3px solid #0a6fa8; outline-offset: -3px; }
.pchat-log { position: relative; flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 10px; background: #fff; overscroll-behavior: contain; }
.pchat-msg { max-width: 88%; font-size: 14px; line-height: 1.45; }
.pchat-msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pchat-msg.bot { align-self: flex-start; }
.pchat-msg.bot > p { background: #f1f5f9; border-radius: 4px 16px 16px 16px; padding: 9px 12px; }
.pchat-msg.me { align-self: flex-end; }
.pchat-msg.me > p { background: var(--pc-brand); color: #fff; border-radius: 16px 4px 16px 16px; padding: 9px 12px; }
.pchat-typing { display: inline-flex; gap: 5px; background: #f1f5f9; border-radius: 4px 16px 16px 16px; padding: 12px 14px; }
.pchat-typing i { width: 7px; height: 7px; border-radius: 50%; background: #6a7f93; display: block; }

/* Tarjetas (idea del día y borradores) */
.pchat-card { margin-top: 6px; border: 1px solid var(--pc-line); border-radius: 14px; padding: 10px 12px; background: #fff; box-shadow: 0 8px 22px -18px rgba(11, 27, 43, .4); }
.pchat-msg.bot > .pchat-card:first-child, .pchat-msg.bot > .sr-only + .pchat-card { margin-top: 0; }
.pchat-eyebrow { font: 800 11px/1 var(--font, sans-serif); letter-spacing: .08em; color: #0a6fa8; margin-bottom: 6px; }
.pchat-ideas { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 3px; font-size: 13px; color: var(--pc-soft); }
.pchat-ideas li.on { color: var(--pc-ink); }
.pchat-ideas li.on b { color: var(--pc-brand); }
.pchat-body { display: grid; grid-template-columns: 104px 1fr; gap: 10px; align-items: start; }
.pchat-body > .pchat-proposal { grid-column: 1 / -1; }
.pchat-msg > .pchat-card > .pchat-media { max-width: 260px; }
/* Imágenes de las tarjetas: siempre enteras (sin recortar), con su proporción natural (también 9:16) y un alto máximo dentro del chat.
   Al tocarlas se abren a tamaño completo. */
.pchat-media { margin: 0; position: relative; border-radius: 10px; overflow: hidden; background: #eef2f6; width: fit-content; max-width: 100%; }
.pchat-media img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(52vh, 380px); object-fit: contain; cursor: zoom-in; }
.pchat-media figcaption { position: absolute; left: 5px; bottom: 5px; background: rgba(255, 255, 255, .94); color: var(--pc-brand); font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.pchat-proposal { margin: 6px 0; padding: 8px 10px; border-radius: 10px; background: #f6fafd; border: 1px dashed #9ec3d6; font-size: 13px; }
.pchat-caption { margin: 0 !important; font-size: 13px; line-height: 1.4; color: var(--pc-ink); white-space: pre-wrap; max-height: 9.8em; overflow: auto; }
.pchat-title-line { display: block; margin-bottom: 4px; }
.pchat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-width: 0; max-width: 100%; }
.pchat-actions > * { max-width: 100%; white-space: normal; text-align: center; line-height: 1.2; box-sizing: border-box; }
.pchat-card, .pchat-msg { min-width: 0; overflow-wrap: anywhere; }
.pchat-card { max-width: 100%; box-sizing: border-box; }
#omx-chat a.pchat-primary, #omx-chat a.pchat-primary:visited, #omx-chat a.pchat-primary:hover, #omx-chat a.pchat-danger, #omx-chat a.pchat-danger:visited, #omx-chat a.pchat-danger:hover { color: #fff; }
.pchat-primary, .pchat-ghost, .pchat-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 999px; font: 700 13px/1 var(--font, sans-serif); cursor: pointer; text-decoration: none; }
.pchat-primary { border: 1px solid var(--pc-brand); background: var(--pc-brand); color: #fff; }
.pchat-primary:hover { background: #083d69; }
.pchat-ghost { border: 1px solid #c9dbe8; background: #fff; color: var(--pc-ink); }
.pchat-ghost:hover { border-color: var(--pc-brand); }
.pchat-link { color: var(--pc-brand); padding: 0; text-decoration: underline; text-underline-offset: 3px; min-height: 30px; }
.pchat-primary:focus-visible, .pchat-ghost:focus-visible, .pchat-link:focus-visible, .pchat-chip:focus-visible, .pchat-send:focus-visible { outline: 3px solid #0a6fa8; outline-offset: 2px; }
.pchat-meta { margin: 6px 0 0 !important; font-size: 12px; color: var(--pc-soft); }

/* Tarjetas de acciones */
.pchat-act.is-confirm { border-color: #9ec3d6; background: #f8fcff; }
.pchat-act.is-danger { border-color: #f1b5ad; background: #fff8f6; }
.pchat-act.is-danger .pchat-eyebrow { color: #b42318; }
.pchat-act.is-upsell .pchat-eyebrow, .pchat-act.is-result .pchat-eyebrow { color: #0f7b4b; }
.pchat-act-img { max-width: min(260px, 100%); margin: 4px 0 2px; }
.pchat-danger { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 999px; font: 700 13px/1 var(--font, sans-serif); cursor: pointer; border: 1px solid #b42318; background: #b42318; color: #fff; }
.pchat-danger:hover { background: #8f1c13; }
.pchat-danger:focus-visible, .pchat-thumb:focus-visible { outline: 3px solid #0a6fa8; outline-offset: 2px; }
.pchat-actions button:disabled { opacity: .45; cursor: default; }
.pchat-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.pchat-thumb { position: relative; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #eef2f6; cursor: pointer; aspect-ratio: 1 / 1; }
.pchat-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pchat-thumb span { position: absolute; left: 4px; top: 4px; min-width: 20px; height: 20px; border-radius: 99px; background: rgba(11, 27, 43, .78); color: #fff; font: 700 11.5px/20px var(--font, sans-serif); text-align: center; }
.pchat-thumb:hover { border-color: var(--pc-brand); }
.pchat-thumb:disabled { opacity: .5; cursor: default; }
.pchat-items { margin: 2px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; }
.pchat-items li { line-height: 1.35; }
.pchat-items small { color: var(--pc-soft); }
.pchat-items .pchat-danger { min-height: 28px; padding: 0 10px; font-size: 12px; margin-left: 6px; }

/* Escritura */
.pchat-error { margin: 0; padding: 6px 12px; color: #b42318; font-size: 13px; background: #fff4f2; }
.pchat-error[hidden] { display: none; }
.pchat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 0; overflow: hidden; }
.pchat-chip { flex: 0 1 auto; max-width: 100%; white-space: normal; text-align: left; line-height: 1.2; border: 1px solid #c9dbe8; background: #fff; color: var(--pc-brand); border-radius: 999px; padding: 7px 12px; font: 600 12.5px/1 var(--font, sans-serif); cursor: pointer; }
.pchat-chip:hover { background: #e6f3fa; }
.pchat-form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; }
.pchat-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; box-sizing: border-box; border: 1px solid rgba(11, 27, 43, .28); border-radius: 14px; padding: 10px 12px; font: 400 15px/1.4 var(--font, sans-serif); color: var(--pc-ink); background: #fff; }
.pchat-form textarea:focus { outline: none; border-color: #0a6fa8; box-shadow: 0 0 0 3px rgba(10, 111, 168, .22); }
.pchat-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--pc-brand); color: #fff; font-size: 17px; cursor: pointer; }
.pchat-send:disabled { opacity: .5; cursor: progress; }
.pchat-hint { margin: 0; padding: 5px 12px 0; font-size: 11.5px; line-height: 1.35; color: #5b6d80; overflow-wrap: anywhere; }
.pchat-hint[hidden] { display: none; }
.pchat-note { margin: 0; padding: 0 12px 10px; font-size: 11px; color: #5b6d80; }

/* Móvil: hoja a pantalla completa */
@media (max-width: 720px) {
  .pchat-launcher { right: 10px; bottom: 10px; width: 66px; height: 66px; }
  .pchat-launcher .mascot-figure { width: 58px; }
  .pchat-bubble { right: 82px; bottom: 26px; max-width: calc(100vw - 100px); }
  .pchat-panel { inset: auto 0 0 0; width: 100%; height: min(88dvh, 760px); border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .pchat.open .pchat-launcher { display: none; }
  .pchat-msg { max-width: 92%; }
  .pchat-form textarea { font-size: 16px; }
  html.pchat-sheet-open, html.pchat-sheet-open body { overflow: hidden; }
}
@media print { .pchat { display: none !important; } }

/* Visor a tamaño completo */
.pchat-lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.pchat-lightbox::backdrop { background: rgba(8, 18, 30, .82); }
.pchat-lightbox img { display: block; max-width: 96vw; max-height: 90vh; width: auto; height: auto; object-fit: contain; border-radius: 10px; background: #fff; }
.pchat-lightbox button { position: absolute; top: -14px; right: -14px; width: 40px; height: 40px; border-radius: 99px; border: 0; background: #fff; color: #10233a; font: 700 22px/1 var(--font, sans-serif); cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.pchat-lightbox button:focus-visible { outline: 3px solid #0a6fa8; outline-offset: 2px; }
@media (max-width: 560px) { .pchat-lightbox button { top: 6px; right: 6px; } }
/* Vídeo en el chat: entero (9:16 incluido), con póster; botón de pantalla completa. */
.pchat-video { position: relative; background: #0b1b2b; }
.pchat-video video { display: block; width: auto; height: auto; max-width: 100%; max-height: min(46vh, 300px); aspect-ratio: auto; object-fit: contain; background: #0b1b2b; }
.pchat-video-full { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 99px; border: 0; background: rgba(255, 255, 255, .92); color: #10233a; font: 700 17px/1 var(--font, sans-serif); cursor: pointer; }
.pchat-video-full:focus-visible { outline: 3px solid #0a6fa8; outline-offset: 2px; }
.pchat-act.is-video .pchat-eyebrow { color: #0f7b4b; }
.pchat-progress-box { display: grid; gap: 6px; margin: 6px 0 2px; }
.pchat-progress { margin: 0 !important; font-size: 13px; color: var(--pc-ink); }
.pchat-progress-bar { display: block; height: 6px; border-radius: 99px; background: #e6edf4; overflow: hidden; }
.pchat-progress-bar i { display: block; height: 100%; width: 5%; background: #0a6fa8; transition: width .6s ease; }
.pchat-actions a.pchat-ghost { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 999px; text-decoration: none; }

/* Contexto del borrador abierto (/borrador) */
.pchat-context { margin: 0; padding: 6px 14px; font-size: 12px; font-weight: 600; color: #0b4f86; background: #e9f4ff; border-bottom: 1px solid #d6e8f8; }
/* Con el chat cargado, la mascota decorativa de la página no se muestra (el botón del chat ya es la mascota) */
html:has(#omx-chat-root:not([hidden])) img.omx-buddy { display: none; }
.pchat-notice { margin: 0; padding: 6px 12px; color: #05603a; font-size: 13px; background: #ecfdf3; }
.pchat-notice[hidden] { display: none; }
